X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=3fe3faa189cfb5b94e18a2375dbdb4ce4e818f89;hb=b7ddaa5728b5449449e3ea14cf84252285bbc794;hp=2f9cfb8f564c10127c5df34716885132a6bb8510;hpb=6014a41760a107d817422aa5412ccf0ce3fc6e92;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index 2f9cfb8f..3fe3faa1 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -150,7 +150,7 @@ static void client_call_notifies(ObClient *self, GSList *list) 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); @@ -163,7 +163,7 @@ void client_remove_destroy_notify(ObClientCallback func) 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; @@ -202,7 +202,8 @@ void client_manage(Window window, ObPrompt *prompt) 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; @@ -221,7 +222,7 @@ void client_manage(Window window, ObPrompt *prompt) /* 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; @@ -347,7 +348,7 @@ void client_manage(Window window, ObPrompt *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. */ @@ -420,7 +421,7 @@ void client_manage(Window window, ObPrompt *prompt) 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. " @@ -440,9 +441,7 @@ void client_manage(Window window, ObPrompt *prompt) 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", @@ -503,7 +502,7 @@ void client_manage(Window window, ObPrompt *prompt) 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); @@ -518,7 +517,7 @@ ObClient *client_fake_manage(Window window) /* 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); @@ -537,7 +536,7 @@ ObClient *client_fake_manage(Window window) self->frame->size.top, self->frame->size.bottom); /* free the ObAppSettings shallow copy */ - g_free(settings); + g_slice_free(ObAppSettings, settings); return self; } @@ -695,7 +694,7 @@ void client_unmanage(ObClient *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) @@ -703,7 +702,7 @@ 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, @@ -723,7 +722,7 @@ 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); @@ -1085,7 +1084,7 @@ gboolean client_find_onscreen(ObClient *self, gint *x, gint *y, gint w, gint h, 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 */ @@ -2049,7 +2048,7 @@ void client_update_strut(ObClient *self) if (!got && OBT_PROP_GETA32(self->window, NET_WM_STRUT, CARDINAL, &data, &num)) { if (num == 4) { - Rect *a; + Rect const *a; got = TRUE; @@ -2062,7 +2061,6 @@ void client_update_strut(ObClient *self) 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); } @@ -2478,7 +2476,7 @@ gboolean client_has_parent(ObClient *self) 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(); @@ -2511,9 +2509,6 @@ static ObStackingLayer calc_layer(ObClient *self) else if (self->below) l = OB_STACKING_LAYER_BELOW; else l = OB_STACKING_LAYER_NORMAL; - g_free(monitor); - g_free(allmonitors); - return l; } @@ -2840,7 +2835,7 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h, /* set the size and position if fullscreen */ if (self->fullscreen) { - Rect *a; + Rect const *a; guint i; i = screen_find_monitor(&desired); @@ -2853,8 +2848,6 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h, 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; @@ -2877,7 +2870,7 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h, 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 */ @@ -4253,7 +4246,7 @@ void client_find_edge_directional(ObClient *self, ObDirection dir, 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 */ @@ -4284,7 +4277,7 @@ void client_find_edge_directional(ObClient *self, ObDirection dir, my_edge_size, dest, near_edge); } - g_free(a); + g_slice_free(Rect, a); } void client_find_move_directional(ObClient *self, ObDirection dir,