Re: The new tooltips API in 5 minutes [Was: Re: Whats coming in GTK+ 2.12, continued]
On Sat, Jun 16, 2007 at 12:18:34AM +0100, Damon Chaplin wrote: Is has-tooltip needed for anything besides the efficiency issue? (e.g. a11y or something?) In order for the tooltips implementation to work, we need to monitor motion and related events on the widget's windows. When has-tooltip is set to TRUE it will also modify the event masks of the widget's windows to monitor these events. If we drop this property we would always have to modify event masks of a widget's window, regardless whether it will show tooltips or not -- I am not sure if that is wished. regards, -kris. ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: The new tooltips API in 5 minutes [Was: Re: Whats coming in GTK+ 2.12, continued]
On Mon, 25 Jun 2007, Kristian Rietveld wrote: On Mon, Jun 25, 2007 at 09:34:56PM +0100, Damon Chaplin wrote: Tim said we get motion hints everywhere now anyway (though I can't see where that is done in the code). See the last paragraph here: http://mail.gnome.org/archives/gtk-devel-list/2007-March/msg00230.html I don't think Tim was talking about GTK+ in general in that paragraph, but I am not sure either. right, i was referring to the tooltip system automatically setting the neccessary motion event masks, and why that is required, in response to Damon's suggestion to let the users take care of it. recap: - setting up event masks is too hard for users - GtkTooltip forcefully requests motion events on the right window - GtkTooltip needs to know *when* to force motion events, for this, we need ::has-tooltip. -kris. --- ciaoTJ ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: The new tooltips API in 5 minutes [Was: Re: Whats coming in GTK+ 2.12, continued]
On Sat, 2007-06-16 at 01:59 +0200, Tim Janik wrote: On Sat, 16 Jun 2007, Damon Chaplin wrote: On Fri, 2007-06-15 at 11:25 +0200, Tim Janik wrote: please read Kris' description again. if you set ::tooltip-markup, ::has-tooltip is set automatically, and you don't need to worry about it. this is *not* the case if you connect to ::query-tooltip and possibly return TRUE. there is no way for gtk to tell this kind of setup and querying every widget would be excessively expensive, so we need the user to set ::has-tooltip here. We discussed it before. I said that query-tooltip should really only be emitted just before a tooltip is shown, and you agreed. If that is done the efficiency problem disappears, doesn't it? i'm not sure it does (on every machine). worst case, there would be widget_tree_height signal emissions for each pixel the mouse pointer moves or at least 20 times a second if we reduce querying to 50ms intervalls. I guess you're talking about the time after the initial tooltip has appeared, when other tooltips appear immediately as the user moves the mouse around. (By they way, the docs for query-tooltip don't mention this case, so need updating a bit.) Efficiency-wise it seems comparable to how mouse motion events are propagated up the hierarchy. It shouldn't really be a problem. Damon ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: The new tooltips API in 5 minutes [Was: Re: Whats coming in GTK+ 2.12, continued]
On Thu, 14 Jun 2007, Damon Chaplin wrote: On Tue, 2007-06-12 at 13:59 +0200, Kristian Rietveld wrote: 2. When you need a tooltip with a little more fancy contents, like adding an image, or you want the tooltip to have different contents per GtkTreeView row or cell, you will have to do a little more work: - Set the has-tooltip property on GtkWidget to TRUE, this will make GTK+ monitor the widget for motion and related events which are needed to determine when and where to show a tooltip. I still think this is unnecessary and clutters the API - it can be determined automatically from the other settings. Can't we get rid of it? please read Kris' description again. if you set ::tooltip-markup, ::has-tooltip is set automatically, and you don't need to worry about it. this is *not* the case if you connect to ::query-tooltip and possibly return TRUE. there is no way for gtk to tell this kind of setup and querying every widget would be excessively expensive, so we need the user to set ::has-tooltip here. Damon --- ciaoTJ ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: The new tooltips API in 5 minutes [Was: Re: Whats coming in GTK+ 2.12, continued]
On Thu, 14 Jun 2007, BJörn Lindqvist wrote: On 6/12/07, Kristian Rietveld [EMAIL PROTECTED] wrote: On Sun, Jun 10, 2007 at 10:38:44AM +0200, Murray Cumming wrote: There's also a new GtkTooltip object. Could we have some more information about how this should be used and if it replaces any existing API, please? Sure ;) As Matthias pointed out in one of his other mails, GTK+ 2.12 has a brand-new API for doing tooltips, replacing the aging GtkTooltips object. There are several ways for showing tooltips using the new API, increasing in complexity as the complexity of the wished tooltip increases: A new API called GtkTooltip replaces an API called GtkTooltips? Seems like that could become very confusing.. especially when using two or more GtkTooltips. Couldn't you have came up with something a little more imaginative? :) no. widget names are not optimized to be imanginative, they are optimized to be descriptive. so users can build up a good understanding of gtk instead of a fancy useless picture of it. since these names are about one component replacing the other, you ideally only use GtkTooltips or GtkTooltip exclusively at any point in time in your code, so there is no long-term clash or confusion. if not, upgrade your code to GtkTooltip *now* ;) -- mvh Björn --- ciaoTJ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: The new tooltips API in 5 minutes [Was: Re: Whats coming in GTK+ 2.12, continued]
On Tue, 2007-06-12 at 13:59 +0200, Kristian Rietveld wrote: 1. If everything you need is a tooltip displaying a simple text string, with or without Pango markup, the only thing you have to do is just setting the tooltip-markup property. just a small add-on, fresh from the commit factory: the tooltip-markup property now has a sister called tooltip-text, which will set the tooltip as plain text, escaping the eventual markup entities; if you're setting tooltips on widgets from external data sources (file names, desktop entries, whatever) you won't have to pass through g_markup_escape_text() first. both the tooltip-markup and the tooltip-text properties also have accessors. finally, along with gtk_tooltip_set_markup() mentioned below, now there's a gtk_tooltip_set_text() as well. kudos to kris for implementing this rocking API for tooltips: it was sorely needed and he did a wonderful job. if you're coming to GUADEC this year, be sure to buy kris a pint! ciao, Emmanuele. -- Emmanuele Bassi, http://www.gnome.org/~ebassi ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: The new tooltips API in 5 minutes [Was: Re: Whats coming in GTK+ 2.12, continued]
On Fri, 2007-06-15 at 11:25 +0200, Tim Janik wrote: On Thu, 14 Jun 2007, Damon Chaplin wrote: On Tue, 2007-06-12 at 13:59 +0200, Kristian Rietveld wrote: 2. When you need a tooltip with a little more fancy contents, like adding an image, or you want the tooltip to have different contents per GtkTreeView row or cell, you will have to do a little more work: - Set the has-tooltip property on GtkWidget to TRUE, this will make GTK+ monitor the widget for motion and related events which are needed to determine when and where to show a tooltip. I still think this is unnecessary and clutters the API - it can be determined automatically from the other settings. Can't we get rid of it? please read Kris' description again. if you set ::tooltip-markup, ::has-tooltip is set automatically, and you don't need to worry about it. this is *not* the case if you connect to ::query-tooltip and possibly return TRUE. there is no way for gtk to tell this kind of setup and querying every widget would be excessively expensive, so we need the user to set ::has-tooltip here. We discussed it before. I said that query-tooltip should really only be emitted just before a tooltip is shown, and you agreed. If that is done the efficiency problem disappears, doesn't it? Is has-tooltip needed for anything besides the efficiency issue? (e.g. a11y or something?) Damon ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: The new tooltips API in 5 minutes [Was: Re: Whats coming in GTK+ 2.12, continued]
On Sat, 16 Jun 2007, Damon Chaplin wrote: On Fri, 2007-06-15 at 11:25 +0200, Tim Janik wrote: please read Kris' description again. if you set ::tooltip-markup, ::has-tooltip is set automatically, and you don't need to worry about it. this is *not* the case if you connect to ::query-tooltip and possibly return TRUE. there is no way for gtk to tell this kind of setup and querying every widget would be excessively expensive, so we need the user to set ::has-tooltip here. We discussed it before. I said that query-tooltip should really only be emitted just before a tooltip is shown, and you agreed. If that is done the efficiency problem disappears, doesn't it? i'm not sure it does (on every machine). worst case, there would be widget_tree_height signal emissions for each pixel the mouse pointer moves or at least 20 times a second if we reduce querying to 50ms intervalls. Damon --- ciaoTJ ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: The new tooltips API in 5 minutes [Was: Re: Whats coming in GTK+ 2.12, continued]
On 6/12/07, Kristian Rietveld [EMAIL PROTECTED] wrote: On Sun, Jun 10, 2007 at 10:38:44AM +0200, Murray Cumming wrote: There's also a new GtkTooltip object. Could we have some more information about how this should be used and if it replaces any existing API, please? Sure ;) As Matthias pointed out in one of his other mails, GTK+ 2.12 has a brand-new API for doing tooltips, replacing the aging GtkTooltips object. There are several ways for showing tooltips using the new API, increasing in complexity as the complexity of the wished tooltip increases: [blah blah] Would be nice if this could be in some the tutorial or something. -- my place on the web: floss-and-misc.blogspot.com ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: The new tooltips API in 5 minutes [Was: Re: Whats coming in GTK+ 2.12, continued]
On 6/12/07, Kristian Rietveld [EMAIL PROTECTED] wrote: On Sun, Jun 10, 2007 at 10:38:44AM +0200, Murray Cumming wrote: There's also a new GtkTooltip object. Could we have some more information about how this should be used and if it replaces any existing API, please? Sure ;) As Matthias pointed out in one of his other mails, GTK+ 2.12 has a brand-new API for doing tooltips, replacing the aging GtkTooltips object. There are several ways for showing tooltips using the new API, increasing in complexity as the complexity of the wished tooltip increases: A new API called GtkTooltip replaces an API called GtkTooltips? Seems like that could become very confusing.. especially when using two or more GtkTooltips. Couldn't you have came up with something a little more imaginative? :) -- mvh Björn ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: The new tooltips API in 5 minutes [Was: Re: Whats coming in GTK+ 2.12, continued]
quote who=BJörn Lindqvist A new API called GtkTooltip replaces an API called GtkTooltips? Seems like that could become very confusing.. especially when using two or more GtkTooltips. Couldn't you have came up with something a little more imaginative? :) Perhaps GtkTooltipEx? GtkTooltippr? Haw haw. :-) - Jeff -- Ubuntu Live 2007: Portland, OR, USA http://www.ubuntulive.com/ Laughter is a force for democracy. - John Cleese ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: The new tooltips API in 5 minutes [Was: Re: Whats coming in GTK+ 2.12, continued]
Kristian Rietveld wrote: [snip] In the GTK+ source code you will find a test app testing all of the above methods in gtk+/tests/testtooltips.c. There are examples for simple tooltips on buttons (also insensitive buttons!), tooltips on GtkTreeView rows, tooltips on GtkTextView tags and a small example with tooltips on specific areas of a GtkDrawingArea. (Yes, I know the tree view example is a little broken -- it will be fixed RSN). Tooltips do not show at all here. Sometimes, when I put mouse over a colored rectangle or label text, and then move mouse away, tooltip shows up for a fraction of second. It's fresh Gtk from today svn. And I didn't break it! Selection in the treeview is blue, so it indeed gets focus. Tooltips are working in gtk-demo's main application window. Best regards, Yevgen ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: The new tooltips API in 5 minutes [Was: Re: Whats coming in GTK+ 2.12, continued]
On Tue, 2007-06-12 at 13:59 +0200, Kristian Rietveld wrote: On Sun, Jun 10, 2007 at 10:38:44AM +0200, Murray Cumming wrote: There's also a new GtkTooltip object. Could we have some more information about how this should be used and if it replaces any existing API, please? Sure ;) As Matthias pointed out in one of his other mails, GTK+ 2.12 has a brand-new API for doing tooltips, replacing the aging GtkTooltips object. So could we deprecate GtkTooltips with #ifdefs and gtk-doc comments? Thanks for the great overview. There are several ways for showing tooltips using the new API, increasing in complexity as the complexity of the wished tooltip increases: 1. If everything you need is a tooltip displaying a simple text string, with or without Pango markup, the only thing you have to do is just setting the tooltip-markup property. 2. When you need a tooltip with a little more fancy contents, like adding an image, or you want the tooltip to have different contents per GtkTreeView row or cell, you will have to do a little more work: - Set the has-tooltip property on GtkWidget to TRUE, this will make GTK+ monitor the widget for motion and related events which are needed to determine when and where to show a tooltip. - Connect to the query-tooltip signal on GtkWidget. This signal will be emitted when a tooltip will have to be shown. The signature is: gboolean (* query_tooltip) (GtkWidget *widget, gintx, ginty, gbooleankeyboard_tooltip, GtkTooltip *tooltip); The arguments are pretty much straightforward, and here we see where the new GtkTooltip object comes to play. The GtkTooltip is the object that we are about to display as a tooltip, and can be manipulated in your query-tooltip callback using functions like: void gtk_tooltip_set_icon (GtkTooltip *tooltip, GdkPixbuf *pixbuf); there are likewise functions for setting the tooltip's markup, setting an image from a stock icon or even for putting in a custom widget. Important is the return value of query-tooltip: when you return TRUE the GtkTooltip will be shown, when you return FALSE it will not be shown. 3. In the, probably, rare case where you want to have even more control over the tooltip that is about to be shown, you can set your own GtkWindow which will be used as tooltip window. This works as follows: - Set has-tooltip and connect to query-tooltip as under 2). - Use gtk_widget_set_tooltip_window() to set a GtkWindow created by you as tooltip window. - In the query-tooltip callback you can access your GtkWindow using gtk_widget_get_tooltip_window() and manipulate as you wish. The semantics of the return value of query-tooltip are exactly the same as with 2): TRUE will show the tooltip window, FALSE will not show it. In the GTK+ source code you will find a test app testing all of the above methods in gtk+/tests/testtooltips.c. There are examples for simple tooltips on buttons (also insensitive buttons!), tooltips on GtkTreeView rows, tooltips on GtkTextView tags and a small example with tooltips on specific areas of a GtkDrawingArea. (Yes, I know the tree view example is a little broken -- it will be fixed RSN). Some small details are still left to be worked out; think of improving tooltips positioning, probably popup-tooltip-directly-on-demand and at some later stage greater flexibility and customizability. Watch gtk-devel-list for the latest news ;) I hope this gives you enough information to get started! regards, -kris. ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list -- Murray Cumming [EMAIL PROTECTED] www.murrayc.com www.openismus.com ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list