mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
decorations: make has_ssd public
This commit is contained in:
parent
a0debda142
commit
e2590f10fd
3 changed files with 33 additions and 32 deletions
|
|
@ -471,6 +471,7 @@ void view_maximize(struct view *view, enum view_axis axis,
|
||||||
bool store_natural_geometry);
|
bool store_natural_geometry);
|
||||||
void view_set_fullscreen(struct view *view, bool fullscreen);
|
void view_set_fullscreen(struct view *view, bool fullscreen);
|
||||||
void view_toggle_maximize(struct view *view, enum view_axis axis);
|
void view_toggle_maximize(struct view *view, enum view_axis axis);
|
||||||
|
bool view_wants_decorations(struct view *view);
|
||||||
void view_toggle_decorations(struct view *view);
|
void view_toggle_decorations(struct view *view);
|
||||||
|
|
||||||
bool view_is_always_on_top(struct view *view);
|
bool view_is_always_on_top(struct view *view);
|
||||||
|
|
|
||||||
31
src/view.c
31
src/view.c
|
|
@ -1218,6 +1218,37 @@ view_toggle_maximize(struct view *view, enum view_axis axis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
view_wants_decorations(struct view *view)
|
||||||
|
{
|
||||||
|
/* Window-rules take priority if they exist for this view */
|
||||||
|
switch (window_rules_get_property(view, "serverDecoration")) {
|
||||||
|
case LAB_PROP_TRUE:
|
||||||
|
return true;
|
||||||
|
case LAB_PROP_FALSE:
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* view->ssd_preference may be set by the decoration implementation
|
||||||
|
* e.g. src/decorations/xdg-deco.c or src/decorations/kde-deco.c.
|
||||||
|
*/
|
||||||
|
switch (view->ssd_preference) {
|
||||||
|
case LAB_SSD_PREF_SERVER:
|
||||||
|
return true;
|
||||||
|
case LAB_SSD_PREF_CLIENT:
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
/*
|
||||||
|
* We don't know anything about the client preference
|
||||||
|
* so fall back to core.decoration settings in rc.xml
|
||||||
|
*/
|
||||||
|
return rc.xdg_shell_server_side_deco;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
view_toggle_decorations(struct view *view)
|
view_toggle_decorations(struct view *view)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
33
src/xdg.c
33
src/xdg.c
|
|
@ -75,37 +75,6 @@ handle_new_popup(struct wl_listener *listener, void *data)
|
||||||
xdg_popup_create(view, wlr_popup);
|
xdg_popup_create(view, wlr_popup);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
|
||||||
has_ssd(struct view *view)
|
|
||||||
{
|
|
||||||
/* Window-rules take priority if they exist for this view */
|
|
||||||
switch (window_rules_get_property(view, "serverDecoration")) {
|
|
||||||
case LAB_PROP_TRUE:
|
|
||||||
return true;
|
|
||||||
case LAB_PROP_FALSE:
|
|
||||||
return false;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* view->ssd_preference may be set by the decoration implementation
|
|
||||||
* e.g. src/decorations/xdg-deco.c or src/decorations/kde-deco.c.
|
|
||||||
*/
|
|
||||||
switch (view->ssd_preference) {
|
|
||||||
case LAB_SSD_PREF_SERVER:
|
|
||||||
return true;
|
|
||||||
case LAB_SSD_PREF_CLIENT:
|
|
||||||
return false;
|
|
||||||
default:
|
|
||||||
/*
|
|
||||||
* We don't know anything about the client preference
|
|
||||||
* so fall back to core.decoration settings in rc.xml
|
|
||||||
*/
|
|
||||||
return rc.xdg_shell_server_side_deco;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_commit(struct wl_listener *listener, void *data)
|
handle_commit(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
|
@ -599,7 +568,7 @@ xdg_toplevel_view_map(struct view *view)
|
||||||
|
|
||||||
init_foreign_toplevel(view);
|
init_foreign_toplevel(view);
|
||||||
|
|
||||||
if (has_ssd(view)) {
|
if (view_wants_decorations(view)) {
|
||||||
view_set_ssd_mode(view, LAB_SSD_MODE_FULL);
|
view_set_ssd_mode(view, LAB_SSD_MODE_FULL);
|
||||||
} else {
|
} else {
|
||||||
view_set_ssd_mode(view, LAB_SSD_MODE_NONE);
|
view_set_ssd_mode(view, LAB_SSD_MODE_NONE);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue