+void event_leave_client(ObClient *client)
+{
+ g_assert(config_focus_follow);
+
+ if (is_enter_focus_event_ignored(event_curserial)) {
+ ob_debug_type(OB_DEBUG_FOCUS, "Ignoring leave event with serial %lu\n"
+ "on client 0x%x", event_curserial, client->window);
+ return;
+ }
+
+ if (client == focus_client) {
+ if (config_focus_delay) {
+ ObFocusDelayData *data;
+
+ if (unfocus_delay_timeout_id)
+ g_source_remove(unfocus_delay_timeout_id);
+
+ data = g_slice_new(ObFocusDelayData);
+ data->client = client;
+ data->time = event_time();
+ data->serial = event_curserial;
+
+ unfocus_delay_timeout_id = g_timeout_add_full(G_PRIORITY_DEFAULT,
+ config_focus_delay,
+ unfocus_delay_func,
+ data,
+ unfocus_delay_dest);
+ unfocus_delay_timeout_client = client;
+ } else {
+ ObFocusDelayData data;
+ data.client = client;
+ data.time = event_time();
+ data.serial = event_curserial;
+ unfocus_delay_func(&data);
+ }
+ }
+}
+
+static gboolean *context_to_button(ObFrame *f, ObFrameContext con, gboolean press)
+{
+ if (press) {
+ switch (con) {
+ case OB_FRAME_CONTEXT_MAXIMIZE:
+ return &f->max_press;
+ case OB_FRAME_CONTEXT_CLOSE:
+ return &f->close_press;
+ case OB_FRAME_CONTEXT_ICONIFY:
+ return &f->iconify_press;
+ case OB_FRAME_CONTEXT_ALLDESKTOPS:
+ return &f->desk_press;
+ case OB_FRAME_CONTEXT_SHADE:
+ return &f->shade_press;
+ default:
+ return NULL;
+ }
+ } else {
+ switch (con) {
+ case OB_FRAME_CONTEXT_MAXIMIZE:
+ return &f->max_hover;
+ case OB_FRAME_CONTEXT_CLOSE:
+ return &f->close_hover;
+ case OB_FRAME_CONTEXT_ICONIFY:
+ return &f->iconify_hover;
+ case OB_FRAME_CONTEXT_ALLDESKTOPS:
+ return &f->desk_hover;
+ case OB_FRAME_CONTEXT_SHADE:
+ return &f->shade_hover;
+ default:
+ return NULL;
+ }
+ }
+}
+
+static gboolean more_client_message_event(Window window, Atom msgtype)
+{
+ ObtXQueueWindowMessage wm;
+ wm.window = window;
+ wm.message = msgtype;
+ return xqueue_exists_local(xqueue_match_window_message, &wm);
+}
+
+struct ObSkipPropertyChange {
+ Window window;
+ Atom prop;
+};
+
+static gboolean skip_property_change(XEvent *e, gpointer data)
+{
+ const struct ObSkipPropertyChange s = *(struct ObSkipPropertyChange*)data;
+
+ if (e->type == PropertyNotify && e->xproperty.window == s.window) {
+ const Atom a = e->xproperty.atom;
+ const Atom b = s.prop;
+
+ /* these are all updated together */
+ if ((a == OBT_PROP_ATOM(NET_WM_NAME) ||
+ a == OBT_PROP_ATOM(WM_NAME) ||
+ a == OBT_PROP_ATOM(NET_WM_ICON_NAME) ||
+ a == OBT_PROP_ATOM(WM_ICON_NAME))
+ &&
+ (b == OBT_PROP_ATOM(NET_WM_NAME) ||
+ b == OBT_PROP_ATOM(WM_NAME) ||
+ b == OBT_PROP_ATOM(NET_WM_ICON_NAME) ||
+ b == OBT_PROP_ATOM(WM_ICON_NAME)))
+ {
+ return TRUE;
+ }
+ else if (a == b && a == OBT_PROP_ATOM(NET_WM_ICON))
+ return TRUE;
+ }
+ return FALSE;
+}
+