summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/rotate.c
diff options
context:
space:
mode:
authorkristian <kristian@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-12-09 19:00:38 +0000
committerkristian <kristian@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-12-09 19:00:38 +0000
commit6b96d28a5f054655d81c032a454fee47b89d5a19 (patch)
treecc018eb3fffcc15a40330d6f53763095c992d9d2 /beryl-plugins/src/rotate.c
parent9fc50b4ddd8a8ca8ab34474c77ede1319093bd26 (diff)
downloadmarex-dev-6b96d28a5f054655d81c032a454fee47b89d5a19.tar.gz
marex-dev-6b96d28a5f054655d81c032a454fee47b89d5a19.tar.bz2
Initate rotate on click on desktop. (Patch by tb7653) Closes #234.
git-svn-id: file:///beryl/trunk@1619 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/rotate.c')
-rw-r--r--beryl-plugins/src/rotate.c52
1 files changed, 51 insertions, 1 deletions
diff --git a/beryl-plugins/src/rotate.c b/beryl-plugins/src/rotate.c
index a9724d0..60fe236 100644
--- a/beryl-plugins/src/rotate.c
+++ b/beryl-plugins/src/rotate.c
@@ -53,6 +53,9 @@
#define ROTATE_INITIATE_BUTTON_DEFAULT Button1
#define ROTATE_INITIATE_MODIFIERS_DEFAULT (ControlMask | CompAltMask)
+#define ROTATE_INITIATEDESKTOP_BUTTON_DEFAULT Button2
+#define ROTATE_INITIATEDESKTOP_MODIFIERS_DEFAULT 0
+
#define ROTATE_WHEELINGS_DEFAULT 1
#define ROTATE_WHEELINGS_MIN 1
#define ROTATE_WHEELINGS_MAX 20
@@ -166,7 +169,8 @@ static int displayPrivateIndex;
#define ROTATE_DISPLAY_OPTION_FLIP_RIGHT 39
#define ROTATE_DISPLAY_OPTION_UP 40
#define ROTATE_DISPLAY_OPTION_DOWN 41
-#define ROTATE_DISPLAY_OPTION_NUM 42
+#define ROTATE_DISPLAY_OPTION_INITIATEDESKTOP 42
+#define ROTATE_DISPLAY_OPTION_NUM 43
typedef struct _RotateDisplay {
int screenPrivateIndex;
@@ -1037,6 +1041,25 @@ rotateInitiate(CompDisplay * d,
}
static Bool
+rotateInitiateDesktop(CompDisplay * d,
+ CompAction * action,
+ CompActionState state, CompOption * option, int nOption)
+{
+ CompScreen *s = findScreenAtDisplay(d, getIntOptionNamed(option, nOption, "root", 0));
+ if (s)
+ {
+ int x, y;
+ x = getIntOptionNamed(option, nOption, "x", 0);
+ y = getIntOptionNamed(option, nOption, "y", 0);
+
+ if (pointerOnlyOnDesktop(s, x, y))
+ return rotateInitiate(d, action, state, option, nOption);
+ }
+ return FALSE;
+}
+
+
+static Bool
rotateTerminate(CompDisplay * d,
CompAction * action,
CompActionState state, CompOption * option, int nOption)
@@ -2182,6 +2205,7 @@ rotateSetDisplayOption(CompDisplay * display,
case ROTATE_DISPLAY_OPTION_TO_12_WINDOW:
case ROTATE_DISPLAY_OPTION_FLIP_LEFT:
case ROTATE_DISPLAY_OPTION_FLIP_RIGHT:
+ case ROTATE_DISPLAY_OPTION_INITIATEDESKTOP:
if (setDisplayAction(display, o, value))
return TRUE;
break;
@@ -2578,6 +2602,26 @@ o->shortDesc = str; \
o->value.i = ROTATE_FLIPTIME_DEFAULT;
o->rest.i.min = ROTATE_FLIPTIME_MIN;
o->rest.i.max = ROTATE_FLIPTIME_MAX;
+
+ o = &rd->opt[ROTATE_DISPLAY_OPTION_INITIATEDESKTOP];
+ o->name = "initiatedesktop";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Initiate on desktop");
+ o->longDesc = N_("Start Rotation, but only when issued over desktop");
+ o->type = CompOptionTypeAction;
+ o->value.action.initiate = rotateInitiateDesktop;
+ o->value.action.terminate = rotateTerminate;
+ o->value.action.bell = FALSE;
+ o->value.action.edgeMask = 0;
+ o->value.action.state = CompActionStateInitKey;
+ o->value.action.state |= CompActionStateInitButton;
+ o->value.action.type = CompBindingTypeButton;
+ o->value.action.button.modifiers =
+ ROTATE_INITIATEDESKTOP_MODIFIERS_DEFAULT;
+ o->value.action.button.button = ROTATE_INITIATEDESKTOP_BUTTON_DEFAULT;
+
}
static CompOption *rotateGetDisplayOptions(CompDisplay * display,
@@ -2718,6 +2762,9 @@ static Bool rotateInitScreen(CompPlugin * p, CompScreen * s)
addScreenAction(s,
&rd->opt[ROTATE_DISPLAY_OPTION_RIGHT_WHEEL].value.
action);
+ addScreenAction(s,
+ &rd->opt[ROTATE_DISPLAY_OPTION_INITIATEDESKTOP].value.
+ action);
WRAP(rs, s, preparePaintScreen, rotatePreparePaintScreen);
WRAP(rs, s, donePaintScreen, rotateDonePaintScreen);
@@ -2779,6 +2826,9 @@ static void rotateFiniScreen(CompPlugin * p, CompScreen * s)
removeScreenAction(s,
&rd->opt[ROTATE_DISPLAY_OPTION_RIGHT_WHEEL].
value.action);
+ removeScreenAction(s,
+ &rd->opt[ROTATE_DISPLAY_OPTION_INITIATEDESKTOP].value.
+ action);
free(rs);
}