diff options
| author | Po Lu | 2022-03-10 09:12:59 +0800 |
|---|---|---|
| committer | Po Lu | 2022-03-10 09:13:08 +0800 |
| commit | 70d63ead212b7ca1e561b869d44fddb14d0445af (patch) | |
| tree | 629ae71e2641c4c166b26df0f4be48c272f10616 /src | |
| parent | 2353893bd04bfee7c7659a758cf7c5072121a90c (diff) | |
| download | emacs-70d63ead212b7ca1e561b869d44fddb14d0445af.tar.gz emacs-70d63ead212b7ca1e561b869d44fddb14d0445af.zip | |
Fix menu bar event detection on XI2 builds using Core Input
* src/gtkutil.c (xg_get_gdk_scale): Always return 1 on GTK+ 2.
(xg_event_is_for_menubar): Fix some ifdefs.
* src/xterm.c (handle_one_xevent): Update a comment.
Diffstat (limited to 'src')
| -rw-r--r-- | src/gtkutil.c | 6 | ||||
| -rw-r--r-- | src/xterm.c | 9 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c index bf95c966421..2a647810886 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -266,6 +266,7 @@ xg_display_open (char *display_name, GdkDisplay **dpy) | |||
| 266 | static int | 266 | static int |
| 267 | xg_get_gdk_scale (void) | 267 | xg_get_gdk_scale (void) |
| 268 | { | 268 | { |
| 269 | #ifdef HAVE_GTK3 | ||
| 269 | const char *sscale = getenv ("GDK_SCALE"); | 270 | const char *sscale = getenv ("GDK_SCALE"); |
| 270 | 271 | ||
| 271 | if (sscale) | 272 | if (sscale) |
| @@ -274,6 +275,7 @@ xg_get_gdk_scale (void) | |||
| 274 | if (0 < scale) | 275 | if (0 < scale) |
| 275 | return min (scale, INT_MAX); | 276 | return min (scale, INT_MAX); |
| 276 | } | 277 | } |
| 278 | #endif | ||
| 277 | 279 | ||
| 278 | return 1; | 280 | return 1; |
| 279 | } | 281 | } |
| @@ -4223,13 +4225,13 @@ xg_event_is_for_menubar (struct frame *f, const XEvent *event) | |||
| 4223 | } | 4225 | } |
| 4224 | else | 4226 | else |
| 4225 | { | 4227 | { |
| 4226 | #else | 4228 | #endif |
| 4227 | rec.x = event->xbutton.x / scale; | 4229 | rec.x = event->xbutton.x / scale; |
| 4228 | rec.y = event->xbutton.y / scale; | 4230 | rec.y = event->xbutton.y / scale; |
| 4229 | #endif | ||
| 4230 | #ifdef HAVE_XINPUT2 | 4231 | #ifdef HAVE_XINPUT2 |
| 4231 | } | 4232 | } |
| 4232 | #endif | 4233 | #endif |
| 4234 | |||
| 4233 | rec.width = 1; | 4235 | rec.width = 1; |
| 4234 | rec.height = 1; | 4236 | rec.height = 1; |
| 4235 | 4237 | ||
diff --git a/src/xterm.c b/src/xterm.c index 68f7588af4a..0d77ea0c198 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -11652,11 +11652,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 11652 | 11652 | ||
| 11653 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) | 11653 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) |
| 11654 | f = x_menubar_window_to_frame (dpyinfo, event); | 11654 | f = x_menubar_window_to_frame (dpyinfo, event); |
| 11655 | /* For a down-event in the menu bar, | 11655 | /* For a down-event in the menu bar, don't pass it to Xt or |
| 11656 | don't pass it to Xt right now. | 11656 | GTK right away. Instead, save it and pass it to Xt or GTK |
| 11657 | Instead, save it away | 11657 | from kbd_buffer_get_event. That way, we can run some Lisp |
| 11658 | and we will pass it to Xt from kbd_buffer_get_event. | 11658 | code first. */ |
| 11659 | That way, we can run some Lisp code first. */ | ||
| 11660 | if (! popup_activated () | 11659 | if (! popup_activated () |
| 11661 | #ifdef USE_GTK | 11660 | #ifdef USE_GTK |
| 11662 | /* Gtk+ menus only react to the first three buttons. */ | 11661 | /* Gtk+ menus only react to the first three buttons. */ |