]> git.mdlowis.com Git - proto/labwc.git/commitdiff
implement corner/edge mouse contexts
authorbi4k8 <bi4k8@github>
Sat, 11 Dec 2021 22:48:28 +0000 (22:48 +0000)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sun, 26 Dec 2021 21:31:11 +0000 (21:31 +0000)
src/config/mousebind.c
src/ssd.c

index c8e31c44ab7a04114a8349f77e9d1cf69dab669b..903be153c647050d50622b2d885b678073fd9aae 100644 (file)
@@ -57,14 +57,32 @@ mousebind_event_from_str(const char *str)
 static enum ssd_part_type
 context_from_str(const char *str)
 {
-       if (!strcasecmp(str, "Titlebar")) {
-               return LAB_SSD_PART_TITLEBAR;
-       } else if (!strcasecmp(str, "Close")) {
+       if (!strcasecmp(str, "Close")) {
                return LAB_SSD_BUTTON_CLOSE;
        } else if (!strcasecmp(str, "Maximize")) {
                return LAB_SSD_BUTTON_MAXIMIZE;
        } else if (!strcasecmp(str, "Iconify")) {
                return LAB_SSD_BUTTON_ICONIFY;
+       } else if (!strcasecmp(str, "Titlebar")) {
+               return LAB_SSD_PART_TITLEBAR;
+       } else if (!strcasecmp(str, "Title")) {
+               return LAB_SSD_PART_TITLE;
+       } else if (!strcasecmp(str, "TLCorner")) {
+               return LAB_SSD_PART_CORNER_TOP_LEFT;
+       } else if (!strcasecmp(str, "TRCorner")) {
+               return LAB_SSD_PART_CORNER_TOP_RIGHT;
+       } else if (!strcasecmp(str, "BRCorner")) {
+               return LAB_SSD_PART_CORNER_BOTTOM_RIGHT;
+       } else if (!strcasecmp(str, "BLCorner")) {
+               return LAB_SSD_PART_CORNER_BOTTOM_LEFT;
+       } else if (!strcasecmp(str, "Top")) {
+               return LAB_SSD_PART_TOP;
+       } else if (!strcasecmp(str, "Right")) {
+               return LAB_SSD_PART_RIGHT;
+       } else if (!strcasecmp(str, "Bottom")) {
+               return LAB_SSD_PART_BOTTOM;
+       } else if (!strcasecmp(str, "Left")) {
+               return LAB_SSD_PART_LEFT;
        } else if (!strcasecmp(str, "Frame")) {
                return LAB_SSD_FRAME;
        } else if (!strcasecmp(str, "Client")) {
index ffa0b728cb4cc62e3c2f2b05a6b20cf4fa5f218c..789f5e387e042ec876192fbe3c93532ce758e5de 100644 (file)
--- a/src/ssd.c
+++ b/src/ssd.c
@@ -423,10 +423,22 @@ ssd_part_contains(enum ssd_part_type whole, enum ssd_part_type candidate)
                return true;
        }
        if (whole == LAB_SSD_PART_TITLEBAR) {
-               return candidate >= LAB_SSD_BUTTON_CLOSE && candidate <= LAB_SSD_PART_CORNER_TOP_RIGHT;
+               return candidate >= LAB_SSD_BUTTON_CLOSE && candidate <= LAB_SSD_PART_TITLE;
        }
        if (whole == LAB_SSD_FRAME) {
                return candidate >= LAB_SSD_BUTTON_CLOSE && candidate <= LAB_SSD_CLIENT;
        }
+       if (whole == LAB_SSD_PART_TOP) {
+               return candidate == LAB_SSD_PART_CORNER_TOP_LEFT || candidate == LAB_SSD_PART_CORNER_BOTTOM_LEFT;
+       }
+       if (whole == LAB_SSD_PART_RIGHT) {
+               return candidate == LAB_SSD_PART_CORNER_TOP_RIGHT || candidate == LAB_SSD_PART_CORNER_BOTTOM_RIGHT;
+       }
+       if (whole == LAB_SSD_PART_BOTTOM) {
+               return candidate == LAB_SSD_PART_CORNER_BOTTOM_RIGHT || candidate == LAB_SSD_PART_CORNER_BOTTOM_LEFT;
+       }
+       if (whole == LAB_SSD_PART_LEFT) {
+               return candidate == LAB_SSD_PART_CORNER_TOP_LEFT || candidate == LAB_SSD_PART_CORNER_BOTTOM_LEFT;
+       }
        return false;
 }