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,8 +781,8 @@ pointer_handle_motion (void *data,
{
double x, y;
gdk_event_get_position (event, &x, &y);
g_message ("motion %f %f, seat %p state %d",
x, y, seat, gdk_event_get_modifier_state (event));
gdk_debug_message ("motion %f %f, seat %p state %d",
x, y, seat, gdk_event_get_modifier_state (event));
}
if (wl_seat_get_version (seat->wl_seat) < WL_POINTER_HAS_FRAME)
@ -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,9 +1841,9 @@ 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_event_get_event_type (event), x, y, seat,
gdk_event_get_modifier_state (event));
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));
}
_gdk_wayland_display_deliver_event (seat->display, event);
@ -1936,10 +1936,10 @@ 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_event_get_event_type (event),
x, y, seat,
gdk_event_get_modifier_state (event));
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));
}
_gdk_wayland_display_deliver_event (seat->display, event);
@ -2030,10 +2030,10 @@ 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_event_get_event_type (event),
x, y, seat,
gdk_event_get_modifier_state (event));
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));
}
_gdk_wayland_display_deliver_event (seat->display, 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 = {
@ -837,8 +842,8 @@ surface_enter (void *data,
GdkDisplay *display = gdk_surface_get_display (surface);
GdkMonitor *monitor;
GDK_DISPLAY_DEBUG(gdk_surface_get_display (surface), EVENTS,
"surface enter, surface %p output %p", surface, output);
GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS,
"surface enter, surface %p output %p", surface, output);
impl->display_server.outputs = g_slist_prepend (impl->display_server.outputs, output);
@ -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);
}
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);

View File

@ -541,9 +541,9 @@ match_any (const GtkCssSelector *selector,
#undef GTK_CSS_CHANGE_ANY
#define GTK_CSS_CHANGE_ANY 0
DEFINE_SIMPLE_SELECTOR(any, ANY, print_any, match_any,
gtk_css_selector_default_hash_one, gtk_css_selector_default_compare_one,
FALSE, FALSE, FALSE, TRUE)
DEFINE_SIMPLE_SELECTOR (any, ANY, print_any, match_any,
gtk_css_selector_default_hash_one, gtk_css_selector_default_compare_one,
FALSE, FALSE, FALSE, TRUE)
#undef GTK_CSS_CHANGE_ANY
/* NAME */
@ -575,7 +575,7 @@ comp_name (const GtkCssSelector *a,
return a->name.name - b->name.name;
}
DEFINE_SIMPLE_SELECTOR(name, NAME, print_name, match_name, hash_name, comp_name, FALSE, FALSE, TRUE, FALSE)
DEFINE_SIMPLE_SELECTOR (name, NAME, print_name, match_name, hash_name, comp_name, FALSE, FALSE, TRUE, FALSE)
/* CLASS */
@ -612,7 +612,7 @@ comp_class (const GtkCssSelector *a,
return 0;
}
DEFINE_SIMPLE_SELECTOR(class, CLASS, print_class, match_class, hash_class, comp_class, FALSE, TRUE, FALSE, FALSE)
DEFINE_SIMPLE_SELECTOR (class, CLASS, print_class, match_class, hash_class, comp_class, FALSE, TRUE, FALSE, FALSE)
/* ID */
@ -644,7 +644,7 @@ comp_id (const GtkCssSelector *a,
return a->id.name - b->id.name;
}
DEFINE_SIMPLE_SELECTOR(id, ID, print_id, match_id, hash_id, comp_id, TRUE, FALSE, FALSE, FALSE)
DEFINE_SIMPLE_SELECTOR (id, ID, print_id, match_id, hash_id, comp_id, TRUE, FALSE, FALSE, FALSE)
/* PSEUDOCLASS FOR STATE */
static void
@ -700,8 +700,8 @@ change_pseudoclass_state (const GtkCssSelector *selector)
}
#define GTK_CSS_CHANGE_PSEUDOCLASS_STATE change_pseudoclass_state (selector)
DEFINE_SIMPLE_SELECTOR(pseudoclass_state, PSEUDOCLASS_STATE, print_pseudoclass_state,
match_pseudoclass_state, hash_pseudoclass_state, comp_pseudoclass_state,
DEFINE_SIMPLE_SELECTOR (pseudoclass_state, PSEUDOCLASS_STATE, print_pseudoclass_state,
match_pseudoclass_state, hash_pseudoclass_state, comp_pseudoclass_state,
FALSE, TRUE, FALSE, TRUE)
#undef GTK_CSS_CHANGE_PSEUDOCLASS_STATE
@ -888,9 +888,9 @@ change_pseudoclass_position (const GtkCssSelector *selector)
}
#define GTK_CSS_CHANGE_PSEUDOCLASS_POSITION change_pseudoclass_position(selector)
DEFINE_SIMPLE_SELECTOR(pseudoclass_position, PSEUDOCLASS_POSITION, print_pseudoclass_position,
match_pseudoclass_position, hash_pseudoclass_position, comp_pseudoclass_position,
FALSE, TRUE, FALSE, TRUE)
DEFINE_SIMPLE_SELECTOR (pseudoclass_position, PSEUDOCLASS_POSITION, print_pseudoclass_position,
match_pseudoclass_position, hash_pseudoclass_position, comp_pseudoclass_position,
FALSE, TRUE, FALSE, TRUE)
#undef GTK_CSS_CHANGE_PSEUDOCLASS_POSITION
/* API */