aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/MenuItem.cc
diff options
context:
space:
mode:
authormarkt <markt>2007-10-13 21:51:37 (GMT)
committermarkt <markt>2007-10-13 21:51:37 (GMT)
commita59428d67a95a9df16554962f0a6257d6378328a (patch)
treef856ed9300c34f7a17d499f22d895610cfbc08e5 /src/FbTk/MenuItem.cc
parent41b5c6dadb1f474675660cef18b812d4c2338ed2 (diff)
downloadfluxbox_paul-a59428d67a95a9df16554962f0a6257d6378328a.zip
fluxbox_paul-a59428d67a95a9df16554962f0a6257d6378328a.tar.bz2
merged changes from pre-devel
Diffstat (limited to 'src/FbTk/MenuItem.cc')
-rw-r--r--src/FbTk/MenuItem.cc21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/FbTk/MenuItem.cc b/src/FbTk/MenuItem.cc
index bc80ca0..2576d2b 100644
--- a/src/FbTk/MenuItem.cc
+++ b/src/FbTk/MenuItem.cc
@@ -93,27 +93,32 @@ void MenuItem::draw(FbDrawable &draw,
93 // Icon 93 // Icon
94 // 94 //
95 if (draw_background) { 95 if (draw_background) {
96 if (m_icon.get() != 0 && m_icon->pixmap.get() != 0) { 96 if (icon() != 0) {
97 // copy pixmap, so we don't resize the original
98 FbPixmap tmp_pixmap, tmp_mask;
99 tmp_pixmap.copy(icon()->pixmap());
100 tmp_mask.copy(icon()->mask());
101
97 // scale pixmap to right size 102 // scale pixmap to right size
98 if (height - 2*theme.bevelWidth() != m_icon->pixmap->height() && 103 if (height - 2*theme.bevelWidth() != tmp_pixmap.height()) {
99 !m_icon->filename.empty()) {
100 unsigned int scale_size = height - 2*theme.bevelWidth(); 104 unsigned int scale_size = height - 2*theme.bevelWidth();
101 m_icon->pixmap->scale(scale_size, scale_size); 105 tmp_pixmap.scale(scale_size, scale_size);
106 tmp_mask.scale(scale_size, scale_size);
102 } 107 }
103 108
104 if (m_icon->pixmap->pixmap().drawable() != 0) { 109 if (tmp_pixmap.drawable() != 0) {
105 GC gc = theme.frameTextGC().gc(); 110 GC gc = theme.frameTextGC().gc();
106 int icon_x = x + theme.bevelWidth(); 111 int icon_x = x + theme.bevelWidth();
107 int icon_y = y + theme.bevelWidth(); 112 int icon_y = y + theme.bevelWidth();
108 // enable clip mask 113 // enable clip mask
109 XSetClipMask(disp, gc, m_icon->pixmap->mask().drawable()); 114 XSetClipMask(disp, gc, tmp_mask.drawable());
110 XSetClipOrigin(disp, gc, icon_x, icon_y); 115 XSetClipOrigin(disp, gc, icon_x, icon_y);
111 116
112 draw.copyArea(m_icon->pixmap->pixmap().drawable(), 117 draw.copyArea(tmp_pixmap.drawable(),
113 gc, 118 gc,
114 0, 0, 119 0, 0,
115 icon_x, icon_y, 120 icon_x, icon_y,
116 m_icon->pixmap->width(), m_icon->pixmap->height()); 121 tmp_pixmap.width(), tmp_pixmap.height());
117 122
118 // restore clip mask 123 // restore clip mask
119 XSetClipMask(disp, gc, None); 124 XSetClipMask(disp, gc, None);