Merge branch 'simple-resizing-fixes' into 'master'

Simple resizing fixes

Closes #3076

See merge request GNOME/gtk!2661
This commit is contained in:
Matthias Clasen 2020-10-06 01:25:25 +00:00
commit 7f5deed2eb
2 changed files with 44 additions and 20 deletions

View File

@ -333,7 +333,9 @@ _gdk_wayland_surface_save_size (GdkSurface *surface)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
if (surface->state & (GDK_TOPLEVEL_STATE_FULLSCREEN | GDK_TOPLEVEL_STATE_MAXIMIZED))
if (surface->state & (GDK_TOPLEVEL_STATE_FULLSCREEN |
GDK_TOPLEVEL_STATE_MAXIMIZED |
GDK_TOPLEVEL_STATE_TILED))
return;
impl->saved_width = surface->width - impl->margin_left - impl->margin_right;
@ -881,24 +883,6 @@ gdk_wayland_surface_finalize (GObject *object)
G_OBJECT_CLASS (gdk_wayland_surface_parent_class)->finalize (object);
}
static void
gdk_wayland_surface_resize (GdkSurface *surface,
int width,
int height,
int scale)
{
GdkDisplay *display;
GdkEvent *event;
event = gdk_configure_event_new (surface, width, height);
gdk_wayland_surface_update_size (surface, width, height, scale);
_gdk_surface_update_size (surface);
display = gdk_surface_get_display (surface);
_gdk_wayland_display_deliver_event (display, event);
}
static gboolean
is_realized_shell_surface (GdkWaylandSurface *impl)
{
@ -920,6 +904,26 @@ is_realized_popup (GdkWaylandSurface *impl)
impl->display_server.zxdg_popup_v6);
}
static void
gdk_wayland_surface_resize (GdkSurface *surface,
int width,
int height,
int scale)
{
gdk_wayland_surface_update_size (surface, width, height, scale);
_gdk_surface_update_size (surface);
if (is_realized_shell_surface (GDK_WAYLAND_SURFACE (surface)))
{
GdkDisplay *display;
GdkEvent *event;
event = gdk_configure_event_new (surface, width, height);
display = gdk_surface_get_display (surface);
_gdk_wayland_display_deliver_event (display, event);
}
}
static void gdk_wayland_surface_show (GdkSurface *surface,
gboolean already_mapped);
static void gdk_wayland_surface_hide (GdkSurface *surface);
@ -1350,6 +1354,11 @@ gdk_wayland_surface_configure_toplevel (GdkSurface *surface)
/* Save size for next time we get 0x0 */
_gdk_wayland_surface_save_size (surface);
}
else
{
width += impl->margin_left + impl->margin_right;
height += impl->margin_top + impl->margin_bottom;
}
gdk_wayland_surface_resize (surface, width, height, impl->scale);
}

View File

@ -4729,6 +4729,22 @@ surface_size_changed (GtkWidget *widget,
check_scale_changed (GTK_WINDOW (widget));
if (!(priv->state & (GDK_TOPLEVEL_STATE_FULLSCREEN |
GDK_TOPLEVEL_STATE_MAXIMIZED |
GDK_TOPLEVEL_STATE_TILED |
GDK_TOPLEVEL_STATE_TOP_TILED |
GDK_TOPLEVEL_STATE_RIGHT_TILED |
GDK_TOPLEVEL_STATE_BOTTOM_TILED |
GDK_TOPLEVEL_STATE_LEFT_TILED |
GDK_TOPLEVEL_STATE_MINIMIZED)))
{
GtkWindowGeometryInfo *info;
info = gtk_window_get_geometry_info (GTK_WINDOW (widget), TRUE);
info->last.configure_request.width = width;
info->last.configure_request.height = height;
}
/* priv->configure_request_count incremented for each
* configure request, and decremented to a min of 0 for
* each configure notify.
@ -5490,7 +5506,6 @@ gtk_window_move_resize (GtkWindow *window)
info->last.geometry = new_geometry;
info->last.flags = new_flags;
info->last.configure_request = new_request;
/* need to set PPosition so the WM will look at our position,
* but we don't want to count PPosition coming and going as a hints
* change for future iterations. So we saved info->last prior to