[gtk/wip/otte/geometry: 4/4] Remove gravity from GdkGeometry
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/geometry: 4/4] Remove gravity from GdkGeometry
- Date: Thu, 30 Jul 2020 13:46:29 +0000 (UTC)
commit f36285dc575bbd9db7ca5ac09f95eb6857f1f44a
Author: Benjamin Otte <otte redhat com>
Date: Thu Jul 30 05:02:30 2020 +0200
Remove gravity from GdkGeometry
It's always northwest
gdk/broadway/gdksurface-broadway.c | 63 +++-----------------------------
gdk/gdkinternals.h | 2 --
gdk/x11/gdksurface-x11.c | 74 ++------------------------------------
gtk/gtkwindow.c | 9 -----
4 files changed, 7 insertions(+), 141 deletions(-)
---
diff --git a/gdk/broadway/gdksurface-broadway.c b/gdk/broadway/gdksurface-broadway.c
index ca68c5fbcd..fb03675ece 100644
--- a/gdk/broadway/gdksurface-broadway.c
+++ b/gdk/broadway/gdksurface-broadway.c
@@ -1137,65 +1137,10 @@ create_moveresize_surface (MoveResizeData *mv_resize,
static void
calculate_unmoving_origin (MoveResizeData *mv_resize)
{
- int x, y, width, height;
-
- if (mv_resize->moveresize_geom_mask & GDK_HINT_WIN_GRAVITY &&
- mv_resize->moveresize_geometry.win_gravity == GDK_GRAVITY_STATIC)
- {
- gdk_surface_get_origin (mv_resize->moveresize_surface,
- &mv_resize->moveresize_orig_x,
- &mv_resize->moveresize_orig_y);
- }
- else
- {
- gdk_surface_get_geometry (mv_resize->moveresize_surface,
- &x, &y, &width, &height);
-
- switch (mv_resize->moveresize_geometry.win_gravity)
- {
- case GDK_GRAVITY_NORTH_WEST:
- mv_resize->moveresize_orig_x = x;
- mv_resize->moveresize_orig_y = y;
- break;
- case GDK_GRAVITY_NORTH:
- mv_resize->moveresize_orig_x = x + width / 2;
- mv_resize->moveresize_orig_y = y;
- break;
- case GDK_GRAVITY_NORTH_EAST:
- mv_resize->moveresize_orig_x = x = width;
- mv_resize->moveresize_orig_y = y;
- break;
- case GDK_GRAVITY_WEST:
- mv_resize->moveresize_orig_x = x;
- mv_resize->moveresize_orig_y = y + height / 2;
- break;
- case GDK_GRAVITY_CENTER:
- mv_resize->moveresize_orig_x = x + width / 2;
- mv_resize->moveresize_orig_y = y + height / 2;
- break;
- case GDK_GRAVITY_EAST:
- mv_resize->moveresize_orig_x = x + width;
- mv_resize->moveresize_orig_y = y + height / 2;
- break;
- case GDK_GRAVITY_SOUTH_WEST:
- mv_resize->moveresize_orig_x = x + width;
- mv_resize->moveresize_orig_y = y + height;
- break;
- case GDK_GRAVITY_SOUTH:
- mv_resize->moveresize_orig_x = x + width / 2;
- mv_resize->moveresize_orig_y = y + height;
- break;
- case GDK_GRAVITY_SOUTH_EAST:
- mv_resize->moveresize_orig_x = x;
- mv_resize->moveresize_orig_y = y + height;
- break;
- case GDK_GRAVITY_STATIC:
- default:
- mv_resize->moveresize_orig_x = x;
- mv_resize->moveresize_orig_y = y;
- break;
- }
- }
+ gdk_surface_get_geometry (mv_resize->moveresize_surface,
+ &mv_resize->moveresize_orig_x,
+ &mv_resize->moveresize_orig_y,
+ NULL, NULL);
}
static void
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 3489455aef..8a51704b41 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -299,7 +299,6 @@ typedef enum
GDK_HINT_POS = 1 << 0,
GDK_HINT_MIN_SIZE = 1 << 1,
GDK_HINT_MAX_SIZE = 1 << 2,
- GDK_HINT_WIN_GRAVITY = 1 << 6,
} GdkSurfaceHints;
typedef enum
@@ -328,7 +327,6 @@ struct _GdkGeometry
int min_height;
int max_width;
int max_height;
- GdkGravity win_gravity;
};
GDK_AVAILABLE_IN_ALL
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index 8552a183ac..6da5fdb588 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -2182,12 +2182,6 @@ gdk_x11_surface_set_geometry_hints (GdkSurface *surface,
size_hints.height_inc = impl->surface_scale;
}
- if (geom_mask & GDK_HINT_WIN_GRAVITY)
- {
- size_hints.flags |= PWinGravity;
- size_hints.win_gravity = geometry->win_gravity;
- }
-
/* FIXME: Would it be better to delete this property if
* geom_mask == 0? It would save space on the server
*/
@@ -2240,12 +2234,6 @@ gdk_surface_get_geometry_hints (GdkSurface *surface,
geometry->max_height = MAX (size_hints->max_height, 1) / impl->surface_scale;
}
- if (size_hints->flags & PWinGravity)
- {
- *geom_mask |= GDK_HINT_WIN_GRAVITY;
- geometry->win_gravity = size_hints->win_gravity;
- }
-
XFree (size_hints);
}
@@ -4146,66 +4134,10 @@ static void
calculate_unmoving_origin (MoveResizeData *mv_resize)
{
GdkRectangle rect;
- int width, height;
- if (mv_resize->moveresize_geom_mask & GDK_HINT_WIN_GRAVITY &&
- mv_resize->moveresize_geometry.win_gravity == GDK_GRAVITY_STATIC)
- {
- gdk_surface_get_origin (mv_resize->moveresize_surface,
- &mv_resize->moveresize_orig_x,
- &mv_resize->moveresize_orig_y);
- }
- else
- {
- gdk_x11_surface_get_frame_extents (mv_resize->moveresize_surface, &rect);
- gdk_surface_get_geometry (mv_resize->moveresize_surface,
- NULL, NULL, &width, &height);
-
- switch (mv_resize->moveresize_geometry.win_gravity)
- {
- case GDK_GRAVITY_NORTH_WEST:
- mv_resize->moveresize_orig_x = rect.x;
- mv_resize->moveresize_orig_y = rect.y;
- break;
- case GDK_GRAVITY_NORTH:
- mv_resize->moveresize_orig_x = rect.x + rect.width / 2 - width / 2;
- mv_resize->moveresize_orig_y = rect.y;
- break;
- case GDK_GRAVITY_NORTH_EAST:
- mv_resize->moveresize_orig_x = rect.x + rect.width - width;
- mv_resize->moveresize_orig_y = rect.y;
- break;
- case GDK_GRAVITY_WEST:
- mv_resize->moveresize_orig_x = rect.x;
- mv_resize->moveresize_orig_y = rect.y + rect.height / 2 - height / 2;
- break;
- case GDK_GRAVITY_CENTER:
- mv_resize->moveresize_orig_x = rect.x + rect.width / 2 - width / 2;
- mv_resize->moveresize_orig_y = rect.y + rect.height / 2 - height / 2;
- break;
- case GDK_GRAVITY_EAST:
- mv_resize->moveresize_orig_x = rect.x + rect.width - width;
- mv_resize->moveresize_orig_y = rect.y + rect.height / 2 - height / 2;
- break;
- case GDK_GRAVITY_SOUTH_WEST:
- mv_resize->moveresize_orig_x = rect.x;
- mv_resize->moveresize_orig_y = rect.y + rect.height - height;
- break;
- case GDK_GRAVITY_SOUTH:
- mv_resize->moveresize_orig_x = rect.x + rect.width / 2 - width / 2;
- mv_resize->moveresize_orig_y = rect.y + rect.height - height;
- break;
- case GDK_GRAVITY_SOUTH_EAST:
- mv_resize->moveresize_orig_x = rect.x + rect.width - width;
- mv_resize->moveresize_orig_y = rect.y + rect.height - height;
- break;
- case GDK_GRAVITY_STATIC:
- default:
- mv_resize->moveresize_orig_x = rect.x;
- mv_resize->moveresize_orig_y = rect.y;
- break;
- }
- }
+ gdk_x11_surface_get_frame_extents (mv_resize->moveresize_surface, &rect);
+ mv_resize->moveresize_orig_x = rect.x;
+ mv_resize->moveresize_orig_y = rect.y;
}
static void
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index f52986fe03..8020abe08c 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -233,7 +233,6 @@ typedef struct
guint modal : 1;
guint resizable : 1;
guint transient_parent_group : 1;
- guint gravity : 5; /* GdkGravity */
guint csd_requested : 1;
guint client_decorated : 1; /* Decorations drawn client-side */
guint use_client_shadow : 1; /* Decorations use client-side shadows */
@@ -1492,7 +1491,6 @@ gtk_window_init (GtkWindow *window)
priv->configure_notify_received = FALSE;
priv->need_default_size = TRUE;
priv->modal = FALSE;
- priv->gravity = GDK_GRAVITY_NORTH_WEST;
priv->decorated = TRUE;
priv->display = gdk_display_get_default ();
@@ -5651,10 +5649,6 @@ gtk_window_compare_hints (GdkGeometry *geometry_a,
geometry_a->max_height != geometry_b->max_height))
return FALSE;
- if ((flags_a & GDK_HINT_WIN_GRAVITY) &&
- geometry_a->win_gravity != geometry_b->win_gravity)
- return FALSE;
-
return TRUE;
}
@@ -5749,9 +5743,6 @@ gtk_window_compute_hints (GtkWindow *window,
new_geometry->max_width = new_geometry->min_width;
new_geometry->max_height = new_geometry->min_height;
}
-
- *new_flags |= GDK_HINT_WIN_GRAVITY;
- new_geometry->win_gravity = priv->gravity;
}
#undef INCLUDE_CSD_SIZE
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]