aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-02-09 18:47:07 +0800
committerPo Lu2022-02-09 18:49:15 +0800
commit7f425613a75d7566309e8b60cdc01fd26c597302 (patch)
treecc32e5818bcac5ba23d0dedc522e7be5b4080a21 /src
parent2f80d8058bada74ae67546e95c314066d697b7ba (diff)
downloademacs-7f425613a75d7566309e8b60cdc01fd26c597302.tar.gz
emacs-7f425613a75d7566309e8b60cdc01fd26c597302.zip
Add support for _NET_WM_USER_TIME_WINDOW
* src/xterm.c (x_make_frame_visible): (x_display_set_last_user_time): Use and set user time window if the WM supports it. (x_term_init): Intern new atom. * src/xterm.h (struct x_display_info): New atom `_NET_WM_USER_TIME_WINDOW'. (struct x_output): New field `user_time_window'.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c51
-rw-r--r--src/xterm.h8
2 files changed, 51 insertions, 8 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 38b50bcd3b7..e6d7d5d133f 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2220,24 +2220,29 @@ static void x_check_font (struct frame *, struct font *);
2220void 2220void
2221x_display_set_last_user_time (struct x_display_info *dpyinfo, Time time) 2221x_display_set_last_user_time (struct x_display_info *dpyinfo, Time time)
2222{ 2222{
2223#ifndef USE_GTK
2223 struct frame *focus_frame = dpyinfo->x_focus_frame; 2224 struct frame *focus_frame = dpyinfo->x_focus_frame;
2225#endif
2224 2226
2225#ifdef ENABLE_CHECKING 2227#ifdef ENABLE_CHECKING
2226 eassert (t <= X_ULONG_MAX); 2228 eassert (t <= X_ULONG_MAX);
2227#endif 2229#endif
2228 dpyinfo->last_user_time = time; 2230 dpyinfo->last_user_time = time;
2229 2231
2232#ifndef USE_GTK
2230 if (focus_frame) 2233 if (focus_frame)
2231 { 2234 {
2232 while (FRAME_PARENT_FRAME (focus_frame)) 2235 while (FRAME_PARENT_FRAME (focus_frame))
2233 focus_frame = FRAME_PARENT_FRAME (focus_frame); 2236 focus_frame = FRAME_PARENT_FRAME (focus_frame);
2234 2237
2235 XChangeProperty (dpyinfo->display, 2238 if (FRAME_X_OUTPUT (focus_frame)->user_time_window != None)
2236 FRAME_OUTER_WINDOW (dpyinfo->x_focus_frame), 2239 XChangeProperty (dpyinfo->display,
2237 dpyinfo->Xatom_net_wm_user_time, 2240 FRAME_X_OUTPUT (focus_frame)->user_time_window,
2238 XA_CARDINAL, 32, PropModeReplace, 2241 dpyinfo->Xatom_net_wm_user_time,
2239 (unsigned char *) &time, 1); 2242 XA_CARDINAL, 32, PropModeReplace,
2243 (unsigned char *) &time, 1);
2240 } 2244 }
2245#endif
2241} 2246}
2242 2247
2243 2248
@@ -14481,6 +14486,9 @@ void
14481x_make_frame_visible (struct frame *f) 14486x_make_frame_visible (struct frame *f)
14482{ 14487{
14483 struct x_display_info *dpyinfo; 14488 struct x_display_info *dpyinfo;
14489#ifndef USE_GTK
14490 struct x_output *output;
14491#endif
14484 14492
14485 if (FRAME_PARENT_FRAME (f)) 14493 if (FRAME_PARENT_FRAME (f))
14486 { 14494 {
@@ -14518,16 +14526,44 @@ x_make_frame_visible (struct frame *f)
14518 && ! f->output_data.x->asked_for_visible) 14526 && ! f->output_data.x->asked_for_visible)
14519 x_set_offset (f, f->left_pos, f->top_pos, 0); 14527 x_set_offset (f, f->left_pos, f->top_pos, 0);
14520 14528
14529#ifndef USE_GTK
14530 output = FRAME_X_OUTPUT (f);
14531
14532 if (output->user_time_window == None)
14533 {
14534 XSetWindowAttributes attrs;
14535 memset (&attrs, 0, sizeof attrs);
14536
14537 output->user_time_window
14538 = FRAME_OUTER_WINDOW (f);
14539
14540 if (x_wm_supports (f, dpyinfo->Xatom_net_wm_user_time_window))
14541 {
14542 output->user_time_window
14543 = XCreateWindow (dpyinfo->display, FRAME_X_WINDOW (f),
14544 -1, -1, 1, 1, 0, 0, InputOnly,
14545 CopyFromParent, 0, &attrs);
14546
14547 XChangeProperty (dpyinfo->display,
14548 FRAME_OUTER_WINDOW (f),
14549 dpyinfo->Xatom_net_wm_user_time_window,
14550 XA_WINDOW, 32, PropModeReplace,
14551 (unsigned char *) &output->user_time_window,
14552 1);
14553 }
14554 }
14555
14521 if (dpyinfo->last_user_time) 14556 if (dpyinfo->last_user_time)
14522 XChangeProperty (dpyinfo->display, 14557 XChangeProperty (dpyinfo->display,
14523 FRAME_OUTER_WINDOW (f), 14558 output->user_time_window,
14524 dpyinfo->Xatom_net_wm_user_time, 14559 dpyinfo->Xatom_net_wm_user_time,
14525 XA_CARDINAL, 32, PropModeReplace, 14560 XA_CARDINAL, 32, PropModeReplace,
14526 (unsigned char *) &dpyinfo->last_user_time, 1); 14561 (unsigned char *) &dpyinfo->last_user_time, 1);
14527 else 14562 else
14528 XDeleteProperty (dpyinfo->display, 14563 XDeleteProperty (dpyinfo->display,
14529 FRAME_OUTER_WINDOW (f), 14564 output->user_time_window,
14530 dpyinfo->Xatom_net_wm_user_time); 14565 dpyinfo->Xatom_net_wm_user_time);
14566#endif
14531 14567
14532 f->output_data.x->asked_for_visible = true; 14568 f->output_data.x->asked_for_visible = true;
14533 14569
@@ -16133,6 +16169,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
16133 ATOM_REFS_INIT ("_NET_WM_SYNC_REQUEST_COUNTER", Xatom_net_wm_sync_request_counter) 16169 ATOM_REFS_INIT ("_NET_WM_SYNC_REQUEST_COUNTER", Xatom_net_wm_sync_request_counter)
16134 ATOM_REFS_INIT ("_NET_WM_FRAME_DRAWN", Xatom_net_wm_frame_drawn) 16170 ATOM_REFS_INIT ("_NET_WM_FRAME_DRAWN", Xatom_net_wm_frame_drawn)
16135 ATOM_REFS_INIT ("_NET_WM_USER_TIME", Xatom_net_wm_user_time) 16171 ATOM_REFS_INIT ("_NET_WM_USER_TIME", Xatom_net_wm_user_time)
16172 ATOM_REFS_INIT ("_NET_WM_USER_TIME_WINDOW", Xatom_net_wm_user_time_window)
16136 /* Session management */ 16173 /* Session management */
16137 ATOM_REFS_INIT ("SM_CLIENT_ID", Xatom_SM_CLIENT_ID) 16174 ATOM_REFS_INIT ("SM_CLIENT_ID", Xatom_SM_CLIENT_ID)
16138 ATOM_REFS_INIT ("_XSETTINGS_SETTINGS", Xatom_xsettings_prop) 16175 ATOM_REFS_INIT ("_XSETTINGS_SETTINGS", Xatom_xsettings_prop)
diff --git a/src/xterm.h b/src/xterm.h
index 9aa7021c4dc..afd6a1757c5 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -506,7 +506,7 @@ struct x_display_info
506 Xatom_net_frame_extents, Xatom_net_current_desktop, Xatom_net_workarea, 506 Xatom_net_frame_extents, Xatom_net_current_desktop, Xatom_net_workarea,
507 Xatom_net_wm_opaque_region, Xatom_net_wm_ping, Xatom_net_wm_sync_request, 507 Xatom_net_wm_opaque_region, Xatom_net_wm_ping, Xatom_net_wm_sync_request,
508 Xatom_net_wm_sync_request_counter, Xatom_net_wm_frame_drawn, 508 Xatom_net_wm_sync_request_counter, Xatom_net_wm_frame_drawn,
509 Xatom_net_wm_user_time; 509 Xatom_net_wm_user_time, Xatom_net_wm_user_time_window;
510 510
511 /* XSettings atoms and windows. */ 511 /* XSettings atoms and windows. */
512 Atom Xatom_xsettings_sel, Xatom_xsettings_prop, Xatom_xsettings_mgr; 512 Atom Xatom_xsettings_sel, Xatom_xsettings_prop, Xatom_xsettings_mgr;
@@ -677,6 +677,12 @@ struct x_output
677 Widget menubar_widget; 677 Widget menubar_widget;
678#endif 678#endif
679 679
680#ifndef USE_GTK
681 /* A window used to store the user time property. May be None or
682 the frame's outer window. */
683 Window user_time_window;
684#endif
685
680#ifdef USE_GTK 686#ifdef USE_GTK
681 /* The widget of this screen. This is the window of a top widget. */ 687 /* The widget of this screen. This is the window of a top widget. */
682 GtkWidget *widget; 688 GtkWidget *widget;