diff options
author | simonb <simonb> | 2006-06-24 13:11:27 (GMT) |
---|---|---|
committer | simonb <simonb> | 2006-06-24 13:11:27 (GMT) |
commit | 1d0b23bd020c9185dc9cbf8952ab97a27f061be0 (patch) | |
tree | 90cb1dbe339ec4edbac9bd6a55b910ccc3e73e77 /src | |
parent | 5fc5ec3374ad903cdf6a2c6b30ce7d8de54d087b (diff) | |
download | fluxbox_lack-1d0b23bd020c9185dc9cbf8952ab97a27f061be0.zip fluxbox_lack-1d0b23bd020c9185dc9cbf8952ab97a27f061be0.tar.bz2 |
fix disappearing menu selection boxes
Diffstat (limited to 'src')
-rw-r--r-- | src/FbTk/FbPixmap.cc | 19 | ||||
-rw-r--r-- | src/FbTk/FbPixmap.hh | 7 | ||||
-rw-r--r-- | src/FbTk/Menu.cc | 4 | ||||
-rw-r--r-- | src/FbTk/MenuTheme.hh | 13 |
4 files changed, 31 insertions, 12 deletions
diff --git a/src/FbTk/FbPixmap.cc b/src/FbTk/FbPixmap.cc index c605feb..46ee97c 100644 --- a/src/FbTk/FbPixmap.cc +++ b/src/FbTk/FbPixmap.cc | |||
@@ -54,18 +54,18 @@ Atom FbPixmap::root_prop_atoms[] = { | |||
54 | 54 | ||
55 | FbPixmap::FbPixmap():m_pm(0), | 55 | FbPixmap::FbPixmap():m_pm(0), |
56 | m_width(0), m_height(0), | 56 | m_width(0), m_height(0), |
57 | m_depth(0) { | 57 | m_depth(0), m_dont_free(false) { |
58 | } | 58 | } |
59 | 59 | ||
60 | FbPixmap::FbPixmap(const FbPixmap &the_copy):FbDrawable(), m_pm(0), | 60 | FbPixmap::FbPixmap(const FbPixmap &the_copy):FbDrawable(), m_pm(0), |
61 | m_width(0), m_height(0), | 61 | m_width(0), m_height(0), |
62 | m_depth(0){ | 62 | m_depth(0), m_dont_free(false) { |
63 | copy(the_copy); | 63 | copy(the_copy); |
64 | } | 64 | } |
65 | 65 | ||
66 | FbPixmap::FbPixmap(Pixmap pm):m_pm(0), | 66 | FbPixmap::FbPixmap(Pixmap pm):m_pm(0), |
67 | m_width(0), m_height(0), | 67 | m_width(0), m_height(0), |
68 | m_depth(0) { | 68 | m_depth(0), m_dont_free(false) { |
69 | if (pm == 0) | 69 | if (pm == 0) |
70 | return; | 70 | return; |
71 | // assign X pixmap to this | 71 | // assign X pixmap to this |
@@ -76,7 +76,7 @@ FbPixmap::FbPixmap(const FbDrawable &src, | |||
76 | unsigned int width, unsigned int height, | 76 | unsigned int width, unsigned int height, |
77 | unsigned int depth):m_pm(0), | 77 | unsigned int depth):m_pm(0), |
78 | m_width(0), m_height(0), | 78 | m_width(0), m_height(0), |
79 | m_depth(0) { | 79 | m_depth(0), m_dont_free(false) { |
80 | 80 | ||
81 | create(src.drawable(), width, height, depth); | 81 | create(src.drawable(), width, height, depth); |
82 | } | 82 | } |
@@ -85,7 +85,7 @@ FbPixmap::FbPixmap(Drawable src, | |||
85 | unsigned int width, unsigned int height, | 85 | unsigned int width, unsigned int height, |
86 | unsigned int depth):m_pm(0), | 86 | unsigned int depth):m_pm(0), |
87 | m_width(0), m_height(0), | 87 | m_width(0), m_height(0), |
88 | m_depth(0) { | 88 | m_depth(0), m_dont_free(false) { |
89 | 89 | ||
90 | create(src, width, height, depth); | 90 | create(src, width, height, depth); |
91 | } | 91 | } |
@@ -470,10 +470,13 @@ void FbPixmap::checkAtoms() { | |||
470 | } | 470 | } |
471 | 471 | ||
472 | void FbPixmap::free() { | 472 | void FbPixmap::free() { |
473 | if (m_pm != 0) { | 473 | if (!m_dont_free && m_pm != 0) |
474 | XFreePixmap(display(), m_pm); | 474 | XFreePixmap(display(), m_pm); |
475 | m_pm = 0; | 475 | |
476 | } | 476 | /* note: m_dont_free shouldnt be required anywhere else, |
477 | because then free() isn't being called appropriately! */ | ||
478 | m_dont_free = false; | ||
479 | m_pm = 0; | ||
477 | m_width = 0; | 480 | m_width = 0; |
478 | m_height = 0; | 481 | m_height = 0; |
479 | m_depth = 0; | 482 | m_depth = 0; |
diff --git a/src/FbTk/FbPixmap.hh b/src/FbTk/FbPixmap.hh index 2935978..dab364a 100644 --- a/src/FbTk/FbPixmap.hh +++ b/src/FbTk/FbPixmap.hh | |||
@@ -77,12 +77,19 @@ public: | |||
77 | unsigned int width, unsigned int height, | 77 | unsigned int width, unsigned int height, |
78 | unsigned int depth); | 78 | unsigned int depth); |
79 | 79 | ||
80 | /* Will be reset to false whenever this pixmap is reassigned */ | ||
81 | void dontFree() { m_dont_free = true; } | ||
82 | |||
80 | private: | 83 | private: |
81 | void free(); | 84 | void free(); |
85 | |||
82 | Pixmap m_pm; | 86 | Pixmap m_pm; |
83 | unsigned int m_width, m_height; | 87 | unsigned int m_width, m_height; |
84 | unsigned int m_depth; | 88 | unsigned int m_depth; |
85 | 89 | ||
90 | // if pixmap not *owned* by this object (eg assigned from cache object) | ||
91 | bool m_dont_free; | ||
92 | |||
86 | /// Functions relating to the maintenance of root window pixmap caching | 93 | /// Functions relating to the maintenance of root window pixmap caching |
87 | static void checkAtoms(); | 94 | static void checkAtoms(); |
88 | 95 | ||
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index b0e5c4e..b067361 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc | |||
@@ -470,11 +470,11 @@ void Menu::updateMenu(int active_index) { | |||
470 | 470 | ||
471 | if (!theme().selectedPixmap().pixmap().drawable()) { | 471 | if (!theme().selectedPixmap().pixmap().drawable()) { |
472 | int hw = theme().itemHeight() / 2; | 472 | int hw = theme().itemHeight() / 2; |
473 | m_theme.setSelectedPixmap(m_image_ctrl.renderImage(hw, hw, theme().hiliteTexture())); | 473 | m_theme.setSelectedPixmap(m_image_ctrl.renderImage(hw, hw, theme().hiliteTexture()), true); |
474 | 474 | ||
475 | if (!theme().highlightSelectedPixmap().pixmap().drawable()) { | 475 | if (!theme().highlightSelectedPixmap().pixmap().drawable()) { |
476 | int hw = theme().itemHeight() / 2; | 476 | int hw = theme().itemHeight() / 2; |
477 | m_theme.setHighlightSelectedPixmap(m_image_ctrl.renderImage(hw, hw, theme().frameTexture())); | 477 | m_theme.setHighlightSelectedPixmap(m_image_ctrl.renderImage(hw, hw, theme().frameTexture()), true); |
478 | } | 478 | } |
479 | } | 479 | } |
480 | 480 | ||
diff --git a/src/FbTk/MenuTheme.hh b/src/FbTk/MenuTheme.hh index c423cf4..da5b65c 100644 --- a/src/FbTk/MenuTheme.hh +++ b/src/FbTk/MenuTheme.hh | |||
@@ -126,8 +126,17 @@ public: | |||
126 | inline const FbTk::Color &borderColor() const { return *m_border_color; } | 126 | inline const FbTk::Color &borderColor() const { return *m_border_color; } |
127 | 127 | ||
128 | // special override | 128 | // special override |
129 | inline void setSelectedPixmap(Pixmap pm) { m_selected_pixmap->pixmap() = pm; } | 129 | inline void setSelectedPixmap(Pixmap pm, bool is_imagecached) { |
130 | inline void setHighlightSelectedPixmap(Pixmap pm) { m_hl_selected_pixmap->pixmap() = pm; } | 130 | m_selected_pixmap->pixmap() = pm; |
131 | if (is_imagecached) | ||
132 | m_selected_pixmap->pixmap().dontFree(); | ||
133 | } | ||
134 | |||
135 | inline void setHighlightSelectedPixmap(Pixmap pm, bool is_imagecached) { | ||
136 | m_hl_selected_pixmap->pixmap() = pm; | ||
137 | if (is_imagecached) | ||
138 | m_hl_selected_pixmap->pixmap().dontFree(); | ||
139 | } | ||
131 | 140 | ||
132 | private: | 141 | private: |
133 | FbTk::ThemeItem<FbTk::Color> t_text, f_text, h_text, d_text; | 142 | FbTk::ThemeItem<FbTk::Color> t_text, f_text, h_text, d_text; |