X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=b1655eee8fc28849e68d18e3b09d06e42d9b1e7a;hb=d286702ed48ef624cb96840bab147fa53a9ae191;hp=de1b2c9c253bf19c146c881893aa17e1fd3cb3c4;hpb=c2684d312b7bcd0aeb16813c7d1b33d635d99603;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index de1b2c9c..b1655eee 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -23,6 +23,9 @@ GSList *client_list = NULL; GHashTable *client_map = NULL; +static Window *client_startup_stack_order = NULL; +static gulong client_startup_stack_size = 0; + static void client_get_all(Client *self); static void client_toggle_border(Client *self, gboolean show); static void client_get_area(Client *self); @@ -38,13 +41,20 @@ static Client *search_focus_tree(Client *node, Client *skip); static void client_apply_startup_state(Client *self); static Client *search_modal_tree(Client *node, Client *skip); -static guint map_hash(Window w) { return w; } -static gboolean map_key_comp(Window w1, Window w2) { return w1 == w2; } +static guint map_hash(Window *w) { return *w; } +static gboolean map_key_comp(Window *w1, Window *w2) { return *w1 == *w2; } void client_startup() { client_map = g_hash_table_new((GHashFunc)map_hash, (GEqualFunc)map_key_comp); + + /* save the stacking order on startup! */ + if (!PROP_GET32U(ob_root, net_client_list_stacking, window, + client_startup_stack_order, client_startup_stack_size)) + g_message("failed"); + g_message("%ld", client_startup_stack_size); + client_set_list(); } @@ -112,6 +122,18 @@ void client_manage_all() } } XFree(children); + + /* stack them as they were on startup! */ + for (i = client_startup_stack_size; i > 0; --i) { + Client *c; + + w = client_startup_stack_order[i-1]; + c = g_hash_table_lookup(client_map, &w); + if (c) stacking_lower(c); + } + g_free(client_startup_stack_order); + client_startup_stack_order = NULL; + client_startup_stack_size = 0; } void client_manage(Window window) @@ -186,8 +208,8 @@ void client_manage(Window window) client_list = g_slist_append(client_list, client); stacking_list = g_list_append(stacking_list, client); - g_assert(!g_hash_table_lookup(client_map, (gpointer)client->window)); - g_hash_table_insert(client_map, (gpointer)window, client); + g_assert(!g_hash_table_lookup(client_map, &client->window)); + g_hash_table_insert(client_map, &client->window, client); /* update the focus lists */ if (client->desktop == DESKTOP_ALL) { @@ -241,7 +263,7 @@ void client_unmanage(Client *client) client_list = g_slist_remove(client_list, client); stacking_list = g_list_remove(stacking_list, client); - g_hash_table_remove(client_map, (gpointer)client->window); + g_hash_table_remove(client_map, &client->window); /* update the focus lists */ if (client->desktop == DESKTOP_ALL) { @@ -528,7 +550,7 @@ void client_update_transient_for(Client *self) if (XGetTransientForHint(ob_display, self->window, &t) && t != self->window) { /* cant be transient to itself! */ self->transient = TRUE; - c = g_hash_table_lookup(client_map, (gpointer)t); + c = g_hash_table_lookup(client_map, &t); g_assert(c != self);/* if this happens then we need to check for it*/ if (!c /*XXX: && _group*/) {