make those apps stay/map on screen!! fuck stupid apps. thats right im talking to you mozilla and you too java.
This commit is contained in:
parent
d8d2fd7148
commit
950516124f
4 changed files with 90 additions and 61 deletions
|
@ -300,7 +300,7 @@ void client_manage(Window window)
|
||||||
dispatch_client(Event_Client_New, self, 0, 0);
|
dispatch_client(Event_Client_New, self, 0, 0);
|
||||||
|
|
||||||
/* make sure the window is visible */
|
/* make sure the window is visible */
|
||||||
client_move_onscreen(self);
|
client_move_onscreen(self, TRUE);
|
||||||
|
|
||||||
screen_update_areas();
|
screen_update_areas();
|
||||||
|
|
||||||
|
@ -454,27 +454,61 @@ void client_unmanage(ObClient *self)
|
||||||
client_set_list();
|
client_set_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_move_onscreen(ObClient *self)
|
void client_move_onscreen(ObClient *self, gboolean rude)
|
||||||
{
|
{
|
||||||
Rect *a;
|
int x = self->area.x;
|
||||||
int x = self->frame->area.x, y = self->frame->area.y;
|
int y = self->area.y;
|
||||||
|
if (client_find_onscreen(self, &x, &y,
|
||||||
/* XXX watch for xinerama dead areas */
|
self->area.width, self->area.height, rude)) {
|
||||||
a = screen_area(self->desktop);
|
|
||||||
if (x >= a->x + a->width - 1)
|
|
||||||
x = a->x + a->width - self->frame->area.width;
|
|
||||||
if (y >= a->y + a->height - 1)
|
|
||||||
y = a->y + a->height - self->frame->area.height;
|
|
||||||
if (x + self->frame->area.width - 1 < a->x)
|
|
||||||
x = a->x;
|
|
||||||
if (y + self->frame->area.height - 1< a->y)
|
|
||||||
y = a->y;
|
|
||||||
|
|
||||||
frame_frame_gravity(self->frame, &x, &y); /* get where the client
|
|
||||||
should be */
|
|
||||||
client_configure(self, OB_CORNER_TOPLEFT, x, y,
|
client_configure(self, OB_CORNER_TOPLEFT, x, y,
|
||||||
self->area.width, self->area.height,
|
self->area.width, self->area.height,
|
||||||
TRUE, TRUE);
|
TRUE, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean client_find_onscreen(ObClient *self, int *x, int *y, int w, int h,
|
||||||
|
gboolean rude)
|
||||||
|
{
|
||||||
|
Rect *a;
|
||||||
|
int ox = *x, oy = *y;
|
||||||
|
|
||||||
|
frame_client_gravity(self->frame, x, y); /* get where the frame
|
||||||
|
would be */
|
||||||
|
|
||||||
|
/* XXX watch for xinerama dead areas */
|
||||||
|
|
||||||
|
a = screen_area(self->desktop);
|
||||||
|
if (*x >= a->x + a->width - 1)
|
||||||
|
*x = a->x + a->width - self->frame->area.width;
|
||||||
|
if (*y >= a->y + a->height - 1)
|
||||||
|
*y = a->y + a->height - self->frame->area.height;
|
||||||
|
if (*x + self->frame->area.width - 1 < a->x)
|
||||||
|
*x = a->x;
|
||||||
|
if (*y + self->frame->area.height - 1 < a->y)
|
||||||
|
*y = a->y;
|
||||||
|
|
||||||
|
if (rude) {
|
||||||
|
/* this is my MOZILLA BITCHSLAP. oh ya it fucking feels good.
|
||||||
|
Java can suck it too. */
|
||||||
|
|
||||||
|
/* dont let windows map/move into the strut unless they
|
||||||
|
are bigger than the available area */
|
||||||
|
if (w <= a->width) {
|
||||||
|
if (*x < a->x) *x = a->x;
|
||||||
|
if (*x + w > a->x + a->width)
|
||||||
|
*x = a->x + a->width - w;
|
||||||
|
}
|
||||||
|
if (h <= a->height) {
|
||||||
|
if (*y < a->y) *y = a->y;
|
||||||
|
if (*y + h > a->y + a->height)
|
||||||
|
*y = a->y + a->height - h;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
frame_frame_gravity(self->frame, x, y); /* get where the client
|
||||||
|
should be */
|
||||||
|
|
||||||
|
return ox != *x || oy != *y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void client_toggle_border(ObClient *self, gboolean show)
|
static void client_toggle_border(ObClient *self, gboolean show)
|
||||||
|
@ -891,22 +925,7 @@ 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)) {
|
||||||
if (size.flags & (PPosition|USPosition)) {
|
self->positioned = !!(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;
|
||||||
|
|
|
@ -284,10 +284,28 @@ void client_configure(ObClient *self, ObCorner anchor,
|
||||||
|
|
||||||
void client_reconfigure(ObClient *self);
|
void client_reconfigure(ObClient *self);
|
||||||
|
|
||||||
|
/*! Finds coordinates to keep a client on the screen.
|
||||||
|
@param self The client
|
||||||
|
@param x The x coord of the client, may be changed.
|
||||||
|
@param y The y coord of the client, may be changed.
|
||||||
|
@param w The width of the client.
|
||||||
|
@param w The height of the client.
|
||||||
|
@param rude Be rude about it. If false, it is only moved if it is entirely
|
||||||
|
not visible. If true, then make sure the window is inside the
|
||||||
|
struts if possible.
|
||||||
|
@return true if the client was moved to be on-screen; false if not.
|
||||||
|
*/
|
||||||
|
gboolean client_find_onscreen(ObClient *self, int *x, int *y, int w, int h,
|
||||||
|
gboolean rude);
|
||||||
|
|
||||||
/*! Moves a client so that it is on screen if it is entirely out of the
|
/*! Moves a client so that it is on screen if it is entirely out of the
|
||||||
viewable screen.
|
viewable screen.
|
||||||
|
@param self The client to move
|
||||||
|
@param rude Be rude about it. If false, it is only moved if it is entirely
|
||||||
|
not visible. If true, then make sure the window is inside the
|
||||||
|
struts if possible.
|
||||||
*/
|
*/
|
||||||
void client_move_onscreen(ObClient *self);
|
void client_move_onscreen(ObClient *self, gboolean rude);
|
||||||
|
|
||||||
/*! Fullscreen's or unfullscreen's the client window
|
/*! Fullscreen's or unfullscreen's the client window
|
||||||
@param fs true if the window should be made fullscreen; false if it should
|
@param fs true if the window should be made fullscreen; false if it should
|
||||||
|
|
|
@ -725,7 +725,6 @@ 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;
|
||||||
|
@ -736,15 +735,15 @@ 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 */
|
int newx = x;
|
||||||
a = screen_area(client->desktop);
|
int newy = y;
|
||||||
if (e->xconfigurerequest.value_mask & CWX &&
|
client_find_onscreen(client, &newx, &newy, w, h, TRUE);
|
||||||
w <= a->width && x < a->x)
|
if (e->xconfigurerequest.value_mask & CWX)
|
||||||
x = a->x;
|
x = newx;
|
||||||
if (e->xconfigurerequest.value_mask & CWY &&
|
if (e->xconfigurerequest.value_mask & CWY)
|
||||||
h <= a->height && y < a->y)
|
y = newy;
|
||||||
y = a->y;
|
}
|
||||||
|
|
||||||
switch (client->gravity) {
|
switch (client->gravity) {
|
||||||
case NorthEastGravity:
|
case NorthEastGravity:
|
||||||
|
@ -910,7 +909,6 @@ 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;
|
||||||
|
@ -935,21 +933,15 @@ static void event_handle_client(ObClient *client, XEvent *e)
|
||||||
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);
|
int newx = x;
|
||||||
|
int newy = y;
|
||||||
/* dont let windows move above/left into the strut unless they are
|
client_find_onscreen(client, &newx, &newy, w, h, TRUE);
|
||||||
bigger than the available area */
|
if (e->xclient.data.l[0] & 1 << 8)
|
||||||
a = screen_area(client->desktop);
|
x = newx;
|
||||||
if (e->xconfigurerequest.value_mask & CWX &&
|
if (e->xclient.data.l[0] & 1 << 9)
|
||||||
w <= a->width && x < a->x)
|
y = newy;
|
||||||
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);
|
||||||
|
|
|
@ -357,7 +357,7 @@ void screen_resize()
|
||||||
screen_update_areas();
|
screen_update_areas();
|
||||||
|
|
||||||
for (it = client_list; it; it = it->next)
|
for (it = client_list; it; it = it->next)
|
||||||
client_move_onscreen(it->data);
|
client_move_onscreen(it->data, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void screen_set_num_desktops(guint num)
|
void screen_set_num_desktops(guint num)
|
||||||
|
|
Loading…
Reference in a new issue