fix programs showing their child windows outside the screen, but retain the possibility to put windows slightly offscreen with the -geometry argument (which is why i broke it in the first place)

This commit is contained in:
Mikael Magnusson 2005-08-11 13:23:59 +00:00
parent 3b83230aaf
commit 829e746b4d
2 changed files with 17 additions and 9 deletions

View file

@ -351,8 +351,11 @@ void client_manage(Window window)
/* non-normal clients has less rules, and /* non-normal clients has less rules, and
windows that are being restored from a session windows that are being restored from a session
do also. we can assume you want it back where do also. we can assume you want it back where
you saved it */ you saved it. Clients saying the user placed
client_normal(self) && !self->session); them are also spared from the evil rules */
!(self->positioned & USPosition) &&
client_normal(self) &&
!self->session);
if (x != ox || y != oy) if (x != ox || y != oy)
client_move(self, x, y); client_move(self, x, y);
} }
@ -543,7 +546,7 @@ static void client_restore_session_state(ObClient *self)
self->session = it->data; self->session = it->data;
RECT_SET_POINT(self->area, self->session->x, self->session->y); RECT_SET_POINT(self->area, self->session->x, self->session->y);
self->positioned = TRUE; self->positioned = PPosition;
if (self->session->w > 0) if (self->session->w > 0)
self->area.width = self->session->w; self->area.width = self->session->w;
if (self->session->h > 0) if (self->session->h > 0)
@ -625,9 +628,12 @@ gboolean client_find_onscreen(ObClient *self, gint *x, gint *y, gint w, gint h,
} }
/* This here doesn't let windows even a pixel outside the screen, /* This here doesn't let windows even a pixel outside the screen,
* not applied to all windows. Not sure if it's going to stay at all. * when called from client_manage, programs placing themselves are
* I wonder if disabling this will break struts somehow? Let's find out. */ * forced completely onscreen, while things like
if (0 && rude) { * xterm -geometry resolution-width/2 will work fine. Trying to
* place it completely offscreen will be handled in the above code.
* Sorry for this confused comment, i am tired. */
if (rude) {
/* avoid the xinerama monitor divide while we're at it, /* avoid the xinerama monitor divide while we're at it,
* remember to fix the placement stuff to avoid it also and * remember to fix the placement stuff to avoid it also and
* then remove this XXX */ * then remove this XXX */
@ -1118,7 +1124,7 @@ void client_update_normal_hints(ObClient *self)
/* normal windows can't request placement! har har /* normal windows can't request placement! har har
if (!client_normal(self)) if (!client_normal(self))
*/ */
self->positioned = !!(size.flags & (PPosition|USPosition)); self->positioned = (size.flags & (PPosition|USPosition));
if (size.flags & PWinGravity) { if (size.flags & PWinGravity) {
self->gravity = size.win_gravity; self->gravity = size.win_gravity;

View file

@ -201,9 +201,11 @@ struct _ObClient
/*! True if the client supports the delete_window protocol */ /*! True if the client supports the delete_window protocol */
gboolean delete_window; gboolean delete_window;
/*! Was the window's position requested by the application? if not, we /*! Was the window's position requested by the application or the user?
if by the application, we force it completely onscreen, if by the user
we only force it if it tries to go completely offscreen, if neither, we
should place the window ourselves when it first appears */ should place the window ourselves when it first appears */
gboolean positioned; guint positioned;
/*! Can the window receive input focus? */ /*! Can the window receive input focus? */
gboolean can_focus; gboolean can_focus;