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;
/* 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;
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);
+ 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. "
/* 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);
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)
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 */
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 */
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 */
my_edge_size, dest, near_edge);
}
- g_free(a);
+ g_slice_free(Rect, a);
}
void client_find_move_directional(ObClient *self, ObDirection dir,
else *y = areas[i]->y;
for (i = 0; i < screen_num_monitors; ++i)
- g_free(areas[i]);
+ g_slice_free(Rect, areas[i]);
g_free(areas);
return TRUE;
}
for (i = 0; i < screen_num_monitors; ++i)
- g_free(areas[i]);
+ g_slice_free(Rect, areas[i]);
g_free(areas);
return ret;
}
*y = py - client->area.height / 2 - client->frame->size.top;
*y = MIN(MAX(*y, t), b);
+ g_slice_free(Rect, area);
+
return TRUE;
}
/* don't free the first one, it's being set as "screen" */
for (i = 1; i < screen_num_monitors; ++i)
- g_free(areas[i]);
+ g_slice_free(Rect, areas[i]);
g_free(areas);
}
else
*y = screen->y + settings->position.y.pos;
- g_free(screen);
+ g_slice_free(Rect, screen);
return TRUE;
}
*y = (areas[0]->height - client->frame->area.height) / 2 + areas[0]->y;
for (i = 0; i < screen_num_monitors; ++i)
- g_free(areas[i]);
+ g_slice_free(Rect, areas[i]);
g_free(areas);
return TRUE;
}
} ObScreenStrut;
#define RESET_STRUT_LIST(sl) \
- (g_slist_free(sl), sl = NULL)
+ while (sl) { \
+ g_slice_free(ObScreenStrut, (sl)->data); \
+ sl = g_slist_delete_link(sl, sl); \
+ }
#define ADD_STRUT_TO_LIST(sl, d, s) \
{ \
- ObScreenStrut *ss = g_new(ObScreenStrut, 1); \
+ ObScreenStrut *ss = g_slice_new(ObScreenStrut); \
ss->desktop = d; \
ss->strut = s; \
sl = g_slist_prepend(sl, ss); \
dims[i*4+1] = area->y;
dims[i*4+2] = area->width;
dims[i*4+3] = area->height;
- g_free(area);
+ g_slice_free(Rect, area);
}
/* set the legacy workarea hint to the union of all the monitors */
}
}
- a = g_new(Rect, 1);
+ a = g_slice_new(Rect);
a->x = l;
a->y = t;
a->width = r - l + 1;