[gtk/wip/otte/geometry: 3/4] Remove aspect ratio from GdkGeometry
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/geometry: 3/4] Remove aspect ratio from GdkGeometry
- Date: Thu, 30 Jul 2020 13:46:29 +0000 (UTC)
commit 9a8082f1a67b69d5ad8239ce8d702fbe7eec6c3d
Author: Benjamin Otte <otte redhat com>
Date: Thu Jul 30 04:50:46 2020 +0200
Remove aspect ratio from GdkGeometry
It's unused.
gdk/gdkinternals.h | 3 ---
gdk/gdksurface.c | 40 ----------------------------------------
gdk/x11/gdksurface-x11.c | 33 ---------------------------------
gtk/gtkwindow.c | 5 -----
4 files changed, 81 deletions(-)
---
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index e241403e5d..3489455aef 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_ASPECT = 1 << 4,
GDK_HINT_WIN_GRAVITY = 1 << 6,
} GdkSurfaceHints;
@@ -329,8 +328,6 @@ struct _GdkGeometry
int min_height;
int max_width;
int max_height;
- double min_aspect;
- double max_aspect;
GdkGravity win_gravity;
};
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 82761c3af2..99271c6427 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -1608,46 +1608,6 @@ gdk_surface_constrain_size (GdkGeometry *geometry,
width = CLAMP (width, min_width, max_width);
height = CLAMP (height, min_height, max_height);
- /* constrain aspect ratio, according to:
- *
- * width
- * min_aspect <= -------- <= max_aspect
- * height
- */
-
- if (flags & GDK_HINT_ASPECT &&
- geometry->min_aspect > 0 &&
- geometry->max_aspect > 0)
- {
- int delta;
-
- if (geometry->min_aspect * height > width)
- {
- delta = height - width / geometry->min_aspect;
- if (height - delta >= min_height)
- height -= delta;
- else
- {
- delta = height * geometry->min_aspect - width;
- if (width + delta <= max_width)
- width += delta;
- }
- }
-
- if (geometry->max_aspect * height < width)
- {
- delta = width - height * geometry->max_aspect;
- if (width - delta >= min_width)
- width -= delta;
- else
- {
- delta = width / geometry->max_aspect - height;
- if (height + delta <= max_height)
- height += delta;
- }
- }
- }
-
*new_width = width;
*new_height = height;
}
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index f316872d57..8552a183ac 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -2182,31 +2182,6 @@ gdk_x11_surface_set_geometry_hints (GdkSurface *surface,
size_hints.height_inc = impl->surface_scale;
}
- if (geom_mask & GDK_HINT_ASPECT)
- {
- size_hints.flags |= PAspect;
- if (geometry->min_aspect <= 1)
- {
- size_hints.min_aspect.x = 65536 * geometry->min_aspect;
- size_hints.min_aspect.y = 65536;
- }
- else
- {
- size_hints.min_aspect.x = 65536;
- size_hints.min_aspect.y = 65536 / geometry->min_aspect;;
- }
- if (geometry->max_aspect <= 1)
- {
- size_hints.max_aspect.x = 65536 * geometry->max_aspect;
- size_hints.max_aspect.y = 65536;
- }
- else
- {
- size_hints.max_aspect.x = 65536;
- size_hints.max_aspect.y = 65536 / geometry->max_aspect;;
- }
- }
-
if (geom_mask & GDK_HINT_WIN_GRAVITY)
{
size_hints.flags |= PWinGravity;
@@ -2265,14 +2240,6 @@ gdk_surface_get_geometry_hints (GdkSurface *surface,
geometry->max_height = MAX (size_hints->max_height, 1) / impl->surface_scale;
}
- if (size_hints->flags & PAspect)
- {
- *geom_mask |= GDK_HINT_ASPECT;
-
- geometry->min_aspect = (double) size_hints->min_aspect.x / (double) size_hints->min_aspect.y;
- geometry->max_aspect = (double) size_hints->max_aspect.x / (double) size_hints->max_aspect.y;
- }
-
if (size_hints->flags & PWinGravity)
{
*geom_mask |= GDK_HINT_WIN_GRAVITY;
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 5df8e9abd1..f52986fe03 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5651,11 +5651,6 @@ gtk_window_compare_hints (GdkGeometry *geometry_a,
geometry_a->max_height != geometry_b->max_height))
return FALSE;
- if ((flags_a & GDK_HINT_ASPECT) &&
- (geometry_a->min_aspect != geometry_b->min_aspect ||
- geometry_a->max_aspect != geometry_b->max_aspect))
- return FALSE;
-
if ((flags_a & GDK_HINT_WIN_GRAVITY) &&
geometry_a->win_gravity != geometry_b->win_gravity)
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]