diff options
author | markt <markt> | 2007-01-06 19:03:33 (GMT) |
---|---|---|
committer | markt <markt> | 2007-01-06 19:03:33 (GMT) |
commit | 94e2c89053325beeb9f79d2e682adf614f636ca8 (patch) | |
tree | b778a387684ef8baef35e318c75de1810408a7f4 /src | |
parent | 8db2d4f26eae2d608e864aabf6218ad461c4da6b (diff) | |
download | fluxbox-94e2c89053325beeb9f79d2e682adf614f636ca8.zip fluxbox-94e2c89053325beeb9f79d2e682adf614f636ca8.tar.bz2 |
make "force pseudotransparency" menu item work immediately
Diffstat (limited to 'src')
-rw-r--r-- | src/FbTk/Menu.cc | 12 | ||||
-rw-r--r-- | src/FbTk/Transparent.cc | 42 | ||||
-rw-r--r-- | src/FbTk/Transparent.hh | 3 | ||||
-rw-r--r-- | src/FbWinFrame.cc | 25 | ||||
-rw-r--r-- | src/Slit.cc | 3 | ||||
-rw-r--r-- | src/Toolbar.cc | 3 | ||||
-rw-r--r-- | src/fluxbox.cc | 5 |
7 files changed, 49 insertions, 44 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index 9206ade..e7fc6d8 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc | |||
@@ -1099,14 +1099,18 @@ void Menu::keyPressEvent(XKeyEvent &event) { | |||
1099 | 1099 | ||
1100 | void Menu::reconfigure() { | 1100 | void Menu::reconfigure() { |
1101 | 1101 | ||
1102 | if (FbTk::Transparent::haveComposite()) | 1102 | if (FbTk::Transparent::haveComposite()) { |
1103 | menu.window.setOpaque(alpha()); | 1103 | menu.window.setOpaque(alpha()); |
1104 | menu.title.setAlpha(255); | ||
1105 | menu.frame.setAlpha(255); | ||
1106 | } else { | ||
1107 | menu.window.setOpaque(255); | ||
1108 | menu.title.setAlpha(alpha()); | ||
1109 | menu.frame.setAlpha(alpha()); | ||
1110 | } | ||
1104 | 1111 | ||
1105 | m_need_update = true; // redraw items | 1112 | m_need_update = true; // redraw items |
1106 | 1113 | ||
1107 | menu.title.setAlpha(alpha()); | ||
1108 | menu.frame.setAlpha(alpha()); | ||
1109 | |||
1110 | menu.window.setBorderColor(theme().borderColor()); | 1114 | menu.window.setBorderColor(theme().borderColor()); |
1111 | menu.title.setBorderColor(theme().borderColor()); | 1115 | menu.title.setBorderColor(theme().borderColor()); |
1112 | menu.frame.setBorderColor(theme().borderColor()); | 1116 | menu.frame.setBorderColor(theme().borderColor()); |
diff --git a/src/FbTk/Transparent.cc b/src/FbTk/Transparent.cc index 6563d5a..d80b2b2 100644 --- a/src/FbTk/Transparent.cc +++ b/src/FbTk/Transparent.cc | |||
@@ -112,6 +112,7 @@ namespace FbTk { | |||
112 | bool Transparent::s_init = false; | 112 | bool Transparent::s_init = false; |
113 | bool Transparent::s_render = false; | 113 | bool Transparent::s_render = false; |
114 | bool Transparent::s_composite = false; | 114 | bool Transparent::s_composite = false; |
115 | bool Transparent::s_use_composite = false; | ||
115 | 116 | ||
116 | void Transparent::init() { | 117 | void Transparent::init() { |
117 | Display *disp = FbTk::App::instance()->display(); | 118 | Display *disp = FbTk::App::instance()->display(); |
@@ -119,48 +120,35 @@ void Transparent::init() { | |||
119 | int major_opcode, first_event, first_error; | 120 | int major_opcode, first_event, first_error; |
120 | if (XQueryExtension(disp, "RENDER", | 121 | if (XQueryExtension(disp, "RENDER", |
121 | &major_opcode, | 122 | &major_opcode, |
122 | &first_event, &first_error) == False) { | 123 | &first_event, &first_error)) { |
123 | s_render = false; | 124 | // we have XRENDER support |
124 | s_composite = false; | ||
125 | } else { // we have RENDER support | ||
126 | s_render = true; | 125 | s_render = true; |
127 | 126 | ||
128 | if (XQueryExtension(disp, "Composite", | 127 | if (XQueryExtension(disp, "Composite", |
129 | &major_opcode, | 128 | &major_opcode, |
130 | &first_event, &first_error) == False) { | 129 | &first_event, &first_error)) { |
131 | s_composite = false; | 130 | // we have Composite support |
132 | } else { // we have Composite support | ||
133 | s_composite = true; | 131 | s_composite = true; |
132 | s_use_composite = true; | ||
134 | } | 133 | } |
135 | } | 134 | } |
136 | s_init = true; | 135 | s_init = true; |
137 | } | 136 | } |
138 | 137 | ||
139 | void Transparent::usePseudoTransparent(bool no_composite) { | 138 | void Transparent::usePseudoTransparent(bool force) { |
140 | if (s_composite != no_composite) | 139 | if (!s_init) |
141 | return; | 140 | init(); |
142 | 141 | s_use_composite = (!force && s_composite); | |
143 | s_init = false; | ||
144 | init(); // only use render if we have it | ||
145 | |||
146 | if (no_composite) | ||
147 | s_composite = false; | ||
148 | } | 142 | } |
149 | 143 | ||
150 | bool Transparent::haveComposite(bool for_real) { | 144 | bool Transparent::haveComposite(bool for_real) { |
151 | if (for_real) { | 145 | if (!s_init) |
152 | Display *disp = FbTk::App::instance()->display(); | 146 | init(); |
153 | int major_opcode, first_event, first_error; | ||
154 | |||
155 | return (XQueryExtension(disp, "Composite", | ||
156 | &major_opcode, | ||
157 | &first_event, &first_error) == True); | ||
158 | } else { | ||
159 | if (!s_init) | ||
160 | init(); | ||
161 | 147 | ||
148 | if (for_real) | ||
162 | return s_composite; | 149 | return s_composite; |
163 | } | 150 | else |
151 | return s_use_composite; | ||
164 | } | 152 | } |
165 | 153 | ||
166 | Transparent::Transparent(Drawable src, Drawable dest, unsigned char alpha, int screen_num): | 154 | Transparent::Transparent(Drawable src, Drawable dest, unsigned char alpha, int screen_num): |
diff --git a/src/FbTk/Transparent.hh b/src/FbTk/Transparent.hh index 77e09c5..3720b33 100644 --- a/src/FbTk/Transparent.hh +++ b/src/FbTk/Transparent.hh | |||
@@ -53,7 +53,7 @@ public: | |||
53 | 53 | ||
54 | static bool haveComposite(bool for_real = false); | 54 | static bool haveComposite(bool for_real = false); |
55 | static bool haveRender() { if (!s_init) init(); return s_render; } | 55 | static bool haveRender() { if (!s_init) init(); return s_render; } |
56 | static void usePseudoTransparent(bool no_composite); | 56 | static void usePseudoTransparent(bool force); |
57 | 57 | ||
58 | private: | 58 | private: |
59 | void freeAlpha(); | 59 | void freeAlpha(); |
@@ -67,6 +67,7 @@ private: | |||
67 | static bool s_init; | 67 | static bool s_init; |
68 | static bool s_render; ///< wheter we have RENDER support | 68 | static bool s_render; ///< wheter we have RENDER support |
69 | static bool s_composite; ///< wheter we have Composite support | 69 | static bool s_composite; ///< wheter we have Composite support |
70 | static bool s_use_composite; ///< whether or not to use Composite | ||
70 | static void init(); | 71 | static void init(); |
71 | }; | 72 | }; |
72 | 73 | ||
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index b7f2e6b..e41d1df 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc | |||
@@ -508,9 +508,11 @@ void FbWinFrame::setFocus(bool newvalue) { | |||
508 | if (FbTk::Transparent::haveRender() && theme().focusedAlpha() != theme().unfocusedAlpha()) { | 508 | if (FbTk::Transparent::haveRender() && theme().focusedAlpha() != theme().unfocusedAlpha()) { |
509 | unsigned char alpha = (m_focused?theme().focusedAlpha():theme().unfocusedAlpha()); | 509 | unsigned char alpha = (m_focused?theme().focusedAlpha():theme().unfocusedAlpha()); |
510 | if (FbTk::Transparent::haveComposite()) { | 510 | if (FbTk::Transparent::haveComposite()) { |
511 | m_tab_container.setAlpha(255); | ||
511 | m_window.setOpaque(alpha); | 512 | m_window.setOpaque(alpha); |
512 | } else { | 513 | } else { |
513 | m_tab_container.setAlpha(alpha); | 514 | m_tab_container.setAlpha(alpha); |
515 | m_window.setOpaque(255); | ||
514 | } | 516 | } |
515 | } | 517 | } |
516 | 518 | ||
@@ -521,9 +523,7 @@ void FbWinFrame::setFocus(bool newvalue) { | |||
521 | applyActiveLabel(*m_current_label); | 523 | applyActiveLabel(*m_current_label); |
522 | } | 524 | } |
523 | 525 | ||
524 | applyTitlebar(); | 526 | applyAll(); |
525 | applyHandles(); | ||
526 | applyTabContainer(); | ||
527 | clearAll(); | 527 | clearAll(); |
528 | } | 528 | } |
529 | 529 | ||
@@ -1053,6 +1053,18 @@ void FbWinFrame::reconfigure() { | |||
1053 | 1053 | ||
1054 | // render the theme | 1054 | // render the theme |
1055 | if (isVisible()) { | 1055 | if (isVisible()) { |
1056 | // update transparency settings | ||
1057 | if (FbTk::Transparent::haveRender()) { | ||
1058 | unsigned char alpha = | ||
1059 | (m_focused ? theme().focusedAlpha() : theme().unfocusedAlpha()); | ||
1060 | if (FbTk::Transparent::haveComposite()) { | ||
1061 | m_tab_container.setAlpha(255); | ||
1062 | m_window.setOpaque(alpha); | ||
1063 | } else { | ||
1064 | m_tab_container.setAlpha(alpha); | ||
1065 | m_window.setOpaque(255); | ||
1066 | } | ||
1067 | } | ||
1056 | renderAll(); | 1068 | renderAll(); |
1057 | applyAll(); | 1069 | applyAll(); |
1058 | clearAll(); | 1070 | clearAll(); |
@@ -1391,13 +1403,6 @@ void FbWinFrame::applyButtons() { | |||
1391 | 1403 | ||
1392 | void FbWinFrame::init() { | 1404 | void FbWinFrame::init() { |
1393 | 1405 | ||
1394 | if (FbTk::Transparent::haveComposite()) { | ||
1395 | if (m_focused) | ||
1396 | m_window.setOpaque(theme().focusedAlpha()); | ||
1397 | else | ||
1398 | m_window.setOpaque(theme().unfocusedAlpha()); | ||
1399 | } | ||
1400 | |||
1401 | if (theme().handleWidth() == 0) | 1406 | if (theme().handleWidth() == 0) |
1402 | m_use_handle = false; | 1407 | m_use_handle = false; |
1403 | 1408 | ||
diff --git a/src/Slit.cc b/src/Slit.cc index 8542dca..e95708e 100644 --- a/src/Slit.cc +++ b/src/Slit.cc | |||
@@ -707,10 +707,13 @@ void Slit::reconfigure() { | |||
707 | if (tmp) | 707 | if (tmp) |
708 | image_ctrl.removeImage(tmp); | 708 | image_ctrl.removeImage(tmp); |
709 | 709 | ||
710 | // could have changed types, so we must set both | ||
710 | if (FbTk::Transparent::haveComposite()) { | 711 | if (FbTk::Transparent::haveComposite()) { |
712 | frame.window.setAlpha(255); | ||
711 | frame.window.setOpaque(*m_rc_alpha); | 713 | frame.window.setOpaque(*m_rc_alpha); |
712 | } else { | 714 | } else { |
713 | frame.window.setAlpha(*m_rc_alpha); | 715 | frame.window.setAlpha(*m_rc_alpha); |
716 | frame.window.setOpaque(255); | ||
714 | } | 717 | } |
715 | // reposition clears the bg | 718 | // reposition clears the bg |
716 | reposition(); | 719 | reposition(); |
diff --git a/src/Toolbar.cc b/src/Toolbar.cc index df5bf44..c0d3f88 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc | |||
@@ -477,9 +477,12 @@ void Toolbar::reconfigure() { | |||
477 | frame.window.setBorderWidth(theme().border().width()); | 477 | frame.window.setBorderWidth(theme().border().width()); |
478 | 478 | ||
479 | bool have_composite = FbTk::Transparent::haveComposite(); | 479 | bool have_composite = FbTk::Transparent::haveComposite(); |
480 | // have_composite could have changed, so we need to change both | ||
480 | if (have_composite) { | 481 | if (have_composite) { |
481 | frame.window.setOpaque(alpha()); | 482 | frame.window.setOpaque(alpha()); |
483 | frame.window.setAlpha(255); | ||
482 | } else { | 484 | } else { |
485 | frame.window.setOpaque(255); | ||
483 | frame.window.setAlpha(alpha()); | 486 | frame.window.setAlpha(alpha()); |
484 | } | 487 | } |
485 | frame.window.clear(); | 488 | frame.window.clear(); |
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index a8290e5..723c6e0 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc | |||
@@ -1569,8 +1569,7 @@ void Fluxbox::load_rc() { | |||
1569 | if (m_rc_menufile->empty()) | 1569 | if (m_rc_menufile->empty()) |
1570 | m_rc_menufile.setDefaultValue(); | 1570 | m_rc_menufile.setDefaultValue(); |
1571 | 1571 | ||
1572 | if (FbTk::Transparent::haveComposite()) | 1572 | FbTk::Transparent::usePseudoTransparent(*m_rc_pseudotrans); |
1573 | FbTk::Transparent::usePseudoTransparent(*m_rc_pseudotrans); | ||
1574 | 1573 | ||
1575 | if (!m_rc_slitlistfile->empty()) { | 1574 | if (!m_rc_slitlistfile->empty()) { |
1576 | *m_rc_slitlistfile = StringUtil::expandFilename(*m_rc_slitlistfile); | 1575 | *m_rc_slitlistfile = StringUtil::expandFilename(*m_rc_slitlistfile); |
@@ -1670,6 +1669,8 @@ void Fluxbox::reconfigure() { | |||
1670 | 1669 | ||
1671 | void Fluxbox::real_reconfigure() { | 1670 | void Fluxbox::real_reconfigure() { |
1672 | 1671 | ||
1672 | FbTk::Transparent::usePseudoTransparent(*m_rc_pseudotrans); | ||
1673 | |||
1673 | ScreenList::iterator screen_it = m_screen_list.begin(); | 1674 | ScreenList::iterator screen_it = m_screen_list.begin(); |
1674 | ScreenList::iterator screen_it_end = m_screen_list.end(); | 1675 | ScreenList::iterator screen_it_end = m_screen_list.end(); |
1675 | for (; screen_it != screen_it_end; ++screen_it) | 1676 | for (; screen_it != screen_it_end; ++screen_it) |