aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/MenuIcon.cc
diff options
context:
space:
mode:
authorakir <akir>2004-09-10 16:41:30 (GMT)
committerakir <akir>2004-09-10 16:41:30 (GMT)
commitdf0c942aa2576a8edaae5a13ace01643729035ea (patch)
tree5ef2a1526885539c70e6c2e8700898245df4c452 /src/FbTk/MenuIcon.cc
parenta90fe37f9a3828eee54f6aeda4ebdb99b27d58d7 (diff)
downloadfluxbox-df0c942aa2576a8edaae5a13ace01643729035ea.zip
fluxbox-df0c942aa2576a8edaae5a13ace01643729035ea.tar.bz2
cosmetic + avoid unneeded App::instance()->display() calls
Diffstat (limited to 'src/FbTk/MenuIcon.cc')
-rw-r--r--src/FbTk/MenuIcon.cc20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/FbTk/MenuIcon.cc b/src/FbTk/MenuIcon.cc
index 168e056..bd9ed79 100644
--- a/src/FbTk/MenuIcon.cc
+++ b/src/FbTk/MenuIcon.cc
@@ -1,7 +1,7 @@
1// MenuIcon.cc for FbTk - Fluxbox ToolKit 1// MenuIcon.cc for FbTk - Fluxbox ToolKit
2// Copyright (c) 2004 Henrik Kinnunen (fluxgen at users.sourceforge.net) 2// Copyright (c) 2004 Henrik Kinnunen (fluxgen at users.sourceforge.net)
3// and Simon Bowden (rathnor at users.sourceforge.net) 3// and Simon Bowden (rathnor at users.sourceforge.net)
4// 4//
5// Permission is hereby granted, free of charge, to any person obtaining a 5// Permission is hereby granted, free of charge, to any person obtaining a
6// copy of this software and associated documentation files (the "Software"), 6// copy of this software and associated documentation files (the "Software"),
7// to deal in the Software without restriction, including without limitation 7// to deal in the Software without restriction, including without limitation
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: MenuIcon.cc,v 1.1 2004/06/07 22:28:39 fluxgen Exp $ 23// $Id: MenuIcon.cc,v 1.2 2004/09/10 16:37:54 akir Exp $
24 24
25#include "MenuIcon.hh" 25#include "MenuIcon.hh"
26 26
@@ -39,7 +39,7 @@ MenuIcon::MenuIcon(const std::string &filename, const std::string &label, int sc
39 m_mask = pm->mask().release(); 39 m_mask = pm->mask().release();
40 delete pm; 40 delete pm;
41 } 41 }
42 42
43} 43}
44 44
45void MenuIcon::updateTheme(const MenuTheme &theme) { 45void MenuIcon::updateTheme(const MenuTheme &theme) {
@@ -51,12 +51,13 @@ void MenuIcon::updateTheme(const MenuTheme &theme) {
51 } 51 }
52} 52}
53 53
54void MenuIcon::draw(FbDrawable &drawable, 54void MenuIcon::draw(FbDrawable &drawable,
55 const MenuTheme &theme, 55 const MenuTheme &theme,
56 bool highlight, 56 bool highlight,
57 int x, int y, 57 int x, int y,
58 unsigned int width, unsigned int height) const { 58 unsigned int width, unsigned int height) const {
59 59
60 Display *disp = FbTk::App::instance()->display();
60 if (height - 2*theme.bevelWidth() != m_pixmap.height() && 61 if (height - 2*theme.bevelWidth() != m_pixmap.height() &&
61 !m_filename.empty()) { 62 !m_filename.empty()) {
62 unsigned int scale_size = height - 2*theme.bevelWidth(); 63 unsigned int scale_size = height - 2*theme.bevelWidth();
@@ -68,11 +69,8 @@ void MenuIcon::draw(FbDrawable &drawable,
68 GC gc = theme.frameTextGC().gc(); 69 GC gc = theme.frameTextGC().gc();
69 70
70 // enable clip mask 71 // enable clip mask
71 XSetClipMask(FbTk::App::instance()->display(), 72 XSetClipMask(disp, gc, m_mask.drawable());
72 gc, 73 XSetClipOrigin(disp, gc, x + theme.bevelWidth(), y + theme.bevelWidth());
73 m_mask.drawable());
74 XSetClipOrigin(FbTk::App::instance()->display(),
75 gc, x + theme.bevelWidth(), y + theme.bevelWidth());
76 74
77 drawable.copyArea(m_pixmap.drawable(), 75 drawable.copyArea(m_pixmap.drawable(),
78 gc, 76 gc,
@@ -81,9 +79,7 @@ void MenuIcon::draw(FbDrawable &drawable,
81 m_pixmap.width(), m_pixmap.height()); 79 m_pixmap.width(), m_pixmap.height());
82 80
83 // restore clip mask 81 // restore clip mask
84 XSetClipMask(FbTk::App::instance()->display(), 82 XSetClipMask(disp, gc, None);
85 gc,
86 None);
87 } 83 }
88 FbTk::MenuItem::draw(drawable, theme, highlight, x, y, width, height); 84 FbTk::MenuItem::draw(drawable, theme, highlight, x, y, width, height);
89} 85}