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

Commit 50ef40356ebebeccc23ac407b583e9a8766c3207
Parent: 9247a25c04f3c39825ddc807bb7eb6570f5b5655
Author: mcol <mcol@posteo.net>
Date: 2021-02-12 11:16:19 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2021-02-12 11:16:19 +0000

add damage_mark_indicator

src/output.h Modified

@@ -8,5 +8,6 @@
 void damage_by_view(struct view *view, bool with_borders);
 void damage_by_lview(struct layer_view *lview);
 void damage_all_outputs();
+void damage_mark_indicator();
 
 #endif

src/output.c Modified

@@ -271,6 +271,24 @@
 }
 
 
+void damage_mark_indicator() {
+    struct output *output;
+    struct wlr_box indicator = wimp.mark_indicator.box;
+    int width, height;
+
+    wl_list_for_each(output, &wimp.outputs, link) {
+	wlr_output_effective_resolution(output->wlr_output, &width, &height);
+	struct wlr_box geo = {
+	    .x = 0,
+	    .y = height - indicator.height,
+	    .width = indicator.width,
+	    .height = indicator.height,
+	};
+	wlr_output_damage_add_box(output->wlr_output_damage, &geo);
+    }
+}
+
+
 static void on_destroy(struct wl_listener *listener, void *data) {
     struct output *output = wl_container_of(listener, output, destroy_listener);
 

src/input.c Modified

@@ -9,6 +9,7 @@
 
 #include "action.h"
 #include "cursor.h"
+#include "output.h"
 #include "shell.h"
 #include "types.h"
 
@@ -71,12 +72,13 @@
 	if (wimp.mark_waiting) {
 	    struct mark *mark;
 	    wimp.mark_waiting = false;
+	    damage_mark_indicator();
 	    xkb_state_key_get_syms(wlr_kb->xkb_state, keycode, &syms);
 	    mark = wl_container_of(wimp.marks.next, mark, link);
-	    if (mark->key == 0) {
-		actually_set_mark(syms[0]);
-	    } else {
+	    if (mark->key) {
 		actually_go_to_mark(syms[0]);
+	    } else {
+		actually_set_mark(syms[0]);
 	    }
 	    return;
 	}

src/action.c Modified

@@ -256,9 +256,9 @@
     mark->y = desk->panned_y;
     mark->zoom = desk->zoom;
     mark->key = 0;
-    wimp.mark_waiting = true;
     wl_list_insert(&wimp.marks, &mark->link);
-    damage_all_outputs();
+    wimp.mark_waiting = true;
+    damage_mark_indicator();
 }
 
 
@@ -291,20 +291,27 @@
 
 void go_to_mark(void *data) {
     wimp.mark_waiting = true;
+    damage_mark_indicator();
 }
 
 
 void actually_go_to_mark(const xkb_keysym_t sym) {
     struct mark *mark;
 
-    if (sym == XKB_KEY_Escape)
+    if (sym == XKB_KEY_Escape) {
 	return;
+    }
 
+    bool found = false;
     wl_list_for_each(mark, &wimp.marks, link) {
 	if (mark->key == sym) {
+	    found = true;
 	    break;
 	}
     }
+    if (!found) {
+	return;
+    }
 
     unfullscreen();
     struct motion motion = {