aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/FbTk/Resource.cc10
-rw-r--r--src/FbWinFrame.cc53
-rw-r--r--src/FbWinFrame.hh3
-rw-r--r--src/FbWinFrameTheme.cc12
-rw-r--r--src/FbWinFrameTheme.hh9
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) {
107*/ 107*/
108bool ResourceManager::save(const char *filename, const char *mergefilename) { 108bool ResourceManager::save(const char *filename, const char *mergefilename) {
109 assert(filename); 109 assert(filename);
110 filename = StringUtil::expandFilename(filename).c_str(); 110
111 // these must be local variables; otherwise, the memory gets released by
112 // std::string, causing weird issues
113 string file_str = StringUtil::expandFilename(filename), mergefile_str;
114 filename = file_str.c_str();
115 if (mergefilename) {
116 mergefile_str = StringUtil::expandFilename(mergefilename);
117 mergefilename = mergefile_str.c_str();
118 }
111 119
112 // empty database 120 // empty database
113 XrmDatabaseHelper database; 121 XrmDatabaseHelper database;
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index 99dd93d..68adc0f 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -525,7 +525,7 @@ void FbWinFrame::setFocus(bool newvalue) {
525 if (newvalue) // focused 525 if (newvalue) // focused
526 applyFocusLabel(*m_current_label); 526 applyFocusLabel(*m_current_label);
527 else // unfocused 527 else // unfocused
528 applyActiveLabel(*m_current_label); 528 applyUnfocusLabel(*m_current_label);
529 } 529 }
530 530
531 applyAll(); 531 applyAll();
@@ -711,7 +711,7 @@ void FbWinFrame::setLabelButtonFocus(FbTk::TextButton &btn) {
711 if (m_focused) 711 if (m_focused)
712 applyFocusLabel(*m_current_label); 712 applyFocusLabel(*m_current_label);
713 else 713 else
714 applyActiveLabel(*m_current_label); 714 applyUnfocusLabel(*m_current_label);
715} 715}
716 716
717void FbWinFrame::setLabelButtonFocus(FbTk::TextButton &btn, bool value) { 717void FbWinFrame::setLabelButtonFocus(FbTk::TextButton &btn, bool value) {
@@ -1320,10 +1320,6 @@ void FbWinFrame::renderTabContainer() {
1320 m_labelbutton_unfocused_pm, 1320 m_labelbutton_unfocused_pm,
1321 m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation()); 1321 m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation());
1322 1322
1323 render(m_theme.labelActiveTexture(), m_labelbutton_active_color,
1324 m_labelbutton_active_pm,
1325 m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation());
1326
1327 renderButtons(); 1323 renderButtons();
1328 1324
1329} 1325}
@@ -1473,7 +1469,7 @@ void FbWinFrame::init() {
1473 m_title_focused_pm = m_title_unfocused_pm = 0; 1469 m_title_focused_pm = m_title_unfocused_pm = 0;
1474 m_label_focused_pm = m_label_unfocused_pm = 0; 1470 m_label_focused_pm = m_label_unfocused_pm = 0;
1475 m_tabcontainer_focused_pm = m_tabcontainer_unfocused_pm = 0; 1471 m_tabcontainer_focused_pm = m_tabcontainer_unfocused_pm = 0;
1476 m_labelbutton_focused_pm = m_labelbutton_unfocused_pm = m_labelbutton_active_pm = 0; 1472 m_labelbutton_focused_pm = m_labelbutton_unfocused_pm = 0;
1477 m_handle_focused_pm = m_handle_unfocused_pm = 0; 1473 m_handle_focused_pm = m_handle_unfocused_pm = 0;
1478 m_button_pm = m_button_unfocused_pm = m_button_pressed_pm = 0; 1474 m_button_pm = m_button_unfocused_pm = m_button_pressed_pm = 0;
1479 m_grip_unfocused_pm = m_grip_focused_pm = 0; 1475 m_grip_unfocused_pm = m_grip_focused_pm = 0;
@@ -1597,12 +1593,9 @@ void FbWinFrame::applyTabContainer() {
1597 Container::ItemList::iterator btn_it_end = m_tab_container.end(); 1593 Container::ItemList::iterator btn_it_end = m_tab_container.end();
1598 for (; btn_it != btn_it_end; ++btn_it) { 1594 for (; btn_it != btn_it_end; ++btn_it) {
1599 FbTk::TextButton *btn = static_cast<FbTk::TextButton *>(*btn_it); 1595 FbTk::TextButton *btn = static_cast<FbTk::TextButton *>(*btn_it);
1600 if (btn == m_current_label) { 1596 if (btn == m_current_label && m_focused)
1601 if (m_focused) 1597 applyFocusLabel(*btn);
1602 applyFocusLabel(*btn); 1598 else
1603 else
1604 applyActiveLabel(*btn);
1605 } else
1606 applyUnfocusLabel(*btn); 1599 applyUnfocusLabel(*btn);
1607 } 1600 }
1608} 1601}
@@ -1674,19 +1667,6 @@ void FbWinFrame::applyFocusLabel(FbTk::TextButton &button) {
1674 1667
1675} 1668}
1676 1669
1677void FbWinFrame::applyActiveLabel(FbTk::TextButton &button) {
1678
1679 button.setGC(theme().labelTextActiveGC());
1680 button.setJustify(theme().justify());
1681 button.setAlpha(getAlpha(m_focused));
1682
1683 if (m_labelbutton_active_pm != 0) {
1684 button.setBackgroundPixmap(m_labelbutton_active_pm);
1685 } else
1686 button.setBackgroundColor(m_labelbutton_active_color);
1687
1688}
1689
1690void FbWinFrame::applyUnfocusLabel(FbTk::TextButton &button) { 1670void FbWinFrame::applyUnfocusLabel(FbTk::TextButton &button) {
1691 1671
1692 button.setGC(theme().labelTextUnfocusGC()); 1672 button.setGC(theme().labelTextUnfocusGC());
@@ -1700,27 +1680,6 @@ void FbWinFrame::applyUnfocusLabel(FbTk::TextButton &button) {
1700 1680
1701} 1681}
1702 1682
1703namespace {
1704class IgnoreEvent {
1705public:
1706 typedef void result_type;
1707 typedef Window argument_type;
1708 explicit IgnoreEvent(long eventmask):
1709 m_display(FbTk::App::instance()->display()),
1710 m_event_mask(eventmask) {
1711 }
1712
1713 void operator()(Window win) const {
1714 static XEvent event;
1715 while (XCheckWindowEvent(m_display, win, m_event_mask, &event))
1716 continue;
1717 }
1718private:
1719 Display *m_display;
1720 long m_event_mask;
1721};
1722}
1723
1724// this function translates its arguments according to win_gravity 1683// this function translates its arguments according to win_gravity
1725// if win_gravity is negative, it does an inverse translation 1684// if win_gravity is negative, it does an inverse translation
1726// This function should be used when a window is mapped/unmapped/pos configured 1685// This function should be used when a window is mapped/unmapped/pos configured
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh
index 182add4..2ea3542 100644
--- a/src/FbWinFrame.hh
+++ b/src/FbWinFrame.hh
@@ -282,7 +282,6 @@ private:
282 void applyTabContainer(); // and label buttons 282 void applyTabContainer(); // and label buttons
283 void applyFocusLabel(FbTk::TextButton &button); 283 void applyFocusLabel(FbTk::TextButton &button);
284 void applyUnfocusLabel(FbTk::TextButton &button); 284 void applyUnfocusLabel(FbTk::TextButton &button);
285 void applyActiveLabel(FbTk::TextButton &button);
286 void applyButtons(); // only called within applyTitlebar 285 void applyButtons(); // only called within applyTitlebar
287 286
288 void getCurrentFocusPixmap(Pixmap &label_pm, Pixmap &title_pm, 287 void getCurrentFocusPixmap(Pixmap &label_pm, Pixmap &title_pm,
@@ -355,8 +354,6 @@ private:
355 FbTk::Color m_labelbutton_focused_color; ///< color for focused label 354 FbTk::Color m_labelbutton_focused_color; ///< color for focused label
356 Pixmap m_labelbutton_unfocused_pm; ///< pixmap for unfocused label 355 Pixmap m_labelbutton_unfocused_pm; ///< pixmap for unfocused label
357 FbTk::Color m_labelbutton_unfocused_color; ///< color for unfocused label 356 FbTk::Color m_labelbutton_unfocused_color; ///< color for unfocused label
358 Pixmap m_labelbutton_active_pm; ///< pixmap for active label
359 FbTk::Color m_labelbutton_active_color; ///< color for active label
360 357
361 FbTk::Color m_handle_focused_color, m_handle_unfocused_color; 358 FbTk::Color m_handle_focused_color, m_handle_unfocused_color;
362 Pixmap m_handle_focused_pm, m_handle_unfocused_pm; 359 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):
30 FbTk::Theme(screen_num), 30 FbTk::Theme(screen_num),
31 m_label_focus(*this, "window.label.focus", "Window.Label.Focus"), 31 m_label_focus(*this, "window.label.focus", "Window.Label.Focus"),
32 m_label_unfocus(*this, "window.label.unfocus", "Window.Label.Unfocus"), 32 m_label_unfocus(*this, "window.label.unfocus", "Window.Label.Unfocus"),
33 m_label_active(*this, "window.label.active", "Window.Label.Active"),
34 33
35 m_title_focus(*this, "window.title.focus", "Window.Title.Focus"), 34 m_title_focus(*this, "window.title.focus", "Window.Title.Focus"),
36 m_title_unfocus(*this, "window.title.unfocus", "Window.Title.Unfocus"), 35 m_title_unfocus(*this, "window.title.unfocus", "Window.Title.Unfocus"),
@@ -47,7 +46,6 @@ FbWinFrameTheme::FbWinFrameTheme(int screen_num):
47 46
48 m_label_focus_color(*this, "window.label.focus.textColor", "Window.Label.Focus.TextColor"), 47 m_label_focus_color(*this, "window.label.focus.textColor", "Window.Label.Focus.TextColor"),
49 m_label_unfocus_color(*this, "window.label.unfocus.textColor", "Window.Label.Unfocus.TextColor"), 48 m_label_unfocus_color(*this, "window.label.unfocus.textColor", "Window.Label.Unfocus.TextColor"),
50 m_label_active_color(*this, "window.label.active.textColor", "Window.Label.Active.TextColor"),
51 49
52 m_button_focus_color(*this, "window.button.focus.picColor", "Window.Button.Focus.PicColor"), 50 m_button_focus_color(*this, "window.button.focus.picColor", "Window.Button.Focus.PicColor"),
53 m_button_unfocus_color(*this, "window.button.unfocus.picColor", "Window.Button.Unfocus.PicColor"), 51 m_button_unfocus_color(*this, "window.button.unfocus.picColor", "Window.Button.Unfocus.PicColor"),
@@ -61,7 +59,6 @@ FbWinFrameTheme::FbWinFrameTheme(int screen_num):
61 m_border(*this, "window", "Window"), // for window.border* 59 m_border(*this, "window", "Window"), // for window.border*
62 m_label_text_focus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)), 60 m_label_text_focus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)),
63 m_label_text_unfocus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)), 61 m_label_text_unfocus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)),
64 m_label_text_active_gc(RootWindow(FbTk::App::instance()->display(), screen_num)),
65 m_button_pic_focus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)), 62 m_button_pic_focus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)),
66 m_button_pic_unfocus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)), 63 m_button_pic_unfocus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)),
67 m_focused_alpha(255), 64 m_focused_alpha(255),
@@ -95,14 +92,6 @@ bool FbWinFrameTheme::fallback(FbTk::ThemeItem_base &item) {
95 return FbTk::ThemeManager::instance().loadItem(item, "bevelWidth", "bevelWidth"); 92 return FbTk::ThemeManager::instance().loadItem(item, "bevelWidth", "bevelWidth");
96 else if (item.name() == "window.handleWidth") 93 else if (item.name() == "window.handleWidth")
97 return FbTk::ThemeManager::instance().loadItem(item, "handleWidth", "HandleWidth"); 94 return FbTk::ThemeManager::instance().loadItem(item, "handleWidth", "HandleWidth");
98 else if (item.name() == "window.label.active") {
99 // copy texture
100 *m_label_active = *m_label_unfocus;
101 return true;
102 } else if (item.name() == "window.label.active.textColor") {
103 return FbTk::ThemeManager::instance().loadItem(item, "window.label.unfocus.textColor",
104 "Window.Label.Unfocus.TextColor");
105 }
106 95
107 return false; 96 return false;
108} 97}
@@ -120,7 +109,6 @@ void FbWinFrameTheme::reconfigTheme() {
120 109
121 m_label_text_focus_gc.setForeground(*m_label_focus_color); 110 m_label_text_focus_gc.setForeground(*m_label_focus_color);
122 m_label_text_unfocus_gc.setForeground(*m_label_unfocus_color); 111 m_label_text_unfocus_gc.setForeground(*m_label_unfocus_color);
123 m_label_text_active_gc.setForeground(*m_label_active_color);
124 m_button_pic_focus_gc.setForeground(*m_button_focus_color); 112 m_button_pic_focus_gc.setForeground(*m_button_focus_color);
125 m_button_pic_unfocus_gc.setForeground(*m_button_unfocus_color); 113 m_button_pic_unfocus_gc.setForeground(*m_button_unfocus_color);
126} 114}
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:
45 //@{ 45 //@{
46 const FbTk::Texture &labelFocusTexture() const { return *m_label_focus; } 46 const FbTk::Texture &labelFocusTexture() const { return *m_label_focus; }
47 const FbTk::Texture &labelUnfocusTexture() const { return *m_label_unfocus; } 47 const FbTk::Texture &labelUnfocusTexture() const { return *m_label_unfocus; }
48 const FbTk::Texture &labelActiveTexture() const { return *m_label_active; }
49 const FbTk::ThemeItem<FbTk::Texture> &label() const { return m_label_unfocus; } 48 const FbTk::ThemeItem<FbTk::Texture> &label() const { return m_label_unfocus; }
50 const FbTk::Texture &titleFocusTexture() const { return *m_title_focus; } 49 const FbTk::Texture &titleFocusTexture() const { return *m_title_focus; }
51 const FbTk::Texture &titleUnfocusTexture() const { return *m_title_unfocus; } 50 const FbTk::Texture &titleUnfocusTexture() const { return *m_title_unfocus; }
@@ -67,7 +66,6 @@ public:
67 //@{ 66 //@{
68 const FbTk::Color &labelFocusColor() const { return *m_label_focus_color; } 67 const FbTk::Color &labelFocusColor() const { return *m_label_focus_color; }
69 const FbTk::Color &labelUnfocusColor() const { return *m_label_unfocus_color; } 68 const FbTk::Color &labelUnfocusColor() const { return *m_label_unfocus_color; }
70 const FbTk::Color &labelActiveColor() const { return *m_label_active_color; }
71 69
72 const FbTk::Color &buttonFocuscolor() const { return *m_button_focus_color; } 70 const FbTk::Color &buttonFocuscolor() const { return *m_button_focus_color; }
73 const FbTk::Color &buttonUnfocuscolor() const { return *m_button_unfocus_color; } 71 const FbTk::Color &buttonUnfocuscolor() const { return *m_button_unfocus_color; }
@@ -78,7 +76,6 @@ public:
78 76
79 GC labelTextFocusGC() const { return m_label_text_focus_gc.gc(); } 77 GC labelTextFocusGC() const { return m_label_text_focus_gc.gc(); }
80 GC labelTextUnfocusGC() const { return m_label_text_unfocus_gc.gc(); } 78 GC labelTextUnfocusGC() const { return m_label_text_unfocus_gc.gc(); }
81 GC labelTextActiveGC() const { return m_label_text_active_gc.gc(); }
82 GC buttonPicFocusGC() const { return m_button_pic_focus_gc.gc(); } 79 GC buttonPicFocusGC() const { return m_button_pic_focus_gc.gc(); }
83 GC buttonPicUnfocusGC() const { return m_button_pic_unfocus_gc.gc(); } 80 GC buttonPicUnfocusGC() const { return m_button_pic_unfocus_gc.gc(); }
84 81
@@ -104,13 +101,13 @@ public:
104 void setUnfocusedAlpha(unsigned char alpha) { m_unfocused_alpha = alpha; } 101 void setUnfocusedAlpha(unsigned char alpha) { m_unfocused_alpha = alpha; }
105 102
106private: 103private:
107 FbTk::ThemeItem<FbTk::Texture> m_label_focus, m_label_unfocus, m_label_active; 104 FbTk::ThemeItem<FbTk::Texture> m_label_focus, m_label_unfocus;
108 FbTk::ThemeItem<FbTk::Texture> m_title_focus, m_title_unfocus; 105 FbTk::ThemeItem<FbTk::Texture> m_title_focus, m_title_unfocus;
109 FbTk::ThemeItem<FbTk::Texture> m_handle_focus, m_handle_unfocus; 106 FbTk::ThemeItem<FbTk::Texture> m_handle_focus, m_handle_unfocus;
110 FbTk::ThemeItem<FbTk::Texture> m_button_focus, m_button_unfocus, m_button_pressed; 107 FbTk::ThemeItem<FbTk::Texture> m_button_focus, m_button_unfocus, m_button_pressed;
111 FbTk::ThemeItem<FbTk::Texture> m_grip_focus, m_grip_unfocus; 108 FbTk::ThemeItem<FbTk::Texture> m_grip_focus, m_grip_unfocus;
112 109
113 FbTk::ThemeItem<FbTk::Color> m_label_focus_color, m_label_unfocus_color, m_label_active_color; 110 FbTk::ThemeItem<FbTk::Color> m_label_focus_color, m_label_unfocus_color;
114 FbTk::ThemeItem<FbTk::Color> m_button_focus_color, m_button_unfocus_color; 111 FbTk::ThemeItem<FbTk::Color> m_button_focus_color, m_button_unfocus_color;
115 112
116 FbTk::ThemeItem<FbTk::Font> m_font; 113 FbTk::ThemeItem<FbTk::Font> m_font;
@@ -120,7 +117,7 @@ private:
120 FbTk::ThemeItem<int> m_title_height, m_bevel_width, m_handle_width; 117 FbTk::ThemeItem<int> m_title_height, m_bevel_width, m_handle_width;
121 BorderTheme m_border; 118 BorderTheme m_border;
122 119
123 FbTk::GContext m_label_text_focus_gc, m_label_text_unfocus_gc, m_label_text_active_gc; 120 FbTk::GContext m_label_text_focus_gc, m_label_text_unfocus_gc;
124 FbTk::GContext m_button_pic_focus_gc, m_button_pic_unfocus_gc; 121 FbTk::GContext m_button_pic_focus_gc, m_button_pic_unfocus_gc;
125 122
126 Cursor m_cursor_move; 123 Cursor m_cursor_move;