void client_add_destroy_notify(ObClientCallback func, gpointer data)
{
- ClientCallback *d = g_new(ClientCallback, 1);
+ ClientCallback *d = g_slice_new(ClientCallback);
d->func = func;
d->data = data;
client_destroy_notifies = g_slist_prepend(client_destroy_notifies, d);
for (it = client_destroy_notifies; it; it = g_slist_next(it)) {
ClientCallback *d = it->data;
if (d->func == func) {
- g_free(d);
+ g_slice_free(ClientCallback, d);
client_destroy_notifies =
g_slist_delete_link(client_destroy_notifies, it);
break;
gboolean activate = FALSE;
ObAppSettings *settings;
gboolean transient = FALSE;
- Rect place, *monitor, *allmonitors;
+ Rect place;
+ Rect const *monitor, *allmonitors;
Time launch_time, map_time;
guint32 user_time;
gboolean obplaced;
/* create the ObClient struct, and populate it from the hints on the
window */
- self = g_new0(ObClient, 1);
+ self = g_slice_new0(ObClient);
self->obwin.type = OB_WINDOW_CLASS_CLIENT;
self->window = window;
self->prompt = prompt;
Rect *r;
r = screen_area(self->desktop, SCREEN_AREA_ALL_MONITORS, NULL);
- place.x = r->x;
- place.y = r->y;
- ob_debug("Moving buggy app from (0,0) to (%d,%d)", r->x, r->y);
- g_free(r);
+ if (r->x || r->y) {
+ place.x = r->x;
+ place.y = r->y;
+ ob_debug("Moving buggy app from (0,0) to (%d,%d)", r->x, r->y);
+ }
+ g_slice_free(Rect, r);
}
/* make sure the window is visible. */
place.width -= self->frame->size.left + self->frame->size.right;
place.height -= self->frame->size.top + self->frame->size.bottom;
- g_free(a);
+ g_slice_free(Rect, a);
}
ob_debug("placing window 0x%x at %d, %d with size %d x %d. "
client_apply_startup_state(self, place.x, place.y,
place.width, place.height);
- g_free(monitor);
monitor = NULL;
- g_free(allmonitors);
allmonitors = NULL;
ob_debug_type(OB_DEBUG_FOCUS, "Going to try activate new window? %s",
client_set_list();
/* free the ObAppSettings shallow copy */
- g_free(settings);
+ g_slice_free(ObAppSettings, settings);
ob_debug("Managed window 0x%lx plate 0x%x (%s)",
window, self->frame->window, self->class);
/* do this minimal stuff to figure out the client's decorations */
- self = g_new0(ObClient, 1);
+ self = g_slice_new0(ObClient);
self->window = window;
client_get_all(self, FALSE);
self->frame->size.top, self->frame->size.bottom);
/* free the ObAppSettings shallow copy */
- g_free(settings);
+ g_slice_free(ObAppSettings, settings);
return self;
}
g_free(self->role);
g_free(self->client_machine);
g_free(self->sm_client_id);
- g_free(self);
+ g_slice_free(ObClient, self);
}
void client_fake_unmanage(ObClient *self)
/* this is all that got allocated to get the decorations */
frame_free(self->frame);
- g_free(self);
+ g_slice_free(ObClient, self);
}
static gboolean client_can_steal_focus(ObClient *self, Time steal_time,
/* This is focus stealing prevention */
ob_debug_type(OB_DEBUG_FOCUS,
- "Want to focus new window 0x%x at time %u "
+ "Want to focus window 0x%x at time %u "
"launched at %u (last user interaction time %u)",
self->window, steal_time, launch_time,
event_last_user_time);
if (rudeb && !self->strut.bottom && *y + fh > a->y + a->height)
*y = a->y + MAX(0, a->height - fh);
- g_free(a);
+ g_slice_free(Rect, a);
}
/* get where the client should be */
if (!got &&
OBT_PROP_GETA32(self->window, NET_WM_STRUT, CARDINAL, &data, &num)) {
if (num == 4) {
- Rect *a;
+ Rect const *a;
got = TRUE;
a->x, a->x + a->width - 1,
a->y, a->y + a->height - 1,
a->x, a->x + a->width - 1);
- g_free(a);
}
g_free(data);
}
static ObStackingLayer calc_layer(ObClient *self)
{
ObStackingLayer l;
- Rect *monitor, *allmonitors;
+ Rect const *monitor, *allmonitors;
monitor = screen_physical_area_monitor(client_monitor(self));
allmonitors = screen_physical_area_all_monitors();
else if (self->below) l = OB_STACKING_LAYER_BELOW;
else l = OB_STACKING_LAYER_NORMAL;
- g_free(monitor);
- g_free(allmonitors);
-
return l;
}
/* set the size and position if fullscreen */
if (self->fullscreen) {
- Rect *a;
+ Rect const *a;
guint i;
i = screen_find_monitor(&desired);
user = FALSE; /* ignore if the client can't be moved/resized when it
is fullscreening */
-
- g_free(a);
} else if (self->max_horz || self->max_vert) {
Rect *a;
guint i;
user = FALSE; /* ignore if the client can't be moved/resized when it
is maximizing */
- g_free(a);
+ g_slice_free(Rect, a);
}
/* gets the client's position */
if (fs) {
self->pre_fullscreen_area = self->area;
+ self->pre_fullscreen_max_horz = self->max_horz;
+ self->pre_fullscreen_max_vert = self->max_vert;
+
/* if the window is maximized, its area isn't all that meaningful.
save its premax area instead. */
if (self->max_horz) {
g_assert(self->pre_fullscreen_area.width > 0 &&
self->pre_fullscreen_area.height > 0);
+ self->max_horz = self->pre_fullscreen_max_horz;
+ self->max_vert = self->pre_fullscreen_max_vert;
+ if (self->max_horz) {
+ self->pre_max_area.x = self->pre_fullscreen_area.x;
+ self->pre_max_area.width = self->pre_fullscreen_area.width;
+ }
+ if (self->max_vert) {
+ self->pre_max_area.y = self->pre_fullscreen_area.y;
+ self->pre_max_area.height = self->pre_fullscreen_area.height;
+ }
+
x = self->pre_fullscreen_area.x;
y = self->pre_fullscreen_area.y;
w = self->pre_fullscreen_area.width;
Rect *area = screen_area(self->desktop, i, NULL);
detect_edge(*area, dir, my_head, my_size, my_edge_start,
my_edge_size, dest, near_edge);
- g_free(area);
+ g_slice_free(Rect, area);
}
/* search for edges of clients */
- for (it = client_list; it; it = g_list_next(it)) {
- ObClient *cur = it->data;
+ if (((dir == OB_DIRECTION_NORTH || dir == OB_DIRECTION_SOUTH) &&
+ !self->max_vert) ||
+ ((dir == OB_DIRECTION_EAST || dir == OB_DIRECTION_WEST) &&
+ !self->max_horz))
+ {
+ for (it = client_list; it; it = g_list_next(it)) {
+ ObClient *cur = it->data;
- /* skip windows to not bump into */
- if (cur == self)
- continue;
- if (cur->iconic)
- continue;
- if (self->desktop != cur->desktop && cur->desktop != DESKTOP_ALL &&
- cur->desktop != screen_desktop)
- continue;
+ /* skip windows to not bump into */
+ if (cur == self)
+ continue;
+ if (cur->iconic)
+ continue;
+ if (self->desktop != cur->desktop && cur->desktop != DESKTOP_ALL &&
+ cur->desktop != screen_desktop)
+ continue;
- ob_debug("trying window %s", cur->title);
+ ob_debug("trying window %s", cur->title);
- detect_edge(cur->frame->area, dir, my_head, my_size, my_edge_start,
+ detect_edge(cur->frame->area, dir, my_head, my_size, my_edge_start,
+ my_edge_size, dest, near_edge);
+ }
+ dock_get_area(&dock_area);
+ detect_edge(dock_area, dir, my_head, my_size, my_edge_start,
my_edge_size, dest, near_edge);
}
- dock_get_area(&dock_area);
- detect_edge(dock_area, dir, my_head, my_size, my_edge_start,
- my_edge_size, dest, near_edge);
- g_free(a);
+
+ g_slice_free(Rect, a);
}
void client_find_move_directional(ObClient *self, ObDirection dir,