From: bi4k8 Date: Wed, 1 Dec 2021 22:10:33 +0000 (+0000) Subject: define ssd_part_contains to define the mouse context subset relation X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=d84103d669244eca3251f133fc3c4ac41dfee840;p=proto%2Flabwc.git define ssd_part_contains to define the mouse context subset relation --- diff --git a/include/ssd.h b/include/ssd.h index 0215c2fc..8ec56295 100644 --- a/include/ssd.h +++ b/include/ssd.h @@ -67,5 +67,6 @@ void ssd_update_title(struct view *view); void ssd_create(struct view *view); void ssd_destroy(struct view *view); void ssd_update_geometry(struct view *view, bool force); +bool ssd_part_contains(enum ssd_part_type whole, enum ssd_part_type candidate); #endif /* __LABWC_SSD_H */ diff --git a/src/ssd.c b/src/ssd.c index a948cf11..ffa0b728 100644 --- a/src/ssd.c +++ b/src/ssd.c @@ -415,3 +415,18 @@ ssd_update_geometry(struct view *view, bool force) view->ssd.box.height = view->h; damage_all_outputs(view->server); } + +bool +ssd_part_contains(enum ssd_part_type whole, enum ssd_part_type candidate) +{ + if (whole == candidate) { + return true; + } + if (whole == LAB_SSD_PART_TITLEBAR) { + return candidate >= LAB_SSD_BUTTON_CLOSE && candidate <= LAB_SSD_PART_CORNER_TOP_RIGHT; + } + if (whole == LAB_SSD_FRAME) { + return candidate >= LAB_SSD_BUTTON_CLOSE && candidate <= LAB_SSD_CLIENT; + } + return false; +}