summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Lyngstol <kristian@bohemians.org>2007-12-24 02:25:09 +0100
committerKristian Lyngstol <kristian@windu.lyngstol.net>2007-12-24 02:25:09 +0100
commite0de5f1d1babd70b402ff58e9b5a21e0a663f7e3 (patch)
tree894cb2563038487304b3ba95c717eb25d07833ea
parent9b6108b62fc316cdf936567b20eb0d8f7b54bfa9 (diff)
downloadshelf-e0de5f1d1babd70b402ff58e9b5a21e0a663f7e3.tar.gz
shelf-e0de5f1d1babd70b402ff58e9b5a21e0a663f7e3.tar.bz2
Add a minimum size for target scaling
-rw-r--r--shelf.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/shelf.c b/shelf.c
index fc16b49..a7d5e95 100644
--- a/shelf.c
+++ b/shelf.c
@@ -55,6 +55,8 @@ static int screenPrivateIndex;
#define SHELF_WINDOW(w) \
shelfWindow *sw = w->base.privates[ss->windowPrivateIndex].ptr;
+#define SHELF_MIN_SIZE 50.0f // Minimum pixelsize a window can be scaled to
+
/* Shape the input of the window when scaled */
static void
shelfShapeInput (CompWindow *w)
@@ -91,7 +93,8 @@ shelfPreparePaintScreen (CompScreen *s,
steps = 0.005;
for (w = s->windows; w; w = w->next)
- ((shelfWindow *)w->base.privates[ss->windowPrivateIndex].ptr)->steps = steps;
+ ((shelfWindow *)w->base.privates[ss->windowPrivateIndex].ptr)->steps
+ = steps;
UNWRAP (ss, s, preparePaintScreen);
(*s->preparePaintScreen) (s, msSinceLastPaint);
@@ -110,8 +113,8 @@ shelfScaleWindow (CompWindow *w, float scale)
sw->targetScale = scale;
if (sw->targetScale > 1.0f)
sw->targetScale = 1.0f;
- else if (sw->targetScale < 0.01f)
- sw->targetScale = 0.01f;
+ else if ((float)w->width * sw->targetScale < SHELF_MIN_SIZE )
+ sw->targetScale = SHELF_MIN_SIZE / (float)w->width;
shelfShapeInput (w);
damageScreen (w->screen);
}