summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMassimo Mund <massimo.mund@stud.uni-duisburg-essen.de>2008-11-24 16:23:43 +0100
committerMassimo Mund <massimo.mund@stud.uni-duisburg-essen.de>2008-11-24 16:23:43 +0100
commit696c9bef0a3351b0e2aa72cc4341d4169dfbe529 (patch)
treeddb55b49c5fe2e27f7457712ce4f6d8cf45116b7
parentcbc910a5affa1bdfdb5e8066c5cfacd230f3a143 (diff)
downloadsmartput-696c9bef0a3351b0e2aa72cc4341d4169dfbe529.tar.gz
smartput-696c9bef0a3351b0e2aa72cc4341d4169dfbe529.tar.bz2
Added use triggerkey also for undo, small bugfixes
-rw-r--r--smartput.c107
-rw-r--r--smartput.xml.in15
2 files changed, 74 insertions, 48 deletions
diff --git a/smartput.c b/smartput.c
index 9d744c3..40d0e84 100644
--- a/smartput.c
+++ b/smartput.c
@@ -53,8 +53,10 @@
typedef struct _SmartputUndoInfo {
Window window;
- int x, y;
- int width, height;
+ int savedX, savedY;
+ int savedWidth, savedHeight;
+ int newX, newY;
+ int newWidth, newHeight;
unsigned int state;
} SmartputUndoInfo;
@@ -340,8 +342,8 @@ smartputBoxFromWindow (CompWindow *w)
windowBox.x1 = w->serverX;
windowBox.y1 = w->serverY;
- windowBox.x2 = w->serverWidth;
- windowBox.y2 = w->serverHeight;
+ windowBox.x2 = w->serverX + w->serverWidth;
+ windowBox.y2 = w->serverY + w->serverHeight;
return windowBox;
}
@@ -603,26 +605,35 @@ smartputSameViewport(CompWindow* w1,
static void
smartputUpdateUndoInfo (CompScreen *s,
CompWindow *w,
+ XWindowChanges *xwc,
Bool reset)
{
SMARTPUT_SCREEN (s);
if(reset)
{
- sps->undoInfo.window = None;
- sps->undoInfo.x = 0;
- sps->undoInfo.y = 0;
- sps->undoInfo.height = 0;
- sps->undoInfo.width = 0;
- sps->undoInfo.state = 0;
+ sps->undoInfo.window = None;
+ sps->undoInfo.savedX = 0;
+ sps->undoInfo.savedY = 0;
+ sps->undoInfo.savedHeight = 0;
+ sps->undoInfo.savedWidth = 0;
+ sps->undoInfo.newX = 0;
+ sps->undoInfo.newY = 0;
+ sps->undoInfo.newHeight = 0;
+ sps->undoInfo.newWidth = 0;
+ sps->undoInfo.state = 0;
}
else
{
- sps->undoInfo.window = w->id;
- sps->undoInfo.x = w->serverX;
- sps->undoInfo.y = w->serverY;
- sps->undoInfo.width = w->serverWidth;
- sps->undoInfo.height = w->serverHeight;
- sps->undoInfo.state = w->state;
+ sps->undoInfo.window = w->id;
+ sps->undoInfo.savedX = w->serverX;
+ sps->undoInfo.savedY = w->serverY;
+ sps->undoInfo.savedWidth = w->serverWidth;
+ sps->undoInfo.savedHeight = w->serverHeight;
+ sps->undoInfo.newX = xwc->x;
+ sps->undoInfo.newY = xwc->y;
+ sps->undoInfo.newHeight = xwc->height;
+ sps->undoInfo.newWidth = xwc->width;
+ sps->undoInfo.state = w->state;
}
}
@@ -639,10 +650,10 @@ smartputUndoResize (CompScreen *s,
SMARTPUT_SCREEN (s);
mask |= CWWidth | CWHeight | CWX | CWY;
- xwc->x = sps->undoInfo.x;
- xwc->y = sps->undoInfo.y;
- xwc->width = sps->undoInfo.width;
- xwc->height = sps->undoInfo.height;
+ xwc->x = sps->undoInfo.savedX;
+ xwc->y = sps->undoInfo.savedY;
+ xwc->width = sps->undoInfo.savedWidth;
+ xwc->height = sps->undoInfo.savedHeight;
return mask;
}
@@ -687,37 +698,47 @@ smartputInitiate(CompWindow *w,
if(!(w->id == sps->undoInfo.window) || sps->undoInfo.window == None) return FALSE;
mask = smartputUndoResize (s,xwc);
}
+ else if(w->id == sps->undoInfo.window && !(sps->undoInfo.window == None) &&
+ sps->undoInfo.newX == w->serverX &&
+ sps->undoInfo.newY == w->serverY &&
+ sps->undoInfo.newWidth == w->serverWidth &&
+ sps->undoInfo.newHeight == w->serverHeight &&
+ smartputGetUseTriggerkeyForundo(d))
+ {
+ mask = smartputUndoResize (s,xwc);
+ }
else
{
mask = smartputComputeResize (w, xwc);
}
- if (mask)
- {
- if (constrainNewWindowSize (w, xwc->width, xwc->height,
- &width, &height))
+ if (mask)
{
- mask |= CWWidth | CWHeight;
- xwc->width = width;
- xwc->height = height;
+ if (constrainNewWindowSize (w, xwc->width, xwc->height,
+ &width, &height))
+ {
+ mask |= CWWidth | CWHeight;
+ xwc->width = width;
+ xwc->height = height;
+ }
+ spw->lastX = w->serverX;
+ spw->lastY = w->serverY;
+
+ spw->targetX = xwc->x;
+ spw->targetY = xwc->y;
+ spw->xwc = xwc;
+ spw->mask = mask;
+ sps->lastWindow = w->id;
+
+ smartputUpdateUndoInfo (s, w, xwc, undo);
+
+ spw->animation = TRUE;
+ sps->animation = TRUE;
+
+ addWindowDamage (w);
}
- spw->lastX = w->serverX;
- spw->lastX = w->serverY;
-
- spw->targetX = xwc->x;
- spw->targetY = xwc->y;
- spw->xwc = xwc;
- spw->mask = mask;
- sps->lastWindow = w->id;
-
- smartputUpdateUndoInfo (s, w, undo);
-
- spw->animation = TRUE;
- sps->animation = TRUE;
-
- addWindowDamage (w);
- }
}
+
return TRUE;
}
diff --git a/smartput.xml.in b/smartput.xml.in
index abcbabe..65c36aa 100644
--- a/smartput.xml.in
+++ b/smartput.xml.in
@@ -12,11 +12,6 @@
<_long>Smart Put!!!</_long>
<default>&lt;Super&gt;&lt;Shift&gt;KP_Multiply</default>
</option>
- <option name="undo_key" type="key">
- <_short>Undo Smart Put on last "smartputed" window</_short>
- <_long>Undo!!!</_long>
- <default>&lt;Super&gt;&lt;Control&gt;KP_Multiply</default>
- </option>
<option name="trigger_all_key" type="key">
<_short>Apply Smart Put on current viewport</_short>
<_long>Smart Put!!!</_long>
@@ -32,6 +27,16 @@
<_long>Smart Put!!!</_long>
<default>Button9</default>
</option>
+ <option name="undo_key" type="key">
+ <_short>Undo Smart Put on last "smartputed" window</_short>
+ <_long>Undo!!!</_long>
+ <default>&lt;Super&gt;&lt;Control&gt;KP_Multiply</default>
+ </option>
+ <option name="use_triggerkey_forundo" type="bool">
+ <_short>Also use apply-key also for undo</_short>
+ <_long>If set, you can also use the same key for undo as you use for applying.</_long>
+ <default>false</default>
+ </option>
</group>
<group>
<_short>Options</_short>