X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=70b13c7e1c2df182d9a4cbab84b15d2780d1eb59;hb=ba64eb20dbea9ca2917c2daddfcb05d317d82452;hp=e653ed19f58b2b0d7cebd7a15c90a64ee4b73d73;hpb=3c5f6db04cb577fa3f547b45283eac7a0664be39;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index e653ed19..70b13c7e 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -32,7 +32,8 @@ #define CLIENT_NOPROPAGATEMASK (ButtonPressMask | ButtonReleaseMask | \ ButtonMotionMask) -GList *client_list = NULL; +GList *client_list = NULL; +GSList *client_destructors = NULL; static void client_get_all(ObClient *self); static void client_toggle_border(ObClient *self, gboolean show); @@ -58,6 +59,16 @@ void client_shutdown() { } +void client_add_destructor(ObClientDestructorFunc func) +{ + client_destructors = g_slist_prepend(client_destructors, (gpointer)func); +} + +void client_remove_destructor(ObClientDestructorFunc func) +{ + client_destructors = g_slist_remove(client_destructors, (gpointer)func); +} + void client_set_list() { Window *windows, *win_it; @@ -312,6 +323,7 @@ void client_manage(Window window) place_client(self, &x, &y); + /* make sure the window is visible */ client_find_onscreen(self, &x, &y, self->frame->area.width, self->frame->area.height, @@ -323,9 +335,6 @@ void client_manage(Window window) TRUE, TRUE); } - /* make sure the window is visible */ - client_move_onscreen(self, client_normal(self)); - client_showhide(self); /* use client_focus instead of client_activate cuz client_activate does @@ -414,13 +423,11 @@ void client_unmanage(ObClient *self) } } - if (moveresize_client == self) - moveresize_end(TRUE); - - /* menus can be associated with a client, so close any that are since - we are disappearing now */ - menu_frame_hide_all_client(self); - + for (it = client_destructors; it; it = g_slist_next(it)) { + ObClientDestructorFunc func = (ObClientDestructorFunc) it->data; + func(self); + } + if (focus_client == self) { XEvent e; @@ -1024,20 +1031,22 @@ void client_update_normal_hints(ObClient *self) void client_setup_decor_and_functions(ObClient *self) { /* start with everything (cept fullscreen) */ - self->decorations = (OB_FRAME_DECOR_TITLEBAR | - OB_FRAME_DECOR_HANDLE | - OB_FRAME_DECOR_GRIPS | - OB_FRAME_DECOR_BORDER | - OB_FRAME_DECOR_ICON | - OB_FRAME_DECOR_ALLDESKTOPS | - OB_FRAME_DECOR_ICONIFY | - OB_FRAME_DECOR_MAXIMIZE | - OB_FRAME_DECOR_SHADE); - self->functions = (OB_CLIENT_FUNC_RESIZE | - OB_CLIENT_FUNC_MOVE | - OB_CLIENT_FUNC_ICONIFY | - OB_CLIENT_FUNC_MAXIMIZE | - OB_CLIENT_FUNC_SHADE); + self->decorations = + (OB_FRAME_DECOR_TITLEBAR | + (ob_rr_theme->show_handle ? OB_FRAME_DECOR_HANDLE : 0) | + OB_FRAME_DECOR_GRIPS | + OB_FRAME_DECOR_BORDER | + OB_FRAME_DECOR_ICON | + OB_FRAME_DECOR_ALLDESKTOPS | + OB_FRAME_DECOR_ICONIFY | + OB_FRAME_DECOR_MAXIMIZE | + OB_FRAME_DECOR_SHADE); + self->functions = + (OB_CLIENT_FUNC_RESIZE | + OB_CLIENT_FUNC_MOVE | + OB_CLIENT_FUNC_ICONIFY | + OB_CLIENT_FUNC_MAXIMIZE | + OB_CLIENT_FUNC_SHADE); if (self->delete_window) { self->functions |= OB_CLIENT_FUNC_CLOSE; self->decorations |= OB_FRAME_DECOR_CLOSE;