fix some minor transparency issues
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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::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 @@ FbTk::Color title_color;
getCurrentFocusPixmap(label_pm, title_pm, label_color, title_color); - if (label_pm != 0) m_label.setBackgroundPixmap(label_pm); else@@ -863,6 +865,9 @@ if (title_pm != 0)
m_titlebar.setBackgroundPixmap(title_pm); else m_titlebar.setBackgroundColor(title_color); + + m_titlebar.setAlpha(theme().alpha()); + m_label.setAlpha(theme().alpha()); renderLabelButtons(); redrawTitlebar();@@ -921,16 +926,8 @@ }
} 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 @@ button.setBackgroundPixmap(m_label_focused_pm);
} else button.setBackgroundColor(m_label_focused_color); - button.clear(); - button.updateTransparent(); } void FbWinFrame::renderButtonActive(FbTk::TextButton &button) {@@ -1178,8 +1173,6 @@ button.setBackgroundPixmap(m_label_active_pm);
} else button.setBackgroundColor(m_label_active_color); - button.clear(); - button.updateTransparent(); } void FbWinFrame::renderButtonUnfocus(FbTk::TextButton &button) {@@ -1196,15 +1189,13 @@ button.setBackgroundPixmap(m_label_unfocused_pm);
} 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 @@ m_grip_right.clear();
m_grip_right.updateTransparent(); m_handle.clear(); m_handle.updateTransparent(); + }
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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 @@ }
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 @@ pixmap().drawable());
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 @@ }
} - 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 @@ }
} - 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 @@ }
} - 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 @@ used = true;
} } - - 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(); }
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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 @@ /// override for redrawing
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;