From c9667e9b60fe0044ea4d5f000973a87a0c584033 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sun, 6 Mar 2022 08:56:02 +0800 Subject: [PATCH] Fix reporting of menu bar wheel events on no toolkit builds * src/xterm.c (x_toolkit_position): Handle menu bar position on no-toolkit builds. (x_create_terminal): Always add `toolkit_position_hook'. --- src/xterm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index 5f8e804c62a..89feece10eb 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -856,7 +856,6 @@ record_event (char *locus, int type) #endif -#if defined USE_X_TOOLKIT || USE_GTK static void x_toolkit_position (struct frame *f, int x, int y, bool *menu_bar_p, bool *tool_bar_p) @@ -884,12 +883,15 @@ x_toolkit_position (struct frame *f, int x, int y, *tool_bar_p = gtk_widget_intersect (FRAME_X_OUTPUT (f)->toolbar_widget, &test_rect, NULL); } -#else +#elif defined USE_X_TOOLKIT *menu_bar_p = (x > 0 && x < FRAME_PIXEL_WIDTH (f) && (y < 0 && y >= -FRAME_MENUBAR_HEIGHT (f))); +#else + *menu_bar_p = (WINDOWP (f->menu_bar_window) + && (x > 0 && x < FRAME_PIXEL_WIDTH (f) + && (y > 0 && y < FRAME_MENU_BAR_HEIGHT (f)))); #endif } -#endif static void x_update_opaque_region (struct frame *f, XEvent *configure) @@ -17985,9 +17987,7 @@ x_create_terminal (struct x_display_info *dpyinfo) terminal->free_pixmap = x_free_pixmap; terminal->delete_frame_hook = x_destroy_window; terminal->delete_terminal_hook = x_delete_terminal; -#if defined USE_X_TOOLKIT || defined USE_GTK terminal->toolkit_position_hook = x_toolkit_position; -#endif /* Other hooks are NULL by default. */ return terminal; -- 2.39.2