Re: RFC: Tooltips redesign (needed e.g. for row dependent tips in treeview)

On Fri, 2004-10-29 at 02:00 +0200, Soeren Sandmann wrote:

> >     typedef enum { GTK_TOOLTIPS_MOUSE, GTK_TOOLTIPS_KEYBOARD } GtkTooltipsContext;
> > 
> >     void gtk_tooltips_window_begin (GtkTooltipsWindow *window,
> >                                     GtkTooltipsContext context,
> >                                     GObject           *owner);
> >     void gtk_tooltips_window_end   (GtkTooltipsWindow *window,
> >                                     GtkTooltipsContext context,
> >                                     GObject           *owner);
> The exact positon of tooltips should probably depend on the mouse
> cursor. Eg., you probably don't want the tooltip popping up directly
> under the mouse cursor. Maybe replace these functions with

I think GtkTooltipsWindow can XQueryPointer() for the mouse position
when the timeout expires and it decides to put up a window. Otherwise,
the application would have to feed it a new position on every motion.

> >     void gtk_tooltips_window_set_area   (GtkTooltipsWindow  *window,
> >                                          GtkTooltipsContext  context,
> >                                          GdkWindow          *relative_to,
> >                                          int x, int y, 
> >                                          int width, int height);
> Shouldn't this function have an owner parameter? 

Yeah, it should.

> Also, what good are
> the width/height parameters? I don't see how they can be useful.

The point of window,x,y,width,height is the area of the object to
which the tooltip refers. The tooltip would be placed completely 
clear of this area. (As it is placed to avoid widgets today.)

> But I don't really think this function is sufficent if you want to
> take mouse position into account. What about
>     typedef void (* GtkTooltipPositionFunc) (GObject *owner,
>                                              GdkEvent *event,
>                                              gpointer data);
>     gtk_tooltips_window_set_position_func (GtkTooltipsWindow      *window,
>                                            GObject                *owner,
>                                            GtkTooltipPositionFunc  func,
>                                            gpointer                data);
> instead?

Do you think XQueryPointer() plus a rectangle for the widget area is
insufficient? I don't want everybody to have to write their own
position function if it's always the same thing.

(The position function would have to get a bunch more stuff passed
in. Ah. You interpreted gtk_tooltips_window_set_area() as "set the
area of the tooltip", not "the area of the object being tooltipped)

> Finally, I could see it being useful putting general widgets into the
> tooltip window, so the API shouldn't rule that out (I don't think it
> does currently).

Yeah, the possibility is pretty much open with this API. The one problem
is that you always have to create the tooltips widget even if the
tooltip never fires. Perhaps some sort of signal on GtkTooltipsWindow
to enable lazily creating the widget would be useful if we added


Attachment: signature.asc
Description: This is a digitally signed message part

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]