]> git.mdlowis.com Git - proto/labwc.git/commitdiff
view: Add view_reload_ssd()
authorJohn Lindgren <john@jlindgren.net>
Sat, 26 Nov 2022 07:13:42 +0000 (02:13 -0500)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sat, 26 Nov 2022 18:02:24 +0000 (18:02 +0000)
Gather related logic from `reload_config_and_theme()` in `server.c` and
`ssd_reload()` in `ssd.c` into a new function, `view_reload_ssd()`.

Also drop the `view->mapped` check since we want to update any view that
has SSD nodes created, mapped or not.

include/ssd.h
include/view.h
src/server.c
src/ssd/ssd.c
src/view.c

index 21ef6d8791d312003b82b89a4753105742b8e28e..06a3e1d3ac56f918a8a8077b08bab636dcf3f155 100644 (file)
@@ -150,7 +150,6 @@ void ssd_create(struct view *view);
 void ssd_set_active(struct view *view, bool active);
 void ssd_update_title(struct view *view);
 void ssd_update_geometry(struct view *view);
-void ssd_reload(struct view *view);
 void ssd_destroy(struct view *view);
 void ssd_update_button_hover(struct wlr_scene_node *node,
        struct ssd_hover_state *hover_state);
index 47263311b416d8841597379efbb0f6332738d547..a174b1b70ab2a9ddd1d4cfcc496fe00b8af3cc1d 100644 (file)
@@ -154,6 +154,7 @@ void view_snap_to_edge(struct view *view, const char *direction,
 const char *view_get_string_prop(struct view *view, const char *prop);
 void view_update_title(struct view *view);
 void view_update_app_id(struct view *view);
+void view_reload_ssd(struct view *view);
 
 void view_impl_map(struct view *view);
 void view_adjust_size(struct view *view, int *w, int *h);
index 6107c3eaccca42f9e6169367dd19c9d53a11578e..a1f40f998ddb24082cf286fbb9832495b32802ba 100644 (file)
@@ -16,7 +16,6 @@
 #include "labwc.h"
 #include "layers.h"
 #include "menu/menu.h"
-#include "ssd.h"
 #include "theme.h"
 #include "view.h"
 #include "workspaces.h"
@@ -40,10 +39,7 @@ reload_config_and_theme(void)
 
        struct view *view;
        wl_list_for_each(view, &g_server->views, link) {
-               if (!view->mapped || !view->ssd_enabled) {
-                       continue;
-               }
-               ssd_reload(view);
+               view_reload_ssd(view);
        }
 
        menu_reconfigure(g_server);
index 2b2feccd33cc3647dc70f2fe450f63f59cd56276..fdfc2cc23271a80c8ab6342e36471fbee796b97e 100644 (file)
@@ -191,16 +191,6 @@ ssd_update_geometry(struct view *view)
        view->ssd.state.y = view->y;
 }
 
-void ssd_reload(struct view *view)
-{
-       if (!view->ssd.tree) {
-               return;
-       }
-
-       ssd_destroy(view);
-       ssd_create(view);
-}
-
 void
 ssd_destroy(struct view *view)
 {
index 221c54c42c2c0d562f224f398472ed8b667fb5ed..168033890a290a0ec816649efd1cc3fad4536350 100644 (file)
@@ -871,6 +871,16 @@ view_update_app_id(struct view *view)
                view->toplevel_handle, app_id);
 }
 
+void
+view_reload_ssd(struct view *view)
+{
+       assert(view);
+       if (view->ssd_enabled) {
+               ssd_destroy(view);
+               ssd_create(view);
+       }
+}
+
 void
 view_destroy(struct view *view)
 {