[Xfce4-commits] [xfce/xfwm4] 03/03: Keep grip in proportion
noreply at xfce.org
noreply at xfce.org
Sun Jan 21 17:05:19 CET 2018
This is an automated email from the git hooks/post-receive script.
o l i v i e r p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfwm4.
commit 315e1bea2f10263c9d3f3d64fb8233abc69b194d
Author: Adam Purkrt <adam at purkrt.net>
Date: Sat Jan 20 07:49:27 2018 +0100
Keep grip in proportion
Bug: 14174
To keep the distance of the grip from the edges of the window
in proportion when unmaximizing/untiling while moving the window,
the grip position is recalculated using pxratio and pyratio.
---
src/moveresize.c | 29 ++++++++---------------------
1 file changed, 8 insertions(+), 21 deletions(-)
diff --git a/src/moveresize.c b/src/moveresize.c
index 3a75400..dca000d 100644
--- a/src/moveresize.c
+++ b/src/moveresize.c
@@ -85,7 +85,7 @@ struct _MoveResizeData
unsigned long configure_flags;
guint cancel_workspace;
gint mx, my;
- gint px, py; /* pointer relative position */
+ double pxratio, pyratio; /* pointer relative position ratio */
gint ox, oy;
gint ow, oh;
gint oldw, oldh;
@@ -249,8 +249,8 @@ clientSetHandle(MoveResizeData *passdata, int handle)
passdata->handle = handle;
passdata->mx = px;
passdata->my = py;
- passdata->px = passdata->mx - frameExtentX (c);
- passdata->py = passdata->my - frameExtentY (c);
+ passdata->pxratio = (passdata->mx - frameExtentX (c)) / (double) frameExtentWidth (c);
+ passdata->pyratio = (passdata->my - frameExtentY (c)) / (double) frameExtentHeight (c);
passdata->ox = c->x;
passdata->oy = c->y;
passdata->ow = c->width;
@@ -1033,11 +1033,6 @@ clientMoveEventFilter (XfwmEvent *event, gpointer data)
if (FLAG_TEST (c->flags, CLIENT_FLAG_RESTORE_SIZE_POS))
{
gboolean size_changed;
- /* to keep the distance from the edges of the window proportional. */
- double xratio, yratio;
-
- xratio = (event->motion.x_root - frameExtentX (c)) / (double) frameExtentWidth (c);
- yratio = (event->motion.y_root - frameExtentY (c)) / (double) frameExtentHeight (c);
size_changed = clientToggleMaximized (c, c->flags & CLIENT_FLAG_MAXIMIZED, FALSE);
if (clientRestoreSizePos (c))
@@ -1048,19 +1043,11 @@ clientMoveEventFilter (XfwmEvent *event, gpointer data)
{
passdata->move_resized = TRUE;
+ /* to keep the distance from the edges of the window proportional. */
passdata->ox = c->x;
- passdata->mx = frameExtentX (c) + passdata->px;
- if ((passdata->mx < frameExtentX (c)) || (passdata->mx > frameExtentX (c) + frameExtentWidth (c)))
- {
- passdata->mx = CLAMP(frameExtentX (c) + frameExtentWidth (c) * xratio, frameExtentX (c), frameExtentX (c) + frameExtentWidth (c));
- }
-
+ passdata->mx = frameExtentX (c) + passdata->pxratio * frameExtentWidth (c);
passdata->oy = c->y;
- passdata->my = frameExtentY (c) + passdata->py;
- if ((passdata->my < frameExtentY (c)) || (passdata->my > frameExtentY (c) + frameExtentHeight (c)))
- {
- passdata->my = CLAMP(frameExtentY (c) + frameExtentHeight (c) * yratio, frameExtentY (c), frameExtentY (c) + frameExtentHeight (c));
- }
+ passdata->my = frameExtentY (c) + passdata->pyratio * frameExtentHeight (c);
passdata->configure_flags = CFG_FORCE_REDRAW;
}
@@ -1201,8 +1188,8 @@ clientMove (Client * c, XfwmEventButton *event)
passdata.button = event->button;
passdata.mx = event->x_root;
passdata.my = event->y_root;
- passdata.px = passdata.mx - frameExtentX (c);
- passdata.py = passdata.my - frameExtentY (c);
+ passdata.pxratio = (passdata.mx - frameExtentX (c)) / (double) frameExtentWidth (c);
+ passdata.pyratio = (passdata.my - frameExtentY (c)) / (double) frameExtentHeight (c);
}
else
{
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list