wayland/window: Pass popup configuration using relative coordinates
After popup placement rules have gone through the constraints engine has ended up resulting in an actual move, pass the window configuration down the path using relative coordinates, as that is what the next layer (xdg-shell implementation) actually cares about. In the future, this will also be helpful when the configured position is not against the current state of the parent. https://gitlab.gnome.org/GNOME/mutter/merge_requests/705
This commit is contained in:
parent
9b97e5ed58
commit
d22f947bf5
@ -1037,8 +1037,8 @@ meta_wayland_zxdg_popup_v6_configure (MetaWaylandShellSurface *shell_surf
|
||||
return;
|
||||
|
||||
geometry_scale = meta_window_wayland_get_geometry_scale (parent_window);
|
||||
x = (configuration->x - parent_window->rect.x) / geometry_scale;
|
||||
y = (configuration->y - parent_window->rect.y) / geometry_scale;
|
||||
x = configuration->rel_x / geometry_scale;
|
||||
y = configuration->rel_y / geometry_scale;
|
||||
|
||||
zxdg_popup_v6_send_configure (xdg_popup->resource,
|
||||
x, y,
|
||||
|
@ -48,6 +48,30 @@ meta_wayland_window_configuration_new (int x,
|
||||
return configuration;
|
||||
}
|
||||
|
||||
MetaWaylandWindowConfiguration *
|
||||
meta_wayland_window_configuration_new_relative (int rel_x,
|
||||
int rel_y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
MetaWaylandWindowConfiguration *configuration;
|
||||
|
||||
configuration = g_new0 (MetaWaylandWindowConfiguration, 1);
|
||||
*configuration = (MetaWaylandWindowConfiguration) {
|
||||
.serial = ++global_serial_counter,
|
||||
|
||||
.has_relative_position = TRUE,
|
||||
.rel_x = rel_x,
|
||||
.rel_y = rel_y,
|
||||
|
||||
.has_size = TRUE,
|
||||
.width = width,
|
||||
.height = height,
|
||||
};
|
||||
|
||||
return configuration;
|
||||
}
|
||||
|
||||
MetaWaylandWindowConfiguration *
|
||||
meta_wayland_window_configuration_new_empty (void)
|
||||
{
|
||||
|
@ -34,6 +34,10 @@ struct _MetaWaylandWindowConfiguration
|
||||
int x;
|
||||
int y;
|
||||
|
||||
gboolean has_relative_position;
|
||||
int rel_x;
|
||||
int rel_y;
|
||||
|
||||
gboolean has_size;
|
||||
int width;
|
||||
int height;
|
||||
@ -43,6 +47,12 @@ MetaWaylandWindowConfiguration * meta_wayland_window_configuration_new (int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
MetaWaylandWindowConfiguration * meta_wayland_window_configuration_new_relative (int rel_x,
|
||||
int rel_y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
MetaWaylandWindowConfiguration * meta_wayland_window_configuration_new_empty (void);
|
||||
|
||||
void meta_wayland_window_configuration_free (MetaWaylandWindowConfiguration *configuration);
|
||||
|
@ -1145,8 +1145,8 @@ meta_wayland_xdg_popup_configure (MetaWaylandShellSurface *shell_surface,
|
||||
return;
|
||||
|
||||
geometry_scale = meta_window_wayland_get_geometry_scale (parent_window);
|
||||
x = (configuration->x - parent_window->rect.x) / geometry_scale;
|
||||
y = (configuration->y - parent_window->rect.y) / geometry_scale;
|
||||
x = configuration->rel_x / geometry_scale;
|
||||
y = configuration->rel_y / geometry_scale;
|
||||
xdg_popup_send_configure (xdg_popup->resource,
|
||||
x, y,
|
||||
configuration->width, configuration->height);
|
||||
|
@ -57,6 +57,8 @@ struct _MetaWindowWayland
|
||||
int last_sent_y;
|
||||
int last_sent_width;
|
||||
int last_sent_height;
|
||||
int last_sent_rel_x;
|
||||
int last_sent_rel_y;
|
||||
|
||||
gboolean has_been_shown;
|
||||
};
|
||||
@ -163,16 +165,10 @@ meta_window_wayland_focus (MetaWindow *window,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_window_wayland_configure (MetaWindowWayland *wl_window,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
meta_window_wayland_configure (MetaWindowWayland *wl_window,
|
||||
MetaWaylandWindowConfiguration *configuration)
|
||||
{
|
||||
MetaWindow *window = META_WINDOW (wl_window);
|
||||
MetaWaylandWindowConfiguration *configuration;
|
||||
|
||||
configuration = meta_wayland_window_configuration_new (x, y, width, height);
|
||||
|
||||
meta_wayland_surface_configure_notify (window->surface, configuration);
|
||||
|
||||
@ -184,16 +180,19 @@ static void
|
||||
surface_state_changed (MetaWindow *window)
|
||||
{
|
||||
MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window);
|
||||
MetaWaylandWindowConfiguration *configuration;
|
||||
|
||||
/* don't send notify when the window is being unmanaged */
|
||||
if (window->unmanaging)
|
||||
return;
|
||||
|
||||
meta_window_wayland_configure (wl_window,
|
||||
wl_window->last_sent_x,
|
||||
wl_window->last_sent_y,
|
||||
wl_window->last_sent_width,
|
||||
wl_window->last_sent_height);
|
||||
configuration =
|
||||
meta_wayland_window_configuration_new (wl_window->last_sent_x,
|
||||
wl_window->last_sent_y,
|
||||
wl_window->last_sent_width,
|
||||
wl_window->last_sent_height);
|
||||
|
||||
meta_window_wayland_configure (wl_window, configuration);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -306,6 +305,8 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
|
||||
constrained_rect.height != window->rect.height ||
|
||||
(flags & META_MOVE_RESIZE_STATE_CHANGED))
|
||||
{
|
||||
MetaWaylandWindowConfiguration *configuration;
|
||||
|
||||
/* If the constrained size is 1x1 and the unconstrained size is 0x0
|
||||
* it means that we are trying to resize a window where the client has
|
||||
* not yet committed a buffer. The 1x1 constrained size is a result of
|
||||
@ -323,13 +324,29 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
|
||||
constrained_rect.height == 1)
|
||||
return;
|
||||
|
||||
meta_window_wayland_configure (wl_window,
|
||||
configured_x,
|
||||
configured_y,
|
||||
configured_width,
|
||||
configured_height);
|
||||
if (window->placement_rule)
|
||||
{
|
||||
MetaWindow *parent = meta_window_get_transient_for (window);
|
||||
int rel_x, rel_y;
|
||||
|
||||
/* We need to wait until the resize completes before we can move */
|
||||
rel_x = configured_x - parent->rect.x;
|
||||
rel_y = configured_y - parent->rect.y;
|
||||
configuration =
|
||||
meta_wayland_window_configuration_new_relative (rel_x,
|
||||
rel_y,
|
||||
configured_width,
|
||||
configured_height);
|
||||
}
|
||||
else
|
||||
{
|
||||
configuration =
|
||||
meta_wayland_window_configuration_new (configured_x,
|
||||
configured_y,
|
||||
configured_width,
|
||||
configured_height);
|
||||
}
|
||||
|
||||
meta_window_wayland_configure (wl_window, configuration);
|
||||
can_move_now = FALSE;
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user