}
#endif
+static void
+append_wm_protocols (struct x_display_info *dpyinfo,
+ struct frame *f)
+{
+ unsigned char *existing = NULL;
+ int format = 0;
+ unsigned long nitems = 0;
+ Atom type;
+ Atom *existing_protocols;
+ Atom protos[10];
+ int num_protos = 0;
+ bool found_wm_ping = false;
+ unsigned long bytes_after;
+
+ block_input ();
+ if ((XGetWindowProperty (dpyinfo->display, FRAME_OUTER_WINDOW (f),
+ dpyinfo->Xatom_wm_protocols,
+ 0, 100, False, XA_ATOM, &type, &format, &nitems,
+ &bytes_after, &existing) == Success)
+ && format == 32 && type == XA_ATOM)
+ {
+ existing_protocols = (Atom *) existing;
+
+ while (nitems)
+ {
+ nitems--;
+
+ if (existing_protocols[nitems]
+ == dpyinfo->Xatom_net_wm_ping)
+ found_wm_ping = true;
+ }
+ }
+
+ if (existing)
+ XFree (existing);
+
+ if (!found_wm_ping)
+ protos[num_protos++] = dpyinfo->Xatom_net_wm_ping;
+
+ if (num_protos)
+ XChangeProperty (dpyinfo->display,
+ FRAME_OUTER_WINDOW (f),
+ dpyinfo->Xatom_wm_protocols,
+ XA_ATOM, 32, PropModeAppend,
+ (unsigned char *) protos,
+ num_protos);
+ unblock_input ();
+}
+
\f
/* Support routines for XIC (X Input Context). */
&f->output_data.x->wm_hints);
hack_wm_protocols (f, shell_widget);
+ append_wm_protocols (FRAME_DISPLAY_INFO (f), f);
#ifdef X_TOOLKIT_EDITRES
XtAddEventHandler (shell_widget, 0, True, _XEditResCheckMessages, 0);
}
#endif
+ append_wm_protocols (FRAME_DISPLAY_INFO (f), f);
+
#ifdef HAVE_XINPUT2
if (FRAME_DISPLAY_INFO (f)->supports_xi2)
setup_xi_event_mask (f);
FRAME_X_VISUAL (f),
attribute_mask, &attributes);
initial_set_up_x_back_buffer (f);
+ append_wm_protocols (FRAME_DISPLAY_INFO (f), f);
#ifdef HAVE_X_I18N
if (use_xim)
goto done;
}
+
+ if (event->xclient.data.l[0] == dpyinfo->Xatom_net_wm_ping
+ && event->xclient.format == 32)
+ {
+ XEvent send_event = *event;
+
+ send_event.xclient.window = dpyinfo->root_window;
+ XSendEvent (dpyinfo->display, dpyinfo->root_window, False,
+ SubstructureRedirectMask | SubstructureNotifyMask,
+ &send_event);
+
+ *finish = X_EVENT_DROP;
+ goto done;
+ }
+
goto done;
}
ATOM_REFS_INIT ("_NET_WM_STATE_ABOVE", Xatom_net_wm_state_above)
ATOM_REFS_INIT ("_NET_WM_STATE_BELOW", Xatom_net_wm_state_below)
ATOM_REFS_INIT ("_NET_WM_OPAQUE_REGION", Xatom_net_wm_opaque_region)
+ ATOM_REFS_INIT ("_NET_WM_PING", Xatom_net_wm_ping)
#ifdef HAVE_XKB
ATOM_REFS_INIT ("Meta", Xatom_Meta)
ATOM_REFS_INIT ("Super", Xatom_Super)
Xatom_net_wm_state_sticky, Xatom_net_wm_state_above, Xatom_net_wm_state_below,
Xatom_net_wm_state_hidden, Xatom_net_wm_state_skip_taskbar,
Xatom_net_frame_extents, Xatom_net_current_desktop, Xatom_net_workarea,
- Xatom_net_wm_opaque_region;
+ Xatom_net_wm_opaque_region, Xatom_net_wm_ping;
/* XSettings atoms and windows. */
Atom Xatom_xsettings_sel, Xatom_xsettings_prop, Xatom_xsettings_mgr;