surface: Remove abs_x/abs_y

We no longer have child windows, so the offset is
always 0.
This commit is contained in:
Matthias Clasen 2019-03-24 15:42:32 -04:00
parent 0f5a6a3927
commit 3248bdc726
3 changed files with 10 additions and 42 deletions

View File

@ -1541,7 +1541,7 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
else else
scale = 1; scale = 1;
offset = - surface_root_x - surface->abs_x; offset = - surface_root_x;
} }
else else
{ {
@ -1550,7 +1550,7 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
else else
scale = 1; scale = 1;
offset = - surface_root_y - surface->abs_y; offset = - surface_root_y;
} }
if (axis_value) if (axis_value)

View File

@ -188,7 +188,6 @@ struct _GdkSurface
guint update_and_descendants_freeze_count; guint update_and_descendants_freeze_count;
gint abs_x, abs_y; /* Absolute offset in impl */
gint width, height; gint width, height;
gint shadow_top; gint shadow_top;
gint shadow_left; gint shadow_left;

View File

@ -61,9 +61,7 @@
* *
* A #GdkSurface is a (usually) rectangular region on the screen. * A #GdkSurface is a (usually) rectangular region on the screen.
* Its a low-level object, used to implement high-level objects such as * Its a low-level object, used to implement high-level objects such as
* #GtkWidget and #GtkWindow on the GTK level. A #GtkWindow is a toplevel * #GtkWindow on the GTK level.
* surface, the thing a user might think of as a window with a titlebar
* and so on; a #GtkWindow may contain many sub-GdkSurfaces.
*/ */
/** /**
@ -73,28 +71,6 @@
* should not be accessed directly. * should not be accessed directly.
*/ */
/* Historically a GdkSurface always matches a platform native window,
* be it a toplevel window or a child window. In this setup the
* GdkSurface (and other GdkDrawables) were platform independent classes,
* and the actual platform specific implementation was in a delegate
* object available as impl in the surface object.
*
* With the addition of client side windows this changes a bit. The
* application-visible GdkSurface object behaves as it did before, but
* such surfaces now don't a corresponding native window. Instead subwindows
* surfaces are client side, i.e. emulated by the gdk code such
* that clipping, drawing, moving, events etc work as expected.
*
* GdkSurfaces have a pointer to the impl surface they are in, i.e.
* the topmost GdkSurface which have the same impl value. This is stored
* in impl_surface, which is different from the surface itself only for client
* side surfaces.
* All GdkSurfaces (native or not) track the position of the surface in the parent
* (x, y), the size of the surface (width, height), the position of the surface
* with respect to the impl surface (abs_x, abs_y). We also track the clip
* region of the surface wrt parent surfaces, in surface-relative coordinates (clip_region).
*/
enum { enum {
MOVED_TO_RECT, MOVED_TO_RECT,
SIZE_CHANGED, SIZE_CHANGED,
@ -1555,6 +1531,7 @@ gdk_surface_get_device_position (GdkSurface *surface,
device, device,
&tmp_x, &tmp_y, &tmp_x, &tmp_y,
&tmp_mask); &tmp_mask);
if (x) if (x)
*x = tmp_x; *x = tmp_x;
if (y) if (y)
@ -1597,7 +1574,7 @@ static void
gdk_surface_show_internal (GdkSurface *surface, gboolean raise) gdk_surface_show_internal (GdkSurface *surface, gboolean raise)
{ {
GdkSurfaceImplClass *impl_class; GdkSurfaceImplClass *impl_class;
gboolean was_mapped, was_viewable; gboolean was_mapped;
gboolean did_show; gboolean did_show;
g_return_if_fail (GDK_IS_SURFACE (surface)); g_return_if_fail (GDK_IS_SURFACE (surface));
@ -1606,7 +1583,6 @@ gdk_surface_show_internal (GdkSurface *surface, gboolean raise)
return; return;
was_mapped = GDK_SURFACE_IS_MAPPED (surface); was_mapped = GDK_SURFACE_IS_MAPPED (surface);
was_viewable = surface->viewable;
if (raise) if (raise)
gdk_surface_raise_internal (surface); gdk_surface_raise_internal (surface);
@ -1780,7 +1756,7 @@ void
gdk_surface_hide (GdkSurface *surface) gdk_surface_hide (GdkSurface *surface)
{ {
GdkSurfaceImplClass *impl_class; GdkSurfaceImplClass *impl_class;
gboolean was_mapped, did_hide; gboolean was_mapped;
g_return_if_fail (GDK_IS_SURFACE (surface)); g_return_if_fail (GDK_IS_SURFACE (surface));
@ -1825,8 +1801,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
g_list_free (devices); g_list_free (devices);
} }
did_hide = _gdk_surface_update_viewable (surface);
impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl); impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
impl_class->hide (surface); impl_class->hide (surface);
} }
@ -2299,9 +2273,7 @@ gdk_surface_get_root_coords (GdkSurface *surface,
impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl); impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
impl_class->get_root_coords (surface->impl_surface, impl_class->get_root_coords (surface->impl_surface,
x + surface->abs_x, x, y, root_x, root_y);
y + surface->abs_y,
root_x, root_y);
} }
/** /**
@ -2772,9 +2744,6 @@ gdk_surface_print (GdkSurface *surface,
if (!gdk_surface_is_visible ((GdkSurface *)surface)) if (!gdk_surface_is_visible ((GdkSurface *)surface))
g_print (" hidden"); g_print (" hidden");
g_print (" abs[%d,%d]",
surface->abs_x, surface->abs_y);
if (surface->alpha != 255) if (surface->alpha != 255)
g_print (" alpha[%d]", g_print (" alpha[%d]",
surface->alpha); surface->alpha);