From 5e87ca1ea430fe325d58d388af2543783e6dd640 Mon Sep 17 00:00:00 2001 From: rathnor Date: Sat, 10 Jan 2004 00:37:35 +0000 Subject: fix some minor transparency issues --- ChangeLog | 3 +++ src/FbWinFrame.cc | 28 ++++++++++------------------ src/WinButton.cc | 37 +++++++++++++++++++++---------------- src/WinButton.hh | 4 ++-- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index b2d35fb..b044eb5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ (Format: Year/Month/Day) Changes for 0.9.8: +*04/01/10: + * Fix a number of transparency issues for window frames (Simon) + FbWinFrame.cc WinButton.hh/cc *04/01/09: * Fixed color parse bug (Henrik) removing whitespaces diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index fed91f9..36c8e81 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWinFrame.cc,v 1.68 2004/01/02 13:26:44 fluxgen Exp $ +// $Id: FbWinFrame.cc,v 1.69 2004/01/10 00:37:35 rathnor Exp $ #include "FbWinFrame.hh" @@ -560,7 +560,10 @@ void FbWinFrame::buttonReleaseEvent(XButtonEvent &event) { } void FbWinFrame::exposeEvent(XExposeEvent &event) { - if (m_label == event.window) { + if (m_titlebar == event.window) { + m_titlebar.clearArea(event.x, event.y, event.width, event.height); + m_titlebar.updateTransparent(event.x, event.y, event.width, event.height); + } else if (m_label == event.window) { m_label.clearArea(event.x, event.y, event.width, event.height); m_label.updateTransparent(event.x, event.y, event.width, event.height); } else if (m_handle == event.window) { @@ -853,7 +856,6 @@ void FbWinFrame::renderTitlebar() { getCurrentFocusPixmap(label_pm, title_pm, label_color, title_color); - if (label_pm != 0) m_label.setBackgroundPixmap(label_pm); else @@ -864,6 +866,9 @@ void FbWinFrame::renderTitlebar() { else m_titlebar.setBackgroundColor(title_color); + m_titlebar.setAlpha(theme().alpha()); + m_label.setAlpha(theme().alpha()); + renderLabelButtons(); redrawTitlebar(); } @@ -921,16 +926,8 @@ void FbWinFrame::renderHandles() { } m_handle.setAlpha(theme().alpha()); - m_handle.clear(); - m_handle.updateTransparent(); - m_grip_left.setAlpha(theme().alpha()); - m_grip_left.clear(); - m_grip_left.updateTransparent(); - m_grip_right.setAlpha(theme().alpha()); - m_grip_right.clear(); - m_grip_right.updateTransparent(); } @@ -1160,8 +1157,6 @@ void FbWinFrame::renderButtonFocus(FbTk::TextButton &button) { } else button.setBackgroundColor(m_label_focused_color); - button.clear(); - button.updateTransparent(); } void FbWinFrame::renderButtonActive(FbTk::TextButton &button) { @@ -1178,8 +1173,6 @@ void FbWinFrame::renderButtonActive(FbTk::TextButton &button) { } else button.setBackgroundColor(m_label_active_color); - button.clear(); - button.updateTransparent(); } void FbWinFrame::renderButtonUnfocus(FbTk::TextButton &button) { @@ -1196,15 +1189,13 @@ void FbWinFrame::renderButtonUnfocus(FbTk::TextButton &button) { } else button.setBackgroundColor(m_label_unfocused_color); - button.clear(); - button.updateTransparent(); } void FbWinFrame::updateTransparent() { redrawTitlebar(); ButtonList::iterator button_it = m_buttons_left.begin(); - ButtonList::iterator button_it_end = m_buttons_left.begin(); + ButtonList::iterator button_it_end = m_buttons_left.end(); for (; button_it != button_it_end; ++button_it) { (*button_it)->clear(); (*button_it)->updateTransparent(); @@ -1223,6 +1214,7 @@ void FbWinFrame::updateTransparent() { m_grip_right.updateTransparent(); m_handle.clear(); m_handle.updateTransparent(); + } diff --git a/src/WinButton.cc b/src/WinButton.cc index 900d23e..6af0dae 100644 --- a/src/WinButton.cc +++ b/src/WinButton.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -/// $Id: WinButton.cc,v 1.16 2003/10/31 19:32:40 rathnor Exp $ +/// $Id: WinButton.cc,v 1.17 2004/01/10 00:37:35 rathnor Exp $ #include "WinButton.hh" #include "App.hh" @@ -39,15 +39,17 @@ WinButton::WinButton(const FluxboxWindow &listen_to, void WinButton::exposeEvent(XExposeEvent &event) { FbTk::Button::exposeEvent(event); - drawType(); + drawType(false, false); } void WinButton::buttonReleaseEvent(XButtonEvent &event) { FbTk::Button::buttonReleaseEvent(event); clear(); + updateTransparent(); } -void WinButton::drawType() { +// clear is used to force this to clear the window (e.g. called from clear()) +void WinButton::drawType(bool clear, bool no_trans) { bool used = false; // if it's odd and we're centring, we need to add one @@ -79,13 +81,14 @@ void WinButton::drawType() { used = true; } } - if (used) + if (used || clear) FbTk::FbWindow::clear(); // if no pixmap was used, use old style if (!used) { if (gc() == 0) // must have valid graphic context return; + drawRectangle(gc(), 2, 2, width() - 5, height() - 5); drawLine(gc(), @@ -120,9 +123,10 @@ void WinButton::drawType() { } - if (used) { + if (used || clear) { FbTk::FbWindow::clear(); - } else if (gc() != 0) { // must have valid graphic context + } + if (!used && gc() != 0) { // must have valid graphic context FbTk::FbWindow::drawRectangle(gc(), 2, height() - 5, width() - 5, 2); } @@ -178,9 +182,10 @@ void WinButton::drawType() { } - if (used) + if (used || clear) FbTk::FbWindow::clear(); - else if (gc() != 0) { + + if (!used && gc() != 0) { // width/4 != width/2, so we use /4*2 so that it's properly centred if (m_listen_to.isStuck()) { fillRectangle(gc(), @@ -221,9 +226,10 @@ void WinButton::drawType() { } - if (used) + if (used || clear) FbTk::FbWindow::clear(); - else if (gc() != 0) { // must have valid graphic context + + if (!used && gc() != 0) { // must have valid graphic context drawLine(gc(), 2, 2, @@ -265,20 +271,19 @@ void WinButton::drawType() { } } - - FbTk::FbWindow::clear(); + if (used || clear) + FbTk::FbWindow::clear(); break; } - updateTransparent(); + if ((used || clear) && !no_trans) + updateTransparent(); } void WinButton::clear() { - FbTk::Button::clear(); - drawType(); + drawType(true, true); } void WinButton::update(FbTk::Subject *subj) { clear(); - drawType(); } diff --git a/src/WinButton.hh b/src/WinButton.hh index 0cbc4c1..bd673fe 100644 --- a/src/WinButton.hh +++ b/src/WinButton.hh @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -/// $Id: WinButton.hh,v 1.4 2003/04/28 22:39:12 fluxgen Exp $ +/// $Id: WinButton.hh,v 1.5 2004/01/10 00:37:35 rathnor Exp $ #include "Button.hh" #include "Observer.hh" @@ -43,7 +43,7 @@ public: void clear(); void update(FbTk::Subject *subj); private: - void drawType(); + void drawType(bool clear, bool no_trans); // don't update transparency (eg in clear) Type m_type; ///< the button type const FluxboxWindow &m_listen_to; WinButtonTheme &m_theme; -- cgit v0.11.2