diff --git a/ChangeLog b/ChangeLog index e301d0d260..20a6be25d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Wed May 15 17:12:50 2002 Owen Taylor + + * gtk/gtktooltips.c: Special case menu items to + pop down on motion. (#75961) + + * tests/testgtk.c (create_item_factory): Add tooltips + to the File menu. + + * gtk/gtkentry.c (update_im_cursor_location): Fix + cursor locations passed to the IM context. + (#80027, Yao Zhang) + Wed May 15 16:52:57 2002 Owen Taylor * gtk/gtkfontsel.c: Update from contents of size entry diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e301d0d260..20a6be25d7 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,15 @@ +Wed May 15 17:12:50 2002 Owen Taylor + + * gtk/gtktooltips.c: Special case menu items to + pop down on motion. (#75961) + + * tests/testgtk.c (create_item_factory): Add tooltips + to the File menu. + + * gtk/gtkentry.c (update_im_cursor_location): Fix + cursor locations passed to the IM context. + (#80027, Yao Zhang) + Wed May 15 16:52:57 2002 Owen Taylor * gtk/gtkfontsel.c: Update from contents of size entry diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index e301d0d260..20a6be25d7 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,15 @@ +Wed May 15 17:12:50 2002 Owen Taylor + + * gtk/gtktooltips.c: Special case menu items to + pop down on motion. (#75961) + + * tests/testgtk.c (create_item_factory): Add tooltips + to the File menu. + + * gtk/gtkentry.c (update_im_cursor_location): Fix + cursor locations passed to the IM context. + (#80027, Yao Zhang) + Wed May 15 16:52:57 2002 Owen Taylor * gtk/gtkfontsel.c: Update from contents of size entry diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index e301d0d260..20a6be25d7 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,15 @@ +Wed May 15 17:12:50 2002 Owen Taylor + + * gtk/gtktooltips.c: Special case menu items to + pop down on motion. (#75961) + + * tests/testgtk.c (create_item_factory): Add tooltips + to the File menu. + + * gtk/gtkentry.c (update_im_cursor_location): Fix + cursor locations passed to the IM context. + (#80027, Yao Zhang) + Wed May 15 16:52:57 2002 Owen Taylor * gtk/gtkfontsel.c: Update from contents of size entry diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index e301d0d260..20a6be25d7 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,15 @@ +Wed May 15 17:12:50 2002 Owen Taylor + + * gtk/gtktooltips.c: Special case menu items to + pop down on motion. (#75961) + + * tests/testgtk.c (create_item_factory): Add tooltips + to the File menu. + + * gtk/gtkentry.c (update_im_cursor_location): Fix + cursor locations passed to the IM context. + (#80027, Yao Zhang) + Wed May 15 16:52:57 2002 Owen Taylor * gtk/gtkfontsel.c: Update from contents of size entry diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index e301d0d260..20a6be25d7 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,15 @@ +Wed May 15 17:12:50 2002 Owen Taylor + + * gtk/gtktooltips.c: Special case menu items to + pop down on motion. (#75961) + + * tests/testgtk.c (create_item_factory): Add tooltips + to the File menu. + + * gtk/gtkentry.c (update_im_cursor_location): Fix + cursor locations passed to the IM context. + (#80027, Yao Zhang) + Wed May 15 16:52:57 2002 Owen Taylor * gtk/gtkfontsel.c: Update from contents of size entry diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 5200bf2165..35554e4aa4 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -2367,11 +2367,11 @@ update_im_cursor_location (GtkEntry *entry) GdkRectangle area; gint strong_x; gint strong_xoffset; - gint x, y, area_width, area_height; + gint area_width, area_height; gtk_entry_get_cursor_locations (entry, CURSOR_STANDARD, &strong_x, NULL) ; - get_text_area_size (entry, &x, &y, &area_width, &area_height); + get_text_area_size (entry, NULL, NULL, &area_width, &area_height); strong_xoffset = strong_x - entry->scroll_offset; if (strong_xoffset < 0) @@ -2382,9 +2382,9 @@ update_im_cursor_location (GtkEntry *entry) { strong_xoffset = area_width; } - area.x = x + strong_xoffset; - area.y = y + area_height; - area.width = area_width; + area.x = strong_xoffset; + area.y = 0; + area.width = 0; area.height = area_height; gtk_im_context_set_cursor_location (entry->im_context, &area); diff --git a/gtk/gtktooltips.c b/gtk/gtktooltips.c index 6f37438e92..20bc1fec64 100644 --- a/gtk/gtktooltips.c +++ b/gtk/gtktooltips.c @@ -30,6 +30,7 @@ #include "gtklabel.h" #include "gtkmain.h" +#include "gtkmenuitem.h" #include "gtkwidget.h" #include "gtkwindow.h" #include "gtksignal.h" @@ -518,6 +519,31 @@ stop_keyboard_mode (GtkWidget *widget) } } +static void +gtk_tooltips_start_delay (GtkTooltips *tooltips, + GtkWidget *widget) +{ + GtkTooltipsData *old_tips_data; + + old_tips_data = tooltips->active_tips_data; + if (tooltips->enabled && + (!old_tips_data || old_tips_data->widget != widget)) + { + guint delay; + + gtk_tooltips_set_active_widget (tooltips, widget); + + if (tooltips->use_sticky_delay && + gtk_tooltips_recently_shown (tooltips)) + delay = STICKY_DELAY; + else + delay = tooltips->delay; + tooltips->timer_tag = gtk_timeout_add (delay, + gtk_tooltips_timeout, + (gpointer) tooltips); + } +} + static void gtk_tooltips_event_handler (GtkWidget *widget, GdkEvent *event) @@ -559,29 +585,11 @@ gtk_tooltips_event_handler (GtkWidget *widget, switch (event->type) { - case GDK_MOTION_NOTIFY: case GDK_EXPOSE: /* do nothing */ break; - case GDK_ENTER_NOTIFY: - old_tips_data = tooltips->active_tips_data; - if (tooltips->enabled && - (!old_tips_data || old_tips_data->widget != widget)) - { - guint delay; - - gtk_tooltips_set_active_widget (tooltips, widget); - - if (tooltips->use_sticky_delay && - gtk_tooltips_recently_shown (tooltips)) - delay = STICKY_DELAY; - else - delay = tooltips->delay; - tooltips->timer_tag = gtk_timeout_add (delay, - gtk_tooltips_timeout, - (gpointer) tooltips); - } + gtk_tooltips_start_delay (tooltips, widget); break; case GDK_LEAVE_NOTIFY: @@ -595,6 +603,17 @@ gtk_tooltips_event_handler (GtkWidget *widget, } break; + case GDK_MOTION_NOTIFY: + /* Handle menu items specially ... pend popup for each motion + * on other widgets, we ignore motion. + */ + if (GTK_IS_MENU_ITEM (widget)) + { + gtk_tooltips_set_active_widget (tooltips, NULL); + gtk_tooltips_start_delay (tooltips, widget); + break; + } + break; /* ignore */ case GDK_BUTTON_PRESS: case GDK_BUTTON_RELEASE: case GDK_KEY_PRESS: diff --git a/tests/testgtk.c b/tests/testgtk.c index 62c8036089..2baf054e86 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -3598,6 +3598,7 @@ create_item_factory (GtkWidget *widget) GtkWidget *button; GtkAccelGroup *accel_group; GtkItemFactory *item_factory; + GtkTooltips *tooltips; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); @@ -3628,6 +3629,23 @@ create_item_factory (GtkWidget *widget) "/Preferences/Shape/Oval")), TRUE); + /* Test how tooltips (ugh) work on menu items + */ + tooltips = gtk_tooltips_new (); + g_object_ref (tooltips); + gtk_object_sink (GTK_OBJECT (tooltips)); + g_object_set_data_full (G_OBJECT (window), "testgtk-tooltips", + tooltips, (GDestroyNotify)g_object_unref); + + gtk_tooltips_set_tip (tooltips, gtk_item_factory_get_item (item_factory, "/File/New"), + "Create a new file", NULL); + gtk_tooltips_set_tip (tooltips, gtk_item_factory_get_item (item_factory, "/File/Open"), + "Open a file", NULL); + gtk_tooltips_set_tip (tooltips, gtk_item_factory_get_item (item_factory, "/File/Save"), + "Safe file", NULL); + gtk_tooltips_set_tip (tooltips, gtk_item_factory_get_item (item_factory, "/File/Save As..."), + "Save under a new name", NULL); + box1 = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (window), box1);