/** Manage _NET_WM_STATE_* ewmh */ void ewmh_manage_net_wm_state(long data_l[], Client *c) { /* Manage _NET_WM_STATE_FULLSCREEN */ if(data_l[1] == (long)net_atom[net_wm_state_fullscreen]) { if(data_l[0] == _NET_WM_STATE_ADD && !(c->flags & FSSFlag)) { c->screen = screen_get_with_geo(c->geo.x, c->geo.y); c->flags &= ~UnmapFlag; XMapWindow(dpy, c->win); XReparentWindow(dpy, c->win, ROOT, spgeo[c->screen].x, spgeo[c->screen].y); XResizeWindow(dpy, c->win, spgeo[c->screen].width, spgeo[c->screen].height); XChangeProperty(dpy, c->win, net_atom[net_wm_state], XA_ATOM, 32, PropModeReplace, (uchar *)&net_atom[net_wm_state_fullscreen], 1); c->tmp_geo = c->geo; if(c->flags & FreeFlag) c->ogeo = c->geo; c->flags |= (FSSFlag | MaxFlag); client_raise(c); client_focus(c); XUnmapWindow(dpy, c->frame); } else if(data_l[0] == _NET_WM_STATE_REMOVE && (c->flags & FSSFlag)) { XChangeProperty(dpy, c->win, net_atom[net_wm_state], XA_ATOM, 32, PropModeReplace, (uchar *)0, 0); c->flags &= ~(FSSFlag | MaxFlag); client_map(c); XReparentWindow(dpy, c->win, c->frame, BORDH, TBARH); client_moveresize(c, c->tmp_geo, False); } } /* Manage _NET_WM_STATE_STICKY */ else if(data_l[1] == (long)net_atom[net_wm_state_sticky]) { /* == client_ignore_tag */ c->tag = MAXTAG + 1; arrange(c->screen, True); } /* Manage _NET_WM_STATE_DEMANDS_ATTENTION */ else if(data_l[1] == (long)net_atom[net_wm_state_demands_attention]) { if(data_l[0] == _NET_WM_STATE_ADD) client_urgent(c, True); if(data_l[0] == _NET_WM_STATE_REMOVE) if(c == sel) client_focus(NULL); } return; }
static void event_mapnotify(XEvent *e) { XMapEvent *ev = &e->xmap; struct client *c; struct _systray *s; if(ev->window != ev->event && !ev->send_event) return; if((c = client_gb_win(ev->window))) client_map(c); else if((s = systray_find(ev->window))) { ewmh_set_wm_state(s->win, NormalState); ewmh_send_message(s->win, s->win, "_XEMBED", CurrentTime, XEMBED_WINDOW_ACTIVATE, 0, 0, 0); } }