diff options
author | Matthias Clasen <mclasen@redhat.com> | 2019-03-24 15:42:32 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2019-03-26 19:18:40 -0400 |
commit | dda6a2653813c6a1107a3cf72496626e93d76cb3 (patch) | |
tree | 7fe85c5ec50c745cdb4091b3d61c55315c4d296c | |
parent | 4e90fc52c2bc3db6222aca3873ad9bd86fef9dd6 (diff) | |
download | gtk+-dda6a2653813c6a1107a3cf72496626e93d76cb3.tar.gz |
surface: Remove abs_x/abs_y
We no longer have child windows, so the offset is
always 0.
-rw-r--r-- | gdk/gdkdevice.c | 4 | ||||
-rw-r--r-- | gdk/gdkinternals.h | 1 | ||||
-rw-r--r-- | gdk/gdksurface.c | 49 | ||||
-rw-r--r-- | gdk/x11/gdkdevice-core-x11.c | 29 |
4 files changed, 13 insertions, 70 deletions
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c index c7ce1395dd..a23144676c 100644 --- a/gdk/gdkdevice.c +++ b/gdk/gdkdevice.c @@ -1663,7 +1663,7 @@ _gdk_device_translate_screen_coord (GdkDevice *device, else scale = 1; - offset = - surface_root_x - surface->abs_x; + offset = - surface_root_x; } else { @@ -1672,7 +1672,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 006eeac90d..53fa916a64 100644 --- a/gdk/gdkinternals.h +++ b/gdk/gdkinternals.h @@ -188,7 +188,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 961d99895e..2f2fd37daf 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,9 +1502,6 @@ gdk_surface_get_device_position_double (GdkSurface *surface, device, &tmp_x, &tmp_y, &tmp_mask); - /* We got the coords on the impl, convert to the surface */ - tmp_x -= surface->abs_x; - tmp_y -= surface->abs_y; if (x) *x = tmp_x; @@ -1609,7 +1582,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)); @@ -1618,7 +1591,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); @@ -1792,7 +1764,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)); @@ -1837,8 +1809,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); } @@ -2271,9 +2241,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; } @@ -2311,9 +2281,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); } /** @@ -2888,9 +2856,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 e6916056b1..87a8af731f 100644 --- a/gdk/x11/gdkdevice-core-x11.c +++ b/gdk/x11/gdkdevice-core-x11.c @@ -103,22 +103,6 @@ gdk_x11_device_core_init (GdkX11DeviceCore *device_core) } 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, guint32 start, @@ -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); |