iconbutton handling fixes
This commit is contained in:
parent
3e6def97d1
commit
b9af026688
8 changed files with 55 additions and 43 deletions
|
@ -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
|
||||
|
|
|
@ -170,6 +170,7 @@ IconButton::IconButton(const IconbarTool& tool, const FbTk::FbWindow &parent,
|
|||
}
|
||||
|
||||
m_win.hintSig().attach(this);
|
||||
m_win.titleSig().attach(this);
|
||||
|
||||
FbTk::EventManager::instance()->add(*this, m_icon_window);
|
||||
|
||||
|
@ -236,13 +237,9 @@ void IconButton::update(FbTk::Subject *subj) {
|
|||
|
||||
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 @@ void IconButton::update(FbTk::Subject *subj) {
|
|||
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,29 +274,27 @@ void IconButton::update(FbTk::Subject *subj) {
|
|||
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();
|
||||
} else {
|
||||
|
|
|
@ -596,12 +596,6 @@ void IconbarTool::update(FbTk::Subject *subj) {
|
|||
|
||||
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 @@ void IconbarTool::addWindow(FluxboxWindow &win) {
|
|||
win.dieSig().attach(this);
|
||||
win.workspaceSig().attach(this);
|
||||
win.stateSig().attach(this);
|
||||
win.titleSig().attach(this);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -319,26 +319,19 @@ void WinButton::clear() {
|
|||
|
||||
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();
|
||||
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();
|
||||
}
|
||||
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();
|
||||
|
||||
XFree(hints);
|
||||
}
|
||||
|
||||
drawType();
|
||||
|
|
|
@ -484,6 +484,16 @@ void WinClient::updateWMHints() {
|
|||
} 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,6 +128,10 @@ public:
|
|||
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; }
|
||||
|
@ -192,6 +196,9 @@ private:
|
|||
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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -331,6 +331,11 @@ public:
|
|||
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(); }
|
||||
|
|
Loading…
Reference in a new issue