implement corner/edge mouse contexts

This commit is contained in:
bi4k8 2021-12-11 22:48:28 +00:00 committed by Johan Malm
parent 2ce961a0bd
commit 5ee4baee7a
2 changed files with 34 additions and 4 deletions

View 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")) {

View file

@ -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;
}