From eacd44278733eea025109ee0fe1420e450bda882 Mon Sep 17 00:00:00 2001 From: Thomas Thurman Date: Tue, 29 Apr 2008 02:54:56 +0000 Subject: [PATCH] documentation 2008-04-29 Thomas Thurman * src/ui/fixedtip.[ch]: documentation svn path=/trunk/; revision=3697 --- ChangeLog | 4 ++++ src/ui/fixedtip.c | 20 ++++++++++++++++++++ src/ui/fixedtip.h | 37 +++++++++++++++++++++++++++++++++++-- 3 files changed, 59 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7d934b2dd..b531569a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-04-29 Thomas Thurman + + * src/ui/fixedtip.[ch]: documentation + 2008-04-27 Thomas Thurman * configure.in: Post-release bump to 2.23.21. diff --git a/src/ui/fixedtip.c b/src/ui/fixedtip.c index a1470224c..b4c5203c9 100644 --- a/src/ui/fixedtip.c +++ b/src/ui/fixedtip.c @@ -25,9 +25,29 @@ #include "fixedtip.h" #include "ui.h" +/** + * The floating rectangle. This is a GtkWindow, and it contains + * the "label" widget, below. + */ static GtkWidget *tip = NULL; + +/** + * The actual text that gets displayed. + */ static GtkWidget *label = NULL; +/* + * X coordinate of the right-hand edge of the screen. + * + * \bug This appears to be a bug; screen_right_edge is calculated only when + * the window is redrawn. Actually we should never cache it because + * different windows are different sizes. + */ static int screen_right_edge = 0; +/* + * Y coordinate of the bottom edge of the screen. + * + * \bug As with screen_right_edge. + */ static int screen_bottom_edge = 0; static gint diff --git a/src/ui/fixedtip.h b/src/ui/fixedtip.h index 3b3e6fffe..c196389d2 100644 --- a/src/ui/fixedtip.h +++ b/src/ui/fixedtip.h @@ -1,7 +1,5 @@ /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ -/* Metacity fixed tooltip routine */ - /* * Copyright (C) 2001 Havoc Pennington * @@ -21,15 +19,50 @@ * 02111-1307, USA. */ +/** + * \file fixedtip.h Metacity fixed tooltip routine + * + * Sometimes we want to display a small floating rectangle with helpful + * text near the pointer. For example, if the user holds the mouse over + * the maximise button, we can display a tooltip saying "Maximize". + * The text is localised, of course. + * + * This file contains the functions to create and delete these tooltips. + * + * \todo Since we now consider MetaDisplay a singleton, there can be + * only one tooltip per display; this might quite simply live in + * display.c. Alternatively, it could move to frames.c, which + * is the only place this business is called anyway. + * + * \todo Apparently some UI needs changing (check bugzilla) + */ + #ifndef META_FIXED_TIP_H #define META_FIXED_TIP_H #include #include +/** + * Displays a tooltip. There can be only one across the entire system. + * This function behaves identically whether or not a tooltip is already + * displayed, but if it is the window will be reused rather than destroyed + * and recreated. + * + * \param xdisplay An X display. + * \param screen_number The number of the screen. + * \param root_x The X coordinate where the tooltip should appear + * \param root_y The Y coordinate where the tooltip should appear + * \param markup_text Text to display in the tooltip; can contain markup + */ void meta_fixed_tip_show (Display *xdisplay, int screen_number, int root_x, int root_y, const char *markup_text); + +/** + * Removes the tooltip that was created by meta_fixed_tip_show(). If there + * is no tooltip currently visible, this is a no-op. + */ void meta_fixed_tip_hide (void);