mirror of
https://github.com/labwc/labwc.git
synced 2026-04-10 08:21:07 -04:00
ssd: fix resizing on border corners and add <resize><cornerRange>
Co-authored-by: @ahesford The direction of resizing was determined based on the hovered ssd component (e.g. left border, top-left extent), but it caused problems when trying to start resizing by pressing the corners of the window border; the resizing direction was always unidirectional at bottom corners and resizing cannot be started by pressing top corners. This commit fixes this weirdness by determining resize directions only based on the window geometry and the cursor position. The corner extents are removed as they are not longer needed. This commit also adds <resize><cornerRange> which configures the range of corner resizing on the borders/extent.
This commit is contained in:
parent
9a473f1848
commit
e98406168d
8 changed files with 89 additions and 59 deletions
|
|
@ -37,17 +37,10 @@ ssd_extents_create(struct ssd *ssd)
|
|||
-(theme->border_width + extended_area),
|
||||
-(ssd->titlebar.height + theme->border_width + extended_area));
|
||||
|
||||
/* Top */
|
||||
add_extent(part_list, LAB_SSD_PART_CORNER_TOP_LEFT, parent);
|
||||
add_extent(part_list, LAB_SSD_PART_TOP, parent);
|
||||
add_extent(part_list, LAB_SSD_PART_CORNER_TOP_RIGHT, parent);
|
||||
/* Sides */
|
||||
add_extent(part_list, LAB_SSD_PART_LEFT, parent);
|
||||
add_extent(part_list, LAB_SSD_PART_RIGHT, parent);
|
||||
/* Bottom */
|
||||
add_extent(part_list, LAB_SSD_PART_CORNER_BOTTOM_LEFT, parent);
|
||||
add_extent(part_list, LAB_SSD_PART_BOTTOM, parent);
|
||||
add_extent(part_list, LAB_SSD_PART_CORNER_BOTTOM_RIGHT, parent);
|
||||
|
||||
/* Initial manual update to keep X11 applications happy */
|
||||
ssd_extents_update(ssd);
|
||||
|
|
@ -76,11 +69,6 @@ ssd_extents_update(struct ssd *ssd)
|
|||
int full_height = height + theme->border_width * 2 + ssd->titlebar.height;
|
||||
int full_width = width + 2 * theme->border_width;
|
||||
int extended_area = SSD_EXTENDED_AREA;
|
||||
int corner_width = ssd_get_corner_width();
|
||||
int corner_size = extended_area + theme->border_width +
|
||||
MIN(corner_width, width) / 2;
|
||||
int side_width = full_width + extended_area * 2 - corner_size * 2;
|
||||
int side_height = full_height + extended_area * 2 - corner_size * 2;
|
||||
|
||||
struct wlr_box part_box;
|
||||
struct wlr_box result_box;
|
||||
|
|
@ -120,54 +108,30 @@ ssd_extents_update(struct ssd *ssd)
|
|||
wl_list_for_each(part, &ssd->extents.parts, link) {
|
||||
rect = wlr_scene_rect_from_node(part->node);
|
||||
switch (part->type) {
|
||||
case LAB_SSD_PART_CORNER_TOP_LEFT:
|
||||
case LAB_SSD_PART_TOP:
|
||||
target.x = 0;
|
||||
target.y = 0;
|
||||
target.width = corner_size;
|
||||
target.height = corner_size;
|
||||
break;
|
||||
case LAB_SSD_PART_TOP:
|
||||
target.x = corner_size;
|
||||
target.y = 0;
|
||||
target.width = side_width;
|
||||
target.width = full_width + extended_area * 2;
|
||||
target.height = extended_area;
|
||||
break;
|
||||
case LAB_SSD_PART_CORNER_TOP_RIGHT:
|
||||
target.x = corner_size + side_width;
|
||||
target.y = 0;
|
||||
target.width = corner_size;
|
||||
target.height = corner_size;
|
||||
break;
|
||||
case LAB_SSD_PART_LEFT:
|
||||
target.x = 0;
|
||||
target.y = corner_size;
|
||||
target.y = extended_area;
|
||||
target.width = extended_area;
|
||||
target.height = side_height;
|
||||
target.height = full_height;
|
||||
break;
|
||||
case LAB_SSD_PART_RIGHT:
|
||||
target.x = extended_area + full_width;
|
||||
target.y = corner_size;
|
||||
target.y = extended_area;
|
||||
target.width = extended_area;
|
||||
target.height = side_height;
|
||||
break;
|
||||
case LAB_SSD_PART_CORNER_BOTTOM_LEFT:
|
||||
target.x = 0;
|
||||
target.y = corner_size + side_height;
|
||||
target.width = corner_size;
|
||||
target.height = corner_size;
|
||||
target.height = full_height;
|
||||
break;
|
||||
case LAB_SSD_PART_BOTTOM:
|
||||
target.x = corner_size;
|
||||
target.x = 0;
|
||||
target.y = extended_area + full_height;
|
||||
target.width = side_width;
|
||||
target.width = full_width + extended_area * 2;
|
||||
target.height = extended_area;
|
||||
break;
|
||||
case LAB_SSD_PART_CORNER_BOTTOM_RIGHT:
|
||||
target.x = corner_size + side_width;
|
||||
target.y = corner_size + side_height;
|
||||
target.width = corner_size;
|
||||
target.height = corner_size;
|
||||
break;
|
||||
default:
|
||||
/* not reached */
|
||||
assert(false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue