mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
x11/surface: Get current drag surface size with compute-size signal
Query and update size of drag surfaces, similarly to how it's done for the Wayland backend in the previous commit.
This commit is contained in:
parent
f63fc91b0e
commit
11d9bbfd6e
@ -40,6 +40,7 @@
|
||||
#include "gdkglcontext-x11.h"
|
||||
#include "gdkprivate-x11.h"
|
||||
#include "gdktextureprivate.h"
|
||||
#include "gdkdragsurfacesizeprivate.h"
|
||||
|
||||
#include "gdkseatprivate.h"
|
||||
#include "gdkprivate.h"
|
||||
@ -345,6 +346,36 @@ compute_toplevel_size (GdkSurface *surface,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
compute_drag_surface_size (GdkSurface *surface,
|
||||
int *width,
|
||||
int *height)
|
||||
{
|
||||
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
||||
GdkDragSurfaceSize size;
|
||||
|
||||
gdk_drag_surface_size_init (&size);
|
||||
size.width = impl->next_layout.configured_width;
|
||||
size.height = impl->next_layout.configured_height;
|
||||
|
||||
gdk_drag_surface_notify_compute_size (GDK_DRAG_SURFACE (surface), &size);
|
||||
|
||||
if ((impl->last_computed_width != size.width ||
|
||||
impl->last_computed_height != size.height) &&
|
||||
(impl->next_layout.configured_width != size.width ||
|
||||
impl->next_layout.configured_height != size.height))
|
||||
{
|
||||
*width = size.width;
|
||||
*height = size.height;
|
||||
impl->last_computed_width = size.width;
|
||||
impl->last_computed_height = size.height;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
compute_size_idle (gpointer user_data)
|
||||
{
|
||||
@ -394,6 +425,24 @@ gdk_x11_surface_compute_size (GdkSurface *surface)
|
||||
impl->surface_scale);
|
||||
}
|
||||
|
||||
impl->next_layout.surface_geometry_dirty = FALSE;
|
||||
impl->next_layout.configure_pending = FALSE;
|
||||
}
|
||||
else if (GDK_IS_DRAG_SURFACE (surface))
|
||||
{
|
||||
int width, height;
|
||||
|
||||
if (compute_drag_surface_size (surface, &width, &height))
|
||||
gdk_x11_surface_toplevel_resize (surface, width, height);
|
||||
|
||||
if (surface->resize_count == 0)
|
||||
{
|
||||
gdk_x11_surface_update_size (impl,
|
||||
impl->next_layout.configured_width,
|
||||
impl->next_layout.configured_height,
|
||||
impl->surface_scale);
|
||||
}
|
||||
|
||||
impl->next_layout.surface_geometry_dirty = FALSE;
|
||||
impl->next_layout.configure_pending = FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user