mirror of
https://github.com/labwc/labwc.git
synced 2025-11-05 13:29:58 -05:00
view: Use wlr_box for current/pending geometry
This commit is contained in:
parent
3941991505
commit
b75dbd5b38
15 changed files with 169 additions and 186 deletions
|
|
@ -40,10 +40,10 @@ ssd_max_extents(struct view *view)
|
|||
assert(view);
|
||||
struct border border = ssd_thickness(view);
|
||||
return (struct wlr_box){
|
||||
.x = view->x - border.left,
|
||||
.y = view->y - border.top,
|
||||
.width = view->w + border.left + border.right,
|
||||
.height = view->h + border.top + border.bottom,
|
||||
.x = view->current.x - border.left,
|
||||
.y = view->current.y - border.top,
|
||||
.width = view->current.width + border.left + border.right,
|
||||
.height = view->current.height + border.top + border.bottom,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -163,11 +163,7 @@ ssd_create(struct view *view, bool active)
|
|||
ssd_titlebar_create(ssd);
|
||||
ssd->margin = ssd_thickness(view);
|
||||
ssd_set_active(ssd, active);
|
||||
|
||||
ssd->state.width = view->w;
|
||||
ssd->state.height = view->h;
|
||||
ssd->state.x = view->x;
|
||||
ssd->state.y = view->y;
|
||||
ssd->state.geometry = view->current;
|
||||
|
||||
return ssd;
|
||||
}
|
||||
|
|
@ -185,24 +181,20 @@ ssd_update_geometry(struct ssd *ssd)
|
|||
return;
|
||||
}
|
||||
|
||||
struct view *view = ssd->view;
|
||||
if (view->w == ssd->state.width && view->h == ssd->state.height) {
|
||||
if (view->x != ssd->state.x || view->y != ssd->state.y) {
|
||||
struct wlr_box cached = ssd->state.geometry;
|
||||
struct wlr_box current = ssd->view->current;
|
||||
if (current.width == cached.width && current.height == cached.height) {
|
||||
if (current.x != cached.x || current.y != cached.y) {
|
||||
/* Dynamically resize extents based on position and usable_area */
|
||||
ssd_extents_update(ssd);
|
||||
ssd->state.x = view->x;
|
||||
ssd->state.y = view->y;
|
||||
ssd->state.geometry = current;
|
||||
}
|
||||
return;
|
||||
}
|
||||
ssd_extents_update(ssd);
|
||||
ssd_border_update(ssd);
|
||||
ssd_titlebar_update(ssd);
|
||||
|
||||
ssd->state.width = view->w;
|
||||
ssd->state.height = view->h;
|
||||
ssd->state.x = view->x;
|
||||
ssd->state.y = view->y;
|
||||
ssd->state.geometry = current;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ ssd_border_create(struct ssd *ssd)
|
|||
{
|
||||
struct view *view = ssd->view;
|
||||
struct theme *theme = view->server->theme;
|
||||
int width = view->w;
|
||||
int height = view->h;
|
||||
int width = view->current.width;
|
||||
int height = view->current.height;
|
||||
int full_width = width + 2 * theme->border_width;
|
||||
|
||||
float *color;
|
||||
|
|
@ -54,8 +54,8 @@ ssd_border_update(struct ssd *ssd)
|
|||
struct view *view = ssd->view;
|
||||
struct theme *theme = view->server->theme;
|
||||
|
||||
int width = view->w;
|
||||
int height = view->h;
|
||||
int width = view->current.width;
|
||||
int height = view->current.height;
|
||||
int full_width = width + 2 * theme->border_width;
|
||||
|
||||
struct ssd_part *part;
|
||||
|
|
|
|||
|
|
@ -113,8 +113,8 @@ ssd_extents_update(struct ssd *ssd)
|
|||
|
||||
struct theme *theme = view->server->theme;
|
||||
|
||||
int width = view->w;
|
||||
int height = view->h;
|
||||
int width = view->current.width;
|
||||
int height = view->current.height;
|
||||
int full_height = height + theme->border_width * 2 + theme->title_height;
|
||||
int full_width = width + 2 * theme->border_width;
|
||||
int extended_area = SSD_EXTENDED_AREA;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ ssd_titlebar_create(struct ssd *ssd)
|
|||
{
|
||||
struct view *view = ssd->view;
|
||||
struct theme *theme = view->server->theme;
|
||||
int width = view->w;
|
||||
int width = view->current.width;
|
||||
|
||||
float *color;
|
||||
struct wlr_scene_tree *parent;
|
||||
|
|
@ -91,8 +91,8 @@ void
|
|||
ssd_titlebar_update(struct ssd *ssd)
|
||||
{
|
||||
struct view *view = ssd->view;
|
||||
int width = view->w;
|
||||
if (width == ssd->state.width) {
|
||||
int width = view->current.width;
|
||||
if (width == ssd->state.geometry.width) {
|
||||
return;
|
||||
}
|
||||
struct theme *theme = view->server->theme;
|
||||
|
|
@ -171,7 +171,7 @@ ssd_update_title_positions(struct ssd *ssd)
|
|||
{
|
||||
struct view *view = ssd->view;
|
||||
struct theme *theme = view->server->theme;
|
||||
int width = view->w;
|
||||
int width = view->current.width;
|
||||
int title_bg_width = width - SSD_BUTTON_WIDTH * SSD_BUTTON_COUNT;
|
||||
|
||||
int x, y;
|
||||
|
|
@ -239,7 +239,8 @@ ssd_update_title(struct ssd *ssd)
|
|||
struct ssd_part *part;
|
||||
struct ssd_sub_tree *subtree;
|
||||
struct ssd_state_title_width *dstate;
|
||||
int title_bg_width = view->w - SSD_BUTTON_WIDTH * SSD_BUTTON_COUNT;
|
||||
int title_bg_width = view->current.width
|
||||
- SSD_BUTTON_WIDTH * SSD_BUTTON_COUNT;
|
||||
|
||||
FOR_EACH_STATE(ssd, subtree) {
|
||||
if (subtree == &ssd->titlebar.active) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue