[xfwm4] Another patch to fix resizing (#670173)
Christoph Wickert
cwickert at fedoraproject.org
Sat Oct 15 14:07:52 UTC 2011
commit bf4946407bbdc1f411685550224b564401be7688
Author: Christoph Wickert <cwickert at fedoraproject.org>
Date: Sat Oct 15 16:07:46 2011 +0200
Another patch to fix resizing (#670173)
...4-4.8.1-do_not_enforce_the_size_increment.patch | 340 ++++++++++++++++++++
xfwm4.spec | 11 +-
2 files changed, 349 insertions(+), 2 deletions(-)
---
diff --git a/xfwm4-4.8.1-do_not_enforce_the_size_increment.patch b/xfwm4-4.8.1-do_not_enforce_the_size_increment.patch
new file mode 100644
index 0000000..bab9f2b
--- /dev/null
+++ b/xfwm4-4.8.1-do_not_enforce_the_size_increment.patch
@@ -0,0 +1,340 @@
+From e77b4762e1484fe36f37347bc3d691f30ea791b3 Mon Sep 17 00:00:00 2001
+From: Olivier Fourdan <fourdan at xfce.org>
+Date: Fri, 07 Oct 2011 13:19:41 +0000
+Subject: Do not enforce the size increment only if the size request comes
+
+from the application itself (refix bug #7445)
+---
+diff --git a/src/client.c b/src/client.c
+index 7ab1664..e8d92e0 100644
+--- a/src/client.c
++++ b/src/client.c
+@@ -666,11 +666,11 @@ clientConfigure (Client * c, XWindowChanges * wc, unsigned long mask, unsigned s
+ }
+ if (mask & CWWidth)
+ {
+- c->width = wc->width;
++ clientSetWidth (c, wc->width, flags & CFG_REQUEST);
+ }
+ if (mask & CWHeight)
+ {
+- c->height = wc->height;
++ clientSetHeight (c, wc->height, flags & CFG_REQUEST);
+ }
+ if (mask & CWBorderWidth)
+ {
+@@ -1834,6 +1834,7 @@ clientFrame (DisplayInfo *display_info, Window w, gboolean recapture)
+ (c->win_layer == WIN_LAYER_NORMAL) &&
+ (c->type == WINDOW_NORMAL))
+ {
++ g_print ("Full screen for old apps\n");
+ FLAG_SET (c->xfwm_flags, XFWM_FLAG_LEGACY_FULLSCREEN);
+ }
+
+diff --git a/src/moveresize.c b/src/moveresize.c
+index 8b58544..a59bc1e 100644
+--- a/src/moveresize.c
++++ b/src/moveresize.c
+@@ -77,48 +77,48 @@ struct _MoveResizeData
+ };
+
+ static void
+-clientComputeWidth (Client * c, int *w)
++clientSetSize (Client * c, int *size, int size_min, int size_max, int size_inc, gboolean source_is_application)
+ {
+- int w2;
++ int temp;
+
+ g_return_if_fail (c != NULL);
+- g_return_if_fail (w != NULL);
+- TRACE ("entering clientComputeWidth");
++ g_return_if_fail (size != NULL);
++ TRACE ("entering clientSetSize");
+
+ /* Bypass resize increment and max sizes for fullscreen */
+ if (!FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)
+ && !(FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
+ && (c->screen_info->params->borderless_maximize)))
+ {
+- if ((c->size->flags & PResizeInc) && (c->size->width_inc))
++ if (!source_is_application && (c->size->flags & PResizeInc) && (size_inc))
+ {
+- w2 = (*w - c->size->min_width) / c->size->width_inc;
+- *w = c->size->min_width + (w2 * c->size->width_inc);
++ temp = (*size - size_min) / size_inc;
++ *size = size_min + (temp * size_inc);
+ }
+ if (c->size->flags & PMaxSize)
+ {
+- if (*w > c->size->max_width)
++ if (*size > size_max)
+ {
+- *w = c->size->max_width;
++ *size = size_max;
+ }
+ }
+ }
+
+ if (c->size->flags & PMinSize)
+ {
+- if (*w < c->size->min_width)
++ if (*size < size_min)
+ {
+- *w = c->size->min_width;
++ *size = size_min;
+ }
+ }
+- if (*w < 1)
++ if (*size < 1)
+ {
+- *w = 1;
++ *size = 1;
+ }
+ }
+
+ void
+-clientSetWidth (Client * c, int w)
++clientSetWidth (Client * c, int w, gboolean source_is_application)
+ {
+ int temp;
+
+@@ -127,52 +127,12 @@ clientSetWidth (Client * c, int w)
+ TRACE ("setting width %i for client \"%s\" (0x%lx)", w, c->name, c->window);
+
+ temp = w;
+- clientComputeWidth (c, &temp);
++ clientSetSize (c, &temp, c->size->min_width, c->size->max_width, c->size->width_inc, source_is_application);
+ c->width = temp;
+ }
+
+-static void
+-clientComputeHeight (Client * c, int *h)
+-{
+- int h2;
+-
+- g_return_if_fail (c != NULL);
+- TRACE ("entering clientComputeHeight");
+-
+- /* Bypass resize increment and max sizes for fullscreen */
+- if (!FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)
+- && !(FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
+- && (c->screen_info->params->borderless_maximize)))
+- {
+- if ((c->size->flags & PResizeInc) && (c->size->height_inc))
+- {
+- h2 = (*h - c->size->min_height) / c->size->height_inc;
+- *h = c->size->min_height + (h2 * c->size->height_inc);
+- }
+- if (c->size->flags & PMaxSize)
+- {
+- if (*h > c->size->max_height)
+- {
+- *h = c->size->max_height;
+- }
+- }
+- }
+-
+- if (c->size->flags & PMinSize)
+- {
+- if (*h < c->size->min_height)
+- {
+- *h = c->size->min_height;
+- }
+- }
+- if (*h < 1)
+- {
+- *h = 1;
+- }
+-}
+-
+ void
+-clientSetHeight (Client * c, int h)
++clientSetHeight (Client * c, int h, gboolean source_is_application)
+ {
+ int temp;
+
+@@ -181,7 +141,7 @@ clientSetHeight (Client * c, int h)
+ TRACE ("setting height %i for client \"%s\" (0x%lx)", h, c->name, c->window);
+
+ temp = h;
+- clientComputeHeight (c, &temp);
++ clientSetSize (c, &temp, c->size->min_height, c->size->max_height, c->size->height_inc, source_is_application);
+ c->height = temp;
+ }
+
+@@ -273,7 +233,7 @@ clientSetHandle(MoveResizeData *passdata, int handle)
+
+ #define MAKE_MULT(a,b) ((b==1) ? (a) : (((int)((a)/(b))) * (b)) )
+ static void
+-clientConstrainRatio (Client * c, int *w, int *h, int handle)
++clientConstrainRatio (Client * c, int handle)
+ {
+
+ g_return_if_fail (c != NULL);
+@@ -291,59 +251,59 @@ clientConstrainRatio (Client * c, int *w, int *h, int handle)
+ maxx = c->size->max_aspect.x;
+ maxy = c->size->max_aspect.y;
+
+- if ((minx * *h > miny * *w) && (miny) &&
++ if ((minx * c->height > miny * c->width) && (miny) &&
+ ((handle == CORNER_COUNT + SIDE_TOP) || (handle == CORNER_COUNT + SIDE_BOTTOM)))
+ {
+ /* Change width to match */
+- delta = MAKE_MULT (minx * *h / miny - *w, xinc);
++ delta = MAKE_MULT (minx * c->height / miny - c->width, xinc);
+ if (!(c->size->flags & PMaxSize) ||
+- (*w + delta <= c->size->max_width))
++ (c->width + delta <= c->size->max_width))
+ {
+- *w += delta;
++ c->width += delta;
+ }
+ }
+- if ((minx * *h > miny * *w) && (minx))
++ if ((minx * c->height > miny * c->width) && (minx))
+ {
+- delta = MAKE_MULT (*h - *w * miny / minx, yinc);
++ delta = MAKE_MULT (c->height - c->width * miny / minx, yinc);
+ if (!(c->size->flags & PMinSize) ||
+- (*h - delta >= c->size->min_height))
++ (c->height - delta >= c->size->min_height))
+ {
+- *h -= delta;
++ c->height -= delta;
+ }
+ else
+ {
+- delta = MAKE_MULT (minx * *h / miny - *w, xinc);
++ delta = MAKE_MULT (minx * c->height / miny - c->width, xinc);
+ if (!(c->size->flags & PMaxSize) ||
+- (*w + delta <= c->size->max_width))
+- *w += delta;
++ (c->width + delta <= c->size->max_width))
++ c->width += delta;
+ }
+ }
+
+- if ((maxx * *h < maxy * *w) && (maxx) &&
++ if ((maxx * c->height < maxy * c->width) && (maxx) &&
+ ((handle == CORNER_COUNT + SIDE_LEFT) || (handle == CORNER_COUNT + SIDE_RIGHT)))
+ {
+- delta = MAKE_MULT (*w * maxy / maxx - *h, yinc);
++ delta = MAKE_MULT (c->width * maxy / maxx - c->height, yinc);
+ if (!(c->size->flags & PMaxSize) ||
+- (*h + delta <= c->size->max_height))
++ (c->height + delta <= c->size->max_height))
+ {
+- *h += delta;
++ c->height += delta;
+ }
+ }
+- if ((maxx * *h < maxy * *w) && (maxy))
++ if ((maxx * c->height < maxy * c->width) && (maxy))
+ {
+- delta = MAKE_MULT (*w - maxx * *h / maxy, xinc);
++ delta = MAKE_MULT (c->width - maxx * c->height / maxy, xinc);
+ if (!(c->size->flags & PMinSize) ||
+- (*w - delta >= c->size->min_width))
++ (c->width - delta >= c->size->min_width))
+ {
+- *w -= delta;
++ c->width -= delta;
+ }
+ else
+ {
+- delta = MAKE_MULT (*w * maxy / maxx - *h, yinc);
++ delta = MAKE_MULT (c->width * maxy / maxx - c->height, yinc);
+ if (!(c->size->flags & PMaxSize) ||
+- (*h + delta <= c->size->max_height))
++ (c->height + delta <= c->size->max_height))
+ {
+- *h += delta;
++ c->height += delta;
+ }
+ }
+ }
+@@ -1421,9 +1381,9 @@ clientResizeEventFilter (XEvent * xevent, gpointer data)
+ c->height = clientFindClosestEdgeY (c, c->y + c->height + frameBottom (c)) - c->y - frameBottom (c);
+ }
+ }
+- clientConstrainRatio (c, &c->width, &c->height, passdata->handle);
++ clientConstrainRatio (c, passdata->handle);
+
+- clientSetWidth (c, c->width);
++ clientSetWidth (c, c->width, FALSE);
+ if (move_left)
+ {
+ c->x = c->x - (c->width - passdata->oldw);
+@@ -1436,7 +1396,7 @@ clientResizeEventFilter (XEvent * xevent, gpointer data)
+ frame_x = frameX (c);
+ }
+
+- clientSetHeight (c, c->height);
++ clientSetHeight (c, c->height, FALSE);
+ if (!FLAG_TEST (c->flags, CLIENT_FLAG_SHADED) && move_top)
+ {
+ c->y = c->y - (c->height - passdata->oldh);
+@@ -1457,14 +1417,14 @@ clientResizeEventFilter (XEvent * xevent, gpointer data)
+ temp = c->y + c->height;
+ c->y = CLAMP (c->y, screen_info->margins [STRUTS_TOP] + frame_top,
+ MAX (disp_max_y - min_visible, screen_info->height - screen_info->margins [STRUTS_BOTTOM] - min_visible));
+- clientSetHeight (c, temp - c->y);
++ clientSetHeight (c, temp - c->y, FALSE);
+ c->y = temp - c->height;
+ }
+ else if (frame_y < 0)
+ {
+ temp = c->y + c->height;
+ c->y = frame_top;
+- clientSetHeight (c, temp - c->y);
++ clientSetHeight (c, temp - c->y, FALSE);
+ c->y = temp - c->height;
+ }
+ }
+@@ -1473,7 +1433,7 @@ clientResizeEventFilter (XEvent * xevent, gpointer data)
+ if (c->y + c->height < MAX (disp_y + min_visible, screen_info->margins [STRUTS_TOP] + min_visible))
+ {
+ temp = MAX (disp_y + min_visible, screen_info->margins [STRUTS_TOP] + min_visible);
+- clientSetHeight (c, temp - c->y);
++ clientSetHeight (c, temp - c->y, FALSE);
+ }
+ }
+ if (move_left)
+@@ -1482,7 +1442,7 @@ clientResizeEventFilter (XEvent * xevent, gpointer data)
+ {
+ temp = c->x + c->width;
+ c->x = MIN (disp_max_x - min_visible, screen_info->width - screen_info->margins [STRUTS_RIGHT] - min_visible);
+- clientSetWidth (c, temp - c->x);
++ clientSetWidth (c, temp - c->x, FALSE);
+ c->x = temp - c->width;
+ }
+ }
+@@ -1491,7 +1451,7 @@ clientResizeEventFilter (XEvent * xevent, gpointer data)
+ if (c->x + c->width < MAX (disp_x + min_visible, screen_info->margins [STRUTS_LEFT] + min_visible))
+ {
+ temp = MAX (disp_x + min_visible, screen_info->margins [STRUTS_LEFT] + min_visible);
+- clientSetWidth (c, temp - c->x);
++ clientSetWidth (c, temp - c->x, FALSE);
+ }
+ }
+
+diff --git a/src/moveresize.h b/src/moveresize.h
+index cd5c770..f6ffc9b 100644
+--- a/src/moveresize.h
++++ b/src/moveresize.h
+@@ -34,9 +34,11 @@
+ #ifndef INC_MOVERESIZE_H
+ #define INC_MOVERESIZE_H
+ void clientSetWidth (Client *,
+- int);
++ int,
++ gboolean);
+ void clientSetHeight (Client *,
+- int);
++ int,
++ gboolean);
+ void clientMove (Client *,
+ XEvent *);
+ void clientResize (Client *,
+--
+cgit
diff --git a/xfwm4.spec b/xfwm4.spec
index c23f8a3..085de48 100644
--- a/xfwm4.spec
+++ b/xfwm4.spec
@@ -2,7 +2,7 @@
Name: xfwm4
Version: 4.8.1
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: Next generation window manager for Xfce
Group: User Interface/Desktops
@@ -15,6 +15,9 @@ Patch0: xfwm4-4.6.1-nodoka.patch
# and https://bugzilla.xfce.org/show_bug.cgi?id=7445
# taken from http://git.xfce.org/xfce/xfwm4/commit/?id=bf911e27
Patch1: xfwm4-4.8.1-relax_resize_wrt_to_size_increments.patch
+# yet another fix for the same problem
+# taken from http://git.xfce.org/xfce/xfwm4/commit/?id=e77b4762
+Patch2: xfwm4-4.8.1-do_not_enforce_the_size_increment.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libxfce4ui-devel >= %{xfceversion}
@@ -37,7 +40,8 @@ xfwm4 is a window manager compatible with GNOME, GNOME2, KDE2, KDE3 and Xfce.
%prep
%setup -q
%patch0 -p1 -b .nodoka
-%patch1 -p1 -b .resize
+%patch1 -p1 -b .relax_resize
+%patch2 -p1 -b .size_increments
%build
@@ -93,6 +97,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%changelog
+* Sat Oct 15 2011 Christoph Wickert <cwickert at fedoraproject.org> - 4.8.3-4
+- Another patch to fix resizing (#670173)
+
* Mon Sep 19 2011 Christoph Wickert <cwickert at fedoraproject.org> - 4.8.1-3
- Be less strict on size changes (#670173)
More information about the scm-commits
mailing list