diff options
| author | Po Lu | 2021-11-30 13:55:16 +0800 |
|---|---|---|
| committer | Po Lu | 2021-11-30 13:55:16 +0800 |
| commit | 72d223a5445831d681a1fbc6f23370cef5252cd3 (patch) | |
| tree | 96dadfdf4a7639a999dc315b50458d94950e9780 /src | |
| parent | b3277883f35c5ac9980b4ef05dc99fa8b5ce6792 (diff) | |
| download | emacs-72d223a5445831d681a1fbc6f23370cef5252cd3.tar.gz emacs-72d223a5445831d681a1fbc6f23370cef5252cd3.zip | |
Enable shallow menu bar updates on PGTK
* src/gtkutil.c (menu_bar_button_pressed_cb): New function.
(create_menus): Connect button press event signal.
* src/pgtkmenu.c (set_frame_menubar): Allow shallow updates.
Diffstat (limited to 'src')
| -rw-r--r-- | src/gtkutil.c | 18 | ||||
| -rw-r--r-- | src/pgtkmenu.c | 4 |
2 files changed, 18 insertions, 4 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c index c2b33912efb..d872d393caf 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -3141,6 +3141,20 @@ xg_create_one_menuitem (widget_value *item, | |||
| 3141 | return w; | 3141 | return w; |
| 3142 | } | 3142 | } |
| 3143 | 3143 | ||
| 3144 | #ifdef HAVE_PGTK | ||
| 3145 | static gboolean | ||
| 3146 | menu_bar_button_pressed_cb (GtkWidget *widget, GdkEvent *event, | ||
| 3147 | gpointer user_data) | ||
| 3148 | { | ||
| 3149 | struct frame *f = user_data; | ||
| 3150 | |||
| 3151 | if (event->button.button < 4) | ||
| 3152 | set_frame_menubar (f, true); | ||
| 3153 | |||
| 3154 | return false; | ||
| 3155 | } | ||
| 3156 | #endif | ||
| 3157 | |||
| 3144 | /* Create a full menu tree specified by DATA. | 3158 | /* Create a full menu tree specified by DATA. |
| 3145 | F is the frame the created menu belongs to. | 3159 | F is the frame the created menu belongs to. |
| 3146 | SELECT_CB is the callback to use when a menu item is selected. | 3160 | SELECT_CB is the callback to use when a menu item is selected. |
| @@ -3198,6 +3212,10 @@ create_menus (widget_value *data, | |||
| 3198 | else | 3212 | else |
| 3199 | { | 3213 | { |
| 3200 | wmenu = gtk_menu_bar_new (); | 3214 | wmenu = gtk_menu_bar_new (); |
| 3215 | #ifdef HAVE_PGTK | ||
| 3216 | g_signal_connect (G_OBJECT (wmenu), "button-press-event", | ||
| 3217 | G_CALLBACK (menu_bar_button_pressed_cb), f); | ||
| 3218 | #endif | ||
| 3201 | /* Set width of menu bar to a small value so it doesn't enlarge | 3219 | /* Set width of menu bar to a small value so it doesn't enlarge |
| 3202 | a small initial frame size. The width will be set to the | 3220 | a small initial frame size. The width will be set to the |
| 3203 | width of the frame later on when it is added to a container. | 3221 | width of the frame later on when it is added to a container. |
diff --git a/src/pgtkmenu.c b/src/pgtkmenu.c index 88020c3044b..6f8f8720ded 100644 --- a/src/pgtkmenu.c +++ b/src/pgtkmenu.c | |||
| @@ -297,10 +297,6 @@ set_frame_menubar (struct frame *f, bool deep_p) | |||
| 297 | if (!menubar_widget) | 297 | if (!menubar_widget) |
| 298 | deep_p = true; | 298 | deep_p = true; |
| 299 | 299 | ||
| 300 | /* Since button_event handler in pgtk emacs doesn't handle mouse | ||
| 301 | * events in menubars, the menu needs to be built now. */ | ||
| 302 | deep_p = true; | ||
| 303 | |||
| 304 | if (deep_p) | 300 | if (deep_p) |
| 305 | { | 301 | { |
| 306 | struct buffer *prev = current_buffer; | 302 | struct buffer *prev = current_buffer; |