add support for _NET_WM_WINDOW_TYPE_DOCK
This commit is contained in:
parent
169e658a18
commit
8c36b49f7f
21
client.c
21
client.c
|
@ -294,13 +294,17 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
c->screen = get_screen_bycoord(c->x, c->y);
|
c->screen = get_screen_bycoord(c->x, c->y);
|
||||||
c->phys_screen = get_phys_screen(c->screen);
|
c->phys_screen = get_phys_screen(c->screen);
|
||||||
|
|
||||||
ewmh_check_client_hints(c);
|
|
||||||
|
|
||||||
move_client_to_screen(c, screen, True);
|
move_client_to_screen(c, screen, True);
|
||||||
|
|
||||||
/* update window title */
|
/* update window title */
|
||||||
client_updatetitle(c);
|
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 */
|
/* loadprops or apply rules if no props */
|
||||||
if(!client_loadprops(c, screen))
|
if(!client_loadprops(c, screen))
|
||||||
tag_client_with_rules(c);
|
tag_client_with_rules(c);
|
||||||
|
@ -312,7 +316,6 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
{
|
{
|
||||||
c->x = area.x;
|
c->x = area.x;
|
||||||
c->y = area.y;
|
c->y = area.y;
|
||||||
c->border = wa->border_width;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -328,8 +331,6 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
c->x = c->rx = darea.x;
|
c->x = c->rx = darea.x;
|
||||||
if(c->y < darea.y)
|
if(c->y < darea.y)
|
||||||
c->y = c->ry = darea.y;
|
c->y = c->ry = darea.y;
|
||||||
|
|
||||||
c->border = globalconf.screens[screen].borderpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set borders */
|
/* set borders */
|
||||||
|
@ -363,7 +364,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
if(is_client_tagged(t, tag))
|
if(is_client_tagged(t, tag))
|
||||||
tag_client(c, tag);
|
tag_client(c, tag);
|
||||||
|
|
||||||
/* should be floating if transsient or fixed) */
|
/* should be floating if transsient or fixed */
|
||||||
if(!c->isfloating)
|
if(!c->isfloating)
|
||||||
c->isfloating = (rettrans == Success) || c->isfixed;
|
c->isfloating = (rettrans == Success) || c->isfixed;
|
||||||
|
|
||||||
|
@ -544,7 +545,8 @@ client_updatewmhints(Client *c)
|
||||||
if((wmh = XGetWMHints(globalconf.display, c->win)))
|
if((wmh = XGetWMHints(globalconf.display, c->win)))
|
||||||
{
|
{
|
||||||
c->isurgent = (wmh->flags & XUrgencyHint);
|
c->isurgent = (wmh->flags & XUrgencyHint);
|
||||||
c->skip = (wmh->initial_state == WithdrawnState);
|
if(wmh->initial_state == WithdrawnState)
|
||||||
|
c->skip = True;
|
||||||
XFree(wmh);
|
XFree(wmh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -609,8 +611,9 @@ client_updatesizehints(Client *c)
|
||||||
else
|
else
|
||||||
c->minax = c->maxax = c->minay = c->maxay = 0;
|
c->minax = c->maxax = c->minay = c->maxay = 0;
|
||||||
|
|
||||||
c->isfixed = (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->maxw == c->minw && c->maxh == c->minh)
|
||||||
|
c->isfixed = True;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns True if a client is tagged
|
/** Returns True if a client is tagged
|
||||||
|
|
11
event.c
11
event.c
|
@ -134,17 +134,10 @@ handle_event_configurerequest(XEvent * e)
|
||||||
XConfigureRequestEvent *ev = &e->xconfigurerequest;
|
XConfigureRequestEvent *ev = &e->xconfigurerequest;
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
int old_screen;
|
int old_screen;
|
||||||
Tag **curtags;
|
|
||||||
|
|
||||||
if((c = get_client_bywin(globalconf.clients, ev->window)))
|
if((c = get_client_bywin(globalconf.clients, ev->window)))
|
||||||
{
|
{
|
||||||
return;
|
if(c->isfixed)
|
||||||
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(ev->value_mask & CWX)
|
if(ev->value_mask & CWX)
|
||||||
c->rx = c->x = ev->x - c->border;
|
c->rx = c->x = ev->x - c->border;
|
||||||
|
@ -166,13 +159,11 @@ handle_event_configurerequest(XEvent * e)
|
||||||
statusbar_draw(c->screen);
|
statusbar_draw(c->screen);
|
||||||
}
|
}
|
||||||
tag_client_with_rules(c);
|
tag_client_with_rules(c);
|
||||||
c->isfloating = True;
|
|
||||||
XMoveResizeWindow(e->xany.display, c->win, c->rx, c->ry, c->rw, c->rh);
|
XMoveResizeWindow(e->xany.display, c->win, c->rx, c->ry, c->rw, c->rh);
|
||||||
arrange(c->screen);
|
arrange(c->screen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
window_configure(globalconf.display, c->win, c->x, c->y, c->w, c->h, c->border);
|
window_configure(globalconf.display, c->win, c->x, c->y, c->w, c->h, c->border);
|
||||||
p_delete(&curtags);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
45
ewmh.c
45
ewmh.c
|
@ -41,6 +41,9 @@ static Atom net_active_window;
|
||||||
static Atom net_close_window;
|
static Atom net_close_window;
|
||||||
|
|
||||||
static Atom net_wm_name;
|
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_icon;
|
||||||
static Atom net_wm_state;
|
static Atom net_wm_state;
|
||||||
static Atom net_wm_state_sticky;
|
static Atom net_wm_state_sticky;
|
||||||
|
@ -66,6 +69,9 @@ static AtomItem AtomNames[] =
|
||||||
{ "_NET_CLOSE_WINDOW", &net_close_window },
|
{ "_NET_CLOSE_WINDOW", &net_close_window },
|
||||||
|
|
||||||
{ "_NET_WM_NAME", &net_wm_name },
|
{ "_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_ICON", &net_wm_icon },
|
||||||
{ "_NET_WM_STATE", &net_wm_state },
|
{ "_NET_WM_STATE", &net_wm_state },
|
||||||
{ "_NET_WM_STATE_STICKY", &net_wm_state_sticky },
|
{ "_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_close_window;
|
||||||
|
|
||||||
atom[i++] = net_wm_name;
|
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_icon;
|
||||||
atom[i++] = net_wm_state;
|
atom[i++] = net_wm_state;
|
||||||
atom[i++] = net_wm_state_sticky;
|
atom[i++] = net_wm_state_sticky;
|
||||||
|
@ -224,8 +233,27 @@ ewmh_process_state_atom(Client *c, Atom state, int set)
|
||||||
c->ismax = False;
|
c->ismax = False;
|
||||||
client_maximize(c, area.x, area.y, area.width, area.height);
|
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
|
void
|
||||||
ewmh_process_client_message(XClientMessageEvent *ev)
|
ewmh_process_client_message(XClientMessageEvent *ev)
|
||||||
{
|
{
|
||||||
|
@ -257,9 +285,8 @@ ewmh_check_client_hints(Client *c)
|
||||||
|
|
||||||
if(XGetWindowProperty(globalconf.display, c->win, net_wm_state, 0L, LONG_MAX, False,
|
if(XGetWindowProperty(globalconf.display, c->win, net_wm_state, 0L, LONG_MAX, False,
|
||||||
XA_ATOM, &real, &format, &n, &extra,
|
XA_ATOM, &real, &format, &n, &extra,
|
||||||
(unsigned char **) &data) != Success || !data)
|
(unsigned char **) &data) == Success && data)
|
||||||
return;
|
{
|
||||||
|
|
||||||
state = (Atom *) data;
|
state = (Atom *) data;
|
||||||
for(i = 0; i < n; i++)
|
for(i = 0; i < n; i++)
|
||||||
ewmh_process_state_atom(c, state[i], _NET_WM_STATE_ADD);
|
ewmh_process_state_atom(c, state[i], _NET_WM_STATE_ADD);
|
||||||
|
@ -267,4 +294,16 @@ ewmh_check_client_hints(Client *c)
|
||||||
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
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||||
|
|
4
mouse.c
4
mouse.c
|
@ -50,7 +50,7 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
|
||||||
Client *c = globalconf.focus->client;
|
Client *c = globalconf.focus->client;
|
||||||
Tag **curtags = get_current_tags(screen);
|
Tag **curtags = get_current_tags(screen);
|
||||||
|
|
||||||
if(!c)
|
if(!c || (c && c->isfixed))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if((curtags[0]->layout->arrange != layout_floating)
|
if((curtags[0]->layout->arrange != layout_floating)
|
||||||
|
@ -128,7 +128,7 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
|
||||||
double mwfact;
|
double mwfact;
|
||||||
|
|
||||||
/* only handle floating and tiled layouts */
|
/* only handle floating and tiled layouts */
|
||||||
if(c)
|
if(c && !c->isfixed)
|
||||||
{
|
{
|
||||||
if((curtags[0]->layout->arrange == layout_floating) || c->isfloating)
|
if((curtags[0]->layout->arrange == layout_floating) || c->isfloating)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue