mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
ssd: extend border over squared corners
This commit is contained in:
parent
98347e454e
commit
2c979fe269
2 changed files with 54 additions and 20 deletions
|
|
@ -86,6 +86,38 @@ ssd_border_update(struct ssd *ssd)
|
||||||
int height = view_effective_height(view, /* use_pending */ false);
|
int height = view_effective_height(view, /* use_pending */ false);
|
||||||
int full_width = width + 2 * theme->border_width;
|
int full_width = width + 2 * theme->border_width;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* From here on we have to cover the following border scenarios:
|
||||||
|
* Non-tiled (partial border, rounded corners):
|
||||||
|
* _____________
|
||||||
|
* o oox
|
||||||
|
* |---------------|
|
||||||
|
* |_______________|
|
||||||
|
*
|
||||||
|
* Tiled (full border, squared corners):
|
||||||
|
* _______________
|
||||||
|
* |o oox|
|
||||||
|
* |---------------|
|
||||||
|
* |_______________|
|
||||||
|
*
|
||||||
|
* Tiled or non-tiled with zero title height (full boarder, no title):
|
||||||
|
* _______________
|
||||||
|
* |_______________|
|
||||||
|
*/
|
||||||
|
|
||||||
|
int side_height = ssd->state.was_tiled_not_maximized
|
||||||
|
? height + ssd->titlebar.height
|
||||||
|
: height;
|
||||||
|
int side_y = ssd->state.was_tiled_not_maximized
|
||||||
|
? -ssd->titlebar.height
|
||||||
|
: 0;
|
||||||
|
int top_width = ssd->titlebar.height <= 0 || ssd->state.was_tiled_not_maximized
|
||||||
|
? full_width
|
||||||
|
: width - 2 * SSD_BUTTON_WIDTH;
|
||||||
|
int top_x = ssd->titlebar.height <= 0 || ssd->state.was_tiled_not_maximized
|
||||||
|
? 0
|
||||||
|
: theme->border_width + SSD_BUTTON_WIDTH;
|
||||||
|
|
||||||
struct ssd_part *part;
|
struct ssd_part *part;
|
||||||
struct wlr_scene_rect *rect;
|
struct wlr_scene_rect *rect;
|
||||||
struct ssd_sub_tree *subtree;
|
struct ssd_sub_tree *subtree;
|
||||||
|
|
@ -95,34 +127,35 @@ ssd_border_update(struct ssd *ssd)
|
||||||
switch (part->type) {
|
switch (part->type) {
|
||||||
case LAB_SSD_PART_LEFT:
|
case LAB_SSD_PART_LEFT:
|
||||||
wlr_scene_rect_set_size(rect,
|
wlr_scene_rect_set_size(rect,
|
||||||
theme->border_width, height);
|
theme->border_width,
|
||||||
|
side_height);
|
||||||
|
wlr_scene_node_set_position(part->node,
|
||||||
|
0,
|
||||||
|
side_y);
|
||||||
continue;
|
continue;
|
||||||
case LAB_SSD_PART_RIGHT:
|
case LAB_SSD_PART_RIGHT:
|
||||||
wlr_scene_rect_set_size(rect,
|
wlr_scene_rect_set_size(rect,
|
||||||
theme->border_width, height);
|
theme->border_width,
|
||||||
|
side_height);
|
||||||
wlr_scene_node_set_position(part->node,
|
wlr_scene_node_set_position(part->node,
|
||||||
theme->border_width + width, 0);
|
theme->border_width + width,
|
||||||
|
side_y);
|
||||||
continue;
|
continue;
|
||||||
case LAB_SSD_PART_BOTTOM:
|
case LAB_SSD_PART_BOTTOM:
|
||||||
wlr_scene_rect_set_size(rect,
|
wlr_scene_rect_set_size(rect,
|
||||||
full_width, theme->border_width);
|
full_width,
|
||||||
|
theme->border_width);
|
||||||
wlr_scene_node_set_position(part->node,
|
wlr_scene_node_set_position(part->node,
|
||||||
0, height);
|
0,
|
||||||
|
height);
|
||||||
continue;
|
continue;
|
||||||
case LAB_SSD_PART_TOP:
|
case LAB_SSD_PART_TOP:
|
||||||
if (ssd->titlebar.height > 0) {
|
wlr_scene_rect_set_size(rect,
|
||||||
wlr_scene_rect_set_size(rect,
|
top_width,
|
||||||
width - 2 * SSD_BUTTON_WIDTH,
|
theme->border_width);
|
||||||
theme->border_width);
|
wlr_scene_node_set_position(part->node,
|
||||||
wlr_scene_node_set_position(part->node,
|
top_x,
|
||||||
theme->border_width + SSD_BUTTON_WIDTH,
|
-(ssd->titlebar.height + theme->border_width));
|
||||||
-(ssd->titlebar.height + theme->border_width));
|
|
||||||
} else {
|
|
||||||
wlr_scene_rect_set_size(rect,
|
|
||||||
full_width, theme->border_width);
|
|
||||||
wlr_scene_node_set_position(part->node,
|
|
||||||
0, -theme->border_width);
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -248,8 +248,8 @@ ssd_update_geometry(struct ssd *ssd)
|
||||||
}
|
}
|
||||||
bool maximized = ssd->view->maximized == VIEW_AXIS_BOTH;
|
bool maximized = ssd->view->maximized == VIEW_AXIS_BOTH;
|
||||||
if (ssd->state.was_maximized != maximized) {
|
if (ssd->state.was_maximized != maximized) {
|
||||||
ssd_border_update(ssd);
|
|
||||||
ssd_titlebar_update(ssd);
|
ssd_titlebar_update(ssd);
|
||||||
|
ssd_border_update(ssd);
|
||||||
ssd_shadow_update(ssd);
|
ssd_shadow_update(ssd);
|
||||||
/*
|
/*
|
||||||
* Not strictly necessary as ssd_titlebar_update()
|
* Not strictly necessary as ssd_titlebar_update()
|
||||||
|
|
@ -261,14 +261,15 @@ ssd_update_geometry(struct ssd *ssd)
|
||||||
bool tiled_and_not_maximized = view_is_tiled(ssd->view) && !maximized;
|
bool tiled_and_not_maximized = view_is_tiled(ssd->view) && !maximized;
|
||||||
if (ssd->state.was_tiled_not_maximized != tiled_and_not_maximized) {
|
if (ssd->state.was_tiled_not_maximized != tiled_and_not_maximized) {
|
||||||
ssd_titlebar_update(ssd);
|
ssd_titlebar_update(ssd);
|
||||||
|
ssd_border_update(ssd);
|
||||||
/* see above about being future proof */
|
/* see above about being future proof */
|
||||||
ssd->state.was_tiled_not_maximized = tiled_and_not_maximized;
|
ssd->state.was_tiled_not_maximized = tiled_and_not_maximized;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ssd_extents_update(ssd);
|
ssd_extents_update(ssd);
|
||||||
ssd_border_update(ssd);
|
|
||||||
ssd_titlebar_update(ssd);
|
ssd_titlebar_update(ssd);
|
||||||
|
ssd_border_update(ssd);
|
||||||
ssd_shadow_update(ssd);
|
ssd_shadow_update(ssd);
|
||||||
ssd->state.geometry = current;
|
ssd->state.geometry = current;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue