Mercurial > emacs
comparison src/gtkutil.c @ 97056:bda3c99f1515
(menu_nav_ended): Revert change from 2008-07-24.
(create_menus): Connect selection-done to menu_nav_ended.
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Mon, 28 Jul 2008 07:15:34 +0000 |
parents | 8a07ea5be91d |
children | 984f2ac5a637 |
comparison
equal
deleted
inserted
replaced
97055:bf2d011df79a | 97056:bda3c99f1515 |
---|---|
2137 } | 2137 } |
2138 | 2138 |
2139 return w; | 2139 return w; |
2140 } | 2140 } |
2141 | 2141 |
2142 /* Callback called when keyboard traversal (started by x-menu-bar-open) ends. | |
2143 WMENU is the menu for which traversal has been done. DATA points to the | |
2144 frame for WMENU. We must release grabs, some bad interaction between GTK | |
2145 and Emacs makes the menus keep the grabs. */ | |
2146 | |
2147 static void | |
2148 menu_nav_ended (wmenu, data) | |
2149 GtkMenuShell *wmenu; | |
2150 gpointer data; | |
2151 { | |
2152 FRAME_PTR f = (FRAME_PTR) data; | |
2153 | |
2154 if (FRAME_X_OUTPUT (f)->menubar_widget) | |
2155 { | |
2156 GtkMenuShell *w = GTK_MENU_SHELL (FRAME_X_OUTPUT (f)->menubar_widget); | |
2157 Display *dpy = FRAME_X_DISPLAY (f); | |
2158 | |
2159 BLOCK_INPUT; | |
2160 gtk_menu_shell_deactivate (w); | |
2161 gtk_menu_shell_deselect (w); | |
2162 | |
2163 XUngrabKeyboard (dpy, CurrentTime); | |
2164 XUngrabPointer (dpy, CurrentTime); | |
2165 UNBLOCK_INPUT; | |
2166 } | |
2167 } | |
2168 | |
2169 | |
2142 static GtkWidget *create_menus P_ ((widget_value *, FRAME_PTR, GCallback, | 2170 static GtkWidget *create_menus P_ ((widget_value *, FRAME_PTR, GCallback, |
2143 GCallback, GCallback, int, int, int, | 2171 GCallback, GCallback, int, int, int, |
2144 GtkWidget *, xg_menu_cb_data *, char *)); | 2172 GtkWidget *, xg_menu_cb_data *, char *)); |
2145 | 2173 |
2146 /* Create a full menu tree specified by DATA. | 2174 /* Create a full menu tree specified by DATA. |
2201 "leave-notify-event", | 2229 "leave-notify-event", |
2202 G_CALLBACK (menuitem_highlight_callback), | 2230 G_CALLBACK (menuitem_highlight_callback), |
2203 NULL); | 2231 NULL); |
2204 } | 2232 } |
2205 else wmenu = gtk_menu_bar_new (); | 2233 else wmenu = gtk_menu_bar_new (); |
2234 | |
2235 /* Fix up grabs after keyboard traversal ends. */ | |
2236 g_signal_connect (G_OBJECT (wmenu), | |
2237 "selection-done", | |
2238 G_CALLBACK (menu_nav_ended), | |
2239 f); | |
2206 | 2240 |
2207 /* Put cl_data on the top menu for easier access. */ | 2241 /* Put cl_data on the top menu for easier access. */ |
2208 cl_data = make_cl_data (cl_data, f, highlight_cb); | 2242 cl_data = make_cl_data (cl_data, f, highlight_cb); |
2209 g_object_set_data (G_OBJECT (wmenu), XG_FRAME_DATA, (gpointer)cl_data); | 2243 g_object_set_data (G_OBJECT (wmenu), XG_FRAME_DATA, (gpointer)cl_data); |
2210 g_signal_connect (G_OBJECT (wmenu), "destroy", | 2244 g_signal_connect (G_OBJECT (wmenu), "destroy", |