summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/miniview.c
diff options
context:
space:
mode:
authorracarr <racarr@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-02 23:56:32 +0000
committerracarr <racarr@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-02 23:56:32 +0000
commitaad43c28475d47be2fd8031fcdb4433969f2af93 (patch)
tree816b985ffdae5eed15165b8beb07d1fbe3b37ac5 /beryl-plugins/src/miniview.c
parent6b0e8374cd390e0e34fb9acc3cc2b901237ea877 (diff)
downloadmarex-dev-aad43c28475d47be2fd8031fcdb4433969f2af93.tar.gz
marex-dev-aad43c28475d47be2fd8031fcdb4433969f2af93.tar.bz2
Add option to hide miniviews without destroying , add and remove screen actions properly, etcetc
git-svn-id: file:///beryl/trunk@3595 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/miniview.c')
-rw-r--r--beryl-plugins/src/miniview.c58
1 files changed, 54 insertions, 4 deletions
diff --git a/beryl-plugins/src/miniview.c b/beryl-plugins/src/miniview.c
index 1b6308c..e5a51df 100644
--- a/beryl-plugins/src/miniview.c
+++ b/beryl-plugins/src/miniview.c
@@ -39,6 +39,9 @@
#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)
+
/* Unimplemented increase/decrease */
static int displayPrivateIndex;
@@ -46,7 +49,8 @@ static int displayPrivateIndex;
#define MINIVIEW_DISPLAY_OPTION_CREATE 0
#define MINIVIEW_DISPLAY_OPTION_MOVE 1
#define MINIVIEW_DISPLAY_OPTION_EXPO 2
-#define MINIVIEW_DISPLAY_OPTION_NUM 3
+#define MINIVIEW_DISPLAY_OPTION_HIDE 3
+#define MINIVIEW_DISPLAY_OPTION_NUM 4
typedef struct _MiniviewDisplay
{
@@ -143,6 +147,23 @@ static Bool miniviewMove(CompDisplay * d, CompAction * action,
return FALSE;
}
+static Bool miniviewHide(CompDisplay * d, CompAction * action,
+ CompActionState state, CompOption * option,
+ int nOption)
+{
+ CompScreen *s;
+ Window xid;
+
+ xid = getIntOptionNamed(option, nOption, "root", 0);
+ s = findScreenAtDisplay(d, xid);
+ MINIVIEW_SCREEN(s);
+ ms->showing = !ms->showing;
+ damageScreen(s);
+
+
+ return FALSE;
+}
+
static Bool miniviewExpo(CompDisplay *d, CompAction * action, CompActionState state, CompOption * option, int nOption)
{
CompScreen *s;
@@ -252,10 +273,11 @@ static void miniviewPaintTransformedScreen(CompScreen * s,
int oldFilter = s->filter[SCREEN_TRANS_FILTER];
s->filter[SCREEN_TRANS_FILTER] = COMP_TEXTURE_FILTER_GOOD;
glPushMatrix();
+
//int origView = s->x;
//moveScreenViewport(s,-s->x,0,FALSE);
- if (ms->expoCam+0.05 <= 1)
- ms->expoCam += 0.05;
+ if (ms->expoCam+0.075 <= 1)
+ ms->expoCam += 0.075;
glScalef(1.0f,1.0f,((float)s->hsize/2.0f)*ms->expoCam);
@@ -265,10 +287,11 @@ static void miniviewPaintTransformedScreen(CompScreen * s,
int i;
for (i = 0; i < s->hsize; i++)
{
- (*s->paintTransformedScreen) (s, sAttrib, region, output, mask);
+ (*s->paintTransformedScreen) (s, sAttrib,region, output, mask);
glTranslatef((2.5/s->hsize),0.0f,0.0);
glTranslatef(0.2f,0.0f,0.1f);
moveScreenViewport(s,1,0,FALSE);
+
}
//while (s->x != origView)
@@ -334,6 +357,24 @@ static void miniviewDisplayInitOptions(MiniviewDisplay * md)
o->value.action.key.modifiers = MINIVIEW_EXPO_MODIFIERS_DEFAULT;
o->value.action.key.keysym = XStringToKeysym(MINIVIEW_EXPO_KEY_DEFAULT);
+ o = &md->opt[MINIVIEW_DISPLAY_OPTION_HIDE];
+ o->advanced = False;
+ o->name = "Hide";
+ o->group = N_("Misc. Settings");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Hide");
+ o->longDesc = N_("Engage miniview hide mode.");
+ o->type = CompOptionTypeAction;
+ o->value.action.initiate = miniviewHide;
+ 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_HIDE_MODIFIERS_DEFAULT;
+ o->value.action.key.keysym = XStringToKeysym(MINIVIEW_HIDE_KEY_DEFAULT);
+
o = &md->opt[MINIVIEW_DISPLAY_OPTION_MOVE];
o->advanced = False;
o->name = "move";
@@ -393,6 +434,7 @@ miniviewSetDisplayOption(CompDisplay * d, char *name, CompOptionValue * value)
case MINIVIEW_DISPLAY_OPTION_CREATE:
case MINIVIEW_DISPLAY_OPTION_MOVE:
case MINIVIEW_DISPLAY_OPTION_EXPO:
+ case MINIVIEW_DISPLAY_OPTION_HIDE:
if (setDisplayAction(d, o, value))
return TRUE;
default:
@@ -451,6 +493,8 @@ static Bool miniviewInitScreen(CompPlugin * p, CompScreen * s)
ms->size = 3.0;
addScreenAction(s, &md->opt[MINIVIEW_DISPLAY_OPTION_CREATE].value.action);
addScreenAction(s, &md->opt[MINIVIEW_DISPLAY_OPTION_MOVE].value.action);
+ addScreenAction(s, &md->opt[MINIVIEW_DISPLAY_OPTION_HIDE].value.action);
+ addScreenAction(s, &md->opt[MINIVIEW_DISPLAY_OPTION_EXPO].value.action);
WRAP(ms, s, paintScreen, miniviewPaintScreen);
WRAP(ms, s, donePaintScreen, miniviewDonePaintScreen);
@@ -465,6 +509,12 @@ static Bool miniviewInitScreen(CompPlugin * p, CompScreen * s)
static void miniviewFiniScreen(CompPlugin * p, CompScreen * s)
{
MINIVIEW_SCREEN(s);
+ MINIVIEW_DISPLAY(s->display);
+
+ removeScreenAction(s, &md->opt[MINIVIEW_DISPLAY_OPTION_CREATE].value.action);
+ removeScreenAction(s, &md->opt[MINIVIEW_DISPLAY_OPTION_MOVE].value.action);
+ removeScreenAction(s, &md->opt[MINIVIEW_DISPLAY_OPTION_HIDE].value.action);
+ removeScreenAction(s, &md->opt[MINIVIEW_DISPLAY_OPTION_EXPO].value.action);
UNWRAP(ms, s, paintScreen);
UNWRAP(ms, s, donePaintScreen);
UNWRAP(ms, s, paintTransformedScreen);