summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/miniview.c
diff options
context:
space:
mode:
authorracarr <racarr@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-03 03:23:05 +0000
committerracarr <racarr@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-03 03:23:05 +0000
commit7be12b6fd30b4f636a9cffe0762b8289f2b2f74b (patch)
tree2ecd1912fd3c309f4ca02c6df9e41a3aa970f409 /beryl-plugins/src/miniview.c
parent3e12318ee7c26f40a5e61b690a73699a00314eef (diff)
downloadmarex-dev-7be12b6fd30b4f636a9cffe0762b8289f2b2f74b.tar.gz
marex-dev-7be12b6fd30b4f636a9cffe0762b8289f2b2f74b.tar.bz2
Add basic viewport testing functionality so testing is possible
git-svn-id: file:///beryl/trunk@3604 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/miniview.c')
-rw-r--r--beryl-plugins/src/miniview.c80
1 files changed, 73 insertions, 7 deletions
diff --git a/beryl-plugins/src/miniview.c b/beryl-plugins/src/miniview.c
index c4d2987..3ab092c 100644
--- a/beryl-plugins/src/miniview.c
+++ b/beryl-plugins/src/miniview.c
@@ -30,18 +30,18 @@
#define MINIVIEW_MOVE_KEY_DEFAULT Button1
#define MINIVIEW_MOVE_MODIFIERS_DEFAULT ( ShiftMask )
-#define MINIVIEW_INCREASE_KEY_DEFAULT "i"
-#define MINIVIEW_INCREASE_MODIFIERS_DEFAULT (CompSuperMask | CompAltMask)
-
-#define MINIVIEW_DECREASE_KEY_DEFAULT "d"
-#define MINIVIEW_DECREASE_MODIFIERS_DEFAULT (CompSuperMask | CompAltMask)
-
#define MINIVIEW_EXPO_KEY_DEFAULT "e"
#define MINIVIEW_EXPO_MODIFIERS_DEFAULT (CompSuperMask)
#define MINIVIEW_HIDE_KEY_DEFAULT "h"
#define MINIVIEW_HIDE_MODIFIERS_DEFAULT (ShiftMask | CompSuperMask)
+#define MINIVIEW_LEFT_KEY_DEFAULT "Left"
+#define MINIVIEW_RIGHT_KEY_DEFAULT "Right"
+#define MINIVIEW_UP_KEY_DEFAULT "Up"
+#define MINIVIEW_DOWN_KEY_DEFAULT "Down"
+#define MINIVIEW_VIEWPORTMOVE_MODIFIERS_DEFAULT (CompAltMask | ControlMask)
+
/* Unimplemented increase/decrease */
static int displayPrivateIndex;
@@ -50,7 +50,11 @@ static int displayPrivateIndex;
#define MINIVIEW_DISPLAY_OPTION_MOVE 1
#define MINIVIEW_DISPLAY_OPTION_EXPO 2
#define MINIVIEW_DISPLAY_OPTION_HIDE 3
-#define MINIVIEW_DISPLAY_OPTION_NUM 4
+#define MINIVIEW_DISPLAY_OPTION_DOWN 4
+#define MINIVIEW_DISPLAY_OPTION_UP 5
+#define MINIVIEW_DISPLAY_OPTION_LEFT 6
+#define MINIVIEW_DISPLAY_OPTION_RIGHT 7
+#define MINIVIEW_DISPLAY_OPTION_NUM 8
typedef struct _MiniviewDisplay
{
@@ -191,6 +195,40 @@ static Bool miniviewExpo(CompDisplay *d, CompAction * action, CompActionState st
return FALSE;
}
+#define GET_SCREEN \
+ CompScreen *s;\
+ Window xid; \
+ xid = getIntOptionNamed(option, nOption, "root", 0); \
+ s = findScreenAtDisplay(d, xid);
+
+static Bool miniviewLeft(CompDisplay *d, CompAction * action, CompActionState state, CompOption * option, int nOption)
+{
+ GET_SCREEN
+ moveScreenViewport(s,-1,0,TRUE);
+ return FALSE;
+}
+
+static Bool miniviewRight(CompDisplay *d, CompAction * action, CompActionState state, CompOption * option, int nOption)
+{
+ GET_SCREEN
+ moveScreenViewport(s, 1, 0, TRUE);
+ return FALSE;
+}
+
+static Bool miniviewDown (CompDisplay *d, CompAction * action, CompActionState state, CompOption * option, int nOption)
+{
+ GET_SCREEN
+ moveScreenViewport(s, 0, 1, TRUE);
+ return FALSE;
+}
+
+static Bool miniviewUp (CompDisplay *d, CompAction * action, CompActionState state, CompOption * option, int nOption)
+{
+ GET_SCREEN
+ moveScreenViewport(s, 0, -1, TRUE);
+ return FALSE;
+}
+
static Bool miniviewPaintScreen(CompScreen * s,
@@ -426,6 +464,30 @@ static void miniviewDisplayInitOptions(MiniviewDisplay * md)
o->value.action.key.modifiers = MINIVIEW_HIDE_MODIFIERS_DEFAULT;
o->value.action.key.keysym = XStringToKeysym(MINIVIEW_HIDE_KEY_DEFAULT);
+ #define MINIVIEW_MOVE_OPTION(UPPER,LOWER) \
+ o = &md->opt[MINIVIEW_DISPLAY_OPTION_##UPPER]; \
+ o->name = "Move "#LOWER; \
+ o->group = N_("Misc. Settings"); \
+ o->subGroup = N_(""); \
+ o->displayHints = ""; \
+ o->shortDesc = N_(#LOWER); \
+ o->longDesc = N_(#LOWER); \
+ o->type = CompOptionTypeAction; \
+ o->value.action.initiate = miniview##LOWER; \
+ o->value.action.terminate = 0; \
+ o->value.action.bell = 0; \
+ o->value.action.edgeMask = 0; \
+ o->value.action.state = CompActionStateInitKey; \
+ o->value.action.type = CompBindingTypeKey; \
+ o->value.action.key.modifiers = MINIVIEW_VIEWPORTMOVE_MODIFIERS_DEFAULT; \
+ o->value.action.key.keysym = XStringToKeysym(MINIVIEW_##UPPER##_KEY_DEFAULT);
+
+ MINIVIEW_MOVE_OPTION(LEFT,Left)
+ MINIVIEW_MOVE_OPTION(RIGHT,Right)
+ MINIVIEW_MOVE_OPTION(UP,Up)
+ MINIVIEW_MOVE_OPTION(DOWN,Down)
+
+
o = &md->opt[MINIVIEW_DISPLAY_OPTION_MOVE];
o->advanced = False;
o->name = "move";
@@ -486,6 +548,10 @@ miniviewSetDisplayOption(CompDisplay * d, char *name, CompOptionValue * value)
case MINIVIEW_DISPLAY_OPTION_MOVE:
case MINIVIEW_DISPLAY_OPTION_EXPO:
case MINIVIEW_DISPLAY_OPTION_HIDE:
+ case MINIVIEW_DISPLAY_OPTION_LEFT:
+ case MINIVIEW_DISPLAY_OPTION_RIGHT:
+ case MINIVIEW_DISPLAY_OPTION_UP:
+ case MINIVIEW_DISPLAY_OPTION_DOWN:
if (setDisplayAction(d, o, value))
return TRUE;
default: