keep apps from moving/maping their titlebar underneath left/top panels

This commit is contained in:
Dana Jansens 2003-07-28 07:19:47 +00:00
parent 7da335f944
commit eb1fb5580e
2 changed files with 48 additions and 2 deletions

View file

@ -891,7 +891,22 @@ void client_update_normal_hints(ObClient *self)
/* get the hints from the window */ /* get the hints from the window */
if (XGetWMNormalHints(ob_display, self->window, &size, &ret)) { if (XGetWMNormalHints(ob_display, self->window, &size, &ret)) {
self->positioned = !!(size.flags & (PPosition|USPosition)); if (size.flags & (PPosition|USPosition)) {
Rect *a;
/* this is my MOZILLA BITCHSLAP. oh ya it fucking feels good.
Java can suck it too. */
/* dont let windows map above/left into the strut unless they
are bigger than the available area */
a = screen_area(self->desktop);
if (self->area.width <= a->width && self->area.x < a->x)
self->area.x = a->x;
if (self->area.height <= a->height && self->area.y < a->y)
self->area.y = a->y;
self->positioned = TRUE;
}
if (size.flags & PWinGravity) { if (size.flags & PWinGravity) {
self->gravity = size.win_gravity; self->gravity = size.win_gravity;

View file

@ -658,6 +658,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
frame_adjust_focus(client->frame, FALSE); frame_adjust_focus(client->frame, FALSE);
break; break;
case EnterNotify: case EnterNotify:
con = frame_context(client, e->xcrossing.subwindow);
if (client_normal(client)) { if (client_normal(client)) {
if (ob_state() == OB_STATE_STARTING) { if (ob_state() == OB_STATE_STARTING) {
/* move it to the top of the focus order */ /* move it to the top of the focus order */
@ -711,6 +712,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
CWX | CWY)) { CWX | CWY)) {
int x, y, w, h; int x, y, w, h;
ObCorner corner; ObCorner corner;
Rect *a;
x = (e->xconfigurerequest.value_mask & CWX) ? x = (e->xconfigurerequest.value_mask & CWX) ?
e->xconfigurerequest.x : client->area.x; e->xconfigurerequest.x : client->area.x;
@ -721,6 +723,16 @@ static void event_handle_client(ObClient *client, XEvent *e)
h = (e->xconfigurerequest.value_mask & CWHeight) ? h = (e->xconfigurerequest.value_mask & CWHeight) ?
e->xconfigurerequest.height : client->area.height; e->xconfigurerequest.height : client->area.height;
/* dont let windows move above/left into the strut unless they are
bigger than the available area */
a = screen_area(client->desktop);
if (e->xconfigurerequest.value_mask & CWX &&
w <= a->width && x < a->x)
x = a->x;
if (e->xconfigurerequest.value_mask & CWY &&
h <= a->height && y < a->y)
y = a->y;
switch (client->gravity) { switch (client->gravity) {
case NorthEastGravity: case NorthEastGravity:
case EastGravity: case EastGravity:
@ -885,6 +897,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
} else if (msgtype == prop_atoms.net_moveresize_window) { } else if (msgtype == prop_atoms.net_moveresize_window) {
int oldg = client->gravity; int oldg = client->gravity;
int tmpg, x, y, w, h; int tmpg, x, y, w, h;
Rect *a;
if (e->xclient.data.l[0] & 0xff) if (e->xclient.data.l[0] & 0xff)
tmpg = e->xclient.data.l[0] & 0xff; tmpg = e->xclient.data.l[0] & 0xff;
@ -908,8 +921,26 @@ static void event_handle_client(ObClient *client, XEvent *e)
else else
h = client->area.y; h = client->area.y;
client->gravity = tmpg; client->gravity = tmpg;
/* get the frame position */
frame_client_gravity(client->frame, &x, &y);
/* dont let windows move above/left into the strut unless they are
bigger than the available area */
a = screen_area(client->desktop);
if (e->xconfigurerequest.value_mask & CWX &&
w <= a->width && x < a->x)
x = a->x;
if (e->xconfigurerequest.value_mask & CWY &&
h <= a->height && y < a->y)
y = a->y;
/* go back to the client position */
frame_frame_gravity(client->frame, &x, &y);
client_configure(client, OB_CORNER_TOPLEFT, client_configure(client, OB_CORNER_TOPLEFT,
x, y, w, h, FALSE, TRUE); x, y, w, h, FALSE, TRUE);
client->gravity = oldg; client->gravity = oldg;
} }
break; break;