g_free(self->name);
g_free(self->class);
g_free(self->role);
+ g_free(self->sm_client_id);
g_free(self);
/* update the list hints */
/* XXX watch for xinerama dead areas */
a = screen_area(self->desktop);
- if (!self->strut.right && *x >= a->x + a->width - 1)
- *x = a->x + a->width - self->frame->area.width;
- if (!self->strut.bottom && *y >= a->y + a->height - 1)
- *y = a->y + a->height - self->frame->area.height;
- if (!self->strut.left && *x + self->frame->area.width - 1 < a->x)
- *x = a->x;
- if (!self->strut.top && *y + self->frame->area.height - 1 < a->y)
- *y = a->y;
+ if (client_normal(self)) {
+ if (!self->strut.right && *x >= a->x + a->width - 1)
+ *x = a->x + a->width - self->frame->area.width;
+ if (!self->strut.bottom && *y >= a->y + a->height - 1)
+ *y = a->y + a->height - self->frame->area.height;
+ if (!self->strut.left && *x + self->frame->area.width - 1 < a->x)
+ *x = a->x;
+ if (!self->strut.top && *y + self->frame->area.height - 1 < a->y)
+ *y = a->y;
+ }
if (rude) {
/* this is my MOZILLA BITCHSLAP. oh ya it fucking feels good.
client_get_state(self);
client_get_shaped(self);
- g_message("self->iconic %d", self->iconic);
-
client_get_mwm_hints(self);
client_get_type(self);/* this can change the mwmhints for special cases */
client_update_title(self);
client_update_class(self);
+ client_update_sm_client_id(self);
client_update_strut(self);
client_update_icons(self);
}
}
if (PROP_GETS(self->window, wm_window_role, locale, &s))
- self->role = g_strdup(s);
+ self->role = s;
if (self->name == NULL) self->name = g_strdup("");
if (self->class == NULL) self->class = g_strdup("");
}
}
+ if (!self->nicons) {
+ self->nicons++;
+ self->icons = g_new(ObClientIcon, self->nicons);
+ self->icons[self->nicons-1].width = 48;
+ self->icons[self->nicons-1].height = 48;
+ self->icons[self->nicons-1].data = g_memdup(ob_rr_theme->def_win_icon,
+ sizeof(RrPixel32)
+ * 48 * 48);
+ }
+
if (self->frame)
frame_adjust_icon(self->frame);
}
{
/* these are in a carefully crafted order.. */
- g_message("self->iconic %d", self->iconic);
if (self->iconic) {
self->iconic = FALSE;
client_iconify(self, TRUE, FALSE);
gboolean user, gboolean final,
gboolean force_reply)
{
+ gint oldw, oldh;
+ gboolean send_resize_client;
gboolean moved = FALSE, resized = FALSE;
guint fdecor = self->frame->decorations;
gboolean fhorz = self->frame->max_horz;
moved = x != self->area.x || y != self->area.y;
resized = w != self->area.width || h != self->area.height;
+ oldw = self->area.width;
+ oldh = self->area.height;
RECT_SET(self->area, x, y, w, h);
/* for app-requested resizes, always resize if 'resized' is true.
for user-requested ones, only resize if final is true, or when
resizing in redraw mode */
- if ((!user && resized) ||
- (user && (final || (resized && config_redraw_resize))))
- XResizeWindow(ob_display, self->window, w, h);
+ send_resize_client = ((!user && resized) ||
+ (user && (final ||
+ (resized && config_redraw_resize))));
+
+ /* if the client is enlarging, the resize the client before the frame */
+ if (send_resize_client && (w > oldw || h > oldh))
+ XResizeWindow(ob_display, self->window, MAX(w, oldw), MAX(h, oldh));
/* move/resize the frame to match the request */
if (self->frame) {
FALSE, StructureNotifyMask, &event);
}
}
+
+ /* if the client is shrinking, then resize the frame before the client */
+ if (send_resize_client && (w <= oldw || h <= oldh))
+ XResizeWindow(ob_display, self->window, w, h);
+
+ XFlush(ob_display);
}
void client_fullscreen(ObClient *self, gboolean fs, gboolean savearea)
/* li is the largest image < req */
unsigned long size, smallest = 0xffffffff, largest = 0, si = 0, li = 0;
- if (!self->nicons) return NULL;
-
for (i = 0; i < self->nicons; ++i) {
size = self->icons[i].width * self->icons[i].height;
if (size < smallest && size >= (unsigned)(w * h)) {
return NULL;
}
-gchar* client_get_sm_client_id(ObClient *self)
+void client_update_sm_client_id(ObClient *self)
{
- gchar *id = NULL;
+ g_free(self->sm_client_id);
+ self->sm_client_id = NULL;
- if (!PROP_GETS(self->window, sm_client_id, locale, &id) && self->group)
- PROP_GETS(self->group->leader, sm_client_id, locale, &id);
- return id;
+ if (!PROP_GETS(self->window, sm_client_id, locale, &self->sm_client_id) &&
+ self->group)
+ PROP_GETS(self->group->leader, sm_client_id, locale,
+ &self->sm_client_id);
}
/* finds the nearest edge in the given direction from the current client