mirror of
https://github.com/labwc/labwc.git
synced 2026-04-12 08:21:13 -04:00
[wip] tearing: prefer client hint over fullscreen
This commit is contained in:
parent
db7f300554
commit
928e712c18
4 changed files with 34 additions and 7 deletions
|
|
@ -30,6 +30,12 @@ enum ssd_preference {
|
|||
LAB_SSD_PREF_SERVER,
|
||||
};
|
||||
|
||||
enum three_state {
|
||||
LAB_STATE_UNSPECIFIED = 0,
|
||||
LAB_STATE_ENABLED,
|
||||
LAB_STATE_DISABLED
|
||||
};
|
||||
|
||||
/**
|
||||
* Directions in which a view can be maximized. "None" is used
|
||||
* internally to mean "not maximized" but is not valid in rc.xml.
|
||||
|
|
@ -163,7 +169,7 @@ struct view {
|
|||
bool minimized;
|
||||
enum view_axis maximized;
|
||||
bool fullscreen;
|
||||
bool tearing_hint;
|
||||
enum three_state tearing_hint;
|
||||
bool visible_on_all_workspaces;
|
||||
enum view_edge tiled;
|
||||
uint32_t edges_visible; /* enum wlr_edges bitset */
|
||||
|
|
|
|||
13
src/action.c
13
src/action.c
|
|
@ -1007,9 +1007,18 @@ actions_run(struct view *activator, struct server *server,
|
|||
break;
|
||||
case ACTION_TYPE_TOGGLE_TEARING:
|
||||
if (view) {
|
||||
view->tearing_hint = !view->tearing_hint;
|
||||
switch (view->tearing_hint) {
|
||||
case LAB_STATE_UNSPECIFIED:
|
||||
case LAB_STATE_DISABLED:
|
||||
view->tearing_hint = LAB_STATE_ENABLED;
|
||||
break;
|
||||
case LAB_STATE_ENABLED:
|
||||
view->tearing_hint = LAB_STATE_DISABLED;
|
||||
break;
|
||||
}
|
||||
wlr_log(WLR_DEBUG, "tearing %sabled",
|
||||
view->tearing_hint ? "en" : "dis");
|
||||
view->tearing_hint == LAB_STATE_ENABLED
|
||||
? "en" : "dis");
|
||||
}
|
||||
break;
|
||||
case ACTION_TYPE_TOGGLE_SHADE:
|
||||
|
|
|
|||
|
|
@ -44,14 +44,18 @@ get_tearing_preference(struct output *output)
|
|||
return false;
|
||||
}
|
||||
|
||||
/* If a hint has been set return the hint */
|
||||
if (server->active_view->tearing_hint != LAB_STATE_UNSPECIFIED) {
|
||||
return server->active_view->tearing_hint == LAB_STATE_ENABLED;
|
||||
}
|
||||
|
||||
/* If configured, automatically enable tearing for fullscreen applications */
|
||||
if (rc.allow_tearing == LAB_TEARING_FULLSCREEN
|
||||
&& server->active_view->fullscreen) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* If the active view requests tearing, or it is toggled on with action, allow it */
|
||||
return server->active_view->tearing_hint;
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -14,8 +14,16 @@ set_tearing_hint(struct wl_listener *listener, void *data)
|
|||
{
|
||||
struct tearing_controller *controller = wl_container_of(listener, controller, set_hint);
|
||||
struct view *view = view_from_wlr_surface(controller->tearing_control->surface);
|
||||
if (view && controller->tearing_control->hint) {
|
||||
view->tearing_hint = true;
|
||||
if (view) {
|
||||
/*
|
||||
* tearing_control->hint is actually an enum:
|
||||
* WP_TEARING_CONTROL_V1_PRESENTATION_HINT_VSYNC = 0
|
||||
* WP_TEARING_CONTROL_V1_PRESENTATION_HINT_ASYNC = 1
|
||||
*
|
||||
* Using it as a bool here allows us to not ship the XML.
|
||||
*/
|
||||
view->tearing_hint = controller->tearing_control->hint
|
||||
? LAB_STATE_ENABLED : LAB_STATE_DISABLED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue