7
* Copyright (c) 2006 Robert Carr <racarr@beryl-project.org>
10
* Robert Carr <racarr@beryl-project.org>
11
* Dennis Kasprzyk <onestone@opencompositing.org>
13
* This program is free software; you can redistribute it and/or
14
* modify it under the terms of the GNU General Public License
15
* as published by the Free Software Foundation; either version 2
16
* of the License, or (at your option) any later version.
18
* This program is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU General Public License for more details.
31
#include <compiz-core.h>
32
#include "wall_options.h"
36
#include <cairo-xlib-xrender.h>
39
#define PI 3.14159265359f
40
#define VIEWPORT_SWITCHER_SIZE 100
43
#define WIN_X(w) ((w)->attrib.x - (w)->input.left)
44
#define WIN_Y(w) ((w)->attrib.y - (w)->input.top)
45
#define WIN_W(w) ((w)->width + (w)->input.left + (w)->input.right)
46
#define WIN_H(w) ((w)->height + (w)->input.top + (w)->input.bottom)
48
#define getColorRGBA(name, _display) \
49
r = wallGet##name##Red(_display) / 65535.0f;\
50
g = wallGet##name##Green(_display) / 65535.0f; \
51
b = wallGet##name##Blue(_display) / 65535.0f; \
52
a = wallGet##name##Alpha(_display) / 65535.0f
54
static int WallDisplayPrivateIndex;
55
static int WallCorePrivateIndex;
71
} ScreenTransformation;
73
typedef struct _WallCairoContext
78
cairo_surface_t *surface;
85
typedef struct _WallCore
87
ObjectAddProc objectAdd;
88
SetOptionForPluginProc setOptionForPlugin;
91
typedef struct _WallDisplay
93
int screenPrivateIndex;
95
HandleEventProc handleEvent;
96
MatchExpHandlerChangedProc matchExpHandlerChanged;
97
MatchPropertyChangedProc matchPropertyChanged;
100
typedef struct _WallScreen
102
int windowPrivateIndex;
104
DonePaintScreenProc donePaintScreen;
105
PaintOutputProc paintOutput;
106
PaintScreenProc paintScreen;
107
PreparePaintScreenProc preparePaintScreen;
108
PaintTransformedOutputProc paintTransformedOutput;
109
PaintWindowProc paintWindow;
110
WindowGrabNotifyProc windowGrabNotify;
111
WindowUngrabNotifyProc windowUngrabNotify;
112
ActivateWindowProc activateWindow;
114
Bool moving; /* Used to track miniview movement */
121
int direction; /* >= 0 : direction arrow angle, < 0 : no direction */
131
CompWindow *grabWindow;
135
ScreenTransformation transform;
136
CompOutput *currOutput;
138
WindowPaintAttrib mSAttribs;
150
WallCairoContext switcherContext;
151
WallCairoContext thumbContext;
152
WallCairoContext highlightContext;
153
WallCairoContext arrowContext;
156
typedef struct _WallWindow
162
#define WALL_CORE(c) PLUGIN_CORE(c, Wall, w)
163
#define WALL_DISPLAY(d) PLUGIN_DISPLAY(d, Wall, w)
164
#define WALL_SCREEN(s) PLUGIN_SCREEN(s, Wall, w)
165
#define WALL_WINDOW(w) PLUGIN_WINDOW(w, Wall, w)
170
xid = getIntOptionNamed(option, nOption, "root", 0);\
171
s = findScreenAtDisplay(d, xid); \
175
#define sigmoid(x) (1.0f / (1.0f + exp (-5.5f * 2 * ((x) - 0.5))))
176
#define sigmoidProgress(x) ((sigmoid (x) - sigmoid (0)) / \
177
(sigmoid (1) - sigmoid (0)))
181
wallClearCairoLayer (cairo_t *cr)
184
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
190
wallDrawSwitcherBackground (CompScreen *s)
193
cairo_pattern_t *pattern;
194
float outline = 2.0f;
195
int width, height, radius;
201
cr = ws->switcherContext.cr;
202
wallClearCairoLayer (cr);
204
width = ws->switcherContext.width - outline;
205
height = ws->switcherContext.height - outline;
208
cairo_translate (cr, outline / 2.0f, outline / 2.0f);
210
/* set the pattern for the switcher's background */
211
pattern = cairo_pattern_create_linear (0, 0, width, height);
212
getColorRGBA (BackgroundGradientBaseColor, s->display);
213
cairo_pattern_add_color_stop_rgba (pattern, 0.00f, r, g, b, a);
214
getColorRGBA (BackgroundGradientHighlightColor, s->display);
215
cairo_pattern_add_color_stop_rgba (pattern, 0.65f, r, g, b, a);
216
getColorRGBA (BackgroundGradientShadowColor, s->display);
217
cairo_pattern_add_color_stop_rgba (pattern, 0.85f, r, g, b, a);
218
cairo_set_source (cr, pattern);
220
/* draw the border's shape */
221
radius = wallGetEdgeRadius (s->display);
224
cairo_arc (cr, radius, radius, radius, PI, 1.5f * PI);
225
cairo_arc (cr, radius + width - 2 * radius,
226
radius, radius, 1.5f * PI, 2.0 * PI);
227
cairo_arc (cr, width - radius, height - radius, radius, 0, PI / 2.0f);
228
cairo_arc (cr, radius, height - radius, radius, PI / 2.0f, PI);
231
cairo_rectangle (cr, 0, 0, width, height);
233
cairo_close_path (cr);
235
/* apply pattern to background... */
236
cairo_fill_preserve (cr);
238
/* ... and draw an outline */
239
cairo_set_line_width (cr, outline);
240
getColorRGBA (OutlineColor, s->display);
241
cairo_set_source_rgba (cr, r, g, b, a);
244
cairo_pattern_destroy (pattern);
248
for (i = 0; i < s->vsize; i++)
250
cairo_translate (cr, 0.0, ws->viewportBorder);
252
for (j = 0; j < s->hsize; j++)
254
cairo_translate (cr, ws->viewportBorder, 0.0);
256
/* this cuts a hole into our background */
257
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
258
cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0);
259
cairo_rectangle (cr, 0, 0, ws->viewportWidth, ws->viewportHeight);
261
cairo_fill_preserve (cr);
262
cairo_set_operator (cr, CAIRO_OPERATOR_XOR);
265
cairo_translate (cr, ws->viewportWidth, 0.0);
269
cairo_translate (cr, 0.0, ws->viewportHeight);
275
wallDrawThumb (CompScreen *s)
278
cairo_pattern_t *pattern;
280
float outline = 2.0f;
285
cr = ws->thumbContext.cr;
286
wallClearCairoLayer (cr);
288
width = ws->thumbContext.width - outline;
289
height = ws->thumbContext.height - outline;
291
cairo_translate (cr, outline / 2.0f, outline / 2.0f);
293
pattern = cairo_pattern_create_linear (0, 0, width, height);
294
getColorRGBA (ThumbGradientBaseColor, s->display);
295
cairo_pattern_add_color_stop_rgba (pattern, 0.0f, r, g, b, a);
296
getColorRGBA (ThumbGradientHighlightColor, s->display);
297
cairo_pattern_add_color_stop_rgba (pattern, 1.0f, r, g, b, a);
299
/* apply the pattern for thumb background */
300
cairo_set_source (cr, pattern);
301
cairo_rectangle (cr, 0, 0, width, height);
302
cairo_fill_preserve (cr);
304
cairo_set_line_width (cr, outline);
305
getColorRGBA (OutlineColor, s->display);
306
cairo_set_source_rgba (cr, r, g, b, a);
309
cairo_pattern_destroy (pattern);
315
wallDrawHighlight(CompScreen *s)
318
cairo_pattern_t *pattern;
321
float outline = 2.0f;
326
cr = ws->highlightContext.cr;
327
wallClearCairoLayer (cr);
329
width = ws->highlightContext.width - outline;
330
height = ws->highlightContext.height - outline;
332
cairo_translate (cr, outline / 2.0f, outline / 2.0f);
334
pattern = cairo_pattern_create_linear (0, 0, width, height);
335
getColorRGBA (ThumbHighlightGradientBaseColor, s->display);
336
cairo_pattern_add_color_stop_rgba (pattern, 0.0f, r, g, b, a);
337
getColorRGBA (ThumbHighlightGradientShadowColor, s->display);
338
cairo_pattern_add_color_stop_rgba (pattern, 1.0f, r, g, b, a);
340
/* apply the pattern for thumb background */
341
cairo_set_source (cr, pattern);
342
cairo_rectangle (cr, 0, 0, width, height);
343
cairo_fill_preserve (cr);
345
cairo_set_line_width (cr, outline);
346
getColorRGBA (OutlineColor, s->display);
347
cairo_set_source_rgba (cr, r, g, b, a);
350
cairo_pattern_destroy (pattern);
356
wallDrawArrow (CompScreen *s)
359
float outline = 2.0f;
364
cr = ws->arrowContext.cr;
365
wallClearCairoLayer (cr);
367
cairo_translate (cr, outline / 2.0f, outline / 2.0f);
369
/* apply the pattern for thumb background */
370
cairo_set_line_width (cr, outline);
372
/* draw top part of the arrow */
373
getColorRGBA (ArrowBaseColor, s->display);
374
cairo_set_source_rgba (cr, r, g, b, a);
375
cairo_move_to (cr, 15, 0);
376
cairo_line_to (cr, 30, 30);
377
cairo_line_to (cr, 15, 24.5);
378
cairo_line_to (cr, 15, 0);
381
/* draw bottom part of the arrow */
382
getColorRGBA (ArrowShadowColor, s->display);
383
cairo_set_source_rgba (cr, r, g, b, a);
384
cairo_move_to (cr, 15, 0);
385
cairo_line_to (cr, 0, 30);
386
cairo_line_to (cr, 15, 24.5);
387
cairo_line_to (cr, 15, 0);
390
/* draw the arrow outline */
391
getColorRGBA (OutlineColor, s->display);
392
cairo_set_source_rgba (cr, r, g, b, a);
393
cairo_move_to (cr, 15, 0);
394
cairo_line_to (cr, 30, 30);
395
cairo_line_to (cr, 15, 24.5);
396
cairo_line_to (cr, 0, 30);
397
cairo_line_to (cr, 15, 0);
404
wallSetupCairoContext (CompScreen *s,
405
WallCairoContext *context)
407
XRenderPictFormat *format;
411
screen = ScreenOfDisplay (s->display->display, s->screenNum);
413
width = context->width;
414
height = context->height;
416
initTexture (s, &context->texture);
418
format = XRenderFindStandardFormat (s->display->display,
421
context->pixmap = XCreatePixmap (s->display->display, s->root,
424
if (!bindPixmapToTexture(s, &context->texture, context->pixmap,
427
compLogMessage ("wall", CompLogLevelError,
428
"Couldn't create cairo context for switcher");
432
cairo_xlib_surface_create_with_xrender_format (s->display->display,
437
context->cr = cairo_create (context->surface);
438
wallClearCairoLayer (context->cr);
442
wallDestroyCairoContext (CompScreen *s,
443
WallCairoContext *context)
446
cairo_destroy (context->cr);
448
if (context->surface)
449
cairo_surface_destroy (context->surface);
451
finiTexture (s, &context->texture);
454
XFreePixmap (s->display->display, context->pixmap);
458
wallCheckDestination (CompScreen *s,
462
if (s->x - destX < 0)
465
if (s->x - destX >= s->hsize)
468
if (s->y - destY >= s->vsize)
471
if (s->y - destY < 0)
478
wallReleaseMoveWindow (CompScreen *s)
483
w = findWindowAtScreen (s, ws->moveWindow);
485
syncWindowPosition (w);
491
wallComputeTranslation (CompScreen *s,
495
float dx, dy, elapsed, duration;
499
duration = wallGetSlideDuration (s->display) * 1000.0;
501
elapsed = 1.0 - (ws->timer / duration);
510
/* Use temporary variables to you can pass in &ps->cur_x */
511
dx = (ws->gotoX - ws->curPosX) * elapsed + ws->curPosX;
512
dy = (ws->gotoY - ws->curPosY) * elapsed + ws->curPosY;
518
/* movement remainder that gets ignored for direction calculation */
519
#define IGNORE_REMAINDER 0.05
522
wallDetermineMovementAngle (CompScreen *s)
529
dx = ws->gotoX - ws->curPosX;
530
dy = ws->gotoY - ws->curPosY;
532
if (dy > IGNORE_REMAINDER)
533
angle = (dx > IGNORE_REMAINDER) ? 135 :
534
(dx < -IGNORE_REMAINDER) ? 225 : 180;
535
else if (dy < -IGNORE_REMAINDER)
536
angle = (dx > IGNORE_REMAINDER) ? 45 :
537
(dx < -IGNORE_REMAINDER) ? 315 : 0;
539
angle = (dx > IGNORE_REMAINDER) ? 90 :
540
(dx < -IGNORE_REMAINDER) ? 270 : -1;
542
ws->direction = angle;
546
wallMoveViewport (CompScreen *s,
556
if (otherScreenGrabExist (s, "move", "switcher", "group-drag", "wall", NULL))
559
if (!wallCheckDestination (s, x, y))
562
if (ws->moveWindow != moveWindow)
566
wallReleaseMoveWindow (s);
567
w = findWindowAtScreen (s, moveWindow);
570
if (!(w->type & (CompWindowTypeDesktopMask |
571
CompWindowTypeDockMask)))
573
if (!(w->state & CompWindowStateStickyMask))
575
ws->moveWindow = w->id;
576
ws->moveWindowX = w->attrib.x;
577
ws->moveWindowY = w->attrib.y;
589
ws->gotoX = s->x - x;
590
ws->gotoY = s->y - y;
592
wallDetermineMovementAngle (s);
595
ws->grabIndex = pushScreenGrab (s, s->invisibleCursor, "wall");
597
moveScreenViewport (s, x, y, TRUE);
600
ws->focusDefault = TRUE;
601
ws->boxOutputDevice = outputDeviceForPoint (s, pointerX, pointerY);
603
if (wallGetShowSwitcher (s->display))
604
ws->boxTimeout = wallGetPreviewTimeout (s->display) * 1000;
608
ws->timer = wallGetSlideDuration (s->display) * 1000;
616
wallHandleEvent (CompDisplay *d,
621
switch (event->type) {
623
if (event->xclient.message_type == d->desktopViewportAtom)
628
s = findScreenAtDisplay (d, event->xclient.window);
632
if (otherScreenGrabExist (s, "switcher", "wall", NULL))
635
dx = event->xclient.data.l[0] / s->width - s->x;
636
dy = event->xclient.data.l[1] / s->height - s->y;
641
wallMoveViewport (s, -dx, -dy, None);
646
UNWRAP (wd, d, handleEvent);
647
(*d->handleEvent) (d, event);
648
WRAP (wd, d, handleEvent, wallHandleEvent);
652
wallActivateWindow (CompWindow *w)
654
CompScreen *s = w->screen;
658
if (w->placed && !otherScreenGrabExist (s, "wall", "switcher", NULL))
662
defaultViewportForWindow (w, &dx, &dy);
668
wallMoveViewport (s, -dx, -dy, None);
669
ws->focusDefault = FALSE;
673
UNWRAP (ws, s, activateWindow);
674
(*s->activateWindow) (w);
675
WRAP (ws, s, activateWindow, wallActivateWindow);
679
wallCheckAmount (CompScreen *s,
688
if (wallGetAllowWraparound (s->display))
691
*amountX = -(s->hsize + dx);
692
else if ((s->x + dx) >= s->hsize)
693
*amountX = s->hsize - dx;
696
*amountY = -(s->vsize + dy);
697
else if ((s->y + dy) >= s->vsize)
698
*amountY = s->vsize - dy;
703
wallInitiate (CompScreen *s,
708
CompActionState state)
710
int amountX, amountY;
714
wallCheckAmount (s, dx, dy, &amountX, &amountY);
715
if (!wallMoveViewport (s, amountX, amountY, win))
718
if (state & CompActionStateInitKey)
719
action->state |= CompActionStateTermKey;
721
if (state & CompActionStateInitButton)
722
action->state |= CompActionStateTermButton;
724
ws->showPreview = wallGetShowSwitcher (s->display);
730
wallTerminate (CompDisplay *d,
732
CompActionState state,
738
for (s = d->screens; s; s = s->next)
744
ws->showPreview = FALSE;
750
action->state &= ~(CompActionStateTermKey | CompActionStateTermButton);
756
wallInitiateFlip (CompScreen *s,
761
int amountX, amountY;
763
if (otherScreenGrabExist (s, "wall", "move", "group-drag", NULL))
768
if (!wallGetEdgeflipDnd (s))
771
if (otherScreenGrabExist (s, "wall", NULL))
774
else if (otherScreenGrabExist (s, "wall", "group-drag", NULL))
776
/* not wall or group means move */
777
if (!wallGetEdgeflipMove (s))
785
/* bail out if window is sticky */
786
if (ws->grabWindow->state & CompWindowStateStickyMask)
789
else if (otherScreenGrabExist (s, "wall", NULL))
791
/* move was ruled out before, so we have group */
792
if (!wallGetEdgeflipDnd (s))
795
else if (!wallGetEdgeflipPointer (s))
816
wallCheckAmount (s, dx, dy, &amountX, &amountY);
817
if (wallMoveViewport (s, amountX, amountY, None))
819
int offsetX, offsetY;
824
offsetX = s->width - 10;
825
warpX = pointerX + s->width;
829
offsetX = 1- s->width;
830
warpX = pointerX - s->width;
835
warpX = lastPointerX;
840
offsetY = s->height - 10;
841
warpY = pointerY + s->height;
845
offsetY = 1- s->height;
846
warpY = pointerY - s->height;
851
warpY = lastPointerY;
854
warpPointer (s, offsetX, offsetY);
855
lastPointerX = warpX;
856
lastPointerY = warpY;
863
wallLeft (CompDisplay *d,
865
CompActionState state,
871
return wallInitiate (s, -1, 0, None, action, state);
875
wallRight (CompDisplay *d,
877
CompActionState state,
883
return wallInitiate (s, 1, 0, None, action, state);
887
wallUp (CompDisplay *d,
889
CompActionState state,
895
return wallInitiate (s, 0, -1, None, action, state);
899
wallDown (CompDisplay *d,
901
CompActionState state,
907
return wallInitiate (s, 0, 1, None, action, state);
911
wallNext (CompDisplay *d,
913
CompActionState state,
917
int amountX, amountY;
920
if ((s->x == s->hsize - 1) && (s->y == s->vsize - 1))
922
amountX = -(s->hsize - 1);
923
amountY = -(s->vsize - 1);
925
else if (s->x == s->hsize - 1)
927
amountX = -(s->hsize - 1);
936
return wallInitiate (s, amountX, amountY, None, action, state);
940
wallPrev (CompDisplay *d,
942
CompActionState state,
946
int amountX, amountY;
949
if ((s->x == 0) && (s->y == 0))
951
amountX = s->hsize - 1;
952
amountY = s->vsize - 1;
956
amountX = s->hsize - 1;
965
return wallInitiate (s, amountX, amountY, None, action, state);
969
wallFlipLeft (CompDisplay *d,
971
CompActionState state,
977
return wallInitiateFlip (s, Left, (state & CompActionStateInitEdgeDnd));
981
wallFlipRight (CompDisplay *d,
983
CompActionState state,
989
return wallInitiateFlip (s, Right, (state & CompActionStateInitEdgeDnd));
993
wallFlipUp (CompDisplay *d,
995
CompActionState state,
1001
return wallInitiateFlip (s, Up, (state & CompActionStateInitEdgeDnd));
1005
wallFlipDown (CompDisplay *d,
1007
CompActionState state,
1013
return wallInitiateFlip (s, Down, (state & CompActionStateInitEdgeDnd));
1017
wallLeftWithWindow (CompDisplay *d,
1019
CompActionState state,
1024
Window win = getIntOptionNamed (option, nOption, "window", 0);
1026
return wallInitiate (s, -1, 0, win, action, state);
1030
wallRightWithWindow (CompDisplay *d,
1032
CompActionState state,
1037
Window win = getIntOptionNamed (option, nOption, "window", 0);
1039
return wallInitiate (s, 1, 0, win, action, state);
1043
wallUpWithWindow (CompDisplay *d,
1045
CompActionState state,
1050
Window win = getIntOptionNamed (option, nOption, "window", 0);
1052
return wallInitiate (s, 0, -1, win, action, state);
1056
wallDownWithWindow (CompDisplay *d,
1058
CompActionState state,
1063
Window win = getIntOptionNamed (option, nOption, "window", 0);
1065
return wallInitiate (s, 0, 1, win, action, state);
1069
wallDrawQuad (CompMatrix *matrix, BOX *box)
1071
glTexCoord2f (COMP_TEX_COORD_X (matrix, box->x1),
1072
COMP_TEX_COORD_Y (matrix, box->y2));
1073
glVertex2i (box->x1, box->y2);
1074
glTexCoord2f (COMP_TEX_COORD_X (matrix, box->x2),
1075
COMP_TEX_COORD_Y (matrix, box->y2));
1076
glVertex2i (box->x2, box->y2);
1077
glTexCoord2f (COMP_TEX_COORD_X (matrix, box->x2),
1078
COMP_TEX_COORD_Y (matrix, box->y1));
1079
glVertex2i (box->x2, box->y1);
1080
glTexCoord2f (COMP_TEX_COORD_X (matrix, box->x1),
1081
COMP_TEX_COORD_Y (matrix, box->y1));
1082
glVertex2i (box->x1, box->y1);
1086
wallDrawCairoTextureOnScreen (CompScreen *s)
1088
float centerX, centerY;
1089
float width, height;
1090
float topLeftX, topLeftY;
1098
glDisableClientState (GL_TEXTURE_COORD_ARRAY);
1099
glEnable (GL_BLEND);
1101
centerX = s->outputDev[ws->boxOutputDevice].region.extents.x1 +
1102
(s->outputDev[ws->boxOutputDevice].width / 2.0f);
1103
centerY = s->outputDev[ws->boxOutputDevice].region.extents.y1 +
1104
(s->outputDev[ws->boxOutputDevice].height / 2.0f);
1106
border = (float) ws->viewportBorder;
1107
width = (float) ws->switcherContext.width;
1108
height = (float) ws->switcherContext.height;
1110
topLeftX = centerX - floor (width / 2.0f);
1111
topLeftY = centerY - floor (height / 2.0f);
1113
ws->firstViewportX = topLeftX + border;
1114
ws->firstViewportY = topLeftY + border;
1118
double left, timeout;
1120
timeout = wallGetPreviewTimeout (s->display) * 1000.0f;
1121
left = (timeout > 0) ? (float) ws->boxTimeout / timeout : 1.0f;
1125
else if (left > 0.5)
1130
screenTexEnvMode (s, GL_MODULATE);
1132
glColor4f (left, left, left, left);
1133
glTranslatef (0.0f,0.0f, -(1 - left));
1135
ws->mSzCamera = -(1 - left);
1138
ws->mSzCamera = 0.0f;
1140
/* draw background */
1142
matrix = ws->switcherContext.texture.matrix;
1143
matrix.x0 -= topLeftX * matrix.xx;
1144
matrix.y0 -= topLeftY * matrix.yy;
1147
box.x2 = box.x1 + width;
1149
box.y2 = box.y1 + height;
1151
enableTexture (s, &ws->switcherContext.texture, COMP_TEXTURE_FILTER_FAST);
1153
wallDrawQuad (&matrix, &box);
1155
disableTexture (s, &ws->switcherContext.texture);
1158
width = (float) ws->thumbContext.width;
1159
height = (float) ws->thumbContext.height;
1161
enableTexture (s, &ws->thumbContext.texture, COMP_TEXTURE_FILTER_FAST);
1163
for (i = 0; i < s->hsize; i++)
1165
for (j = 0; j < s->vsize; j++)
1167
if (i == ws->gotoX && j == ws->gotoY && ws->moving)
1170
box.x1 = i * (width + border);
1171
box.x1 += topLeftX + border;
1172
box.x2 = box.x1 + width;
1173
box.y1 = j * (height + border);
1174
box.y1 += topLeftY + border;
1175
box.y2 = box.y1 + height;
1177
matrix = ws->thumbContext.texture.matrix;
1178
matrix.x0 -= box.x1 * matrix.xx;
1179
matrix.y0 -= box.y1 * matrix.yy;
1181
wallDrawQuad (&matrix, &box);
1185
disableTexture (s, &ws->thumbContext.texture);
1187
if (ws->moving || ws->showPreview)
1189
/* draw highlight */
1192
box.x1 = s->x * (width + border) + topLeftX + border;
1193
box.x2 = box.x1 + width;
1194
box.y1 = s->y * (height + border) + topLeftY + border;
1195
box.y2 = box.y1 + height;
1197
matrix = ws->highlightContext.texture.matrix;
1198
matrix.x0 -= box.x1 * matrix.xx;
1199
matrix.y0 -= box.y1 * matrix.yy;
1201
enableTexture (s, &ws->highlightContext.texture,
1202
COMP_TEXTURE_FILTER_FAST);
1204
wallDrawQuad (&matrix, &box);
1206
disableTexture (s, &ws->highlightContext.texture);
1209
if (ws->direction >= 0)
1211
enableTexture (s, &ws->arrowContext.texture,
1212
COMP_TEXTURE_FILTER_GOOD);
1214
aW = ws->arrowContext.width;
1215
aH = ws->arrowContext.height;
1217
/* if we have a viewport preview we just paint the
1218
arrow outside the switcher */
1219
if (wallGetMiniscreen (s->display))
1221
width = (float) ws->switcherContext.width;
1222
height = (float) ws->switcherContext.height;
1224
switch (ws->direction)
1228
box.x1 = topLeftX - aW - border;
1229
box.y1 = topLeftY - aH - border;
1233
box.x1 = topLeftX + width / 2.0f - aW / 2.0f;
1234
box.y1 = topLeftY - aH - border;
1238
box.x1 = topLeftX + width + border;
1239
box.y1 = topLeftY - aH - border;
1243
box.x1 = topLeftX + width + border;
1244
box.y1 = topLeftY + height / 2.0f - aH / 2.0f;
1248
box.x1 = topLeftX + width + border;
1249
box.y1 = topLeftY + height + border;
1253
box.x1 = topLeftX + width / 2.0f - aW / 2.0f;
1254
box.y1 = topLeftY + height + border;
1258
box.x1 = topLeftX - aW - border;
1259
box.y1 = topLeftY + height + border;
1263
box.x1 = topLeftX - aW - border;
1264
box.y1 = topLeftY + height / 2.0f - aH / 2.0f;
1272
/* arrow is visible (no preview is painted over it) */
1273
box.x1 = s->x * (width + border) + topLeftX + border;
1274
box.x1 += width / 2 - aW / 2;
1275
box.y1 = s->y * (height + border) + topLeftY + border;
1276
box.y1 += height / 2 - aH / 2;
1279
box.x2 = box.x1 + aW;
1280
box.y2 = box.y1 + aH;
1282
glTranslatef (box.x1 + aW / 2, box.y1 + aH / 2, 0.0f);
1283
glRotatef (ws->direction, 0.0f, 0.0f, 1.0f);
1284
glTranslatef (-box.x1 - aW / 2, -box.y1 - aH / 2, 0.0f);
1286
matrix = ws->arrowContext.texture.matrix;
1287
matrix.x0 -= box.x1 * matrix.xx;
1288
matrix.y0 -= box.y1 * matrix.yy;
1291
wallDrawQuad (&matrix, &box);
1294
disableTexture (s, &ws->arrowContext.texture);
1298
glDisable (GL_BLEND);
1299
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
1300
screenTexEnvMode (s, GL_REPLACE);
1301
glColor4usv (defaultColor);
1305
wallPaintScreen (CompScreen *s,
1306
CompOutput *outputs,
1312
if (ws->moving && numOutputs > 1 && wallGetMmmode(s) == MmmodeSwitchAll)
1314
outputs = &s->fullscreenOutput;
1318
UNWRAP (ws, s, paintScreen);
1319
(*s->paintScreen) (s, outputs, numOutputs, mask);
1320
WRAP (ws, s, paintScreen, wallPaintScreen);
1324
wallPaintOutput (CompScreen *s,
1325
const ScreenPaintAttrib *sAttrib,
1326
const CompTransform *transform,
1335
ws->transform = NoTransformation;
1337
mask |= PAINT_SCREEN_TRANSFORMED_MASK |
1338
PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
1340
UNWRAP (ws, s, paintOutput);
1341
status = (*s->paintOutput) (s, sAttrib, transform, region, output, mask);
1342
WRAP (ws, s, paintOutput, wallPaintOutput);
1344
if (wallGetShowSwitcher (s->display) &&
1345
(ws->moving || ws->showPreview || ws->boxTimeout) &&
1346
(output->id == ws->boxOutputDevice || output == &s->fullscreenOutput))
1348
CompTransform sTransform = *transform;
1350
transformToScreenSpace (s, output, -DEFAULT_Z_CAMERA, &sTransform);
1353
glLoadMatrixf (sTransform.m);
1355
wallDrawCairoTextureOnScreen (s);
1359
if (wallGetMiniscreen (s->display))
1364
mw = ws->viewportWidth;
1365
mh = ws->viewportHeight;
1367
ws->transform = MiniScreen;
1368
ws->mSAttribs.xScale = mw / s->width;
1369
ws->mSAttribs.yScale = mh / s->height;
1370
ws->mSAttribs.opacity = OPAQUE * (1.0 + ws->mSzCamera);
1371
ws->mSAttribs.saturation = COLOR;
1373
for (j = 0; j < s->vsize; j++)
1375
for (i = 0; i < s->hsize; i++)
1378
unsigned int msMask;
1380
mx = ws->firstViewportX +
1381
(i * (ws->viewportWidth + ws->viewportBorder));
1382
my = ws->firstViewportY +
1383
(j * (ws->viewportHeight + ws->viewportBorder));
1385
ws->mSAttribs.xTranslate = mx / output->width;
1386
ws->mSAttribs.yTranslate = -my / output->height;
1388
ws->mSAttribs.brightness = 0.4f * BRIGHT;
1390
if (i == s->x && j == s->y && ws->moving)
1391
ws->mSAttribs.brightness = BRIGHT;
1393
if ((ws->boxTimeout || ws->showPreview) &&
1394
!ws->moving && i == s->x && j == s->y)
1396
ws->mSAttribs.brightness = BRIGHT;
1399
setWindowPaintOffset (s, (s->x - i) * s->width,
1400
(s->y - j) * s->height);
1402
msMask = mask | PAINT_SCREEN_TRANSFORMED_MASK;
1403
(*s->paintTransformedOutput) (s, sAttrib, transform,
1404
region, output, msMask);
1409
ws->transform = NoTransformation;
1410
setWindowPaintOffset (s, 0, 0);
1418
wallPreparePaintScreen (CompScreen *s,
1419
int msSinceLastPaint)
1423
if (!ws->moving && !ws->showPreview && ws->boxTimeout)
1424
ws->boxTimeout -= msSinceLastPaint;
1427
ws->timer -= msSinceLastPaint;
1431
wallComputeTranslation (s, &ws->curPosX, &ws->curPosY);
1437
w = findWindowAtScreen (s, ws->moveWindow);
1442
dx = ws->gotoX - ws->curPosX;
1443
dy = ws->gotoY - ws->curPosY;
1445
moveWindowToViewportPosition (w,
1446
ws->moveWindowX - s->width * dx,
1447
ws->moveWindowY - s->height * dy,
1453
if (ws->moving && ws->curPosX == ws->gotoX && ws->curPosY == ws->gotoY)
1459
wallReleaseMoveWindow (s);
1460
else if (ws->focusDefault)
1463
for (i = 0; i < s->maxGrab; i++)
1464
if (s->grabs[i].active)
1465
if (strcmp(s->grabs[i].name, "switcher") == 0)
1468
/* only focus default window if switcher is not active */
1469
if (i == s->maxGrab)
1470
focusDefaultWindow (s);
1474
UNWRAP (ws, s, preparePaintScreen);
1475
(*s->preparePaintScreen) (s, msSinceLastPaint);
1476
WRAP (ws, s, preparePaintScreen, wallPreparePaintScreen);
1480
wallPaintTransformedOutput (CompScreen *s,
1481
const ScreenPaintAttrib *sAttrib,
1482
const CompTransform *transform,
1488
Bool clear = (mask & PAINT_SCREEN_CLEAR_MASK);
1490
if (ws->transform == MiniScreen)
1492
CompTransform sTransform = *transform;
1494
mask &= ~PAINT_SCREEN_CLEAR_MASK;
1496
/* move each screen to the correct output position */
1498
matrixTranslate (&sTransform,
1499
-(float) output->region.extents.x1 /
1500
(float) output->width,
1501
(float) output->region.extents.y1 /
1502
(float) output->height, 0.0f);
1503
matrixTranslate (&sTransform, 0.0f, 0.0f, -DEFAULT_Z_CAMERA);
1505
matrixTranslate (&sTransform,
1506
ws->mSAttribs.xTranslate,
1507
ws->mSAttribs.yTranslate,
1510
/* move origin to top left */
1511
matrixTranslate (&sTransform, -0.5f, 0.5f, 0.0f);
1512
matrixScale (&sTransform,
1513
ws->mSAttribs.xScale, ws->mSAttribs.yScale, 1.0);
1515
/* revert prepareXCoords region shift.
1516
Now all screens display the same */
1517
matrixTranslate (&sTransform, 0.5f, 0.5f, DEFAULT_Z_CAMERA);
1518
matrixTranslate (&sTransform,
1519
(float) output->region.extents.x1 /
1520
(float) output->width,
1521
-(float) output->region.extents.y2 /
1522
(float) output->height, 0.0f);
1524
UNWRAP (ws, s, paintTransformedOutput);
1525
(*s->paintTransformedOutput) (s, sAttrib, &sTransform,
1526
&s->region, output, mask);
1527
WRAP (ws, s, paintTransformedOutput, wallPaintTransformedOutput);
1531
UNWRAP (ws, s, paintTransformedOutput);
1534
(*s->paintTransformedOutput) (s, sAttrib, transform,
1535
region, output, mask);
1537
mask &= ~PAINT_SCREEN_CLEAR_MASK;
1541
ScreenTransformation oldTransform = ws->transform;
1542
CompTransform sTransform = *transform;
1543
float xTranslate, yTranslate;
1546
Bool movingX, movingY;
1549
clearTargetOutput (s->display, GL_COLOR_BUFFER_BIT);
1551
ws->transform = Sliding;
1552
ws->currOutput = output;
1557
movingX = ((int) floor (px)) != ((int) ceil (px));
1558
movingY = ((int) floor (py)) != ((int) ceil (py));
1562
ty = ceil (py) - s->y;
1563
yTranslate = fmod (py, 1) - 1;
1565
matrixTranslate (&sTransform, 0.0f, yTranslate, 0.0f);
1569
tx = ceil (px) - s->x;
1570
xTranslate = 1 - fmod (px, 1);
1572
setWindowPaintOffset (s, (s->x - ceil(px)) * s->width,
1573
(s->y - ceil(py)) * s->height);
1575
matrixTranslate (&sTransform, xTranslate, 0.0f, 0.0f);
1577
(*s->paintTransformedOutput) (s, sAttrib, &sTransform,
1578
&output->region, output, mask);
1580
matrixTranslate (&sTransform, -xTranslate, 0.0f, 0.0f);
1583
tx = floor (px) - s->x;
1584
xTranslate = -fmod (px, 1);
1586
setWindowPaintOffset (s, (s->x - floor(px)) * s->width,
1587
(s->y - ceil(py)) * s->height);
1589
matrixTranslate (&sTransform, xTranslate, 0.0f, 0.0f);
1591
(*s->paintTransformedOutput) (s, sAttrib, &sTransform,
1592
&output->region, output, mask);
1593
matrixTranslate (&sTransform, -xTranslate, -yTranslate, 0.0f);
1596
ty = floor (py) - s->y;
1597
yTranslate = fmod (py, 1);
1599
matrixTranslate (&sTransform, 0.0f, yTranslate, 0.0f);
1603
tx = ceil (px) - s->x;
1604
xTranslate = 1 - fmod (px, 1);
1606
setWindowPaintOffset (s, (s->x - ceil(px)) * s->width,
1607
(s->y - floor(py)) * s->height);
1609
matrixTranslate (&sTransform, xTranslate, 0.0f, 0.0f);
1611
(*s->paintTransformedOutput) (s, sAttrib, &sTransform,
1612
&output->region, output, mask);
1614
matrixTranslate (&sTransform, -xTranslate, 0.0f, 0.0f);
1617
tx = floor (px) - s->x;
1618
xTranslate = -fmod (px, 1);
1620
setWindowPaintOffset (s, (s->x - floor(px)) * s->width,
1621
(s->y - floor(py)) * s->height);
1623
matrixTranslate (&sTransform, xTranslate, 0.0f, 0.0f);
1624
(*s->paintTransformedOutput) (s, sAttrib, &sTransform,
1625
&output->region, output, mask);
1627
setWindowPaintOffset (s, 0, 0);
1628
ws->transform = oldTransform;
1631
WRAP (ws, s, paintTransformedOutput, wallPaintTransformedOutput);
1635
wallPaintWindow (CompWindow *w,
1636
const WindowPaintAttrib *attrib,
1637
const CompTransform *transform,
1642
CompScreen *s = w->screen;
1646
if (ws->transform == MiniScreen)
1648
WindowPaintAttrib pA = *attrib;
1650
pA.opacity = attrib->opacity *
1651
((float) ws->mSAttribs.opacity / OPAQUE);
1652
pA.brightness = attrib->brightness *
1653
((float) ws->mSAttribs.brightness / BRIGHT);
1654
pA.saturation = attrib->saturation *
1655
((float) ws->mSAttribs.saturation / COLOR);
1657
if (!pA.opacity || !pA.brightness)
1658
mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK;
1660
UNWRAP (ws, s, paintWindow);
1661
status = (*s->paintWindow) (w, &pA, transform, region, mask);
1662
WRAP (ws, s, paintWindow, wallPaintWindow);
1664
else if (ws->transform == Sliding)
1666
CompTransform wTransform;
1672
matrixGetIdentity (&wTransform);
1673
transformToScreenSpace (s, ws->currOutput, -DEFAULT_Z_CAMERA,
1675
mask |= PAINT_WINDOW_TRANSFORMED_MASK;
1679
wTransform = *transform;
1682
UNWRAP (ws, s, paintWindow);
1683
status = (*s->paintWindow) (w, attrib, &wTransform, region, mask);
1684
WRAP (ws, s, paintWindow, wallPaintWindow);
1688
UNWRAP (ws, s, paintWindow);
1689
status = (*s->paintWindow) (w, attrib, transform, region, mask);
1690
WRAP (ws, s, paintWindow, wallPaintWindow);
1697
wallDonePaintScreen (CompScreen *s)
1701
if (ws->moving || ws->showPreview || ws->boxTimeout)
1703
ws->boxTimeout = MAX (0, ws->boxTimeout);
1707
if (!ws->moving && !ws->showPreview && ws->grabIndex)
1709
removeScreenGrab (s, ws->grabIndex, NULL);
1713
UNWRAP (ws, s, donePaintScreen);
1714
(*s->donePaintScreen) (s);
1715
WRAP (ws, s, donePaintScreen, wallDonePaintScreen);
1720
wallCreateCairoContexts (CompScreen *s,
1727
ws->viewportWidth = VIEWPORT_SWITCHER_SIZE *
1728
(float) wallGetPreviewScale (s->display) / 100.0f;
1729
ws->viewportHeight = ws->viewportWidth *
1730
(float) s->height / (float) s->width;
1731
ws->viewportBorder = wallGetBorderWidth (s->display);
1733
width = s->hsize * (ws->viewportWidth + ws->viewportBorder) +
1735
height = s->vsize * (ws->viewportHeight + ws->viewportBorder) +
1738
wallDestroyCairoContext (s, &ws->switcherContext);
1739
ws->switcherContext.width = width;
1740
ws->switcherContext.height = height;
1741
wallSetupCairoContext (s, &ws->switcherContext);
1742
wallDrawSwitcherBackground (s);
1744
wallDestroyCairoContext (s, &ws->thumbContext);
1745
ws->thumbContext.width = ws->viewportWidth;
1746
ws->thumbContext.height = ws->viewportHeight;
1747
wallSetupCairoContext (s, &ws->thumbContext);
1750
wallDestroyCairoContext (s, &ws->highlightContext);
1751
ws->highlightContext.width = ws->viewportWidth;
1752
ws->highlightContext.height = ws->viewportHeight;
1753
wallSetupCairoContext (s, &ws->highlightContext);
1754
wallDrawHighlight (s);
1758
ws->arrowContext.width = ARROW_SIZE;
1759
ws->arrowContext.height = ARROW_SIZE;
1760
wallSetupCairoContext (s, &ws->arrowContext);
1766
wallDisplayOptionChanged (CompDisplay *display,
1768
WallDisplayOptions num)
1774
case WallDisplayOptionOutlineColor:
1775
for (s = display->screens; s; s = s->next)
1777
wallDrawSwitcherBackground (s);
1778
wallDrawHighlight (s);
1783
case WallDisplayOptionEdgeRadius:
1784
case WallDisplayOptionBackgroundGradientBaseColor:
1785
case WallDisplayOptionBackgroundGradientHighlightColor:
1786
case WallDisplayOptionBackgroundGradientShadowColor:
1787
for (s = display->screens; s; s = s->next)
1788
wallDrawSwitcherBackground (s);
1791
case WallDisplayOptionBorderWidth:
1792
case WallDisplayOptionPreviewScale:
1793
for (s = display->screens; s; s = s->next)
1794
wallCreateCairoContexts (s, FALSE);
1797
case WallDisplayOptionThumbGradientBaseColor:
1798
case WallDisplayOptionThumbGradientHighlightColor:
1799
for (s = display->screens; s; s = s->next)
1803
case WallDisplayOptionThumbHighlightGradientBaseColor:
1804
case WallDisplayOptionThumbHighlightGradientShadowColor:
1805
for (s = display->screens; s; s = s->next)
1806
wallDrawHighlight (s);
1809
case WallDisplayOptionArrowBaseColor:
1810
case WallDisplayOptionArrowShadowColor:
1811
for (s = display->screens; s; s = s->next)
1815
case WallDisplayOptionNoSlideMatch:
1816
for (s = display->screens; s; s = s->next)
1820
for (w = s->windows; w; w = w->next)
1823
ww->isSliding = !matchEval (wallGetNoSlideMatch (display), w);
1834
wallSetOptionForPlugin (CompObject *o,
1837
CompOptionValue *value)
1843
UNWRAP (wc, &core, setOptionForPlugin);
1844
status = (*core.setOptionForPlugin) (o, plugin, name, value);
1845
WRAP (wc, &core, setOptionForPlugin, wallSetOptionForPlugin);
1847
if (status && o->type == COMP_OBJECT_TYPE_SCREEN)
1849
if (strcmp (plugin, "core") == 0)
1850
if (strcmp (name, "hsize") == 0 || strcmp (name, "vsize") == 0)
1852
CompScreen *s = (CompScreen *) o;
1854
wallCreateCairoContexts (s, FALSE);
1862
wallMatchExpHandlerChanged (CompDisplay *d)
1868
UNWRAP (wd, d, matchExpHandlerChanged);
1869
(*d->matchExpHandlerChanged) (d);
1870
WRAP (wd, d, matchExpHandlerChanged, wallMatchExpHandlerChanged);
1872
for (s = d->screens; s; s = s->next)
1876
for (w = s->windows; w; w = w->next)
1880
ww->isSliding = !matchEval (wallGetNoSlideMatch (d), w);
1886
wallMatchPropertyChanged (CompDisplay *d,
1892
UNWRAP (wd, d, matchPropertyChanged);
1893
(*d->matchPropertyChanged) (d, w);
1894
WRAP (wd, d, matchPropertyChanged, wallMatchPropertyChanged);
1896
ww->isSliding = !matchEval (wallGetNoSlideMatch (d), w);
1900
wallWindowGrabNotify (CompWindow *w,
1906
WALL_SCREEN (w->screen);
1908
if (!ws->grabWindow)
1911
UNWRAP (ws, w->screen, windowGrabNotify);
1912
(*w->screen->windowGrabNotify) (w, x, y, state, mask);
1913
WRAP (ws, w->screen, windowGrabNotify, wallWindowGrabNotify);
1917
wallWindowUngrabNotify (CompWindow *w)
1919
WALL_SCREEN (w->screen);
1921
if (w == ws->grabWindow)
1922
ws->grabWindow = NULL;
1924
UNWRAP (ws, w->screen, windowUngrabNotify);
1925
(*w->screen->windowUngrabNotify) (w);
1926
WRAP (ws, w->screen, windowUngrabNotify, wallWindowUngrabNotify);
1930
wallWindowAdd (CompScreen *s,
1935
ww->isSliding = !matchEval (wallGetNoSlideMatch (s->display), w);
1939
wallObjectAdd (CompObject *parent,
1942
static ObjectAddProc dispTab[] = {
1943
(ObjectAddProc) 0, /* CoreAdd */
1944
(ObjectAddProc) 0, /* DisplayAdd */
1945
(ObjectAddProc) 0, /* ScreenAdd */
1946
(ObjectAddProc) wallWindowAdd
1951
UNWRAP (wc, &core, objectAdd);
1952
(*core.objectAdd) (parent, object);
1953
WRAP (wc, &core, objectAdd, wallObjectAdd);
1955
DISPATCH (object, dispTab, ARRAY_SIZE (dispTab), (parent, object));
1959
wallInitCore (CompPlugin *p,
1964
if (!checkPluginABI ("core", CORE_ABIVERSION))
1967
wc = malloc (sizeof (WallCore));
1971
WallDisplayPrivateIndex = allocateDisplayPrivateIndex ();
1972
if (WallDisplayPrivateIndex < 0)
1978
WRAP (wc, c, setOptionForPlugin, wallSetOptionForPlugin);
1979
WRAP (wc, c, objectAdd, wallObjectAdd);
1981
c->base.privates[WallCorePrivateIndex].ptr = wc;
1987
wallFiniCore (CompPlugin *p,
1992
UNWRAP (wc, c, setOptionForPlugin);
1993
UNWRAP (wc, c, objectAdd);
1995
freeDisplayPrivateIndex (WallDisplayPrivateIndex);
2001
wallInitDisplay (CompPlugin *p,
2006
wd = malloc (sizeof (WallDisplay));
2010
wd->screenPrivateIndex = allocateScreenPrivateIndex (d);
2011
if (wd->screenPrivateIndex < 0)
2017
wallSetLeftKeyInitiate (d, wallLeft);
2018
wallSetLeftKeyTerminate (d, wallTerminate);
2019
wallSetRightKeyInitiate (d, wallRight);
2020
wallSetRightKeyTerminate (d, wallTerminate);
2021
wallSetUpKeyInitiate (d, wallUp);
2022
wallSetUpKeyTerminate (d, wallTerminate);
2023
wallSetDownKeyInitiate (d, wallDown);
2024
wallSetDownKeyTerminate (d, wallTerminate);
2025
wallSetNextKeyInitiate (d, wallNext);
2026
wallSetNextKeyTerminate (d, wallTerminate);
2027
wallSetPrevKeyInitiate (d, wallPrev);
2028
wallSetPrevKeyTerminate (d, wallTerminate);
2029
wallSetLeftButtonInitiate (d, wallLeft);
2030
wallSetLeftButtonTerminate (d, wallTerminate);
2031
wallSetRightButtonInitiate (d, wallRight);
2032
wallSetRightButtonTerminate (d, wallTerminate);
2033
wallSetUpButtonInitiate (d, wallUp);
2034
wallSetUpButtonTerminate (d, wallTerminate);
2035
wallSetDownButtonInitiate (d, wallDown);
2036
wallSetDownButtonTerminate (d, wallTerminate);
2037
wallSetNextButtonInitiate (d, wallNext);
2038
wallSetNextButtonTerminate (d, wallTerminate);
2039
wallSetPrevButtonInitiate (d, wallPrev);
2040
wallSetPrevButtonTerminate (d, wallTerminate);
2041
wallSetLeftWindowKeyInitiate (d, wallLeftWithWindow);
2042
wallSetLeftWindowKeyTerminate (d, wallTerminate);
2043
wallSetRightWindowKeyInitiate (d, wallRightWithWindow);
2044
wallSetRightWindowKeyTerminate (d, wallTerminate);
2045
wallSetUpWindowKeyInitiate (d, wallUpWithWindow);
2046
wallSetUpWindowKeyTerminate (d, wallTerminate);
2047
wallSetDownWindowKeyInitiate (d, wallDownWithWindow);
2048
wallSetDownWindowKeyTerminate (d, wallTerminate);
2049
wallSetFlipLeftEdgeInitiate (d, wallFlipLeft);
2050
wallSetFlipRightEdgeInitiate (d, wallFlipRight);
2051
wallSetFlipUpEdgeInitiate (d, wallFlipUp);
2052
wallSetFlipDownEdgeInitiate (d, wallFlipDown);
2054
wallSetEdgeRadiusNotify (d, wallDisplayOptionChanged);
2055
wallSetBorderWidthNotify (d, wallDisplayOptionChanged);
2056
wallSetPreviewScaleNotify (d, wallDisplayOptionChanged);
2057
wallSetOutlineColorNotify (d, wallDisplayOptionChanged);
2058
wallSetBackgroundGradientBaseColorNotify (d, wallDisplayOptionChanged);
2059
wallSetBackgroundGradientHighlightColorNotify (d, wallDisplayOptionChanged);
2060
wallSetBackgroundGradientShadowColorNotify (d, wallDisplayOptionChanged);
2061
wallSetThumbGradientBaseColorNotify (d, wallDisplayOptionChanged);
2062
wallSetThumbGradientHighlightColorNotify (d, wallDisplayOptionChanged);
2063
wallSetThumbHighlightGradientBaseColorNotify (d, wallDisplayOptionChanged);
2064
wallSetThumbHighlightGradientShadowColorNotify (d,
2065
wallDisplayOptionChanged);
2066
wallSetArrowBaseColorNotify (d, wallDisplayOptionChanged);
2067
wallSetArrowShadowColorNotify (d, wallDisplayOptionChanged);
2068
wallSetNoSlideMatchNotify (d, wallDisplayOptionChanged);
2070
WRAP (wd, d, handleEvent, wallHandleEvent);
2071
WRAP (wd, d, matchExpHandlerChanged, wallMatchExpHandlerChanged);
2072
WRAP (wd, d, matchPropertyChanged, wallMatchPropertyChanged);
2074
d->base.privates[WallDisplayPrivateIndex].ptr = wd;
2080
wallFiniDisplay (CompPlugin *p,
2085
UNWRAP (wd, d, handleEvent);
2086
UNWRAP (wd, d, matchExpHandlerChanged);
2087
UNWRAP (wd, d, matchPropertyChanged);
2089
freeScreenPrivateIndex (d, wd->screenPrivateIndex);
2094
wallInitScreen (CompPlugin *p,
2099
WALL_DISPLAY (s->display);
2101
ws = malloc (sizeof (WallScreen));
2105
ws->windowPrivateIndex = allocateWindowPrivateIndex (s);
2106
if (ws->windowPrivateIndex < 0)
2117
ws->showPreview = FALSE;
2118
ws->focusDefault = TRUE;
2119
ws->moveWindow = None;
2120
ws->grabWindow = NULL;
2122
ws->transform = NoTransformation;
2125
memset (&ws->switcherContext, 0, sizeof (WallCairoContext));
2126
memset (&ws->thumbContext, 0, sizeof (WallCairoContext));
2127
memset (&ws->highlightContext, 0, sizeof (WallCairoContext));
2128
memset (&ws->arrowContext, 0, sizeof (WallCairoContext));
2130
WRAP (ws, s, paintScreen, wallPaintScreen);
2131
WRAP (ws, s, paintOutput, wallPaintOutput);
2132
WRAP (ws, s, donePaintScreen, wallDonePaintScreen);
2133
WRAP (ws, s, paintTransformedOutput, wallPaintTransformedOutput);
2134
WRAP (ws, s, preparePaintScreen, wallPreparePaintScreen);
2135
WRAP (ws, s, paintWindow, wallPaintWindow);
2136
WRAP (ws, s, windowGrabNotify, wallWindowGrabNotify);
2137
WRAP (ws, s, windowUngrabNotify, wallWindowUngrabNotify);
2138
WRAP (ws, s, activateWindow, wallActivateWindow);
2140
s->base.privates[wd->screenPrivateIndex].ptr = ws;
2142
wallCreateCairoContexts (s, TRUE);
2148
wallFiniScreen (CompPlugin *p,
2154
removeScreenGrab (s, ws->grabIndex, NULL);
2156
wallDestroyCairoContext (s, &ws->switcherContext);
2157
wallDestroyCairoContext (s, &ws->thumbContext);
2158
wallDestroyCairoContext (s, &ws->highlightContext);
2159
wallDestroyCairoContext (s, &ws->arrowContext);
2161
UNWRAP (ws, s, paintScreen);
2162
UNWRAP (ws, s, paintOutput);
2163
UNWRAP (ws, s, donePaintScreen);
2164
UNWRAP (ws, s, paintTransformedOutput);
2165
UNWRAP (ws, s, preparePaintScreen);
2166
UNWRAP (ws, s, paintWindow);
2167
UNWRAP (ws, s, windowGrabNotify);
2168
UNWRAP (ws, s, windowUngrabNotify);
2169
UNWRAP (ws, s, activateWindow);
2171
freeWindowPrivateIndex (s, ws->windowPrivateIndex);
2177
wallInitWindow (CompPlugin *p,
2182
WALL_SCREEN (w->screen);
2184
ww = malloc (sizeof (WallWindow));
2188
ww->isSliding = TRUE;
2190
w->base.privates[ws->windowPrivateIndex].ptr = ww;
2196
wallFiniWindow (CompPlugin *p,
2205
wallInitObject (CompPlugin *p,
2208
static InitPluginObjectProc dispTab[] = {
2209
(InitPluginObjectProc) wallInitCore,
2210
(InitPluginObjectProc) wallInitDisplay,
2211
(InitPluginObjectProc) wallInitScreen,
2212
(InitPluginObjectProc) wallInitWindow
2215
RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
2219
wallFiniObject (CompPlugin *p,
2222
static FiniPluginObjectProc dispTab[] = {
2223
(FiniPluginObjectProc) wallFiniCore,
2224
(FiniPluginObjectProc) wallFiniDisplay,
2225
(FiniPluginObjectProc) wallFiniScreen,
2226
(FiniPluginObjectProc) wallFiniWindow
2229
DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
2233
wallInit (CompPlugin *p)
2235
WallCorePrivateIndex = allocateCorePrivateIndex ();
2236
if (WallCorePrivateIndex < 0)
2243
wallFini (CompPlugin *p)
2245
freeCorePrivateIndex (WallCorePrivateIndex);
2248
CompPluginVTable wallVTable = {
2260
getCompPluginInfo (void)