diff options
| author | Dana Jansens <danakj@orodu.net> | 2007-05-07 23:26:22 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2007-05-07 23:26:22 +0000 |
| commit | 280529221e9349aa07c6c498df6b80b3a8951198 (patch) | |
| tree | f80ab701abbe3519b2613d735569e3dd23f93dee /openbox/client.c | |
| parent | 31d7680274cdf2fa3c45b8c8d56db2b5d8fbc111 (diff) | |
add a notifier for clients changing desktops. use it to update the send-to menu if it changes. it does this by closing/opening the menu.. thats about the best we can do tho with this menu code without huge changes
Diffstat (limited to 'openbox/client.c')
| -rw-r--r-- | openbox/client.c | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/openbox/client.c b/openbox/client.c index 47bfcabc..0d74882c 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -57,13 +57,14 @@ typedef struct { - ObClientDestructor func; + ObClientCallback func; gpointer data; -} Destructor; +} ClientCallback; -GList *client_list = NULL; +GList *client_list = NULL; -static GSList *client_destructors = NULL; +static GSList *client_destructors = NULL; +static GSList *client_desktop_notifies = NULL; static void client_get_all(ObClient *self); static void client_toggle_border(ObClient *self, gboolean show); @@ -105,20 +106,20 @@ void client_shutdown(gboolean reconfig) { } -void client_add_destructor(ObClientDestructor func, gpointer data) +void client_add_destructor(ObClientCallback func, gpointer data) { - Destructor *d = g_new(Destructor, 1); + ClientCallback *d = g_new(ClientCallback, 1); d->func = func; d->data = data; client_destructors = g_slist_prepend(client_destructors, d); } -void client_remove_destructor(ObClientDestructor func) +void client_remove_destructor(ObClientCallback func) { GSList *it; for (it = client_destructors; it; it = g_slist_next(it)) { - Destructor *d = it->data; + ClientCallback *d = it->data; if (d->func == func) { g_free(d); client_destructors = g_slist_delete_link(client_destructors, it); @@ -127,6 +128,29 @@ void client_remove_destructor(ObClientDestructor func) } } +void client_add_desktop_notify(ObClientCallback func, gpointer data) +{ + ClientCallback *d = g_new(ClientCallback, 1); + d->func = func; + d->data = data; + client_desktop_notifies = g_slist_prepend(client_desktop_notifies, d); +} + +void client_remove_desktop_notify(ObClientCallback func) +{ + GSList *it; + + for (it = client_desktop_notifies; it; it = g_slist_next(it)) { + ClientCallback *d = it->data; + if (d->func == func) { + g_free(d); + client_desktop_notifies = + g_slist_delete_link(client_desktop_notifies, it); + break; + } + } +} + void client_set_list() { Window *windows, *win_it; @@ -533,7 +557,7 @@ void client_unmanage(ObClient *self) screen_update_areas(); for (it = client_destructors; it; it = g_slist_next(it)) { - Destructor *d = it->data; + ClientCallback *d = it->data; d->func(self, d->data); } @@ -3001,6 +3025,12 @@ void client_set_desktop_recursive(ObClient *self, focus_order_to_top(self); else focus_order_to_bottom(self); + + /* call the notifies */ + for (it = client_desktop_notifies; it; it = g_slist_next(it)) { + ClientCallback *d = it->data; + d->func(self, d->data); + } } /* move all transients */ |
