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
This commit is contained in:
parent
9f22554b6a
commit
acfa2af3c2
10 changed files with 35 additions and 34 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue