From 28f69b2f304d2af1a3ec7265dff13046c50f4b74 Mon Sep 17 00:00:00 2001 From: Simon Long Date: Wed, 1 May 2024 07:28:17 +0100 Subject: [PATCH 1/3] Add All context for mouse events --- include/ssd.h | 1 + src/config/mousebind.c | 2 ++ src/ssd/ssd.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/ssd.h b/include/ssd.h index 757f9a21..56f3202e 100644 --- a/include/ssd.h +++ b/include/ssd.h @@ -45,6 +45,7 @@ enum ssd_part_type { LAB_SSD_LAYER_SURFACE, LAB_SSD_LAYER_SUBSURFACE, LAB_SSD_UNMANAGED, + LAB_SSD_ALL, LAB_SSD_END_MARKER }; diff --git a/src/config/mousebind.c b/src/config/mousebind.c index a686010d..857012fd 100644 --- a/src/config/mousebind.c +++ b/src/config/mousebind.c @@ -142,6 +142,8 @@ context_from_str(const char *str) return LAB_SSD_ROOT; } else if (!strcasecmp(str, "Root")) { return LAB_SSD_ROOT; + } else if (!strcasecmp(str, "All")) { + return LAB_SSD_ALL; } wlr_log(WLR_ERROR, "unknown mouse context (%s)", str); return LAB_SSD_NONE; diff --git a/src/ssd/ssd.c b/src/ssd/ssd.c index 9c96ef7b..3d50e049 100644 --- a/src/ssd/ssd.c +++ b/src/ssd/ssd.c @@ -309,7 +309,7 @@ ssd_destroy(struct ssd *ssd) bool ssd_part_contains(enum ssd_part_type whole, enum ssd_part_type candidate) { - if (whole == candidate) { + if (whole == candidate || whole == LAB_SSD_ALL) { return true; } if (whole == LAB_SSD_PART_TITLEBAR) { From 44644f291da65990068d08d71727bad81169dd74 Mon Sep 17 00:00:00 2001 From: Simon Long Date: Wed, 1 May 2024 11:30:55 +0100 Subject: [PATCH 2/3] Documentation --- docs/labwc-config.5.scd | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/labwc-config.5.scd b/docs/labwc-config.5.scd index acc59ada..9e7ec737 100644 --- a/docs/labwc-config.5.scd +++ b/docs/labwc-config.5.scd @@ -559,6 +559,7 @@ extending outward from the snapped edge. through to the application. - Desktop: The desktop background, where no windows are present. - Root: A synonym for Desktop (for compatibility). + - All: Anywhere on the screen. Supported mouse *buttons* are: - Left From 9745fcf784c133e7f4d6f659a9feb944f1dbaf1a Mon Sep 17 00:00:00 2001 From: Simon Long Date: Thu, 2 May 2024 11:00:23 +0100 Subject: [PATCH 3/3] Update consumed_by_frame_context for LAB_SSD_ALL --- src/input/cursor.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/input/cursor.c b/src/input/cursor.c index df03dcf2..9d4852c0 100644 --- a/src/input/cursor.c +++ b/src/input/cursor.c @@ -823,12 +823,15 @@ handle_release_mousebinding(struct server *server, */ consumed_by_frame_context |= mousebind->context == LAB_SSD_FRAME; + consumed_by_frame_context |= + mousebind->context == LAB_SSD_ALL; } continue; default: continue; } consumed_by_frame_context |= mousebind->context == LAB_SSD_FRAME; + consumed_by_frame_context |= mousebind->context == LAB_SSD_ALL; actions_run(ctx->view, server, &mousebind->actions, /*resize_edges*/ 0); } @@ -909,6 +912,8 @@ handle_press_mousebinding(struct server *server, struct cursor_context *ctx, */ consumed_by_frame_context |= mousebind->context == LAB_SSD_FRAME; + consumed_by_frame_context |= + mousebind->context == LAB_SSD_ALL; mousebind->pressed_in_context = true; } continue; @@ -923,6 +928,7 @@ handle_press_mousebinding(struct server *server, struct cursor_context *ctx, continue; } consumed_by_frame_context |= mousebind->context == LAB_SSD_FRAME; + consumed_by_frame_context |= mousebind->context == LAB_SSD_ALL; actions_run(ctx->view, server, &mousebind->actions, resize_edges); } }