From f7c36d77038a5c149dad419e740919036a538703 Mon Sep 17 00:00:00 2001 From: markt Date: Tue, 3 Apr 2007 17:13:39 +0000 Subject: fixed a bug, removed some unused code --- src/FbTk/Resource.cc | 10 +++++++++- src/FbWinFrame.cc | 53 ++++++-------------------------------------------- src/FbWinFrame.hh | 3 --- src/FbWinFrameTheme.cc | 12 ------------ src/FbWinFrameTheme.hh | 9 +++------ 5 files changed, 18 insertions(+), 69 deletions(-) diff --git a/src/FbTk/Resource.cc b/src/FbTk/Resource.cc index cb45eac..3b857de 100644 --- a/src/FbTk/Resource.cc +++ b/src/FbTk/Resource.cc @@ -107,7 +107,15 @@ bool ResourceManager::load(const char *filename) { */ bool ResourceManager::save(const char *filename, const char *mergefilename) { assert(filename); - filename = StringUtil::expandFilename(filename).c_str(); + + // these must be local variables; otherwise, the memory gets released by + // std::string, causing weird issues + string file_str = StringUtil::expandFilename(filename), mergefile_str; + filename = file_str.c_str(); + if (mergefilename) { + mergefile_str = StringUtil::expandFilename(mergefilename); + mergefilename = mergefile_str.c_str(); + } // empty database XrmDatabaseHelper database; diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index 84f47f4..124883e 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc @@ -526,7 +526,7 @@ void FbWinFrame::setFocus(bool newvalue) { if (newvalue) // focused applyFocusLabel(*m_current_label); else // unfocused - applyActiveLabel(*m_current_label); + applyUnfocusLabel(*m_current_label); } applyAll(); @@ -706,7 +706,7 @@ void FbWinFrame::setLabelButtonFocus(FbTk::TextButton &btn) { if (m_focused) applyFocusLabel(*m_current_label); else - applyActiveLabel(*m_current_label); + applyUnfocusLabel(*m_current_label); } void FbWinFrame::setLabelButtonFocus(FbTk::TextButton &btn, bool value) { @@ -1315,10 +1315,6 @@ void FbWinFrame::renderTabContainer() { m_labelbutton_unfocused_pm, m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation()); - render(m_theme.labelActiveTexture(), m_labelbutton_active_color, - m_labelbutton_active_pm, - m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation()); - renderButtons(); } @@ -1468,7 +1464,7 @@ void FbWinFrame::init() { m_title_focused_pm = m_title_unfocused_pm = 0; m_label_focused_pm = m_label_unfocused_pm = 0; m_tabcontainer_focused_pm = m_tabcontainer_unfocused_pm = 0; - m_labelbutton_focused_pm = m_labelbutton_unfocused_pm = m_labelbutton_active_pm = 0; + m_labelbutton_focused_pm = m_labelbutton_unfocused_pm = 0; m_handle_focused_pm = m_handle_unfocused_pm = 0; m_button_pm = m_button_unfocused_pm = m_button_pressed_pm = 0; m_grip_unfocused_pm = m_grip_focused_pm = 0; @@ -1592,12 +1588,9 @@ void FbWinFrame::applyTabContainer() { Container::ItemList::iterator btn_it_end = m_tab_container.end(); for (; btn_it != btn_it_end; ++btn_it) { FbTk::TextButton *btn = static_cast(*btn_it); - if (btn == m_current_label) { - if (m_focused) - applyFocusLabel(*btn); - else - applyActiveLabel(*btn); - } else + if (btn == m_current_label && m_focused) + applyFocusLabel(*btn); + else applyUnfocusLabel(*btn); } } @@ -1669,19 +1662,6 @@ void FbWinFrame::applyFocusLabel(FbTk::TextButton &button) { } -void FbWinFrame::applyActiveLabel(FbTk::TextButton &button) { - - button.setGC(theme().labelTextActiveGC()); - button.setJustify(theme().justify()); - button.setAlpha(getAlpha(m_focused)); - - if (m_labelbutton_active_pm != 0) { - button.setBackgroundPixmap(m_labelbutton_active_pm); - } else - button.setBackgroundColor(m_labelbutton_active_color); - -} - void FbWinFrame::applyUnfocusLabel(FbTk::TextButton &button) { button.setGC(theme().labelTextUnfocusGC()); @@ -1695,27 +1675,6 @@ void FbWinFrame::applyUnfocusLabel(FbTk::TextButton &button) { } -namespace { -class IgnoreEvent { -public: - typedef void result_type; - typedef Window argument_type; - explicit IgnoreEvent(long eventmask): - m_display(FbTk::App::instance()->display()), - m_event_mask(eventmask) { - } - - void operator()(Window win) const { - static XEvent event; - while (XCheckWindowEvent(m_display, win, m_event_mask, &event)) - continue; - } -private: - Display *m_display; - long m_event_mask; -}; -} - // this function translates its arguments according to win_gravity // if win_gravity is negative, it does an inverse translation // This function should be used when a window is mapped/unmapped/pos configured diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh index a75d8a1..ff8df83 100644 --- a/src/FbWinFrame.hh +++ b/src/FbWinFrame.hh @@ -281,7 +281,6 @@ private: void applyTabContainer(); // and label buttons void applyFocusLabel(FbTk::TextButton &button); void applyUnfocusLabel(FbTk::TextButton &button); - void applyActiveLabel(FbTk::TextButton &button); void applyButtons(); // only called within applyTitlebar void getCurrentFocusPixmap(Pixmap &label_pm, Pixmap &title_pm, @@ -353,8 +352,6 @@ private: FbTk::Color m_labelbutton_focused_color; ///< color for focused label Pixmap m_labelbutton_unfocused_pm; ///< pixmap for unfocused label FbTk::Color m_labelbutton_unfocused_color; ///< color for unfocused label - Pixmap m_labelbutton_active_pm; ///< pixmap for active label - FbTk::Color m_labelbutton_active_color; ///< color for active label FbTk::Color m_handle_focused_color, m_handle_unfocused_color; Pixmap m_handle_focused_pm, m_handle_unfocused_pm; diff --git a/src/FbWinFrameTheme.cc b/src/FbWinFrameTheme.cc index 72f42fe..e4bc196 100644 --- a/src/FbWinFrameTheme.cc +++ b/src/FbWinFrameTheme.cc @@ -30,7 +30,6 @@ FbWinFrameTheme::FbWinFrameTheme(int screen_num): FbTk::Theme(screen_num), m_label_focus(*this, "window.label.focus", "Window.Label.Focus"), m_label_unfocus(*this, "window.label.unfocus", "Window.Label.Unfocus"), - m_label_active(*this, "window.label.active", "Window.Label.Active"), m_title_focus(*this, "window.title.focus", "Window.Title.Focus"), m_title_unfocus(*this, "window.title.unfocus", "Window.Title.Unfocus"), @@ -47,7 +46,6 @@ FbWinFrameTheme::FbWinFrameTheme(int screen_num): m_label_focus_color(*this, "window.label.focus.textColor", "Window.Label.Focus.TextColor"), m_label_unfocus_color(*this, "window.label.unfocus.textColor", "Window.Label.Unfocus.TextColor"), - m_label_active_color(*this, "window.label.active.textColor", "Window.Label.Active.TextColor"), m_button_focus_color(*this, "window.button.focus.picColor", "Window.Button.Focus.PicColor"), m_button_unfocus_color(*this, "window.button.unfocus.picColor", "Window.Button.Unfocus.PicColor"), @@ -61,7 +59,6 @@ FbWinFrameTheme::FbWinFrameTheme(int screen_num): m_border(*this, "window", "Window"), // for window.border* m_label_text_focus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)), m_label_text_unfocus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)), - m_label_text_active_gc(RootWindow(FbTk::App::instance()->display(), screen_num)), m_button_pic_focus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)), m_button_pic_unfocus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)), m_focused_alpha(255), @@ -95,14 +92,6 @@ bool FbWinFrameTheme::fallback(FbTk::ThemeItem_base &item) { return FbTk::ThemeManager::instance().loadItem(item, "bevelWidth", "bevelWidth"); else if (item.name() == "window.handleWidth") return FbTk::ThemeManager::instance().loadItem(item, "handleWidth", "HandleWidth"); - else if (item.name() == "window.label.active") { - // copy texture - *m_label_active = *m_label_unfocus; - return true; - } else if (item.name() == "window.label.active.textColor") { - return FbTk::ThemeManager::instance().loadItem(item, "window.label.unfocus.textColor", - "Window.Label.Unfocus.TextColor"); - } return false; } @@ -120,7 +109,6 @@ void FbWinFrameTheme::reconfigTheme() { m_label_text_focus_gc.setForeground(*m_label_focus_color); m_label_text_unfocus_gc.setForeground(*m_label_unfocus_color); - m_label_text_active_gc.setForeground(*m_label_active_color); m_button_pic_focus_gc.setForeground(*m_button_focus_color); m_button_pic_unfocus_gc.setForeground(*m_button_unfocus_color); } diff --git a/src/FbWinFrameTheme.hh b/src/FbWinFrameTheme.hh index 0feadd3..319e01b 100644 --- a/src/FbWinFrameTheme.hh +++ b/src/FbWinFrameTheme.hh @@ -45,7 +45,6 @@ public: //@{ const FbTk::Texture &labelFocusTexture() const { return *m_label_focus; } const FbTk::Texture &labelUnfocusTexture() const { return *m_label_unfocus; } - const FbTk::Texture &labelActiveTexture() const { return *m_label_active; } const FbTk::ThemeItem &label() const { return m_label_unfocus; } const FbTk::Texture &titleFocusTexture() const { return *m_title_focus; } const FbTk::Texture &titleUnfocusTexture() const { return *m_title_unfocus; } @@ -67,7 +66,6 @@ public: //@{ const FbTk::Color &labelFocusColor() const { return *m_label_focus_color; } const FbTk::Color &labelUnfocusColor() const { return *m_label_unfocus_color; } - const FbTk::Color &labelActiveColor() const { return *m_label_active_color; } const FbTk::Color &buttonFocuscolor() const { return *m_button_focus_color; } const FbTk::Color &buttonUnfocuscolor() const { return *m_button_unfocus_color; } @@ -78,7 +76,6 @@ public: GC labelTextFocusGC() const { return m_label_text_focus_gc.gc(); } GC labelTextUnfocusGC() const { return m_label_text_unfocus_gc.gc(); } - GC labelTextActiveGC() const { return m_label_text_active_gc.gc(); } GC buttonPicFocusGC() const { return m_button_pic_focus_gc.gc(); } GC buttonPicUnfocusGC() const { return m_button_pic_unfocus_gc.gc(); } @@ -104,13 +101,13 @@ public: void setUnfocusedAlpha(unsigned char alpha) { m_unfocused_alpha = alpha; } private: - FbTk::ThemeItem m_label_focus, m_label_unfocus, m_label_active; + FbTk::ThemeItem m_label_focus, m_label_unfocus; FbTk::ThemeItem m_title_focus, m_title_unfocus; FbTk::ThemeItem m_handle_focus, m_handle_unfocus; FbTk::ThemeItem m_button_focus, m_button_unfocus, m_button_pressed; FbTk::ThemeItem m_grip_focus, m_grip_unfocus; - FbTk::ThemeItem m_label_focus_color, m_label_unfocus_color, m_label_active_color; + FbTk::ThemeItem m_label_focus_color, m_label_unfocus_color; FbTk::ThemeItem m_button_focus_color, m_button_unfocus_color; FbTk::ThemeItem m_font; @@ -120,7 +117,7 @@ private: FbTk::ThemeItem m_title_height, m_bevel_width, m_handle_width; BorderTheme m_border; - FbTk::GContext m_label_text_focus_gc, m_label_text_unfocus_gc, m_label_text_active_gc; + FbTk::GContext m_label_text_focus_gc, m_label_text_unfocus_gc; FbTk::GContext m_button_pic_focus_gc, m_button_pic_unfocus_gc; Cursor m_cursor_move; -- cgit v0.11.2