From e976a935f8c1e6a300d6b537c6853d57bd236094 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Mon, 1 Aug 2022 19:00:48 +0800 Subject: [PATCH] Improve handling of xsettings events * src/xsettings.c (xft_settings_event): * src/xsettings.h: Return if the event was handled. * src/xterm.c (handle_one_xevent): If it was, don't handle the event any further. --- src/xsettings.c | 7 +++++-- src/xsettings.h | 2 +- src/xterm.c | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/xsettings.c b/src/xsettings.c index c29a844e0a8..9c60ff825a4 100644 --- a/src/xsettings.c +++ b/src/xsettings.c @@ -964,9 +964,10 @@ read_and_apply_settings (Display_Info *dpyinfo, bool send_event_p) #endif #ifndef HAVE_PGTK -/* Check if EVENT for the display in DPYINFO is XSettings related. */ +/* Check if EVENT for the display in DPYINFO is XSettings related. + Return true if it is, after performing associated side effects. */ -void +bool xft_settings_event (Display_Info *dpyinfo, const XEvent *event) { bool check_window_p = false, apply_settings_p = false; @@ -1004,6 +1005,8 @@ xft_settings_event (Display_Info *dpyinfo, const XEvent *event) if (apply_settings_p) read_and_apply_settings (dpyinfo, true); + + return check_window_p || apply_settings_p; } #endif diff --git a/src/xsettings.h b/src/xsettings.h index 5e5df37062b..833c2b367dc 100644 --- a/src/xsettings.h +++ b/src/xsettings.h @@ -36,7 +36,7 @@ typedef struct pgtk_display_info Display_Info; extern void xsettings_initialize (Display_Info *); #ifndef HAVE_PGTK -extern void xft_settings_event (Display_Info *, const XEvent *); +extern bool xft_settings_event (Display_Info *, const XEvent *); #endif extern const char *xsettings_get_system_font (void); #ifdef USE_LUCID diff --git a/src/xterm.c b/src/xterm.c index bf6061d30eb..c34fb3eb362 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -17170,7 +17170,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, goto done; #endif - xft_settings_event (dpyinfo, event); + if (xft_settings_event (dpyinfo, event)) + goto done; f = any; /* We don't want to ever leak tooltip frames to Lisp code. */ -- 2.39.2