[gtk/wip/matthiasc/popup4: 62/115] surface: Remove abs_x/abs_y
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/popup4: 62/115] surface: Remove abs_x/abs_y
- Date: Wed, 24 Apr 2019 19:35:49 +0000 (UTC)
commit b0af0485785aeb06c3ef0e0ae12370dd31e593e4
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Mar 24 15:42:32 2019 -0400
surface: Remove abs_x/abs_y
We no longer have child windows, so the offset is
always 0.
gdk/gdkdevice.c | 4 ++--
gdk/gdkinternals.h | 1 -
gdk/gdksurface.c | 47 ++++++++------------------------------------
gdk/x11/gdkdevice-core-x11.c | 29 ++++-----------------------
4 files changed, 14 insertions(+), 67 deletions(-)
---
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index b85787df1e..a919bd2814 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -1541,7 +1541,7 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
else
scale = 1;
- offset = - surface_root_x - surface->abs_x;
+ offset = - surface_root_x;
}
else
{
@@ -1550,7 +1550,7 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
else
scale = 1;
- offset = - surface_root_y - surface->abs_y;
+ offset = - surface_root_y;
}
if (axis_value)
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 232cc8f1d0..1f2d090cba 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -187,7 +187,6 @@ struct _GdkSurface
guint update_and_descendants_freeze_count;
- gint abs_x, abs_y; /* Absolute offset in impl */
gint width, height;
gint shadow_top;
gint shadow_left;
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 191065b229..4fde6e7d4b 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -61,9 +61,7 @@
*
* A #GdkSurface is a (usually) rectangular region on the screen.
* It’s a low-level object, used to implement high-level objects such as
- * #GtkWidget and #GtkWindow on the GTK level. A #GtkWindow is a toplevel
- * surface, the thing a user might think of as a “window” with a titlebar
- * and so on; a #GtkWindow may contain many sub-GdkSurfaces.
+ * #GtkWindow on the GTK level.
*/
/**
@@ -73,28 +71,6 @@
* 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 {
MOVED_TO_RECT,
SIZE_CHANGED,
@@ -1526,6 +1502,7 @@ gdk_surface_get_device_position (GdkSurface *surface,
device,
&tmp_x, &tmp_y,
&tmp_mask);
+
if (x)
*x = tmp_x;
if (y)
@@ -1568,7 +1545,7 @@ static void
gdk_surface_show_internal (GdkSurface *surface, gboolean raise)
{
GdkSurfaceImplClass *impl_class;
- gboolean was_mapped, was_viewable;
+ gboolean was_mapped;
gboolean did_show;
g_return_if_fail (GDK_IS_SURFACE (surface));
@@ -1577,7 +1554,6 @@ gdk_surface_show_internal (GdkSurface *surface, gboolean raise)
return;
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
- was_viewable = surface->viewable;
if (raise)
gdk_surface_raise_internal (surface);
@@ -1751,7 +1727,7 @@ void
gdk_surface_hide (GdkSurface *surface)
{
GdkSurfaceImplClass *impl_class;
- gboolean was_mapped, did_hide;
+ gboolean was_mapped;
g_return_if_fail (GDK_IS_SURFACE (surface));
@@ -1796,8 +1772,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
g_list_free (devices);
}
- did_hide = _gdk_surface_update_viewable (surface);
-
impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
impl_class->hide (surface);
}
@@ -2230,9 +2204,9 @@ gdk_surface_get_origin (GdkSurface *surface,
g_return_val_if_fail (GDK_IS_SURFACE (surface), 0);
gdk_surface_get_root_coords (surface,
- 0, 0,
- x ? x : &dummy_x,
- y ? y : &dummy_y);
+ 0, 0,
+ x ? x : &dummy_x,
+ y ? y : &dummy_y);
return TRUE;
}
@@ -2270,9 +2244,7 @@ gdk_surface_get_root_coords (GdkSurface *surface,
impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
impl_class->get_root_coords (surface->impl_surface,
- x + surface->abs_x,
- y + surface->abs_y,
- root_x, root_y);
+ x, y, root_x, root_y);
}
/**
@@ -2847,9 +2819,6 @@ gdk_surface_print (GdkSurface *surface,
if (!gdk_surface_is_visible ((GdkSurface *)surface))
g_print (" hidden");
- g_print (" abs[%d,%d]",
- surface->abs_x, surface->abs_y);
-
if (surface->alpha != 255)
g_print (" alpha[%d]",
surface->alpha);
diff --git a/gdk/x11/gdkdevice-core-x11.c b/gdk/x11/gdkdevice-core-x11.c
index 98a2d76a3b..20318618ca 100644
--- a/gdk/x11/gdkdevice-core-x11.c
+++ b/gdk/x11/gdkdevice-core-x11.c
@@ -102,22 +102,6 @@ gdk_x11_device_core_init (GdkX11DeviceCore *device_core)
_gdk_device_add_axis (device, NULL, GDK_AXIS_Y, 0, 0, 1);
}
-static gboolean
-impl_coord_in_surface (GdkSurface *surface,
- int impl_x,
- int impl_y)
-{
- if (impl_x < surface->abs_x ||
- impl_x >= surface->abs_x + surface->width)
- return FALSE;
-
- if (impl_y < surface->abs_y ||
- impl_y >= surface->abs_y + surface->height)
- return FALSE;
-
- return TRUE;
-}
-
static gboolean
gdk_x11_device_core_get_history (GdkDevice *device,
GdkSurface *surface,
@@ -145,15 +129,10 @@ gdk_x11_device_core_get_history (GdkDevice *device,
for (i = 0, j = 0; i < tmp_n_events; i++)
{
- if (impl_coord_in_surface (surface,
- xcoords[i].x / impl->surface_scale,
- xcoords[i].y / impl->surface_scale))
- {
- coords[j]->time = xcoords[i].time;
- coords[j]->axes[0] = (double)xcoords[i].x / impl->surface_scale - surface->abs_x;
- coords[j]->axes[1] = (double)xcoords[i].y / impl->surface_scale - surface->abs_y;
- j++;
- }
+ coords[j]->time = xcoords[i].time;
+ coords[j]->axes[0] = (double)xcoords[i].x / impl->surface_scale;
+ coords[j]->axes[1] = (double)xcoords[i].y / impl->surface_scale;
+ j++;
}
XFree (xcoords);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]