Skip to content

Commit

Permalink
Add _NET_WM_PING support
Browse files Browse the repository at this point in the history
  • Loading branch information
alimirjamali committed Nov 8, 2024
1 parent 89d0254 commit 6cea5a0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
16 changes: 15 additions & 1 deletion gui-daemon/xside.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,10 @@ static Window mkwindow(Ghandles * g, struct windowdata *vm_window)
ButtonPressMask | ButtonReleaseMask |
PointerMotionMask | EnterWindowMask | LeaveWindowMask |
FocusChangeMask | StructureNotifyMask | PropertyChangeMask);
XSetWMProtocols(g->display, child_win, &g->wmDeleteMessage, 1);
Atom protocols[2];
protocols[0] = g->wmDeleteMessage;
protocols[1] = g->wm_ping;
XSetWMProtocols(g->display, child_win, protocols, 2);
if (g->icon_data) {
XChangeProperty(g->display, child_win, g->net_wm_icon, XA_CARDINAL, 32,
PropModeReplace, (unsigned char *) g->icon_data,
Expand Down Expand Up @@ -423,6 +426,7 @@ static Window mkwindow(Ghandles * g, struct windowdata *vm_window)
32, PropModeReplace,
(const unsigned char *)&vm_window->remote_winid,
1);

/* extra properties from command line */
for (i = 0; i < MAX_EXTRA_PROPS; i++) {
if (g->extra_props[i].prop) {
Expand Down Expand Up @@ -600,6 +604,7 @@ static void intern_global_atoms(Ghandles *const g) {
{ &g->wm_user_time, "_NET_WM_USER_TIME" },
{ &g->wmDeleteMessage, "WM_DELETE_WINDOW" },
{ &g->net_supported, "_NET_SUPPORTED" },
{ &g->wm_ping, "_NET_WM_PING" },
};
Atom labels[QUBES_ARRAY_SIZE(atoms_to_intern)];
const char *names[QUBES_ARRAY_SIZE(atoms_to_intern)];
Expand Down Expand Up @@ -2649,6 +2654,15 @@ static void process_xevent(Ghandles * g)
(int) event_buffer.xclient.window);
process_xevent_close(g,
event_buffer.xclient.window);
} else if ((Atom)event_buffer.xclient.data.l[0] ==
g->wm_ping) {
XClientMessageEvent *ev = (XClientMessageEvent *) &event_buffer;
ev->window = g->root_win;
XSendEvent(g->display, g->root_win, False,
(SubstructureNotifyMask|SubstructureRedirectMask),
&event_buffer);
if (g->log_level > 1)
fprintf(stderr, "Received ping request from Window Manager\n");
}
break;
default:;
Expand Down
1 change: 1 addition & 0 deletions gui-daemon/xside.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ struct _global_handles {
Atom wm_state_maximized_horz; /* Atom: _NET_WM_STATE_MAXIMIZED_HORZ */
Atom wm_user_time_window; /* Atom: _NET_WM_USER_TIME_WINDOW */
Atom wm_user_time; /* Atom: _NET_WM_USER_TIME */
Atom wm_ping; /* Atom: _NET_WM_PING */
int shm_major_opcode; /* MIT-SHM extension opcode */
/* shared memory handling */
struct shm_args_hdr *shm_args; /* shared memory with Xorg */
Expand Down

0 comments on commit 6cea5a0

Please sign in to comment.