gimp but for windows: a wayland compositor
git clone https://github.com/m-col/wimp
Files | Refs | Readme

Commit 1c3699540311da35aee7aa66fe94df2e4dd004b7
Parent: 79686a16a9f5b2dec1bd270cc9a7aa8769c4225b
Author: mcol <mcol@posteo.net>
Date: 2021-02-06 19:07:58 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2021-02-06 19:07:58 +0000

remove scratchpads upon config reload or shutdown

src/scratchpad.h Modified

@@ -6,5 +6,6 @@
 struct scratchpad *scratchpad_from_view(struct view *view);
 void scratchpad_apply_geo(struct scratchpad *scratchpad);
 bool catch_scratchpad(struct view *view);
+void drop_scratchpads();
 
 #endif

src/scratchpad.c Modified

@@ -65,3 +65,17 @@
     }
     return false;
 }
+
+
+void drop_scratchpads() {
+    struct scratchpad *scratchpad, *tmp;
+    wl_list_for_each_safe(scratchpad, tmp, &wimp.scratchpads, link) {
+	if (scratchpad->view) {
+	    scratchpad->view->is_scratchpad = false;
+	    wl_list_insert(&wimp.current_desk->views, &scratchpad->view->link);
+	    map_view(scratchpad->view);
+	}
+	free(scratchpad->command);
+	free(scratchpad);
+    }
+}

src/main.c Modified

@@ -19,6 +19,7 @@
 #include "layer_shell.h"
 #include "log.h"
 #include "output.h"
+#include "scratchpad.h"
 #include "shell.h"
 #include "types.h"
 
@@ -66,6 +67,8 @@
     wl_list_remove(&wimp.request_cursor_listener.link);
     wl_list_remove(&wimp.request_set_selection_listener.link);
 
+    drop_scratchpads();
+
     struct binding *kb, *tkb;
     wl_list_for_each_safe(kb, tkb, &wimp.mouse_bindings, link) {
 	wl_list_remove(&kb->link);
@@ -117,14 +120,6 @@
 	free(output);
     };
 
-    struct scratchpad *scratchpad, *tscratchpad;
-    wl_list_for_each_safe(scratchpad, tscratchpad, &wimp.scratchpads, link) {
-	wl_list_remove(&scratchpad->link);
-	free(scratchpad->view);
-	free(scratchpad->command);
-	free(scratchpad);
-    };
-
     struct keyboard *keyboard, *tkeyboard;
     wl_list_for_each_safe(keyboard, tkeyboard, &wimp.keyboards, link) {
 	wl_list_remove(&keyboard->link);

src/config.c Modified

@@ -10,6 +10,7 @@
 #include "action.h"
 #include "config.h"
 #include "desk.h"
+#include "scratchpad.h"
 #include "types.h"
 
 #define is_number(s) (strspn(s, "0123456789.-") == strlen(s))
@@ -668,6 +669,8 @@
 	free_binding(kb);
     }
 
+    drop_scratchpads();
+
     // load defaults
     char *buffer = NULL;
     size_t size = 0;