diff --git a/client.c b/client.c index 573a8dbe1..b33c97f9a 100644 --- a/client.c +++ b/client.c @@ -294,13 +294,17 @@ client_manage(Window w, XWindowAttributes *wa, int screen) c->screen = get_screen_bycoord(c->x, c->y); c->phys_screen = get_phys_screen(c->screen); - ewmh_check_client_hints(c); - move_client_to_screen(c, screen, True); /* update window title */ client_updatetitle(c); + if(c->w == area.width && c->h == area.height) + c->border = wa->border_width; + else + c->border = globalconf.screens[screen].borderpx; + + ewmh_check_client_hints(c); /* loadprops or apply rules if no props */ if(!client_loadprops(c, screen)) tag_client_with_rules(c); @@ -312,7 +316,6 @@ client_manage(Window w, XWindowAttributes *wa, int screen) { c->x = area.x; c->y = area.y; - c->border = wa->border_width; } else { @@ -328,8 +331,6 @@ client_manage(Window w, XWindowAttributes *wa, int screen) c->x = c->rx = darea.x; if(c->y < darea.y) c->y = c->ry = darea.y; - - c->border = globalconf.screens[screen].borderpx; } /* set borders */ @@ -363,7 +364,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen) if(is_client_tagged(t, tag)) tag_client(c, tag); - /* should be floating if transsient or fixed) */ + /* should be floating if transsient or fixed */ if(!c->isfloating) c->isfloating = (rettrans == Success) || c->isfixed; @@ -544,7 +545,8 @@ client_updatewmhints(Client *c) if((wmh = XGetWMHints(globalconf.display, c->win))) { c->isurgent = (wmh->flags & XUrgencyHint); - c->skip = (wmh->initial_state == WithdrawnState); + if(wmh->initial_state == WithdrawnState) + c->skip = True; XFree(wmh); } } @@ -609,8 +611,9 @@ client_updatesizehints(Client *c) else c->minax = c->maxax = c->minay = c->maxay = 0; - c->isfixed = (c->maxw && c->minw && c->maxh && c->minh - && c->maxw == c->minw && c->maxh == c->minh); + if(c->maxw && c->minw && c->maxh && c->minh + && c->maxw == c->minw && c->maxh == c->minh) + c->isfixed = True; } /** Returns True if a client is tagged diff --git a/event.c b/event.c index d1eaa0709..946d84960 100644 --- a/event.c +++ b/event.c @@ -134,17 +134,10 @@ handle_event_configurerequest(XEvent * e) XConfigureRequestEvent *ev = &e->xconfigurerequest; XWindowChanges wc; int old_screen; - Tag **curtags; if((c = get_client_bywin(globalconf.clients, ev->window))) { - return; - c->ismax = False; - curtags = get_current_tags(c->screen); - if(ev->value_mask & CWBorderWidth) - c->border = ev->border_width; - if(c->isfixed || c->isfloating - || curtags[0]->layout->arrange == layout_floating) + if(c->isfixed) { if(ev->value_mask & CWX) c->rx = c->x = ev->x - c->border; @@ -166,13 +159,11 @@ handle_event_configurerequest(XEvent * e) statusbar_draw(c->screen); } tag_client_with_rules(c); - c->isfloating = True; XMoveResizeWindow(e->xany.display, c->win, c->rx, c->ry, c->rw, c->rh); arrange(c->screen); } else window_configure(globalconf.display, c->win, c->x, c->y, c->w, c->h, c->border); - p_delete(&curtags); } else { diff --git a/ewmh.c b/ewmh.c index 3b1ea0999..4f3f2dd60 100644 --- a/ewmh.c +++ b/ewmh.c @@ -41,6 +41,9 @@ static Atom net_active_window; static Atom net_close_window; static Atom net_wm_name; +static Atom net_wm_window_type; +static Atom net_wm_window_type_normal; +static Atom net_wm_window_type_dock; static Atom net_wm_icon; static Atom net_wm_state; static Atom net_wm_state_sticky; @@ -66,6 +69,9 @@ static AtomItem AtomNames[] = { "_NET_CLOSE_WINDOW", &net_close_window }, { "_NET_WM_NAME", &net_wm_name }, + { "_NET_WM_WINDOW_TYPE", &net_wm_window_type }, + { "_NET_WM_WINDOW_TYPE_NORMAL", &net_wm_window_type_normal }, + { "_NET_WM_WINDOW_TYPE_DOCK", &net_wm_window_type_dock }, { "_NET_WM_ICON", &net_wm_icon }, { "_NET_WM_STATE", &net_wm_state }, { "_NET_WM_STATE_STICKY", &net_wm_state_sticky }, @@ -110,6 +116,9 @@ ewmh_set_supported_hints(int phys_screen) atom[i++] = net_close_window; atom[i++] = net_wm_name; + atom[i++] = net_wm_window_type; + atom[i++] = net_wm_window_type_normal; + atom[i++] = net_wm_window_type_dock; atom[i++] = net_wm_icon; atom[i++] = net_wm_state; atom[i++] = net_wm_state_sticky; @@ -224,8 +233,27 @@ ewmh_process_state_atom(Client *c, Atom state, int set) c->ismax = False; client_maximize(c, area.x, area.y, area.width, area.height); } + else + printf("%s received unknown window state %s\n", c->name, XGetAtomName(globalconf.display, state)); } +static void +ewmh_process_window_type_atom(Client *c, Atom state) +{ + if(state == net_wm_window_type_normal) + { + /* do nothing */ + } + else if(state == net_wm_window_type_dock) + { + c->border = 0; + c->skip = True; + c->isfixed = True; + c->isfloating = True; + } + else + printf("%s received unknown window type %s\n", c->name, XGetAtomName(globalconf.display, state)); +} void ewmh_process_client_message(XClientMessageEvent *ev) { @@ -257,14 +285,25 @@ ewmh_check_client_hints(Client *c) if(XGetWindowProperty(globalconf.display, c->win, net_wm_state, 0L, LONG_MAX, False, XA_ATOM, &real, &format, &n, &extra, - (unsigned char **) &data) != Success || !data) - return; + (unsigned char **) &data) == Success && data) + { + state = (Atom *) data; + for(i = 0; i < n; i++) + ewmh_process_state_atom(c, state[i], _NET_WM_STATE_ADD); - state = (Atom *) data; - for(i = 0; i < n; i++) - ewmh_process_state_atom(c, state[i], _NET_WM_STATE_ADD); + XFree(data); + } - XFree(data); + if(XGetWindowProperty(globalconf.display, c->win, net_wm_window_type, 0L, LONG_MAX, False, + XA_ATOM, &real, &format, &n, &extra, + (unsigned char **) &data) == Success && data) + { + state = (Atom *) data; + for(i = 0; i < n; i++) + ewmh_process_window_type_atom(c, state[i]); + + XFree(data); + } } // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/mouse.c b/mouse.c index 346769f83..e6aa71c97 100644 --- a/mouse.c +++ b/mouse.c @@ -50,7 +50,7 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused))) Client *c = globalconf.focus->client; Tag **curtags = get_current_tags(screen); - if(!c) + if(!c || (c && c->isfixed)) return; if((curtags[0]->layout->arrange != layout_floating) @@ -128,7 +128,7 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused))) double mwfact; /* only handle floating and tiled layouts */ - if(c) + if(c && !c->isfixed) { if((curtags[0]->layout->arrange == layout_floating) || c->isfloating) {