diff options
author | Erkin Bahceci <erkinbah@gmail.com> | 2009-12-25 14:51:15 -0600 |
---|---|---|
committer | Erkin Bahceci <erkinbah@gmail.com> | 2009-12-25 15:03:07 -0600 |
commit | c95fa4b68788aedc36f6881eba500458ccb5e38a (patch) | |
tree | b47066b1f26b71935839d9ee0d3ae588637fc95d | |
parent | 6276539b1d10914ab5532f7ffaf807d84ba378d7 (diff) | |
download | compiz-with-glib-mainloop-c95fa4b68788aedc36f6881eba500458ccb5e38a.tar.gz compiz-with-glib-mainloop-c95fa4b68788aedc36f6881eba500458ccb5e38a.tar.bz2 |
Paint switcher icons at the same size.
Forward port of 06f538d460b72a044e3da72f01d385890da43e84.
-rw-r--r-- | plugins/compiztoolbox/include/compiztoolbox/compiztoolbox.h | 2 | ||||
-rw-r--r-- | plugins/switcher/src/switcher.cpp | 24 |
2 files changed, 12 insertions, 14 deletions
diff --git a/plugins/compiztoolbox/include/compiztoolbox/compiztoolbox.h b/plugins/compiztoolbox/include/compiztoolbox/compiztoolbox.h index 8bd9d66..3223348 100644 --- a/plugins/compiztoolbox/include/compiztoolbox/compiztoolbox.h +++ b/plugins/compiztoolbox/include/compiztoolbox/compiztoolbox.h @@ -159,7 +159,7 @@ class BaseSwitchWindow CompWindow *window; }; -#define ICON_SIZE 64 +#define ICON_SIZE 48 #define MAX_ICON_SIZE 256 #endif diff --git a/plugins/switcher/src/switcher.cpp b/plugins/switcher/src/switcher.cpp index 83e32d7..90c5ce4 100644 --- a/plugins/switcher/src/switcher.cpp +++ b/plugins/switcher/src/switcher.cpp @@ -894,10 +894,15 @@ SwitchWindow::updateIconTexturedWindow (GLWindowPaintAttrib &sAttrib, int y, GLTexture *icon) { - sAttrib.xScale = sAttrib.yScale = 1.0f; + sAttrib.xScale = (float) ICON_SIZE / icon->width (); + sAttrib.yScale = (float) ICON_SIZE / icon->height (); + if (sAttrib.xScale < sAttrib.yScale) + sAttrib.yScale = sAttrib.xScale; + else + sAttrib.xScale = sAttrib.yScale; - wx = x + WIDTH - icon->width () - SPACE; - wy = y + HEIGHT - icon->height () - SPACE; + wx = x + WIDTH - icon->width () * sAttrib.xScale - SPACE; + wy = y + HEIGHT - icon->height () * sAttrib.yScale - SPACE; } void @@ -910,20 +915,13 @@ SwitchWindow::updateIconNontexturedWindow (GLWindowPaintAttrib &sAttrib, int y, GLTexture *icon) { - int iw, ih; + float iw, ih; iw = width - SPACE; ih = height - SPACE; - if ((int)icon->width () < (iw >> 1)) - sAttrib.xScale = (iw / icon->width ()); - else - sAttrib.xScale = 1.0f; - - if ((int)icon->height () < (ih >> 1)) - sAttrib.yScale = (ih / icon->height ()); - else - sAttrib.yScale = 1.0f; + sAttrib.xScale = iw / icon->width (); + sAttrib.yScale = ih / icon->height (); if (sAttrib.xScale < sAttrib.yScale) sAttrib.yScale = sAttrib.xScale; |