summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorracarr <racarr@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-01-24 10:58:19 +0000
committerracarr <racarr@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-01-24 10:58:19 +0000
commit045ba4cb32fa3e1c16216ff8809bd40db9c2ed77 (patch)
treea5f6f2d27646d56bdcf42ddc15c05ce8da8c25e4
parentcf2abe773b6536e55c6d76d5444fac69ccf70773 (diff)
downloadmarex-dev-045ba4cb32fa3e1c16216ff8809bd40db9c2ed77.tar.gz
marex-dev-045ba4cb32fa3e1c16216ff8809bd40db9c2ed77.tar.bz2
indent.sh on plugins
git-svn-id: file:///beryl/trunk@3081 d7aaf104-2d23-0410-ae22-9d23157bf5a3
-rw-r--r--beryl-plugins/src/3d.c245
-rw-r--r--beryl-plugins/src/animation.c401
-rw-r--r--beryl-plugins/src/annotate.c16
-rw-r--r--beryl-plugins/src/blurfx.c29
-rw-r--r--beryl-plugins/src/cube.c33
-rw-r--r--beryl-plugins/src/dbus.c1856
-rw-r--r--beryl-plugins/src/decoration.c56
-rw-r--r--beryl-plugins/src/fade.c9
-rw-r--r--beryl-plugins/src/inputzoom.c48
-rw-r--r--beryl-plugins/src/jpeg.c130
-rw-r--r--beryl-plugins/src/move.c63
-rw-r--r--beryl-plugins/src/opacify.c40
-rw-r--r--beryl-plugins/src/png.c12
-rw-r--r--beryl-plugins/src/put.c12
-rw-r--r--beryl-plugins/src/resize.c21
-rw-r--r--beryl-plugins/src/rotate.c35
-rw-r--r--beryl-plugins/src/scale.c222
-rw-r--r--beryl-plugins/src/screenshot.c3
-rw-r--r--beryl-plugins/src/snap.c787
-rw-r--r--beryl-plugins/src/snow.c32
-rw-r--r--beryl-plugins/src/splash.c3
-rw-r--r--beryl-plugins/src/state.c22
-rw-r--r--beryl-plugins/src/svg.c15
-rw-r--r--beryl-plugins/src/switcher.c11
-rw-r--r--beryl-plugins/src/thumbnail.c885
-rw-r--r--beryl-plugins/src/trailfocus2.c32
-rw-r--r--beryl-plugins/src/wobbly.c64
27 files changed, 2582 insertions, 2500 deletions
diff --git a/beryl-plugins/src/3d.c b/beryl-plugins/src/3d.c
index f511881..c4c99b3 100644
--- a/beryl-plugins/src/3d.c
+++ b/beryl-plugins/src/3d.c
@@ -24,7 +24,6 @@
/**
TODO:
1. Add 3d shadows / projections.
- 2. Add width to windows.
3. Add an option to select z-order of windows not only by viewports but also by screens.
4. Fix 3d for inside cube and planed / unfolded cube.
5. Find a better solution for blur cache + 3d.
@@ -406,8 +405,7 @@ static void tdPreparePaintScreen(CompScreen * screen, int msSinceLastPaint)
tds->currentDifferentResolutions = differentResolutions(screen);
if (tds->currentViewportNum > 2
- && (tds->currentMmMode != Multiple
- || screen->nOutputDev == 1))
+ && (tds->currentMmMode != Multiple || screen->nOutputDev == 1))
tds->xMove =
1.0f /
(tan
@@ -503,10 +501,10 @@ tdPaintWindow(CompWindow * w,
//Window painting is done twice, once in reverse mode and one in normal.
//We should paint it only in the needed mode.
- if ( ( (w->attrib.y + w->attrib.height) > w->screen->workArea.height)
- && (w->attrib.x > w->screen->workArea.x) && ( (w->attrib.x + w->attrib.width )
- < w->screen->workArea.width ) )
-
+ if (((w->attrib.y + w->attrib.height) > w->screen->workArea.height)
+ && (w->attrib.x > w->screen->workArea.x) &&
+ ((w->attrib.x + w->attrib.width) < w->screen->workArea.width))
+
mask |= PAINT_WINDOW_TRANSFORMED_MASK;
@@ -606,149 +604,164 @@ tdPaintWindow(CompWindow * w,
glTranslatef(-width * tdw->currentZ * tds->xMove, 0.0f, 0.0f);
}
- int wx,wy,wh,ww;
+ int wx, wy, wh, ww;
+
wx = w->attrib.x - w->input.left;
wy = w->attrib.y - w->input.top;
- ww = w->attrib.width+w->input.left+w->input.right;
+ ww = w->attrib.width + w->input.left + w->input.right;
wh = w->attrib.height + w->input.top + w->input.bottom;
- if (wx+ww > w->screen->workArea.width)
+ if (wx + ww > w->screen->workArea.width)
{
- ww -= (wx+ww)-w->screen->workArea.width;
+ ww -= (wx + ww) - w->screen->workArea.width;
}
if (wx < w->screen->workArea.x)
{
- ww -= (w->screen->workArea.x -wx);
+ ww -= (w->screen->workArea.x - wx);
wx += (w->screen->workArea.x - wx);
}
- float wwidth = - (tds->opt[TD_SCREEN_OPTION_WIDTH].value.f ) / 30;
+ float wwidth = -(tds->opt[TD_SCREEN_OPTION_WIDTH].value.f) / 30;
int bevel = tds->opt[TD_SCREEN_OPTION_BEVEL].value.i;
-
+
glBegin(GL_QUADS);
- glColor4f(.90f,.90f,.90f,1.0f);
+ glColor4f(.90f, .90f, .90f, 1.0f);
- #define DOBEVEL(corner) (GETBEVEL(corner) ? bevel : 0)
+#define DOBEVEL(corner) (GETBEVEL(corner) ? bevel : 0)
- /* Top */
- glVertex3f(wx+DOBEVEL(TOPLEFT),wy,0);
- glVertex3f(wx+ww-DOBEVEL(TOPRIGHT),wy,0);
- glVertex3f(wx + ww-DOBEVEL(TOPRIGHT),wy,(wwidth));
- glVertex3f(wx+DOBEVEL(TOPLEFT),wy,(wwidth));
+ /* Top */
+ glVertex3f(wx + DOBEVEL(TOPLEFT), wy, 0);
+ glVertex3f(wx + ww - DOBEVEL(TOPRIGHT), wy, 0);
+ glVertex3f(wx + ww - DOBEVEL(TOPRIGHT), wy, (wwidth));
+ glVertex3f(wx + DOBEVEL(TOPLEFT), wy, (wwidth));
- /* Bottom */
- glVertex3f(wx+DOBEVEL(BOTTOMLEFT),wy+wh,0);
- glVertex3f(wx+ww-DOBEVEL(BOTTOMRIGHT),wy+wh,0);
- glVertex3f(wx+ww-DOBEVEL(BOTTOMRIGHT),wy+wh,wwidth);
- glVertex3f(wx+DOBEVEL(BOTTOMLEFT),wy+wh,wwidth);
-
-
- glColor4f(.70f,.70f,.70f,1.0f);
+ /* Bottom */
+ glVertex3f(wx + DOBEVEL(BOTTOMLEFT), wy + wh, 0);
+ glVertex3f(wx + ww - DOBEVEL(BOTTOMRIGHT), wy + wh, 0);
+ glVertex3f(wx + ww - DOBEVEL(BOTTOMRIGHT), wy + wh, wwidth);
+ glVertex3f(wx + DOBEVEL(BOTTOMLEFT), wy + wh, wwidth);
- /* Left */
- if (!(w->attrib.x < w->screen->workArea.x))
- {
- glVertex3f(wx,wy+DOBEVEL(TOPLEFT),0);
- glVertex3f(wx,wy+wh-DOBEVEL(BOTTOMLEFT),0);
- glVertex3f(wx,wy+wh-DOBEVEL(BOTTOMLEFT),wwidth);
- glVertex3f(wx,wy+DOBEVEL(TOPLEFT),wwidth);
- }
+ glColor4f(.70f, .70f, .70f, 1.0f);
- /* Right */
- if (!((w->attrib.x+w->attrib.width + w->input.left + w->input.right) > w->screen->workArea.width))
+ /* Left */
+ if (!(w->attrib.x < w->screen->workArea.x))
{
- glVertex3f(wx+ww,wy+DOBEVEL(TOPRIGHT),0);
- glVertex3f(wx+ww,wy+wh-DOBEVEL(BOTTOMRIGHT),0);
- glVertex3f(wx+ww,wy+wh-DOBEVEL(BOTTOMRIGHT),wwidth);
- glVertex3f(wx+ww,wy+DOBEVEL(TOPRIGHT),wwidth);
+ glVertex3f(wx, wy + DOBEVEL(TOPLEFT), 0);
+ glVertex3f(wx, wy + wh - DOBEVEL(BOTTOMLEFT), 0);
+ glVertex3f(wx, wy + wh - DOBEVEL(BOTTOMLEFT), wwidth);
+ glVertex3f(wx, wy + DOBEVEL(TOPLEFT), wwidth);
}
- glColor4f(.95f,.95f,.95f,1.0f);
- if (!(w->attrib.x < w->screen->workArea.x))
- {
- /* Top left bevel */
- if (GETBEVEL(TOPLEFT))
- {
- glVertex3f(wx,wy+bevel,wwidth);
- glVertex3f(wx,wy+bevel,0);
- glVertex3f(wx+bevel/2.0f,wy+bevel-bevel/1.2f,0);
- glVertex3f(wx+bevel/2.0f,wy+bevel-bevel/1.2f,wwidth);
-
- glColor4f(1.0f,1.0f,1.0f,1.0f);
-
- glVertex3f(wx+bevel/2.0f,wy+bevel-bevel/1.2f,0);
- glVertex3f(wx+bevel/2.0f,wy+bevel-bevel/1.2f,wwidth);
- glVertex3f(wx+bevel,wy,wwidth);
- glVertex3f(wx+bevel,wy,0);
-
- glColor4f(.95f,.95f,.95f,1.0f);
- }
- /* Bottom left bevel */
- if (GETBEVEL(BOTTOMLEFT))
+ /* Right */
+ if (!
+ ((w->attrib.x + w->attrib.width + w->input.left +
+ w->input.right) > w->screen->workArea.width))
{
- glVertex3f(wx,wy+wh-bevel,0);
- glVertex3f(wx,wy+wh-bevel,wwidth);
- glVertex3f(wx+bevel/2.0f,wy+wh-bevel+bevel/1.2f,wwidth);
- glVertex3f(wx+bevel/2.0f,wy+wh-bevel+bevel/1.2f,0);
-
- glColor4f(1.0f,1.0f,1.0f,1.0f);
-
- glVertex3f(wx+bevel/2.0f,wy+wh-bevel+bevel/1.2f,wwidth);
- glVertex3f(wx+bevel/2.0f,wy+wh-bevel+bevel/1.2f,0);
- glVertex3f(wx+bevel,wy+wh,0);
- glVertex3f(wx+bevel,wy+wh,wwidth);
+ glVertex3f(wx + ww, wy + DOBEVEL(TOPRIGHT), 0);
+ glVertex3f(wx + ww, wy + wh - DOBEVEL(BOTTOMRIGHT), 0);
+ glVertex3f(wx + ww, wy + wh - DOBEVEL(BOTTOMRIGHT), wwidth);
+ glVertex3f(wx + ww, wy + DOBEVEL(TOPRIGHT), wwidth);
}
- }
- glColor4f(.95f,.95f,.95f,1.0f);
-
-
- if (!((w->attrib.x+w->attrib.width + w->input.left + w->input.right) > w->screen->workArea.width))
- {
+ glColor4f(.95f, .95f, .95f, 1.0f);
- /* Bottom right bevel */
- if (GETBEVEL(BOTTOMRIGHT))
+ if (!(w->attrib.x < w->screen->workArea.x))
{
- glVertex3f(wx+ww-bevel,wy+wh,0);
- glVertex3f(wx+ww-bevel,wy+wh,wwidth);
- glVertex3f(wx+ww-bevel/2.0f,wy+wh-bevel+bevel/1.2f,wwidth);
- glVertex3f(wx+ww-bevel/2.0f,wy+wh-bevel+bevel/1.2f,0);
+ /* Top left bevel */
+ if (GETBEVEL(TOPLEFT))
+ {
+ glVertex3f(wx, wy + bevel, wwidth);
+ glVertex3f(wx, wy + bevel, 0);
+ glVertex3f(wx + bevel / 2.0f, wy + bevel - bevel / 1.2f, 0);
+ glVertex3f(wx + bevel / 2.0f, wy + bevel - bevel / 1.2f,
+ wwidth);
- glColor4f(1.0f,1.0f,1.0f,1.0f);
+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
- glVertex3f(wx+ww-bevel/2.0f,wy+wh-bevel+bevel/1.2f,wwidth);
- glVertex3f(wx+ww-bevel/2.0f,wy+wh-bevel+bevel/1.2f,0);
- glVertex3f(wx+ww,wy+wh-bevel,0);
- glVertex3f(wx+ww,wy+wh-bevel,wwidth);
+ glVertex3f(wx + bevel / 2.0f, wy + bevel - bevel / 1.2f, 0);
+ glVertex3f(wx + bevel / 2.0f, wy + bevel - bevel / 1.2f,
+ wwidth);
+ glVertex3f(wx + bevel, wy, wwidth);
+ glVertex3f(wx + bevel, wy, 0);
- glColor4f(.95f,.95f,.95f,1.0f);
+ glColor4f(.95f, .95f, .95f, 1.0f);
+ }
+ /* Bottom left bevel */
+ if (GETBEVEL(BOTTOMLEFT))
+ {
+ glVertex3f(wx, wy + wh - bevel, 0);
+ glVertex3f(wx, wy + wh - bevel, wwidth);
+ glVertex3f(wx + bevel / 2.0f, wy + wh - bevel + bevel / 1.2f,
+ wwidth);
+ glVertex3f(wx + bevel / 2.0f, wy + wh - bevel + bevel / 1.2f,
+ 0);
+
+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+
+ glVertex3f(wx + bevel / 2.0f, wy + wh - bevel + bevel / 1.2f,
+ wwidth);
+ glVertex3f(wx + bevel / 2.0f, wy + wh - bevel + bevel / 1.2f,
+ 0);
+ glVertex3f(wx + bevel, wy + wh, 0);
+ glVertex3f(wx + bevel, wy + wh, wwidth);
+ }
}
- /* Top right bevel */
- if (GETBEVEL(TOPRIGHT))
- {
- glVertex3f(wx+ww-bevel,wy,0);
- glVertex3f(wx+ww-bevel,wy,wwidth);
- glVertex3f(wx+ww-bevel/2.0f,wy+bevel-bevel/1.2f,wwidth);
- glVertex3f(wx+ww-bevel/2.0f,wy+bevel-bevel/1.2f,0);
- glColor4f(1.0f,1.0f,1.0f,1.0f);
+ glColor4f(.95f, .95f, .95f, 1.0f);
- glVertex3f(wx+ww-bevel/2.0f,wy+bevel-bevel/1.2f,wwidth);
- glVertex3f(wx+ww-bevel/2.0f,wy+bevel-bevel/1.2f,0);
- glVertex3f(wx+ww,wy+bevel,0);
- glVertex3f(wx+ww,wy+bevel,wwidth);
- }
- }
-
+ if (!
+ ((w->attrib.x + w->attrib.width + w->input.left +
+ w->input.right) > w->screen->workArea.width))
+ {
-
- glEnd();
+ /* Bottom right bevel */
+ if (GETBEVEL(BOTTOMRIGHT))
+ {
+ glVertex3f(wx + ww - bevel, wy + wh, 0);
+ glVertex3f(wx + ww - bevel, wy + wh, wwidth);
+ glVertex3f(wx + ww - bevel / 2.0f,
+ wy + wh - bevel + bevel / 1.2f, wwidth);
+ glVertex3f(wx + ww - bevel / 2.0f,
+ wy + wh - bevel + bevel / 1.2f, 0);
+
+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+
+ glVertex3f(wx + ww - bevel / 2.0f,
+ wy + wh - bevel + bevel / 1.2f, wwidth);
+ glVertex3f(wx + ww - bevel / 2.0f,
+ wy + wh - bevel + bevel / 1.2f, 0);
+ glVertex3f(wx + ww, wy + wh - bevel, 0);
+ glVertex3f(wx + ww, wy + wh - bevel, wwidth);
+
+ glColor4f(.95f, .95f, .95f, 1.0f);
+ }
+ /* Top right bevel */
+ if (GETBEVEL(TOPRIGHT))
+ {
+ glVertex3f(wx + ww - bevel, wy, 0);
+ glVertex3f(wx + ww - bevel, wy, wwidth);
+ glVertex3f(wx + ww - bevel / 2.0f, wy + bevel - bevel / 1.2f,
+ wwidth);
+ glVertex3f(wx + ww - bevel / 2.0f, wy + bevel - bevel / 1.2f,
+ 0);
+
+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+
+ glVertex3f(wx + ww - bevel / 2.0f, wy + bevel - bevel / 1.2f,
+ wwidth);
+ glVertex3f(wx + ww - bevel / 2.0f, wy + bevel - bevel / 1.2f,
+ 0);
+ glVertex3f(wx + ww, wy + bevel, 0);
+ glVertex3f(wx + ww, wy + bevel, wwidth);
+ }
+ }
+ glEnd();
}
@@ -939,7 +952,8 @@ static void tdScreenInitOptions(tdScreen * tds)
o->subGroup = N_("");
o->advanced = False;
o->shortDesc = N_("Bevel corners");
- o->longDesc = N_("Roundoff corners for consistency with rounded decorations");
+ o->longDesc =
+ N_("Roundoff corners for consistency with rounded decorations");
o->displayHints = "";
o->type = CompOptionTypeInt;
o->value.f = TD_BEVEL_DEFAULT;
@@ -996,7 +1010,7 @@ static void tdScreenInitOptions(tdScreen * tds)
o->type = CompOptionTypeBool;
o->value.b = TD_SCREEN_OPTION_MANUAL_ONLY_DEFAULT;
- #define BEVELOPTION(CORNER) \
+#define BEVELOPTION(CORNER) \
o = &tds->opt[TD_SCREEN_OPTION_BEVEL_##CORNER]; \
o->name = "bevel_"#CORNER; \
o->group = N_("Misc. Settings"); \
@@ -1078,7 +1092,7 @@ tdSetScreenOption(CompScreen * screen, char *name, CompOptionValue * value)
return TRUE;
break;
case TD_SCREEN_OPTION_BEVEL:
- if (compSetIntOption(o,value))
+ if (compSetIntOption(o, value))
return TRUE;
break;
@@ -1230,7 +1244,8 @@ static void tdFini(CompPlugin * p)
}
CompPluginDep tdDeps[] = {
- {CompPluginRuleAfter, "decoration"},
+ {CompPluginRuleAfter, "decoration"}
+ ,
};
static CompPluginVTable tdVTable = {
diff --git a/beryl-plugins/src/animation.c b/beryl-plugins/src/animation.c
index 993dcc9..13e8378 100644
--- a/beryl-plugins/src/animation.c
+++ b/beryl-plugins/src/animation.c
@@ -110,9 +110,9 @@ typedef struct _Model
int gridWidth;
int gridHeight;
- int winWidth; // keeps win. size when model was created
- int winHeight; //
-
+ int winWidth; // keeps win. size when model was created
+ int winHeight; //
+
float remainderSteps;
Vector scale;
Point scaleOrigin;
@@ -1145,7 +1145,7 @@ static void fxMagicLampInit(CompScreen * s, CompWindow * w)
int screenHeight = s->height;
Bool minimizeToTop = (WIN_Y(w) + WIN_H(w) / 2) >
- (aw->icon.y + aw->icon.height / 2);
+ (aw->icon.y + aw->icon.height / 2);
int maxWaves;
float waveAmpMin, waveAmpMax;
@@ -1397,7 +1397,7 @@ static void fxMagicLampModelStep(CompScreen * s, CompWindow * w, float time)
steps = MAX(1, steps);
Bool minimizeToTop = (WIN_Y(w) + WIN_H(w) / 2) >
- (aw->icon.y + aw->icon.height / 2);
+ (aw->icon.y + aw->icon.height / 2);
for (j = 0; j < steps; j++)
{
@@ -3596,13 +3596,12 @@ animSetScreenOption(CompScreen * screen, char *name, CompOptionValue * value)
if (compSetOptionList(o, value))
{
STORE_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_MINIMIZE_RANDOM_EFFECTS,
- NUM_MINIMIZE_EFFECT,
- ANIM_MINIMIZE_DEFAULT,
- nMinimizeRandomEffects,
- minimizeRandomEffects,
- minimizeEffectName,
- minimizeEffectType);
+ (ANIM_SCREEN_OPTION_MINIMIZE_RANDOM_EFFECTS,
+ NUM_MINIMIZE_EFFECT,
+ ANIM_MINIMIZE_DEFAULT,
+ nMinimizeRandomEffects,
+ minimizeRandomEffects,
+ minimizeEffectName, minimizeEffectType);
return TRUE;
}
break;
@@ -3610,13 +3609,12 @@ animSetScreenOption(CompScreen * screen, char *name, CompOptionValue * value)
if (compSetOptionList(o, value))
{
STORE_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_UNMINIMIZE_RANDOM_EFFECTS,
- NUM_MINIMIZE_EFFECT,
- ANIM_UNMINIMIZE_DEFAULT,
- nUnminimizeRandomEffects,
- unminimizeRandomEffects,
- minimizeEffectName,
- minimizeEffectType);
+ (ANIM_SCREEN_OPTION_UNMINIMIZE_RANDOM_EFFECTS,
+ NUM_MINIMIZE_EFFECT,
+ ANIM_UNMINIMIZE_DEFAULT,
+ nUnminimizeRandomEffects,
+ unminimizeRandomEffects,
+ minimizeEffectName, minimizeEffectType);
return TRUE;
}
break;
@@ -3624,13 +3622,11 @@ animSetScreenOption(CompScreen * screen, char *name, CompOptionValue * value)
if (compSetOptionList(o, value))
{
STORE_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_CLOSE1_RANDOM_EFFECTS,
- NUM_CLOSE_EFFECT,
- ANIM_CLOSE1_DEFAULT,
- nClose1RandomEffects,
- close1RandomEffects,
- closeEffectName,
- closeEffectType);
+ (ANIM_SCREEN_OPTION_CLOSE1_RANDOM_EFFECTS,
+ NUM_CLOSE_EFFECT,
+ ANIM_CLOSE1_DEFAULT,
+ nClose1RandomEffects,
+ close1RandomEffects, closeEffectName, closeEffectType);
return TRUE;
}
break;
@@ -3638,13 +3634,11 @@ animSetScreenOption(CompScreen * screen, char *name, CompOptionValue * value)
if (compSetOptionList(o, value))
{
STORE_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_CLOSE2_RANDOM_EFFECTS,
- NUM_CLOSE_EFFECT,
- ANIM_CLOSE2_DEFAULT,
- nClose2RandomEffects,
- close2RandomEffects,
- closeEffectName,
- closeEffectType);
+ (ANIM_SCREEN_OPTION_CLOSE2_RANDOM_EFFECTS,
+ NUM_CLOSE_EFFECT,
+ ANIM_CLOSE2_DEFAULT,
+ nClose2RandomEffects,
+ close2RandomEffects, closeEffectName, closeEffectType);
return TRUE;
}
break;
@@ -3652,13 +3646,11 @@ animSetScreenOption(CompScreen * screen, char *name, CompOptionValue * value)
if (compSetOptionList(o, value))
{
STORE_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_CREATE1_RANDOM_EFFECTS,
- NUM_CLOSE_EFFECT,
- ANIM_CREATE1_DEFAULT,
- nCreate1RandomEffects,
- create1RandomEffects,
- closeEffectName,
- closeEffectType);
+ (ANIM_SCREEN_OPTION_CREATE1_RANDOM_EFFECTS,
+ NUM_CLOSE_EFFECT,
+ ANIM_CREATE1_DEFAULT,
+ nCreate1RandomEffects,
+ create1RandomEffects, closeEffectName, closeEffectType);
return TRUE;
}
break;
@@ -3666,13 +3658,11 @@ animSetScreenOption(CompScreen * screen, char *name, CompOptionValue * value)
if (compSetOptionList(o, value))
{
STORE_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_CREATE2_RANDOM_EFFECTS,
- NUM_CLOSE_EFFECT,
- ANIM_CREATE2_DEFAULT,
- nCreate2RandomEffects,
- create2RandomEffects,
- closeEffectName,
- closeEffectType);
+ (ANIM_SCREEN_OPTION_CREATE2_RANDOM_EFFECTS,
+ NUM_CLOSE_EFFECT,
+ ANIM_CREATE2_DEFAULT,
+ nCreate2RandomEffects,
+ create2RandomEffects, closeEffectName, closeEffectType);
return TRUE;
}
break;
@@ -3680,13 +3670,11 @@ animSetScreenOption(CompScreen * screen, char *name, CompOptionValue * value)
if (compSetOptionList(o, value))
{
STORE_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_SHADE_RANDOM_EFFECTS,
- NUM_SHADE_EFFECT,
- ANIM_SHADE_DEFAULT,
- nShadeRandomEffects,
- shadeRandomEffects,
- shadeEffectName,
- shadeEffectType);
+ (ANIM_SCREEN_OPTION_SHADE_RANDOM_EFFECTS,
+ NUM_SHADE_EFFECT,
+ ANIM_SHADE_DEFAULT,
+ nShadeRandomEffects,
+ shadeRandomEffects, shadeEffectName, shadeEffectType);
return TRUE;
}
break;
@@ -3694,13 +3682,11 @@ animSetScreenOption(CompScreen * screen, char *name, CompOptionValue * value)
if (compSetOptionList(o, value))
{
STORE_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_UNSHADE_RANDOM_EFFECTS,
- NUM_SHADE_EFFECT,
- ANIM_UNSHADE_DEFAULT,
- nUnshadeRandomEffects,
- unshadeRandomEffects,
- shadeEffectName,
- shadeEffectType);
+ (ANIM_SCREEN_OPTION_UNSHADE_RANDOM_EFFECTS,
+ NUM_SHADE_EFFECT,
+ ANIM_UNSHADE_DEFAULT,
+ nUnshadeRandomEffects,
+ unshadeRandomEffects, shadeEffectName, shadeEffectType);
return TRUE;
}
break;
@@ -3911,7 +3897,9 @@ static void animScreenInitOptions(AnimScreen * as)
o->subGroup = N_("Magic Lamp #1");
o->advanced = False;
o->shortDesc = N_("Magic Lamp #1 Create Start Width");
- o->longDesc = N_("Starting width of create effect and ending width of close effect for Magic Lamp #1.");
+ o->longDesc =
+ N_
+ ("Starting width of create effect and ending width of close effect for Magic Lamp #1.");
o->displayHints = "";
o->type = CompOptionTypeInt;
o->value.i = ANIM_MAGIC_LAMP1_CREATE_START_WIDTH_DEFAULT;
@@ -3984,7 +3972,9 @@ static void animScreenInitOptions(AnimScreen * as)
o->subGroup = N_("Magic Lamp #2");
o->advanced = False;
o->shortDesc = N_("Magic Lamp #2 Create Start Width");
- o->longDesc = N_("Starting width of create effect and ending width of close effect for Magic Lamp #2.");
+ o->longDesc =
+ N_
+ ("Starting width of create effect and ending width of close effect for Magic Lamp #2.");
o->displayHints = "";
o->type = CompOptionTypeInt;
o->value.i = ANIM_MAGIC_LAMP2_CREATE_START_WIDTH_DEFAULT;
@@ -4090,17 +4080,15 @@ static void animScreenInitOptions(AnimScreen * as)
o->rest.f.precision = ANIM_MINIMIZE_DURATION_PRECISION;
INIT_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_MINIMIZE_RANDOM_EFFECTS,
- "minimize", "(Un)Minimize", "Minimize", NUM_MINIMIZE_EFFECT,
- minimizeEffectName);
+ (ANIM_SCREEN_OPTION_MINIMIZE_RANDOM_EFFECTS,
+ "minimize", "(Un)Minimize", "Minimize", NUM_MINIMIZE_EFFECT,
+ minimizeEffectName);
STORE_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_MINIMIZE_RANDOM_EFFECTS,
- NUM_MINIMIZE_EFFECT,
- ANIM_MINIMIZE_DEFAULT,
- nMinimizeRandomEffects,
- minimizeRandomEffects,
- minimizeEffectName,
- minimizeEffectType);
+ (ANIM_SCREEN_OPTION_MINIMIZE_RANDOM_EFFECTS,
+ NUM_MINIMIZE_EFFECT,
+ ANIM_MINIMIZE_DEFAULT,
+ nMinimizeRandomEffects,
+ minimizeRandomEffects, minimizeEffectName, minimizeEffectType);
// Unminimize
@@ -4154,17 +4142,15 @@ static void animScreenInitOptions(AnimScreen * as)
o->rest.f.precision = ANIM_UNMINIMIZE_DURATION_PRECISION;
INIT_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_UNMINIMIZE_RANDOM_EFFECTS,
- "unminimize", "(Un)Minimize", "Unminimize", NUM_MINIMIZE_EFFECT,
- minimizeEffectName);
+ (ANIM_SCREEN_OPTION_UNMINIMIZE_RANDOM_EFFECTS,
+ "unminimize", "(Un)Minimize", "Unminimize", NUM_MINIMIZE_EFFECT,
+ minimizeEffectName);
STORE_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_UNMINIMIZE_RANDOM_EFFECTS,
- NUM_MINIMIZE_EFFECT,
- ANIM_UNMINIMIZE_DEFAULT,
- nUnminimizeRandomEffects,
- unminimizeRandomEffects,
- minimizeEffectName,
- minimizeEffectType);
+ (ANIM_SCREEN_OPTION_UNMINIMIZE_RANDOM_EFFECTS,
+ NUM_MINIMIZE_EFFECT,
+ ANIM_UNMINIMIZE_DEFAULT,
+ nUnminimizeRandomEffects,
+ unminimizeRandomEffects, minimizeEffectName, minimizeEffectType);
// Close 1
@@ -4218,17 +4204,15 @@ static void animScreenInitOptions(AnimScreen * as)
o->rest.f.precision = ANIM_CLOSE1_DURATION_PRECISION;
INIT_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_CLOSE1_RANDOM_EFFECTS,
- "close1", "Close", "Close #1", NUM_CLOSE_EFFECT,
- closeEffectName);
+ (ANIM_SCREEN_OPTION_CLOSE1_RANDOM_EFFECTS,
+ "close1", "Close", "Close #1", NUM_CLOSE_EFFECT,
+ closeEffectName);
STORE_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_CLOSE1_RANDOM_EFFECTS,
- NUM_CLOSE_EFFECT,
- ANIM_CLOSE1_DEFAULT,
- nClose1RandomEffects,
- close1RandomEffects,
- closeEffectName,
- closeEffectType);
+ (ANIM_SCREEN_OPTION_CLOSE1_RANDOM_EFFECTS,
+ NUM_CLOSE_EFFECT,
+ ANIM_CLOSE1_DEFAULT,
+ nClose1RandomEffects,
+ close1RandomEffects, closeEffectName, closeEffectType);
// Close 2
@@ -4282,17 +4266,15 @@ static void animScreenInitOptions(AnimScreen * as)
o->rest.f.precision = ANIM_CLOSE2_DURATION_PRECISION;
INIT_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_CLOSE2_RANDOM_EFFECTS,
- "close2", "Close", "Close #2", NUM_CLOSE_EFFECT,
- closeEffectName);
+ (ANIM_SCREEN_OPTION_CLOSE2_RANDOM_EFFECTS,
+ "close2", "Close", "Close #2", NUM_CLOSE_EFFECT,
+ closeEffectName);
STORE_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_CLOSE2_RANDOM_EFFECTS,
- NUM_CLOSE_EFFECT,
- ANIM_CLOSE2_DEFAULT,
- nClose2RandomEffects,
- close2RandomEffects,
- closeEffectName,
- closeEffectType);
+ (ANIM_SCREEN_OPTION_CLOSE2_RANDOM_EFFECTS,
+ NUM_CLOSE_EFFECT,
+ ANIM_CLOSE2_DEFAULT,
+ nClose2RandomEffects,
+ close2RandomEffects, closeEffectName, closeEffectType);
// Create 1
@@ -4346,17 +4328,15 @@ static void animScreenInitOptions(AnimScreen * as)
o->rest.f.precision = ANIM_CREATE1_DURATION_PRECISION;
INIT_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_CREATE1_RANDOM_EFFECTS,
- "create1", "Create", "Create #1", NUM_CLOSE_EFFECT,
- closeEffectName);
+ (ANIM_SCREEN_OPTION_CREATE1_RANDOM_EFFECTS,
+ "create1", "Create", "Create #1", NUM_CLOSE_EFFECT,
+ closeEffectName);
STORE_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_CREATE1_RANDOM_EFFECTS,
- NUM_CLOSE_EFFECT,
- ANIM_CREATE1_DEFAULT,
- nCreate1RandomEffects,
- create1RandomEffects,
- closeEffectName,
- closeEffectType);
+ (ANIM_SCREEN_OPTION_CREATE1_RANDOM_EFFECTS,
+ NUM_CLOSE_EFFECT,
+ ANIM_CREATE1_DEFAULT,
+ nCreate1RandomEffects,
+ create1RandomEffects, closeEffectName, closeEffectType);
// Create 2
@@ -4410,17 +4390,15 @@ static void animScreenInitOptions(AnimScreen * as)
o->rest.f.precision = ANIM_CREATE2_DURATION_PRECISION;
INIT_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_CREATE2_RANDOM_EFFECTS,
- "create2", "Create", "Create #2", NUM_CLOSE_EFFECT,
- closeEffectName);
+ (ANIM_SCREEN_OPTION_CREATE2_RANDOM_EFFECTS,
+ "create2", "Create", "Create #2", NUM_CLOSE_EFFECT,
+ closeEffectName);
STORE_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_CREATE2_RANDOM_EFFECTS,
- NUM_CLOSE_EFFECT,
- ANIM_CREATE2_DEFAULT,
- nCreate2RandomEffects,
- create2RandomEffects,
- closeEffectName,
- closeEffectType);
+ (ANIM_SCREEN_OPTION_CREATE2_RANDOM_EFFECTS,
+ NUM_CLOSE_EFFECT,
+ ANIM_CREATE2_DEFAULT,
+ nCreate2RandomEffects,
+ create2RandomEffects, closeEffectName, closeEffectType);
// Focus
@@ -4525,17 +4503,15 @@ static void animScreenInitOptions(AnimScreen * as)
o->rest.f.precision = ANIM_SHADE_DURATION_PRECISION;
INIT_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_SHADE_RANDOM_EFFECTS,
- "shade", "(Un)Shade", "Shade", NUM_SHADE_EFFECT,
- shadeEffectName);
+ (ANIM_SCREEN_OPTION_SHADE_RANDOM_EFFECTS,
+ "shade", "(Un)Shade", "Shade", NUM_SHADE_EFFECT,
+ shadeEffectName);
STORE_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_SHADE_RANDOM_EFFECTS,
- NUM_SHADE_EFFECT,
- ANIM_SHADE_DEFAULT,
- nShadeRandomEffects,
- shadeRandomEffects,
- shadeEffectName,
- shadeEffectType);
+ (ANIM_SCREEN_OPTION_SHADE_RANDOM_EFFECTS,
+ NUM_SHADE_EFFECT,
+ ANIM_SHADE_DEFAULT,
+ nShadeRandomEffects,
+ shadeRandomEffects, shadeEffectName, shadeEffectType);
// Unshade
@@ -4589,17 +4565,15 @@ static void animScreenInitOptions(AnimScreen * as)
o->rest.f.precision = ANIM_UNSHADE_DURATION_PRECISION;
INIT_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_UNSHADE_RANDOM_EFFECTS,
- "unshade", "(Un)Shade", "Unshade", NUM_SHADE_EFFECT,
- shadeEffectName);
+ (ANIM_SCREEN_OPTION_UNSHADE_RANDOM_EFFECTS,
+ "unshade", "(Un)Shade", "Unshade", NUM_SHADE_EFFECT,
+ shadeEffectName);
STORE_RANDOM_EFFECT_LIST
- (ANIM_SCREEN_OPTION_UNSHADE_RANDOM_EFFECTS,
- NUM_SHADE_EFFECT,
- ANIM_UNSHADE_DEFAULT,
- nUnshadeRandomEffects,
- unshadeRandomEffects,
- shadeEffectName,
- shadeEffectType);
+ (ANIM_SCREEN_OPTION_UNSHADE_RANDOM_EFFECTS,
+ NUM_SHADE_EFFECT,
+ ANIM_UNSHADE_DEFAULT,
+ nUnshadeRandomEffects,
+ unshadeRandomEffects, shadeEffectName, shadeEffectType);
// Fire (Burn)
@@ -5022,8 +4996,7 @@ animEnsureModel(CompWindow * w,
gridWidth != aw->model->gridWidth ||
gridHeight != aw->model->gridHeight ||
(isShadeUnshadeEvent != wasShadeUnshadeEvent) ||
- aw->model->winWidth != WIN_W(w) ||
- aw->model->winHeight != WIN_H(w))
+ aw->model->winWidth != WIN_W(w) || aw->model->winHeight != WIN_H(w))
{
if (aw->model)
{
@@ -5164,15 +5137,15 @@ static void animPreparePaintScreen(CompScreen * s, int msSinceLastPaint)
aw->model->winHeight != WIN_H(w))
{
// model needs update
-
+
// keep this value
float remainderSteps = aw->model->remainderSteps;
// re-create model
animEnsureModel
- (w, aw->curWindowEvent, aw->curAnimEffect);
+ (w, aw->curWindowEvent, aw->curAnimEffect);
if (aw->model == 0)
- continue; // skip this window
+ continue; // skip this window
aw->model->remainderSteps = remainderSteps;
}
// Call fx step func.
@@ -6000,13 +5973,16 @@ static void animHandleEvent(CompDisplay * d, XEvent * event)
if (startingNew)
{
- if (as-> shadeEffect == AnimEffectRandom
+ if (as->shadeEffect == AnimEffectRandom
|| as->
opt[ANIM_SCREEN_OPTION_ALL_RANDOM].value.b)
aw->curAnimEffect = // choose a random effect
- as->shadeRandomEffects[
- (int)(as->nShadeRandomEffects *
- (double)rand() / RAND_MAX)];
+ as->shadeRandomEffects[(int)
+ (as->
+ nShadeRandomEffects
+ *
+ (double)rand()
+ / RAND_MAX)];
else
aw->curAnimEffect = as->shadeEffect;
@@ -6072,9 +6048,12 @@ static void animHandleEvent(CompDisplay * d, XEvent * event)
AnimEffectRandom
|| as->opt[ANIM_SCREEN_OPTION_ALL_RANDOM].value.b)
aw->curAnimEffect = // choose a random effect
- as->minimizeRandomEffects[
- (int)(as->nMinimizeRandomEffects *
- (double)rand() / RAND_MAX)];
+ as->minimizeRandomEffects[(int)
+ (as->
+ nMinimizeRandomEffects
+ *
+ (double)rand()
+ / RAND_MAX)];
else
aw->curAnimEffect = as->minimizeEffect;
@@ -6200,14 +6179,22 @@ static void animHandleEvent(CompDisplay * d, XEvent * event)
{
if (whichClose == 1)
aw->curAnimEffect = // choose a random effect
- as->close1RandomEffects[
- (int)(as->nClose1RandomEffects *
- (double)rand() / RAND_MAX)];
+ as->close1RandomEffects[(int)
+ (as->
+ nClose1RandomEffects
+ *
+ (double)
+ rand() /
+ RAND_MAX)];
else
aw->curAnimEffect = // choose a random effect
- as->close2RandomEffects[
- (int)(as->nClose2RandomEffects *
- (double)rand() / RAND_MAX)];
+ as->close2RandomEffects[(int)
+ (as->
+ nClose2RandomEffects
+ *
+ (double)
+ rand() /
+ RAND_MAX)];
}
else
aw->curAnimEffect = windowsCloseEffect;
@@ -6234,21 +6221,29 @@ static void animHandleEvent(CompDisplay * d, XEvent * event)
if (aw->curAnimEffect == AnimEffectMagicLamp1 &&
aw->icon.width <
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_CREATE_START_WIDTH]
- .value.i)
+ as->
+ opt
+ [ANIM_SCREEN_OPTION_MAGIC_LAMP1_CREATE_START_WIDTH].
+ value.i)
{
aw->icon.width =
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_CREATE_START_WIDTH]
- .value.i;
+ as->
+ opt
+ [ANIM_SCREEN_OPTION_MAGIC_LAMP1_CREATE_START_WIDTH].
+ value.i;
}
else if (aw->curAnimEffect == AnimEffectMagicLamp2 &&
- aw->icon.width <
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP2_CREATE_START_WIDTH]
- .value.i)
+ aw->icon.width <
+ as->
+ opt
+ [ANIM_SCREEN_OPTION_MAGIC_LAMP2_CREATE_START_WIDTH].
+ value.i)
{
aw->icon.width =
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP2_CREATE_START_WIDTH]
- .value.i;
+ as->
+ opt
+ [ANIM_SCREEN_OPTION_MAGIC_LAMP2_CREATE_START_WIDTH].
+ value.i;
}
aw->icon.x -= aw->icon.width / 2;
aw->icon.y -= aw->icon.height / 2;
@@ -6427,9 +6422,12 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
AnimEffectRandom
|| as->opt[ANIM_SCREEN_OPTION_ALL_RANDOM].value.b)
aw->curAnimEffect = // choose a random effect
- as->unminimizeRandomEffects[
- (int)(as->nUnminimizeRandomEffects *
- (double)rand() / RAND_MAX)];
+ as->unminimizeRandomEffects[(int)
+ (as->
+ nUnminimizeRandomEffects
+ *
+ (double)rand() /
+ RAND_MAX)];
else
aw->curAnimEffect = as->unminimizeEffect;
@@ -6513,9 +6511,11 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
AnimEffectRandom
|| as->opt[ANIM_SCREEN_OPTION_ALL_RANDOM].value.b)
aw->curAnimEffect = // choose a random effect
- as->unshadeRandomEffects[
- (int)(as->nUnshadeRandomEffects *
- (double)rand() / RAND_MAX)];
+ as->unshadeRandomEffects[(int)
+ (as->
+ nUnshadeRandomEffects
+ * (double)rand() /
+ RAND_MAX)];
else
aw->curAnimEffect = as->unshadeEffect;
@@ -6589,14 +6589,20 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
{
if (whichCreate == 1)
aw->curAnimEffect = // choose a random effect
- as->create1RandomEffects[
- (int)(as->nCreate1RandomEffects *
- (double)rand() / RAND_MAX)];
+ as->create1RandomEffects[(int)
+ (as->
+ nCreate1RandomEffects
+ *
+ (double)rand() /
+ RAND_MAX)];
else
aw->curAnimEffect = // choose a random effect
- as->create2RandomEffects[
- (int)(as->nCreate2RandomEffects *
- (double)rand() / RAND_MAX)];
+ as->create2RandomEffects[(int)
+ (as->
+ nCreate2RandomEffects
+ *
+ (double)rand() /
+ RAND_MAX)];
}
else
aw->curAnimEffect = windowsCreateEffect;
@@ -6615,21 +6621,28 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
if (aw->curAnimEffect == AnimEffectMagicLamp1 &&
aw->icon.width <
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_CREATE_START_WIDTH]
- .value.i)
+ as->
+ opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_CREATE_START_WIDTH].
+ value.i)
{
aw->icon.width =
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_CREATE_START_WIDTH]
- .value.i;
+ as->
+ opt
+ [ANIM_SCREEN_OPTION_MAGIC_LAMP1_CREATE_START_WIDTH].
+ value.i;
}
else if (aw->curAnimEffect == AnimEffectMagicLamp2 &&
- aw->icon.width <
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP2_CREATE_START_WIDTH]
- .value.i)
+ aw->icon.width <
+ as->
+ opt
+ [ANIM_SCREEN_OPTION_MAGIC_LAMP2_CREATE_START_WIDTH].
+ value.i)
{
aw->icon.width =
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP2_CREATE_START_WIDTH]
- .value.i;
+ as->
+ opt
+ [ANIM_SCREEN_OPTION_MAGIC_LAMP2_CREATE_START_WIDTH].
+ value.i;
}
aw->icon.x -= aw->icon.width / 2;
aw->icon.y -= aw->icon.height / 2;
@@ -6664,7 +6677,8 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
return status;
}
-static void animWindowResizeNotify(CompWindow * w, int dx, int dy, int dwidth, int dheight)
+static void animWindowResizeNotify(CompWindow * w, int dx, int dy, int dwidth,
+ int dheight)
{
ANIM_SCREEN(w->screen);
ANIM_WINDOW(w);
@@ -6679,7 +6693,8 @@ static void animWindowResizeNotify(CompWindow * w, int dx, int dy, int dwidth, i
if (aw->model)
{
- modelInitObjects(aw->model, WIN_X(w), WIN_Y(w), WIN_W(w), WIN_H(w));
+ modelInitObjects(aw->model, WIN_X(w), WIN_Y(w), WIN_W(w),
+ WIN_H(w));
}
}
diff --git a/beryl-plugins/src/annotate.c b/beryl-plugins/src/annotate.c
index 59323ea..c06ceb1 100644
--- a/beryl-plugins/src/annotate.c
+++ b/beryl-plugins/src/annotate.c
@@ -1059,8 +1059,8 @@ annoUsePaintbrush(CompDisplay * d,
xid = getIntOptionNamed(option, nOption, "root", 0);
s = findScreenAtDisplay(d, xid);
- if (!s)
- return FALSE;
+ if (!s)
+ return FALSE;
ANNO_SCREEN(s);
@@ -1078,8 +1078,8 @@ annoUseLine(CompDisplay * d,
xid = getIntOptionNamed(option, nOption, "root", 0);
s = findScreenAtDisplay(d, xid);
- if (!s)
- return FALSE;
+ if (!s)
+ return FALSE;
ANNO_SCREEN(s);
as->tool = ANNO_TOOL_LINE;
@@ -1095,8 +1095,8 @@ annoUseArrow(CompDisplay * d,
xid = getIntOptionNamed(option, nOption, "root", 0);
s = findScreenAtDisplay(d, xid);
- if (!s)
- return FALSE;
+ if (!s)
+ return FALSE;
ANNO_SCREEN(s);
as->tool = ANNO_TOOL_ARROW;
@@ -1113,8 +1113,8 @@ annoPutText(CompDisplay * d,
xid = getIntOptionNamed(option, nOption, "root", 0);
s = findScreenAtDisplay(d, xid);
- if (!s)
- return FALSE;
+ if (!s)
+ return FALSE;
ANNO_SCREEN(s);
ANNO_DISPLAY(d);
diff --git a/beryl-plugins/src/blurfx.c b/beryl-plugins/src/blurfx.c
index 65b6ddb..04b1716 100644
--- a/beryl-plugins/src/blurfx.c
+++ b/beryl-plugins/src/blurfx.c
@@ -1294,9 +1294,10 @@ blurfxPaintScreen(CompScreen * s, const ScreenPaintAttrib * sa,
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
bs->mb_alpha =
(bs->mb_timer / 500.0) * bs->mb_alpha + (1.0 -
- (bs->
- mb_timer
- / 500.0)) * 0.5;
+ (bs->
+ mb_timer
+ / 500.0)) *
+ 0.5;
bs->mb_alpha = MIN(1.0, bs->mb_alpha);
glColor4f(1, 1, 1, (bs->mb_update) ? 1.0 : bs->mb_alpha);
enableBlurfxTexture(&bs->backTex, COMP_TEXTURE_FILTER_FAST);
@@ -1356,11 +1357,11 @@ blurfxPaintScreen(CompScreen * s, const ScreenPaintAttrib * sa,
glPopMatrix();
glViewport(s->outputDev[bs->output].region.extents.
- x1,
- s->height -
- s->outputDev[bs->output].region.extents.
- y2, s->outputDev[bs->output].width,
- s->outputDev[bs->output].height);
+ x1,
+ s->height -
+ s->outputDev[bs->output].region.extents.
+ y2, s->outputDev[bs->output].width,
+ s->outputDev[bs->output].height);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
@@ -1398,8 +1399,10 @@ blurfxPaintScreen(CompScreen * s, const ScreenPaintAttrib * sa,
stride = 4 * sizeof(GLfloat);
genGeometry(&bs->vertArray, mat, 0,
&s->outputDev[bs->output].region);
- glVertexPointer(2, GL_FLOAT, stride, bs->vertArray.vertices + 2);
- glTexCoordPointer(2, GL_FLOAT, stride, bs->vertArray.vertices);
+ glVertexPointer(2, GL_FLOAT, stride,
+ bs->vertArray.vertices + 2);
+ glTexCoordPointer(2, GL_FLOAT, stride,
+ bs->vertArray.vertices);
glColor4f(1.0, 1.0, 1.0, 1.0);
enableBlurfxTexture(&bs->backTex, COMP_TEXTURE_FILTER_FAST);
@@ -4453,9 +4456,9 @@ static Bool bindFbo(CompScreen * s, BlurTexture tex)
glRasterPos2f(0, 0);
s->rasterX = s->rasterY = 0;
glViewport(s->outputDev[bs->output].region.extents.x1,
- s->height - s->outputDev[bs->output].region.extents.y2,
- s->outputDev[bs->output].width,
- s->outputDev[bs->output].height);
+ s->height - s->outputDev[bs->output].region.extents.y2,
+ s->outputDev[bs->output].width,
+ s->outputDev[bs->output].height);
glMatrixMode(GL_PROJECTION);
glPopMatrix();
diff --git a/beryl-plugins/src/cube.c b/beryl-plugins/src/cube.c
index 805bd10..89ae7d4 100644
--- a/beryl-plugins/src/cube.c
+++ b/beryl-plugins/src/cube.c
@@ -1205,7 +1205,9 @@ static void cubeScreenInitOptions(CubeScreen * cs)
o->subGroup = N_("");
o->displayHints = "file;image";
o->shortDesc = N_("Skydome Image");
- o->longDesc = N_("Image to use as texture for the skydome. Dimensions must be a power of two");
+ o->longDesc =
+ N_
+ ("Image to use as texture for the skydome. Dimensions must be a power of two");
o->type = CompOptionTypeString;
o->value.s = strdup("");
o->rest.s.string = 0;
@@ -1964,7 +1966,10 @@ cubePaintTransformedScreen(CompScreen * s,
sa.zTranslate = -cs->invert * (0.5f / tanf(M_PI / size));
sa.zCamera -= cs->unfold * cs->unfoldDistance;
- sa.zCamera /= IPCS_IsSet(IPCS_OBJECT(s),cs->zoomLevelAtom) ? IPCS_GetFloat(IPCS_OBJECT(s),cs->zoomLevelAtom) : 1;
+ sa.zCamera /= IPCS_IsSet(IPCS_OBJECT(s),
+ cs->
+ zoomLevelAtom) ?
+ IPCS_GetFloat(IPCS_OBJECT(s), cs->zoomLevelAtom) : 1;
sa.xRotate = sAttrib->xRotate * cs->invert;
if (sa.xRotate > 0.0f)
@@ -2843,7 +2848,8 @@ static Bool cubeInitScreen(CompPlugin * p, CompScreen * s)
cs->manualAtom =
IPCS_GetAtom(IPCS_OBJECT(s), IPCS_BOOL, "MOUSE_INITIATED_ROTATE",
TRUE);
- cs->zoomLevelAtom = IPCS_GetAtom(IPCS_OBJECT(s),IPCS_FLOAT,"ZOOM_LEVEL",TRUE);
+ cs->zoomLevelAtom =
+ IPCS_GetAtom(IPCS_OBJECT(s), IPCS_FLOAT, "ZOOM_LEVEL", TRUE);
cs->paintingCaps = FALSE;
IPCS_SetVPtr(IPCS_OBJECT(s), cs->paintingCapsAtom,
(void *)&cs->paintingCaps);
@@ -2960,13 +2966,20 @@ static void cubeFini(CompPlugin * p)
}
CompPluginDep cubeDeps[] = {
- {CompPluginRuleAfter, "animation"},
- {CompPluginRuleAfter, "decoration"},
- {CompPluginRuleAfter, "fade"},
- {CompPluginRuleAfter, "wobbly"},
- {CompPluginRuleAfter, "inputzoom"},
- {CompPluginRuleAfter, "3d"},
- {CompPluginRuleAfterCategory, "imageformat"},
+ {CompPluginRuleAfter, "animation"}
+ ,
+ {CompPluginRuleAfter, "decoration"}
+ ,
+ {CompPluginRuleAfter, "fade"}
+ ,
+ {CompPluginRuleAfter, "wobbly"}
+ ,
+ {CompPluginRuleAfter, "inputzoom"}
+ ,
+ {CompPluginRuleAfter, "3d"}
+ ,
+ {CompPluginRuleAfterCategory, "imageformat"}
+ ,
};
CompPluginFeature cubeFeatures[] = {
diff --git a/beryl-plugins/src/dbus.c b/beryl-plugins/src/dbus.c
index 09bf362..1ab0c7b 100644
--- a/beryl-plugins/src/dbus.c
+++ b/beryl-plugins/src/dbus.c
@@ -42,29 +42,32 @@
#define BERYL_DBUS_LIST_MEMBER_NAME "list"
#define BERYL_DBUS_CHANGED_SIGNAL_NAME "changed"
-typedef enum {
- DbusActionIndexKeyBinding = 0,
- DbusActionIndexButtonBinding = 1,
- DbusActionIndexBell = 2,
- DbusActionIndexEdge = 3,
- DbusActionIndexEdgeButton = 4
+typedef enum
+{
+ DbusActionIndexKeyBinding = 0,
+ DbusActionIndexButtonBinding = 1,
+ DbusActionIndexBell = 2,
+ DbusActionIndexEdge = 3,
+ DbusActionIndexEdgeButton = 4
} DbusActionIndex;
static int displayPrivateIndex;
-typedef struct _DbusDisplay {
- int screenPrivateIndex;
+typedef struct _DbusDisplay
+{
+ int screenPrivateIndex;
- DBusConnection *connection;
- CompWatchFdHandle watchFdHandle;
+ DBusConnection *connection;
+ CompWatchFdHandle watchFdHandle;
- SetDisplayOptionProc setDisplayOption;
- SetDisplayOptionForPluginProc setDisplayOptionForPlugin;
+ SetDisplayOptionProc setDisplayOption;
+ SetDisplayOptionForPluginProc setDisplayOptionForPlugin;
} DbusDisplay;
-typedef struct _DbusScreen {
- SetScreenOptionProc setScreenOption;
- SetScreenOptionForPluginProc setScreenOptionForPlugin;
+typedef struct _DbusScreen
+{
+ SetScreenOptionProc setScreenOption;
+ SetScreenOptionForPluginProc setScreenOptionForPlugin;
} DbusScreen;
#define GET_DBUS_DISPLAY(d) \
@@ -80,63 +83,62 @@ typedef struct _DbusScreen {
DbusScreen *ds = GET_DBUS_SCREEN (s, GET_DBUS_DISPLAY (s->display))
-static CompOption *
-dbusGetOptionsFromPath (CompDisplay *d,
- char **path,
- CompScreen **return_screen,
- int *nOption)
+static CompOption *dbusGetOptionsFromPath(CompDisplay * d,
+ char **path,
+ CompScreen ** return_screen,
+ int *nOption)
{
- CompScreen *s = NULL;
-
- if (strcmp (path[1], "allscreens"))
- {
- int screenNum;
+ CompScreen *s = NULL;
- if (sscanf (path[1], "screen%d", &screenNum) != 1)
- return FALSE;
-
- for (s = d->screens; s; s = s->next)
- if (s->screenNum == screenNum)
- break;
+ if (strcmp(path[1], "allscreens"))
+ {
+ int screenNum;
- if (!s)
- return NULL;
- }
+ if (sscanf(path[1], "screen%d", &screenNum) != 1)
+ return FALSE;
- if (return_screen)
- *return_screen = s;
+ for (s = d->screens; s; s = s->next)
+ if (s->screenNum == screenNum)
+ break;
- if (strcmp (path[0], "core") == 0)
- {
- if (s)
- return compGetScreenOptions (s, nOption);
- else
- return compGetDisplayOptions (d, nOption);
- }
- else
- {
- CompPlugin *p;
-
- for (p = getPlugins (); p; p = p->next)
- if (strcmp (p->vTable->name, path[0]) == 0)
- break;
+ if (!s)
+ return NULL;
+ }
- if (!p)
- return NULL;
+ if (return_screen)
+ *return_screen = s;
- if (s)
+ if (strcmp(path[0], "core") == 0)
{
- if (p->vTable->getScreenOptions)
- return (*p->vTable->getScreenOptions) (s, nOption);
+ if (s)
+ return compGetScreenOptions(s, nOption);
+ else
+ return compGetDisplayOptions(d, nOption);
}
else
{
- if (p->vTable->getDisplayOptions)
- return (*p->vTable->getDisplayOptions) (d, nOption);
+ CompPlugin *p;
+
+ for (p = getPlugins(); p; p = p->next)
+ if (strcmp(p->vTable->name, path[0]) == 0)
+ break;
+
+ if (!p)
+ return NULL;
+
+ if (s)
+ {
+ if (p->vTable->getScreenOptions)
+ return (*p->vTable->getScreenOptions) (s, nOption);
+ }
+ else
+ {
+ if (p->vTable->getDisplayOptions)
+ return (*p->vTable->getDisplayOptions) (d, nOption);
+ }
}
- }
- return NULL;
+ return NULL;
}
/*
@@ -169,212 +171,199 @@ dbusGetOptionsFromPath (CompDisplay *d,
* int32:`xwininfo -root | grep id: | awk '{ print $4 }'` \
*/
static Bool
-dbusHandleActionMessage (DBusConnection *connection,
- DBusMessage *message,
- CompDisplay *d,
- char **path,
- Bool activate)
+dbusHandleActionMessage(DBusConnection * connection,
+ DBusMessage * message,
+ CompDisplay * d, char **path, Bool activate)
{
- CompOption *option;
- int nOption;
+ CompOption *option;
+ int nOption;
- option = dbusGetOptionsFromPath (d, path, NULL, &nOption);
- if (!option)
- return FALSE;
+ option = dbusGetOptionsFromPath(d, path, NULL, &nOption);
+ if (!option)
+ return FALSE;
- while (nOption--)
- {
- if (strcmp (option->name, path[2]) == 0)
+ while (nOption--)
{
- CompOption *argument = NULL;
- int nArgument = 0;
- DBusMessageIter iter;
+ if (strcmp(option->name, path[2]) == 0)
+ {
+ CompOption *argument = NULL;
+ int nArgument = 0;
+ DBusMessageIter iter;
- if (option->type != CompOptionTypeAction)
- return FALSE;
+ if (option->type != CompOptionTypeAction)
+ return FALSE;
- if (activate)
- {
- if (!option->value.action.initiate)
- return FALSE;
- }
- else
- {
- if (!option->value.action.terminate)
- return FALSE;
- }
-
- if (dbus_message_iter_init (message, &iter))
- {
- CompOptionValue value;
- CompOptionType type = 0;
- char *name;
- Bool hasValue;
-
- do
- {
- name = NULL;
- hasValue = FALSE;
-
- while (!name)
- {
- switch (dbus_message_iter_get_arg_type (&iter)) {
- case DBUS_TYPE_STRING:
- dbus_message_iter_get_basic (&iter, &name);
- default:
- break;
+ if (activate)
+ {
+ if (!option->value.action.initiate)
+ return FALSE;
}
-
- if (!dbus_message_iter_next (&iter))
- break;
- }
-
- while (!hasValue)
- {
- double tmp;
-
- switch (dbus_message_iter_get_arg_type (&iter)) {
- case DBUS_TYPE_BOOLEAN:
- hasValue = TRUE;
- type = CompOptionTypeBool;
-
- dbus_message_iter_get_basic (&iter, &value.b);
- break;
- case DBUS_TYPE_INT32:
- hasValue = TRUE;
- type = CompOptionTypeInt;
-
- dbus_message_iter_get_basic (&iter, &value.i);
- break;
- case DBUS_TYPE_DOUBLE:
- hasValue = TRUE;
- type = CompOptionTypeFloat;
-
- dbus_message_iter_get_basic (&iter, &tmp);
-
- value.f = tmp;
- break;
- case DBUS_TYPE_STRING:
- hasValue = TRUE;
- type = CompOptionTypeString;
-
- dbus_message_iter_get_basic (&iter, &value.s);
- default:
- break;
+ else
+ {
+ if (!option->value.action.terminate)
+ return FALSE;
}
- if (!dbus_message_iter_next (&iter))
- break;
- }
+ if (dbus_message_iter_init(message, &iter))
+ {
+ CompOptionValue value;
+ CompOptionType type = 0;
+ char *name;
+ Bool hasValue;
- if (name && hasValue)
- {
- CompOption *a;
+ do
+ {
+ name = NULL;
+ hasValue = FALSE;
- a = realloc (argument,
- sizeof (CompOption) * (nArgument + 1));
- if (a)
- {
- argument = a;
+ while (!name)
+ {
+ switch (dbus_message_iter_get_arg_type(&iter))
+ {
+ case DBUS_TYPE_STRING:
+ dbus_message_iter_get_basic(&iter, &name);
+ default:
+ break;
+ }
+
+ if (!dbus_message_iter_next(&iter))
+ break;
+ }
+
+ while (!hasValue)
+ {
+ double tmp;
+
+ switch (dbus_message_iter_get_arg_type(&iter))
+ {
+ case DBUS_TYPE_BOOLEAN:
+ hasValue = TRUE;
+ type = CompOptionTypeBool;
+
+ dbus_message_iter_get_basic(&iter, &value.b);
+ break;
+ case DBUS_TYPE_INT32:
+ hasValue = TRUE;
+ type = CompOptionTypeInt;
+
+ dbus_message_iter_get_basic(&iter, &value.i);
+ break;
+ case DBUS_TYPE_DOUBLE:
+ hasValue = TRUE;
+ type = CompOptionTypeFloat;
+
+ dbus_message_iter_get_basic(&iter, &tmp);
+
+ value.f = tmp;
+ break;
+ case DBUS_TYPE_STRING:
+ hasValue = TRUE;
+ type = CompOptionTypeString;
+
+ dbus_message_iter_get_basic(&iter, &value.s);
+ default:
+ break;
+ }
+
+ if (!dbus_message_iter_next(&iter))
+ break;
+ }
+
+ if (name && hasValue)
+ {
+ CompOption *a;
- argument[nArgument].name = name;
- argument[nArgument].type = type;
- argument[nArgument].value = value;
+ a = realloc(argument,
+ sizeof(CompOption) * (nArgument + 1));
+ if (a)
+ {
+ argument = a;
- nArgument++;
+ argument[nArgument].name = name;
+ argument[nArgument].type = type;
+ argument[nArgument].value = value;
+
+ nArgument++;
+ }
+ }
+ }
+ while (dbus_message_iter_has_next(&iter));
}
- }
- } while (dbus_message_iter_has_next (&iter));
- }
-
- if (activate)
- {
- (*option->value.action.initiate) (d,
- &option->value.action,
- 0,
- argument, nArgument);
- }
- else
- {
- (*option->value.action.terminate) (d,
- &option->value.action,
- 0,
- argument, nArgument);
- }
-
- if (argument)
- free (argument);
-
- return TRUE;
- }
- option++;
- }
+ if (activate)
+ {
+ (*option->value.action.initiate) (d,
+ &option->value.action,
+ 0, argument, nArgument);
+ }
+ else
+ {
+ (*option->value.action.terminate) (d,
+ &option->value.action,
+ 0, argument, nArgument);
+ }
+
+ if (argument)
+ free(argument);
+
+ return TRUE;
+ }
+
+ option++;
+ }
- return FALSE;
+ return FALSE;
}
static Bool
-dbusTryGetValueWithType (DBusMessageIter *iter,
- int type,
- void *value)
+dbusTryGetValueWithType(DBusMessageIter * iter, int type, void *value)
{
- if (dbus_message_iter_get_arg_type (iter) == type)
- {
- dbus_message_iter_get_basic (iter, value);
+ if (dbus_message_iter_get_arg_type(iter) == type)
+ {
+ dbus_message_iter_get_basic(iter, value);
- return TRUE;
- }
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
static Bool
-dbusGetOptionValue (DBusMessageIter *iter,
- CompOptionType type,
- CompOptionValue *value)
+dbusGetOptionValue(DBusMessageIter * iter,
+ CompOptionType type, CompOptionValue * value)
{
- double d;
- char *s;
-
- switch (type) {
- case CompOptionTypeBool:
- return dbusTryGetValueWithType (iter,
- DBUS_TYPE_BOOLEAN,
- &value->b);
- break;
- case CompOptionTypeInt:
- return dbusTryGetValueWithType (iter,
- DBUS_TYPE_INT32,
- &value->i);
- break;
- case CompOptionTypeFloat:
- if (dbusTryGetValueWithType (iter,
- DBUS_TYPE_DOUBLE,
- &d))
- {
- value->f = d;
- return TRUE;
- }
- break;
- case CompOptionTypeString:
- return dbusTryGetValueWithType (iter,
- DBUS_TYPE_STRING,
- &value->s);
- break;
- case CompOptionTypeColor:
- if (dbusTryGetValueWithType (iter,
- DBUS_TYPE_STRING,
- &s))
+ double d;
+ char *s;
+
+ switch (type)
{
- if (stringToColor (s, value->c))
- return TRUE;
+ case CompOptionTypeBool:
+ return dbusTryGetValueWithType(iter, DBUS_TYPE_BOOLEAN, &value->b);
+ break;
+ case CompOptionTypeInt:
+ return dbusTryGetValueWithType(iter, DBUS_TYPE_INT32, &value->i);
+ break;
+ case CompOptionTypeFloat:
+ if (dbusTryGetValueWithType(iter, DBUS_TYPE_DOUBLE, &d))
+ {
+ value->f = d;
+ return TRUE;
+ }
+ break;
+ case CompOptionTypeString:
+ return dbusTryGetValueWithType(iter, DBUS_TYPE_STRING, &value->s);
+ break;
+ case CompOptionTypeColor:
+ if (dbusTryGetValueWithType(iter, DBUS_TYPE_STRING, &s))
+ {
+ if (stringToColor(s, value->c))
+ return TRUE;
+ }
+ default:
+ break;
}
- default:
- break;
- }
- return FALSE;
+ return FALSE;
}
/*
@@ -413,259 +402,258 @@ dbusGetOptionValue (DBusMessageIter *iter,
* int:'0'
*/
static Bool
-dbusHandleSetOptionMessage (DBusConnection *connection,
- DBusMessage *message,
- CompDisplay *d,
- char **path)
+dbusHandleSetOptionMessage(DBusConnection * connection,
+ DBusMessage * message,
+ CompDisplay * d, char **path)
{
- CompScreen *s;
- CompOption *option;
- int nOption;
+ CompScreen *s;
+ CompOption *option;
+ int nOption;
- option = dbusGetOptionsFromPath (d, path, &s, &nOption);
- if (!option)
- return FALSE;
+ option = dbusGetOptionsFromPath(d, path, &s, &nOption);
+ if (!option)
+ return FALSE;
- while (nOption--)
- {
- if (strcmp (option->name, path[2]) == 0)
+ while (nOption--)
{
- DBusMessageIter iter;
-
- if (dbus_message_iter_init (message, &iter))
- {
- CompOptionValue value, tmpValue;
- DbusActionIndex actionIndex = DbusActionIndexKeyBinding;
- Bool status = FALSE;
-
- memset (&value, 0, sizeof (value));
-
- do
+ if (strcmp(option->name, path[2]) == 0)
{
- if (option->type == CompOptionTypeList)
- {
- if (dbusGetOptionValue (&iter, option->type, &tmpValue))
+ DBusMessageIter iter;
+
+ if (dbus_message_iter_init(message, &iter))
{
- CompOptionValue *v;
-
- v = realloc (value.list.value,
- sizeof (CompOptionValue) *
- (value.list.nValue + 1));
- if (v)
- {
- v[value.list.nValue++] = tmpValue;
- value.list.value = v;
- status |= TRUE;
- }
- }
- }
- else if (option->type == CompOptionTypeAction)
- {
- CompAction *a = &value.action;
- char *str;
-
- status = TRUE;
-
- switch (actionIndex) {
- case DbusActionIndexKeyBinding:
- if (dbusTryGetValueWithType (&iter,
- DBUS_TYPE_STRING,
- &str))
- {
- if (stringToKeyBinding (d, str, &a->key))
- a->type |= CompBindingTypeKey;
- }
- break;
- case DbusActionIndexButtonBinding:
- if (dbusTryGetValueWithType (&iter,
- DBUS_TYPE_STRING,
- &str))
- {
- if (stringToButtonBinding (d, str, &a->button))
- a->type |= CompBindingTypeButton;
- }
- break;
- case DbusActionIndexBell:
- dbusTryGetValueWithType (&iter,
- DBUS_TYPE_BOOLEAN,
- &a->bell);
- break;
- case DbusActionIndexEdge:
- if (dbusTryGetValueWithType (&iter,
- DBUS_TYPE_STRING,
- &str))
- {
- status |= TRUE;
-
- while (strlen (str))
- {
- char *edge;
- int len, i = SCREEN_EDGE_NUM;
+ CompOptionValue value, tmpValue;
+ DbusActionIndex actionIndex = DbusActionIndexKeyBinding;
+ Bool status = FALSE;
- for (;;)
- {
- edge = edgeToString (--i);
- len = strlen (edge);
+ memset(&value, 0, sizeof(value));
- if (strncasecmp (str, edge, len) == 0)
+ do
+ {
+ if (option->type == CompOptionTypeList)
{
- a->edgeMask |= 1 << i;
-
- str += len;
- break;
+ if (dbusGetOptionValue
+ (&iter, option->type, &tmpValue))
+ {
+ CompOptionValue *v;
+
+ v = realloc(value.list.value,
+ sizeof(CompOptionValue) *
+ (value.list.nValue + 1));
+ if (v)
+ {
+ v[value.list.nValue++] = tmpValue;
+ value.list.value = v;
+ status |= TRUE;
+ }
+ }
}
-
- if (!i)
+ else if (option->type == CompOptionTypeAction)
{
- str++;
- break;
+ CompAction *a = &value.action;
+ char *str;
+
+ status = TRUE;
+
+ switch (actionIndex)
+ {
+ case DbusActionIndexKeyBinding:
+ if (dbusTryGetValueWithType(&iter,
+ DBUS_TYPE_STRING,
+ &str))
+ {
+ if (stringToKeyBinding(d, str, &a->key))
+ a->type |= CompBindingTypeKey;
+ }
+ break;
+ case DbusActionIndexButtonBinding:
+ if (dbusTryGetValueWithType(&iter,
+ DBUS_TYPE_STRING,
+ &str))
+ {
+ if (stringToButtonBinding(d, str, &a->button))
+ a->type |= CompBindingTypeButton;
+ }
+ break;
+ case DbusActionIndexBell:
+ dbusTryGetValueWithType(&iter,
+ DBUS_TYPE_BOOLEAN,
+ &a->bell);
+ break;
+ case DbusActionIndexEdge:
+ if (dbusTryGetValueWithType(&iter,
+ DBUS_TYPE_STRING,
+ &str))
+ {
+ status |= TRUE;
+
+ while (strlen(str))
+ {
+ char *edge;
+ int len, i = SCREEN_EDGE_NUM;
+
+ for (;;)
+ {
+ edge = edgeToString(--i);
+ len = strlen(edge);
+
+ if (strncasecmp(str, edge, len) == 0)
+ {
+ a->edgeMask |= 1 << i;
+
+ str += len;
+ break;
+ }
+
+ if (!i)
+ {
+ str++;
+ break;
+ }
+ }
+ }
+ }
+ default:
+ break;
+ }
+
+ actionIndex++;
+ }
+ else if (dbusGetOptionValue(&iter, option->type, &value))
+ {
+ status |= TRUE;
}
- }
}
- }
- default:
- break;
- }
-
- actionIndex++;
- }
- else if (dbusGetOptionValue (&iter, option->type, &value))
- {
- status |= TRUE;
- }
- } while (dbus_message_iter_next (&iter));
+ while (dbus_message_iter_next(&iter));
- if (status)
- {
- if (s)
- {
- if (strcmp (path[0], "core"))
- status =
- (*s->setScreenOptionForPlugin) (s,
- path[0],
- option->name,
- &value);
- else
- status = (*s->setScreenOption) (s, option->name,
- &value);
- }
- else
- {
- if (strcmp (path[0], "core"))
- status =
- (*d->setDisplayOptionForPlugin) (d,
- path[0],
- option->name,
- &value);
- else
- status = (*d->setDisplayOption) (d, option->name,
- &value);
- }
+ if (status)
+ {
+ if (s)
+ {
+ if (strcmp(path[0], "core"))
+ status = (*s->setScreenOptionForPlugin) (s,
+ path[0],
+ option->
+ name,
+ &value);
+ else
+ status = (*s->setScreenOption) (s, option->name,
+ &value);
+ }
+ else
+ {
+ if (strcmp(path[0], "core"))
+ status = (*d->setDisplayOptionForPlugin) (d,
+ path[0],
+ option->
+ name,
+ &value);
+ else
+ status = (*d->setDisplayOption) (d, option->name,
+ &value);
+ }
- return status;
- }
- else
- {
- return FALSE;
+ return status;
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
}
- }
- }
- option++;
- }
+ option++;
+ }
- return FALSE;
+ return FALSE;
}
static void
-dbusAppendSimpleOptionValue (DBusMessage *message,
- CompOptionType type,
- CompOptionValue *value)
+dbusAppendSimpleOptionValue(DBusMessage * message,
+ CompOptionType type, CompOptionValue * value)
{
- double d;
- char *s;
-
- switch (type) {
- case CompOptionTypeBool:
- dbus_message_append_args (message,
- DBUS_TYPE_BOOLEAN, &value->b,
- DBUS_TYPE_INVALID);
- break;
- case CompOptionTypeInt:
- dbus_message_append_args (message,
- DBUS_TYPE_INT32, &value->i,
- DBUS_TYPE_INVALID);
- break;
- case CompOptionTypeFloat:
- d = value->f;
-
- dbus_message_append_args (message,
- DBUS_TYPE_DOUBLE, &d,
- DBUS_TYPE_INVALID);
- break;
- case CompOptionTypeString:
- dbus_message_append_args (message,
- DBUS_TYPE_STRING, &value->s,
- DBUS_TYPE_INVALID);
- break;
- case CompOptionTypeColor:
- s = colorToString (value->c);
- if (s)
+ double d;
+ char *s;
+
+ switch (type)
{
- dbus_message_append_args (message,
- DBUS_TYPE_STRING, &s,
- DBUS_TYPE_INVALID);
- free (s);
+ case CompOptionTypeBool:
+ dbus_message_append_args(message,
+ DBUS_TYPE_BOOLEAN, &value->b,
+ DBUS_TYPE_INVALID);
+ break;
+ case CompOptionTypeInt:
+ dbus_message_append_args(message,
+ DBUS_TYPE_INT32, &value->i,
+ DBUS_TYPE_INVALID);
+ break;
+ case CompOptionTypeFloat:
+ d = value->f;
+
+ dbus_message_append_args(message,
+ DBUS_TYPE_DOUBLE, &d, DBUS_TYPE_INVALID);
+ break;
+ case CompOptionTypeString:
+ dbus_message_append_args(message,
+ DBUS_TYPE_STRING, &value->s,
+ DBUS_TYPE_INVALID);
+ break;
+ case CompOptionTypeColor:
+ s = colorToString(value->c);
+ if (s)
+ {
+ dbus_message_append_args(message,
+ DBUS_TYPE_STRING, &s, DBUS_TYPE_INVALID);
+ free(s);
+ }
+ default:
+ break;
}
- default:
- break;
- }
}
static void
-dbusAppendOptionValue (CompDisplay *d,
- DBusMessage *message,
- CompOptionType type,
- CompOptionValue *value)
+dbusAppendOptionValue(CompDisplay * d,
+ DBusMessage * message,
+ CompOptionType type, CompOptionValue * value)
{
- int i;
-
- if (type == CompOptionTypeList)
- {
- for (i = 0; i < value->list.nValue; i++)
- dbusAppendSimpleOptionValue (message, value->list.type,
- &value->list.value[i]);
- }
- else if (type == CompOptionTypeAction)
- {
- CompAction *a = &value->action;
- char *key = "Disabled";
- char *button = "Disabled";
- char *edge = "Disabled";
- int edgeButton = 0;
-
- if (a->type & CompBindingTypeKey)
- key = keyBindingToString (d, &a->key);
-
- if (a->type & CompBindingTypeButton)
- button = buttonBindingToString (d, &a->button);
-
- for (i = 0; i < SCREEN_EDGE_NUM; i++)
- if (a->edgeMask & (1 << i))
- edge = edgeToString (i);
-
- dbus_message_append_args (message,
- DBUS_TYPE_STRING, &key,
- DBUS_TYPE_STRING, &button,
- DBUS_TYPE_BOOLEAN, &a->bell,
- DBUS_TYPE_STRING, &edge,
- DBUS_TYPE_INT32, &edgeButton,
- DBUS_TYPE_INVALID);
- }
- else
- {
- dbusAppendSimpleOptionValue (message, type, value);
- }
+ int i;
+
+ if (type == CompOptionTypeList)
+ {
+ for (i = 0; i < value->list.nValue; i++)
+ dbusAppendSimpleOptionValue(message, value->list.type,
+ &value->list.value[i]);
+ }
+ else if (type == CompOptionTypeAction)
+ {
+ CompAction *a = &value->action;
+ char *key = "Disabled";
+ char *button = "Disabled";
+ char *edge = "Disabled";
+ int edgeButton = 0;
+
+ if (a->type & CompBindingTypeKey)
+ key = keyBindingToString(d, &a->key);
+
+ if (a->type & CompBindingTypeButton)
+ button = buttonBindingToString(d, &a->button);
+
+ for (i = 0; i < SCREEN_EDGE_NUM; i++)
+ if (a->edgeMask & (1 << i))
+ edge = edgeToString(i);
+
+ dbus_message_append_args(message,
+ DBUS_TYPE_STRING, &key,
+ DBUS_TYPE_STRING, &button,
+ DBUS_TYPE_BOOLEAN, &a->bell,
+ DBUS_TYPE_STRING, &edge,
+ DBUS_TYPE_INT32, &edgeButton,
+ DBUS_TYPE_INVALID);
+ }
+ else
+ {
+ dbusAppendSimpleOptionValue(message, type, value);
+ }
}
@@ -680,86 +668,81 @@ dbusAppendOptionValue (CompDisplay *d,
* org.freedesktop.beryl.get
*/
static Bool
-dbusHandleGetOptionMessage (DBusConnection *connection,
- DBusMessage *message,
- CompDisplay *d,
- char **path)
+dbusHandleGetOptionMessage(DBusConnection * connection,
+ DBusMessage * message,
+ CompDisplay * d, char **path)
{
- CompScreen *s;
- CompOption *option;
- int nOption = 0;
- DBusMessage *reply = NULL;
+ CompScreen *s;
+ CompOption *option;
+ int nOption = 0;
+ DBusMessage *reply = NULL;
- option = dbusGetOptionsFromPath (d, path, &s, &nOption);
+ option = dbusGetOptionsFromPath(d, path, &s, &nOption);
- while (nOption--)
- {
- if (strcmp (option->name, path[2]) == 0)
+ while (nOption--)
{
- reply = dbus_message_new_method_return (message);
- dbusAppendOptionValue (d, reply, option->type, &option->value);
- break;
- }
+ if (strcmp(option->name, path[2]) == 0)
+ {
+ reply = dbus_message_new_method_return(message);
+ dbusAppendOptionValue(d, reply, option->type, &option->value);
+ break;
+ }
- option++;
- }
+ option++;
+ }
- if (!reply)
- reply = dbus_message_new_error (message,
- DBUS_ERROR_FAILED,
- "No such option");
+ if (!reply)
+ reply = dbus_message_new_error(message,
+ DBUS_ERROR_FAILED, "No such option");
- dbus_connection_send (connection, reply, NULL);
- dbus_connection_flush (connection);
+ dbus_connection_send(connection, reply, NULL);
+ dbus_connection_flush(connection);
- dbus_message_unref (reply);
+ dbus_message_unref(reply);
- return TRUE;
+ return TRUE;
}
static Bool
-dbusHandleListMessage (DBusConnection *connection,
- DBusMessage *message,
- CompDisplay *d,
- char **path)
+dbusHandleListMessage(DBusConnection * connection,
+ DBusMessage * message, CompDisplay * d, char **path)
{
- CompScreen *s;
- CompOption *option;
- int nOption = 0;
- DBusMessage *reply;
+ CompScreen *s;
+ CompOption *option;
+ int nOption = 0;
+ DBusMessage *reply;
- option = dbusGetOptionsFromPath (d, path, &s, &nOption);
+ option = dbusGetOptionsFromPath(d, path, &s, &nOption);
- reply = dbus_message_new_method_return (message);
+ reply = dbus_message_new_method_return(message);
- while (nOption--)
- {
- dbus_message_append_args (reply,
- DBUS_TYPE_STRING, &option->name,
- DBUS_TYPE_INVALID);
- option++;
- }
+ while (nOption--)
+ {
+ dbus_message_append_args(reply,
+ DBUS_TYPE_STRING, &option->name,
+ DBUS_TYPE_INVALID);
+ option++;
+ }
- dbus_connection_send (connection, reply, NULL);
- dbus_connection_flush (connection);
+ dbus_connection_send(connection, reply, NULL);
+ dbus_connection_flush(connection);
- dbus_message_unref (reply);
+ dbus_message_unref(reply);
- return TRUE;
+ return TRUE;
}
static Bool
-dbusHandleGetMetadataMessage (DBusConnection *connection,
- DBusMessage *message,
- CompDisplay *d,
- char **path)
+dbusHandleGetMetadataMessage(DBusConnection * connection,
+ DBusMessage * message,
+ CompDisplay * d, char **path)
{
- CompScreen *s;
- CompOption *option;
- int nOption = 0;
- DBusMessage *reply = NULL;
+ CompScreen *s;
+ CompOption *option;
+ int nOption = 0;
+ DBusMessage *reply = NULL;
- reply = dbus_message_new_method_return (message);
+ reply = dbus_message_new_method_return(message);
//check to see if we've been called on a plugin
if (!path[1])
@@ -768,593 +751,574 @@ dbusHandleGetMetadataMessage (DBusConnection *connection,
{
char *shortDesc = "General Options";
char *longDesc = "Options for Beryl as a whole";
- dbus_message_append_args (reply,
- DBUS_TYPE_STRING, &shortDesc,
- DBUS_TYPE_STRING, &longDesc,
- DBUS_TYPE_INVALID);
+
+ dbus_message_append_args(reply,
+ DBUS_TYPE_STRING, &shortDesc,
+ DBUS_TYPE_STRING, &longDesc,
+ DBUS_TYPE_INVALID);
}
else
{
CompPlugin *p;
- p = findActivePlugin (path[0]);
+
+ p = findActivePlugin(path[0]);
if (p)
{
- dbus_message_append_args (reply,
- DBUS_TYPE_STRING, &p->vTable->shortDesc,
- DBUS_TYPE_STRING, &p->vTable->longDesc,
- DBUS_TYPE_INVALID);
+ dbus_message_append_args(reply,
+ DBUS_TYPE_STRING,
+ &p->vTable->shortDesc,
+ DBUS_TYPE_STRING,
+ &p->vTable->longDesc,
+ DBUS_TYPE_INVALID);
}
}
}
else
{
- option = dbusGetOptionsFromPath (d, path, &s, &nOption);
+ option = dbusGetOptionsFromPath(d, path, &s, &nOption);
- while (nOption--)
- {
- if (strcmp (option->name, path[2]) == 0)
- {
- CompOptionType restrictionType = option->type;
- char *type;
-
- type = optionTypeToString (option->type);
-
- dbus_message_append_args (reply,
- DBUS_TYPE_STRING, &option->shortDesc,
- DBUS_TYPE_STRING, &option->longDesc,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_INVALID);
-
- if (restrictionType == CompOptionTypeList)
- {
- type = optionTypeToString (option->value.list.type);
- restrictionType = option->value.list.type;
-
- dbus_message_append_args (reply,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_INVALID);
- }
-
- switch (restrictionType) {
- case CompOptionTypeInt:
- dbus_message_append_args (reply,
- DBUS_TYPE_INT32, &option->rest.i.min,
- DBUS_TYPE_INT32, &option->rest.i.max,
- DBUS_TYPE_INVALID);
- break;
- case CompOptionTypeFloat: {
- double min, max, precision;
-
- min = option->rest.f.min;
- max = option->rest.f.max;
- precision = option->rest.f.precision;
-
- dbus_message_append_args (reply,
- DBUS_TYPE_DOUBLE, &min,
- DBUS_TYPE_DOUBLE, &max,
- DBUS_TYPE_DOUBLE, &precision,
- DBUS_TYPE_INVALID);
- } break;
- case CompOptionTypeString:
- if (option->rest.s.nString)
+ while (nOption--)
{
- char *possible;
- int i;
+ if (strcmp(option->name, path[2]) == 0)
+ {
+ CompOptionType restrictionType = option->type;
+ char *type;
- for (i = 0; i < option->rest.s.nString; i++)
- {
- possible = option->rest.s.string[i];
+ type = optionTypeToString(option->type);
- dbus_message_append_args (reply,
- DBUS_TYPE_STRING, &possible,
- DBUS_TYPE_INVALID);
- }
- }
- default:
- break;
- }
- break;
- }
+ dbus_message_append_args(reply,
+ DBUS_TYPE_STRING, &option->shortDesc,
+ DBUS_TYPE_STRING, &option->longDesc,
+ DBUS_TYPE_STRING, &type,
+ DBUS_TYPE_INVALID);
+
+ if (restrictionType == CompOptionTypeList)
+ {
+ type = optionTypeToString(option->value.list.type);
+ restrictionType = option->value.list.type;
- option++;
- }
+ dbus_message_append_args(reply,
+ DBUS_TYPE_STRING, &type,
+ DBUS_TYPE_INVALID);
+ }
+
+ switch (restrictionType)
+ {
+ case CompOptionTypeInt:
+ dbus_message_append_args(reply,
+ DBUS_TYPE_INT32,
+ &option->rest.i.min,
+ DBUS_TYPE_INT32,
+ &option->rest.i.max,
+ DBUS_TYPE_INVALID);
+ break;
+ case CompOptionTypeFloat:
+ {
+ double min, max, precision;
+
+ min = option->rest.f.min;
+ max = option->rest.f.max;
+ precision = option->rest.f.precision;
+
+ dbus_message_append_args(reply,
+ DBUS_TYPE_DOUBLE, &min,
+ DBUS_TYPE_DOUBLE, &max,
+ DBUS_TYPE_DOUBLE, &precision,
+ DBUS_TYPE_INVALID);
+ } break;
+ case CompOptionTypeString:
+ if (option->rest.s.nString)
+ {
+ char *possible;
+ int i;
+
+ for (i = 0; i < option->rest.s.nString; i++)
+ {
+ possible = option->rest.s.string[i];
+
+ dbus_message_append_args(reply,
+ DBUS_TYPE_STRING,
+ &possible,
+ DBUS_TYPE_INVALID);
+ }
+ }
+ default:
+ break;
+ }
+ break;
+ }
+
+ option++;
+ }
}
- if (!reply)
- reply = dbus_message_new_error (message,
- DBUS_ERROR_FAILED,
- "No such option");
+ if (!reply)
+ reply = dbus_message_new_error(message,
+ DBUS_ERROR_FAILED, "No such option");
- dbus_connection_send (connection, reply, NULL);
- dbus_connection_flush (connection);
+ dbus_connection_send(connection, reply, NULL);
+ dbus_connection_flush(connection);
- dbus_message_unref (reply);
+ dbus_message_unref(reply);
- return TRUE;
+ return TRUE;
}
static DBusHandlerResult
-dbusHandleMessage (DBusConnection *connection,
- DBusMessage *message,
- void *userData)
+dbusHandleMessage(DBusConnection * connection,
+ DBusMessage * message, void *userData)
{
- CompDisplay *d = (CompDisplay *) userData;
- Bool status = FALSE;
- char **path;
- const char *service, *interface, *member;
+ CompDisplay *d = (CompDisplay *) userData;
+ Bool status = FALSE;
+ char **path;
+ const char *service, *interface, *member;
- service = dbus_message_get_destination (message);
- interface = dbus_message_get_interface (message);
- member = dbus_message_get_member (message);
+ service = dbus_message_get_destination(message);
+ interface = dbus_message_get_interface(message);
+ member = dbus_message_get_member(message);
- if (!service || !interface || !member)
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ if (!service || !interface || !member)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- if (!dbus_message_is_method_call (message, interface, member))
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ if (!dbus_message_is_method_call(message, interface, member))
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- if (!dbus_message_has_destination (message, BERYL_DBUS_SERVICE_NAME))
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ if (!dbus_message_has_destination(message, BERYL_DBUS_SERVICE_NAME))
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- if (!dbus_message_get_path_decomposed (message, &path))
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ if (!dbus_message_get_path_decomposed(message, &path))
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- if (!path[0] || !path[1] || !path[2] || !path[3])
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ if (!path[0] || !path[1] || !path[2] || !path[3])
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- if (strcmp (path[0], "org") ||
- strcmp (path[1], "freedesktop")||
- strcmp (path[2], "beryl"))
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ if (strcmp(path[0], "org") ||
+ strcmp(path[1], "freedesktop") || strcmp(path[2], "beryl"))
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ if (dbus_message_has_member(message, BERYL_DBUS_ACTIVATE_MEMBER_NAME) &&
+ path[5])
+ {
+ status = dbusHandleActionMessage(connection, message, d, &path[3],
+ TRUE);
+ }
+ else if (dbus_message_has_member(message,
+ BERYL_DBUS_DEACTIVATE_MEMBER_NAME) &&
+ path[5])
+ {
+ status = dbusHandleActionMessage(connection, message, d, &path[3],
+ FALSE);
+ }
+ else if (dbus_message_has_member(message, BERYL_DBUS_SET_MEMBER_NAME) &&
+ path[5])
+ {
+ status = dbusHandleSetOptionMessage(connection, message, d, &path[3]);
+ }
+ else if (dbus_message_has_member(message,
+ BERYL_DBUS_GET_MEMBER_NAME) && path[5])
+ {
+ status = dbusHandleGetOptionMessage(connection, message, d, &path[3]);
+ }
+ else if (dbus_message_has_member(message,
+ BERYL_DBUS_GET_METADATA_MEMBER_NAME))
+ {
+ status = dbusHandleGetMetadataMessage(connection, message, d,
+ &path[3]);
+ }
+ else if (dbus_message_has_member(message, BERYL_DBUS_LIST_MEMBER_NAME))
+ {
+ status = dbusHandleListMessage(connection, message, d, &path[3]);
+ }
+
+ dbus_free_string_array(path);
- if (dbus_message_has_member (message, BERYL_DBUS_ACTIVATE_MEMBER_NAME) &&
- path[5])
- {
- status = dbusHandleActionMessage (connection, message, d, &path[3],
- TRUE);
- }
- else if (dbus_message_has_member (message,
- BERYL_DBUS_DEACTIVATE_MEMBER_NAME) &&
- path[5])
- {
- status = dbusHandleActionMessage (connection, message, d, &path[3],
- FALSE);
- }
- else if (dbus_message_has_member (message, BERYL_DBUS_SET_MEMBER_NAME) &&
- path[5])
- {
- status = dbusHandleSetOptionMessage (connection, message, d, &path[3]);
- }
- else if (dbus_message_has_member (message,
- BERYL_DBUS_GET_MEMBER_NAME) && path[5])
- {
- status = dbusHandleGetOptionMessage (connection, message, d, &path[3]);
- }
- else if (dbus_message_has_member (message,
- BERYL_DBUS_GET_METADATA_MEMBER_NAME))
- {
- status = dbusHandleGetMetadataMessage (connection, message, d,
- &path[3]);
- }
- else if (dbus_message_has_member (message,
- BERYL_DBUS_LIST_MEMBER_NAME))
- {
- status = dbusHandleListMessage (connection, message, d, &path[3]);
- }
-
- dbus_free_string_array (path);
-
- if (status)
- return DBUS_HANDLER_RESULT_HANDLED;
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ if (status)
+ return DBUS_HANDLER_RESULT_HANDLED;
+
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
-static Bool
-dbusProcessMessages (void *data)
+static Bool dbusProcessMessages(void *data)
{
- CompDisplay *d = (CompDisplay *) data;
- DBusDispatchStatus status;
+ CompDisplay *d = (CompDisplay *) data;
+ DBusDispatchStatus status;
- DBUS_DISPLAY (d);
+ DBUS_DISPLAY(d);
- do
- {
- dbus_connection_read_write_dispatch (dd->connection, 0);
- status = dbus_connection_get_dispatch_status (dd->connection);
- }
- while (status == DBUS_DISPATCH_DATA_REMAINS);
+ do
+ {
+ dbus_connection_read_write_dispatch(dd->connection, 0);
+ status = dbus_connection_get_dispatch_status(dd->connection);
+ }
+ while (status == DBUS_DISPATCH_DATA_REMAINS);
- return TRUE;
+ return TRUE;
}
static void
-dbusSendChangeSignalForOption (CompDisplay *d,
- CompOptionType type,
- CompOptionValue *value,
- char *path)
+dbusSendChangeSignalForOption(CompDisplay * d,
+ CompOptionType type,
+ CompOptionValue * value, char *path)
{
- DBusMessage *signal;
+ DBusMessage *signal;
- DBUS_DISPLAY (d);
+ DBUS_DISPLAY(d);
- signal = dbus_message_new_signal (path,
- BERYL_DBUS_SERVICE_NAME,
- BERYL_DBUS_CHANGED_SIGNAL_NAME);
+ signal = dbus_message_new_signal(path,
+ BERYL_DBUS_SERVICE_NAME,
+ BERYL_DBUS_CHANGED_SIGNAL_NAME);
- dbusAppendOptionValue (d, signal, type, value);
+ dbusAppendOptionValue(d, signal, type, value);
- dbus_connection_send (dd->connection, signal, NULL);
- dbus_connection_flush (dd->connection);
+ dbus_connection_send(dd->connection, signal, NULL);
+ dbus_connection_flush(dd->connection);
- dbus_message_unref (signal);
+ dbus_message_unref(signal);
}
static void
-dbusSendChangeSignalForDisplayOption (CompDisplay *d,
- CompOption *o,
- char *plugin)
+dbusSendChangeSignalForDisplayOption(CompDisplay * d,
+ CompOption * o, char *plugin)
{
- char path[256];
-
- if (o)
- {
- sprintf (path, "/org/freedesktop/beryl/%s/allscreens/%s",
- plugin, o->name);
- dbusSendChangeSignalForOption (d, o->type, &o->value, path);
- }
+ char path[256];
+
+ if (o)
+ {
+ sprintf(path, "/org/freedesktop/beryl/%s/allscreens/%s",
+ plugin, o->name);
+ dbusSendChangeSignalForOption(d, o->type, &o->value, path);
+ }
}
static void
-dbusSendChangeSignalForScreenOption (CompScreen *s,
- CompOption *o,
- char *plugin)
+dbusSendChangeSignalForScreenOption(CompScreen * s,
+ CompOption * o, char *plugin)
{
- char path[256];
-
- if (o)
- {
- sprintf (path, "/org/freedesktop/beryl/%s/screens%d/%s",
- plugin, s->screenNum, o->name);
- dbusSendChangeSignalForOption (s->display, o->type, &o->value, path);
- }
+ char path[256];
+
+ if (o)
+ {
+ sprintf(path, "/org/freedesktop/beryl/%s/screens%d/%s",
+ plugin, s->screenNum, o->name);
+ dbusSendChangeSignalForOption(s->display, o->type, &o->value, path);
+ }
}
static Bool
-dbusSetDisplayOption (CompDisplay *d,
- char *name,
- CompOptionValue *value)
+dbusSetDisplayOption(CompDisplay * d, char *name, CompOptionValue * value)
{
- Bool status;
+ Bool status;
- DBUS_DISPLAY (d);
+ DBUS_DISPLAY(d);
- UNWRAP (dd, d, setDisplayOption);
- status = (*d->setDisplayOption) (d, name, value);
- WRAP (dd, d, setDisplayOption, dbusSetDisplayOption);
+ UNWRAP(dd, d, setDisplayOption);
+ status = (*d->setDisplayOption) (d, name, value);
+ WRAP(dd, d, setDisplayOption, dbusSetDisplayOption);
- if (status)
- {
- CompOption *option;
- int nOption;
+ if (status)
+ {
+ CompOption *option;
+ int nOption;
- option = compGetDisplayOptions (d, &nOption);
- dbusSendChangeSignalForDisplayOption (d,
- compFindOption (option, nOption,
- name, 0),
- "core");
- }
+ option = compGetDisplayOptions(d, &nOption);
+ dbusSendChangeSignalForDisplayOption(d,
+ compFindOption(option, nOption,
+ name, 0), "core");
+ }
- return status;
+ return status;
}
static Bool
-dbusSetDisplayOptionForPlugin (CompDisplay *d,
- char *plugin,
- char *name,
- CompOptionValue *value)
+dbusSetDisplayOptionForPlugin(CompDisplay * d,
+ char *plugin,
+ char *name, CompOptionValue * value)
{
- Bool status;
+ Bool status;
- DBUS_DISPLAY (d);
+ DBUS_DISPLAY(d);
- UNWRAP (dd, d, setDisplayOptionForPlugin);
- status = (*d->setDisplayOptionForPlugin) (d, plugin, name, value);
- WRAP (dd, d, setDisplayOptionForPlugin, dbusSetDisplayOptionForPlugin);
+ UNWRAP(dd, d, setDisplayOptionForPlugin);
+ status = (*d->setDisplayOptionForPlugin) (d, plugin, name, value);
+ WRAP(dd, d, setDisplayOptionForPlugin, dbusSetDisplayOptionForPlugin);
- if (status)
- {
- CompPlugin *p;
-
- p = findActivePlugin (plugin);
- if (p && p->vTable->getDisplayOptions)
+ if (status)
{
- CompOption *option;
- int nOption;
-
- option = (*p->vTable->getDisplayOptions) (d, &nOption);
- dbusSendChangeSignalForDisplayOption (d,
- compFindOption (option,
- nOption,
- name, 0),
- p->vTable->name);
+ CompPlugin *p;
+
+ p = findActivePlugin(plugin);
+ if (p && p->vTable->getDisplayOptions)
+ {
+ CompOption *option;
+ int nOption;
+
+ option = (*p->vTable->getDisplayOptions) (d, &nOption);
+ dbusSendChangeSignalForDisplayOption(d,
+ compFindOption(option,
+ nOption,
+ name, 0),
+ p->vTable->name);
+ }
}
- }
- return status;
+ return status;
}
static Bool
-dbusSetScreenOption (CompScreen *s,
- char *name,
- CompOptionValue *value)
+dbusSetScreenOption(CompScreen * s, char *name, CompOptionValue * value)
{
- Bool status;
+ Bool status;
- DBUS_SCREEN (s);
+ DBUS_SCREEN(s);
- UNWRAP (ds, s, setScreenOption);
- status = (*s->setScreenOption) (s, name, value);
- WRAP (ds, s, setScreenOption, dbusSetScreenOption);
+ UNWRAP(ds, s, setScreenOption);
+ status = (*s->setScreenOption) (s, name, value);
+ WRAP(ds, s, setScreenOption, dbusSetScreenOption);
- if (status)
- {
- CompOption *option;
- int nOption;
-
- option = compGetScreenOptions (s, &nOption);
- dbusSendChangeSignalForScreenOption (s,
- compFindOption (option,
- nOption,
- name, 0),
- "core");
- }
+ if (status)
+ {
+ CompOption *option;
+ int nOption;
+
+ option = compGetScreenOptions(s, &nOption);
+ dbusSendChangeSignalForScreenOption(s,
+ compFindOption(option,
+ nOption,
+ name, 0), "core");
+ }
- return status;
+ return status;
}
static Bool
-dbusSetScreenOptionForPlugin (CompScreen *s,
- char *plugin,
- char *name,
- CompOptionValue *value)
+dbusSetScreenOptionForPlugin(CompScreen * s,
+ char *plugin,
+ char *name, CompOptionValue * value)
{
- Bool status;
-
- DBUS_SCREEN (s);
+ Bool status;
- UNWRAP (ds, s, setScreenOptionForPlugin);
- status = (*s->setScreenOptionForPlugin) (s, plugin, name, value);
- WRAP (ds, s, setScreenOptionForPlugin, dbusSetScreenOptionForPlugin);
+ DBUS_SCREEN(s);
- if (status)
- {
- CompPlugin *p;
+ UNWRAP(ds, s, setScreenOptionForPlugin);
+ status = (*s->setScreenOptionForPlugin) (s, plugin, name, value);
+ WRAP(ds, s, setScreenOptionForPlugin, dbusSetScreenOptionForPlugin);
- p = findActivePlugin (plugin);
- if (p && p->vTable->getScreenOptions)
+ if (status)
{
- CompOption *option;
- int nOption;
-
- option = (*p->vTable->getScreenOptions) (s, &nOption);
- dbusSendChangeSignalForScreenOption (s,
- compFindOption (option,
- nOption,
- name, 0),
- p->vTable->name);
+ CompPlugin *p;
+
+ p = findActivePlugin(plugin);
+ if (p && p->vTable->getScreenOptions)
+ {
+ CompOption *option;
+ int nOption;
+
+ option = (*p->vTable->getScreenOptions) (s, &nOption);
+ dbusSendChangeSignalForScreenOption(s,
+ compFindOption(option,
+ nOption,
+ name, 0),
+ p->vTable->name);
+ }
}
- }
- return status;
+ return status;
}
-static Bool
-dbusInitDisplay (CompPlugin *p,
- CompDisplay *d)
+static Bool dbusInitDisplay(CompPlugin * p, CompDisplay * d)
{
- DbusDisplay *dd;
- DBusError error;
- dbus_bool_t status;
- int fd, ret;
+ DbusDisplay *dd;
+ DBusError error;
+ dbus_bool_t status;
+ int fd, ret;
- dd = malloc (sizeof (DbusDisplay));
- if (!dd)
- return FALSE;
+ dd = malloc(sizeof(DbusDisplay));
+ if (!dd)
+ return FALSE;
- dd->screenPrivateIndex = allocateScreenPrivateIndex (d);
- if (dd->screenPrivateIndex < 0)
- {
- free (dd);
- return FALSE;
- }
+ dd->screenPrivateIndex = allocateScreenPrivateIndex(d);
+ if (dd->screenPrivateIndex < 0)
+ {
+ free(dd);
+ return FALSE;
+ }
- dbus_error_init (&error);
+ dbus_error_init(&error);
- dd->connection = dbus_bus_get (DBUS_BUS_SESSION, &error);
- if (dbus_error_is_set (&error))
- {
- fprintf (stderr, "%s: dbus_bus_get error: %s\n",
- getProgramName (), error.message);
+ dd->connection = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ if (dbus_error_is_set(&error))
+ {
+ fprintf(stderr, "%s: dbus_bus_get error: %s\n",
+ getProgramName(), error.message);
- dbus_error_free (&error);
- free (dd);
+ dbus_error_free(&error);
+ free(dd);
- return FALSE;
- }
+ return FALSE;
+ }
- ret = dbus_bus_request_name (dd->connection,
- BERYL_DBUS_SERVICE_NAME,
- DBUS_NAME_FLAG_REPLACE_EXISTING |
- DBUS_NAME_FLAG_ALLOW_REPLACEMENT,
- &error);
+ ret = dbus_bus_request_name(dd->connection,
+ BERYL_DBUS_SERVICE_NAME,
+ DBUS_NAME_FLAG_REPLACE_EXISTING |
+ DBUS_NAME_FLAG_ALLOW_REPLACEMENT, &error);
- if (dbus_error_is_set (&error))
- {
- fprintf (stderr, "%s: dbus_bus_request_name error: %s\n",
- getProgramName (), error.message);
+ if (dbus_error_is_set(&error))
+ {
+ fprintf(stderr, "%s: dbus_bus_request_name error: %s\n",
+ getProgramName(), error.message);
- /* dbus_connection_unref (dd->connection); */
- dbus_error_free (&error);
- free (dd);
+ /* dbus_connection_unref (dd->connection); */
+ dbus_error_free(&error);
+ free(dd);
- return FALSE;
- }
+ return FALSE;
+ }
- dbus_error_free (&error);
+ dbus_error_free(&error);
- if (ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
- {
- fprintf (stderr, "%s: dbus_bus_request_name reply is not "
- "primary owner\n", getProgramName ());
+ if (ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
+ {
+ fprintf(stderr, "%s: dbus_bus_request_name reply is not "
+ "primary owner\n", getProgramName());
- /* dbus_connection_unref (dd->connection); */
- free (dd);
+ /* dbus_connection_unref (dd->connection); */
+ free(dd);
- return FALSE;
- }
+ return FALSE;
+ }
- status = dbus_connection_add_filter (dd->connection,
- dbusHandleMessage,
- d, NULL);
- if (!status)
- {
- fprintf (stderr, "%s: dbus_connection_add_filter failed\n",
- getProgramName ());
+ status = dbus_connection_add_filter(dd->connection,
+ dbusHandleMessage, d, NULL);
+ if (!status)
+ {
+ fprintf(stderr, "%s: dbus_connection_add_filter failed\n",
+ getProgramName());
- /* dbus_connection_unref (dd->connection); */
- free (dd);
+ /* dbus_connection_unref (dd->connection); */
+ free(dd);
- return FALSE;
- }
+ return FALSE;
+ }
- status = dbus_connection_get_unix_fd (dd->connection, &fd);
- if (!status)
- {
- fprintf (stderr, "%s: dbus_connection_get_unix_fd failed\n",
- getProgramName ());
+ status = dbus_connection_get_unix_fd(dd->connection, &fd);
+ if (!status)
+ {
+ fprintf(stderr, "%s: dbus_connection_get_unix_fd failed\n",
+ getProgramName());
- /* dbus_connection_unref (dd->connection); */
- free (dd);
+ /* dbus_connection_unref (dd->connection); */
+ free(dd);
- return FALSE;
- }
+ return FALSE;
+ }
- dd->watchFdHandle = compAddWatchFd (fd,
- POLLIN | POLLPRI | POLLHUP | POLLERR,
- dbusProcessMessages,
- d);
+ dd->watchFdHandle = compAddWatchFd(fd,
+ POLLIN | POLLPRI | POLLHUP | POLLERR,
+ dbusProcessMessages, d);
- WRAP (dd, d, setDisplayOption, dbusSetDisplayOption);
- WRAP (dd, d, setDisplayOptionForPlugin, dbusSetDisplayOptionForPlugin);
+ WRAP(dd, d, setDisplayOption, dbusSetDisplayOption);
+ WRAP(dd, d, setDisplayOptionForPlugin, dbusSetDisplayOptionForPlugin);
- d->privates[displayPrivateIndex].ptr = dd;
+ d->privates[displayPrivateIndex].ptr = dd;
- return TRUE;
+ return TRUE;
}
-static void
-dbusFiniDisplay (CompPlugin *p,
- CompDisplay *d)
+static void dbusFiniDisplay(CompPlugin * p, CompDisplay * d)
{
- DBUS_DISPLAY (d);
+ DBUS_DISPLAY(d);
- compRemoveWatchFd (dd->watchFdHandle);
+ compRemoveWatchFd(dd->watchFdHandle);
- dbus_bus_release_name (dd->connection, BERYL_DBUS_SERVICE_NAME, NULL);
+ dbus_bus_release_name(dd->connection, BERYL_DBUS_SERVICE_NAME, NULL);
- /*
- can't unref the connection returned by dbus_bus_get as it's
- shared and we can't know if it's closed or not.
+ /*
+ can't unref the connection returned by dbus_bus_get as it's
+ shared and we can't know if it's closed or not.
- dbus_connection_unref (dd->connection);
- */
+ dbus_connection_unref (dd->connection);
+ */
- UNWRAP (dd, d, setDisplayOption);
- UNWRAP (dd, d, setDisplayOptionForPlugin);
-
- free (dd);
+ UNWRAP(dd, d, setDisplayOption);
+ UNWRAP(dd, d, setDisplayOptionForPlugin);
+
+ free(dd);
}
-static Bool
-dbusInitScreen (CompPlugin *p, CompScreen *s)
+static Bool dbusInitScreen(CompPlugin * p, CompScreen * s)
{
- DbusScreen *ds;
+ DbusScreen *ds;
- DBUS_DISPLAY (s->display);
+ DBUS_DISPLAY(s->display);
- ds = malloc (sizeof (DbusScreen));
- if (!ds)
- return FALSE;
+ ds = malloc(sizeof(DbusScreen));
+ if (!ds)
+ return FALSE;
- WRAP (ds, s, setScreenOption, dbusSetScreenOption);
- WRAP (ds, s, setScreenOptionForPlugin, dbusSetScreenOptionForPlugin);
+ WRAP(ds, s, setScreenOption, dbusSetScreenOption);
+ WRAP(ds, s, setScreenOptionForPlugin, dbusSetScreenOptionForPlugin);
- s->privates[dd->screenPrivateIndex].ptr = ds;
+ s->privates[dd->screenPrivateIndex].ptr = ds;
- return TRUE;
+ return TRUE;
}
-static void
-dbusFiniScreen (CompPlugin *p, CompScreen *s)
+static void dbusFiniScreen(CompPlugin * p, CompScreen * s)
{
- DBUS_SCREEN (s);
+ DBUS_SCREEN(s);
- UNWRAP (ds, s, setScreenOption);
- UNWRAP (ds, s, setScreenOptionForPlugin);
+ UNWRAP(ds, s, setScreenOption);
+ UNWRAP(ds, s, setScreenOptionForPlugin);
- free(ds);
+ free(ds);
}
-static Bool
-dbusInit (CompPlugin *p)
+static Bool dbusInit(CompPlugin * p)
{
- displayPrivateIndex = allocateDisplayPrivateIndex ();
- if (displayPrivateIndex < 0)
- return FALSE;
+ displayPrivateIndex = allocateDisplayPrivateIndex();
+ if (displayPrivateIndex < 0)
+ return FALSE;
- return TRUE;
+ return TRUE;
}
-static void
-dbusFini (CompPlugin *p)
+static void dbusFini(CompPlugin * p)
{
- if (displayPrivateIndex >= 0)
- freeDisplayPrivateIndex (displayPrivateIndex);
+ if (displayPrivateIndex >= 0)
+ freeDisplayPrivateIndex(displayPrivateIndex);
}
CompPluginVTable dbusVTable = {
- "dbus",
- "Dbus",
- "Dbus Control Backend",
- dbusInit,
- dbusFini,
- dbusInitDisplay,
- dbusFiniDisplay,
- dbusInitScreen,
- dbusFiniScreen,
- 0, /* InitWindow */
- 0, /* FiniWindow */
- 0, /* GetDisplayOptions */
- 0, /* SetDisplayOption */
- 0, /* GetScreenOptions */
- 0, /* SetScreenOption */
- 0, /* Deps */
- 0, /* nDeps */
- 0, /* Features */
- 0, /* nFeatures */
- BERYL_ABI_INFO,
- "beryl-dbus",
+ "dbus",
+ "Dbus",
+ "Dbus Control Backend",
+ dbusInit,
+ dbusFini,
+ dbusInitDisplay,
+ dbusFiniDisplay,
+ dbusInitScreen,
+ dbusFiniScreen,
+ 0, /* InitWindow */
+ 0, /* FiniWindow */
+ 0, /* GetDisplayOptions */
+ 0, /* SetDisplayOption */
+ 0, /* GetScreenOptions */
+ 0, /* SetScreenOption */
+ 0, /* Deps */
+ 0, /* nDeps */
+ 0, /* Features */
+ 0, /* nFeatures */
+ BERYL_ABI_INFO,
+ "beryl-dbus",
"misc",
0,
0,
True,
};
-CompPluginVTable *
-getCompPluginInfo (void)
+CompPluginVTable *getCompPluginInfo(void)
{
- return &dbusVTable;
+ return &dbusVTable;
}
diff --git a/beryl-plugins/src/decoration.c b/beryl-plugins/src/decoration.c
index 849fc6e..28a5760 100644
--- a/beryl-plugins/src/decoration.c
+++ b/beryl-plugins/src/decoration.c
@@ -170,7 +170,7 @@ typedef struct _DecorWindow
{
WindowDecoration *wd;
Decoration *decor;
- Bool needsUpdate;
+ Bool needsUpdate;
} DecorWindow;
#define GET_DECOR_DISPLAY(d) \
@@ -856,7 +856,7 @@ static void decorWindowUpdateDecoration(CompWindow * w)
DECOR_DISPLAY(w->screen->display);
DECOR_WINDOW(w);
- dw->needsUpdate=False;
+ dw->needsUpdate = False;
decoration = decorCreateDecoration(w->screen, w->id, dd->winDecorAtom);
@@ -1342,30 +1342,29 @@ static Bool decorDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
}
static void
-decorGetOutputExtentsForWindow (CompWindow *w,
- CompWindowExtents *output)
+decorGetOutputExtentsForWindow(CompWindow * w, CompWindowExtents * output)
{
- DECOR_SCREEN (w->screen);
- DECOR_WINDOW (w);
-
- UNWRAP (ds, w->screen, getOutputExtentsForWindow);
- (*w->screen->getOutputExtentsForWindow) (w, output);
- WRAP (ds, w->screen, getOutputExtentsForWindow,
- decorGetOutputExtentsForWindow);
-
- if (dw->wd)
- {
- CompWindowExtents *e = &dw->wd->decor->output;
-
- if (e->left > output->left)
- output->left = e->left;
- if (e->right > output->right)
- output->right = e->right;
- if (e->top > output->top)
- output->top = e->top;
- if (e->bottom > output->bottom)
- output->bottom = e->bottom;
- }
+ DECOR_SCREEN(w->screen);
+ DECOR_WINDOW(w);
+
+ UNWRAP(ds, w->screen, getOutputExtentsForWindow);
+ (*w->screen->getOutputExtentsForWindow) (w, output);
+ WRAP(ds, w->screen, getOutputExtentsForWindow,
+ decorGetOutputExtentsForWindow);
+
+ if (dw->wd)
+ {
+ CompWindowExtents *e = &dw->wd->decor->output;
+
+ if (e->left > output->left)
+ output->left = e->left;
+ if (e->right > output->right)
+ output->right = e->right;
+ if (e->top > output->top)
+ output->top = e->top;
+ if (e->bottom > output->bottom)
+ output->bottom = e->bottom;
+ }
}
static void
@@ -1395,7 +1394,8 @@ decorWindowMoveNotify(CompWindow * w, int dx, int dy, Bool immediate)
WRAP(ds, w->screen, windowMoveNotify, decorWindowMoveNotify);
}
-static void decorWindowResizeNotify(CompWindow * w, int dx, int dy, int dwidth, int dheight)
+static void decorWindowResizeNotify(CompWindow * w, int dx, int dy,
+ int dwidth, int dheight)
{
DECOR_SCREEN(w->screen);
@@ -1545,12 +1545,12 @@ static Bool decorInitWindow(CompPlugin * p, CompWindow * w)
w->privates[ds->windowPrivateIndex].ptr = dw;
- dw->needsUpdate=False;
+ dw->needsUpdate = False;
if (!w->attrib.override_redirect)
decorWindowUpdateDecoration(w);
if (w->shaded || w->attrib.map_state == IsViewable)
- dw->needsUpdate=True;
+ dw->needsUpdate = True;
return TRUE;
}
diff --git a/beryl-plugins/src/fade.c b/beryl-plugins/src/fade.c
index 3385047..7ce2dbb 100644
--- a/beryl-plugins/src/fade.c
+++ b/beryl-plugins/src/fade.c
@@ -420,9 +420,12 @@ static void fadeFini(CompPlugin * p)
}
CompPluginDep fadeDeps[] = {
- {CompPluginRuleAfter, "animation"},
- {CompPluginRuleAfter, "decoration"},
- {CompPluginRuleAfter, "wobbly"},
+ {CompPluginRuleAfter, "animation"}
+ ,
+ {CompPluginRuleAfter, "decoration"}
+ ,
+ {CompPluginRuleAfter, "wobbly"}
+ ,
};
static CompPluginVTable fadeVTable = {
diff --git a/beryl-plugins/src/inputzoom.c b/beryl-plugins/src/inputzoom.c
index 208971b..30c96cf 100644
--- a/beryl-plugins/src/inputzoom.c
+++ b/beryl-plugins/src/inputzoom.c
@@ -494,9 +494,9 @@ zoomApplyScreenTransform(CompScreen * s,
if (zs->active && (!pCaps || !(*pCaps)))
{
- float ox,oy,ow,oh;
+ float ox, oy, ow, oh;
- int mmMode = IPCS_GetIntND(IPCS_OBJECT(s),"MM_MODE",0);
+ int mmMode = IPCS_GetIntND(IPCS_OBJECT(s), "MM_MODE", 0);
if (mmMode == 1)
{
@@ -515,6 +515,7 @@ zoomApplyScreenTransform(CompScreen * s,
float tx = zs->mouseX - (ox + (ow / 2.0));
float ty = zs->mouseY - (oy + (oh / 2.0));
+
tx /= ow;
tx = -(tx * (zs->xscale - 1));
ty /= oh;
@@ -525,8 +526,7 @@ zoomApplyScreenTransform(CompScreen * s,
}
}
-static Bool
-zoomUpdateMouse (void *vs)
+static Bool zoomUpdateMouse(void *vs)
{
CompScreen *s = (CompScreen *) vs;
@@ -542,9 +542,8 @@ zoomUpdateMouse (void *vs)
Window child_return;
XQueryPointer(s->display->display, s->root,
- &root_return, &child_return,
- &rootX, &rootY, &winX,
- &winY, &mask_return);
+ &root_return, &child_return,
+ &rootX, &rootY, &winX, &winY, &mask_return);
if (rootX != zs->mouseX || rootY != zs->mouseY)
{
@@ -555,8 +554,8 @@ zoomUpdateMouse (void *vs)
}
zs->mouseTimeout =
- compAddTimeout(zs->opt[ZOOM_SCREEN_OPTION_MOUSE_UPDATE].value.i,
- zoomUpdateMouse, s);
+ compAddTimeout(zs->opt[ZOOM_SCREEN_OPTION_MOUSE_UPDATE].value.i,
+ zoomUpdateMouse, s);
return FALSE;
}
@@ -565,8 +564,8 @@ static void zoomPreparePaintScreen(CompScreen * s, int msSinceLastPaint)
ZOOM_SCREEN(s);
ZOOM_DISPLAY(s->display);
- if (screenGrabExist (s, "rotate","cube",0) &&
- zs->opt[ZOOM_SCREEN_OPTION_OUT_ON_CUBE].value.b)
+ if (screenGrabExist(s, "rotate", "cube", 0) &&
+ zs->opt[ZOOM_SCREEN_OPTION_OUT_ON_CUBE].value.b)
zs->toScale = 1.0f;
else
zs->toScale = zs->newScale;
@@ -600,7 +599,7 @@ static void zoomPreparePaintScreen(CompScreen * s, int msSinceLastPaint)
zs->yscale = zs->currentScale;
if (zs->currentScale == 1.0f && zs->zVelocity == 0.0f &&
- zs->newScale == 1.0)
+ zs->newScale == 1.0)
{
zs->active = FALSE;
if (zs->mouseTimeout)
@@ -614,7 +613,7 @@ static void zoomPreparePaintScreen(CompScreen * s, int msSinceLastPaint)
}
if (zs->currentScale == 1.0f && zs->zVelocity == 0.0f &&
- zs->newScale == 1.0)
+ zs->newScale == 1.0)
{
zs->active = FALSE;
if (zs->mouseTimeout)
@@ -709,8 +708,8 @@ zoomPaintTransformedScreen(CompScreen * s, const ScreenPaintAttrib * sa,
r.rects = &r.extents;
r.numRects = 1;
- if (screenGrabExist (s, "rotate","cube",0) &&
- IPCS_GetIntND(IPCS_OBJECT(s),"MM_MODE",0) == 1)
+ if (screenGrabExist(s, "rotate", "cube", 0) &&
+ IPCS_GetIntND(IPCS_OBJECT(s), "MM_MODE", 0) == 1)
{
r.extents.x1 = zs->mouseX - (zs->mouseX / zs->xscale);
r.extents.y1 = zs->mouseY - (zs->mouseY / zs->yscale);
@@ -730,10 +729,10 @@ zoomPaintTransformedScreen(CompScreen * s, const ScreenPaintAttrib * sa,
}
- r.extents.x1 = MAX(0,r.extents.x1);
- r.extents.y1 = MAX(0,r.extents.y1);
- r.extents.x2 = MIN(s->width,r.extents.x2);
- r.extents.y2 = MIN(s->height,r.extents.y2);
+ r.extents.x1 = MAX(0, r.extents.x1);
+ r.extents.y1 = MAX(0, r.extents.y1);
+ r.extents.x2 = MIN(s->width, r.extents.x2);
+ r.extents.y2 = MIN(s->height, r.extents.y2);
UNWRAP(zs, s, paintTransformedScreen);
(*s->paintTransformedScreen) (s, sa, &r, output, mask);
@@ -801,8 +800,8 @@ zoomIn(CompDisplay * d,
if (!zs->mouseTimeout)
zs->mouseTimeout =
- compAddTimeout(zs->opt[ZOOM_SCREEN_OPTION_MOUSE_UPDATE].value.i,
- zoomUpdateMouse, s);
+ compAddTimeout(zs->opt[ZOOM_SCREEN_OPTION_MOUSE_UPDATE].
+ value.i, zoomUpdateMouse, s);
if (zd->fixesSupported && !zs->cursorInfoSelected && zs->showScaled)
{
@@ -848,8 +847,8 @@ zoomOut(CompDisplay * d,
if (!zs->mouseTimeout)
zs->mouseTimeout =
- compAddTimeout(zs->opt[ZOOM_SCREEN_OPTION_MOUSE_UPDATE].value.i,
- zoomUpdateMouse, s);
+ compAddTimeout(zs->opt[ZOOM_SCREEN_OPTION_MOUSE_UPDATE].
+ value.i, zoomUpdateMouse, s);
if (zd->fixesSupported && !zs->cursorInfoSelected && zs->showScaled)
{
@@ -1145,7 +1144,8 @@ static void zoomFini(CompPlugin * p)
}
CompPluginDep zoomDeps[] = {
- {CompPluginRuleBefore, "cube"},
+ {CompPluginRuleBefore, "cube"}
+ ,
};
CompPluginFeature zoomFeatures[] = {
diff --git a/beryl-plugins/src/jpeg.c b/beryl-plugins/src/jpeg.c
index ca1412c..c0f867e 100644
--- a/beryl-plugins/src/jpeg.c
+++ b/beryl-plugins/src/jpeg.c
@@ -54,7 +54,8 @@ typedef struct _JPEGDisplay
#define NUM_OPTIONS(d) (sizeof ((d)->opt) / sizeof (CompOption))
-static Bool rgbToBGRA(const JSAMPLE *source, void **data, int height, int width, int alpha)
+static Bool rgbToBGRA(const JSAMPLE * source, void **data, int height,
+ int width, int alpha)
{
int h, w;
char *dest;
@@ -77,10 +78,11 @@ static Bool rgbToBGRA(const JSAMPLE *source, void **data, int height, int width,
return TRUE;
}
-static Bool rgbaToRGB(char *source, JSAMPLE **dest, int height, int width, int stride)
+static Bool rgbaToRGB(char *source, JSAMPLE ** dest, int height, int width,
+ int stride)
{
int h, w;
- int ps = stride / width; /* pixel size */
+ int ps = stride / width; /* pixel size */
JSAMPLE *d;
d = malloc(height * width * 3 * sizeof(JSAMPLE));
@@ -92,15 +94,16 @@ static Bool rgbaToRGB(char *source, JSAMPLE **dest, int height, int width, int s
for (h = 0; h < height; h++)
for (w = 0; w < width; w++)
{
- d[((h * width + w) * 3) + 0] = source[((h * width + w) * ps) + 0];//R
- d[((h * width + w) * 3) + 1] = source[((h * width + w) * ps) + 1];//G
- d[((h * width + w) * 3) + 2] = source[((h * width + w) * ps) + 2];//B
+ d[((h * width + w) * 3) + 0] = source[((h * width + w) * ps) + 0]; //R
+ d[((h * width + w) * 3) + 1] = source[((h * width + w) * ps) + 1]; //G
+ d[((h * width + w) * 3) + 2] = source[((h * width + w) * ps) + 2]; //B
}
return TRUE;
}
-static Bool readJPEGFileToImage(FILE *file, int *width, int *height, void **data)
+static Bool readJPEGFileToImage(FILE * file, int *width, int *height,
+ void **data)
{
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
@@ -125,24 +128,24 @@ static Bool readJPEGFileToImage(FILE *file, int *width, int *height, void **data
*height = cinfo.output_height;
*width = cinfo.output_width;
- buf = malloc(cinfo.output_height * cinfo.output_width *
- cinfo.output_components * sizeof(JSAMPLE));
+ buf = malloc(cinfo.output_height * cinfo.output_width *
+ cinfo.output_components * sizeof(JSAMPLE));
if (!buf)
return FALSE;
rows = malloc(cinfo.output_height * sizeof(JSAMPROW));
if (!rows)
{
- free (buf);
+ free(buf);
return FALSE;
}
- for(i = 0; i < cinfo.output_height; i++)
- rows[i] = &buf[i * cinfo.output_width * cinfo.output_components];
+ for (i = 0; i < cinfo.output_height; i++)
+ rows[i] = &buf[i * cinfo.output_width * cinfo.output_components];
- while (cinfo.output_scanline < cinfo.output_height)
- jpeg_read_scanlines(&cinfo, &rows[cinfo.output_scanline],
- cinfo.output_height - cinfo.output_scanline);
+ while (cinfo.output_scanline < cinfo.output_height)
+ jpeg_read_scanlines(&cinfo, &rows[cinfo.output_scanline],
+ cinfo.output_height - cinfo.output_scanline);
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
@@ -161,8 +164,8 @@ static Bool readJPEGFileToImage(FILE *file, int *width, int *height, void **data
}
-static Bool writeJPEG(CompDisplay *d, void *buffer, FILE *file,
- int width, int height, int stride)
+static Bool writeJPEG(CompDisplay * d, void *buffer, FILE * file,
+ int width, int height, int stride)
{
struct jpeg_compress_struct cinfo;
struct jpeg_error_mgr jerr;
@@ -186,13 +189,15 @@ static Bool writeJPEG(CompDisplay *d, void *buffer, FILE *file,
cinfo.in_color_space = JCS_RGB;
jpeg_set_defaults(&cinfo);
- jpeg_set_quality(&cinfo,
- jd->opt[JPEG_DISPLAY_OPTION_QUALITY].value.i, TRUE);
+ jpeg_set_quality(&cinfo,
+ jd->opt[JPEG_DISPLAY_OPTION_QUALITY].value.i, TRUE);
jpeg_start_compress(&cinfo, TRUE);
- while (cinfo.next_scanline < cinfo.image_height) {
- row_pointer[0] =
- &data[(cinfo.image_height - cinfo.next_scanline - 1) * width * 3];
+ while (cinfo.next_scanline < cinfo.image_height)
+ {
+ row_pointer[0] =
+ &data[(cinfo.image_height - cinfo.next_scanline -
+ 1) * width * 3];
jpeg_write_scanlines(&cinfo, row_pointer, 1);
}
@@ -237,11 +242,11 @@ static char *createFilename(const char *path, const char *name)
}
-static Bool JPEGImageToFile(CompDisplay *d,
- const char *path,
- const char *name,
- const char *format,
- int width, int height, int stride, void *data)
+static Bool JPEGImageToFile(CompDisplay * d,
+ const char *path,
+ const char *name,
+ const char *format,
+ int width, int height, int stride, void *data)
{
Bool status = FALSE;
@@ -250,7 +255,8 @@ static Bool JPEGImageToFile(CompDisplay *d,
{
JPEG_DISPLAY(d);
UNWRAP(jd, d, imageToFile);
- status = (*d->imageToFile) (d, path, name, format, width, height, stride, data);
+ status = (*d->imageToFile) (d, path, name, format, width, height,
+ stride, data);
WRAP(jd, d, imageToFile, JPEGImageToFile);
return status;
}
@@ -258,10 +264,11 @@ static Bool JPEGImageToFile(CompDisplay *d,
// Is a JPEG
char *filename = createFilename(path, name);
- if (!filename)
+ if (!filename)
return FALSE;
FILE *file = fopen(filename, "wb");
+
if (file)
{
status = writeJPEG(d, data, file, width, height, stride);
@@ -272,32 +279,35 @@ static Bool JPEGImageToFile(CompDisplay *d,
return status;
}
-static Bool JPEGFileToImage(CompDisplay *d,
- const char *path,
- const char *name,
- int *width, int *height, int *stride, void **data)
+static Bool JPEGFileToImage(CompDisplay * d,
+ const char *path,
+ const char *name,
+ int *width, int *height, int *stride, void **data)
{
Bool status = FALSE;
-
+
char *filename = createFilename(path, name);
- if (!filename)
+
+ if (!filename)
return FALSE;
// Do some testing here to see if it's got a .jpg or .jpeg extension
// TODO: fix for mixed & uppercase extensions!
char *extension = strrchr(filename, '.');
+
if (extension)
- {
- if (strcasecmp(extension, ".jpeg") == 0 ||
+ {
+ if (strcasecmp(extension, ".jpeg") == 0 ||
strcasecmp(extension, ".jpg") == 0)
{
FILE *file = fopen(filename, "rb");
+
if (file)
{
status = readJPEGFileToImage(file, width, height, data);
fclose(file);
-
- if (status) // Success!
+
+ if (status) // Success!
{
free(filename);
*stride = *width * 4;
@@ -307,7 +317,7 @@ static Bool JPEGFileToImage(CompDisplay *d,
}
}
- free(filename);
+ free(filename);
// Isn't a JPEG - pass to the next in the chain.
JPEG_DISPLAY(d);
@@ -319,7 +329,7 @@ static Bool JPEGFileToImage(CompDisplay *d,
return status;
}
-static void JPEGDisplayInitOptions(JPEGDisplay *jd)
+static void JPEGDisplayInitOptions(JPEGDisplay * jd)
{
CompOption *o;
@@ -337,7 +347,7 @@ static void JPEGDisplayInitOptions(JPEGDisplay *jd)
o->rest.i.max = JPEG_QUALITY_MAX;
}
-static CompOption *JPEGGetDisplayOptions(CompDisplay *display, int *count)
+static CompOption *JPEGGetDisplayOptions(CompDisplay * display, int *count)
{
if (display)
{
@@ -345,7 +355,9 @@ static CompOption *JPEGGetDisplayOptions(CompDisplay *display, int *count)
*count = NUM_OPTIONS(jd);
return jd->opt;
- } else {
+ }
+ else
+ {
JPEGDisplay *jd = malloc(sizeof(JPEGDisplay));
JPEGDisplayInitOptions(jd);
@@ -354,8 +366,9 @@ static CompOption *JPEGGetDisplayOptions(CompDisplay *display, int *count)
}
}
-static Bool
-JPEGSetDisplayOption(CompDisplay *display, char *name, CompOptionValue *value)
+static Bool
+JPEGSetDisplayOption(CompDisplay * display, char *name,
+ CompOptionValue * value)
{
CompOption *o;
int index;
@@ -364,7 +377,7 @@ JPEGSetDisplayOption(CompDisplay *display, char *name, CompOptionValue *value)
o = compFindOption(jd->opt, NUM_OPTIONS(jd), name, &index);
if (!o)
- return FALSE;
+ return FALSE;
switch (index)
{
@@ -379,7 +392,7 @@ JPEGSetDisplayOption(CompDisplay *display, char *name, CompOptionValue *value)
return FALSE;
}
-static Bool JPEGInitDisplay(CompPlugin *p, CompDisplay *d)
+static Bool JPEGInitDisplay(CompPlugin * p, CompDisplay * d)
{
JPEGDisplay *jd;
CompScreen *s;
@@ -401,7 +414,7 @@ static Bool JPEGInitDisplay(CompPlugin *p, CompDisplay *d)
return TRUE;
}
-static void JPEGFiniDisplay(CompPlugin *p, CompDisplay *d)
+static void JPEGFiniDisplay(CompPlugin * p, CompDisplay * d)
{
CompScreen *s;
@@ -410,14 +423,14 @@ static void JPEGFiniDisplay(CompPlugin *p, CompDisplay *d)
UNWRAP(jd, d, fileToImage);
UNWRAP(jd, d, imageToFile);
- for (s = d->screens; s; s = s->next)
+ for (s = d->screens; s; s = s->next)
updateDefaultIcon(s);
free(jd);
}
-static Bool JPEGInit(CompPlugin *p)
+static Bool JPEGInit(CompPlugin * p)
{
displayPrivateIndex = allocateDisplayPrivateIndex();
if (displayPrivateIndex < 0)
@@ -426,16 +439,19 @@ static Bool JPEGInit(CompPlugin *p)
return TRUE;
}
-static void JPEGFini(CompPlugin *p)
+static void JPEGFini(CompPlugin * p)
{
if (displayPrivateIndex >= 0)
freeDisplayPrivateIndex(displayPrivateIndex);
}
-CompPluginFeature JPEGFeatures[]={
- {"imageext:jpeg"},
- {"imageext:jpg"},
- {"imagemime:image/jpeg"},
+CompPluginFeature JPEGFeatures[] = {
+ {"imageext:jpeg"}
+ ,
+ {"imageext:jpg"}
+ ,
+ {"imagemime:image/jpeg"}
+ ,
};
CompPluginVTable JPEGVTable = {
@@ -446,7 +462,7 @@ CompPluginVTable JPEGVTable = {
JPEGFini,
JPEGInitDisplay,
JPEGFiniDisplay,
- 0,
+ 0,
0,
0,
0,
@@ -457,7 +473,7 @@ CompPluginVTable JPEGVTable = {
0,
0,
JPEGFeatures,
- sizeof(JPEGFeatures)/sizeof(JPEGFeatures[0]),
+ sizeof(JPEGFeatures) / sizeof(JPEGFeatures[0]),
BERYL_ABI_INFO,
"beryl-plugins",
"imageformat",
diff --git a/beryl-plugins/src/move.c b/beryl-plugins/src/move.c
index 21b6480..e9aee94 100644
--- a/beryl-plugins/src/move.c
+++ b/beryl-plugins/src/move.c
@@ -185,7 +185,7 @@ moveInitiate(CompDisplay * d,
if (md->region)
{
- XDestroyRegion (md->region);
+ XDestroyRegion(md->region);
md->region = NULL;
}
@@ -213,7 +213,8 @@ moveInitiate(CompDisplay * d,
CompWindowGrabMoveMask
| CompWindowGrabButtonMask);
- if (md->moveOpacity != OPAQUE && w->paint.opacity >= md->opacifyMinOpacity)
+ if (md->moveOpacity != OPAQUE &&
+ w->paint.opacity >= md->opacifyMinOpacity)
{
/* modify opacity of windows that are not active */
setWindowOpacity(w, md->moveOpacity, PL_TEMP_HELLO);
@@ -273,37 +274,36 @@ moveTerminate(CompDisplay * d,
return FALSE;
}
-static Region
-moveGetYConstrainRegion (CompScreen *s)
+static Region moveGetYConstrainRegion(CompScreen * s)
{
CompWindow *w;
- Region region;
- REGION r;
- int i;
+ Region region;
+ REGION r;
+ int i;
- region = XCreateRegion ();
+ region = XCreateRegion();
if (!region)
- return NULL;
+ return NULL;
- r.rects = &r.extents;
- r.numRects = r.size = 1;
+ r.rects = &r.extents;
+ r.numRects = r.size = 1;
r.extents.x1 = MINSHORT;
r.extents.y1 = 0;
r.extents.x2 = 0;
r.extents.y2 = s->height;
- XUnionRegion (&r, region, region);
+ XUnionRegion(&r, region, region);
r.extents.x1 = s->width;
r.extents.x2 = MAXSHORT;
XUnionRegion(&r, region, region);
- for (i = 0;i < s->nOutputDev; i++)
- XUnionRegion (&s->outputDev[i].region, region, region);
+ for (i = 0; i < s->nOutputDev; i++)
+ XUnionRegion(&s->outputDev[i].region, region, region);
- for (w = s->windows; w; w = w->next)
+ for (w = s->windows; w; w = w->next)
{
if (!w->mapNum)
continue;
@@ -315,18 +315,18 @@ moveGetYConstrainRegion (CompScreen *s)
r.extents.x2 = r.extents.x1 + w->struts->top.width;
r.extents.y2 = r.extents.y1 + w->struts->top.height;
- XSubtractRegion (region, &r, region);
+ XSubtractRegion(region, &r, region);
r.extents.x1 = w->struts->bottom.x;
r.extents.y1 = w->struts->bottom.y;
r.extents.x2 = r.extents.x1 + w->struts->bottom.width;
r.extents.y2 = r.extents.y1 + w->struts->bottom.height;
- XSubtractRegion (region, &r, region);
+ XSubtractRegion(region, &r, region);
}
}
- return region;
+ return region;
}
@@ -361,9 +361,9 @@ static void moveHandleMotionEvent(CompScreen * s, int xRoot, int yRoot)
XRectangle workArea;
int min, max;
Bool constrainTop =
- md->opt[MOVE_DISPLAY_OPTION_CONSTRAIN_Y_TOP].value.b;
+ md->opt[MOVE_DISPLAY_OPTION_CONSTRAIN_Y_TOP].value.b;
Bool constrainBottom =
- md->opt[MOVE_DISPLAY_OPTION_CONSTRAIN_Y_BOTTOM].value.b;
+ md->opt[MOVE_DISPLAY_OPTION_CONSTRAIN_Y_BOTTOM].value.b;
dx = md->x;
dy = md->y;
@@ -374,11 +374,11 @@ static void moveHandleMotionEvent(CompScreen * s, int xRoot, int yRoot)
if (constrainTop || constrainBottom)
{
if (!md->region)
- md->region = moveGetYConstrainRegion (s);
+ md->region = moveGetYConstrainRegion(s);
/* make sure that the top frame extents or the top row of
- pixels are within what is currently our valid screen
- region */
+ pixels are within what is currently our valid screen
+ region */
if (md->region)
{
int x, y, width, height;
@@ -386,21 +386,21 @@ static void moveHandleMotionEvent(CompScreen * s, int xRoot, int yRoot)
if (constrainTop)
{
- y = w->attrib.y + dy - w->input.top;
+ y = w->attrib.y + dy - w->input.top;
height = w->input.top ? w->input.top : 1;
if (constrainBottom)
height += w->height + w->input.bottom;
}
else if (constrainBottom)
{
- y = w->attrib.y + dy + w->height;
+ y = w->attrib.y + dy + w->height;
height = w->input.bottom ? w->input.bottom : 1;
}
x = w->attrib.x + dx - w->input.left;
width = w->width + w->input.left + w->input.right;
- status = XRectInRegion (md->region, x, y, width, height);
+ status = XRectInRegion(md->region, x, y, width, height);
/* only constrain movement if previous position was valid */
if (md->status == RectangleIn)
@@ -409,7 +409,9 @@ static void moveHandleMotionEvent(CompScreen * s, int xRoot, int yRoot)
while (dx && xStatus != RectangleIn)
{
- xStatus = XRectInRegion (md->region, x, y - dy, width, height);
+ xStatus =
+ XRectInRegion(md->region, x, y - dy,
+ width, height);
if (xStatus != RectangleIn)
dx += (dx < 0) ? 1 : -1;
@@ -419,14 +421,15 @@ static void moveHandleMotionEvent(CompScreen * s, int xRoot, int yRoot)
while (dy && status != RectangleIn)
{
- status = XRectInRegion (md->region,
- x, y, width, height);
+ status = XRectInRegion(md->region,
+ x, y, width, height);
if (status != RectangleIn)
dy += (dy < 0) ? 1 : -1;
y = w->attrib.y + dy +
- (constrainTop ? (-w->input.top) : w->height);
+ (constrainTop ? (-w->input.top) : w->
+ height);
}
}
else
diff --git a/beryl-plugins/src/opacify.c b/beryl-plugins/src/opacify.c
index 2206b32..3faac4b 100644
--- a/beryl-plugins/src/opacify.c
+++ b/beryl-plugins/src/opacify.c
@@ -214,7 +214,7 @@ static void opacify_handle_enter(CompScreen * s, CompWindow * w)
OPACIFY_SCREEN(s);
int num;
- if (screenGrabExist(s, "move", 0))
+ if (screenGrabExist(s, "move", 0))
{
os->just_moved = True;
return;
@@ -252,9 +252,11 @@ static void opacify_handle_enter(CompScreen * s, CompWindow * w)
static Bool handle_timeout(void *data)
{
CompScreen *s = (CompScreen *) data;
+
OPACIFY_SCREEN(s);
OPACIFY_DISPLAY(s->display);
- CompWindow * w;
+ CompWindow *w;
+
os->timeout_handle = 0;
if (UNLIKELY(!od->toggle))
{
@@ -288,7 +290,7 @@ static void opacifyHandleEvent(CompDisplay * d, XEvent * event)
(*d->handleEvent) (d, event);
WRAP(od, d, handleEvent, opacifyHandleEvent);
- if (!od->toggle && !od->toggle_reset)
+ if (!od->toggle && !od->toggle_reset)
return;
switch (event->type)
@@ -301,13 +303,14 @@ static void opacifyHandleEvent(CompDisplay * d, XEvent * event)
if (!od->toggle && !os->active)
return;
os->new_active = event->xcrossing.window;
- if (os->timeout_handle)
+ if (os->timeout_handle)
compRemoveTimeout(os->timeout_handle);
- if((os->opt[OPACIFY_SCREEN_OPTION_FOCUS_INSTANT].value.b
- && os->new_active == d->activeWindow) || !os->timeout)
+ if ((os->opt[OPACIFY_SCREEN_OPTION_FOCUS_INSTANT].value.b
+ && os->new_active == d->activeWindow) || !os->timeout)
handle_timeout(s);
else
- os->timeout_handle = compAddTimeout(os->timeout,handle_timeout,s);
+ os->timeout_handle =
+ compAddTimeout(os->timeout, handle_timeout, s);
}
break;
case ConfigureNotify:
@@ -320,7 +323,7 @@ static void opacifyHandleEvent(CompDisplay * d, XEvent * event)
clear_passive(s);
if (LIKELY(os->active))
w = find_window(s, os->active);
- if (w)
+ if (w)
passive_windows(s, w->region);
}
break;
@@ -340,7 +343,7 @@ static void opacifyFiniScreen(CompPlugin * p, CompScreen * s)
removeScreenAction(s, &od->opt[OPACIFY_DISPLAY_OPTION_TOGGLE].value.
action);
- if (os->timeout_handle)
+ if (os->timeout_handle)
compRemoveTimeout(os->timeout_handle);
XDestroyRegion(os->intersect);
free(os);
@@ -430,14 +433,14 @@ static void opacifyScreenInitOptions(OpacifyScreen * os)
o->group = N_("Misc. options");
o->subGroup = N_("");
o->displayHints = "";
- o->shortDesc = N_("Bypass delay when the new active window is the focused window.");
- o->longDesc =
+ o->shortDesc =
N_
- ("Do not wait if the window we are hoovering is the focused "
- "window. This allows us to instantly see the focused window."
- "You probably want to disable this if you are not using "
- "\"Click to Focus\"."
- );
+ ("Bypass delay when the new active window is the focused window.");
+ o->longDesc =
+ N_("Do not wait if the window we are hoovering is the focused "
+ "window. This allows us to instantly see the focused window."
+ "You probably want to disable this if you are not using "
+ "\"Click to Focus\".");
o->type = CompOptionTypeBool;
o->value.b = FALSE;
o->advanced = False;
@@ -626,8 +629,9 @@ static Bool opacifySetDisplayOptions(CompDisplay * display, char *name,
return TRUE;
break;
case OPACIFY_DISPLAY_OPTION_INIT_TOGGLE:
- if (compSetBoolOption(o, value)) {
- od->toggle = o->value.b;
+ if (compSetBoolOption(o, value))
+ {
+ od->toggle = o->value.b;
return TRUE;
}
break;
diff --git a/beryl-plugins/src/png.c b/beryl-plugins/src/png.c
index 4ecc8a0..4905fbd 100644
--- a/beryl-plugins/src/png.c
+++ b/beryl-plugins/src/png.c
@@ -481,9 +481,11 @@ static void pngFini(CompPlugin * p)
freeDisplayPrivateIndex(displayPrivateIndex);
}
-CompPluginFeature pngFeatures[]={
- {"imageext:png"},
- {"imagemime:image/png"},
+CompPluginFeature pngFeatures[] = {
+ {"imageext:png"}
+ ,
+ {"imagemime:image/png"}
+ ,
};
CompPluginVTable pngVTable = {
@@ -504,8 +506,8 @@ CompPluginVTable pngVTable = {
0, /* SetScreenOption */
0, /* Deps */
0, /* nDeps */
- pngFeatures, /* Features */
- sizeof(pngFeatures)/sizeof(pngFeatures[0]), /* nFeatures */
+ pngFeatures, /* Features */
+ sizeof(pngFeatures) / sizeof(pngFeatures[0]), /* nFeatures */
BERYL_ABI_INFO,
"beryl-plugins",
"imageformat",
diff --git a/beryl-plugins/src/put.c b/beryl-plugins/src/put.c
index 11548f3..0679fea 100644
--- a/beryl-plugins/src/put.c
+++ b/beryl-plugins/src/put.c
@@ -191,7 +191,7 @@ typedef struct _PutScreen
float timestep; /* animation time step */
int moreAdjust; /* animation flag */
int grabIndex; /* screen grab index */
- CompWindow *grabbedWindow; /* the window we have issued a grab notify for */
+ CompWindow *grabbedWindow; /* the window we have issued a grab notify for */
Bool ownAnim; /* animation bypass flag */
int padLeft, padTop, padRight, padBottom; /* position padding */
Bool vpMoving; /* viewport move flag */
@@ -595,7 +595,7 @@ static void putDonePaintScreen(CompScreen * s)
if (w->attrib.x == w->serverX && w->attrib.y == w->serverY)
{
- (*w->screen->windowUngrabNotify)(w);
+ (*w->screen->windowUngrabNotify) (w);
ps->grabbedWindow = NULL;
}
}
@@ -1065,9 +1065,11 @@ putInitiate(CompDisplay * d, CompAction * action, CompActionState state,
* this is so wobbly will animate the window. */
(w->screen->windowGrabNotify) (w,
- x + (w->attrib.width / 2),
- y + (w->attrib.height / 2),
- 0, CompWindowGrabMoveMask | CompWindowGrabButtonMask);
+ x + (w->attrib.width / 2),
+ y + (w->attrib.height / 2),
+ 0,
+ CompWindowGrabMoveMask |
+ CompWindowGrabButtonMask);
ps->grabbedWindow = w;
diff --git a/beryl-plugins/src/resize.c b/beryl-plugins/src/resize.c
index bc11561..af58142 100644
--- a/beryl-plugins/src/resize.c
+++ b/beryl-plugins/src/resize.c
@@ -545,12 +545,16 @@ resizeInitiate(CompDisplay * d,
this is fine for now, but may break the API (documentation would be nice...) */
Bool wobbleDesired = (rd->resizeMode == ResizeModeNormal);
- wobbleDesired |= (!(mask & ~(ResizeUpMask | ResizeDownMask))) && (w->state & CompWindowStateMaximizedVertMask);
- wobbleDesired |= (!(mask & ~(ResizeLeftMask | ResizeRightMask))) && (w->state & CompWindowStateMaximizedHorzMask);
+
+ wobbleDesired |= (!(mask & ~(ResizeUpMask | ResizeDownMask))) &&
+ (w->state & CompWindowStateMaximizedVertMask);
+ wobbleDesired |= (!(mask & ~(ResizeLeftMask | ResizeRightMask))) &&
+ (w->state & CompWindowStateMaximizedHorzMask);
(w->screen->windowGrabNotify) (w, x, y, state,
- CompWindowGrabResizeMask |
- (wobbleDesired ? CompWindowGrabButtonMask : 0));
+ CompWindowGrabResizeMask |
+ (wobbleDesired ?
+ CompWindowGrabButtonMask : 0));
if (state & CompActionStateInitKey)
{
@@ -1004,8 +1008,9 @@ resizePaintOutline(CompScreen * s, const ScreenPaintAttrib * sa, int output,
x1 = rd->currentX - rd->w->input.left;
x2 = rd->currentX + rd->currentWidth + rd->w->input.right;
y1 = rd->currentY - rd->w->input.top;
- y2 = rd->currentY + (rd->w->shaded ? rd->w->height : rd->currentHeight) +
- rd->w->input.bottom;
+ y2 = rd->currentY +
+ (rd->w->shaded ? rd->w->height : rd->currentHeight) +
+ rd->w->input.bottom;
glPushMatrix();
@@ -1155,8 +1160,8 @@ resizeSetDisplayOption(CompDisplay * display,
break;
case RESIZE_DISPLAY_OPTION_BORDER_COLOR:
case RESIZE_DISPLAY_OPTION_FILL_COLOR:
- if (compSetColorOption(o, value))
- return TRUE;
+ if (compSetColorOption(o, value))
+ return TRUE;
break;
default:
break;
diff --git a/beryl-plugins/src/rotate.c b/beryl-plugins/src/rotate.c
index 565b9de..0c27e4f 100644
--- a/beryl-plugins/src/rotate.c
+++ b/beryl-plugins/src/rotate.c
@@ -1168,7 +1168,8 @@ rotate(CompDisplay * d,
return FALSE;
if (otherScreenGrabExist
- (s, "rotate", "move", "switcher", "cube", "scale", "group-drag", 0))
+ (s, "rotate", "move", "switcher", "cube", "scale", "group-drag",
+ 0))
return FALSE;
/* FIXME: this is sort of a hack - we check if
@@ -1176,8 +1177,8 @@ rotate(CompDisplay * d,
we definitely need a better communication
mechanism here... */
- int *scaleState = (int*) IPCS_GetVPtrND(IPCS_OBJECT(s),
- "SCALE_STATE_INT_PTR", NULL);
+ int *scaleState = (int *)IPCS_GetVPtrND(IPCS_OBJECT(s),
+ "SCALE_STATE_INT_PTR", NULL);
if (scaleState && (*scaleState == 2))
return FALSE;
@@ -1454,16 +1455,16 @@ rotateWheel(CompDisplay * d, int direction, CompOption * option, int nOption)
static Bool
rotateRightWheel(CompDisplay * d,
- CompAction * action,
- CompActionState state, CompOption * option, int nOption)
+ CompAction * action,
+ CompActionState state, CompOption * option, int nOption)
{
return rotateWheel(d, 1, option, nOption);
}
static Bool
rotateLeftWheel(CompDisplay * d,
- CompAction * action,
- CompActionState state, CompOption * option, int nOption)
+ CompAction * action,
+ CompActionState state, CompOption * option, int nOption)
{
return rotateWheel(d, -1, option, nOption);
}
@@ -2158,7 +2159,8 @@ rotateWindowGrabNotify(CompWindow * w,
{
ROTATE_SCREEN(w->screen);
- if (!rs->grabWindow) {
+ if (!rs->grabWindow)
+ {
rs->grabMask = mask;
rs->grabWindow = w;
}
@@ -2172,7 +2174,8 @@ static void rotateWindowUngrabNotify(CompWindow * w)
{
ROTATE_SCREEN(w->screen);
- if (w == rs->grabWindow) {
+ if (w == rs->grabWindow)
+ {
rs->grabMask = 0;
rs->grabWindow = NULL;
}
@@ -2329,8 +2332,10 @@ static void rotateDisplayInitOptions(RotateDisplay * rd)
o->subGroup = N_("Initiate");
o->displayHints = "";
o->shortDesc = N_("Initiate sticky");
- o->longDesc = N_("Start Rotation and don't finish it until specifily terminated by"
- " the normal iniate.");
+ o->longDesc =
+ N_
+ ("Start Rotation and don't finish it until specifily terminated by"
+ " the normal iniate.");
o->type = CompOptionTypeAction;
o->value.action.initiate = rotateInitiate;
o->value.action.terminate = 0;
@@ -2339,7 +2344,8 @@ static void rotateDisplayInitOptions(RotateDisplay * rd)
o->value.action.state = CompActionStateInitKey;
o->value.action.state |= CompActionStateInitButton;
o->value.action.type = CompBindingTypeButton;
- o->value.action.button.modifiers = ROTATE_INITIATE_STICKY_MODIFIERS_DEFAULT;
+ o->value.action.button.modifiers =
+ ROTATE_INITIATE_STICKY_MODIFIERS_DEFAULT;
o->value.action.button.button = ROTATE_INITIATE_STICKY_BUTTON_DEFAULT;
o = &rd->opt[ROTATE_DISPLAY_OPTION_WHEELINGS];
@@ -2734,7 +2740,7 @@ static CompOption *rotateGetDisplayOptions(CompDisplay * display, int *count)
RotateDisplay *rd = malloc(sizeof(RotateDisplay));
rotateDisplayInitOptions(rd);
- *count = NUM_OPTIONS(rd)-2;
+ *count = NUM_OPTIONS(rd) - 2;
return rd->opt;
}
}
@@ -2932,7 +2938,8 @@ static void rotateFini(CompPlugin * p)
}
CompPluginDep rotateDeps[] = {
- {CompPluginRuleAfter, "cube"},
+ {CompPluginRuleAfter, "cube"}
+ ,
{CompPluginRuleRequire, "cube"}
};
diff --git a/beryl-plugins/src/scale.c b/beryl-plugins/src/scale.c
index a86f12b..64d38bd 100644
--- a/beryl-plugins/src/scale.c
+++ b/beryl-plugins/src/scale.c
@@ -743,7 +743,7 @@ static Bool isScaleWin(CompWindow * w)
SCALE_SCREEN(w->screen);
if (isNeverScaleWin(w))
- return FALSE;
+ return FALSE;
if (!ss->allScreensMode && ss->currentHead
&& !ss->onlyCurrent
@@ -762,10 +762,11 @@ static Bool isScaleWin(CompWindow * w)
}
else
{
- int x, y;
- defaultViewportForWindow(w, &x, &y);
- if (x != w->screen->x)
- return FALSE;
+ int x, y;
+
+ defaultViewportForWindow(w, &x, &y);
+ if (x != w->screen->x)
+ return FALSE;
if ((!(*w->screen->focusWindow) (w))
&& (!w->minimized
|| !ss->opt[SCALE_SCREEN_OPTION_SHOW_MINIMIZED].value.b))
@@ -900,8 +901,8 @@ scalePaintWindow(CompWindow * w,
if (icon->width > 96)
{
sAttrib.xScale = sAttrib.yScale =
- MIN((48.0f / (float)icon-> width),
- (48.0f / (float)icon->height));
+ MIN((48.0f / (float)icon->width),
+ (48.0f / (float)icon->height));
}
else
sAttrib.xScale = sAttrib.yScale = 1.0f;
@@ -927,28 +928,29 @@ scalePaintWindow(CompWindow * w,
if (sAttrib.xScale != 1.0f)
{
wx = w->attrib.x +
- ((w->width * sw->scale) -
- (icon->width * sAttrib.xScale)) /
- sAttrib.xScale;
+ ((w->width * sw->scale) -
+ (icon->width * sAttrib.xScale)) /
+ sAttrib.xScale;
wy = w->attrib.y +
- ((w->height * sw->scale) -
- (icon->height * sAttrib.yScale)) /
- sAttrib.yScale;
+ ((w->height * sw->scale) -
+ (icon->height * sAttrib.yScale)) /
+ sAttrib.yScale;
}
else
{
wx = w->attrib.x +
- (w->width * sw->scale) - icon->width;
+ (w->width * sw->scale) - icon->width;
wy = w->attrib.y +
- (w->height * sw->scale) - icon->height;
+ (w->height * sw->scale) - icon->height;
}
break;
case ScaleIconBig:
wx = w->attrib.x +
- ((scaledWinWidth - width * sAttrib.xScale) / 2) / sAttrib.xScale;
+ ((scaledWinWidth -
+ width * sAttrib.xScale) / 2) / sAttrib.xScale;
wy = w->attrib.y +
- ((scaledWinHeight - height * sAttrib.yScale) /
- 2) / sAttrib.yScale;
+ ((scaledWinHeight -
+ height * sAttrib.yScale) / 2) / sAttrib.yScale;
break;
default:
wx = wy = 0;
@@ -973,16 +975,16 @@ scalePaintWindow(CompWindow * w,
if (sw->slot)
{
sw->delta =
- fabs(sw->slot->x1 - w->serverX) +
- fabs(sw->slot->y1 - w->serverY) +
- fabs(1.0f - sw->slot->scale) * 500.0f;
+ fabs(sw->slot->x1 - w->serverX) +
+ fabs(sw->slot->y1 - w->serverY) +
+ fabs(1.0f - sw->slot->scale) * 500.0f;
}
if (sw->delta)
{
ds = fabs(sw->tx) + fabs(sw->ty) +
- fabs(1.0f - sw->scale) * 500.0f;
+ fabs(1.0f - sw->scale) * 500.0f;
if (ds > sw->delta)
ds = sw->delta;
@@ -995,8 +997,8 @@ scalePaintWindow(CompWindow * w,
if (ds)
{
sAttrib.opacity =
- (fabs(1.0f - sw->scale) *
- sAttrib.opacity) / ds;
+ (fabs(1.0f - sw->scale) *
+ sAttrib.opacity) / ds;
}
else if (!sw->slot)
{
@@ -1023,11 +1025,13 @@ scalePaintWindow(CompWindow * w,
if (iconReg.extents.x1 < iconReg.extents.x2
&& iconReg.extents.y1 < iconReg.extents.y2)
(*w->screen->addWindowGeometry) (w,
- &matrix, 1, &iconReg, &iconReg);
+ &matrix, 1, &iconReg,
+ &iconReg);
if (w->vCount)
(*w->screen->drawWindowTexture) (w,
- &icon->texture, &sAttrib, mask);
+ &icon->texture, &sAttrib,
+ mask);
}
}
}
@@ -1107,7 +1111,7 @@ layoutOrganicCalculateOverlap(CompScreen * s, int win, int x, int y)
static double
layoutOrganicFindBestHorizontalPosition(CompScreen * s, int win,
- int *bestx, int areaWidth)
+ int *bestx, int areaWidth)
{
SCALE_SCREEN(s);
int i;
@@ -1130,7 +1134,8 @@ layoutOrganicFindBestHorizontalPosition(CompScreen * s, int win,
if (ss->slots[i].x1 - w >= 0)
{
double overlap = layoutOrganicCalculateOverlap(s, win,
- ss->slots[i].x1 - w, y1);
+ ss->slots[i].
+ x1 - w, y1);
if (overlap < bestoverlap)
{
@@ -1142,8 +1147,12 @@ layoutOrganicFindBestHorizontalPosition(CompScreen * s, int win,
ss->slots[i].x1 + w < areaWidth)
{
double overlap = layoutOrganicCalculateOverlap(s, win,
- ss->slots[i].x1 + WIN_W(ss->windows[i]) *
- ss->scale,y1);
+ ss->slots[i].
+ x1 +
+ WIN_W(ss->
+ windows
+ [i]) *
+ ss->scale, y1);
if (overlap < bestoverlap)
{
@@ -1174,7 +1183,7 @@ layoutOrganicFindBestHorizontalPosition(CompScreen * s, int win,
static double
layoutOrganicFindBestVerticalPosition(CompScreen * s, int win,
- int *besty, int areaHeight)
+ int *besty, int areaHeight)
{
SCALE_SCREEN(s);
int i;
@@ -1197,20 +1206,27 @@ layoutOrganicFindBestVerticalPosition(CompScreen * s, int win,
if (ss->slots[i].y1 - h >= 0 && ss->slots[i].y1 < areaHeight)
{
double overlap = layoutOrganicCalculateOverlap(s, win,
- x1, ss->slots[i].y1 - h);
+ x1,
+ ss->slots[i].
+ y1 - h);
if (overlap < bestoverlap)
{
*besty = ss->slots[i].y1 - h;
bestoverlap = overlap;
}
}
- if (WIN_H(ss->windows[i]) * ss->scale + ss->slots[i].y1 > 0
+ if (WIN_H(ss->windows[i]) * ss->scale + ss->slots[i].y1 > 0
&& WIN_H(ss->windows[i]) * ss->scale + h +
ss->slots[i].y1 < areaHeight)
{
double overlap = layoutOrganicCalculateOverlap(s, win,
- x1, WIN_H(ss->windows[i]) * ss->scale +
- ss->slots[i].y1);
+ x1,
+ WIN_H(ss->
+ windows
+ [i]) *
+ ss->scale +
+ ss->slots[i].
+ y1);
if (overlap < bestoverlap)
{
@@ -1262,12 +1278,15 @@ layoutOrganicLocalSearch(CompScreen * s, int areaWidth, int areaHeight)
improved = FALSE;
oldoverlap = layoutOrganicCalculateOverlap(s, i,
- ss->slots[i].x1, ss->slots[i].y1);
+ ss->slots[i].x1,
+ ss->slots[i].y1);
- overlaph = layoutOrganicFindBestHorizontalPosition(
- s, i, &newx, areaWidth);
- overlapv = layoutOrganicFindBestVerticalPosition(
- s, i, &newy, areaHeight);
+ overlaph =
+ layoutOrganicFindBestHorizontalPosition(s, i, &newx,
+ areaWidth);
+ overlapv =
+ layoutOrganicFindBestVerticalPosition(s, i, &newy,
+ areaHeight);
if (overlaph < oldoverlap - 0.1
|| overlapv < oldoverlap - 0.1)
@@ -1290,7 +1309,8 @@ layoutOrganicLocalSearch(CompScreen * s, int areaWidth, int areaHeight)
for (i = 0; i < ss->nWindows; i++)
{
totaloverlap += layoutOrganicCalculateOverlap(s,
- i, ss->slots[i].x1, ss->slots[i].y1);
+ i, ss->slots[i].x1,
+ ss->slots[i].y1);
}
return (totaloverlap > 0.1);
}
@@ -1316,9 +1336,9 @@ layoutOrganicRemoveOverlap(CompScreen * s, int areaWidth, int areaHeight)
centerY = ss->slots[i].y1 + WIN_H(w) / 2;
newWidth = (int)((1.0 - ORGANIC_STEP) *
- (double)WIN_W(w)) - ss->spacing / 2;
+ (double)WIN_W(w)) - ss->spacing / 2;
newHeight = (int)((1.0 - ORGANIC_STEP) *
- (double)WIN_H(w)) - ss->spacing / 2;
+ (double)WIN_H(w)) - ss->spacing / 2;
newX = centerX - (newWidth / 2);
newY = centerY - (newHeight / 2);
@@ -1380,7 +1400,7 @@ static Bool layoutStandardThumbs(CompScreen * s)
if (ss->windowsSize <= ss->nWindows)
{
ss->windows = realloc(ss->windows,
- sizeof(CompWindow *) * (ss->nWindows + 32));
+ sizeof(CompWindow *) * (ss->nWindows + 32));
if (!ss->windows)
return FALSE;
@@ -1395,14 +1415,15 @@ static Bool layoutStandardThumbs(CompScreen * s)
qsort(ss->windows, ss->nWindows, sizeof(CompWindow *), compareWindows);
- itemsPerLine = (sqrt(ss->nWindows) * outputRect.width) / outputRect.height;
+ itemsPerLine =
+ (sqrt(ss->nWindows) * outputRect.width) / outputRect.height;
if (itemsPerLine < 1)
itemsPerLine = 1;
if (ss->lineSize <= ss->nWindows / itemsPerLine + 1)
{
ss->line = realloc(ss->line, sizeof(int) *
- (ss->nWindows / itemsPerLine + 2));
+ (ss->nWindows / itemsPerLine + 2));
if (!ss->line)
return FALSE;
@@ -1418,7 +1439,7 @@ static Bool layoutStandardThumbs(CompScreen * s)
if (ss->slotsSize <= ss->nWindows)
{
ss->slots = realloc(ss->slots,
- sizeof(ScaleSlot) * (ss->nWindows + 1));
+ sizeof(ScaleSlot) * (ss->nWindows + 1));
if (!ss->slots)
return FALSE;
@@ -1720,7 +1741,7 @@ static Bool layoutEnhancedThumbs(CompScreen * s)
if (ss->windowsSize <= ss->nWindows)
{
ss->windows = realloc(ss->windows,
- sizeof(CompWindow *) * (ss->nWindows + 32));
+ sizeof(CompWindow *) * (ss->nWindows + 32));
if (!ss->windows)
return FALSE;
@@ -1816,7 +1837,7 @@ static Bool layoutOrganicThumbs(CompScreen * s)
if (ss->windowsSize <= ss->nWindows)
{
ss->windows = realloc(ss->windows,
- sizeof(CompWindow *) * (ss->nWindows + 32));
+ sizeof(CompWindow *) * (ss->nWindows + 32));
if (!ss->windows)
return FALSE;
@@ -1872,7 +1893,7 @@ static Bool layoutOrganicThumbs(CompScreen * s)
if (ss->slots[i].y2 > workArea.height - workArea.y)
{
ss->slots[i].y1 -= abs(ss->slots[i].y2 -
- workArea.height - workArea.y);
+ workArea.height - workArea.y);
ss->slots[i].y2 = workArea.height - workArea.y;
}
}
@@ -1880,7 +1901,7 @@ static Bool layoutOrganicThumbs(CompScreen * s)
ss->nSlots = ss->nWindows;
layoutOrganicRemoveOverlap(s, workArea.width - workArea.x,
- workArea.height - workArea.y);
+ workArea.height - workArea.y);
for (i = 0; i < ss->nWindows; i++)
{
SCALE_WINDOW(ss->windows[i]);
@@ -1905,10 +1926,10 @@ static void zoomWindow(CompScreen * s, CompWindow * w)
XRectangle workArea, outputRect;
int head;
- head = screenGetCurrentOutputDev (s);
- screenGetOutputDevRect (s, head, &outputRect);
+ head = screenGetCurrentOutputDev(s);
+ screenGetOutputDevRect(s, head, &outputRect);
- screenGetOutputDevWorkArea (s, screenGetCurrentOutputDev (s), &workArea);
+ screenGetOutputDevWorkArea(s, screenGetCurrentOutputDev(s), &workArea);
if (sw->rescaled == FALSE)
@@ -2139,16 +2160,19 @@ static void scaleDonePaintScreen(CompScreen * s)
{
ss->grab = FALSE;
removeScreenGrabKeyboardOptional(s,
- ss->grabIndex, 0,
- !ss->opt[SCALE_SCREEN_OPTION_ALLOW_KEYBOARD_INPUT].value.b);
+ ss->grabIndex, 0,
+ !ss->
+ opt
+ [SCALE_SCREEN_OPTION_ALLOW_KEYBOARD_INPUT].
+ value.b);
ss->grabIndex = 0;
if (ss->selectedWindow)
{
CompWindow *w = findWindowAtScreen(s,
- ss->selectedWindow);
+ ss->selectedWindow);
- if (w && isScaleWin (w))
+ if (w && isScaleWin(w))
{
SCALE_WINDOW(w);
raiseWindow(w);
@@ -2256,8 +2280,11 @@ scaleTerminate(CompDisplay * d,
if (ss->grabIndex)
{
removeScreenGrabKeyboardOptional(s,
- ss->grabIndex, 0,
- !ss->opt[SCALE_SCREEN_OPTION_ALLOW_KEYBOARD_INPUT].value.b);
+ ss->grabIndex, 0,
+ !ss->
+ opt
+ [SCALE_SCREEN_OPTION_ALLOW_KEYBOARD_INPUT].
+ value.b);
ss->grabIndex = 0;
}
@@ -2266,7 +2293,7 @@ scaleTerminate(CompDisplay * d,
if (ss->selectedWindow && !(state & CompActionStateCancel))
{
CompWindow *w = findWindowAtScreen(s,
- ss->selectedWindow);
+ ss->selectedWindow);
if (w)
{
@@ -2313,7 +2340,7 @@ scaleTerminate(CompDisplay * d,
ss->cancelWindow);
if (aw)
- sendWindowActivationRequest(s, aw->id);
+ sendWindowActivationRequest(s, aw->id);
ss->cancelWindow = 0;
ss->selectedWindow = 0;
@@ -2337,8 +2364,9 @@ static Bool scaleEnsureDndRedirectWindow(CompScreen * s)
attr.override_redirect = TRUE;
ss->dndTarget = XCreateWindow(s->display->display,
- s->root, 0, 0, 1, 1, 0, CopyFromParent,
- InputOnly, CopyFromParent, CWOverrideRedirect, &attr);
+ s->root, 0, 0, 1, 1, 0, CopyFromParent,
+ InputOnly, CopyFromParent,
+ CWOverrideRedirect, &attr);
XChangeProperty(s->display->display, ss->dndTarget,
s->display->xdndAwareAtom,
@@ -2393,7 +2421,8 @@ scaleInitiateReal(CompDisplay * d,
if (s->display->activeWindow)
{
CompWindow *aw = findTopLevelWindowAtScreen(s,
- s->display->activeWindow);
+ s->display->
+ activeWindow);
//make sure that the selected window is a valid one
if (aw && isScaleWin(aw))
@@ -2428,8 +2457,12 @@ scaleInitiateReal(CompDisplay * d,
else if (!ss->grabIndex)
{
ss->grabIndex = pushScreenGrabKeyboardOptional(s,
- ss->cursor, "scale",
- !ss->opt[SCALE_SCREEN_OPTION_ALLOW_KEYBOARD_INPUT].value.b);
+ ss->cursor,
+ "scale",
+ !ss->
+ opt
+ [SCALE_SCREEN_OPTION_ALLOW_KEYBOARD_INPUT].
+ value.b);
if (ss->grabIndex)
ss->grab = TRUE;
}
@@ -2707,8 +2740,8 @@ static void scaleHandleEvent(CompDisplay * d, XEvent * event)
CompWindow *w;
w = scaleCheckForWindowAt(s,
- event->xbutton.x_root,
- event->xbutton.y_root);
+ event->xbutton.x_root,
+ event->xbutton.y_root);
if (w)
zoomWindow(s, w);
@@ -2718,17 +2751,17 @@ static void scaleHandleEvent(CompDisplay * d, XEvent * event)
CompWindow *w;
w = scaleCheckForWindowAt(s,
- event->xbutton.x_root,
- event->xbutton.y_root);
+ event->xbutton.x_root,
+ event->xbutton.y_root);
if (w)
closeWindow(w, event->xkey.time);
}
else if (scaleSelectWindowAt(s,
- event->xbutton.x_root,
- event->xbutton.y_root) &&
- event->xbutton.button == Button1)
+ event->xbutton.x_root,
+ event->xbutton.y_root) &&
+ event->xbutton.button == Button1)
{
scaleTerminate(d, action, 0, &o, 1);
}
@@ -2755,8 +2788,10 @@ static void scaleHandleEvent(CompDisplay * d, XEvent * event)
if (ss->grab && ss->state != SCALE_STATE_IN)
scaleHoverWindowAt(s,
- event->xmotion.x_root, event->xmotion.y_root,
- ss->opt[SCALE_SCREEN_OPTION_SLOPPY_FOCUS].value.b);
+ event->xmotion.x_root,
+ event->xmotion.y_root,
+ ss->opt[SCALE_SCREEN_OPTION_SLOPPY_FOCUS].
+ value.b);
}
break;
case ClientMessage:
@@ -2774,7 +2809,8 @@ static void scaleHandleEvent(CompDisplay * d, XEvent * event)
if (w->id == ss->dndTarget)
sendDndStatusMessage(w->screen, event->xclient.data.l[0]);
- if (ss->grab && ss->state != SCALE_STATE_IN && w->id == ss->dndTarget)
+ if (ss->grab && ss->state != SCALE_STATE_IN &&
+ w->id == ss->dndTarget)
{
int x = event->xclient.data.l[2] >> 16;
int y = event->xclient.data.l[2] & 0xffff;
@@ -2793,10 +2829,11 @@ static void scaleHandleEvent(CompDisplay * d, XEvent * event)
if (!ss->hoverHandle)
ss->hoverHandle =
- compAddTimeout(ss->
- opt
- [SCALE_SCREEN_OPTION_HOVER_TIME].
- value.i, scaleHoverTimeout, s);
+ compAddTimeout(ss->
+ opt
+ [SCALE_SCREEN_OPTION_HOVER_TIME].
+ value.i, scaleHoverTimeout,
+ s);
scaleSelectWindowAt(s, x, y);
}
@@ -2883,7 +2920,7 @@ static Bool scaleDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
if (sw->slot)
{
damageTransformedWindowRect(w, sw->scale,
- sw->scale, sw->tx, sw->ty, rect);
+ sw->scale, sw->tx, sw->ty, rect);
status = TRUE;
}
@@ -3143,8 +3180,10 @@ static Bool scaleInitScreen(CompPlugin * p, CompScreen * s)
ss->iconOverlay = ScaleIconEmblem;
ss->scaleMethod = SCALE_METHOD_INT_DEFAULT;
- ss->scaleStateAtom = IPCS_GetAtom(IPCS_OBJECT(s), IPCS_VPTR, "SCALE_STATE_INT_PTR", TRUE);
- IPCS_SetVPtr(IPCS_OBJECT(s), ss->scaleStateAtom, (void*)&ss->state);
+ ss->scaleStateAtom =
+ IPCS_GetAtom(IPCS_OBJECT(s), IPCS_VPTR, "SCALE_STATE_INT_PTR",
+ TRUE);
+ IPCS_SetVPtr(IPCS_OBJECT(s), ss->scaleStateAtom, (void *)&ss->state);
scaleScreenInitOptions(ss);
@@ -3269,11 +3308,16 @@ static void scaleFini(CompPlugin * p)
}
CompPluginDep setDeps[] = {
- {CompPluginRuleAfter, "decoration"},
- {CompPluginRuleAfter, "animation"},
- {CompPluginRuleAfter, "cube"},
- {CompPluginRuleAfter, "wobbly"},
- {CompPluginRuleAfter, "fade"},
+ {CompPluginRuleAfter, "decoration"}
+ ,
+ {CompPluginRuleAfter, "animation"}
+ ,
+ {CompPluginRuleAfter, "cube"}
+ ,
+ {CompPluginRuleAfter, "wobbly"}
+ ,
+ {CompPluginRuleAfter, "fade"}
+ ,
};
CompPluginVTable scaleVTable = {
diff --git a/beryl-plugins/src/screenshot.c b/beryl-plugins/src/screenshot.c
index dafd3ef..154de85 100644
--- a/beryl-plugins/src/screenshot.c
+++ b/beryl-plugins/src/screenshot.c
@@ -512,7 +512,8 @@ static void shotFini(CompPlugin * p)
}
CompPluginDep shotDeps[] = {
- {CompPluginRuleAfterCategory, "imageformat"},
+ {CompPluginRuleAfterCategory, "imageformat"}
+ ,
};
static CompPluginVTable shotVTable = {
diff --git a/beryl-plugins/src/snap.c b/beryl-plugins/src/snap.c
index 91ed481..92980be 100644
--- a/beryl-plugins/src/snap.c
+++ b/beryl-plugins/src/snap.c
@@ -148,8 +148,8 @@ struct _Edge
int end;
EdgeType type;
- Window id;
- Bool passed;
+ Window id;
+ Bool passed;
Bool snapped;
};
@@ -182,10 +182,10 @@ typedef struct _SnapScreen
{
int windowPrivateIndex;
- WindowResizeNotifyProc windowResizeNotify;
- WindowMoveNotifyProc windowMoveNotify;
- WindowGrabNotifyProc windowGrabNotify;
- WindowUngrabNotifyProc windowUngrabNotify;
+ WindowResizeNotifyProc windowResizeNotify;
+ WindowMoveNotifyProc windowMoveNotify;
+ WindowGrabNotifyProc windowGrabNotify;
+ WindowUngrabNotifyProc windowUngrabNotify;
CompOption opt[SNAP_SCREEN_OPTION_NUM];
@@ -245,32 +245,30 @@ typedef struct _SnapWindow
/*
* Wrapper function to avoid infinite notify loops
*/
-static void
-snapMoveWindow (CompWindow * w, int dx, int dy)
+static void snapMoveWindow(CompWindow * w, int dx, int dy)
{
- SNAP_WINDOW (w);
+ SNAP_WINDOW(w);
sw->skipNotify = TRUE;
- moveWindow (w, dx, dy, TRUE, TRUE);
- warpPointer (w->screen->display, dx, dy);
+ moveWindow(w, dx, dy, TRUE, TRUE);
+ warpPointer(w->screen->display, dx, dy);
sw->skipNotify = FALSE;
}
-static void
-snapFreeEdges (CompWindow *w)
+static void snapFreeEdges(CompWindow * w)
{
- SNAP_WINDOW (w);
+ SNAP_WINDOW(w);
Edge *current = sw->edges, *next;
+
while (current)
{
next = current->next;
- free (current);
+ free(current);
current = next;
}
sw->edges = sw->reverseEdges = NULL;
}
-static void
-snapRemoveEdge (Edge *edge)
+static void snapRemoveEdge(Edge * edge)
{
if (edge == NULL)
return;
@@ -278,24 +276,24 @@ snapRemoveEdge (Edge *edge)
edge->prev->next = edge->next;
if (edge->next)
edge->next->prev = edge->prev;
- free (edge);
+ free(edge);
}
-static Edge *
-snapAddEdge (Edge **edges, Edge **reverseEdges, Window id,
- int position, int start, int end, EdgeType type)
+static Edge *snapAddEdge(Edge ** edges, Edge ** reverseEdges, Window id,
+ int position, int start, int end, EdgeType type)
{
- Edge *edge = malloc (sizeof (Edge));
+ Edge *edge = malloc(sizeof(Edge));
+
if (!edge)
return NULL;
- edge->next = NULL;
- edge->position = position;
- edge->start = start;
- edge->end = end;
- edge->type = type;
- edge->snapped = FALSE;
- edge->passed = FALSE;
- edge->id = id;
+ edge->next = NULL;
+ edge->position = position;
+ edge->start = start;
+ edge->end = end;
+ edge->type = type;
+ edge->snapped = FALSE;
+ edge->passed = FALSE;
+ edge->id = id;
if (!*edges)
{
edge->prev = NULL;
@@ -313,8 +311,7 @@ snapAddEdge (Edge **edges, Edge **reverseEdges, Window id,
/*
* Add an edge for each rectangle of the region
*/
-static void
-snapAddRegionEdges (SnapWindow *sw, Edge *parent, Region region)
+static void snapAddRegionEdges(SnapWindow * sw, Edge * parent, Region region)
{
Edge *edge;
int i, position, start, end;
@@ -323,21 +320,21 @@ snapAddRegionEdges (SnapWindow *sw, Edge *parent, Region region)
{
switch (parent->type)
{
- case LeftEdge:
- case RightEdge:
- position = region->rects[i].x1;
- start = region->rects[i].y1;
- end = region->rects[i].y2;
- break;
- case TopEdge:
- case BottomEdge:
- default:
- position = region->rects[i].y1;
- start = region->rects[i].x1;
- end = region->rects[i].x2;
+ case LeftEdge:
+ case RightEdge:
+ position = region->rects[i].x1;
+ start = region->rects[i].y1;
+ end = region->rects[i].y2;
+ break;
+ case TopEdge:
+ case BottomEdge:
+ default:
+ position = region->rects[i].y1;
+ start = region->rects[i].x1;
+ end = region->rects[i].x2;
}
- edge = snapAddEdge (&sw->edges, &sw->reverseEdges, parent->id,
- position, start, end, parent->type);
+ edge = snapAddEdge(&sw->edges, &sw->reverseEdges, parent->id,
+ position, start, end, parent->type);
if (edge)
edge->passed = parent->passed;
}
@@ -367,12 +364,12 @@ static inline Bool isSnapWindow(CompWindow * w)
/*
* Detect visible windows edges
*/
-static void
-snapUpdateWindowsEdges (CompWindow *w)
+static void snapUpdateWindowsEdges(CompWindow * w)
{
CompWindow *c = NULL;
Edge *e = NULL, *next = NULL;
- SNAP_WINDOW (w);
+
+ SNAP_WINDOW(w);
Region edgeRegion, resultRegion;
XRectangle rect;
Bool remove = FALSE;
@@ -388,18 +385,16 @@ snapUpdateWindowsEdges (CompWindow *w)
c = c->next;
continue;
}
- snapAddEdge (&sw->edges, &sw->reverseEdges, c->id,
- WIN_Y(c), WIN_X(c), WIN_X(c) + WIN_W(c),
- TopEdge);
- snapAddEdge (&sw->edges, &sw->reverseEdges, c->id,
- WIN_Y(c) + WIN_H(c), WIN_X(c), WIN_X(c) + WIN_W(c),
- BottomEdge);
- snapAddEdge (&sw->edges, &sw->reverseEdges, c->id,
- WIN_X(c), WIN_Y(c), WIN_Y(c) + WIN_H(c),
- LeftEdge);
- snapAddEdge (&sw->edges, &sw->reverseEdges, c->id,
- WIN_X(c) + WIN_W(c), WIN_Y(c), WIN_Y(c) + WIN_H(c),
- RightEdge);
+ snapAddEdge(&sw->edges, &sw->reverseEdges, c->id,
+ WIN_Y(c), WIN_X(c), WIN_X(c) + WIN_W(c), TopEdge);
+ snapAddEdge(&sw->edges, &sw->reverseEdges, c->id,
+ WIN_Y(c) + WIN_H(c), WIN_X(c), WIN_X(c) + WIN_W(c),
+ BottomEdge);
+ snapAddEdge(&sw->edges, &sw->reverseEdges, c->id,
+ WIN_X(c), WIN_Y(c), WIN_Y(c) + WIN_H(c), LeftEdge);
+ snapAddEdge(&sw->edges, &sw->reverseEdges, c->id,
+ WIN_X(c) + WIN_W(c), WIN_Y(c), WIN_Y(c) + WIN_H(c),
+ RightEdge);
c = c->next;
}
@@ -423,35 +418,32 @@ snapUpdateWindowsEdges (CompWindow *w)
}
switch (e->type)
{
- case LeftEdge:
- case RightEdge:
- rect.x = e->position;
- rect.y = e->start;
- rect.width = 1;
- rect.height = e->end - e->start;
- break;
- case TopEdge:
- case BottomEdge:
- default:
- rect.x = e->start;
- rect.y = e->position;
- rect.width = e->end - e->start;
- rect.height = 1;
+ case LeftEdge:
+ case RightEdge:
+ rect.x = e->position;
+ rect.y = e->start;
+ rect.width = 1;
+ rect.height = e->end - e->start;
+ break;
+ case TopEdge:
+ case BottomEdge:
+ default:
+ rect.x = e->start;
+ rect.y = e->position;
+ rect.width = e->end - e->start;
+ rect.height = 1;
}
// If the edge is in the window region, remove it,
// if it's partly in the region, split it
- edgeRegion = XCreateRegion ();
- resultRegion = XCreateRegion ();
- XUnionRectWithRegion (&rect, edgeRegion,
- edgeRegion);
- XSubtractRegion (edgeRegion, c->region,
- resultRegion);
+ edgeRegion = XCreateRegion();
+ resultRegion = XCreateRegion();
+ XUnionRectWithRegion(&rect, edgeRegion, edgeRegion);
+ XSubtractRegion(edgeRegion, c->region, resultRegion);
if (XEmptyRegion(resultRegion))
remove = TRUE;
- else if (!XEqualRegion (edgeRegion,
- resultRegion))
+ else if (!XEqualRegion(edgeRegion, resultRegion))
{
- snapAddRegionEdges (sw, e, resultRegion);
+ snapAddRegionEdges(sw, e, resultRegion);
remove = TRUE;
}
next = e->next;
@@ -461,11 +453,11 @@ snapUpdateWindowsEdges (CompWindow *w)
sw->edges = e->next;
if (e->next == NULL)
sw->reverseEdges = e->prev;
- snapRemoveEdge (e);
+ snapRemoveEdge(e);
remove = FALSE;
}
- XDestroyRegion (resultRegion);
- XDestroyRegion (edgeRegion);
+ XDestroyRegion(resultRegion);
+ XDestroyRegion(edgeRegion);
}
}
}
@@ -476,46 +468,43 @@ snapUpdateWindowsEdges (CompWindow *w)
* top side a bottom edge and bottom side a top edge,
* since they will be snapped as the right/left/bottom/top edge of a window
*/
-static void
-snapUpdateScreenEdges (CompWindow *w)
+static void snapUpdateScreenEdges(CompWindow * w)
{
XRectangle area;
int i;
- SNAP_WINDOW (w);
+
+ SNAP_WINDOW(w);
for (i = 1; i <= w->screen->nOutputDev; i++)
{
- screenGetOutputDevRect (w->screen, i, &area);
- snapAddEdge (&sw->edges, &sw->reverseEdges, 0,
- area.y, area.x,
- area.x + area.width - 1, BottomEdge);
- snapAddEdge (&sw->edges, &sw->reverseEdges, 0,
- area.y + area.height, area.x,
- area.x + area.width - 1, TopEdge);
- snapAddEdge (&sw->edges, &sw->reverseEdges, 0,
- area.x, area.y,
- area.y + area.height - 1, RightEdge);
- snapAddEdge (&sw->edges, &sw->reverseEdges, 0,
- area.x + area.width, area.y,
- area.y + area.height - 1, LeftEdge);
+ screenGetOutputDevRect(w->screen, i, &area);
+ snapAddEdge(&sw->edges, &sw->reverseEdges, 0,
+ area.y, area.x, area.x + area.width - 1, BottomEdge);
+ snapAddEdge(&sw->edges, &sw->reverseEdges, 0,
+ area.y + area.height, area.x,
+ area.x + area.width - 1, TopEdge);
+ snapAddEdge(&sw->edges, &sw->reverseEdges, 0,
+ area.x, area.y, area.y + area.height - 1, RightEdge);
+ snapAddEdge(&sw->edges, &sw->reverseEdges, 0,
+ area.x + area.width, area.y,
+ area.y + area.height - 1, LeftEdge);
}
}
/*
* Clean edges and fill it again with appropriate edges
*/
-static void
-snapUpdateEdges (CompWindow *w)
+static void snapUpdateEdges(CompWindow * w)
{
- SNAP_SCREEN (w->screen);
+ SNAP_SCREEN(w->screen);
- snapFreeEdges (w);
+ snapFreeEdges(w);
if (ss->edgesCategories & WindowsEdges)
- snapUpdateWindowsEdges (w);
+ snapUpdateWindowsEdges(w);
if (ss->edgesCategories & ScreenEdges)
- snapUpdateScreenEdges (w);
+ snapUpdateScreenEdges(w);
}
// Edges checking functions ----------------------------------------------------
@@ -527,26 +516,27 @@ snapUpdateEdges (CompWindow *w)
* snapDirection : just an helper, related to type
*/
static void
-snapCheckNearestEdge (CompWindow *w, int position, int start, int end,
- Bool before, EdgeType type, int snapDirection)
+snapCheckNearestEdge(CompWindow * w, int position, int start, int end,
+ Bool before, EdgeType type, int snapDirection)
{
- SNAP_SCREEN (w->screen);
- SNAP_WINDOW (w);
+ SNAP_SCREEN(w->screen);
+ SNAP_WINDOW(w);
Edge *current = sw->edges;
Edge *edge = current;
int dist, min = 65535;
+
while (current)
{
// Skip wrong type or outbound edges
if (current->type != type
- || current->end < start || current->start > end)
+ || current->end < start || current->start > end)
{
current = current->next;
continue;
}
// Compute distance
dist = before ? position - current->position
- : current->position - position;
+ : current->position - position;
// Update minimum distance if needed
if (dist < min && dist >= 0)
{
@@ -563,7 +553,7 @@ snapCheckNearestEdge (CompWindow *w, int position, int start, int end,
}
// We found a 0-dist edge, or we have a snapping candidate
if (min == 0 || (min <= ss->attractionDistance
- && ss->snapType & EdgeAttraction))
+ && ss->snapType & EdgeAttraction))
{
// Update snapping data
if (ss->snapType & EdgeResistance)
@@ -577,20 +567,20 @@ snapCheckNearestEdge (CompWindow *w, int position, int start, int end,
edge->snapped = TRUE;
switch (type)
{
- case LeftEdge:
- snapMoveWindow (w, min, 0);
- break;
- case RightEdge:
- snapMoveWindow (w, -min, 0);
- break;
- case TopEdge:
- snapMoveWindow (w, 0, min);
- break;
- case BottomEdge:
- snapMoveWindow (w, 0, -min);
- break;
- default:
- break;
+ case LeftEdge:
+ snapMoveWindow(w, min, 0);
+ break;
+ case RightEdge:
+ snapMoveWindow(w, -min, 0);
+ break;
+ case TopEdge:
+ snapMoveWindow(w, 0, min);
+ break;
+ case BottomEdge:
+ snapMoveWindow(w, 0, -min);
+ break;
+ default:
+ break;
}
}
}
@@ -599,51 +589,48 @@ snapCheckNearestEdge (CompWindow *w, int position, int start, int end,
/*
* Call the previous function for each of the 4 sides of the window
*/
-static void
-snapCheckEdges (CompWindow * w)
+static void snapCheckEdges(CompWindow * w)
{
- snapCheckNearestEdge (w, WIN_X (w),
- WIN_Y (w), WIN_Y (w) + WIN_H (w),
- TRUE, RightEdge, HorizontalSnap);
- snapCheckNearestEdge (w, WIN_X (w) + WIN_W (w),
- WIN_Y (w), WIN_Y (w) + WIN_H (w),
- FALSE, LeftEdge, HorizontalSnap);
- snapCheckNearestEdge (w, WIN_Y (w),
- WIN_X (w), WIN_X (w) + WIN_W (w),
- TRUE, BottomEdge, VerticalSnap);
- snapCheckNearestEdge (w, WIN_Y (w) + WIN_H (w),
- WIN_X (w), WIN_X (w) + WIN_W (w),
- FALSE, TopEdge, VerticalSnap);
+ snapCheckNearestEdge(w, WIN_X(w),
+ WIN_Y(w), WIN_Y(w) + WIN_H(w),
+ TRUE, RightEdge, HorizontalSnap);
+ snapCheckNearestEdge(w, WIN_X(w) + WIN_W(w),
+ WIN_Y(w), WIN_Y(w) + WIN_H(w),
+ FALSE, LeftEdge, HorizontalSnap);
+ snapCheckNearestEdge(w, WIN_Y(w),
+ WIN_X(w), WIN_X(w) + WIN_W(w),
+ TRUE, BottomEdge, VerticalSnap);
+ snapCheckNearestEdge(w, WIN_Y(w) + WIN_H(w),
+ WIN_X(w), WIN_X(w) + WIN_W(w),
+ FALSE, TopEdge, VerticalSnap);
}
// avoidSnap functions ---------------------------------------------------------
static Bool
-snapEnableSnapping (CompDisplay * d,
- CompAction * action,
- CompActionState state, CompOption * option, int nOption)
+snapEnableSnapping(CompDisplay * d,
+ CompAction * action,
+ CompActionState state, CompOption * option, int nOption)
{
- SNAP_DISPLAY (d);
+ SNAP_DISPLAY(d);
sd->snapping = TRUE;
return FALSE;
}
static Bool
-snapDisableSnapping (CompDisplay * d,
- CompAction * action,
- CompActionState state,
- CompOption * option, int nOption)
+snapDisableSnapping(CompDisplay * d,
+ CompAction * action,
+ CompActionState state, CompOption * option, int nOption)
{
- SNAP_DISPLAY (d);
+ SNAP_DISPLAY(d);
sd->snapping = FALSE;
return FALSE;
}
// Check if avoidSnap is matched, and enable/disable snap consequently
-static void
-snapHandleEvent (CompDisplay * d, XEvent * event)
+static void snapHandleEvent(CompDisplay * d, XEvent * event)
{
- SNAP_DISPLAY (d);
+ SNAP_DISPLAY(d);
if (event->type == d->xkbEvent)
{
@@ -651,50 +638,49 @@ snapHandleEvent (CompDisplay * d, XEvent * event)
if (xkbEvent->xkb_type == XkbStateNotify)
{
- XkbStateNotifyEvent *stateEvent =
- (XkbStateNotifyEvent *) event;
+ XkbStateNotifyEvent *stateEvent = (XkbStateNotifyEvent *) event;
unsigned int mods = 0xffffffff;
if (sd->avoidSnapMask)
mods = sd->avoidSnapMask;
if ((stateEvent->mods & mods) == mods)
- snapDisableSnapping (d, NULL, 0, NULL, 0);
+ snapDisableSnapping(d, NULL, 0, NULL, 0);
else
- snapEnableSnapping (d, NULL, 0, NULL, 0);
+ snapEnableSnapping(d, NULL, 0, NULL, 0);
}
}
- UNWRAP (sd, d, handleEvent);
+ UNWRAP(sd, d, handleEvent);
(*d->handleEvent) (d, event);
- WRAP (sd, d, handleEvent, snapHandleEvent);
+ WRAP(sd, d, handleEvent, snapHandleEvent);
}
// Events notifications --------------------------------------------------------
static void
-snapWindowResizeNotify (CompWindow *w, int dx, int dy,
- int dwidth, int dheight)
+snapWindowResizeNotify(CompWindow * w, int dx, int dy,
+ int dwidth, int dheight)
{
//SNAP_DISPLAY (w->screen->display);
- SNAP_SCREEN (w->screen);
+ SNAP_SCREEN(w->screen);
//SNAP_WINDOW (w);
- UNWRAP (ss, w->screen, windowResizeNotify);
+ UNWRAP(ss, w->screen, windowResizeNotify);
(*w->screen->windowResizeNotify) (w, dx, dy, dwidth, dheight);
- WRAP (ss, w->screen, windowResizeNotify, snapWindowResizeNotify);
+ WRAP(ss, w->screen, windowResizeNotify, snapWindowResizeNotify);
}
static void
-snapWindowMoveNotify (CompWindow * w, int dx, int dy, Bool immediate)
+snapWindowMoveNotify(CompWindow * w, int dx, int dy, Bool immediate)
{
- SNAP_DISPLAY (w->screen->display);
- SNAP_SCREEN (w->screen);
- SNAP_WINDOW (w);
+ SNAP_DISPLAY(w->screen->display);
+ SNAP_SCREEN(w->screen);
+ SNAP_WINDOW(w);
- UNWRAP (ss, w->screen, windowMoveNotify);
+ UNWRAP(ss, w->screen, windowMoveNotify);
(*w->screen->windowMoveNotify) (w, dx, dy, immediate);
- WRAP (ss, w->screen, windowMoveNotify, snapWindowMoveNotify);
+ WRAP(ss, w->screen, windowMoveNotify, snapWindowMoveNotify);
// avoid-infinite-notify-loop mode/not grabbed
if (sw->skipNotify || !sw->grabbed)
@@ -703,7 +689,7 @@ snapWindowMoveNotify (CompWindow * w, int dx, int dy, Bool immediate)
// we have to avoid snapping but there's still some buffered moving
if (!sd->snapping && (sw->dx || sw->dy))
{
- snapMoveWindow (w, sw->dx, sw->dy);
+ snapMoveWindow(w, sw->dx, sw->dy);
sw->dx = sw->dy = 0;
return;
}
@@ -722,11 +708,11 @@ snapWindowMoveNotify (CompWindow * w, int dx, int dy, Bool immediate)
{
sw->dx += dx;
if (sw->dx < ss->resistanceDistance
- && sw->dx > -ss->resistanceDistance)
- snapMoveWindow (w, -dx, 0);
+ && sw->dx > -ss->resistanceDistance)
+ snapMoveWindow(w, -dx, 0);
else
{
- snapMoveWindow (w, sw->dx - dx, 0);
+ snapMoveWindow(w, sw->dx - dx, 0);
sw->dx = 0;
sw->snapDirection &= VerticalSnap;
}
@@ -736,11 +722,11 @@ snapWindowMoveNotify (CompWindow * w, int dx, int dy, Bool immediate)
{
sw->dy += dy;
if (sw->dy < ss->resistanceDistance
- && sw->dy > -ss->resistanceDistance)
- snapMoveWindow (w, 0, -dy);
+ && sw->dy > -ss->resistanceDistance)
+ snapMoveWindow(w, 0, -dy);
else
{
- snapMoveWindow (w, 0, sw->dy - dy);
+ snapMoveWindow(w, 0, sw->dy - dy);
sw->dy = 0;
sw->snapDirection &= HorizontalSnap;
}
@@ -752,38 +738,37 @@ snapWindowMoveNotify (CompWindow * w, int dx, int dy, Bool immediate)
// If we don't already snap vertically and horizontally,
// check edges status
if (sw->snapDirection != (VerticalSnap | HorizontalSnap))
- snapCheckEdges (w);
+ snapCheckEdges(w);
}
/*
* Initiate snap, get edges
*/
static void
-snapWindowGrabNotify (CompWindow * w,
- int x, int y, unsigned int state, unsigned int mask)
+snapWindowGrabNotify(CompWindow * w,
+ int x, int y, unsigned int state, unsigned int mask)
{
- SNAP_SCREEN (w->screen);
- SNAP_WINDOW (w);
+ SNAP_SCREEN(w->screen);
+ SNAP_WINDOW(w);
sw->grabbed = TRUE;
- snapUpdateEdges (w);
+ snapUpdateEdges(w);
- UNWRAP (ss, w->screen, windowGrabNotify);
+ UNWRAP(ss, w->screen, windowGrabNotify);
(*w->screen->windowGrabNotify) (w, x, y, state, mask);
- WRAP (ss, w->screen, windowGrabNotify, snapWindowGrabNotify);
+ WRAP(ss, w->screen, windowGrabNotify, snapWindowGrabNotify);
}
/*
* Clean edges data, reset dx/dy to avoid buggy moves
* when snap will be triggered again.
*/
-static void
-snapWindowUngrabNotify (CompWindow * w)
+static void snapWindowUngrabNotify(CompWindow * w)
{
- SNAP_SCREEN (w->screen);
- SNAP_WINDOW (w);
+ SNAP_SCREEN(w->screen);
+ SNAP_WINDOW(w);
- snapFreeEdges (w);
+ snapFreeEdges(w);
sw->snapped = FALSE;
sw->snapDirection = 0;
sw->grabbed = FALSE;
@@ -797,343 +782,335 @@ snapWindowUngrabNotify (CompWindow * w)
// Internal stuff --------------------------------------------------------------
static Bool
-snapSetScreenOption (CompScreen * screen,
- char *name, CompOptionValue * value)
+snapSetScreenOption(CompScreen * screen, char *name, CompOptionValue * value)
{
CompOption *o;
int index;
- SNAP_SCREEN (screen);
+ SNAP_SCREEN(screen);
- o = compFindOption (ss->opt, NUM_OPTIONS (ss), name, &index);
+ o = compFindOption(ss->opt, NUM_OPTIONS(ss), name, &index);
if (!o)
return FALSE;
switch (index)
{
- case SNAP_SCREEN_OPTION_SNAP_TYPE:
- if (compSetStringOption(o, value))
- {
- int i;
- SnapType type = SNAP_TYPE_OPTION_DEFAULT;
-
- for (i = 0; i < o->rest.s.nString; i++)
- if (strcmp (snapTypes[i], o->value.s) == 0)
- type = (SnapType) i;
- switch (type)
- {
- case SnapTypeFull:
- ss->snapType = EdgeResistance | EdgeAttraction;
- break;
- default:
- case SnapTypeResistance:
- ss->snapType = EdgeResistance;
- break;
- }
- return TRUE;
- }
- break;
- case SNAP_SCREEN_OPTION_EDGES_CATEGORIES:
- if (compSetStringOption(o, value))
- {
- int i;
- EdgesCategory type = EDGES_CATEGORY_OPTION_DEFAULT;
-
- for (i = 0; i < o->rest.s.nString; i++)
- if (strcmp (edgesCategories[i], o->value.s) == 0)
- type = (EdgesCategory) i;
- switch (type)
- {
- case EdgesCategoryScreen:
- ss->edgesCategories = ScreenEdges;
- break;
- case EdgesCategoryWindows:
- ss->edgesCategories = WindowsEdges;
- break;
- default:
- case EdgesCategoryBoth:
- ss->edgesCategories = ScreenEdges | WindowsEdges;
- break;
- }
- return TRUE;
- }
- break;
- case SNAP_SCREEN_OPTION_RESISTANCE_DISTANCE:
- if (compSetIntOption (o, value))
+ case SNAP_SCREEN_OPTION_SNAP_TYPE:
+ if (compSetStringOption(o, value))
+ {
+ int i;
+ SnapType type = SNAP_TYPE_OPTION_DEFAULT;
+
+ for (i = 0; i < o->rest.s.nString; i++)
+ if (strcmp(snapTypes[i], o->value.s) == 0)
+ type = (SnapType) i;
+ switch (type)
{
- ss->resistanceDistance = o->value.i;
- return TRUE;
+ case SnapTypeFull:
+ ss->snapType = EdgeResistance | EdgeAttraction;
+ break;
+ default:
+ case SnapTypeResistance:
+ ss->snapType = EdgeResistance;
+ break;
}
- break;
- case SNAP_SCREEN_OPTION_ATTRACTION_DISTANCE:
- if (compSetIntOption (o, value))
+ return TRUE;
+ }
+ break;
+ case SNAP_SCREEN_OPTION_EDGES_CATEGORIES:
+ if (compSetStringOption(o, value))
+ {
+ int i;
+ EdgesCategory type = EDGES_CATEGORY_OPTION_DEFAULT;
+
+ for (i = 0; i < o->rest.s.nString; i++)
+ if (strcmp(edgesCategories[i], o->value.s) == 0)
+ type = (EdgesCategory) i;
+ switch (type)
{
- ss->attractionDistance = o->value.i;
- return TRUE;
+ case EdgesCategoryScreen:
+ ss->edgesCategories = ScreenEdges;
+ break;
+ case EdgesCategoryWindows:
+ ss->edgesCategories = WindowsEdges;
+ break;
+ default:
+ case EdgesCategoryBoth:
+ ss->edgesCategories = ScreenEdges | WindowsEdges;
+ break;
}
- break;
- default:
- break;
+ return TRUE;
+ }
+ break;
+ case SNAP_SCREEN_OPTION_RESISTANCE_DISTANCE:
+ if (compSetIntOption(o, value))
+ {
+ ss->resistanceDistance = o->value.i;
+ return TRUE;
+ }
+ break;
+ case SNAP_SCREEN_OPTION_ATTRACTION_DISTANCE:
+ if (compSetIntOption(o, value))
+ {
+ ss->attractionDistance = o->value.i;
+ return TRUE;
+ }
+ break;
+ default:
+ break;
}
return FALSE;
}
-static void
-snapScreenInitOptions (SnapScreen * ss)
+static void snapScreenInitOptions(SnapScreen * ss)
{
CompOption *o;
o = &ss->opt[SNAP_SCREEN_OPTION_SNAP_TYPE];
- o->advanced = False;
- o->name = "snap_type";
- o->group = N_("Behaviour");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Snap type");
- o->longDesc =
- N_("Choose resistance, attraction or full mode.");
- o->type = CompOptionTypeString;
- o->value.s = strdup(snapTypes[SNAP_TYPE_OPTION_DEFAULT]);
- o->rest.s.string = snapTypes;
- o->rest.s.nString = NUM_SNAP_TYPES;
+ o->advanced = False;
+ o->name = "snap_type";
+ o->group = N_("Behaviour");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Snap type");
+ o->longDesc = N_("Choose resistance, attraction or full mode.");
+ o->type = CompOptionTypeString;
+ o->value.s = strdup(snapTypes[SNAP_TYPE_OPTION_DEFAULT]);
+ o->rest.s.string = snapTypes;
+ o->rest.s.nString = NUM_SNAP_TYPES;
o = &ss->opt[SNAP_SCREEN_OPTION_EDGES_CATEGORIES];
- o->advanced = False;
- o->name = "edges_categories";
- o->group = N_("Behaviour");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Edges");
- o->longDesc =
- N_("Snap to Screen Edges, Windows Edges or both");
- o->type = CompOptionTypeString;
- o->value.s = strdup(edgesCategories[EDGES_CATEGORY_OPTION_DEFAULT]);
- o->rest.s.string = edgesCategories;
- o->rest.s.nString = NUM_EDGES_CATEGORIES;
+ o->advanced = False;
+ o->name = "edges_categories";
+ o->group = N_("Behaviour");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Edges");
+ o->longDesc = N_("Snap to Screen Edges, Windows Edges or both");
+ o->type = CompOptionTypeString;
+ o->value.s = strdup(edgesCategories[EDGES_CATEGORY_OPTION_DEFAULT]);
+ o->rest.s.string = edgesCategories;
+ o->rest.s.nString = NUM_EDGES_CATEGORIES;
o = &ss->opt[SNAP_SCREEN_OPTION_RESISTANCE_DISTANCE];
- o->advanced = False;
- o->name = "resistance_distance";
- o->group = N_("Behaviour");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = "Edge resistance distance";
- o->longDesc = "Edge resistance distance";
- o->type = CompOptionTypeInt;
- o->value.i = SNAP_RESISTANCE_DISTANCE_DEFAULT;
- o->rest.i.min = SNAP_EDGE_DISTANCE_MIN;
- o->rest.i.max = SNAP_EDGE_DISTANCE_MAX;
+ o->advanced = False;
+ o->name = "resistance_distance";
+ o->group = N_("Behaviour");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = "Edge resistance distance";
+ o->longDesc = "Edge resistance distance";
+ o->type = CompOptionTypeInt;
+ o->value.i = SNAP_RESISTANCE_DISTANCE_DEFAULT;
+ o->rest.i.min = SNAP_EDGE_DISTANCE_MIN;
+ o->rest.i.max = SNAP_EDGE_DISTANCE_MAX;
o = &ss->opt[SNAP_SCREEN_OPTION_ATTRACTION_DISTANCE];
- o->advanced = False;
- o->name = "attraction_distance";
- o->group = N_("Behaviour");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = "Edge attraction distance";
- o->longDesc = "Edge attraction distance";
- o->type = CompOptionTypeInt;
- o->value.i = SNAP_ATTRACTION_DISTANCE_DEFAULT;
- o->rest.i.min = SNAP_EDGE_DISTANCE_MIN;
- o->rest.i.max = SNAP_EDGE_DISTANCE_MAX;
+ o->advanced = False;
+ o->name = "attraction_distance";
+ o->group = N_("Behaviour");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = "Edge attraction distance";
+ o->longDesc = "Edge attraction distance";
+ o->type = CompOptionTypeInt;
+ o->value.i = SNAP_ATTRACTION_DISTANCE_DEFAULT;
+ o->rest.i.min = SNAP_EDGE_DISTANCE_MIN;
+ o->rest.i.max = SNAP_EDGE_DISTANCE_MAX;
}
-static CompOption *
-snapGetScreenOptions (CompScreen * screen, int *count)
+static CompOption *snapGetScreenOptions(CompScreen * screen, int *count)
{
if (screen)
{
- SNAP_SCREEN (screen);
- *count = NUM_OPTIONS (ss);
+ SNAP_SCREEN(screen);
+ *count = NUM_OPTIONS(ss);
return ss->opt;
}
else
{
- SnapScreen * ss = malloc(sizeof(SnapScreen));
+ SnapScreen *ss = malloc(sizeof(SnapScreen));
+
snapScreenInitOptions(ss);
- *count = NUM_OPTIONS (ss);
+ *count = NUM_OPTIONS(ss);
return ss->opt;
}
}
static Bool
-snapSetDisplayOption (CompDisplay * display,
- char *name, CompOptionValue * value)
+snapSetDisplayOption(CompDisplay * display,
+ char *name, CompOptionValue * value)
{
CompOption *o;
int index;
- SNAP_DISPLAY (display);
+ SNAP_DISPLAY(display);
- o = compFindOption (sd->opt, NUM_OPTIONS (sd), name, &index);
+ o = compFindOption(sd->opt, NUM_OPTIONS(sd), name, &index);
if (!o)
return FALSE;
switch (index)
{
- case SNAP_DISPLAY_OPTION_AVOID_SNAP:
- if (compSetOptionList (o, value))
+ case SNAP_DISPLAY_OPTION_AVOID_SNAP:
+ if (compSetOptionList(o, value))
+ {
+ int i;
+
+ sd->avoidSnapMask = 0;
+ for (i = 0; i < o->value.list.nValue; i++)
{
- int i;
- sd->avoidSnapMask = 0;
- for (i = 0; i < o->value.list.nValue; i++)
- {
- int j;
- for (j = 0; j < nMods; j++)
- if (strcmp (o->value.list.value[i].s, Mods[j]) == 0)
- sd->avoidSnapMask |= ModMask[j];
- }
- return TRUE;
+ int j;
+
+ for (j = 0; j < nMods; j++)
+ if (strcmp(o->value.list.value[i].s, Mods[j]) == 0)
+ sd->avoidSnapMask |= ModMask[j];
}
- break;
- default:
- break;
+ return TRUE;
+ }
+ break;
+ default:
+ break;
}
return FALSE;
}
-static void
-snapDisplayInitOptions (SnapDisplay * sd)
+static void snapDisplayInitOptions(SnapDisplay * sd)
{
CompOption *o;
CompOptionValue *v;
o = &sd->opt[SNAP_DISPLAY_OPTION_AVOID_SNAP];
- o->name = "avoid_snap";
- o->group = N_("Bindings");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Avoid snap modifier");
- o->longDesc = N_("Use this binding to avoid snapping");
+ o->name = "avoid_snap";
+ o->group = N_("Bindings");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Avoid snap modifier");
+ o->longDesc = N_("Use this binding to avoid snapping");
o->type = CompOptionTypeList;
- v = malloc (sizeof (CompOptionValue));
- o->value.list.type = CompOptionTypeString;
- o->value.list.nValue = 1;
- o->value.list.value = v;
- v->s = strdup (N_("Shift"));
- o->rest.s.nString = nMods;
- o->rest.s.string = Mods;
+ v = malloc(sizeof(CompOptionValue));
+ o->value.list.type = CompOptionTypeString;
+ o->value.list.nValue = 1;
+ o->value.list.value = v;
+ v->s = strdup(N_("Shift"));
+ o->rest.s.nString = nMods;
+ o->rest.s.string = Mods;
}
-static CompOption *
-snapGetDisplayOptions (CompDisplay * display, int *count)
+static CompOption *snapGetDisplayOptions(CompDisplay * display, int *count)
{
if (display)
{
- SNAP_DISPLAY (display);
- *count = NUM_OPTIONS (sd);
+ SNAP_DISPLAY(display);
+ *count = NUM_OPTIONS(sd);
return sd->opt;
}
else
{
- SnapDisplay * sd = malloc (sizeof(SnapDisplay));
- snapDisplayInitOptions (sd);
- *count = NUM_OPTIONS (sd);
+ SnapDisplay *sd = malloc(sizeof(SnapDisplay));
+
+ snapDisplayInitOptions(sd);
+ *count = NUM_OPTIONS(sd);
return sd->opt;
}
}
-static Bool
-snapInitDisplay (CompPlugin * p, CompDisplay * d)
+static Bool snapInitDisplay(CompPlugin * p, CompDisplay * d)
{
SnapDisplay *sd;
- sd = malloc (sizeof (SnapDisplay));
+ sd = malloc(sizeof(SnapDisplay));
if (!sd)
return FALSE;
- sd->screenPrivateIndex = allocateScreenPrivateIndex (d);
+ sd->screenPrivateIndex = allocateScreenPrivateIndex(d);
if (sd->screenPrivateIndex < 0)
{
- free (sd);
+ free(sd);
return FALSE;
}
- WRAP (sd, d, handleEvent, snapHandleEvent);
+ WRAP(sd, d, handleEvent, snapHandleEvent);
sd->avoidSnapMask = AVOID_SNAP_MODIFIERS_DEFAULT;
sd->snapping = TRUE;
- snapDisplayInitOptions (sd);
+ snapDisplayInitOptions(sd);
d->privates[displayPrivateIndex].ptr = sd;
return TRUE;
}
-static void
-snapFiniDisplay (CompPlugin * p, CompDisplay * d)
+static void snapFiniDisplay(CompPlugin * p, CompDisplay * d)
{
- SNAP_DISPLAY (d);
+ SNAP_DISPLAY(d);
- freeScreenPrivateIndex (d, sd->screenPrivateIndex);
+ freeScreenPrivateIndex(d, sd->screenPrivateIndex);
- UNWRAP (sd, d, handleEvent);
+ UNWRAP(sd, d, handleEvent);
- free (sd);
+ free(sd);
}
-static Bool
-snapInitScreen (CompPlugin * p, CompScreen * s)
+static Bool snapInitScreen(CompPlugin * p, CompScreen * s)
{
SnapScreen *ss;
- SNAP_DISPLAY (s->display);
+ SNAP_DISPLAY(s->display);
- ss = malloc (sizeof (SnapScreen));
+ ss = malloc(sizeof(SnapScreen));
if (!ss)
return FALSE;
- ss->windowPrivateIndex = allocateWindowPrivateIndex (s);
+ ss->windowPrivateIndex = allocateWindowPrivateIndex(s);
if (ss->windowPrivateIndex < 0)
{
- free (ss);
+ free(ss);
return FALSE;
}
- ss->snapType = SNAP_TYPE_DEFAULT;
- ss->edgesCategories = EDGES_CATEGORIES_DEFAULT;
- ss->resistanceDistance = SNAP_RESISTANCE_DISTANCE_DEFAULT;
- ss->attractionDistance = SNAP_ATTRACTION_DISTANCE_DEFAULT;
+ ss->snapType = SNAP_TYPE_DEFAULT;
+ ss->edgesCategories = EDGES_CATEGORIES_DEFAULT;
+ ss->resistanceDistance = SNAP_RESISTANCE_DISTANCE_DEFAULT;
+ ss->attractionDistance = SNAP_ATTRACTION_DISTANCE_DEFAULT;
- snapScreenInitOptions (ss);
+ snapScreenInitOptions(ss);
- WRAP (ss, s, windowResizeNotify, snapWindowResizeNotify);
- WRAP (ss, s, windowMoveNotify, snapWindowMoveNotify);
- WRAP (ss, s, windowGrabNotify, snapWindowGrabNotify);
- WRAP (ss, s, windowUngrabNotify, snapWindowUngrabNotify);
+ WRAP(ss, s, windowResizeNotify, snapWindowResizeNotify);
+ WRAP(ss, s, windowMoveNotify, snapWindowMoveNotify);
+ WRAP(ss, s, windowGrabNotify, snapWindowGrabNotify);
+ WRAP(ss, s, windowUngrabNotify, snapWindowUngrabNotify);
s->privates[sd->screenPrivateIndex].ptr = ss;
return TRUE;
}
-static void
-snapFiniScreen (CompPlugin * p, CompScreen * s)
+static void snapFiniScreen(CompPlugin * p, CompScreen * s)
{
- SNAP_SCREEN (s);
+ SNAP_SCREEN(s);
- freeWindowPrivateIndex (s, ss->windowPrivateIndex);
+ freeWindowPrivateIndex(s, ss->windowPrivateIndex);
- UNWRAP (ss, s, windowResizeNotify);
- UNWRAP (ss, s, windowMoveNotify);
- UNWRAP (ss, s, windowGrabNotify);
- UNWRAP (ss, s, windowUngrabNotify);
+ UNWRAP(ss, s, windowResizeNotify);
+ UNWRAP(ss, s, windowMoveNotify);
+ UNWRAP(ss, s, windowGrabNotify);
+ UNWRAP(ss, s, windowUngrabNotify);
- free (ss);
+ free(ss);
}
-static Bool
-snapInitWindow (CompPlugin * p, CompWindow * w)
+static Bool snapInitWindow(CompPlugin * p, CompWindow * w)
{
SnapWindow *sw;
- SNAP_SCREEN (w->screen);
+ SNAP_SCREEN(w->screen);
- sw = malloc (sizeof (SnapWindow));
+ sw = malloc(sizeof(SnapWindow));
if (!sw)
return FALSE;
@@ -1148,30 +1125,27 @@ snapInitWindow (CompPlugin * p, CompWindow * w)
return TRUE;
}
-static void
-snapFiniWindow (CompPlugin * p, CompWindow * w)
+static void snapFiniWindow(CompPlugin * p, CompWindow * w)
{
- SNAP_WINDOW (w);
+ SNAP_WINDOW(w);
- snapFreeEdges (w);
+ snapFreeEdges(w);
- free (sw);
+ free(sw);
}
-static Bool
-snapInit (CompPlugin * p)
+static Bool snapInit(CompPlugin * p)
{
- displayPrivateIndex = allocateDisplayPrivateIndex ();
+ displayPrivateIndex = allocateDisplayPrivateIndex();
if (displayPrivateIndex < 0)
return FALSE;
return TRUE;
}
-static void
-snapFini (CompPlugin * p)
+static void snapFini(CompPlugin * p)
{
if (displayPrivateIndex >= 0)
- freeDisplayPrivateIndex (displayPrivateIndex);
+ freeDisplayPrivateIndex(displayPrivateIndex);
}
CompPluginDep snapDeps[] = {
@@ -1200,9 +1174,9 @@ CompPluginVTable snapVTable = {
snapGetScreenOptions,
snapSetScreenOption,
snapDeps,
- sizeof (snapDeps) / sizeof (snapDeps[0]),
+ sizeof(snapDeps) / sizeof(snapDeps[0]),
snapFeatures,
- sizeof (snapFeatures) / sizeof (snapFeatures[0]),
+ sizeof(snapFeatures) / sizeof(snapFeatures[0]),
BERYL_ABI_INFO,
"beryl-plugins",
"wm",
@@ -1211,8 +1185,7 @@ CompPluginVTable snapVTable = {
False,
};
-CompPluginVTable *
-getCompPluginInfo (void)
+CompPluginVTable *getCompPluginInfo(void)
{
return &snapVTable;
}
diff --git a/beryl-plugins/src/snow.c b/beryl-plugins/src/snow.c
index d70b8d5..fe2069b 100644
--- a/beryl-plugins/src/snow.c
+++ b/beryl-plugins/src/snow.c
@@ -344,10 +344,10 @@ static void beginRendering(SnowScreen * ss, CompScreen * s, int output)
if (snowFlake->tex == &ss->snowTex[j])
{
glTranslatef(snowFlake->x, snowFlake->y, snowFlake->z);
- if(snowRotate)
+ if (snowRotate)
glRotatef(snowFlake->ra, 0, 0, 1);
glCallList(ss->snowTex[j].dList);
- if(snowRotate)
+ if (snowRotate)
glRotatef(-snowFlake->ra, 0, 0, 1);
glTranslatef(-snowFlake->x, -snowFlake->y, -snowFlake->z);
}
@@ -450,7 +450,8 @@ static void InitiateSnowFlake(SnowScreen * ss, SnowFlake * sf)
{
//TODO: possibly place snowflakes based on FOV, instead of a cube.
SNOW_DISPLAY(ss->s->display);
- CompOption * o = &sd->opt[SNOW_DISPLAY_OPTION_SNOW_DIRECTION];
+ CompOption *o = &sd->opt[SNOW_DISPLAY_OPTION_SNOW_DIRECTION];
+
if (strcmp(snowDirections[0], o->value.s) == 0)
{
sf->x = mmrand(-boxing, ss->s->width + boxing, 1);
@@ -655,8 +656,9 @@ snowSetDisplayOption(CompDisplay * display, char *name,
break;
case SNOW_DISPLAY_OPTION_SNOW_DIRECTION:
- if (compSetStringOption(o, value)) {
- return TRUE;
+ if (compSetStringOption(o, value))
+ {
+ return TRUE;
}
break;
case SNOW_DISPLAY_OPTION_SNOW_SIZE:
@@ -734,13 +736,13 @@ snowSetDisplayOption(CompDisplay * display, char *name,
return TRUE;
}
break;
- case SNOW_DISPLAY_OPTION_ROTATION:
- if (compSetBoolOption(o, value))
- {
- snowRotate = sd->opt[SNOW_DISPLAY_OPTION_ROTATION].value.b;
- return TRUE;
- }
- break;
+ case SNOW_DISPLAY_OPTION_ROTATION:
+ if (compSetBoolOption(o, value))
+ {
+ snowRotate = sd->opt[SNOW_DISPLAY_OPTION_ROTATION].value.b;
+ return TRUE;
+ }
+ break;
case SNOW_DISPLAY_OPTION_USE_BLENDING:
if (compSetBoolOption(o, value))
{
@@ -922,7 +924,8 @@ static void snowDisplayInitOptions(SnowDisplay * sd)
o->shortDesc = N_("Snow Direction");
o->longDesc = N_("Select direction in which the snow should fly.");
o->type = CompOptionTypeString;
- o->value.s = strdup(snowDirections[SNOW_DISPLAY_OPTION_DIRECTION_DEFAULT]);
+ o->value.s =
+ strdup(snowDirections[SNOW_DISPLAY_OPTION_DIRECTION_DEFAULT]);
o->rest.s.string = snowDirections;
o->rest.s.nString = NUM_SNOW_DIRECTIONS;
@@ -1038,7 +1041,8 @@ static void snowFini(CompPlugin * p)
}
CompPluginDep snowDeps[] = {
- {CompPluginRuleAfterCategory, "imageformat"},
+ {CompPluginRuleAfterCategory, "imageformat"}
+ ,
};
CompPluginVTable snowVTable = {
diff --git a/beryl-plugins/src/splash.c b/beryl-plugins/src/splash.c
index 5ef278a..ebc1f9f 100644
--- a/beryl-plugins/src/splash.c
+++ b/beryl-plugins/src/splash.c
@@ -907,7 +907,8 @@ static void splashFini(CompPlugin * p)
}
CompPluginDep splashDeps[] = {
- {CompPluginRuleAfterCategory, "imageloader"},
+ {CompPluginRuleAfterCategory, "imageloader"}
+ ,
{CompPluginRuleEnd, ""}
};
diff --git a/beryl-plugins/src/state.c b/beryl-plugins/src/state.c
index 730eb8e..4ebdc0d 100644
--- a/beryl-plugins/src/state.c
+++ b/beryl-plugins/src/state.c
@@ -331,7 +331,7 @@ static void stateScreenInitOptions(StateScreen * fs)
o->displayHints = "";
o->shortDesc = N_("Absoloute Window Opacity");
o->longDesc = N_("Set window opacity by conditions, this "
- "overrides plugins like opacify.");
+ "overrides plugins like opacify.");
o->type = CompOptionTypeList;
o->value.list.type = CompOptionTypeString;
o->value.list.nValue = 0;
@@ -347,7 +347,7 @@ static void stateScreenInitOptions(StateScreen * fs)
o->displayHints = "";
o->shortDesc = N_("Absoloute Window Brightness");
o->longDesc = N_("Set window brightness by conditions, this "
- "overrides plugins like opacify.");
+ "overrides plugins like opacify.");
o->type = CompOptionTypeList;
o->value.list.type = CompOptionTypeString;
o->value.list.nValue = 0;
@@ -363,7 +363,7 @@ static void stateScreenInitOptions(StateScreen * fs)
o->displayHints = "";
o->shortDesc = N_("Absoloute Window Saturation");
o->longDesc = N_("Set window saturation by conditions, this "
- "overrides plugins like opacify.");
+ "overrides plugins like opacify.");
o->type = CompOptionTypeList;
o->value.list.type = CompOptionTypeString;
o->value.list.nValue = 0;
@@ -756,8 +756,7 @@ stateGetParamForWindow(CompWindow * w, StateIntValues * params)
else if (type == TITLE)
{
if (title
- && stateMatch(title, params->values[i])
- && changed <= TITLE)
+ && stateMatch(title, params->values[i]) && changed <= TITLE)
{
ret = dret;
changed = TITLE;
@@ -833,21 +832,22 @@ static void stateAdjustWindowPaintParams(CompWindow * w)
stateChangeWindowBrightness(w, val);
val = stateGetParamForWindow(w, fs->opacitiesabs);
if (val != -1)
- setWindowOpacity(w, val * OPAQUE/100, PL_PLUGIN_ONE);
+ setWindowOpacity(w, val * OPAQUE / 100, PL_PLUGIN_ONE);
val = stateGetParamForWindow(w, fs->saturationsabs);
if (val != -1)
- setWindowSaturation(w, val * COLOR/100, PL_PLUGIN_ONE);
+ setWindowSaturation(w, val * COLOR / 100, PL_PLUGIN_ONE);
val = stateGetParamForWindow(w, fs->brightnessesabs);
if (val != -1)
- setWindowBrightness(w, val * BRIGHT/100, PL_PLUGIN_ONE);
+ setWindowBrightness(w, val * BRIGHT / 100, PL_PLUGIN_ONE);
}
static void stateResetWindowPaintParams(CompWindow * w)
{
STATE_SCREEN(w->screen);
signed int val;
+
val = stateGetParamForWindow(w, fs->opacities);
- if (val != -1)
+ if (val != -1)
setWindowBailoutOpacity(w, PL_PLUGIN_ONE);
val = stateGetParamForWindow(w, fs->saturations);
if (val != -1)
@@ -879,10 +879,12 @@ static void stateAdjustAllWindowsPaintParams(CompScreen * screen)
static void stateResetAllWindowsPaintParams(CompScreen * s)
{
- CompWindow * w;
+ CompWindow *w;
+
for (w = s->windows; w; w = w->next)
stateResetWindowPaintParams(w);
}
+
/*
static void
updateWidgetStatusForWindow (CompWindow * w)
diff --git a/beryl-plugins/src/svg.c b/beryl-plugins/src/svg.c
index 11b0d25..6b198a9 100644
--- a/beryl-plugins/src/svg.c
+++ b/beryl-plugins/src/svg.c
@@ -203,10 +203,13 @@ static void svgFini(CompPlugin * p)
freeDisplayPrivateIndex(displayPrivateIndex);
}
-CompPluginFeature svgFeatures[]={
- {"imageext:svg"},
- {"imagemime:image/svg+xml"},
- {"imagemime:image/svg-xml"},
+CompPluginFeature svgFeatures[] = {
+ {"imageext:svg"}
+ ,
+ {"imagemime:image/svg+xml"}
+ ,
+ {"imagemime:image/svg-xml"}
+ ,
};
CompPluginVTable svgVTable = {
@@ -227,8 +230,8 @@ CompPluginVTable svgVTable = {
0, /* SetScreenOption */
0, /* Deps */
0, /* nDeps */
- svgFeatures, /* Features */
- sizeof(svgFeatures)/sizeof(svgFeatures[0]), /* nFeatures */
+ svgFeatures, /* Features */
+ sizeof(svgFeatures) / sizeof(svgFeatures[0]), /* nFeatures */
BERYL_ABI_INFO,
"beryl-plugins",
"imageformat",
diff --git a/beryl-plugins/src/switcher.c b/beryl-plugins/src/switcher.c
index 44d78bb..a73b51a 100644
--- a/beryl-plugins/src/switcher.c
+++ b/beryl-plugins/src/switcher.c
@@ -597,8 +597,9 @@ static void switchScreenInitOptions(SwitchScreen * ss)
o->subGroup = N_("");
o->displayHints = "";
o->shortDesc = N_("Switch focus instantly");
- o->longDesc = N_("If enabled, the focus is switched to the window immediately"
- "on activation; otherwise on Application Switcher termination.");
+ o->longDesc =
+ N_("If enabled, the focus is switched to the window immediately"
+ "on activation; otherwise on Application Switcher termination.");
o->type = CompOptionTypeBool;
o->value.b = SWITCH_SWITCH_FOCUS_INSTANTLY_DEFAULT;
}
@@ -2322,8 +2323,10 @@ static void switchFini(CompPlugin * p)
}
CompPluginDep setDeps[] = {
- {CompPluginRuleAfter, "cube"},
- {CompPluginRuleAfter, "decoration"},
+ {CompPluginRuleAfter, "cube"}
+ ,
+ {CompPluginRuleAfter, "decoration"}
+ ,
};
CompPluginVTable switchVTable = {
diff --git a/beryl-plugins/src/thumbnail.c b/beryl-plugins/src/thumbnail.c
index 25b87fa..1d2e9d8 100644
--- a/beryl-plugins/src/thumbnail.c
+++ b/beryl-plugins/src/thumbnail.c
@@ -108,15 +108,17 @@
static int displayPrivateIndex;
-typedef struct _ThumbDisplay {
- int screenPrivateIndex;
+typedef struct _ThumbDisplay
+{
+ int screenPrivateIndex;
HandleEventProc handleEvent;
Atom winIconGeometryAtom;
} ThumbDisplay;
-typedef struct _Thumbnail {
+typedef struct _Thumbnail
+{
int x;
int y;
int width;
@@ -128,17 +130,18 @@ typedef struct _Thumbnail {
CompWindow *dock;
} Thumbnail;
-typedef struct _ThumbScreen {
- int windowPrivateIndex;
+typedef struct _ThumbScreen
+{
+ int windowPrivateIndex;
CompTimeoutHandle mouseTimeout;
CompTimeoutHandle displayTimeout;
PreparePaintScreenProc preparePaintScreen;
- PaintScreenProc paintScreen;
- PaintWindowProc paintWindow;
+ PaintScreenProc paintScreen;
+ PaintWindowProc paintWindow;
DonePaintScreenProc donePaintScreen;
- DamageWindowRectProc damageWindowRect;
+ DamageWindowRectProc damageWindowRect;
CompWindow *dock;
CompWindow *pointedWin;
@@ -149,10 +152,11 @@ typedef struct _ThumbScreen {
CompTexture glowTexture;
CompTexture windowTexture;
- CompOption opt[THUMB_SCREEN_OPTION_NUM];
+ CompOption opt[THUMB_SCREEN_OPTION_NUM];
} ThumbScreen;
-typedef struct _IconGeometry {
+typedef struct _IconGeometry
+{
int x;
int y;
int width;
@@ -160,29 +164,29 @@ typedef struct _IconGeometry {
Bool isSet;
} IconGeometry;
-typedef struct _ThumbWindow {
+typedef struct _ThumbWindow
+{
IconGeometry ig;
} ThumbWindow;
-static void
-updateWindowIconGeometry (CompWindow *w)
+static void updateWindowIconGeometry(CompWindow * w)
{
THUMB_DISPLAY(w->screen->display);
THUMB_WINDOW(w);
Atom actual;
- int result, format;
- unsigned long n, left;
- unsigned char *data;
- unsigned long *mydata;
+ int result, format;
+ unsigned long n, left;
+ unsigned char *data;
+ unsigned long *mydata;
- result = XGetWindowProperty (w->screen->display->display,
- w->id, td->winIconGeometryAtom, 0L, 4L,
- FALSE, XA_CARDINAL, &actual, &format, &n,
- &left, &data);
+ result = XGetWindowProperty(w->screen->display->display,
+ w->id, td->winIconGeometryAtom, 0L, 4L,
+ FALSE, XA_CARDINAL, &actual, &format, &n,
+ &left, &data);
- mydata = (unsigned long *) data;
+ mydata = (unsigned long *)data;
tw->ig.isSet = FALSE;
@@ -193,14 +197,14 @@ updateWindowIconGeometry (CompWindow *w)
tw->ig.width = mydata[2];
tw->ig.height = mydata[3];
tw->ig.isSet = TRUE;
- XFree (data);
+ XFree(data);
}
}
-static void
-damageThumbRegion (CompScreen *s, Thumbnail *t)
+static void damageThumbRegion(CompScreen * s, Thumbnail * t)
{
REGION region;
+
region.extents.x1 = t->x - t->offset;
region.extents.y1 = t->y - t->offset;
region.extents.x2 = region.extents.x1 + t->width + (t->offset * 2);
@@ -215,8 +219,7 @@ damageThumbRegion (CompScreen *s, Thumbnail *t)
(sqrt((((a)[0] - (b)[0]) * ((a)[0] - (b)[0])) + \
(((a)[1] - (b)[1]) * ((a)[1] - (b)[1]))))
-static void
-thumbUpdateThumbnail( CompScreen *s)
+static void thumbUpdateThumbnail(CompScreen * s)
{
THUMB_SCREEN(s);
@@ -227,7 +230,7 @@ thumbUpdateThumbnail( CompScreen *s)
return;
if (ts->thumb.win)
- damageThumbRegion(s,&ts->thumb);
+ damageThumbRegion(s, &ts->thumb);
ts->oldThumb = ts->thumb;
ts->thumb.win = ts->pointedWin;
@@ -238,6 +241,7 @@ thumbUpdateThumbnail( CompScreen *s)
float maxSize = ts->opt[THUMB_SCREEN_OPTION_SIZE].value.i;
double scale = 1.0;
+
// do we nee to scale the window down?
if (WIN_W(ts->thumb.win) > maxSize || WIN_H(ts->thumb.win) > maxSize)
{
@@ -254,15 +258,18 @@ thumbUpdateThumbnail( CompScreen *s)
THUMB_WINDOW(ts->thumb.win);
int igMidPoint[2] = { tw->ig.x + (tw->ig.width / 2),
- tw->ig.y + (tw->ig.height / 2)};
+ tw->ig.y + (tw->ig.height / 2)
+ };
int tMidPoint[2];
int tPos[2];
int tmpPos[2];
float distance = 1000000;
int off = ts->opt[THUMB_SCREEN_OPTION_BORDER].value.i;
- int oDev = screenGetOutputDev(s,tw->ig.x,tw->ig.y,tw->ig.width,tw->ig.height);
- int ox1,oy1,ox2,oy2,ow,oh;
+ int oDev = screenGetOutputDev(s, tw->ig.x, tw->ig.y, tw->ig.width,
+ tw->ig.height);
+ int ox1, oy1, ox2, oy2, ow, oh;
+
if (s->nOutputDev == 1 || oDev > s->nOutputDev)
{
ox1 = 0;
@@ -300,7 +307,7 @@ thumbUpdateThumbnail( CompScreen *s)
tmpPos[0] = ox1 + off;
if (tmpPos[0] + off + ts->thumb.width > ox2)
{
- if (ts->thumb.width + (2*off) < ow)
+ if (ts->thumb.width + (2 * off) < ow)
tmpPos[0] = ox2 - ts->thumb.width - off;
else
tmpPos[0] = ox1 + off;
@@ -313,18 +320,18 @@ thumbUpdateThumbnail( CompScreen *s)
{
tPos[0] = tmpPos[0];
tPos[1] = tmpPos[1];
- distance = GET_DISTANCE(igMidPoint,tMidPoint);
+ distance = GET_DISTANCE(igMidPoint, tMidPoint);
}
// below
tmpPos[1] = WIN_Y(ts->dock) + WIN_H(ts->dock) + off;
tMidPoint[1] = tmpPos[1] + (ts->thumb.height / 2.0);
if (tmpPos[1] + ts->thumb.height + off < oy2 &&
- GET_DISTANCE(igMidPoint,tMidPoint) < distance)
+ GET_DISTANCE(igMidPoint, tMidPoint) < distance)
{
tPos[0] = tmpPos[0];
tPos[1] = tmpPos[1];
- distance = GET_DISTANCE(igMidPoint,tMidPoint);
+ distance = GET_DISTANCE(igMidPoint, tMidPoint);
}
// left
@@ -333,7 +340,7 @@ thumbUpdateThumbnail( CompScreen *s)
tmpPos[1] = oy1 + off;
if (tmpPos[1] + off + ts->thumb.height > oy2)
{
- if (ts->thumb.height + (2*off) < oh)
+ if (ts->thumb.height + (2 * off) < oh)
tmpPos[1] = oy2 - ts->thumb.height - off;
else
tmpPos[1] = oy1 + off;
@@ -342,23 +349,22 @@ thumbUpdateThumbnail( CompScreen *s)
tmpPos[0] = WIN_X(ts->dock) - ts->thumb.width - off;
tMidPoint[0] = tmpPos[0] + (ts->thumb.width / 2.0);
- if (tmpPos[0] > ox1 &&
- GET_DISTANCE(igMidPoint,tMidPoint) < distance)
+ if (tmpPos[0] > ox1 && GET_DISTANCE(igMidPoint, tMidPoint) < distance)
{
tPos[0] = tmpPos[0];
tPos[1] = tmpPos[1];
- distance = GET_DISTANCE(igMidPoint,tMidPoint);
+ distance = GET_DISTANCE(igMidPoint, tMidPoint);
}
// right
tmpPos[0] = WIN_X(ts->dock) + WIN_W(ts->dock) + off;
tMidPoint[0] = tmpPos[0] + (ts->thumb.width / 2.0);
if (tmpPos[0] + ts->thumb.width + off < ox2 &&
- GET_DISTANCE(igMidPoint,tMidPoint) < distance)
+ GET_DISTANCE(igMidPoint, tMidPoint) < distance)
{
tPos[0] = tmpPos[0];
tPos[1] = tmpPos[1];
- distance = GET_DISTANCE(igMidPoint,tMidPoint);
+ distance = GET_DISTANCE(igMidPoint, tMidPoint);
}
ts->thumb.x = tPos[0];
@@ -368,22 +374,21 @@ thumbUpdateThumbnail( CompScreen *s)
ts->thumb.opacity = 0.0;
- damageThumbRegion(s,&ts->thumb);
+ damageThumbRegion(s, &ts->thumb);
}
-static Bool
-thumbShowThumbnail (void *vs)
+static Bool thumbShowThumbnail(void *vs)
{
CompScreen *s = (CompScreen *) vs;
+
THUMB_SCREEN(s);
ts->showingThumb = TRUE;
thumbUpdateThumbnail(s);
- damageThumbRegion(s,&ts->thumb);
+ damageThumbRegion(s, &ts->thumb);
return TRUE;
}
-static Bool
-checkPosition (CompWindow *w)
+static Bool checkPosition(CompWindow * w)
{
THUMB_SCREEN(w->screen);
@@ -392,7 +397,8 @@ checkPosition (CompWindow *w)
// TODO: We need a faster calculation here
Bool onViewport = FALSE;
Region reg = XCreateRegion();
- XIntersectRegion(w->region,&w->screen->region,reg);
+
+ XIntersectRegion(w->region, &w->screen->region, reg);
if (reg->numRects)
onViewport = TRUE;
XDestroyRegion(reg);
@@ -403,8 +409,7 @@ checkPosition (CompWindow *w)
return TRUE;
}
-static Bool
-thumbUpdateMouse (void *vs)
+static Bool thumbUpdateMouse(void *vs)
{
CompScreen *s = (CompScreen *) vs;
@@ -417,9 +422,8 @@ thumbUpdateMouse (void *vs)
Window child_return;
XQueryPointer(s->display->display, s->root,
- &root_return, &child_return,
- &rootX, &rootY, &winX,
- &winY, &mask_return);
+ &root_return, &child_return,
+ &rootX, &rootY, &winX, &winY, &mask_return);
CompWindow *w = findWindowAtDisplay(s->display, child_return);
@@ -439,7 +443,8 @@ thumbUpdateMouse (void *vs)
CompWindow *cw = s->windows;
CompWindow *found = NULL;
- for (;cw && !found;cw = cw->next)
+
+ for (; cw && !found; cw = cw->next)
{
THUMB_WINDOW(cw);
if (!tw->ig.isSet)
@@ -447,15 +452,15 @@ thumbUpdateMouse (void *vs)
if (cw->attrib.map_state != IsViewable && !cw->thumbPixmap)
continue;
if (cw->state & CompWindowStateSkipTaskbarMask)
- continue;
+ continue;
if (cw->state & CompWindowStateSkipPagerMask)
- continue;
+ continue;
if (!cw->managed)
continue;
if (rootX >= tw->ig.x && rootX < tw->ig.x + tw->ig.width &&
rootY >= tw->ig.y && rootY < tw->ig.y + tw->ig.height &&
- checkPosition(cw))
+ checkPosition(cw))
{
found = cw;
}
@@ -471,16 +476,18 @@ thumbUpdateMouse (void *vs)
if (ts->pointedWin != found)
{
compRemoveTimeout(ts->displayTimeout);
- ts->displayTimeout = compAddTimeout(
- ts->opt[THUMB_SCREEN_OPTION_DELAY].value.i,
- thumbShowThumbnail, s);
+ ts->displayTimeout =
+ compAddTimeout(ts->
+ opt[THUMB_SCREEN_OPTION_DELAY].
+ value.i, thumbShowThumbnail,
+ s);
}
}
else
{
ts->displayTimeout =
- compAddTimeout(ts->opt[THUMB_SCREEN_OPTION_DELAY].value.i,
- thumbShowThumbnail, s);
+ compAddTimeout(ts->opt[THUMB_SCREEN_OPTION_DELAY].
+ value.i, thumbShowThumbnail, s);
}
}
ts->pointedWin = found;
@@ -498,7 +505,8 @@ thumbUpdateMouse (void *vs)
ts->showingThumb = FALSE;
}
- } else
+ }
+ else
{
ts->dock = NULL;
if (ts->displayTimeout)
@@ -510,57 +518,57 @@ thumbUpdateMouse (void *vs)
ts->showingThumb = FALSE;
}
- ts->mouseTimeout = compAddTimeout(THUMB_MOUSE_UPDATE_SPEED, thumbUpdateMouse, s);
+ ts->mouseTimeout =
+ compAddTimeout(THUMB_MOUSE_UPDATE_SPEED, thumbUpdateMouse, s);
return FALSE;
}
-static void
-thumbScreenInitOptions (ThumbScreen *ts)
+static void thumbScreenInitOptions(ThumbScreen * ts)
{
- CompOption *o;
-
- o = &ts->opt[THUMB_SCREEN_OPTION_SIZE];
- o->name = "thumb_size";
- o->shortDesc = N_("Thumbnail size");
- o->longDesc = N_("Thumbnail window size");
- o->type = CompOptionTypeInt;
- o->value.i = THUMB_SIZE_DEFAULT;
- o->rest.i.min = THUMB_SIZE_MIN;
- o->rest.i.max = THUMB_SIZE_MAX;
- o->group = N_("Settings");
- o->subGroup = "";
- o->advanced = False;
- o->displayHints = "";
-
-
- o = &ts->opt[THUMB_SCREEN_OPTION_DELAY];
- o->name = "show_delay";
- o->shortDesc = N_("Show delay");
- o->longDesc = N_("Time (in ms) before thumbnail is shown when hovering "
- "over a task button (10-10000)");
- o->type = CompOptionTypeInt;
- o->value.i = THUMB_DELAY_DEFAULT;
- o->rest.i.min = THUMB_DELAY_MIN;
- o->rest.i.max = THUMB_DELAY_MAX;
- o->group = N_("Settings");
- o->subGroup = "";
- o->advanced = False;
- o->displayHints = "";
+ CompOption *o;
+
+ o = &ts->opt[THUMB_SCREEN_OPTION_SIZE];
+ o->name = "thumb_size";
+ o->shortDesc = N_("Thumbnail size");
+ o->longDesc = N_("Thumbnail window size");
+ o->type = CompOptionTypeInt;
+ o->value.i = THUMB_SIZE_DEFAULT;
+ o->rest.i.min = THUMB_SIZE_MIN;
+ o->rest.i.max = THUMB_SIZE_MAX;
+ o->group = N_("Settings");
+ o->subGroup = "";
+ o->advanced = False;
+ o->displayHints = "";
+
+
+ o = &ts->opt[THUMB_SCREEN_OPTION_DELAY];
+ o->name = "show_delay";
+ o->shortDesc = N_("Show delay");
+ o->longDesc = N_("Time (in ms) before thumbnail is shown when hovering "
+ "over a task button (10-10000)");
+ o->type = CompOptionTypeInt;
+ o->value.i = THUMB_DELAY_DEFAULT;
+ o->rest.i.min = THUMB_DELAY_MIN;
+ o->rest.i.max = THUMB_DELAY_MAX;
+ o->group = N_("Settings");
+ o->subGroup = "";
+ o->advanced = False;
+ o->displayHints = "";
o = &ts->opt[THUMB_SCREEN_OPTION_BORDER];
- o->name = "border";
- o->shortDesc = N_("Thumbnail border size");
- o->longDesc = N_("Size of thumbnail border");
- o->type = CompOptionTypeInt;
- o->value.i = THUMB_BORDER_DEFAULT;
- o->rest.i.min = THUMB_BORDER_MIN;
- o->rest.i.max = THUMB_BORDER_MAX;
- o->group = N_("Settings");
- o->subGroup = "";
- o->advanced = False;
- o->displayHints = "";
-
- o = &ts->opt[THUMB_SCREEN_OPTION_COLOR];
+ o->name = "border";
+ o->shortDesc = N_("Thumbnail border size");
+ o->longDesc = N_("Size of thumbnail border");
+ o->type = CompOptionTypeInt;
+ o->value.i = THUMB_BORDER_DEFAULT;
+ o->rest.i.min = THUMB_BORDER_MIN;
+ o->rest.i.max = THUMB_BORDER_MAX;
+ o->group = N_("Settings");
+ o->subGroup = "";
+ o->advanced = False;
+ o->displayHints = "";
+
+ o = &ts->opt[THUMB_SCREEN_OPTION_COLOR];
o->name = "thumb_color";
o->group = N_("Settings");
o->subGroup = N_("");
@@ -589,176 +597,173 @@ thumbScreenInitOptions (ThumbScreen *ts)
o->rest.f.precision = THUMB_FADE_PRECISION;
o = &ts->opt[THUMB_SCREEN_OPTION_CURRENT_VIEWPORT];
- o->name = "current_viewport";
- o->shortDesc = N_("Taskbar shows only windows of current viewport");
- o->longDesc = N_("Set it if the taskbar shows only windows of current viewport");
- o->type = CompOptionTypeBool;
- o->value.b = THUMB_CURRENT_VIEWPORT_DEFAULT;
- o->group = N_("Settings");
- o->subGroup = N_("Taskbar");
- o->advanced = False;
- o->displayHints = "";
+ o->name = "current_viewport";
+ o->shortDesc = N_("Taskbar shows only windows of current viewport");
+ o->longDesc =
+ N_
+ ("Set it if the taskbar shows only windows of current viewport");
+ o->type = CompOptionTypeBool;
+ o->value.b = THUMB_CURRENT_VIEWPORT_DEFAULT;
+ o->group = N_("Settings");
+ o->subGroup = N_("Taskbar");
+ o->advanced = False;
+ o->displayHints = "";
o = &ts->opt[THUMB_SCREEN_OPTION_ALWAYS_TOP];
- o->name = "always_on_top";
- o->shortDesc = N_("Paint thumbnails always on top");
- o->longDesc = N_("Paint thumbnails always on top of the desktop");
- o->type = CompOptionTypeBool;
- o->value.b = THUMB_ALWAYS_TOP_DEFAULT;
- o->group = N_("Settings");
- o->subGroup = N_("Taskbar");
- o->advanced = False;
- o->displayHints = "";
+ o->name = "always_on_top";
+ o->shortDesc = N_("Paint thumbnails always on top");
+ o->longDesc = N_("Paint thumbnails always on top of the desktop");
+ o->type = CompOptionTypeBool;
+ o->value.b = THUMB_ALWAYS_TOP_DEFAULT;
+ o->group = N_("Settings");
+ o->subGroup = N_("Taskbar");
+ o->advanced = False;
+ o->displayHints = "";
o = &ts->opt[THUMB_SCREEN_OPTION_WINDOW_LIKE];
- o->name = "window_like";
- o->shortDesc = N_("Paint window like background");
- o->longDesc = N_("Paint window like background instead of glow");
- o->type = CompOptionTypeBool;
- o->value.b = THUMB_WINDOW_LIKE_DEFAULT;
- o->group = N_("Settings");
- o->subGroup = "";
- o->advanced = False;
- o->displayHints = "";
+ o->name = "window_like";
+ o->shortDesc = N_("Paint window like background");
+ o->longDesc = N_("Paint window like background instead of glow");
+ o->type = CompOptionTypeBool;
+ o->value.b = THUMB_WINDOW_LIKE_DEFAULT;
+ o->group = N_("Settings");
+ o->subGroup = "";
+ o->advanced = False;
+ o->displayHints = "";
o = &ts->opt[THUMB_SCREEN_OPTION_MIPMAP];
- o->name = "mipmap";
- o->shortDesc = N_("Generate Mipmaps");
- o->longDesc = N_("Generate mipmaps when possible for higher quality "
- "scaling");
- o->type = CompOptionTypeBool;
- o->value.b = THUMB_MIPMAP_DEFAULT;
- o->group = N_("Settings");
- o->subGroup = "";
- o->advanced = TRUE;
- o->displayHints = "";
+ o->name = "mipmap";
+ o->shortDesc = N_("Generate Mipmaps");
+ o->longDesc = N_("Generate mipmaps when possible for higher quality "
+ "scaling");
+ o->type = CompOptionTypeBool;
+ o->value.b = THUMB_MIPMAP_DEFAULT;
+ o->group = N_("Settings");
+ o->subGroup = "";
+ o->advanced = TRUE;
+ o->displayHints = "";
}
-static CompOption *
-thumbGetScreenOptions (CompScreen *screen,
- int *count)
+static CompOption *thumbGetScreenOptions(CompScreen * screen, int *count)
{
if (screen)
{
- THUMB_SCREEN (screen);
+ THUMB_SCREEN(screen);
- *count = NUM_OPTIONS (ts);
+ *count = NUM_OPTIONS(ts);
return ts->opt;
}
else
{
- ThumbScreen * ts = malloc(sizeof(ThumbScreen));
+ ThumbScreen *ts = malloc(sizeof(ThumbScreen));
+
thumbScreenInitOptions(ts);
- *count = NUM_OPTIONS (ts);
+ *count = NUM_OPTIONS(ts);
return ts->opt;
}
}
static Bool
-thumbSetScreenOption (CompScreen *screen,
- char *name,
- CompOptionValue *value)
+thumbSetScreenOption(CompScreen * screen, char *name, CompOptionValue * value)
{
- CompOption *o;
- int index;
+ CompOption *o;
+ int index;
- THUMB_SCREEN (screen);
+ THUMB_SCREEN(screen);
- o = compFindOption (ts->opt, NUM_OPTIONS (ts), name, &index);
- if (!o)
- return FALSE;
+ o = compFindOption(ts->opt, NUM_OPTIONS(ts), name, &index);
+ if (!o)
+ return FALSE;
- switch (index)
- {
- case THUMB_SCREEN_OPTION_SIZE:
- case THUMB_SCREEN_OPTION_DELAY:
- case THUMB_SCREEN_OPTION_BORDER:
- if (compSetIntOption (o, value))
- {
- return TRUE;
- }
- break;
- case THUMB_SCREEN_OPTION_COLOR:
- if (compSetColorOption(o, value))
- {
- return TRUE;
- }
- break;
- case THUMB_SCREEN_OPTION_FADE:
- if (compSetFloatOption(o, value))
- {
- return TRUE;
- }
- break;
- case THUMB_SCREEN_OPTION_ALWAYS_TOP:
- case THUMB_SCREEN_OPTION_CURRENT_VIEWPORT:
- case THUMB_SCREEN_OPTION_WINDOW_LIKE:
- case THUMB_SCREEN_OPTION_MIPMAP:
- if (compSetBoolOption(o, value))
- {
- return TRUE;
- }
- default:
- break;
- }
+ switch (index)
+ {
+ case THUMB_SCREEN_OPTION_SIZE:
+ case THUMB_SCREEN_OPTION_DELAY:
+ case THUMB_SCREEN_OPTION_BORDER:
+ if (compSetIntOption(o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case THUMB_SCREEN_OPTION_COLOR:
+ if (compSetColorOption(o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case THUMB_SCREEN_OPTION_FADE:
+ if (compSetFloatOption(o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case THUMB_SCREEN_OPTION_ALWAYS_TOP:
+ case THUMB_SCREEN_OPTION_CURRENT_VIEWPORT:
+ case THUMB_SCREEN_OPTION_WINDOW_LIKE:
+ case THUMB_SCREEN_OPTION_MIPMAP:
+ if (compSetBoolOption(o, value))
+ {
+ return TRUE;
+ }
+ default:
+ break;
+ }
- return FALSE;
+ return FALSE;
}
-static void
-thumbHandleEvent (CompDisplay *d,
- XEvent *event)
+static void thumbHandleEvent(CompDisplay * d, XEvent * event)
{
- THUMB_DISPLAY (d);
+ THUMB_DISPLAY(d);
- UNWRAP (td, d, handleEvent);
- (*d->handleEvent) (d, event);
- WRAP (td, d, handleEvent, thumbHandleEvent);
+ UNWRAP(td, d, handleEvent);
+ (*d->handleEvent) (d, event);
+ WRAP(td, d, handleEvent, thumbHandleEvent);
CompWindow *w;
- switch (event->type)
+ switch (event->type)
{
- case PropertyNotify:
- if (event->xproperty.atom == td->winIconGeometryAtom)
+ case PropertyNotify:
+ if (event->xproperty.atom == td->winIconGeometryAtom)
+ {
+ w = findWindowAtDisplay(d, event->xproperty.window);
+ if (w)
{
- w = findWindowAtDisplay(d, event->xproperty.window);
- if (w)
- {
- updateWindowIconGeometry(w);
- }
+ updateWindowIconGeometry(w);
}
- break;
- case ButtonPress:
- {
- CompScreen *s = findScreenAtDisplay (d, event->xbutton.root);
- if (!s)
- break;
+ }
+ break;
+ case ButtonPress:
+ {
+ CompScreen *s = findScreenAtDisplay(d, event->xbutton.root);
- THUMB_SCREEN(s);
- ts->dock = NULL;
- if (ts->displayTimeout)
- {
- compRemoveTimeout(ts->displayTimeout);
- ts->displayTimeout = 0;
- }
- ts->pointedWin = 0;
- ts->showingThumb = FALSE;
- }
- break;
- default:
+ if (!s)
break;
+
+ THUMB_SCREEN(s);
+ ts->dock = NULL;
+ if (ts->displayTimeout)
+ {
+ compRemoveTimeout(ts->displayTimeout);
+ ts->displayTimeout = 0;
+ }
+ ts->pointedWin = 0;
+ ts->showingThumb = FALSE;
+ }
+ break;
+ default:
+ break;
}
}
-static void
-thumbPaintThumb(CompScreen *s,Thumbnail *t)
+static void thumbPaintThumb(CompScreen * s, Thumbnail * t)
{
THUMB_SCREEN(s);
DrawWindowGeometryProc oldDrawWindowGeometry;
@@ -789,103 +794,104 @@ thumbPaintThumb(CompScreen *s,Thumbnail *t)
int off = t->offset;
glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
if (ts->opt[THUMB_SCREEN_OPTION_WINDOW_LIKE].value.b)
{
- glColor4f(1.0,1.0,1.0,t->opacity);
+ glColor4f(1.0, 1.0, 1.0, t->opacity);
enableTexture(s, &ts->windowTexture, COMP_TEXTURE_FILTER_GOOD);
}
else
{
glColor4us(ts->opt[THUMB_SCREEN_OPTION_COLOR].value.c[0],
- ts->opt[THUMB_SCREEN_OPTION_COLOR].value.c[1],
- ts->opt[THUMB_SCREEN_OPTION_COLOR].value.c[2],
- ts->opt[THUMB_SCREEN_OPTION_COLOR].value.c[3] * t->opacity);
+ ts->opt[THUMB_SCREEN_OPTION_COLOR].value.c[1],
+ ts->opt[THUMB_SCREEN_OPTION_COLOR].value.c[2],
+ ts->opt[THUMB_SCREEN_OPTION_COLOR].value.c[3] *
+ t->opacity);
enableTexture(s, &ts->glowTexture, COMP_TEXTURE_FILTER_GOOD);
}
glBegin(GL_QUADS);
- glTexCoord2f(1,0);
- glVertex2f(wx,wy);
- glVertex2f(wx,wy+height);
- glVertex2f(wx+width,wy+height);
- glVertex2f(wx+width,wy);
-
- glTexCoord2f(0,1);
- glVertex2f(wx-off,wy-off);
- glTexCoord2f(0,0);
- glVertex2f(wx-off,wy);
- glTexCoord2f(1,0);
- glVertex2f(wx,wy);
- glTexCoord2f(1,1);
- glVertex2f(wx,wy-off);
-
- glTexCoord2f(1,1);
- glVertex2f(wx+width,wy-off);
- glTexCoord2f(1,0);
- glVertex2f(wx+width,wy);
- glTexCoord2f(0,0);
- glVertex2f(wx+width+off,wy);
- glTexCoord2f(0,1);
- glVertex2f(wx+width+off,wy-off);
-
- glTexCoord2f(0,0);
- glVertex2f(wx-off,wy+height);
- glTexCoord2f(0,1);
- glVertex2f(wx-off,wy+height+off);
- glTexCoord2f(1,1);
- glVertex2f(wx,wy+height+off);
- glTexCoord2f(1,0);
- glVertex2f(wx,wy+height);
-
- glTexCoord2f(1,0);
- glVertex2f(wx+width,wy+height);
- glTexCoord2f(1,1);
- glVertex2f(wx+width,wy+height+off);
- glTexCoord2f(0,1);
- glVertex2f(wx+width+off,wy+height+off);
- glTexCoord2f(0,0);
- glVertex2f(wx+width+off,wy+height);
-
- glTexCoord2f(1,1);
- glVertex2f(wx,wy-off);
- glTexCoord2f(1,0);
- glVertex2f(wx,wy);
- glTexCoord2f(1,0);
- glVertex2f(wx+width,wy);
- glTexCoord2f(1,1);
- glVertex2f(wx+width,wy-off);
-
- glTexCoord2f(1,0);
- glVertex2f(wx,wy+height);
- glTexCoord2f(1,1);
- glVertex2f(wx,wy+height+off);
- glTexCoord2f(1,1);
- glVertex2f(wx+width,wy+height+off);
- glTexCoord2f(1,0);
- glVertex2f(wx+width,wy+height);
-
- glTexCoord2f(0,0);
- glVertex2f(wx-off,wy);
- glTexCoord2f(0,0);
- glVertex2f(wx-off,wy+height);
- glTexCoord2f(1,0);
- glVertex2f(wx,wy+height);
- glTexCoord2f(1,0);
- glVertex2f(wx,wy);
-
- glTexCoord2f(1,0);
- glVertex2f(wx+width,wy);
- glTexCoord2f(1,0);
- glVertex2f(wx+width,wy+height);
- glTexCoord2f(0,0);
- glVertex2f(wx+width+off,wy+height);
- glTexCoord2f(0,0);
- glVertex2f(wx+width+off,wy);
+ glTexCoord2f(1, 0);
+ glVertex2f(wx, wy);
+ glVertex2f(wx, wy + height);
+ glVertex2f(wx + width, wy + height);
+ glVertex2f(wx + width, wy);
+
+ glTexCoord2f(0, 1);
+ glVertex2f(wx - off, wy - off);
+ glTexCoord2f(0, 0);
+ glVertex2f(wx - off, wy);
+ glTexCoord2f(1, 0);
+ glVertex2f(wx, wy);
+ glTexCoord2f(1, 1);
+ glVertex2f(wx, wy - off);
+
+ glTexCoord2f(1, 1);
+ glVertex2f(wx + width, wy - off);
+ glTexCoord2f(1, 0);
+ glVertex2f(wx + width, wy);
+ glTexCoord2f(0, 0);
+ glVertex2f(wx + width + off, wy);
+ glTexCoord2f(0, 1);
+ glVertex2f(wx + width + off, wy - off);
+
+ glTexCoord2f(0, 0);
+ glVertex2f(wx - off, wy + height);
+ glTexCoord2f(0, 1);
+ glVertex2f(wx - off, wy + height + off);
+ glTexCoord2f(1, 1);
+ glVertex2f(wx, wy + height + off);
+ glTexCoord2f(1, 0);
+ glVertex2f(wx, wy + height);
+
+ glTexCoord2f(1, 0);
+ glVertex2f(wx + width, wy + height);
+ glTexCoord2f(1, 1);
+ glVertex2f(wx + width, wy + height + off);
+ glTexCoord2f(0, 1);
+ glVertex2f(wx + width + off, wy + height + off);
+ glTexCoord2f(0, 0);
+ glVertex2f(wx + width + off, wy + height);
+
+ glTexCoord2f(1, 1);
+ glVertex2f(wx, wy - off);
+ glTexCoord2f(1, 0);
+ glVertex2f(wx, wy);
+ glTexCoord2f(1, 0);
+ glVertex2f(wx + width, wy);
+ glTexCoord2f(1, 1);
+ glVertex2f(wx + width, wy - off);
+
+ glTexCoord2f(1, 0);
+ glVertex2f(wx, wy + height);
+ glTexCoord2f(1, 1);
+ glVertex2f(wx, wy + height + off);
+ glTexCoord2f(1, 1);
+ glVertex2f(wx + width, wy + height + off);
+ glTexCoord2f(1, 0);
+ glVertex2f(wx + width, wy + height);
+
+ glTexCoord2f(0, 0);
+ glVertex2f(wx - off, wy);
+ glTexCoord2f(0, 0);
+ glVertex2f(wx - off, wy + height);
+ glTexCoord2f(1, 0);
+ glVertex2f(wx, wy + height);
+ glTexCoord2f(1, 0);
+ glVertex2f(wx, wy);
+
+ glTexCoord2f(1, 0);
+ glVertex2f(wx + width, wy);
+ glTexCoord2f(1, 0);
+ glVertex2f(wx + width, wy + height);
+ glTexCoord2f(0, 0);
+ glVertex2f(wx + width + off, wy + height);
+ glTexCoord2f(0, 0);
+ glVertex2f(wx + width + off, wy);
glEnd();
@@ -899,8 +905,8 @@ thumbPaintThumb(CompScreen *s,Thumbnail *t)
}
glDisable(GL_BLEND);
- glBlendFunc(GL_ONE,GL_ONE_MINUS_SRC_ALPHA);
- screenTexEnvMode (s,GL_REPLACE);
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ screenTexEnvMode(s, GL_REPLACE);
glColor4usv(defaultColor);
@@ -931,6 +937,7 @@ static void thumbPreparePaintScreen(CompScreen * s, int ms)
THUMB_SCREEN(s);
float val = ms;
+
val /= 1000;
val /= ts->opt[THUMB_SCREEN_OPTION_FADE].value.f;
@@ -948,16 +955,16 @@ static void thumbPreparePaintScreen(CompScreen * s, int ms)
if (ts->showingThumb && ts->thumb.win == ts->pointedWin)
{
- ts->thumb.opacity = MIN(1.0,ts->thumb.opacity + val);
+ ts->thumb.opacity = MIN(1.0, ts->thumb.opacity + val);
}
if (!ts->showingThumb || ts->thumb.win != ts->pointedWin)
{
- ts->thumb.opacity = MAX(0.0,ts->thumb.opacity - val);
+ ts->thumb.opacity = MAX(0.0, ts->thumb.opacity - val);
}
- ts->oldThumb.opacity = MAX(0.0,ts->oldThumb.opacity - val);
+ ts->oldThumb.opacity = MAX(0.0, ts->oldThumb.opacity - val);
UNWRAP(ts, s, preparePaintScreen);
- (*s->preparePaintScreen) (s,ms);
+ (*s->preparePaintScreen) (s, ms);
WRAP(ts, s, preparePaintScreen, thumbPreparePaintScreen);
}
@@ -966,9 +973,9 @@ static void thumbDonePaintScreen(CompScreen * s)
THUMB_SCREEN(s);
if (ts->thumb.opacity > 0.0 && ts->thumb.opacity < 1.0)
- damageThumbRegion(s,&ts->thumb);
+ damageThumbRegion(s, &ts->thumb);
if (ts->oldThumb.opacity > 0.0 && ts->oldThumb.opacity < 1.0)
- damageThumbRegion(s,&ts->oldThumb);
+ damageThumbRegion(s, &ts->oldThumb);
UNWRAP(ts, s, donePaintScreen);
(*s->donePaintScreen) (s);
@@ -976,15 +983,13 @@ static void thumbDonePaintScreen(CompScreen * s)
}
static Bool
-thumbPaintScreen (CompScreen *s,
- const ScreenPaintAttrib *sAttrib,
- Region region,
- int output,
- unsigned int mask)
+thumbPaintScreen(CompScreen * s,
+ const ScreenPaintAttrib * sAttrib,
+ Region region, int output, unsigned int mask)
{
- Bool status;
+ Bool status;
- THUMB_SCREEN (s);
+ THUMB_SCREEN(s);
unsigned int newMask = mask;
@@ -992,123 +997,115 @@ thumbPaintScreen (CompScreen *s,
(ts->thumb.opacity > 0.0 && ts->thumb.win))
newMask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
- UNWRAP (ts, s, paintScreen);
+ UNWRAP(ts, s, paintScreen);
status = (*s->paintScreen) (s, sAttrib, region, output, newMask);
- WRAP (ts, s, paintScreen, thumbPaintScreen);
+ WRAP(ts, s, paintScreen, thumbPaintScreen);
if (ts->opt[THUMB_SCREEN_OPTION_ALWAYS_TOP].value.b)
{
if (ts->oldThumb.opacity > 0.0 && ts->oldThumb.win)
{
glPushMatrix();
- prepareXCoords(s, output,-DEFAULT_Z_CAMERA);
- thumbPaintThumb(s,&ts->oldThumb);
+ prepareXCoords(s, output, -DEFAULT_Z_CAMERA);
+ thumbPaintThumb(s, &ts->oldThumb);
glPopMatrix();
}
if (ts->thumb.opacity > 0.0 && ts->thumb.win)
{
glPushMatrix();
- prepareXCoords(s, output,-DEFAULT_Z_CAMERA);
- thumbPaintThumb(s,&ts->thumb);
+ prepareXCoords(s, output, -DEFAULT_Z_CAMERA);
+ thumbPaintThumb(s, &ts->thumb);
glPopMatrix();
}
}
- return status;
+ return status;
}
static Bool
-thumbPaintWindow (CompWindow *w,
- const WindowPaintAttrib *attrib,
- Region region,
- unsigned int mask)
+thumbPaintWindow(CompWindow * w,
+ const WindowPaintAttrib * attrib,
+ Region region, unsigned int mask)
{
- CompScreen *s = w->screen;
- Bool status;
+ CompScreen *s = w->screen;
+ Bool status;
- THUMB_SCREEN (s);
+ THUMB_SCREEN(s);
- UNWRAP (ts, s, paintWindow);
+ UNWRAP(ts, s, paintWindow);
status = (*s->paintWindow) (w, attrib, region, mask);
- WRAP (ts, s, paintWindow, thumbPaintWindow);
+ WRAP(ts, s, paintWindow, thumbPaintWindow);
if (!ts->opt[THUMB_SCREEN_OPTION_ALWAYS_TOP].value.b)
{
if (ts->oldThumb.opacity > 0.0 && ts->oldThumb.win &&
ts->oldThumb.dock == w)
{
- thumbPaintThumb(s,&ts->oldThumb);
+ thumbPaintThumb(s, &ts->oldThumb);
}
if (ts->thumb.opacity > 0.0 && ts->thumb.win && ts->thumb.dock == w)
{
- thumbPaintThumb(s,&ts->thumb);
+ thumbPaintThumb(s, &ts->thumb);
}
}
- return status;
+ return status;
}
-static Bool
-thumbDamageWindowRect (CompWindow *w,
- Bool initial,
- BoxPtr rect)
+static Bool thumbDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
{
- Bool status;
+ Bool status;
- THUMB_SCREEN (w->screen);
+ THUMB_SCREEN(w->screen);
if (ts->thumb.win == w && ts->thumb.opacity > 0.0)
- damageThumbRegion(w->screen,&ts->thumb);
+ damageThumbRegion(w->screen, &ts->thumb);
if (ts->oldThumb.win == w && ts->oldThumb.opacity > 0.0)
- damageThumbRegion(w->screen,&ts->oldThumb);
+ damageThumbRegion(w->screen, &ts->oldThumb);
- UNWRAP (ts, w->screen, damageWindowRect);
- status = (*w->screen->damageWindowRect) (w, initial, rect);
- WRAP (ts, w->screen, damageWindowRect, thumbDamageWindowRect);
+ UNWRAP(ts, w->screen, damageWindowRect);
+ status = (*w->screen->damageWindowRect) (w, initial, rect);
+ WRAP(ts, w->screen, damageWindowRect, thumbDamageWindowRect);
- return status;
+ return status;
}
-static Bool
-thumbInitDisplay (CompPlugin *p,
- CompDisplay *d)
+static Bool thumbInitDisplay(CompPlugin * p, CompDisplay * d)
{
- ThumbDisplay *td;
+ ThumbDisplay *td;
- td = malloc (sizeof (ThumbDisplay));
- if (!td)
+ td = malloc(sizeof(ThumbDisplay));
+ if (!td)
return FALSE;
- td->screenPrivateIndex = allocateScreenPrivateIndex (d);
- if (td->screenPrivateIndex < 0)
- {
- free (td);
+ td->screenPrivateIndex = allocateScreenPrivateIndex(d);
+ if (td->screenPrivateIndex < 0)
+ {
+ free(td);
return FALSE;
- }
+ }
- td->winIconGeometryAtom = XInternAtom (d->display,
- "_NET_WM_ICON_GEOMETRY", FALSE);
+ td->winIconGeometryAtom = XInternAtom(d->display,
+ "_NET_WM_ICON_GEOMETRY", FALSE);
- WRAP (td, d, handleEvent, thumbHandleEvent);
+ WRAP(td, d, handleEvent, thumbHandleEvent);
- d->privates[displayPrivateIndex].ptr = td;
+ d->privates[displayPrivateIndex].ptr = td;
- return TRUE;
+ return TRUE;
}
-static void
-thumbFiniDisplay (CompPlugin *p,
- CompDisplay *d)
+static void thumbFiniDisplay(CompPlugin * p, CompDisplay * d)
{
- THUMB_DISPLAY (d);
+ THUMB_DISPLAY(d);
- freeScreenPrivateIndex (d, td->screenPrivateIndex);
+ freeScreenPrivateIndex(d, td->screenPrivateIndex);
- UNWRAP (td, d, handleEvent);
+ UNWRAP(td, d, handleEvent);
- free (td);
+ free(td);
}
static Bool thumbInitWindow(CompPlugin * p, CompWindow * w)
@@ -1136,14 +1133,14 @@ static void thumbFiniWindow(CompPlugin * p, CompWindow * w)
if (ts->thumb.win == w)
{
- damageThumbRegion(w->screen,&ts->thumb);
+ damageThumbRegion(w->screen, &ts->thumb);
ts->thumb.win = NULL;
ts->thumb.opacity = 0;
}
if (ts->oldThumb.win == w)
{
- damageThumbRegion(w->screen,&ts->oldThumb);
+ damageThumbRegion(w->screen, &ts->oldThumb);
ts->oldThumb.win = NULL;
ts->oldThumb.opacity = 0;
}
@@ -1154,27 +1151,25 @@ static void thumbFiniWindow(CompPlugin * p, CompWindow * w)
}
-static Bool
-thumbInitScreen (CompPlugin *p,
- CompScreen *s)
+static Bool thumbInitScreen(CompPlugin * p, CompScreen * s)
{
- ThumbScreen *ts;
+ ThumbScreen *ts;
- THUMB_DISPLAY (s->display);
+ THUMB_DISPLAY(s->display);
- ts = calloc (1,sizeof (ThumbScreen));
- if (!ts)
+ ts = calloc(1, sizeof(ThumbScreen));
+ if (!ts)
return FALSE;
ts->windowPrivateIndex = allocateWindowPrivateIndex(s);
- thumbScreenInitOptions (ts);
+ thumbScreenInitOptions(ts);
- WRAP (ts, s, paintScreen, thumbPaintScreen);
- WRAP (ts, s, damageWindowRect, thumbDamageWindowRect);
- WRAP (ts, s, preparePaintScreen, thumbPreparePaintScreen);
- WRAP (ts, s, donePaintScreen, thumbDonePaintScreen);
- WRAP (ts, s, paintWindow, thumbPaintWindow);
+ WRAP(ts, s, paintScreen, thumbPaintScreen);
+ WRAP(ts, s, damageWindowRect, thumbDamageWindowRect);
+ WRAP(ts, s, preparePaintScreen, thumbPreparePaintScreen);
+ WRAP(ts, s, donePaintScreen, thumbDonePaintScreen);
+ WRAP(ts, s, paintWindow, thumbPaintWindow);
ts->dock = NULL;
ts->pointedWin = NULL;
@@ -1183,82 +1178,78 @@ thumbInitScreen (CompPlugin *p,
ts->oldThumb.win = NULL;
ts->showingThumb = FALSE;
- s->privates[td->screenPrivateIndex].ptr = ts;
+ s->privates[td->screenPrivateIndex].ptr = ts;
ts->mouseTimeout =
- compAddTimeout(THUMB_MOUSE_UPDATE_SPEED, thumbUpdateMouse, s);
+ compAddTimeout(THUMB_MOUSE_UPDATE_SPEED, thumbUpdateMouse, s);
- initTexture (s, &ts->glowTexture);
- initTexture (s, &ts->windowTexture);
+ initTexture(s, &ts->glowTexture);
+ initTexture(s, &ts->windowTexture);
- imageToTexture (s, &ts->glowTexture,glowTex,32,32);
- imageToTexture (s, &ts->windowTexture,windowTex,32,32);
+ imageToTexture(s, &ts->glowTexture, glowTex, 32, 32);
+ imageToTexture(s, &ts->windowTexture, windowTex, 32, 32);
- return TRUE;
+ return TRUE;
}
-static void
-thumbFiniScreen (CompPlugin *p,
- CompScreen *s)
+static void thumbFiniScreen(CompPlugin * p, CompScreen * s)
{
- THUMB_SCREEN (s);
+ THUMB_SCREEN(s);
- UNWRAP (ts, s, paintScreen);
- UNWRAP (ts, s, damageWindowRect);
- UNWRAP (ts, s, preparePaintScreen);
- UNWRAP (ts, s, donePaintScreen);
- UNWRAP (ts, s, paintWindow);
+ UNWRAP(ts, s, paintScreen);
+ UNWRAP(ts, s, damageWindowRect);
+ UNWRAP(ts, s, preparePaintScreen);
+ UNWRAP(ts, s, donePaintScreen);
+ UNWRAP(ts, s, paintWindow);
if (ts->mouseTimeout)
- compRemoveTimeout (ts->mouseTimeout);
+ compRemoveTimeout(ts->mouseTimeout);
- finiTexture (s, &ts->glowTexture);
- finiTexture (s, &ts->windowTexture);
+ finiTexture(s, &ts->glowTexture);
+ finiTexture(s, &ts->windowTexture);
- free (ts);
+ free(ts);
}
-static Bool
-thumbInit (CompPlugin *p)
+static Bool thumbInit(CompPlugin * p)
{
- displayPrivateIndex = allocateDisplayPrivateIndex ();
- if (displayPrivateIndex < 0)
+ displayPrivateIndex = allocateDisplayPrivateIndex();
+ if (displayPrivateIndex < 0)
return FALSE;
- return TRUE;
+ return TRUE;
}
-static void
-thumbFini (CompPlugin *p)
+static void thumbFini(CompPlugin * p)
{
- if (displayPrivateIndex >= 0)
- freeDisplayPrivateIndex (displayPrivateIndex);
+ if (displayPrivateIndex >= 0)
+ freeDisplayPrivateIndex(displayPrivateIndex);
}
CompPluginVTable thumbVTable = {
- "thumbnail",
- N_("Window thumbnails"),
- N_("Window thumbnails at the taskbar"),
- thumbInit,
- thumbFini,
- thumbInitDisplay,
- thumbFiniDisplay,
- thumbInitScreen,
- thumbFiniScreen,
- thumbInitWindow,
- thumbFiniWindow,
- 0, /* thumbGetDisplayOptions */
- 0, /* thumbSetDisplayOption */
- thumbGetScreenOptions,
- thumbSetScreenOption,
- 0, /* Deps */
- 0, /* nDeps */
- 0, /* Features */
- 0, /* nFeatures */
+ "thumbnail",
+ N_("Window thumbnails"),
+ N_("Window thumbnails at the taskbar"),
+ thumbInit,
+ thumbFini,
+ thumbInitDisplay,
+ thumbFiniDisplay,
+ thumbInitScreen,
+ thumbFiniScreen,
+ thumbInitWindow,
+ thumbFiniWindow,
+ 0, /* thumbGetDisplayOptions */
+ 0, /* thumbSetDisplayOption */
+ thumbGetScreenOptions,
+ thumbSetScreenOption,
+ 0, /* Deps */
+ 0, /* nDeps */
+ 0, /* Features */
+ 0, /* nFeatures */
BERYL_ABI_INFO,
"thumbnail",
"misc",
@@ -1268,9 +1259,7 @@ CompPluginVTable thumbVTable = {
};
-CompPluginVTable *
-getCompPluginInfo (void)
+CompPluginVTable *getCompPluginInfo(void)
{
- return &thumbVTable;
+ return &thumbVTable;
}
-
diff --git a/beryl-plugins/src/trailfocus2.c b/beryl-plugins/src/trailfocus2.c
index 9c551ea..86b008b 100644
--- a/beryl-plugins/src/trailfocus2.c
+++ b/beryl-plugins/src/trailfocus2.c
@@ -100,7 +100,7 @@ static Bool is_trailfocus_window(TrailfocusScreen * ts, CompWindow * w)
{
if (!(w->type & ts->wMask))
return False;
- if (w->defaultPaintLock.opacity && w->defaultPaintLock.saturation
+ if (w->defaultPaintLock.opacity && w->defaultPaintLock.saturation
&& w->defaultPaintLock.brightness)
return False;
@@ -290,6 +290,7 @@ static void trailfocusHandleEvent(CompDisplay * d, XEvent * event)
{
TRAILFOCUS_DISPLAY(d);
CompScreen *s;
+
switch (event->type)
{
case FocusIn:
@@ -300,7 +301,7 @@ static void trailfocusHandleEvent(CompDisplay * d, XEvent * event)
default:
break;
}
-
+
UNWRAP(td, d, handleEvent);
(*d->handleEvent) (d, event);
@@ -315,11 +316,14 @@ static void recalculate_attributes(TrailfocusScreen * ts)
TfAttrib tmp, min, max;
int i;
int start;
+
start = ts->opt[SOPT_WINDOWS_START].value.i - 1;
ts->win_max = ts->opt[SOPT_WINDOWS].value.i;
- if (start >= ts->win_max) {
- fprintf(stderr, "trailfocus: WARNING: Attempting to define start higher than max windows.\n");
- start = ts->win_max-1;
+ if (start >= ts->win_max)
+ {
+ fprintf(stderr,
+ "trailfocus: WARNING: Attempting to define start higher than max windows.\n");
+ start = ts->win_max - 1;
}
min.opacity = ts->opt[SOPT_MIN_OPACITY].value.i * OPAQUE / 100;
@@ -333,19 +337,21 @@ static void recalculate_attributes(TrailfocusScreen * ts)
ts->inc = realloc(ts->inc, sizeof(TfAttrib) * (ts->win_max + 1));
tmp.opacity = (max.opacity - min.opacity) / ((ts->win_max - start));
- tmp.brightness = (max.brightness - min.brightness) / ((ts->win_max - start));
- tmp.saturation = (max.saturation - min.saturation) / ((ts->win_max - start));
+ tmp.brightness =
+ (max.brightness - min.brightness) / ((ts->win_max - start));
+ tmp.saturation =
+ (max.saturation - min.saturation) / ((ts->win_max - start));
for (i = 0; i < start; ++i)
ts->inc[i] = max;
- for (i = 0; i+start <= ts->win_max; i++)
+ for (i = 0; i + start <= ts->win_max; i++)
{
- ts->inc[i+start].opacity = max.opacity - (tmp.opacity * i);
- ts->inc[i+start].brightness = max.brightness - (tmp.brightness * i);
- ts->inc[i+start].saturation = max.saturation - (tmp.saturation * i);
- ts->win[i+start] = 0;
+ ts->inc[i + start].opacity = max.opacity - (tmp.opacity * i);
+ ts->inc[i + start].brightness = max.brightness - (tmp.brightness * i);
+ ts->inc[i + start].saturation = max.saturation - (tmp.saturation * i);
+ ts->win[i + start] = 0;
}
-// ts->inc[i+start] = min;
+// ts->inc[i+start] = min;
}
/* Unlike the traditional setScreenOptions, we return on failure in the
diff --git a/beryl-plugins/src/wobbly.c b/beryl-plugins/src/wobbly.c
index 398f20b..8bd7375 100644
--- a/beryl-plugins/src/wobbly.c
+++ b/beryl-plugins/src/wobbly.c
@@ -979,7 +979,7 @@ static void findNextWestEdge(CompWindow * w, Object * object)
x = object->position.x + w->output.left - w->input.left;
- output = outputDeviceForPoint (w->screen, x, object->position.y);
+ output = outputDeviceForPoint(w->screen, x, object->position.y);
if (x >= w->screen->outputDev[output].region.extents.x1)
{
@@ -996,13 +996,13 @@ static void findNextWestEdge(CompWindow * w, Object * object)
{
s = p->struts->left.y - w->output.top;
e = p->struts->left.y + p->struts->left.height +
- w->output.bottom;
+ w->output.bottom;
}
else if (!p->invisible && (p->type & SNAP_WINDOW_TYPE))
{
s = p->attrib.y - p->output.top - w->output.top;
e = p->attrib.y + p->height + p->output.bottom +
- w->output.bottom;
+ w->output.bottom;
}
else
continue;
@@ -1082,7 +1082,7 @@ static void findNextEastEdge(CompWindow * w, Object * object)
x = object->position.x - w->output.right + w->input.right;
- output = outputDeviceForPoint (w->screen, x, object->position.y);
+ output = outputDeviceForPoint(w->screen, x, object->position.y);
if (x <= w->screen->outputDev[output].region.extents.x2)
{
@@ -1099,13 +1099,13 @@ static void findNextEastEdge(CompWindow * w, Object * object)
{
s = p->struts->right.y - w->output.top;
e = p->struts->right.y + p->struts->right.height +
- w->output.bottom;
+ w->output.bottom;
}
else if (!p->invisible && (p->type & SNAP_WINDOW_TYPE))
{
s = p->attrib.y - p->output.top - w->output.top;
e = p->attrib.y + p->height + p->output.bottom +
- w->output.bottom;
+ w->output.bottom;
}
else
continue;
@@ -1185,7 +1185,7 @@ static void findNextNorthEdge(CompWindow * w, Object * object)
y = object->position.y + w->output.top - w->input.top;
- output = outputDeviceForPoint (w->screen, object->position.x, y);
+ output = outputDeviceForPoint(w->screen, object->position.x, y);
if (y >= w->screen->outputDev[output].region.extents.y1)
{
@@ -1201,14 +1201,13 @@ static void findNextNorthEdge(CompWindow * w, Object * object)
if (p->mapNum && p->struts)
{
s = p->struts->top.x - w->output.left;
- e = p->struts->top.x + p->struts->top.width +
- w->output.right;
- }
+ e = p->struts->top.x + p->struts->top.width + w->output.right;
+ }
else if (!p->invisible && (p->type & SNAP_WINDOW_TYPE))
{
s = p->attrib.x - p->output.left - w->output.left;
e = p->attrib.x + p->width + p->output.right +
- w->output.right;
+ w->output.right;
}
else
continue;
@@ -1234,7 +1233,7 @@ static void findNextNorthEdge(CompWindow * w, Object * object)
if (p->mapNum && p->struts)
v = p->struts->top.y + p->struts->top.height;
else
- v = p->attrib.y + p->height + p->input.bottom;
+ v = p->attrib.y + p->height + p->input.bottom;
if (v <= y)
{
@@ -1288,7 +1287,7 @@ static void findNextSouthEdge(CompWindow * w, Object * object)
y = object->position.y - w->output.bottom + w->input.bottom;
- output = outputDeviceForPoint (w->screen, object->position.x, y);
+ output = outputDeviceForPoint(w->screen, object->position.x, y);
if (y <= w->screen->outputDev[output].region.extents.y2)
{
@@ -1304,14 +1303,14 @@ static void findNextSouthEdge(CompWindow * w, Object * object)
if (p->mapNum && p->struts)
{
s = p->struts->bottom.x - w->output.left;
- e = p->struts->bottom.x + p->struts->bottom.width +
- w->output.right;
- }
+ e = p->struts->bottom.x + p->struts->bottom.width +
+ w->output.right;
+ }
else if (!p->invisible && (p->type & SNAP_WINDOW_TYPE))
{
s = p->attrib.x - p->output.left - w->output.left;
e = p->attrib.x + p->width + p->output.right +
- w->output.right;
+ w->output.right;
}
else
continue;
@@ -2266,14 +2265,14 @@ static void wobblyPreparePaintScreen(CompScreen * s, int msSinceLastPaint)
ww->model = NULL;
if (w->attrib.x == w->serverX &&
- w->attrib.y == w->serverY)
+ w->attrib.y == w->serverY)
{
- moveWindow (w,
- model->topLeft.x + w->output.left -
- w->attrib.x,
- model->topLeft.y + w->output.top -
- w->attrib.y, TRUE, TRUE);
- syncWindowPosition (w);
+ moveWindow(w,
+ model->topLeft.x + w->output.left -
+ w->attrib.x,
+ model->topLeft.y + w->output.top -
+ w->attrib.y, TRUE, TRUE);
+ syncWindowPosition(w);
}
ww->model = model;
@@ -3008,7 +3007,8 @@ static Bool wobblyDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
return status;
}
-static void wobblyWindowResizeNotify(CompWindow * w, int dx, int dy, int dwidth, int dheight)
+static void wobblyWindowResizeNotify(CompWindow * w, int dx, int dy,
+ int dwidth, int dheight)
{
WOBBLY_SCREEN(w->screen);
WOBBLY_WINDOW(w);
@@ -3027,7 +3027,7 @@ static void wobblyWindowResizeNotify(CompWindow * w, int dx, int dy, int dwidth,
ww->model->anchorObject->immobile = FALSE;
ww->model->anchorObject = NULL;
}
-
+
modelAddEdgeAnchors(ww->model,
WIN_X(w), WIN_Y(w), WIN_W(w), WIN_H(w));
}
@@ -3050,7 +3050,7 @@ static void wobblyWindowResizeNotify(CompWindow * w, int dx, int dy, int dwidth,
ww->wobbly |= WobblyInitial;
ws->wobblyWindows |= ww->wobbly;
-
+
damagePendingOnScreen(w->screen);
}
}
@@ -3070,7 +3070,10 @@ static void wobblyWindowResizeNotify(CompWindow * w, int dx, int dy, int dwidth,
ww->model->anchorObject->immobile = FALSE;
ww->model->anchorObject = modelFindNearestObject(ww->model,
- w->screen->display->pointerX, w->screen->display->pointerY);
+ w->screen->display->
+ pointerX,
+ w->screen->display->
+ pointerY);
ww->model->anchorObject->immobile = TRUE;
@@ -3140,7 +3143,7 @@ wobblyWindowGrabNotify(CompWindow * w,
WOBBLY_SCREEN(w->screen);
WOBBLY_DISPLAY(w->screen->display);
- if (!ws->grabWindow)
+ if (!ws->grabWindow)
{
ws->grabMask = mask;
ws->grabWindow = w;
@@ -3616,7 +3619,8 @@ static void wobblyFini(CompPlugin * p)
}
CompPluginDep wobblyDeps[] = {
- {CompPluginRuleAfter, "decoration"},
+ {CompPluginRuleAfter, "decoration"}
+ ,
};
CompPluginFeature wobblyFeatures[] = {