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.
This commit is contained in:
Po Lu 2022-08-01 19:00:48 +08:00
parent 89fbcbb907
commit e976a935f8
3 changed files with 8 additions and 4 deletions

View file

@ -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

View file

@ -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

View file

@ -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. */