aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsimonb <simonb>2006-04-17 23:34:01 (GMT)
committersimonb <simonb>2006-04-17 23:34:01 (GMT)
commitb9af026688f0945196582af5773d62f5df3f97f3 (patch)
treed97e66e4271480644f3ff2a2c0106730d1f714f4 /src
parent3e6def97d18133baf82b596cb742a2f7ef4f9f00 (diff)
downloadfluxbox-b9af026688f0945196582af5773d62f5df3f97f3.zip
fluxbox-b9af026688f0945196582af5773d62f5df3f97f3.tar.bz2
iconbutton handling fixes
Diffstat (limited to 'src')
-rw-r--r--src/IconButton.cc33
-rw-r--r--src/IconbarTool.cc7
-rw-r--r--src/WinButton.cc27
-rw-r--r--src/WinClient.cc10
-rw-r--r--src/WinClient.hh7
-rw-r--r--src/Window.cc5
-rw-r--r--src/Window.hh5
7 files changed, 51 insertions, 43 deletions
diff --git a/src/IconButton.cc b/src/IconButton.cc
index 015065c..11b2c02 100644
--- a/src/IconButton.cc
+++ b/src/IconButton.cc
@@ -170,6 +170,7 @@ IconButton::IconButton(const IconbarTool& tool, const FbTk::FbWindow &parent,
170 } 170 }
171 171
172 m_win.hintSig().attach(this); 172 m_win.hintSig().attach(this);
173 m_win.titleSig().attach(this);
173 174
174 FbTk::EventManager::instance()->add(*this, m_icon_window); 175 FbTk::EventManager::instance()->add(*this, m_icon_window);
175 176
@@ -236,13 +237,9 @@ void IconButton::update(FbTk::Subject *subj) {
236 237
237 Display *display = FbTk::App::instance()->display(); 238 Display *display = FbTk::App::instance()->display();
238 239
239 XWMHints *hints = XGetWMHints(display, m_win.winClient().window());
240 if (hints == 0)
241 return;
242
243 int screen = m_win.screen().screenNumber(); 240 int screen = m_win.screen().screenNumber();
244 241
245 if (m_use_pixmap && (hints->flags & IconPixmapHint) && hints->icon_pixmap != 0) { 242 if (m_use_pixmap && m_win.usePixmap()) {
246 // setup icon window 243 // setup icon window
247 m_icon_window.show(); 244 m_icon_window.show();
248 unsigned int w = width(); 245 unsigned int w = width();
@@ -262,7 +259,7 @@ void IconButton::update(FbTk::Subject *subj) {
262 neww = newh; 259 neww = newh;
263 m_icon_window.moveResize(iconx, icony, neww, newh); 260 m_icon_window.moveResize(iconx, icony, neww, newh);
264 261
265 m_icon_pixmap.copy(hints->icon_pixmap, DefaultDepth(display, screen), screen); 262 m_icon_pixmap.copy(m_win.iconPixmap().drawable(), DefaultDepth(display, screen), screen);
266 m_icon_pixmap.scale(m_icon_window.width(), m_icon_window.height()); 263 m_icon_pixmap.scale(m_icon_window.width(), m_icon_window.height());
267 264
268 // rotate the icon or not?? lets go not for now, and see what they say... 265 // 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) {
277 m_icon_pixmap = 0; 274 m_icon_pixmap = 0;
278 } 275 }
279 276
280 if(m_use_pixmap && (hints->flags & IconMaskHint)) { 277 if(m_use_pixmap && m_win.useMask()) {
281 m_icon_mask.copy(hints->icon_mask, 0, 0); 278 m_icon_mask.copy(m_win.iconMask().drawable(), 0, 0);
282 m_icon_mask.scale(m_icon_pixmap.width(), m_icon_pixmap.height()); 279 m_icon_mask.scale(m_icon_pixmap.width(), m_icon_pixmap.height());
283 m_icon_mask.rotate(orientation()); 280 m_icon_mask.rotate(orientation());
284 } else 281 } else
285 m_icon_mask = 0; 282 m_icon_mask = 0;
286 283
287 XFree(hints);
288 hints = 0;
289
290#ifdef SHAPE 284#ifdef SHAPE
291 285
292 if (m_icon_mask.drawable() != 0) { 286 XShapeCombineMask(display,
293 XShapeCombineMask(display, 287 m_icon_window.drawable(),
294 m_icon_window.drawable(), 288 ShapeBounding,
295 ShapeBounding, 289 0, 0,
296 0, 0, 290 m_icon_mask.drawable(),
297 m_icon_mask.drawable(), 291 ShapeSet);
298 ShapeSet);
299 }
300 292
301#endif // SHAPE 293#endif // SHAPE
302 294
295 if (subj == &(m_win.titleSig()))
296 setText(m_win.title());
297
303 if (subj != 0) { 298 if (subj != 0) {
304 setupWindow(); 299 setupWindow();
305 } else { 300 } else {
diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc
index e2eede4..82fdf26 100644
--- a/src/IconbarTool.cc
+++ b/src/IconbarTool.cc
@@ -596,12 +596,6 @@ void IconbarTool::update(FbTk::Subject *subj) {
596 596
597 return; 597 return;
598 598
599 } else if (subj == &(winsubj->win().titleSig())) {
600 IconButton *button = findButton(winsubj->win());
601 if (button == 0)
602 return;
603 button->setText(winsubj->win().title());
604 return;
605 } else { 599 } else {
606 // signal not handled 600 // signal not handled
607 return; 601 return;
@@ -897,7 +891,6 @@ void IconbarTool::addWindow(FluxboxWindow &win) {
897 win.dieSig().attach(this); 891 win.dieSig().attach(this);
898 win.workspaceSig().attach(this); 892 win.workspaceSig().attach(this);
899 win.stateSig().attach(this); 893 win.stateSig().attach(this);
900 win.titleSig().attach(this);
901 894
902} 895}
903 896
diff --git a/src/WinButton.cc b/src/WinButton.cc
index 4f50935..496e63d 100644
--- a/src/WinButton.cc
+++ b/src/WinButton.cc
@@ -319,26 +319,19 @@ void WinButton::clear() {
319 319
320 Display* display = m_listen_to.fbWindow().display(); 320 Display* display = m_listen_to.fbWindow().display();
321 int screen = m_listen_to.screen().screenNumber(); 321 int screen = m_listen_to.screen().screenNumber();
322 XWMHints* hints = XGetWMHints(display, m_listen_to.winClient().window()); 322 if (m_listen_to.usePixmap()) {
323 if (hints == 0) { 323 m_icon_pixmap.copy(m_listen_to.iconPixmap().drawable(),
324 DefaultDepth(display, screen), screen);
325 m_icon_pixmap.scale(width() - 4, height() - 4);
326 } else
324 m_icon_pixmap.release(); 327 m_icon_pixmap.release();
325 m_icon_mask.release();
326 } else {
327 if ((hints->flags & IconPixmapHint) && hints->icon_pixmap != 0) {
328 m_icon_pixmap.copy(hints->icon_pixmap,
329 DefaultDepth(display, screen), screen);
330 m_icon_pixmap.scale(width() - 4, height() - 4);
331 } else
332 m_icon_pixmap.release();
333 328
334 if ((hints->flags & IconMaskHint)) { 329 if (m_listen_to.useMask()) {
335 m_icon_mask.copy(hints->icon_mask, 0, 0); 330 m_icon_mask.copy(m_listen_to.iconMask().drawable(), 0, 0);
336 m_icon_mask.scale(width() - 4, height() - 4); 331 m_icon_mask.scale(width() - 4, height() - 4);
337 } else 332 } else
338 m_icon_mask.release(); 333 m_icon_mask.release();
339 }
340 334
341 XFree(hints);
342 } 335 }
343 336
344 drawType(); 337 drawType();
diff --git a/src/WinClient.cc b/src/WinClient.cc
index b1187a0..056013a 100644
--- a/src/WinClient.cc
+++ b/src/WinClient.cc
@@ -484,6 +484,16 @@ void WinClient::updateWMHints() {
484 } else 484 } else
485 window_group = None; 485 window_group = None;
486 486
487 if ((bool)(wmhint->flags & IconPixmapHint) && wmhint->icon_pixmap != 0)
488 m_icon_pixmap.copy(wmhint->icon_pixmap, 0, 0);
489 else
490 m_icon_pixmap = 0;
491
492 if ((bool)(wmhint->flags & IconMaskHint) && wmhint->icon_mask != 0)
493 m_icon_mask.copy(wmhint->icon_mask, 0, 0);
494 else
495 m_icon_mask = 0;
496
487 XFree(wmhint); 497 XFree(wmhint);
488 } 498 }
489} 499}
diff --git a/src/WinClient.hh b/src/WinClient.hh
index 0f74695..d092aa7 100644
--- a/src/WinClient.hh
+++ b/src/WinClient.hh
@@ -128,6 +128,10 @@ public:
128 return (m_win == &win); 128 return (m_win == &win);
129 } 129 }
130 130
131 const FbTk::FbPixmap &iconPixmap() const { return m_icon_pixmap; }
132 const FbTk::FbPixmap &iconMask() const { return m_icon_mask; }
133 const bool usePixmap() const { return m_icon_pixmap.drawable() != None; }
134 const bool useMask() const { return m_icon_mask.drawable() != None; }
131 135
132 inline const std::string &title() const { return m_title; } 136 inline const std::string &title() const { return m_title; }
133 inline const std::string &iconTitle() const { return m_icon_title; } 137 inline const std::string &iconTitle() const { return m_icon_title; }
@@ -192,6 +196,9 @@ private:
192 std::string m_title, m_icon_title; 196 std::string m_title, m_icon_title;
193 std::string m_class_name, m_instance_name; 197 std::string m_class_name, m_instance_name;
194 198
199 FbTk::FbPixmap m_icon_pixmap;
200 FbTk::FbPixmap m_icon_mask;
201
195 FluxboxWindow::BlackboxHints *m_blackbox_hint; 202 FluxboxWindow::BlackboxHints *m_blackbox_hint;
196 MwmHints *m_mwm_hint; 203 MwmHints *m_mwm_hint;
197 204
diff --git a/src/Window.cc b/src/Window.cc
index a165d90..e766cab 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -3680,6 +3680,11 @@ FbTk::Menu &FluxboxWindow::menu() {
3680 return screen().windowMenu(); 3680 return screen().windowMenu();
3681} 3681}
3682 3682
3683const FbTk::FbPixmap &FluxboxWindow::iconPixmap() const { return m_client->iconPixmap(); }
3684const FbTk::FbPixmap &FluxboxWindow::iconMask() const { return m_client->iconMask(); }
3685const bool FluxboxWindow::usePixmap() const { return m_client->usePixmap(); }
3686const bool FluxboxWindow::useMask() const { return m_client->useMask(); }
3687
3683const FbTk::Menu &FluxboxWindow::menu() const { 3688const FbTk::Menu &FluxboxWindow::menu() const {
3684 return screen().windowMenu(); 3689 return screen().windowMenu();
3685} 3690}
diff --git a/src/Window.hh b/src/Window.hh
index 44214c7..9508d5c 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -331,6 +331,11 @@ public:
331 const FbTk::FbWindow &parent() const { return m_parent; } 331 const FbTk::FbWindow &parent() const { return m_parent; }
332 FbTk::FbWindow &parent() { return m_parent; } 332 FbTk::FbWindow &parent() { return m_parent; }
333 333
334 const FbTk::FbPixmap &iconPixmap() const;
335 const FbTk::FbPixmap &iconMask() const;
336 const bool usePixmap() const;
337 const bool useMask() const;
338
334 const std::string &title() const; 339 const std::string &title() const;
335 const std::string &iconTitle() const; 340 const std::string &iconTitle() const;
336 inline int x() const { return frame().x(); } 341 inline int x() const { return frame().x(); }