diff options
author | Po Lu <luangruo@yahoo.com> | 2022-04-26 12:38:52 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2022-04-26 12:38:52 +0800 |
commit | 1b64e0fc0ee799060cfb406d2b048372b3edab70 (patch) | |
tree | 758450b65c670f9c4e43e460ab2bd75203477269 | |
parent | ec027d873c5660463cd65ce4e9445ed549b03ce4 (diff) | |
download | emacs-1b64e0fc0ee799060cfb406d2b048372b3edab70.tar.gz emacs-1b64e0fc0ee799060cfb406d2b048372b3edab70.tar.bz2 emacs-1b64e0fc0ee799060cfb406d2b048372b3edab70.zip |
Fix event mask of activation client message
* src/xterm.c (x_alloc_lighter_color):
(x_get_scale_factor): Minor formatting fixes.
(x_ewmh_activate_frame): Fix event mask used to send message to
the root window.
-rw-r--r-- | src/xterm.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/src/xterm.c b/src/xterm.c index 3abc67a4b10..16d0ce67071 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -7158,7 +7158,7 @@ x_alloc_lighter_color (struct frame *f, Display *display, Colormap cmap, that scaling by FACTOR alone isn't enough. */ { /* How far below the limit this color is (0 - 1, 1 being darker). */ - double dimness = 1 - (double)bright / HIGHLIGHT_COLOR_DARK_BOOST_LIMIT; + double dimness = 1 - (double) bright / HIGHLIGHT_COLOR_DARK_BOOST_LIMIT; /* The additive adjustment. */ int min_delta = delta * dimness * factor / 2; @@ -8179,7 +8179,7 @@ x_draw_stretch_glyph_string (struct glyph_string *s) } static void -x_get_scale_factor(Display *disp, int *scale_x, int *scale_y) +x_get_scale_factor (Display *disp, int *scale_x, int *scale_y) { const int base_res = 96; struct x_display_info * dpyinfo = x_display_info_for_display (disp); @@ -21468,20 +21468,30 @@ xembed_request_focus (struct frame *f) static void x_ewmh_activate_frame (struct frame *f) { - /* See Window Manager Specification/Extended Window Manager Hints at - https://freedesktop.org/wiki/Specifications/wm-spec/ */ + XEvent msg; + struct x_display_info *dpyinfo; - struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); + dpyinfo = FRAME_DISPLAY_INFO (f); - if (FRAME_VISIBLE_P (f) && x_wm_supports (f, dpyinfo->Xatom_net_active_window)) - { - Lisp_Object frame; - XSETFRAME (frame, f); - x_send_client_event (frame, make_fixnum (0), frame, - dpyinfo->Xatom_net_active_window, - make_fixnum (32), - list2 (make_fixnum (1), - INT_TO_INTEGER (dpyinfo->last_user_time))); + if (FRAME_VISIBLE_P (f) + && x_wm_supports (f, dpyinfo->Xatom_net_active_window)) + { + /* See the documentation at + https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html + for more details on the format of this message. */ + msg.xclient.window = FRAME_OUTER_WINDOW (f); + msg.xclient.message_type = dpyinfo->Xatom_net_active_window; + msg.xclient.data.l[0] = 1; + msg.xclient.data.l[1] = dpyinfo->last_user_time; + msg.xclient.data.l[2] = (!dpyinfo->x_focus_frame + ? None + : FRAME_OUTER_WINDOW (dpyinfo->x_focus_frame)); + msg.xclient.data.l[3] = 0; + msg.xclient.data.l[4] = 0; + + XSendEvent (dpyinfo->display, dpyinfo->root_window, + False, (SubstructureRedirectMask + | SubstructureNotifyMask), &msg); } } |