static void client_apply_startup_state(Client *self);
static Client *search_modal_tree(Client *node, Client *skip);
-static guint map_hash(Window w) { return w; }
-static gboolean map_key_comp(Window w1, Window w2) { return w1 == w2; }
+static guint map_hash(Window *w) { return *w; }
+static gboolean map_key_comp(Window *w1, Window *w2) { return *w1 == *w2; }
void client_startup()
{
client_list = g_slist_append(client_list, client);
stacking_list = g_list_append(stacking_list, client);
- g_assert(!g_hash_table_lookup(client_map, (gpointer)client->window));
- g_hash_table_insert(client_map, (gpointer)window, client);
+ g_assert(!g_hash_table_lookup(client_map, &client->window));
+ g_hash_table_insert(client_map, &client->window, client);
/* update the focus lists */
if (client->desktop == DESKTOP_ALL) {
client_list = g_slist_remove(client_list, client);
stacking_list = g_list_remove(stacking_list, client);
- g_hash_table_remove(client_map, (gpointer)client->window);
+ g_hash_table_remove(client_map, &client->window);
/* update the focus lists */
if (client->desktop == DESKTOP_ALL) {
if (XGetTransientForHint(ob_display, self->window, &t) &&
t != self->window) { /* cant be transient to itself! */
self->transient = TRUE;
- c = g_hash_table_lookup(client_map, (gpointer)t);
+ c = g_hash_table_lookup(client_map, &t);
g_assert(c != self);/* if this happens then we need to check for it*/
if (!c /*XXX: && _group*/) {
/* can't maximize without moving/resizing */
if (!((self->functions & Func_Move) && (self->functions & Func_Resize)))
- self->functions &= ~Func_Maximize;
+ self->functions &= ~(Func_Maximize | Func_Fullscreen);
/* finally, user specified disabled decorations are applied to subtract
decorations */
if (self->frame) {
/* change the decors on the frame, and with more/less decorations,
we may also need to be repositioned */
- engine_frame_adjust_area(self->frame);
+ engine_frame_adjust_area(self->frame, TRUE, TRUE);
/* with new decor, the window's maximized size may change */
client_remaximize(self);
}
}
}
- if (x == self->area.x && y == self->area.y && w == self->area.width &&
- h == self->area.height)
- return; /* no change */
-
- w -= self->base_size.width;
- h -= self->base_size.height;
-
+ /* these override the above states! if you cant move you can't move! */
if (user) {
- /* for interactive resizing. have to move half an increment in each
- direction. */
-
- /* how far we are towards the next size inc */
- int mw = w % self->size_inc.width;
- int mh = h % self->size_inc.height;
- /* amount to add */
- int aw = self->size_inc.width / 2;
- int ah = self->size_inc.height / 2;
- /* don't let us move into a new size increment */
- if (mw + aw >= self->size_inc.width)
- aw = self->size_inc.width - mw - 1;
- if (mh + ah >= self->size_inc.height)
- ah = self->size_inc.height - mh - 1;
- w += aw;
- h += ah;
-
- /* if this is a user-requested resize, then check against min/max
- sizes and aspect ratios */
-
- /* smaller than min size or bigger than max size? */
- if (w > self->max_size.width) w = self->max_size.width;
- if (w < self->min_size.width) w = self->min_size.width;
- if (h > self->max_size.height) h = self->max_size.height;
- if (h < self->min_size.height) h = self->min_size.height;
-
- /* adjust the height ot match the width for the aspect ratios */
- if (self->min_ratio)
- if (h * self->min_ratio > w) h = (int)(w / self->min_ratio);
- if (self->max_ratio)
- if (h * self->max_ratio < w) h = (int)(w / self->max_ratio);
+ if (!(self->functions & Func_Move)) {
+ x = self->area.x;
+ y = self->area.y;
+ }
+ if (!(self->functions & Func_Resize)) {
+ w = self->area.width;
+ h = self->area.height;
+ }
}
- /* keep to the increments */
- w /= self->size_inc.width;
- h /= self->size_inc.height;
+ if (!(w == self->area.width && h == self->area.height)) {
+ w -= self->base_size.width;
+ h -= self->base_size.height;
+
+ if (user) {
+ /* for interactive resizing. have to move half an increment in each
+ direction. */
+
+ /* how far we are towards the next size inc */
+ int mw = w % self->size_inc.width;
+ int mh = h % self->size_inc.height;
+ /* amount to add */
+ int aw = self->size_inc.width / 2;
+ int ah = self->size_inc.height / 2;
+ /* don't let us move into a new size increment */
+ if (mw + aw >= self->size_inc.width)
+ aw = self->size_inc.width - mw - 1;
+ if (mh + ah >= self->size_inc.height)
+ ah = self->size_inc.height - mh - 1;
+ w += aw;
+ h += ah;
+
+ /* if this is a user-requested resize, then check against min/max
+ sizes and aspect ratios */
+
+ /* smaller than min size or bigger than max size? */
+ if (w > self->max_size.width) w = self->max_size.width;
+ if (w < self->min_size.width) w = self->min_size.width;
+ if (h > self->max_size.height) h = self->max_size.height;
+ if (h < self->min_size.height) h = self->min_size.height;
+
+ /* adjust the height ot match the width for the aspect ratios */
+ if (self->min_ratio)
+ if (h * self->min_ratio > w) h = (int)(w / self->min_ratio);
+ if (self->max_ratio)
+ if (h * self->max_ratio < w) h = (int)(w / self->max_ratio);
+ }
+
+ /* keep to the increments */
+ w /= self->size_inc.width;
+ h /= self->size_inc.height;
- /* you cannot resize to nothing */
- if (w < 1) w = 1;
- if (h < 1) h = 1;
+ /* you cannot resize to nothing */
+ if (w < 1) w = 1;
+ if (h < 1) h = 1;
- /* store the logical size */
- SIZE_SET(self->logical_size, w, h);
+ /* store the logical size */
+ SIZE_SET(self->logical_size, w, h);
- w *= self->size_inc.width;
- h *= self->size_inc.height;
+ w *= self->size_inc.width;
+ h *= self->size_inc.height;
- w += self->base_size.width;
- h += self->base_size.height;
+ w += self->base_size.width;
+ h += self->base_size.height;
+ }
switch (anchor) {
case Corner_TopLeft:
/* move/resize the frame to match the request */
if (self->frame) {
- engine_frame_adjust_area(self->frame);
-
- if (moved) {
- if (!user || final) {
- XEvent event;
- event.type = ConfigureNotify;
- event.xconfigure.display = ob_display;
- event.xconfigure.event = self->window;
- event.xconfigure.window = self->window;
+ if (moved || resized)
+ engine_frame_adjust_area(self->frame, moved, resized);
+
+ if (!user || final) {
+ XEvent event;
+ event.type = ConfigureNotify;
+ event.xconfigure.display = ob_display;
+ event.xconfigure.event = self->window;
+ event.xconfigure.window = self->window;
- /* root window coords with border in mind */
- event.xconfigure.x = x - self->border_width +
- self->frame->size.left;
- event.xconfigure.y = y - self->border_width +
- self->frame->size.top;
+ /* root window coords with border in mind */
+ event.xconfigure.x = x - self->border_width +
+ self->frame->size.left;
+ event.xconfigure.y = y - self->border_width +
+ self->frame->size.top;
- event.xconfigure.width = self->area.width;
- event.xconfigure.height = self->area.height;
- event.xconfigure.border_width = self->border_width;
- event.xconfigure.above = self->frame->plate;
- event.xconfigure.override_redirect = FALSE;
- XSendEvent(event.xconfigure.display, event.xconfigure.window,
- FALSE, StructureNotifyMask, &event);
- }
+ event.xconfigure.width = self->area.width;
+ event.xconfigure.height = self->area.height;
+ event.xconfigure.border_width = self->border_width;
+ event.xconfigure.above = self->frame->plate;
+ event.xconfigure.override_redirect = FALSE;
+ XSendEvent(event.xconfigure.display, event.xconfigure.window,
+ FALSE, StructureNotifyMask, &event);
}
}
}
self->shaded = shade;
client_change_state(self);
/* resize the frame to just the titlebar */
- engine_frame_adjust_area(self->frame);
+ engine_frame_adjust_area(self->frame, FALSE, FALSE);
}
void client_close(Client *self)