aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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 84f47f4..124883e 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -526,7 +526,7 @@ void FbWinFrame::setFocus(bool newvalue) {
526 if (newvalue) // focused 526 if (newvalue) // focused
527 applyFocusLabel(*m_current_label); 527 applyFocusLabel(*m_current_label);
528 else // unfocused 528 else // unfocused
529 applyActiveLabel(*m_current_label); 529 applyUnfocusLabel(*m_current_label);
530 } 530 }
531 531
532 applyAll(); 532 applyAll();
@@ -706,7 +706,7 @@ void FbWinFrame::setLabelButtonFocus(FbTk::TextButton &btn) {
706 if (m_focused) 706 if (m_focused)
707 applyFocusLabel(*m_current_label); 707 applyFocusLabel(*m_current_label);
708 else 708 else
709 applyActiveLabel(*m_current_label); 709 applyUnfocusLabel(*m_current_label);
710} 710}
711 711
712void FbWinFrame::setLabelButtonFocus(FbTk::TextButton &btn, bool value) { 712void FbWinFrame::setLabelButtonFocus(FbTk::TextButton &btn, bool value) {
@@ -1315,10 +1315,6 @@ void FbWinFrame::renderTabContainer() {
1315 m_labelbutton_unfocused_pm, 1315 m_labelbutton_unfocused_pm,
1316 m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation()); 1316 m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation());
1317 1317
1318 render(m_theme.labelActiveTexture(), m_labelbutton_active_color,
1319 m_labelbutton_active_pm,
1320 m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation());
1321
1322 renderButtons(); 1318 renderButtons();
1323 1319
1324} 1320}
@@ -1468,7 +1464,7 @@ void FbWinFrame::init() {
1468 m_title_focused_pm = m_title_unfocused_pm = 0; 1464 m_title_focused_pm = m_title_unfocused_pm = 0;
1469 m_label_focused_pm = m_label_unfocused_pm = 0; 1465 m_label_focused_pm = m_label_unfocused_pm = 0;
1470 m_tabcontainer_focused_pm = m_tabcontainer_unfocused_pm = 0; 1466 m_tabcontainer_focused_pm = m_tabcontainer_unfocused_pm = 0;
1471 m_labelbutton_focused_pm = m_labelbutton_unfocused_pm = m_labelbutton_active_pm = 0; 1467 m_labelbutton_focused_pm = m_labelbutton_unfocused_pm = 0;
1472 m_handle_focused_pm = m_handle_unfocused_pm = 0; 1468 m_handle_focused_pm = m_handle_unfocused_pm = 0;
1473 m_button_pm = m_button_unfocused_pm = m_button_pressed_pm = 0; 1469 m_button_pm = m_button_unfocused_pm = m_button_pressed_pm = 0;
1474 m_grip_unfocused_pm = m_grip_focused_pm = 0; 1470 m_grip_unfocused_pm = m_grip_focused_pm = 0;
@@ -1592,12 +1588,9 @@ void FbWinFrame::applyTabContainer() {
1592 Container::ItemList::iterator btn_it_end = m_tab_container.end(); 1588 Container::ItemList::iterator btn_it_end = m_tab_container.end();
1593 for (; btn_it != btn_it_end; ++btn_it) { 1589 for (; btn_it != btn_it_end; ++btn_it) {
1594 FbTk::TextButton *btn = static_cast<FbTk::TextButton *>(*btn_it); 1590 FbTk::TextButton *btn = static_cast<FbTk::TextButton *>(*btn_it);
1595 if (btn == m_current_label) { 1591 if (btn == m_current_label && m_focused)
1596 if (m_focused) 1592 applyFocusLabel(*btn);
1597 applyFocusLabel(*btn); 1593 else
1598 else
1599 applyActiveLabel(*btn);
1600 } else
1601 applyUnfocusLabel(*btn); 1594 applyUnfocusLabel(*btn);
1602 } 1595 }
1603} 1596}
@@ -1669,19 +1662,6 @@ void FbWinFrame::applyFocusLabel(FbTk::TextButton &button) {
1669 1662
1670} 1663}
1671 1664
1672void FbWinFrame::applyActiveLabel(FbTk::TextButton &button) {
1673
1674 button.setGC(theme().labelTextActiveGC());
1675 button.setJustify(theme().justify());
1676 button.setAlpha(getAlpha(m_focused));
1677
1678 if (m_labelbutton_active_pm != 0) {
1679 button.setBackgroundPixmap(m_labelbutton_active_pm);
1680 } else
1681 button.setBackgroundColor(m_labelbutton_active_color);
1682
1683}
1684
1685void FbWinFrame::applyUnfocusLabel(FbTk::TextButton &button) { 1665void FbWinFrame::applyUnfocusLabel(FbTk::TextButton &button) {
1686 1666
1687 button.setGC(theme().labelTextUnfocusGC()); 1667 button.setGC(theme().labelTextUnfocusGC());
@@ -1695,27 +1675,6 @@ void FbWinFrame::applyUnfocusLabel(FbTk::TextButton &button) {
1695 1675
1696} 1676}
1697 1677
1698namespace {
1699class IgnoreEvent {
1700public:
1701 typedef void result_type;
1702 typedef Window argument_type;
1703 explicit IgnoreEvent(long eventmask):
1704 m_display(FbTk::App::instance()->display()),
1705 m_event_mask(eventmask) {
1706 }
1707
1708 void operator()(Window win) const {
1709 static XEvent event;
1710 while (XCheckWindowEvent(m_display, win, m_event_mask, &event))
1711 continue;
1712 }
1713private:
1714 Display *m_display;
1715 long m_event_mask;
1716};
1717}
1718
1719// this function translates its arguments according to win_gravity 1678// this function translates its arguments according to win_gravity
1720// if win_gravity is negative, it does an inverse translation 1679// if win_gravity is negative, it does an inverse translation
1721// This function should be used when a window is mapped/unmapped/pos configured 1680// 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:
281 void applyTabContainer(); // and label buttons 281 void applyTabContainer(); // and label buttons
282 void applyFocusLabel(FbTk::TextButton &button); 282 void applyFocusLabel(FbTk::TextButton &button);
283 void applyUnfocusLabel(FbTk::TextButton &button); 283 void applyUnfocusLabel(FbTk::TextButton &button);
284 void applyActiveLabel(FbTk::TextButton &button);
285 void applyButtons(); // only called within applyTitlebar 284 void applyButtons(); // only called within applyTitlebar
286 285
287 void getCurrentFocusPixmap(Pixmap &label_pm, Pixmap &title_pm, 286 void getCurrentFocusPixmap(Pixmap &label_pm, Pixmap &title_pm,
@@ -353,8 +352,6 @@ private:
353 FbTk::Color m_labelbutton_focused_color; ///< color for focused label 352 FbTk::Color m_labelbutton_focused_color; ///< color for focused label
354 Pixmap m_labelbutton_unfocused_pm; ///< pixmap for unfocused label 353 Pixmap m_labelbutton_unfocused_pm; ///< pixmap for unfocused label
355 FbTk::Color m_labelbutton_unfocused_color; ///< color for unfocused label 354 FbTk::Color m_labelbutton_unfocused_color; ///< color for unfocused label
356 Pixmap m_labelbutton_active_pm; ///< pixmap for active label
357 FbTk::Color m_labelbutton_active_color; ///< color for active label
358 355
359 FbTk::Color m_handle_focused_color, m_handle_unfocused_color; 356 FbTk::Color m_handle_focused_color, m_handle_unfocused_color;
360 Pixmap m_handle_focused_pm, m_handle_unfocused_pm; 357 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;