From af7deab37956a180996f4420144c484fa7cdb5ed Mon Sep 17 00:00:00 2001 From: rathnor Date: Fri, 31 Oct 2003 19:32:40 +0000 Subject: tweak winbutton icon drawing, plus a little fix to icon changes --- ChangeLog | 2 ++ src/IconButton.cc | 14 ++++++++------ src/WinButton.cc | 22 ++++++++++++++++------ 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5570542..ef5aa8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ (Format: Year/Month/Day) Changes for 0.9.6: *03/10/31: + * Tweak some positioning for winbutton drawn icons (Simon) + WinButton.cc * Fix iconbar button alignment and squash inactive tools (Simon) - also fix a bunch of rounding issues -> keep in mind that titlebar/iconbar width may not be exactly diff --git a/src/IconButton.cc b/src/IconButton.cc index 2f68ecf..093298e 100644 --- a/src/IconButton.cc +++ b/src/IconButton.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconButton.cc,v 1.9 2003/10/31 10:37:09 rathnor Exp $ +// $Id: IconButton.cc,v 1.10 2003/10/31 19:32:39 rathnor Exp $ #include "IconButton.hh" @@ -144,14 +144,14 @@ void IconButton::update(FbTk::Subject *subj) { if (hints->flags & IconPixmapHint && hints->icon_pixmap != 0) { // setup icon window m_icon_window.show(); - int new_height = height() - m_icon_window.y(); - int new_width = height(); - m_icon_window.resize(new_width ? new_width : 1, new_height ? new_height : 1); + int new_height = height() - 2*m_icon_window.y(); // equally padded + int new_width = new_height; + m_icon_window.resize((new_width>0) ? new_width : 1, (new_height>0) ? new_height : 1); m_icon_pixmap.copy(hints->icon_pixmap); - m_icon_pixmap.scale(m_icon_window.height(), m_icon_window.height()); + m_icon_pixmap.scale(m_icon_window.width(), m_icon_window.height()); - setBackgroundPixmap(m_icon_pixmap.drawable()); + m_icon_window.setBackgroundPixmap(m_icon_pixmap.drawable()); } else { // no icon pixmap m_icon_window.move(0, 0); @@ -186,6 +186,8 @@ void IconButton::update(FbTk::Subject *subj) { void IconButton::setupWindow() { + m_icon_window.clear(); + if (!m_win.clientList().empty()) { setText(m_win.winClient().title()); // draw with x offset and y offset diff --git a/src/WinButton.cc b/src/WinButton.cc index 48ce31c..900d23e 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.15 2003/09/22 12:07:00 rathnor Exp $ +/// $Id: WinButton.cc,v 1.16 2003/10/31 19:32:40 rathnor Exp $ #include "WinButton.hh" #include "App.hh" @@ -50,6 +50,10 @@ void WinButton::buttonReleaseEvent(XButtonEvent &event) { void WinButton::drawType() { bool used = false; + // if it's odd and we're centring, we need to add one + int oddW = width()%2; + int oddH = height()%2; + switch (m_type) { case MAXIMIZE: @@ -177,14 +181,15 @@ void WinButton::drawType() { if (used) FbTk::FbWindow::clear(); else if (gc() != 0) { + // width/4 != width/2, so we use /4*2 so that it's properly centred if (m_listen_to.isStuck()) { fillRectangle(gc(), width()/2 - width()/4, height()/2 - height()/4, - width()/2, height()/2); + width()/4*2 + oddW, height()/4*2 + oddH); } else { fillRectangle(gc(), width()/2 - width()/10, height()/2 - height()/10, - width()/5, height()/5); + width()/10*2 + oddW, height()/10*2 + oddH); } } break; @@ -222,10 +227,15 @@ void WinButton::drawType() { drawLine(gc(), 2, 2, - width() - 3, height() - 3); + width() - 2, height() - 2); + // I can't figure out why this second one needs a y offset of 1????? + // but it does - at least on my box: + // XFree86 Version 4.2.1.1 (Debian 4.2.1-12.1 20031003005825) + // (protocol Version 11, revision 0, vendor release 6600) + drawLine(gc(), - 2, width() - 3, - height() - 3, 2); + 2, height() - 3, + width() - 2, 1); } break; case SHADE: -- cgit v0.11.2