RECT_SET(self->area, self->session->x, self->session->y,
self->session->w, self->session->h);
self->positioned = TRUE;
- XResizeWindow(ob_display, self->window,
- self->session->w, self->session->h);
+ if (self->session->w > 0 && self->session->h > 0)
+ XResizeWindow(ob_display, self->window,
+ self->session->w, self->session->h);
self->desktop = (self->session->desktop == DESKTOP_ALL ?
self->session->desktop :
OB_CLIENT_FUNC_MAXIMIZE |
OB_CLIENT_FUNC_SHADE);
if (self->delete_window) {
- self->functions |= OB_CLIENT_FUNC_CLOSE;
+ self->functions |= OB_CLIENT_FUNC_CLOSE;
self->decorations |= OB_FRAME_DECOR_CLOSE;
}
if (!(self->min_size.width < self->max_size.width ||
- self->min_size.height < self->max_size.height))
- self->functions &= ~OB_CLIENT_FUNC_RESIZE;
+ self->min_size.height < self->max_size.height))
+ self->functions &= ~OB_CLIENT_FUNC_RESIZE;
switch (self->type) {
case OB_CLIENT_TYPE_NORMAL:
- /* normal windows retain all of the possible decorations and
- functionality, and are the only windows that you can fullscreen */
- self->functions |= OB_CLIENT_FUNC_FULLSCREEN;
- break;
+ /* normal windows retain all of the possible decorations and
+ functionality, and are the only windows that you can fullscreen */
+ self->functions |= OB_CLIENT_FUNC_FULLSCREEN;
+ break;
case OB_CLIENT_TYPE_DIALOG:
case OB_CLIENT_TYPE_UTILITY:
- /* these windows cannot be maximized */
- self->functions &= ~OB_CLIENT_FUNC_MAXIMIZE;
- break;
+ /* these windows cannot be maximized */
+ self->functions &= ~OB_CLIENT_FUNC_MAXIMIZE;
+ break;
case OB_CLIENT_TYPE_MENU:
case OB_CLIENT_TYPE_TOOLBAR:
- /* these windows get less functionality */
- self->functions &= ~(OB_CLIENT_FUNC_ICONIFY | OB_CLIENT_FUNC_RESIZE);
- break;
+ /* these windows get less functionality */
+ self->functions &= ~(OB_CLIENT_FUNC_ICONIFY | OB_CLIENT_FUNC_RESIZE);
+ break;
case OB_CLIENT_TYPE_DESKTOP:
case OB_CLIENT_TYPE_DOCK:
case OB_CLIENT_TYPE_SPLASH:
- /* none of these windows are manipulated by the window manager */
- self->decorations = 0;
- self->functions = 0;
- break;
+ /* none of these windows are manipulated by the window manager */
+ self->decorations = 0;
+ self->functions = 0;
+ break;
}
/* Mwm Hints are applied subtractively to what has already been chosen for
decor and functionality */
if (self->mwmhints.flags & OB_MWM_FLAG_DECORATIONS) {
- if (! (self->mwmhints.decorations & OB_MWM_DECOR_ALL)) {
- if (! ((self->mwmhints.decorations & OB_MWM_DECOR_HANDLE) ||
+ if (! (self->mwmhints.decorations & OB_MWM_DECOR_ALL)) {
+ if (! ((self->mwmhints.decorations & OB_MWM_DECOR_HANDLE) ||
(self->mwmhints.decorations & OB_MWM_DECOR_TITLE)))
/* if the mwm hints request no handle or title, then all
decorations are disabled */
- self->decorations = 0;
- }
+ self->decorations = 0;
+ }
}
if (self->mwmhints.flags & OB_MWM_FLAG_FUNCTIONS) {
- if (! (self->mwmhints.functions & OB_MWM_FUNC_ALL)) {
- if (! (self->mwmhints.functions & OB_MWM_FUNC_RESIZE))
- self->functions &= ~OB_CLIENT_FUNC_RESIZE;
- if (! (self->mwmhints.functions & OB_MWM_FUNC_MOVE))
- self->functions &= ~OB_CLIENT_FUNC_MOVE;
+ if (! (self->mwmhints.functions & OB_MWM_FUNC_ALL)) {
+ if (! (self->mwmhints.functions & OB_MWM_FUNC_RESIZE))
+ self->functions &= ~OB_CLIENT_FUNC_RESIZE;
+ if (! (self->mwmhints.functions & OB_MWM_FUNC_MOVE))
+ self->functions &= ~OB_CLIENT_FUNC_MOVE;
/* dont let mwm hints kill any buttons
- if (! (self->mwmhints.functions & OB_MWM_FUNC_ICONIFY))
- self->functions &= ~OB_CLIENT_FUNC_ICONIFY;
- if (! (self->mwmhints.functions & OB_MWM_FUNC_MAXIMIZE))
- self->functions &= ~OB_CLIENT_FUNC_MAXIMIZE;
+ if (! (self->mwmhints.functions & OB_MWM_FUNC_ICONIFY))
+ self->functions &= ~OB_CLIENT_FUNC_ICONIFY;
+ if (! (self->mwmhints.functions & OB_MWM_FUNC_MAXIMIZE))
+ self->functions &= ~OB_CLIENT_FUNC_MAXIMIZE;
*/
- /* dont let mwm hints kill the close button
- if (! (self->mwmhints.functions & MwmFunc_Close))
- self->functions &= ~OB_CLIENT_FUNC_CLOSE; */
- }
+ /* dont let mwm hints kill the close button
+ if (! (self->mwmhints.functions & MwmFunc_Close))
+ self->functions &= ~OB_CLIENT_FUNC_CLOSE; */
+ }
}
if (!(self->functions & OB_CLIENT_FUNC_SHADE))
/* if we don't have a titlebar, then we cannot shade! */
if (!(self->decorations & OB_FRAME_DECOR_TITLEBAR))
- self->functions &= ~OB_CLIENT_FUNC_SHADE;
+ self->functions &= ~OB_CLIENT_FUNC_SHADE;
/* now we need to check against rules for the client's current state */
if (self->fullscreen) {
- self->functions &= (OB_CLIENT_FUNC_CLOSE |
+ self->functions &= (OB_CLIENT_FUNC_CLOSE |
OB_CLIENT_FUNC_FULLSCREEN |
OB_CLIENT_FUNC_ICONIFY);
- self->decorations = 0;
+ self->decorations = 0;
}
client_change_allowed_actions(self);
{
if (self->iconic) return FALSE;
else if (!(self->desktop == screen_desktop ||
- self->desktop == DESKTOP_ALL)) return FALSE;
+ self->desktop == DESKTOP_ALL)) return FALSE;
else if (client_normal(self) && screen_showing_desktop) return FALSE;
return TRUE;
h -= self->base_size.height;
if (self->min_ratio)
- if (h * self->min_ratio > w) h = (int)(w / self->min_ratio);
+ if (h * self->min_ratio > w) {
+ h = (int)(w / self->min_ratio);
+
+ /* you cannot resize to nothing */
+ if (h < 1) {
+ h = 1;
+ w = (int)(h * self->min_ratio);
+ }
+ }
if (self->max_ratio)
- if (h * self->max_ratio < w) h = (int)(w / self->max_ratio);
+ if (h * self->max_ratio < w) {
+ h = (int)(w / self->max_ratio);
+
+ /* you cannot resize to nothing */
+ if (h < 1) {
+ h = 1;
+ w = (int)(h * self->min_ratio);
+ }
+ }
w += self->base_size.width;
h += self->base_size.height;
}
+ g_assert(w > 0);
+ g_assert(h > 0);
+
switch (anchor) {
case OB_CORNER_TOPLEFT:
- break;
+ break;
case OB_CORNER_TOPRIGHT:
- x -= w - self->area.width;
- break;
+ x -= w - self->area.width;
+ break;
case OB_CORNER_BOTTOMLEFT:
- y -= h - self->area.height;
- break;
+ y -= h - self->area.height;
+ break;
case OB_CORNER_BOTTOMRIGHT:
- x -= w - self->area.width;
- y -= h - self->area.height;
- break;
+ x -= w - self->area.width;
+ y -= h - self->area.height;
+ break;
}
moved = x != self->area.x || y != self->area.y;
h = self->area.height;
if (max) {
- if (savearea)
- self->pre_max_area = self->area;
+ if (savearea) {
+ if ((dir == 0 || dir == 1) && !self->max_horz) { /* horz */
+ RECT_SET(self->pre_max_area,
+ self->area.x, self->pre_max_area.y,
+ self->area.width, self->pre_max_area.height);
+ }
+ if ((dir == 0 || dir == 2) && !self->max_vert) { /* vert */
+ RECT_SET(self->pre_max_area,
+ self->pre_max_area.x, self->area.y,
+ self->pre_max_area.width, self->area.height);
+ }
+ }
} else {
Rect *a;
if (!self->frame->visible)
return FALSE;
- if (!((self->can_focus || self->focus_notify) &&
- (self->desktop == screen_desktop ||
- self->desktop == DESKTOP_ALL) &&
- !self->iconic))
+ if (!(self->can_focus || self->focus_notify))
return FALSE;
/* do a check to see if the window has already been unmapped or destroyed
/* li is the largest image < req */
unsigned long size, smallest = 0xffffffff, largest = 0, si = 0, li = 0;
- g_message("icons %d", self->nicons);
-
if (!self->nicons) {
ObClientIcon *parent = NULL;
ObClientIcon *ret;
static ObClientIcon deficon;
- g_message("going for broke");
if (!(ret = client_icon_recursive(self, w, h))) {
- g_message("using default");
deficon.width = deficon.height = 48;
deficon.data = ob_rr_theme->def_win_icon;
ret = &deficon;
for (it = stacking_list; it != NULL; it = it->next) {
if (WINDOW_IS_CLIENT(it->data)) {
ObClient *c = WINDOW_AS_CLIENT(it->data);
- if (c->desktop == screen_desktop &&
+ if (c->frame->visible &&
RECT_CONTAINS(c->frame->area, x, y)) {
ret = c;
break;