summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Lyngstol <kristian@bohemians.org>2007-12-19 01:44:31 +0100
committerKristian Lyngstol <kristian@windu.lyngstol.net>2007-12-19 01:44:31 +0100
commitccd74c19c116b38964d14e4c80f46a2c15090d76 (patch)
tree9e0e3c167cec47b47a38b6b77ffd266897eeeb2f
parentb982d3af31495b5b51493f45dfdb6c31b91a91bc (diff)
downloadshelf-ccd74c19c116b38964d14e4c80f46a2c15090d76.tar.gz
shelf-ccd74c19c116b38964d14e4c80f46a2c15090d76.tar.bz2
Floating binding
-rw-r--r--shelf.c45
-rw-r--r--shelf.xml.in20
2 files changed, 65 insertions, 0 deletions
diff --git a/shelf.c b/shelf.c
index 745f320..ff8a54d 100644
--- a/shelf.c
+++ b/shelf.c
@@ -101,6 +101,49 @@ shelfTrigger (CompDisplay *d,
return TRUE;
}
+/* shelfInc and shelfDec are matcing functions and bindings;
+ * They increase and decrease the scale factor by 'interval'.
+ */
+static Bool
+shelfInc (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption)
+{
+ CompWindow *w = findWindowAtDisplay (d, d->activeWindow);
+ if (!w)
+ return TRUE;
+ SHELF_SCREEN (w->screen);
+ SHELF_WINDOW (w);
+ sw->scale += shelfGetInterval(d);
+ if (sw->scale >= 1.00f)
+ sw->scale = 1.00f;
+ shelfShapeInput (w);
+ damageScreen (w->screen);
+ return TRUE;
+}
+
+static Bool
+shelfDec (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption)
+{
+ CompWindow *w = findWindowAtDisplay (d, d->activeWindow);
+ if (!w)
+ return TRUE;
+ SHELF_SCREEN (w->screen);
+ SHELF_WINDOW (w);
+ sw->scale -= shelfGetInterval(d);
+ if (sw->scale < 0.001f)
+ sw->scale = 0.001f;
+ shelfShapeInput (w);
+ damageScreen (w->screen);
+ return TRUE;
+}
+
/* The window was damaged, adjust the damage to fit the actual area we
* care about.
*
@@ -228,6 +271,8 @@ shelfInitDisplay (CompPlugin *p,
return FALSE;
}
shelfSetTriggerKeyInitiate (d, shelfTrigger);
+ shelfSetIncButtonInitiate (d, shelfInc);
+ shelfSetDecButtonInitiate (d, shelfDec);
return TRUE;
}
diff --git a/shelf.xml.in b/shelf.xml.in
index e73f8ca..e842130 100644
--- a/shelf.xml.in
+++ b/shelf.xml.in
@@ -16,7 +16,27 @@
</_long>
<default>&lt;Super&gt;l</default>
</option>
+ <option name="dec_button" type="button">
+ <_short>Make the window smaller</_short>
+ <_long>
+ Reduces the scale factor making the window smaller.
+ </_long>
+ <default>&lt;Alt&gt;&lt;Super&gt;Button4</default>
+ </option>
+ <option name="inc_button" type="button">
+ <_short>Make the window bigger</_short>
+ <_long>
+ Increase the scale factor making the window bigger.
+ </_long>
+ <default>&lt;Alt&gt;&lt;Super&gt;Button5</default>
+ </option>
</group>
+ <option name="interval" type="float">
+ <default>0.1</default>
+ <min>0.001</min>
+ <max>1.000</max>
+ <precision>0.001</precision>
+ </option>
</display>
</plugin>
</compiz>