From: Dana Jansens Date: Sun, 13 May 2007 07:45:15 +0000 (+0000) Subject: use the right list in client_add_hide_notify, rename destructor to destroy_notify... X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=acfa2af3c2eacd099869cc5aebdcfa1241214e8b;p=chaz%2Fopenbox use the right list in client_add_hide_notify, rename destructor to destroy_notify which is really what it is, and is more consistant now that there are 2 notifies --- diff --git a/openbox/client.c b/openbox/client.c index 112b8d8b..73696c89 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -64,7 +64,7 @@ typedef struct GList *client_list = NULL; -static GSList *client_destructors = NULL; +static GSList *client_destroy_notifies = NULL; static GSList *client_hide_notifies = NULL; static void client_get_all(ObClient *self, gboolean real); @@ -92,7 +92,7 @@ static void client_present(ObClient *self, gboolean here, gboolean raise); static GSList *client_search_all_top_parents_internal(ObClient *self, gboolean bylayer, ObStackingLayer layer); -static void client_call_callbacks(ObClient *self, GSList *list); +static void client_call_notifies(ObClient *self, GSList *list); void client_startup(gboolean reconfig) { @@ -106,7 +106,7 @@ void client_shutdown(gboolean reconfig) if (reconfig) return; } -static void client_call_callbacks(ObClient *self, GSList *list) +static void client_call_notifies(ObClient *self, GSList *list) { GSList *it; @@ -116,23 +116,24 @@ static void client_call_callbacks(ObClient *self, GSList *list) } } -void client_add_destructor(ObClientCallback func, gpointer data) +void client_add_destroy_notify(ObClientCallback func, gpointer data) { ClientCallback *d = g_new(ClientCallback, 1); d->func = func; d->data = data; - client_destructors = g_slist_prepend(client_destructors, d); + client_destroy_notifies = g_slist_prepend(client_destroy_notifies, d); } -void client_remove_destructor(ObClientCallback func) +void client_remove_destroy_notify(ObClientCallback func) { GSList *it; - for (it = client_destructors; it; it = g_slist_next(it)) { + for (it = client_destroy_notifies; it; it = g_slist_next(it)) { ClientCallback *d = it->data; if (d->func == func) { g_free(d); - client_destructors = g_slist_delete_link(client_destructors, it); + client_destroy_notifies = + g_slist_delete_link(client_destroy_notifies, it); break; } } @@ -143,7 +144,7 @@ void client_add_hide_notify(ObClientCallback func, gpointer data) ClientCallback *d = g_new(ClientCallback, 1); d->func = func; d->data = data; - client_hide_notifies = g_slist_prepend(client_destructors, d); + client_hide_notifies = g_slist_prepend(client_hide_notifies, d); } void client_remove_hide_notify(ObClientCallback func) @@ -600,7 +601,7 @@ void client_unmanage(ObClient *self) if (STRUT_EXISTS(self->strut)) screen_update_areas(); - client_call_callbacks(self, client_destructors); + client_call_notifies(self, client_destroy_notifies); /* tell our parent(s) that we're gone */ if (self->transient_for == OB_TRAN_GROUP) { /* transient of group */ @@ -2416,7 +2417,7 @@ void client_hide(ObClient *self) if (!client_should_show(self)) { frame_hide(self->frame); - client_call_callbacks(self, client_hide_notifies); + client_call_notifies(self, client_hide_notifies); } /* According to the ICCCM (sec 4.1.3.1) when a window is not visible, it @@ -2435,7 +2436,7 @@ void client_showhide(ObClient *self) else { frame_hide(self->frame); - client_call_callbacks(self, client_hide_notifies); + client_call_notifies(self, client_hide_notifies); } /* According to the ICCCM (sec 4.1.3.1) when a window is not visible, it diff --git a/openbox/client.h b/openbox/client.h index 1a2273f4..351f063b 100644 --- a/openbox/client.h +++ b/openbox/client.h @@ -309,8 +309,8 @@ typedef void (*ObClientCallback)(ObClient *client, gpointer data); /* Callback functions */ /*! Get notified when the client is unmanaged */ -void client_add_destructor(ObClientCallback func, gpointer data); -void client_remove_destructor(ObClientCallback func); +void client_add_destroy_notify(ObClientCallback func, gpointer data); +void client_remove_destroy_notify(ObClientCallback func); /*! Get notified when the client is hidden */ void client_add_hide_notify(ObClientCallback func, gpointer data); diff --git a/openbox/client_list_combined_menu.c b/openbox/client_list_combined_menu.c index 26430f35..52ebce43 100644 --- a/openbox/client_list_combined_menu.c +++ b/openbox/client_list_combined_menu.c @@ -143,7 +143,7 @@ static void client_dest(ObClient *client, gpointer data) void client_list_combined_menu_startup(gboolean reconfig) { if (!reconfig) - client_add_destructor(client_dest, NULL); + client_add_destroy_notify(client_dest, NULL); combined_menu = menu_new(MENU_NAME, _("Windows"), TRUE, NULL); menu_set_update_func(combined_menu, self_update); @@ -153,5 +153,5 @@ void client_list_combined_menu_startup(gboolean reconfig) void client_list_combined_menu_shutdown(gboolean reconfig) { if (!reconfig) - client_remove_destructor(client_dest); + client_remove_destroy_notify(client_dest); } diff --git a/openbox/client_list_menu.c b/openbox/client_list_menu.c index 351790be..77cfc193 100644 --- a/openbox/client_list_menu.c +++ b/openbox/client_list_menu.c @@ -194,7 +194,7 @@ void client_list_menu_startup(gboolean reconfig) ObMenu *menu; if (!reconfig) - client_add_destructor(client_dest, NULL); + client_add_destroy_notify(client_dest, NULL); menu = menu_new(MENU_NAME, _("Desktops"), TRUE, NULL); menu_set_update_func(menu, self_update); @@ -203,5 +203,5 @@ void client_list_menu_startup(gboolean reconfig) void client_list_menu_shutdown(gboolean reconfig) { if (!reconfig) - client_remove_destructor(client_dest); + client_remove_destroy_notify(client_dest); } diff --git a/openbox/event.c b/openbox/event.c index 15a8e128..9d8c5f3c 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -131,7 +131,7 @@ void event_startup(gboolean reconfig) IceAddConnectionWatch(ice_watch, NULL); #endif - client_add_destructor(focus_delay_client_dest, NULL); + client_add_destroy_notify(focus_delay_client_dest, NULL); } void event_shutdown(gboolean reconfig) @@ -142,7 +142,7 @@ void event_shutdown(gboolean reconfig) IceRemoveConnectionWatch(ice_watch, NULL); #endif - client_remove_destructor(focus_delay_client_dest); + client_remove_destroy_notify(focus_delay_client_dest); } static Window event_get_window(XEvent *e) diff --git a/openbox/focus.c b/openbox/focus.c index 1d9ddcaa..00759514 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -67,7 +67,7 @@ static gboolean valid_focus_target(ObClient *ft, gboolean all_desktops, gboolean dock_windows, gboolean desktop_windows); -static void focus_cycle_destructor(ObClient *client, gpointer data); +static void focus_cycle_destroy_notify(ObClient *client, gpointer data); static void focus_tried_hide_notify(ObClient *client, gpointer data); static Window createWindow(Window parent, gulong mask, @@ -86,8 +86,8 @@ void focus_startup(gboolean reconfig) if (!reconfig) { XSetWindowAttributes attr; - client_add_destructor(focus_cycle_destructor, NULL); - client_add_destructor(focus_tried_hide_notify, NULL); + client_add_destroy_notify(focus_cycle_destroy_notify, NULL); + client_add_destroy_notify(focus_tried_hide_notify, NULL); client_add_hide_notify(focus_tried_hide_notify, NULL); /* start with nothing focused */ @@ -141,8 +141,8 @@ void focus_shutdown(gboolean reconfig) icon_popup_free(focus_cycle_popup); if (!reconfig) { - client_remove_destructor(focus_cycle_destructor); - client_remove_destructor(focus_tried_hide_notify); + client_remove_destroy_notify(focus_cycle_destroy_notify); + client_remove_destroy_notify(focus_tried_hide_notify); client_remove_hide_notify(focus_tried_hide_notify); /* reset focus to root */ @@ -417,7 +417,7 @@ static void popup_cycle(ObClient *c, gboolean show, g_free(showtext); } -static void focus_cycle_destructor(ObClient *client, gpointer data) +static void focus_cycle_destroy_notify(ObClient *client, gpointer data) { /* end cycling if the target disappears. CurrentTime is fine, time won't be used diff --git a/openbox/keyboard.c b/openbox/keyboard.c index d758b386..1534e198 100644 --- a/openbox/keyboard.c +++ b/openbox/keyboard.c @@ -324,13 +324,13 @@ void keyboard_startup(gboolean reconfig) popup = popup_new(FALSE); if (!reconfig) - client_add_destructor(keyboard_interactive_end_client, NULL); + client_add_destroy_notify(keyboard_interactive_end_client, NULL); } void keyboard_shutdown(gboolean reconfig) { if (!reconfig) - client_remove_destructor(keyboard_interactive_end_client); + client_remove_destroy_notify(keyboard_interactive_end_client); if (istate.active) keyboard_interactive_end(0, TRUE, 0, TRUE); diff --git a/openbox/mainloop.c b/openbox/mainloop.c index 2af81629..0e7b0b3c 100644 --- a/openbox/mainloop.c +++ b/openbox/mainloop.c @@ -282,7 +282,7 @@ void ob_main_loop_run(ObMainLoop *loop) loop->run = TRUE; loop->running = TRUE; - client_add_destructor(ob_main_loop_client_destroy, loop); + client_add_destroy_notify(ob_main_loop_client_destroy, loop); while (loop->run) { if (loop->signal_fired) { @@ -365,7 +365,7 @@ void ob_main_loop_run(ObMainLoop *loop) } } - client_remove_destructor(ob_main_loop_client_destroy); + client_remove_destroy_notify(ob_main_loop_client_destroy); loop->running = FALSE; } diff --git a/openbox/menu.c b/openbox/menu.c index c6e986b9..dbb0c701 100644 --- a/openbox/menu.c +++ b/openbox/menu.c @@ -110,13 +110,13 @@ void menu_startup(gboolean reconfig) g_assert(menu_parse_state.parent == NULL); if (!reconfig) - client_add_destructor(client_dest, NULL); + client_add_destroy_notify(client_dest, NULL); } void menu_shutdown(gboolean reconfig) { if (!reconfig) - client_remove_destructor(client_dest); + client_remove_destroy_notify(client_dest); parse_shutdown(menu_parse_inst); menu_parse_inst = NULL; diff --git a/openbox/moveresize.c b/openbox/moveresize.c index 6a1e2354..ac51f8b6 100644 --- a/openbox/moveresize.c +++ b/openbox/moveresize.c @@ -70,7 +70,7 @@ void moveresize_startup(gboolean reconfig) popup = popup_new(FALSE); if (!reconfig) - client_add_destructor(client_dest, NULL); + client_add_destroy_notify(client_dest, NULL); } void moveresize_shutdown(gboolean reconfig) @@ -78,7 +78,7 @@ void moveresize_shutdown(gboolean reconfig) if (!reconfig) { if (moveresize_in_progress) moveresize_end(FALSE); - client_remove_destructor(client_dest); + client_remove_destroy_notify(client_dest); } popup_free(popup);