summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Gurgel Pinho <eduardo@mad4.(none)>2008-12-15 18:15:01 -0300
committerEduardo Gurgel Pinho <eduardo@mad4.(none)>2008-12-15 18:15:01 -0300
commitbde7566f56b44940409dd484e55d0ac14c626ac3 (patch)
treec702961de0d4af882e3d46f3347dfbf8712b073e
parent1cac3e2729d4dc35e7ef80c5ebe7f51c5516d125 (diff)
downloadsmartput-bde7566f56b44940409dd484e55d0ac14c626ac3.tar.gz
smartput-bde7566f56b44940409dd484e55d0ac14c626ac3.tar.bz2
Smartput All removed. Coding style. Undo fixedHEADmaster
-rw-r--r--smartput.c152
-rw-r--r--smartput.xml.in27
2 files changed, 86 insertions, 93 deletions
diff --git a/smartput.c b/smartput.c
index 001ef0b..53ac638 100644
--- a/smartput.c
+++ b/smartput.c
@@ -268,8 +268,8 @@ smartputExtendBox (CompWindow *w,
*/
static void
-smartputCreateBoxes(CompWindow* window,
- BOX* testBoxes)
+smartputCreateBoxes (CompWindow* window,
+ BOX* testBoxes)
{
/* BOX to represent an infintesimal window to compute maximum empty region */
XRectangle tmpRect;
@@ -304,8 +304,8 @@ smartputCreateBoxes(CompWindow* window,
}
static Bool
-smartputValidBox(CompScreen* s,
- BOX box)
+smartputValidBox (CompScreen* s,
+ BOX box)
{
if(box.x1 < 0 || box.y1 < 0 || box.x2 < 0 || box.y2 < 0) return FALSE;
if(box.x1 > s->width || box.x2 > s->width || box.y1 > s->height || box.y2 > s->height) return FALSE;
@@ -316,9 +316,9 @@ smartputValidBox(CompScreen* s,
*
*/
static BOX
-smartputBox(CompWindow* w,
- Region r,
- BOX testBox)
+smartputBox (CompWindow* w,
+ Region r,
+ BOX testBox)
{
BOX ansA, ansB;
ansA = smartputExtendBox (w, testBox, r, TRUE, TRUE,TRUE,TRUE,TRUE);
@@ -381,7 +381,7 @@ smartputFindRect (CompWindow *w,
tmpRect.width = w->serverWidth;
tmpRect.height = w->serverHeight;
- windowBox = smartputBoxFromRect(tmpRect);
+ windowBox = smartputBoxFromRect (tmpRect);
int currentArea = tmpRect.width*tmpRect.height;
@@ -395,16 +395,16 @@ smartputFindRect (CompWindow *w,
for (window = s->windows; window; window = window->next)
{
BOX testBoxes[4];
- smartputCreateBoxes(window,testBoxes);
+ smartputCreateBoxes (window,testBoxes);
int i;
for(i = 0; i < 4; i++)
{
BOX testBox = testBoxes[i];
BOX tmpMaxBox;
- if(smartputValidBox(s,testBox))
+ if(smartputValidBox (s,testBox))
{
- tmpMaxBox = smartputBox(w,r,testBox);
+ tmpMaxBox = smartputBox (w,r,testBox);
area = (tmpMaxBox.x2 - tmpMaxBox.x1)*(tmpMaxBox.y2 - tmpMaxBox.y1);
if(area >= maxArea)
{
@@ -419,8 +419,8 @@ smartputFindRect (CompWindow *w,
* And if so, windows may just shrink to a minimal size of 50x50
*/
if(smartputGetAllowWindowsShrink (d) &&
- (maxBox.x2 - maxBox.x1) > smartputGetWindowMinwidth(d) &&
- (maxBox.y2 - maxBox.y1) > smartputGetWindowMinheight(d))
+ (maxBox.x2 - maxBox.x1) > smartputGetWindowMinwidth (d) &&
+ (maxBox.y2 - maxBox.y1) > smartputGetWindowMinheight (d))
return maxBox;
if(maxArea >= currentArea)
@@ -439,7 +439,7 @@ smartputFindStapleRect (CompWindow *w,
{
BOX windowBox, maxBox;
CompWindow *window;
- int maxArea, maxRate;
+ int maxArea;
windowBox = smartputBoxFromWindow (w);
@@ -509,8 +509,8 @@ smartputFindStapleRect (CompWindow *w,
* Calls out to compute the resize.
*/
static unsigned int
-smartputComputeResize(CompWindow *w,
- XWindowChanges *xwc)
+smartputComputeResize (CompWindow *w,
+ XWindowChanges *xwc)
{
CompOutput *output;
CompDisplay *d;
@@ -578,8 +578,8 @@ smartputComputeResize(CompWindow *w,
*/
static Bool
-smartputSameViewport(CompWindow* w1,
- CompWindow* w2)
+smartputSameViewport (CompWindow* w1,
+ CompWindow* w2)
{
int x1,x2,y1,y2;
@@ -649,12 +649,12 @@ smartputUndoResize (CompScreen *s,
}
static Bool
-smartputInitiate(CompWindow *w,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption,
- Bool undo)
+smartputInitiate (CompWindow *w,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption,
+ Bool undo)
{
CompDisplay *d;
if (w)
@@ -693,40 +693,41 @@ smartputInitiate(CompWindow *w,
sps->undoInfo.newY == w->serverY &&
sps->undoInfo.newWidth == w->serverWidth &&
sps->undoInfo.newHeight == w->serverHeight &&
- smartputGetUseTriggerkeyForundo(d))
+ smartputGetUseTriggerkeyForundo (d))
{
mask = smartputUndoResize (s,xwc);
+ undo = TRUE;
}
else
{
mask = smartputComputeResize (w, xwc);
}
- if (mask)
+ if (mask)
+ {
+ if (constrainNewWindowSize (w, xwc->width, xwc->height,
+ &width, &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);
+ 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);
+ }
}
return TRUE;
@@ -737,11 +738,11 @@ smartputInitiate(CompWindow *w,
* Tries to undo Smart Put last action
*/
static Bool
-smartputUndo(CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
+smartputUndo (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption)
{
Window xid;
CompWindow *w;
@@ -754,8 +755,8 @@ smartputUndo(CompDisplay *d,
if (w)
{
- return smartputInitiate(w, action, state,
- option, nOption,TRUE);
+ return smartputInitiate (w, action, state,
+ option, nOption,TRUE);
}
return FALSE;
@@ -767,11 +768,11 @@ smartputUndo(CompDisplay *d,
*
*/
static Bool
-smartputTrigger(CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
+smartputTrigger (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption)
{
Window xid;
CompWindow *w;
@@ -792,8 +793,8 @@ smartputTrigger(CompDisplay *d,
if (w->wmType & CompWindowTypeDockMask)
return FALSE;
- return smartputInitiate(w, action, state,
- option, nOption,FALSE);
+ return smartputInitiate (w, action, state,
+ option, nOption,FALSE);
}
return FALSE;
@@ -801,16 +802,14 @@ smartputTrigger(CompDisplay *d,
/*
- * Initially triggered keybinding.
- * Fetch the viewport, fetch the resize, constrain it.
- *
+ * Buggy
*/
static Bool
-smartputAllTrigger(CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
+smartputAllTrigger (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption)
{
Window xid;
CompWindow *w;
@@ -868,7 +867,7 @@ smartputAllTrigger(CompDisplay *d,
}
/*
- * calculate the velocity for the moving window
+ * Calculate the velocity for the moving window
*/
static int
adjustSmartputVelocity (CompWindow *w)
@@ -916,7 +915,7 @@ adjustSmartputVelocity (CompWindow *w)
}
/*
- * setup for paint screen
+ * Setup for paint screen
*/
static void
smartputPreparePaintScreen (CompScreen *s,
@@ -982,7 +981,7 @@ smartputPreparePaintScreen (CompScreen *s,
/*
- * after painting clean up
+ * After painting clean up
*/
static void
smartputDonePaintScreen (CompScreen *s)
@@ -1124,7 +1123,7 @@ smartputHandleEvent (CompDisplay *d,
{
CompWindow *w;
- w = findWindowAtDisplay(d, event->xclient.window);
+ w = findWindowAtDisplay (d, event->xclient.window);
if (w)
{
/*
@@ -1197,14 +1196,13 @@ smartputInitDisplay (CompPlugin *p,
/* custom atom for client events */
spd->compizSmartputWindowAtom = XInternAtom(d->display,
- "_COMPIZ_SMARTPUT_WINDOW", 0);
+ "_COMPIZ_SMARTPUT_WINDOW", 0);
spd->lastWindow = None;
smartputSetTriggerButtonInitiate(d, smartputTrigger);
smartputSetTriggerAllButtonInitiate (d, smartputAllTrigger);
smartputSetTriggerKeyInitiate (d, smartputTrigger);
- smartputSetTriggerAllKeyInitiate (d, smartputAllTrigger);
smartputSetUndoKeyInitiate (d, smartputUndo);
WRAP (spd, d, handleEvent, smartputHandleEvent);
@@ -1280,7 +1278,7 @@ smartputFiniScreen (CompPlugin *p,
static Bool
smartputInitWindow (CompPlugin *p,
- CompWindow *w)
+ CompWindow *w)
{
SmartputWindow *spw;
diff --git a/smartput.xml.in b/smartput.xml.in
index c67a0b7..ec4cf9f 100644
--- a/smartput.xml.in
+++ b/smartput.xml.in
@@ -2,24 +2,19 @@
<compiz>
<plugin name="smartput" useBcop="true">
<_short>Smart Put</_short>
- <_long>Smart way to fit windows on empty region.</_long>
+ <_long>Smart way to fit windows.</_long>
<category>Window Management</category>
<display>
<group>
<_short>Bindings</_short>
<option name="trigger_key" type="key">
- <_short>Apply Smart Put on current window</_short>
- <_long>Smart Put!!!</_long>
+ <_short>Apply Smart Put on current window.</_short>
+ <_long>Apply Smart Put on current window.</_long>
<default>&lt;Super&gt;&lt;Shift&gt;KP_Multiply</default>
</option>
- <option name="trigger_all_key" type="key">
- <_short>Apply Smart Put on current viewport</_short>
- <_long>Smart Put!!!</_long>
- <default>&lt;Super&gt;&lt;Control&gt;&lt;Shift&gt;KP_Multiply</default>
- </option>
<option name="trigger_button" type="button">
- <_short>Initiate Smartput on current window</_short>
- <_long>Smart Put!!!</_long>
+ <_short>Initiate Smartput on current window.</_short>
+ <_long>Initiate Smart Put on current window.</_long>
<default>Button8</default>
</option>
<option name="trigger_all_button" type="button">
@@ -33,7 +28,7 @@
<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>
+ <_short>Also use apply-key to undo</_short>
<_long>If set, you can also use the same key for undo as you use for applying.</_long>
<default>false</default>
</option>
@@ -42,31 +37,31 @@
<_short>Options</_short>
<option name="allow_windows_stack" type="bool">
<_short>Allow stack windows</_short>
- <_long>Stack windows on each other if there is no place left to place them</_long>
+ <_long>Stack windows on each other if there is no place left to place them.</_long>
<default>false</default>
</option>
<option name="allow_windows_shrink" type="bool">
<_short>Allow windows shrink</_short>
- <_long>Just place the window when the new size is larger than the old one</_long>
+ <_long>Just place the window when the new size is larger than the old one.</_long>
<default>false</default>
</option>
<option name="window_minheight" type="int">
<_short>Minimal window height</_short>
- <_long>The minimal height the new window must have at least </_long>
+ <_long>Minimal height that the new window must have at least.</_long>
<default>50</default>
<min>5</min>
<max>6000</max>
</option>
<option name="window_minwidth" type="int">
<_short>Minimal window width</_short>
- <_long>The minimal width the new window must have at least</_long>
+ <_long>Minimal width that the new window must have at least.</_long>
<default>50</default>
<min>5</min>
<max>6000</max>
</option>
<option name="window_margin" type="int">
<_short>Window margin</_short>
- <_long>The distance windows hold between each other</_long>
+ <_long>The distance between windows.</_long>
<default>0</default>
<min>0</min>
<max>500</max>