[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 14:55:55 +0000 (UTC)
commit 4b8831762ac13315c166b74be4eae90aba012f51
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/macos/gdkmacossurface.c | 2 -
gdk/win32/gdksurface-win32.c | 78 --------------------------------------
gdk/x11/gdksurface-x11.c | 74 ++----------------------------------
gtk/gtkwindow.c | 9 -----
6 files changed, 7 insertions(+), 221 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/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c
index abf78e04bd..9a55c01c0c 100644
--- a/gdk/macos/gdkmacossurface.c
+++ b/gdk/macos/gdkmacossurface.c
@@ -638,8 +638,6 @@ _gdk_macos_surface_set_geometry_hints (GdkMacosSurface *self,
else
min_size = NSMakeSize (1, 1);
[self->window setContentMinSize:min_size];
-
- if (geom_mask & GDK_HINT_WIN_GRAVITY) { /* TODO */ }
}
void
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index 0a29c65cce..74001bf549 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -763,75 +763,6 @@ get_outer_rect (GdkSurface *window,
_gdk_win32_adjust_client_rect (window, rect);
}
-static void
-adjust_for_gravity_hints (GdkSurface *window,
- RECT *outer_rect,
- int *x,
- int *y)
-{
- GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
-
- if (impl->hint_flags & GDK_HINT_WIN_GRAVITY)
- {
-#ifdef G_ENABLE_DEBUG
- int orig_x = *x, orig_y = *y;
-#endif
-
- switch (impl->hints.win_gravity)
- {
- case GDK_GRAVITY_NORTH:
- case GDK_GRAVITY_CENTER:
- case GDK_GRAVITY_SOUTH:
- *x -= (outer_rect->right - outer_rect->left / 2) / impl->surface_scale;
- *x += window->width / 2;
- break;
-
- case GDK_GRAVITY_SOUTH_EAST:
- case GDK_GRAVITY_EAST:
- case GDK_GRAVITY_NORTH_EAST:
- *x -= (outer_rect->right - outer_rect->left) / impl->surface_scale;
- *x += window->width;
- break;
-
- case GDK_GRAVITY_STATIC:
- *x += outer_rect->left / impl->surface_scale;
- break;
-
- default:
- break;
- }
-
- switch (impl->hints.win_gravity)
- {
- case GDK_GRAVITY_WEST:
- case GDK_GRAVITY_CENTER:
- case GDK_GRAVITY_EAST:
- *y -= ((outer_rect->bottom - outer_rect->top) / 2) / impl->surface_scale;
- *y += window->height / 2;
- break;
-
- case GDK_GRAVITY_SOUTH_WEST:
- case GDK_GRAVITY_SOUTH:
- case GDK_GRAVITY_SOUTH_EAST:
- *y -= (outer_rect->bottom - outer_rect->top) / impl->surface_scale;
- *y += window->height;
- break;
-
- case GDK_GRAVITY_STATIC:
- *y += outer_rect->top * impl->surface_scale;
- break;
-
- default:
- break;
- }
- GDK_NOTE (MISC,
- (orig_x != *x || orig_y != *y) ?
- g_print ("adjust_for_gravity_hints: x: %d->%d, y: %d->%d\n",
- orig_x, *x, orig_y, *y)
- : (void) 0);
- }
-}
-
static void
gdk_win32_surface_fullscreen (GdkSurface *window);
@@ -1125,8 +1056,6 @@ gdk_win32_surface_do_move (GdkSurface *window,
impl = GDK_WIN32_SURFACE (window);
get_outer_rect (window, window->width, window->height, &outer_rect);
- adjust_for_gravity_hints (window, &outer_rect, &x, &y);
-
GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,0,0,"
"NOACTIVATE|NOSIZE|NOZORDER)\n",
GDK_SURFACE_HWND (window),
@@ -1211,8 +1140,6 @@ gdk_win32_surface_do_move_resize (GdkSurface *window,
get_outer_rect (window, width, height, &outer_rect);
- adjust_for_gravity_hints (window, &outer_rect, &x, &y);
-
GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,%ld,%ld,"
"NOACTIVATE|NOZORDER)\n",
GDK_SURFACE_HWND (window),
@@ -1509,11 +1436,6 @@ gdk_win32_surface_set_geometry_hints (GdkSurface *window,
geometry->max_width, geometry->max_height));
}
- if (geom_mask & GDK_HINT_WIN_GRAVITY)
- {
- GDK_NOTE (MISC, g_print ("... GRAVITY: %d\n", geometry->win_gravity));
- }
-
_gdk_win32_surface_update_style_bits (window);
}
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]