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

Commit 56f939cefaadb3a3046f69e8f905b3aae619abd7
Parent: 46520dc1c23f10b7732b0a0f685c00f503a2c4ee
Author: mcol <mcol@posteo.net>
Date: 2021-02-08 23:55:00 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2021-02-08 23:55:00 +0000

add scratchpad_from_id

src/scratchpad.h Modified

@@ -4,6 +4,7 @@
 #include "types.h"
 
 struct scratchpad *scratchpad_from_view(struct view *view);
+struct scratchpad *scratchpad_from_id(int id);
 void scratchpad_apply_geo(struct scratchpad *scratchpad);
 bool catch_scratchpad(struct view *view);
 void drop_scratchpads();

src/scratchpad.c Modified

@@ -16,6 +16,19 @@
 }
 
 
+struct scratchpad *scratchpad_from_id(int id) {
+    struct scratchpad *scratchpad;
+
+    wl_list_for_each(scratchpad, &wimp.scratchpads, link) {
+	if (scratchpad->id == id) {
+	    return scratchpad;
+	}
+    }
+
+    return NULL;
+}
+
+
 void scratchpad_apply_geo(struct scratchpad *scratchpad) {
     struct wlr_output *output =
 	wlr_output_layout_output_at(wimp.output_layout, wimp.cursor->x, wimp.cursor->y);

src/action.c Modified

@@ -8,6 +8,7 @@
 #include "cursor.h"
 #include "desk.h"
 #include "output.h"
+#include "scratchpad.h"
 #include "shell.h"
 #include "types.h"
 
@@ -410,14 +411,7 @@
 
 
 void toggle_scratchpad(void *data) {
-    int id = *(int *)data;
-    struct scratchpad *scratchpad;
-
-    wl_list_for_each(scratchpad, &wimp.scratchpads, link) {
-	if (scratchpad->id == id) {
-	    break;
-	}
-    }
+    struct scratchpad *scratchpad = scratchpad_from_id(*(int *)data);
 
     if (scratchpad->view) {
 	if (scratchpad->is_mapped) {