iconbutton handling fixes
simonb simonb
8 files changed,
55 insertions(+),
43 deletions(-)
M
ChangeLog
→
ChangeLog
@@ -1,5 +1,9 @@
(Format: Year/Month/Day) Changes for 0.9.16: +*06/04/18: + * Fix iconbar updates (icon and title) + (Thanks Mark Tiefenbruck, mark at tiefenbruck dot org) + WinClient.hh/cc Window.hh/cc IconButton.cc IconbarTool.cc WinButton.cc *06/04/17: * Fix toolbar transparency when autohide enabled (Simon) Toolbar.cc Container.hh/cc ToolbarItem.hh/cc *Tool.hh/cc
M
src/IconButton.cc
→
src/IconButton.cc
@@ -170,6 +170,7 @@ setOnClick(prev_workspace, 5);
} m_win.hintSig().attach(this); + m_win.titleSig().attach(this); FbTk::EventManager::instance()->add(*this, m_icon_window);@@ -236,13 +237,9 @@ return;
Display *display = FbTk::App::instance()->display(); - XWMHints *hints = XGetWMHints(display, m_win.winClient().window()); - if (hints == 0) - return; - int screen = m_win.screen().screenNumber(); - if (m_use_pixmap && (hints->flags & IconPixmapHint) && hints->icon_pixmap != 0) { + if (m_use_pixmap && m_win.usePixmap()) { // setup icon window m_icon_window.show(); unsigned int w = width();@@ -262,7 +259,7 @@
neww = newh; m_icon_window.moveResize(iconx, icony, neww, newh); - m_icon_pixmap.copy(hints->icon_pixmap, DefaultDepth(display, screen), screen); + m_icon_pixmap.copy(m_win.iconPixmap().drawable(), DefaultDepth(display, screen), screen); m_icon_pixmap.scale(m_icon_window.width(), m_icon_window.height()); // rotate the icon or not?? lets go not for now, and see what they say...@@ -277,28 +274,26 @@ m_icon_window.hide();
m_icon_pixmap = 0; } - if(m_use_pixmap && (hints->flags & IconMaskHint)) { - m_icon_mask.copy(hints->icon_mask, 0, 0); + if(m_use_pixmap && m_win.useMask()) { + m_icon_mask.copy(m_win.iconMask().drawable(), 0, 0); m_icon_mask.scale(m_icon_pixmap.width(), m_icon_pixmap.height()); m_icon_mask.rotate(orientation()); } else m_icon_mask = 0; - XFree(hints); - hints = 0; - #ifdef SHAPE - if (m_icon_mask.drawable() != 0) { - XShapeCombineMask(display, - m_icon_window.drawable(), - ShapeBounding, - 0, 0, - m_icon_mask.drawable(), - ShapeSet); - } + XShapeCombineMask(display, + m_icon_window.drawable(), + ShapeBounding, + 0, 0, + m_icon_mask.drawable(), + ShapeSet); #endif // SHAPE + + if (subj == &(m_win.titleSig())) + setText(m_win.title()); if (subj != 0) { setupWindow();
M
src/IconbarTool.cc
→
src/IconbarTool.cc
@@ -596,12 +596,6 @@ }
return; - } else if (subj == &(winsubj->win().titleSig())) { - IconButton *button = findButton(winsubj->win()); - if (button == 0) - return; - button->setText(winsubj->win().title()); - return; } else { // signal not handled return;@@ -897,7 +891,6 @@ win.focusSig().attach(this);
win.dieSig().attach(this); win.workspaceSig().attach(this); win.stateSig().attach(this); - win.titleSig().attach(this); }
M
src/WinButton.cc
→
src/WinButton.cc
@@ -319,26 +319,19 @@ m_icon_pixmap.height() != height() - 4))) {
Display* display = m_listen_to.fbWindow().display(); int screen = m_listen_to.screen().screenNumber(); - XWMHints* hints = XGetWMHints(display, m_listen_to.winClient().window()); - if (hints == 0) { + if (m_listen_to.usePixmap()) { + m_icon_pixmap.copy(m_listen_to.iconPixmap().drawable(), + DefaultDepth(display, screen), screen); + m_icon_pixmap.scale(width() - 4, height() - 4); + } else m_icon_pixmap.release(); + + if (m_listen_to.useMask()) { + m_icon_mask.copy(m_listen_to.iconMask().drawable(), 0, 0); + m_icon_mask.scale(width() - 4, height() - 4); + } else m_icon_mask.release(); - } else { - if ((hints->flags & IconPixmapHint) && hints->icon_pixmap != 0) { - m_icon_pixmap.copy(hints->icon_pixmap, - DefaultDepth(display, screen), screen); - m_icon_pixmap.scale(width() - 4, height() - 4); - } else - m_icon_pixmap.release(); - - if ((hints->flags & IconMaskHint)) { - m_icon_mask.copy(hints->icon_mask, 0, 0); - m_icon_mask.scale(width() - 4, height() - 4); - } else - m_icon_mask.release(); - } - XFree(hints); } drawType();
M
src/WinClient.cc
→
src/WinClient.cc
@@ -484,6 +484,16 @@ window_group = wmhint->window_group;
} else window_group = None; + if ((bool)(wmhint->flags & IconPixmapHint) && wmhint->icon_pixmap != 0) + m_icon_pixmap.copy(wmhint->icon_pixmap, 0, 0); + else + m_icon_pixmap = 0; + + if ((bool)(wmhint->flags & IconMaskHint) && wmhint->icon_mask != 0) + m_icon_mask.copy(wmhint->icon_mask, 0, 0); + else + m_icon_mask = 0; + XFree(wmhint); } }
M
src/WinClient.hh
→
src/WinClient.hh
@@ -128,6 +128,10 @@ inline bool operator == (const FluxboxWindow &win) const {
return (m_win == &win); } + const FbTk::FbPixmap &iconPixmap() const { return m_icon_pixmap; } + const FbTk::FbPixmap &iconMask() const { return m_icon_mask; } + const bool usePixmap() const { return m_icon_pixmap.drawable() != None; } + const bool useMask() const { return m_icon_mask.drawable() != None; } inline const std::string &title() const { return m_title; } inline const std::string &iconTitle() const { return m_icon_title; }@@ -191,6 +195,9 @@ int m_win_gravity;
std::string m_title, m_icon_title; std::string m_class_name, m_instance_name; + + FbTk::FbPixmap m_icon_pixmap; + FbTk::FbPixmap m_icon_mask; FluxboxWindow::BlackboxHints *m_blackbox_hint; MwmHints *m_mwm_hint;
M
src/Window.cc
→
src/Window.cc
@@ -3680,6 +3680,11 @@ FbTk::Menu &FluxboxWindow::menu() {
return screen().windowMenu(); } +const FbTk::FbPixmap &FluxboxWindow::iconPixmap() const { return m_client->iconPixmap(); } +const FbTk::FbPixmap &FluxboxWindow::iconMask() const { return m_client->iconMask(); } +const bool FluxboxWindow::usePixmap() const { return m_client->usePixmap(); } +const bool FluxboxWindow::useMask() const { return m_client->useMask(); } + const FbTk::Menu &FluxboxWindow::menu() const { return screen().windowMenu(); }
M
src/Window.hh
→
src/Window.hh
@@ -331,6 +331,11 @@
const FbTk::FbWindow &parent() const { return m_parent; } FbTk::FbWindow &parent() { return m_parent; } + const FbTk::FbPixmap &iconPixmap() const; + const FbTk::FbPixmap &iconMask() const; + const bool usePixmap() const; + const bool useMask() const; + const std::string &title() const; const std::string &iconTitle() const; inline int x() const { return frame().x(); }