fix disappearing menu selection boxes
This commit is contained in:
parent
5fc5ec3374
commit
1d0b23bd02
5 changed files with 35 additions and 12 deletions
|
@ -1,5 +1,9 @@
|
|||
(Format: Year/Month/Day)
|
||||
Changes for 1.0rc2:
|
||||
*06/06/24:
|
||||
* Fix bug #1362463, menu selection pixmaps disappear (Simon)
|
||||
- pixmap from image cache was put into FbPixmap, which freed it.
|
||||
FbPixmap.hh/cc MenuTheme.hh Menu.cc
|
||||
*06/06/23:
|
||||
* Make startfluxbox aware of --program-prefix and --program-suffix (Mark)
|
||||
configure.in util/Makefile.am util/startfluxbox.in
|
||||
|
|
|
@ -54,18 +54,18 @@ Atom FbPixmap::root_prop_atoms[] = {
|
|||
|
||||
FbPixmap::FbPixmap():m_pm(0),
|
||||
m_width(0), m_height(0),
|
||||
m_depth(0) {
|
||||
m_depth(0), m_dont_free(false) {
|
||||
}
|
||||
|
||||
FbPixmap::FbPixmap(const FbPixmap &the_copy):FbDrawable(), m_pm(0),
|
||||
m_width(0), m_height(0),
|
||||
m_depth(0){
|
||||
m_depth(0), m_dont_free(false) {
|
||||
copy(the_copy);
|
||||
}
|
||||
|
||||
FbPixmap::FbPixmap(Pixmap pm):m_pm(0),
|
||||
m_width(0), m_height(0),
|
||||
m_depth(0) {
|
||||
m_depth(0), m_dont_free(false) {
|
||||
if (pm == 0)
|
||||
return;
|
||||
// assign X pixmap to this
|
||||
|
@ -76,7 +76,7 @@ FbPixmap::FbPixmap(const FbDrawable &src,
|
|||
unsigned int width, unsigned int height,
|
||||
unsigned int depth):m_pm(0),
|
||||
m_width(0), m_height(0),
|
||||
m_depth(0) {
|
||||
m_depth(0), m_dont_free(false) {
|
||||
|
||||
create(src.drawable(), width, height, depth);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ FbPixmap::FbPixmap(Drawable src,
|
|||
unsigned int width, unsigned int height,
|
||||
unsigned int depth):m_pm(0),
|
||||
m_width(0), m_height(0),
|
||||
m_depth(0) {
|
||||
m_depth(0), m_dont_free(false) {
|
||||
|
||||
create(src, width, height, depth);
|
||||
}
|
||||
|
@ -470,10 +470,13 @@ void FbPixmap::checkAtoms() {
|
|||
}
|
||||
|
||||
void FbPixmap::free() {
|
||||
if (m_pm != 0) {
|
||||
if (!m_dont_free && m_pm != 0)
|
||||
XFreePixmap(display(), m_pm);
|
||||
m_pm = 0;
|
||||
}
|
||||
|
||||
/* note: m_dont_free shouldnt be required anywhere else,
|
||||
because then free() isn't being called appropriately! */
|
||||
m_dont_free = false;
|
||||
m_pm = 0;
|
||||
m_width = 0;
|
||||
m_height = 0;
|
||||
m_depth = 0;
|
||||
|
|
|
@ -77,12 +77,19 @@ public:
|
|||
unsigned int width, unsigned int height,
|
||||
unsigned int depth);
|
||||
|
||||
/* Will be reset to false whenever this pixmap is reassigned */
|
||||
void dontFree() { m_dont_free = true; }
|
||||
|
||||
private:
|
||||
void free();
|
||||
|
||||
Pixmap m_pm;
|
||||
unsigned int m_width, m_height;
|
||||
unsigned int m_depth;
|
||||
|
||||
// if pixmap not *owned* by this object (eg assigned from cache object)
|
||||
bool m_dont_free;
|
||||
|
||||
/// Functions relating to the maintenance of root window pixmap caching
|
||||
static void checkAtoms();
|
||||
|
||||
|
|
|
@ -470,11 +470,11 @@ void Menu::updateMenu(int active_index) {
|
|||
|
||||
if (!theme().selectedPixmap().pixmap().drawable()) {
|
||||
int hw = theme().itemHeight() / 2;
|
||||
m_theme.setSelectedPixmap(m_image_ctrl.renderImage(hw, hw, theme().hiliteTexture()));
|
||||
m_theme.setSelectedPixmap(m_image_ctrl.renderImage(hw, hw, theme().hiliteTexture()), true);
|
||||
|
||||
if (!theme().highlightSelectedPixmap().pixmap().drawable()) {
|
||||
int hw = theme().itemHeight() / 2;
|
||||
m_theme.setHighlightSelectedPixmap(m_image_ctrl.renderImage(hw, hw, theme().frameTexture()));
|
||||
m_theme.setHighlightSelectedPixmap(m_image_ctrl.renderImage(hw, hw, theme().frameTexture()), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -126,8 +126,17 @@ public:
|
|||
inline const FbTk::Color &borderColor() const { return *m_border_color; }
|
||||
|
||||
// special override
|
||||
inline void setSelectedPixmap(Pixmap pm) { m_selected_pixmap->pixmap() = pm; }
|
||||
inline void setHighlightSelectedPixmap(Pixmap pm) { m_hl_selected_pixmap->pixmap() = pm; }
|
||||
inline void setSelectedPixmap(Pixmap pm, bool is_imagecached) {
|
||||
m_selected_pixmap->pixmap() = pm;
|
||||
if (is_imagecached)
|
||||
m_selected_pixmap->pixmap().dontFree();
|
||||
}
|
||||
|
||||
inline void setHighlightSelectedPixmap(Pixmap pm, bool is_imagecached) {
|
||||
m_hl_selected_pixmap->pixmap() = pm;
|
||||
if (is_imagecached)
|
||||
m_hl_selected_pixmap->pixmap().dontFree();
|
||||
}
|
||||
|
||||
private:
|
||||
FbTk::ThemeItem<FbTk::Color> t_text, f_text, h_text, d_text;
|
||||
|
|
Loading…
Reference in a new issue