diff options
-rw-r--r-- | beryl-plugins/src/group/group.h | 6 | ||||
-rw-r--r-- | beryl-plugins/src/group/option.c | 6 | ||||
-rw-r--r-- | beryl-plugins/src/wall.c | 499 |
3 files changed, 314 insertions, 197 deletions
diff --git a/beryl-plugins/src/group/group.h b/beryl-plugins/src/group/group.h index 9be3533..a715222 100644 --- a/beryl-plugins/src/group/group.h +++ b/beryl-plugins/src/group/group.h @@ -159,12 +159,6 @@ enum { /* * tab bar styles */ -static char *tabBarStyleNames[] = { - N_("Simple"), - N_("Gradient"), - N_("Glass") -}; - typedef enum { StyleSimple = 0, StyleGradient, diff --git a/beryl-plugins/src/group/option.c b/beryl-plugins/src/group/option.c index 84db324..256fafd 100644 --- a/beryl-plugins/src/group/option.c +++ b/beryl-plugins/src/group/option.c @@ -200,6 +200,12 @@ #define GROUP_TAB_DRAG_FRICTION_MAX 100.0f #define GROUP_TAB_DRAG_FRICTION_PRECISION 0.1f +static char *tabBarStyleNames[] = { + N_("Simple"), + N_("Gradient"), + N_("Glass") +}; + char *groupDefaultTypes[] = { N_("Normal"), N_("Dialog"), diff --git a/beryl-plugins/src/wall.c b/beryl-plugins/src/wall.c index 2e18195..1f3f751 100644 --- a/beryl-plugins/src/wall.c +++ b/beryl-plugins/src/wall.c @@ -90,6 +90,10 @@ Known Bugs: #define WALL_MINISCREEN_DEFAULT FALSE #define WALL_ALLOW_WRAPAROUND_DEFAULT FALSE +#define WALL_EDGEFLIP_POINTER_DEFAULT FALSE +#define WALL_EDGEFLIP_MOVE_DEFAULT TRUE +#define WALL_EDGEFLIP_DND_DEFAULT FALSE + #define WIN_X(w) ((w)->attrib.x - (w)->input.left) #define WIN_Y(w) ((w)->attrib.y - (w)->input.top) #define WIN_W(w) ((w)->width + (w)->input.left + (w)->input.right) @@ -121,16 +125,24 @@ static int displayPrivateIndex; #define WALL_DISPLAY_OPTION_MINISCREEN 19 #define WALL_DISPLAY_OPTION_PREVIEW_TIMEOUT 20 #define WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND 21 -#define WALL_DISPLAY_OPTION_NUM 22 +#define WALL_DISPLAY_OPTION_EDGEFLIP_POINTER 22 +#define WALL_DISPLAY_OPTION_EDGEFLIP_MOVE 23 +#define WALL_DISPLAY_OPTION_EDGEFLIP_DND 24 +/* these four should always be at the end */ +#define WALL_DISPLAY_OPTION_FLIP_LEFT 25 +#define WALL_DISPLAY_OPTION_FLIP_RIGHT 26 +#define WALL_DISPLAY_OPTION_FLIP_UP 27 +#define WALL_DISPLAY_OPTION_FLIP_DOWN 28 +#define WALL_DISPLAY_OPTION_NUM 29 /* Enums */ -enum Direction +typedef enum { - UpLeft = 0, - UpRight, - DownLeft, - DownRight -}; + Up = 0, + Left, + Down, + Right +} Direction; enum DnDState { @@ -176,8 +188,6 @@ typedef struct _WallScreen PaintTransformedScreenProc paintTransformedScreen; PaintWindowProc paintWindow; DamageWindowRectProc damageWindowRect; - WindowGrabNotifyProc windowGrabNotify; - WindowUngrabNotifyProc windowUngrabNotify; int moveStep; float expoCam; // Used for expo zoom animation @@ -217,8 +227,6 @@ typedef struct _WallScreen Bool anyClick; int boxTimeout; - CompWindow *grabbedWindow; - Window moveWindow; Bool miniScreen; @@ -300,17 +308,17 @@ static void wallReleaseMoveWindow (CompScreen * s) ws->moveWindow = 0; } -static void wallMoveViewport(CompScreen * s, int x, int y, Window moveWindow) +static Bool wallMoveViewport(CompScreen * s, int x, int y, Window moveWindow) { int newDestX = MAXSHORT; int newDestY = MAXSHORT; if (!x && !y) - return; + return FALSE; WALL_SCREEN(s); if (ws->moving) - return; + return FALSE; WALL_DISPLAY(s->display); if (!ws->expoMode) @@ -359,7 +367,7 @@ static void wallMoveViewport(CompScreen * s, int x, int y, Window moveWindow) if (ws->moving) { ws->boxTimeout = wd->opt[WALL_DISPLAY_OPTION_PREVIEW_TIMEOUT].value.f * 1000; - if (!otherScreenGrabExist(s, "move", "wall", 0)) + if (!otherScreenGrabExist(s, "move", "scale", "group-drag", "wall", 0)) { if (ws->grabIndex) removeScreenGrab(s, ws->grabIndex, NULL); @@ -373,6 +381,8 @@ static void wallMoveViewport(CompScreen * s, int x, int y, Window moveWindow) } damageScreen(s); + + return ws->moving; } static void wallHandleEvent(CompDisplay * d, XEvent * event) @@ -574,60 +584,173 @@ static Bool wallDownWheel(CompDisplay * d, CompAction * action, return FALSE; } +static Bool wallInitiate(CompScreen *s, int dx, int dy, Window win) +{ + WALL_DISPLAY(s->display); + + int amountX = -dx; + int amountY = -dy; + + if (wd->opt[WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND].value.b) + { + if ((s->x + dx) < 0) + amountX = -(s->hsize + dx); + else if ((s->x + dx) >= s->hsize) + amountX = s->hsize - dx; + + if ((s->y + dy) < 0) + amountY = -(s->vsize + dy); + else if ((s->y + dy) >= s->vsize) + amountY = s->vsize - dy; + } + + wallMoveViewport(s, amountX, amountY, win); + + return FALSE; +} + +static Bool wallInitiateFlip(CompScreen *s, Direction direction, Bool dnd) +{ + int dx, dy; + WALL_DISPLAY(s->display); + + if (dnd) + { + if (!wd->opt[WALL_DISPLAY_OPTION_EDGEFLIP_DND].value.b) + return TRUE; + + if (otherScreenGrabExist(s, "wall", 0)) + return TRUE; + } + else if (screenGrabExist(s, "move", 0)) + { + if (!wd->opt[WALL_DISPLAY_OPTION_EDGEFLIP_MOVE].value.b) + return TRUE; + } + else if (screenGrabExist(s, "group-drag", 0)) + { + if (!wd->opt[WALL_DISPLAY_OPTION_EDGEFLIP_DND].value.b) + return TRUE; + } + else if (!wd->opt[WALL_DISPLAY_OPTION_EDGEFLIP_POINTER].value.b) + return TRUE; + + switch (direction) + { + case Left: + dx = 1; dy = 0; + break; + case Right: + dx = -1; dy = 0; + break; + case Up: + dx = 0; dy = 1; + break; + case Down: + dx = 0; dy = -1; + break; + default: + dx = 0; dy = 0; + break; + } + + if (wallMoveViewport(s, dx, dy, None)) + { + int offsetX, offsetY; + int warpX, warpY; + + if (dx > 0) { + offsetX = s->width - 10; + warpX = s->display->pointerX + s->width; + } else if (dx < 0) { + offsetX = 10 - s->width; + warpX = s->display->pointerX - s->width; + } else { + offsetX = 0; + warpX = s->display->lastPointerX; + } + + if (dy > 0) { + offsetY = s->height - 10; + warpY = s->display->pointerY + s->height; + } else if (dy < 0) { + offsetY = 10 - s->height; + warpY = s->display->pointerY - s->height; + } else { + offsetY = 0; + warpY = s->display->lastPointerY; + } + + warpPointer(s, offsetX, offsetY); + s->display->lastPointerX = warpX; + s->display->lastPointerY = warpY; + } + + return FALSE; +} + static Bool wallLeft(CompDisplay * d, CompAction * action, CompActionState state, CompOption * option, int nOption) { GET_SCREEN; - WALL_DISPLAY(d); - if (wd->opt[WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND].value.b && (s->x == 0)) - wallMoveViewport(s, -(s->hsize - 1), 0, None); - else - wallMoveViewport(s, 1, 0, None); - - return FALSE; + return wallInitiate(s, -1, 0, None); } static Bool wallRight(CompDisplay * d, CompAction * action, CompActionState state, CompOption * option, int nOption) { GET_SCREEN; - WALL_DISPLAY(d); - - if (wd->opt[WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND].value.b && (s->x == s->hsize - 1)) - wallMoveViewport(s, s->hsize - 1, 0, None); - else - wallMoveViewport(s, -1, 0, None); - return FALSE; + return wallInitiate(s, 1, 0, None); } static Bool wallUp(CompDisplay * d, CompAction * action, CompActionState state, CompOption * option, int nOption) { GET_SCREEN; - WALL_DISPLAY(d); - - if (wd->opt[WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND].value.b && (s->y == 0)) - wallMoveViewport(s, 0, -(s->vsize - 1), None); - else - wallMoveViewport(s, 0, 1, None); - return FALSE; + return wallInitiate(s, 0, -1, None); } static Bool wallDown(CompDisplay * d, CompAction * action, CompActionState state, CompOption * option, int nOption) { GET_SCREEN; - WALL_DISPLAY(d); - if (wd->opt[WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND].value.b && (s->y == s->vsize - 1)) - wallMoveViewport(s, 0, s->vsize - 1, None); - else - wallMoveViewport(s, 0, -1, None); + return wallInitiate(s, 0, 1, None); +} - return FALSE; +static Bool wallFlipLeft(CompDisplay * d, CompAction * action, + CompActionState state, CompOption * option, int nOption) +{ + GET_SCREEN; + + return wallInitiateFlip(s, Left, (state & CompActionStateInitEdgeDnd)); +} + +static Bool wallFlipRight(CompDisplay * d, CompAction * action, + CompActionState state, CompOption * option, int nOption) +{ + GET_SCREEN; + + return wallInitiateFlip(s, Right, (state & CompActionStateInitEdgeDnd)); +} + +static Bool wallFlipUp(CompDisplay * d, CompAction * action, + CompActionState state, CompOption * option, int nOption) +{ + GET_SCREEN; + + return wallInitiateFlip(s, Up, (state & CompActionStateInitEdgeDnd)); +} + +static Bool wallFlipDown(CompDisplay * d, CompAction * action, + CompActionState state, CompOption * option, int nOption) +{ + GET_SCREEN; + + return wallInitiateFlip(s, Down, (state & CompActionStateInitEdgeDnd)); } static Bool wallLeftWithWindow (CompDisplay *d, CompAction * action, @@ -636,14 +759,8 @@ static Bool wallLeftWithWindow (CompDisplay *d, CompAction * action, { GET_SCREEN; Window win = getIntOptionNamed (option, nOption, "window", 0); - WALL_DISPLAY(d); - if (wd->opt[WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND].value.b && (s->x == 0)) - wallMoveViewport(s, -(s->hsize - 1), 0, win); - else - wallMoveViewport(s, 1, 0, win); - - return FALSE; + return wallInitiate(s, -1, 0, win); } static Bool wallRightWithWindow (CompDisplay *d, CompAction * action, @@ -652,14 +769,8 @@ static Bool wallRightWithWindow (CompDisplay *d, CompAction * action, { GET_SCREEN; Window win = getIntOptionNamed (option, nOption, "window", 0); - WALL_DISPLAY(d); - - if (wd->opt[WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND].value.b && (s->x == s->hsize - 1)) - wallMoveViewport(s, s->hsize - 1, 0, win); - else - wallMoveViewport(s, -1, 0, win); - return FALSE; + return wallInitiate(s, 1, 0, win); } static Bool wallUpWithWindow (CompDisplay *d, CompAction * action, @@ -668,14 +779,8 @@ static Bool wallUpWithWindow (CompDisplay *d, CompAction * action, { GET_SCREEN; Window win = getIntOptionNamed (option, nOption, "window", 0); - WALL_DISPLAY(d); - if (wd->opt[WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND].value.b && (s->y == 0)) - wallMoveViewport(s, 0, -(s->vsize - 1), win); - else - wallMoveViewport(s, 0, 1, win); - - return FALSE; + return wallInitiate(s, 0, -1, win); } static Bool wallDownWithWindow (CompDisplay *d, CompAction * action, @@ -684,14 +789,8 @@ static Bool wallDownWithWindow (CompDisplay *d, CompAction * action, { GET_SCREEN; Window win = getIntOptionNamed (option, nOption, "window", 0); - WALL_DISPLAY(d); - - if (wd->opt[WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND].value.b && (s->y == s->vsize - 1)) - wallMoveViewport(s, 0, s->vsize - 1, win); - else - wallMoveViewport(s, 0, -1, win); - return FALSE; + return wallInitiate(s, 0, 1, win); } static Bool wallExpo(CompDisplay * d, CompAction * action, @@ -843,32 +942,6 @@ static void invertTransformedVertex(CompScreen * s, const ScreenPaintAttrib * sA } -static void wallWindowUngrabNotify(CompWindow * w) -{ - WALL_SCREEN(w->screen); - - if (w == ws->grabbedWindow) - ws->grabbedWindow = NULL; - - UNWRAP(ws, w->screen, windowUngrabNotify); - (*w->screen->windowUngrabNotify) (w); - WRAP(ws, w->screen, windowUngrabNotify, wallWindowUngrabNotify); -} - -static void wallWindowGrabNotify(CompWindow * w, - int x, int y, unsigned int state, - unsigned int mask) -{ - WALL_SCREEN(w->screen); - - if (!ws->grabbedWindow && (mask & CompWindowGrabMoveMask)) - ws->grabbedWindow = w; - - UNWRAP(ws, w->screen, windowGrabNotify); - (*w->screen->windowGrabNotify) (w, x, y, state, mask); - WRAP(ws, w->screen, windowGrabNotify, wallWindowGrabNotify); -} - static Bool wallDamageWindowRect(CompWindow *w, Bool initial, BoxPtr rect) { WALL_SCREEN(w->screen); @@ -973,13 +1046,18 @@ static Bool wallPaintScreen(CompScreen * s, + double left = + (float)ws->timer / + (wd->opt[WALL_DISPLAY_OPTION_SLIDE_DURATION].value.f * 1000.0f * + MAX(abs(ws->destx), abs(ws->desty))); glEnable(GL_BLEND); - glColor4f(0.8, 0.8, 0.8, 0.85); // Back rect color + glColor4f(0.8, 0.8, 0.8, 0.85); glLineWidth(2.0f); + left = 1-left; //glRectf(topleftx+border,toplefty+height-border,topleftx+width-border,toplefty+border); glRectf(topleftx + border, toplefty + border, topleftx + width - border, toplefty); @@ -1099,13 +1177,16 @@ static Bool wallPaintScreen(CompScreen * s, 0.0f); glRotatef(45, 0.0f, 0.0f, 1.0f); } + glEnable(GL_POLYGON_SMOOTH); glBegin(GL_TRIANGLES); glVertex2f(-s->width / 60.0f, -s->width / 60.0f); glVertex2f(-s->width / 60.0f, s->width / 60.0f); glVertex2f(s->width / 60.0f, 0); glEnd(); + glDisable(GL_POLYGON_SMOOTH); glPopMatrix(); } + glColor4f(0.1, 0.1, 0.2, 0.08); // Viewport colors if (!wd->opt[WALL_DISPLAY_OPTION_MINISCREEN].value.b) @@ -1120,11 +1201,11 @@ static Bool wallPaintScreen(CompScreen * s, if (i == s->x - ws->destx && j == s->y - ws->desty && ws->moving) { - glColor4f(0.1, 0.1, 0.1, 0.7); // Highlighted color + glColor4f(0.1, 0.1, 0.1, 0.3+0.3*left); // Highlighted color } if (ws->boxTimeout && !ws->moving && i == s->x && j == s->y) - glColor4f(0.1, 0.1, 0.1, 0.7); // Highlighted color + glColor4f(0.1, 0.1, 0.1, 0.3+0.3*left); // Highlighted color glRectf(firstviewX + (i * viewportWidth) + border, @@ -1194,7 +1275,6 @@ static Bool wallPaintScreen(CompScreen * s, j == origVY) ws->mSAttribs.brightness = BRIGHT; - (*s->paintTransformedScreen) (s, sAttrib, transform, region, output, mask | PAINT_SCREEN_TRANSFORMED_MASK); @@ -1251,12 +1331,39 @@ static void moveWindowToViewportYPosition(CompWindow * w, int y, Bool sync) } } +static void wallGetDistanceForAnimation(CompScreen *s, double left, int output, float *rdx, float *rdy) +{ + WALL_SCREEN(s); + + // 1.44 isn't a magic number, it can be easily derived from the + // following + // integral x^2=x^3/3, then solve for x = 1 as we want to translate by 1 + // total, you get 1.44 and the (tx-1.44) is to translate the parabola + // right by 1.44 + float tx = (1 - left) * 1.4422495; + float dx = (tx - 1.4422495) * (tx - 1.4422495) / 2; + + dx = 1 - dx; + dx *= s->width / (float)s->outputDev[output].width; + dx *= ws->destx; + + float dy = (tx - 1.4422495) * (tx - 1.4422495) / 2; + dy = 1 - dy; + dy *= (s->height) / (float)s->outputDev[output].height; + dy *= ws->desty; + + if (rdx) + *rdx = dx; + + if (rdy) + *rdy = dy; +} static void wallPreparePaintScreen(CompScreen * s, int ms) { WALL_SCREEN(s); - if (ws->expoMode || ws->grabbedWindow) // Do we need the mouse location? + if (ws->expoMode) // Do we need the mouse location? { int winX, winY; int rootX, rootY; @@ -1303,9 +1410,13 @@ static void wallPreparePaintScreen(CompScreen * s, int ms) w = findWindowAtScreen(s, ws->moveWindow); if (w) { + float dx, dy; + + wallGetDistanceForAnimation(s, left, s->currentOutputDev, &dx, &dy); + moveWindow (w, ws->moveWindowX-w->attrib.x ,ws->moveWindowY-w->attrib.y, TRUE, TRUE); - moveWindowToViewportPosition(w,ws->moveWindowX-(1-left)*s->width*ws->destx,FALSE); - moveWindowToViewportYPosition(w,ws->moveWindowY-(1-left)*s->height*ws->desty,FALSE); + moveWindowToViewportPosition(w,ws->moveWindowX-s->width*dx,FALSE); + moveWindowToViewportYPosition(w,ws->moveWindowY-s->height*dy,FALSE); syncWindowPosition(w); } } @@ -1377,7 +1488,7 @@ static void wallPaintTransformedScreen(CompScreen * s, ws->expoActive = FALSE; - (*s->paintTransformedScreen) (s, sAttrib, &sTransform, region, output, mask); + (*s->paintTransformedScreen) (s, sAttrib, &sTransform, region, output, mask | PAINT_SCREEN_CLEAR_MASK); if (ws->expoCam > 0.0) { @@ -1578,30 +1689,10 @@ static void wallPaintTransformedScreen(CompScreen * s, clearTargetOutput(s->display, GL_COLOR_BUFFER_BIT); int i, j; + float dx, dy; - // 1.44 isn't a magic number, it can be easily derived from the - // following - // integral x^2=x^3/3, then solve for x = 1 as we want to translate by 1 - // total, you get 1.44 and the (tx-1.44) is to translate the parabola - // right by 1.44 - float tx = (1-left) * 1.4422495; - float dx = (tx-1.4422495)*(tx-1.4422495)/2; - - dx = 1-dx; - - dx*=s->width/(float)s->outputDev[output].width; - dx*=ws->destx; - - - float dy = (tx-1.4422495)*(tx-1.4422495)/2; - dy = 1-dy; - - dy *= (s->height)/(float)s->outputDev[output].height; - dy*=ws->desty; - + wallGetDistanceForAnimation(s, left, output, &dx, &dy); matrixTranslate(&sTransform, dx, -dy, 0); - int lbx; - int lby; for (i = -abs(ws->destx); i < s->hsize; i++) // TODO: Add a slight bit of intelligence to not be so ineffecient { @@ -1657,13 +1748,12 @@ wallPaintWindow(CompWindow * w, if (ws->expoActive) { - if (wd->expoAnimationType == ExpoAnimationZoom) - pA.opacity = attrib->opacity; - else + if (wd->expoAnimationType != ExpoAnimationZoom) pA.opacity = attrib->opacity * ws->expoCam; if (w == ws->stickyWindow) pA.opacity = 0; + if (w->wmType & CompWindowTypeDockMask) { if (wd->expoAnimationType == ExpoAnimationZoom && @@ -1677,16 +1767,19 @@ wallPaintWindow(CompWindow * w, else pA.opacity = 0; } - pA.brightness = attrib->brightness * .75; + if (w->screen->x == ws->origVX && w->screen->y == ws->origVY) { pA.brightness = attrib->brightness; } - if (w->screen->x == ws->rorigx && w->screen->y == ws->rorigy && + else if (w->screen->x == ws->rorigx && w->screen->y == ws->rorigy && ws->origVY < 0 && ws->origVX < 0) { pA.brightness = attrib->brightness; } + else + pA.brightness = attrib->brightness * .75; + /* * FIXME: Bugged with windows intersecting more than one border int winx = w->attrib.x - w->input.left; @@ -1701,26 +1794,25 @@ wallPaintWindow(CompWindow * w, if (!(w == ws->stickyWindow)) { if (wd->expoAnimationType == ExpoAnimationZoom) - pA.brightness = attrib->brightness * 0.01; + pA.brightness = 0; else - pA.brightness = - attrib->brightness * (1.0 - (0.99 * ws->expoCam)); + pA.brightness = attrib->brightness * (1 - sigmoidProgress(ws->expoCam)); } } } if (ws->miniScreen) { - pA.opacity = - attrib->opacity * ((float)ws->mSAttribs.opacity / OPAQUE); - pA.brightness = - attrib->brightness * ((float)ws->mSAttribs.brightness / - BRIGHT); - pA.saturation = - attrib->saturation * ((float)ws->mSAttribs.saturation / - COLOR); + pA.opacity = attrib->opacity * ((float)ws->mSAttribs.opacity / OPAQUE); + pA.brightness = attrib->brightness * + ((float)ws->mSAttribs.brightness / BRIGHT); + pA.saturation = attrib->saturation * + ((float)ws->mSAttribs.saturation / COLOR); } + if (!pA.opacity || !pA.brightness) + return TRUE; + UNWRAP(ws, w->screen, paintWindow); status = (*w->screen->paintWindow) (w, &pA, transform, region, mask); WRAP(ws, w->screen, paintWindow, wallPaintWindow); @@ -1740,33 +1832,6 @@ static void wallDonePaintScreen(CompScreen * s) ws->boxTimeout = 0; damageScreen(s); } - if (ws->grabbedWindow && !ws->moving) - { - if (ws->pointerX >= (s->width - 1)) - { - wallMoveViewport(s, -1, 0, None); - if (ws->moving) - warpPointer(s, 10 - s->width, 0); - } - else if (ws->pointerX <= 1) - { - wallMoveViewport(s, 1, 0, None); - if (ws->moving) - warpPointer(s, s->width - 10, 0); - } - else if (ws->pointerY >= (s->height - 1)) - { - wallMoveViewport(s, 0, -1, None); - if (ws->moving) - warpPointer(s, 0, -(s->height - 10)); - } - else if (ws->pointerY <= (1)) - { - wallMoveViewport(s, 0, 1, None); - if (ws->moving) - warpPointer(s, 0, (s->height - 10)); - } - } UNWRAP(ws, s, donePaintScreen); (*s->donePaintScreen) (s); @@ -1953,22 +2018,31 @@ static void wallDisplayInitOptions(WallDisplay * wd) WALL_MOVE_OPTION(RIGHT, Right) WALL_MOVE_OPTION(UP, Up) WALL_MOVE_OPTION(DOWN, Down) - WALL_MOVE_OPTION(NEXT, Next) - o->value.action.edgeButton = Button4; - o->value.action.state |= CompActionStateInitEdge; - o->value.action.type |= CompBindingTypeEdgeButton; - o->value.action.edgeMask = 1 << SCREEN_EDGE_LEFT; - o->value.action.edgeMask |= 1 << SCREEN_EDGE_RIGHT; - o->value.action.edgeMask |= 1 << SCREEN_EDGE_TOP; - o->value.action.edgeMask |= 1 << SCREEN_EDGE_BOTTOM; WALL_MOVE_OPTION(PREV, Prev) - o->value.action.edgeButton = Button5; - o->value.action.state |= CompActionStateInitEdge; - o->value.action.type |= CompBindingTypeEdgeButton; - o->value.action.edgeMask = 1 << SCREEN_EDGE_LEFT; - o->value.action.edgeMask |= 1 << SCREEN_EDGE_RIGHT; - o->value.action.edgeMask |= 1 << SCREEN_EDGE_TOP; - o->value.action.edgeMask |= 1 << SCREEN_EDGE_BOTTOM; + WALL_MOVE_OPTION(NEXT, Next) + +#define WALL_MOVE_FLIP_OPTION(UPPER,LOWERCASE,EDGE) \ + o = &wd->opt [WALL_DISPLAY_OPTION_FLIP_##UPPER]; \ + o->advanced = False; \ + o->name = "flip_##LOWERCASE"; \ + o->group = N_("Viewport Switching"); \ + o->subGroup = N_(""); \ + o->displayHints = ""; \ + o->shortDesc = N_("Move "#LOWERCASE); \ + o->longDesc = N_("Move along the wall "#LOWERCASE); \ + o->type = CompOptionTypeAction; \ + o->value.action.initiate = wallFlip##LOWERCASE; \ + o->value.action.terminate = 0; \ + o->value.action.bell = 0; \ + o->value.action.edgeMask = (1 << SCREEN_EDGE_##EDGE); \ + o->value.action.state = CompActionStateInitEdge; \ + o->value.action.state |= CompActionStateInitEdgeDnd; \ + o->value.action.type = CompBindingTypeNone; + + WALL_MOVE_FLIP_OPTION(LEFT, Left, LEFT) + WALL_MOVE_FLIP_OPTION(RIGHT, Right, RIGHT) + WALL_MOVE_FLIP_OPTION(UP, Up, TOP) + WALL_MOVE_FLIP_OPTION(DOWN, Down, BOTTOM) #define WALL_MOVE_WITH_WINDOW_OPTION(UPPER,LOWERCASE) \ o = &wd->opt [WALL_DISPLAY_OPTION_WINDOW_##UPPER]; \ @@ -2092,6 +2166,39 @@ static void wallDisplayInitOptions(WallDisplay * wd) o->longDesc = N_("Allow wrap-around when moving the wall up/down/left/right"); o->type = CompOptionTypeBool; o->value.b = WALL_ALLOW_WRAPAROUND_DEFAULT; + + o = &wd->opt[WALL_DISPLAY_OPTION_EDGEFLIP_POINTER]; + o->advanced = False; + o->name = "edgeflip_pointer"; + o->group = N_("Viewport Switching"); + o->subGroup = N_("Edge Flip"); + o->displayHints = ""; + o->shortDesc = N_("Edge Flip Pointer"); + o->longDesc = N_("Flip viewport when moving the pointer to a screen edge."); + o->type = CompOptionTypeBool; + o->value.b = WALL_EDGEFLIP_POINTER_DEFAULT; + + o = &wd->opt[WALL_DISPLAY_OPTION_EDGEFLIP_MOVE]; + o->advanced = False; + o->name = "edgeflip_move"; + o->group = N_("Viewport Switching"); + o->subGroup = N_("Edge Flip"); + o->displayHints = ""; + o->shortDesc = N_("Edge Flip Move"); + o->longDesc = N_("Flip viewport when moving a window to a screen edge."); + o->type = CompOptionTypeBool; + o->value.b = WALL_EDGEFLIP_MOVE_DEFAULT; + + o = &wd->opt[WALL_DISPLAY_OPTION_EDGEFLIP_DND]; + o->advanced = False; + o->name = "edgeflip_dnd"; + o->group = N_("Viewport Switching"); + o->subGroup = N_("Edge Flip"); + o->displayHints = ""; + o->shortDesc = N_("Edge Flip DnD"); + o->longDesc = N_("Flip viewport when dragging an object to a screen edge."); + o->type = CompOptionTypeBool; + o->value.b = WALL_EDGEFLIP_DND_DEFAULT; } static CompOption *wallGetDisplayOptions(CompDisplay * d, int *count) @@ -2107,7 +2214,7 @@ static CompOption *wallGetDisplayOptions(CompDisplay * d, int *count) WallDisplay *wd = malloc(sizeof(WallDisplay)); wallDisplayInitOptions(wd); - *count = NUM_OPTIONS(wd); + *count = NUM_OPTIONS(wd) - 4; return wd->opt; } } @@ -2137,6 +2244,10 @@ wallSetDisplayOption(CompDisplay * d, char *name, CompOptionValue * value) case WALL_DISPLAY_OPTION_WINDOW_RIGHT: case WALL_DISPLAY_OPTION_WINDOW_UP: case WALL_DISPLAY_OPTION_WINDOW_DOWN: + case WALL_DISPLAY_OPTION_FLIP_LEFT: + case WALL_DISPLAY_OPTION_FLIP_RIGHT: + case WALL_DISPLAY_OPTION_FLIP_UP: + case WALL_DISPLAY_OPTION_FLIP_DOWN: case WALL_DISPLAY_OPTION_WHEEL_UP: case WALL_DISPLAY_OPTION_WHEEL_DOWN: case WALL_DISPLAY_OPTION_NEXT: @@ -2148,6 +2259,9 @@ wallSetDisplayOption(CompDisplay * d, char *name, CompOptionValue * value) case WALL_DISPLAY_OPTION_MIPMAPS: case WALL_DISPLAY_OPTION_MINISCREEN: case WALL_DISPLAY_OPTION_ALLOW_WRAPAROUND: + case WALL_DISPLAY_OPTION_EDGEFLIP_POINTER: + case WALL_DISPLAY_OPTION_EDGEFLIP_MOVE: + case WALL_DISPLAY_OPTION_EDGEFLIP_DND: if (compSetBoolOption(o, value)) return TRUE; break; @@ -2165,7 +2279,7 @@ wallSetDisplayOption(CompDisplay * d, char *name, CompOptionValue * value) { if (strcmp(o->value.s, expoAnimationName[i]) == 0) { - gs->tabBarStyle = i; + wd->expoAnimationType = i; return TRUE; } } @@ -2250,7 +2364,6 @@ static Bool wallInitScreen(CompPlugin * p, CompScreen * s) ws->expoCam = 0.0f; ws->expoMode = 0; - ws->grabbedWindow = NULL; ws->stickyWindow = NULL; ws->moveWindow = None; ws->size = 3.0; // Size is kind of misleading it's more like amount zoomed out for miniviews... @@ -2259,14 +2372,16 @@ static Bool wallInitScreen(CompPlugin * p, CompScreen * s) ws->dndWindow = NULL; addScreenAction(s, &wd->opt[WALL_DISPLAY_OPTION_EXPO].value.action); + addScreenAction(s, &wd->opt[WALL_DISPLAY_OPTION_FLIP_LEFT].value.action); + addScreenAction(s, &wd->opt[WALL_DISPLAY_OPTION_FLIP_RIGHT].value.action); + addScreenAction(s, &wd->opt[WALL_DISPLAY_OPTION_FLIP_UP].value.action); + addScreenAction(s, &wd->opt[WALL_DISPLAY_OPTION_FLIP_DOWN].value.action); WRAP(ws, s, paintScreen, wallPaintScreen); WRAP(ws, s, donePaintScreen, wallDonePaintScreen); WRAP(ws, s, paintTransformedScreen, wallPaintTransformedScreen); WRAP(ws, s, preparePaintScreen, wallPreparePaintScreen); WRAP(ws, s, paintWindow, wallPaintWindow); - WRAP(ws, s, windowGrabNotify, wallWindowGrabNotify); - WRAP(ws, s, windowUngrabNotify, wallWindowUngrabNotify); WRAP(ws, s, damageWindowRect, wallDamageWindowRect); s->privates[wd->screenPrivateIndex].ptr = ws; @@ -2282,14 +2397,16 @@ static void wallFiniScreen(CompPlugin * p, CompScreen * s) free(wd->opt[WALL_DISPLAY_OPTION_EXPO_ANIMATION].value.s); removeScreenAction(s, &wd->opt[WALL_DISPLAY_OPTION_EXPO].value.action); + removeScreenAction(s, &wd->opt[WALL_DISPLAY_OPTION_FLIP_LEFT].value.action); + removeScreenAction(s, &wd->opt[WALL_DISPLAY_OPTION_FLIP_RIGHT].value.action); + removeScreenAction(s, &wd->opt[WALL_DISPLAY_OPTION_FLIP_UP].value.action); + removeScreenAction(s, &wd->opt[WALL_DISPLAY_OPTION_FLIP_DOWN].value.action); UNWRAP(ws, s, paintScreen); UNWRAP(ws, s, donePaintScreen); UNWRAP(ws, s, paintTransformedScreen); UNWRAP(ws, s, preparePaintScreen); UNWRAP(ws, s, paintWindow); - UNWRAP(ws, s, windowGrabNotify); - UNWRAP(ws, s, windowUngrabNotify); UNWRAP(ws, s, damageWindowRect); free(ws); |