all repos — fluxbox @ 060219fca20ff02629d04fd41abfe7c8a36446be

custom fork of the fluxbox windowmanager

extra checks
fluxgen fluxgen
commit

060219fca20ff02629d04fd41abfe7c8a36446be

parent

7be86791e445a6d586528212d905cb02cd96abc3

1 files changed, 14 insertions(+), 6 deletions(-)

jump to
M src/IconButton.ccsrc/IconButton.cc

@@ -20,7 +20,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: IconButton.cc,v 1.2 2003/08/12 00:16:16 fluxgen Exp $ +// $Id: IconButton.cc,v 1.3 2003/08/12 01:19:22 fluxgen Exp $ #include "IconButton.hh"

@@ -40,9 +40,6 @@ #include <X11/Xutil.h>

#ifdef SHAPE #include <X11/extensions/shape.h> #endif // SHAPE - -#include <iostream> -using namespace std; IconButton::IconButton(const FbTk::FbWindow &parent, const FbTk::Font &font, FluxboxWindow &win):

@@ -98,14 +95,20 @@ // we got signal that either title or

// icon pixmap was updated, // so we refresh everything + // we need to check our client first + if (m_win.clientList().size() == 0) + return; + XWMHints *hints = XGetWMHints(FbTk::App::instance()->display(), m_win.winClient().window()); if (hints == 0) return; - if (hints->flags & IconPixmapHint) { + if (hints->flags & IconPixmapHint && hints->icon_pixmap != 0) { // setup icon window m_icon_window.show(); - m_icon_window.resize(height(), height() - m_icon_window.y()); + 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); m_icon_pixmap.copy(hints->icon_pixmap); m_icon_pixmap.scale(m_icon_window.height(), m_icon_window.height());

@@ -113,6 +116,7 @@

m_icon_window.setBackgroundPixmap(m_icon_pixmap.drawable()); } else { // no icon pixmap + m_icon_window.move(0, 0); m_icon_window.hide(); m_icon_pixmap = 0; }

@@ -145,6 +149,10 @@

void IconButton::setupWindow() { m_icon_window.clear(); + + if (m_win.clientList().size() == 0) + return; + setText(m_win.winClient().title()); // draw with x offset and y offset drawText(m_icon_window.x() + m_icon_window.width() + 1);