This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project wmaker-crm.git.
The branch, next has been updated
via 81eefca4ef70414d73048300058e5007f402dd7f (commit)
from 8edb9dad810420e638d2c774957d1fd23ec7257e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/wmaker-crm.git/commit/81eefca4ef70414d73048300058e5007f402dd7f
commit 81eefca4ef70414d73048300058e5007f402dd7f
Author: Iain Patterson <[email protected]>
Date: Tue Jun 26 16:20:43 2012 +0100
More (un)maximize tweaks.
Update the saved X co-ordinate of a window which was moved when
maximized (only) vertically so that unmaximizing the window restores
its dimensions without warping it back to its previous X position.
Similarly update the saved Y co-ordinate of a window which was
moved when maximized (only) horizontally.
Handle Maximus as a special case. We remember the Maximusized X and Y
co-ordinates then adjust the restored co-ordinates relative to the
delta between the window's position just after Maximusizing and its
position just before restoring. So for example if a window is
Maximusized, moved 100 pixels to the left and restored, it will end
up 100 pixels left of its original geometry.
Also fix "jumping window" bug reported by Christian Wittmer:
This "jumping window" happens only when you
1) open new xterm (STRG +n)
2) current position is (+64, +0)
3) maximize window vertically
4) undo maximizing
5) move window to the right or left (up or down as you like)
I moved right to (+450, +0)
6) maximize vertically again
7) and undo maximizing
8) window jumps back to (+64, ..) position
If you move a new opened window to a new position (e.g. +200, +200)
and then start with "3)". window is jumping back "+200, +200"
diff --git a/src/actions.c b/src/actions.c
index 881448f..988e90a 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -287,14 +287,20 @@ void wUnshadeWindow(WWindow *wwin)
/* Set the old coordinates using the current values */
static void save_old_geometry(WWindow *wwin, int directions)
{
- if (directions & MAX_HORIZONTAL || ! wwin->old_geometry.width) {
- wwin->old_geometry.width = wwin->client.width;
+ /* never been saved? */
+ if (! wwin->old_geometry.width)
+ directions |= SAVE_GEOMETRY_X | SAVE_GEOMETRY_WIDTH;
+ if (! wwin->old_geometry.height)
+ directions |= SAVE_GEOMETRY_Y | SAVE_GEOMETRY_HEIGHT;
+
+ if (directions & SAVE_GEOMETRY_X)
wwin->old_geometry.x = wwin->frame_x;
- }
- if (directions & MAX_VERTICAL || ! wwin->old_geometry.height) {
- wwin->old_geometry.height = wwin->client.height;
+ if (directions & SAVE_GEOMETRY_Y)
wwin->old_geometry.y = wwin->frame_y;
- }
+ if (directions & SAVE_GEOMETRY_WIDTH)
+ wwin->old_geometry.width = wwin->client.width;
+ if (directions & SAVE_GEOMETRY_HEIGHT)
+ wwin->old_geometry.height = wwin->client.height;
}
static void remember_geometry(WWindow *wwin, int *x, int *y, int *w, int *h)
@@ -312,6 +318,27 @@ static void remember_geometry(WWindow *wwin, int *x, int
*y, int *w, int *h)
*h = wwin->old_geometry.height ? wwin->old_geometry.height :
wwin->client.height;
}
+/* Remember geometry for unmaximizing */
+void update_saved_geometry(WWindow *wwin)
+{
+ /* NOT if we aren't already maximized
+ * we'll save geometry when maximizing */
+ if (!wwin->flags.maximized)
+ return;
+
+ /* NOT if we are fully maximized */
+ if ((wwin->flags.maximized & MAX_MAXIMUS) ||
+ ((wwin->flags.maximized & MAX_HORIZONTAL) &&
+ (wwin->flags.maximized & MAX_VERTICAL)))
+ return;
+
+ /* save the co-ordinate in the axis in which we AREN'T maximized */
+ if (wwin->flags.maximized & MAX_HORIZONTAL)
+ save_old_geometry(wwin, SAVE_GEOMETRY_Y);
+ if (wwin->flags.maximized & MAX_VERTICAL)
+ save_old_geometry(wwin, SAVE_GEOMETRY_X);
+}
+
#define IS_MAX_HORIZONTALLY(directions) ((directions & MAX_HORIZONTAL) |
(directions & MAX_LEFTHALF) | (directions & MAX_RIGHTHALF))
void wMaximizeWindow(WWindow *wwin, int directions)
{
@@ -336,17 +363,20 @@ void wMaximizeWindow(WWindow *wwin, int directions)
adj_size = FRAME_BORDER_WIDTH * 2 * has_border;
/* save old coordinates before we change the current values
+ * always if the window is not currently maximized at all
* but never if the window has been Maximusized */
- if (!(wwin->flags.old_maximized & MAX_MAXIMUS)) {
+ if (!wwin->flags.maximized)
+ save_directions |= SAVE_GEOMETRY_ALL;
+ else if (!(wwin->flags.old_maximized & MAX_MAXIMUS)) {
if ((directions & MAX_VERTICAL) &&
!(wwin->flags.maximized & MAX_VERTICAL))
- save_directions |= MAX_VERTICAL;
+ save_directions |= SAVE_GEOMETRY_Y |
SAVE_GEOMETRY_HEIGHT;
if (IS_MAX_HORIZONTALLY(directions) &&
!IS_MAX_HORIZONTALLY(wwin->flags.maximized))
- save_directions |= MAX_HORIZONTAL;
+ save_directions |= SAVE_GEOMETRY_X |
SAVE_GEOMETRY_WIDTH;
}
if ((directions & MAX_MAXIMUS) && !wwin->flags.maximized)
- save_directions |= MAX_VERTICAL | MAX_HORIZONTAL;
+ save_directions |= SAVE_GEOMETRY_ALL;
save_old_geometry(wwin, save_directions);
totalArea.x1 = 0;
@@ -445,6 +475,8 @@ void wMaximizeWindow(WWindow *wwin, int directions)
new_y -= wwin->frame->top_width;
new_height += wwin->frame->top_width - 1;
}
+ wwin->maximus_x = new_x;
+ wwin->maximus_y = new_y;
wwin->flags.old_maximized |= MAX_MAXIMUS;
}
@@ -673,9 +705,16 @@ void wUnmaximizeWindow(WWindow *wwin)
wwin->flags.skip_next_animation = 1;
wUnshadeWindow(wwin);
}
+
/* Use old coordinates if they are set, current values otherwise */
remember_geometry(wwin, &x, &y, &w, &h);
+ /* unMaximusize relative to original position */
+ if (wwin->flags.maximized & MAX_MAXIMUS) {
+ x += wwin->frame_x - wwin->maximus_x;
+ y += wwin->frame_y - wwin->maximus_y;
+ }
+
wwin->flags.maximized = 0;
wwin->flags.old_maximized = 0;
wWindowConfigure(wwin, x, y, w, h);
diff --git a/src/actions.h b/src/actions.h
index 719df2e..55de740 100644
--- a/src/actions.h
+++ b/src/actions.h
@@ -31,6 +31,12 @@
#define MAX_IGNORE_XINERAMA (1 << 5)
#define MAX_KEYBOARD (1 << 6)
+#define SAVE_GEOMETRY_X (1 << 0)
+#define SAVE_GEOMETRY_Y (1 << 1)
+#define SAVE_GEOMETRY_WIDTH (1 << 2)
+#define SAVE_GEOMETRY_HEIGHT (1 << 3)
+#define SAVE_GEOMETRY_ALL SAVE_GEOMETRY_X | SAVE_GEOMETRY_Y |
SAVE_GEOMETRY_WIDTH | SAVE_GEOMETRY_HEIGHT
+
void wSetFocusTo(WScreen *scr, WWindow *wwin);
int wMouseMoveWindow(WWindow *wwin, XEvent *ev);
@@ -71,6 +77,7 @@ void wFullscreenWindow(WWindow *wwin);
void wUnfullscreenWindow(WWindow *wwin);
void animateResize(WScreen *scr, int x, int y, int w, int h, int fx, int fy,
int fw, int fh);
+void update_saved_geometry(WWindow *wwin);
#endif
diff --git a/src/moveres.c b/src/moveres.c
index 3d3ff7e..59dd0d2 100644
--- a/src/moveres.c
+++ b/src/moveres.c
@@ -1535,6 +1535,8 @@ int wKeyboardMoveResizeWindow(WWindow * wwin)
wArrangeIcons(scr, True);
}
+ update_saved_geometry(wwin);
+
return 1;
}
}
@@ -1796,6 +1798,10 @@ int wMouseMoveWindow(WWindow * wwin, XEvent * ev)
head != wGetHeadForWindow(wwin)) {
wArrangeIcons(scr, True);
}
+
+ if (started)
+ update_saved_geometry(wwin);
+
return started;
}
diff --git a/src/window.h b/src/window.h
index 99e1c24..cdb5bc7 100644
--- a/src/window.h
+++ b/src/window.h
@@ -199,6 +199,9 @@ typedef struct WWindow {
unsigned int width, height; /* original geometry of the window */
} bfs_geometry; /* (before fullscreen) */
+ int maximus_x; /* size after Maximusizing */
+ int maximus_y;
+
/* client window info */
short old_border_width; /* original border width of client_win*/
Window client_win; /* the window we're managing */
-----------------------------------------------------------------------
Summary of changes:
src/actions.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++---------
src/actions.h | 7 ++++++
src/moveres.c | 6 +++++
src/window.h | 3 ++
4 files changed, 65 insertions(+), 10 deletions(-)
repo.or.cz automatic notification. Contact project admin [email protected]
if you want to unsubscribe, or site admin [email protected] if you receive
no reply.
--
wmaker-crm.git ("The Window Maker window manager")
--
To unsubscribe, send mail to [email protected].