mirror of
https://github.com/labwc/labwc.git
synced 2026-03-10 05:33:47 -04:00
ssd: show squared corners when the view is tiled
This commit is contained in:
parent
f2755a4e2e
commit
98347e454e
3 changed files with 23 additions and 6 deletions
|
|
@ -50,6 +50,7 @@ struct ssd {
|
||||||
*/
|
*/
|
||||||
struct {
|
struct {
|
||||||
bool was_maximized; /* To un-round corner buttons and toggle icon on maximize */
|
bool was_maximized; /* To un-round corner buttons and toggle icon on maximize */
|
||||||
|
bool was_tiled_not_maximized; /* To un-round corner buttons */
|
||||||
struct wlr_box geometry;
|
struct wlr_box geometry;
|
||||||
struct ssd_state_title {
|
struct ssd_state_title {
|
||||||
char *text;
|
char *text;
|
||||||
|
|
|
||||||
|
|
@ -117,11 +117,16 @@ ssd_titlebar_create(struct ssd *ssd)
|
||||||
|
|
||||||
ssd_update_title(ssd);
|
ssd_update_title(ssd);
|
||||||
|
|
||||||
if (view->maximized == VIEW_AXIS_BOTH) {
|
bool maximized = view->maximized == VIEW_AXIS_BOTH;
|
||||||
|
if (maximized) {
|
||||||
set_squared_corners(ssd, true);
|
set_squared_corners(ssd, true);
|
||||||
set_maximize_alt_icon(ssd, true);
|
set_maximize_alt_icon(ssd, true);
|
||||||
ssd->state.was_maximized = true;
|
ssd->state.was_maximized = true;
|
||||||
}
|
}
|
||||||
|
if (view_is_tiled(view) && !maximized) {
|
||||||
|
set_squared_corners(ssd, true);
|
||||||
|
ssd->state.was_tiled_not_maximized = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
@ -187,11 +192,16 @@ ssd_titlebar_update(struct ssd *ssd)
|
||||||
int width = view->current.width;
|
int width = view->current.width;
|
||||||
struct theme *theme = view->server->theme;
|
struct theme *theme = view->server->theme;
|
||||||
|
|
||||||
bool maximized = (view->maximized == VIEW_AXIS_BOTH);
|
bool maximized = view->maximized == VIEW_AXIS_BOTH;
|
||||||
if (ssd->state.was_maximized != maximized) {
|
bool tiled_not_maximized = view_is_tiled(ssd->view) && !maximized;
|
||||||
set_squared_corners(ssd, maximized);
|
if (ssd->state.was_maximized != maximized
|
||||||
set_maximize_alt_icon(ssd, maximized);
|
|| ssd->state.was_tiled_not_maximized != tiled_not_maximized) {
|
||||||
|
set_squared_corners(ssd, maximized || tiled_not_maximized);
|
||||||
|
if (ssd->state.was_maximized != maximized) {
|
||||||
|
set_maximize_alt_icon(ssd, maximized);
|
||||||
|
}
|
||||||
ssd->state.was_maximized = maximized;
|
ssd->state.was_maximized = maximized;
|
||||||
|
ssd->state.was_tiled_not_maximized = tiled_not_maximized;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (width == ssd->state.geometry.width) {
|
if (width == ssd->state.geometry.width) {
|
||||||
|
|
|
||||||
|
|
@ -246,7 +246,7 @@ ssd_update_geometry(struct ssd *ssd)
|
||||||
ssd_extents_update(ssd);
|
ssd_extents_update(ssd);
|
||||||
ssd->state.geometry = current;
|
ssd->state.geometry = current;
|
||||||
}
|
}
|
||||||
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_border_update(ssd);
|
||||||
ssd_titlebar_update(ssd);
|
ssd_titlebar_update(ssd);
|
||||||
|
|
@ -258,6 +258,12 @@ ssd_update_geometry(struct ssd *ssd)
|
||||||
*/
|
*/
|
||||||
ssd->state.was_maximized = maximized;
|
ssd->state.was_maximized = maximized;
|
||||||
}
|
}
|
||||||
|
bool tiled_and_not_maximized = view_is_tiled(ssd->view) && !maximized;
|
||||||
|
if (ssd->state.was_tiled_not_maximized != tiled_and_not_maximized) {
|
||||||
|
ssd_titlebar_update(ssd);
|
||||||
|
/* see above about being future proof */
|
||||||
|
ssd->state.was_tiled_not_maximized = tiled_and_not_maximized;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ssd_extents_update(ssd);
|
ssd_extents_update(ssd);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue