Add experimental mode to use native scaling of Xwayland clients
Allow scale-aware Xwayland clients to scale by an integer scale themselves, instead of letting them render them at 1x scale and then scaling up the texture, making it look blurry. When monitor framebuffers are scaled, this special cases Xwayland and sends output regions in a way that Xwayland think everything is N times as large as the logical region, where N is the ceil of the max monitor scale. This is done by introducing a "stage" vs "protocol" coordinate space for X11, where the "protocol" coordinate space is "stage" multiplied by a scaling factor. Xwayland thus will have its own "effective scale", sent via wl_output.scale. The effective Xwayland scale is also used for the internal MetaWaylandSurface scale internally, unless there is a viewport dst size set on the same surface, in which case the scale is still set to 1, to not interfere with wp_viewport semantics. We're guarding this behind a new experimental feature "xwayland-native-scaling", which can only come into effect when enabled together with "scale-monitor-framebuffer". [v2]: Move stage_to_protocol/protocol_to_stage to generic window class. This means parts that aren't aware of any windowing system specific logic, only that coordinates originate from there for a given window, can still get their coordinates properly handled. In particular, this means coordinates from IBus that originates from the client, can be scaled properly when that client is using X11. Also make them properly introspected. [v3]: Split up coordinate transform API. Make it one that takes a MtkRectangle, and another that takes a point. This means the rounding strategy becames explicit when transforming a point, while when it's a rectangle, it's still always "grow". Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3567>
This commit is contained in:
@ -101,24 +101,20 @@ cursor_sprite_prepare_at (MetaCursorSprite *cursor_sprite,
|
||||
|
||||
logical_monitor =
|
||||
meta_monitor_manager_get_logical_monitor_at (monitor_manager, x, y);
|
||||
|
||||
if (!meta_wayland_surface_is_xwayland (surface))
|
||||
if (logical_monitor)
|
||||
{
|
||||
if (logical_monitor)
|
||||
{
|
||||
int surface_scale = surface->applied_state.scale;
|
||||
float texture_scale;
|
||||
int surface_scale = surface->applied_state.scale;
|
||||
float texture_scale;
|
||||
|
||||
if (meta_backend_is_stage_views_scaled (backend))
|
||||
texture_scale = 1.0f / surface_scale;
|
||||
else
|
||||
texture_scale = (meta_logical_monitor_get_scale (logical_monitor) /
|
||||
surface_scale);
|
||||
if (meta_backend_is_stage_views_scaled (backend))
|
||||
texture_scale = 1.0f / surface_scale;
|
||||
else
|
||||
texture_scale = (meta_logical_monitor_get_scale (logical_monitor) /
|
||||
surface_scale);
|
||||
|
||||
meta_cursor_sprite_set_texture_scale (cursor_sprite, texture_scale);
|
||||
meta_cursor_sprite_set_texture_transform (cursor_sprite,
|
||||
surface->buffer_transform);
|
||||
}
|
||||
meta_cursor_sprite_set_texture_scale (cursor_sprite, texture_scale);
|
||||
meta_cursor_sprite_set_texture_transform (cursor_sprite,
|
||||
surface->buffer_transform);
|
||||
}
|
||||
|
||||
meta_wayland_surface_set_main_monitor (surface, logical_monitor);
|
||||
|
Reference in New Issue
Block a user