Merge branch 'matthiasc/for-main' into 'main'

wayland: Use wl_compositor version 6

See merge request GNOME/gtk!7164
This commit is contained in:
Matthias Clasen 2024-04-22 01:00:22 +00:00
commit 59db0ca328
6 changed files with 82 additions and 53 deletions

View File

@ -440,7 +440,7 @@ gdk_registry_handle_global (void *data,
{
display_wayland->compositor =
wl_registry_bind (display_wayland->wl_registry, id,
&wl_compositor_interface, MIN (version, 5));
&wl_compositor_interface, MIN (version, 6));
}
else if (strcmp (interface, "wl_shm") == 0)
{

View File

@ -781,7 +781,7 @@ pointer_handle_motion (void *data,
{
double x, y;
gdk_event_get_position (event, &x, &y);
g_message ("motion %f %f, seat %p state %d",
gdk_debug_message ("motion %f %f, seat %p state %d",
x, y, seat, gdk_event_get_modifier_state (event));
}
@ -1664,7 +1664,7 @@ touch_handle_down (void *data,
{
double xx, yy;
gdk_event_get_position (event, &xx, &yy);
g_message ("touch begin %f %f", xx, yy);
gdk_debug_message ("touch begin %f %f", xx, yy);
}
_gdk_wayland_display_deliver_event (seat->display, event);
@ -1699,7 +1699,7 @@ touch_handle_up (void *data,
{
double x, y;
gdk_event_get_position (event, &x, &y);
g_message ("touch end %f %f", x, y);
gdk_debug_message ("touch end %f %f", x, y);
}
_gdk_wayland_display_deliver_event (seat->display, event);
@ -1747,7 +1747,7 @@ touch_handle_motion (void *data,
{
double xx, yy;
gdk_event_get_position (event, &xx, &yy);
g_message ("touch update %f %f", xx, yy);
gdk_debug_message ("touch update %f %f", xx, yy);
}
_gdk_wayland_display_deliver_event (seat->display, event);
@ -1841,7 +1841,7 @@ emit_gesture_swipe_event (GdkWaylandSeat *seat,
{
double x, y;
gdk_event_get_position (event, &x, &y);
g_message ("swipe event %d, coords: %f %f, seat %p state %d",
gdk_debug_message ("swipe event %d, coords: %f %f, seat %p state %d",
gdk_event_get_event_type (event), x, y, seat,
gdk_event_get_modifier_state (event));
}
@ -1936,7 +1936,7 @@ emit_gesture_pinch_event (GdkWaylandSeat *seat,
{
double x, y;
gdk_event_get_position (event, &x, &y);
g_message ("pinch event %d, coords: %f %f, seat %p state %d",
gdk_debug_message ("pinch event %d, coords: %f %f, seat %p state %d",
gdk_event_get_event_type (event),
x, y, seat,
gdk_event_get_modifier_state (event));
@ -2030,7 +2030,7 @@ emit_gesture_hold_event (GdkWaylandSeat *seat,
{
double x, y;
gdk_event_get_position (event, &x, &y);
g_message ("hold event %d, coords: %f %f, seat %p state %d",
gdk_debug_message ("hold event %d, coords: %f %f, seat %p state %d",
gdk_event_get_event_type (event),
x, y, seat,
gdk_event_get_modifier_state (event));

View File

@ -408,10 +408,7 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
if (has_background)
ensure_bg_surface (self);
if (self->dest.x != dest->origin.x ||
self->dest.y != dest->origin.y ||
self->dest.width != dest->size.width ||
self->dest.height != dest->size.height)
if (!scaled_rect_is_integral (dest, 1, &device_rect))
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
"Non-integer coordinates %g %g %g %g for %dx%d texture, hiding subsurface %p",
@ -430,10 +427,18 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
scale,
self);
}
else if (background && !scaled_rect_is_integral (background, 1, &device_rect))
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
"Non-integral background coordinates %g %g %g %g, hiding subsurface %p",
background->origin.x, background->origin.y,
background->size.width, background->size.height,
self);
}
else if (background && !scaled_rect_is_integral (background, scale, &device_rect))
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
"Non-integral background device coordinates %g %g %g %g (fractional scale %.2f), hiding background of subsurface %p",
"Non-integral background device coordinates %g %g %g %g (fractional scale %.2f), hiding subsurface %p",
device_rect.origin.x, device_rect.origin.y,
device_rect.size.width, device_rect.size.height,
scale,
@ -491,12 +496,14 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
}
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
"Attached %dx%d texture to subsurface %p at %d %d %d %d",
"Attached %dx%d texture to subsurface %p at %d %d %d %d%s%s",
gdk_texture_get_width (texture),
gdk_texture_get_height (texture),
self,
self->dest.x, self->dest.y,
self->dest.width, self->dest.height);
self->dest.width, self->dest.height,
will_be_above ? ", above parent" : "",
has_background ? ", with background" : "");
result = TRUE;
}
else
@ -654,7 +661,7 @@ gdk_wayland_subsurface_detach (GdkSubsurface *sub)
if (sub->parent == NULL)
{
g_warning ("Can't draw to destroyed subsurface %p", self);
g_warning ("Can't detach from destroyed subsurface %p", self);
return;
}

View File

@ -821,6 +821,11 @@ gdk_wayland_surface_fractional_scale_preferred_scale_cb (void *data,
gdk_wayland_surface_update_size (surface,
surface->width, surface->height,
&GDK_FRACTIONAL_SCALE_INIT (scale));
GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS,
"preferred fractional scale, surface %p scale %f",
surface,
gdk_fractional_scale_to_double (&GDK_FRACTIONAL_SCALE_INIT (scale)));
}
static const struct wp_fractional_scale_v1_listener fractional_scale_listener = {
@ -870,9 +875,38 @@ surface_leave (void *data,
gdk_surface_leave_monitor (surface, monitor);
}
static void
surface_preferred_buffer_scale (void *data,
struct wl_surface *wl_surface,
int32_t factor)
{
GdkSurface *surface = GDK_SURFACE (data);
GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS,
"preferred buffer scale, surface %p scale %d",
surface, factor);
}
static void
surface_preferred_buffer_transform (void *data,
struct wl_surface *wl_surface,
uint32_t transform)
{
GdkSurface *surface = GDK_SURFACE (data);
const char *transform_name[] = {
"normal", "90", "180", "270", "flipped", "flipped-90", "flipped-180", "flipped-270"
};
GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS,
"preferred buffer transform, surface %p transform %s",
surface, transform_name[transform]);
}
static const struct wl_surface_listener surface_listener = {
surface_enter,
surface_leave
surface_leave,
surface_preferred_buffer_scale,
surface_preferred_buffer_transform,
};
static void

View File

@ -130,11 +130,7 @@ find_texture_to_attach (GskOffload *self,
gsk_rect_equal (&bounds, &subsurface_node->bounds) &&
gdk_rgba_equal (gsk_color_node_get_color (child), &GDK_RGBA_BLACK))
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD,
"Offloading subsurface %p with background",
subsurface);
*has_background = TRUE;
node = gsk_container_node_get_child (node, 1);
break;
}
@ -684,7 +680,6 @@ gsk_offload_new (GdkSurface *surface,
GskRenderNode *root,
cairo_region_t *diff)
{
GdkDisplay *display = gdk_surface_get_display (surface);
GskOffload *self;
self = g_new0 (GskOffload, 1);
@ -752,17 +747,10 @@ gsk_offload_new (GdkSurface *surface,
{
info->is_offloaded = FALSE;
if (info->was_offloaded)
{
GDK_DISPLAY_DEBUG (display, OFFLOAD, "Hiding subsurface %p", info->subsurface);
gdk_subsurface_detach (info->subsurface);
}
}
if (info->is_offloaded && gdk_subsurface_is_above_parent (info->subsurface))
{
GDK_DISPLAY_DEBUG (display, OFFLOAD, "Raising subsurface %p", info->subsurface);
info->is_above = TRUE;
}
info->is_above = info->is_offloaded && gdk_subsurface_is_above_parent (info->subsurface);
gdk_subsurface_get_bounds (info->subsurface, &bounds);