mirror of
https://github.com/labwc/labwc.git
synced 2025-10-31 22:25:34 -04:00
Support xwayland window title bar dragging
This commit is contained in:
parent
4c53bd8bf9
commit
83c3492c87
7 changed files with 109 additions and 42 deletions
39
deco.c
Normal file
39
deco.c
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#include "labwc.h"
|
||||
|
||||
struct wlr_box deco_max_extents(struct view *view)
|
||||
{
|
||||
struct wlr_box box = {
|
||||
.x = view->x - XWL_WINDOW_BORDER,
|
||||
.y = view->y - XWL_TITLEBAR_HEIGHT - XWL_WINDOW_BORDER,
|
||||
.width = view->surface->current.width + 2 * XWL_WINDOW_BORDER,
|
||||
.height = view->surface->current.height + XWL_TITLEBAR_HEIGHT +
|
||||
2 * XWL_WINDOW_BORDER,
|
||||
};
|
||||
return box;
|
||||
}
|
||||
|
||||
struct wlr_box deco_box(struct view *view, enum deco_part deco_part)
|
||||
{
|
||||
struct wlr_box box = { .x = 0, .y = 0, .width = 0, .height = 0 };
|
||||
if (!view)
|
||||
return;
|
||||
switch (deco_part) {
|
||||
case LAB_DECO_PART_TOP:
|
||||
box.x = view->x - XWL_WINDOW_BORDER;
|
||||
box.y = view->y - XWL_TITLEBAR_HEIGHT - XWL_WINDOW_BORDER;
|
||||
box.width = view->surface->current.width + 2 * XWL_WINDOW_BORDER;
|
||||
box.height = XWL_TITLEBAR_HEIGHT + XWL_WINDOW_BORDER;
|
||||
break;
|
||||
}
|
||||
return box;
|
||||
}
|
||||
|
||||
enum deco_part deco_at(struct view *view, double lx, double ly)
|
||||
{
|
||||
struct wlr_box box;
|
||||
box = deco_box(view, LAB_DECO_PART_TOP);
|
||||
if (wlr_box_contains_point(&box, lx, ly))
|
||||
return LAB_DECO_PART_TOP;
|
||||
return LAB_DECO_NONE;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue