aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHenrik Kinnunen <fluxgen@fluxbox.org>2008-09-21 18:45:01 (GMT)
committerHenrik Kinnunen <fluxgen@fluxbox.org>2008-09-21 18:45:01 (GMT)
commited53f3c623e7c3ae35672b33ae3b52759dc1a6ed (patch)
treed7ad6a0b4aa4b5540b5c89bf1817194a3f1daf4f /src
parent52e22a0304ef108e036cecc7c8808dc0bcf8d77b (diff)
downloadfluxbox-ed53f3c623e7c3ae35672b33ae3b52759dc1a6ed.zip
fluxbox-ed53f3c623e7c3ae35672b33ae3b52759dc1a6ed.tar.bz2
Changed icon list signal in BScreen to use the new signal system
Diffstat (limited to 'src')
-rw-r--r--src/ClientMenu.cc19
-rw-r--r--src/ClientMenu.hh17
-rw-r--r--src/FbCommands.cc5
-rw-r--r--src/MenuCreator.cc4
-rw-r--r--src/Screen.cc7
-rw-r--r--src/Screen.hh4
-rw-r--r--src/Workspace.cc15
-rw-r--r--src/Workspace.hh5
8 files changed, 45 insertions, 31 deletions
diff --git a/src/ClientMenu.cc b/src/ClientMenu.cc
index f5af305..0da3773 100644
--- a/src/ClientMenu.cc
+++ b/src/ClientMenu.cc
@@ -1,5 +1,5 @@
1// ClientMenu.hh 1// ClientMenu.hh
2// Copyright (c) 2007 Fluxbox Team (fluxgen at fluxbox dot org) 2// Copyright (c) 2007-2008 Fluxbox Team (fluxgen at fluxbox dot org)
3// 3//
4// Permission is hereby granted, free of charge, to any person obtaining a 4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"), 5// copy of this software and associated documentation files (the "Software"),
@@ -28,6 +28,7 @@
28#include <X11/keysym.h> 28#include <X11/keysym.h>
29 29
30#include "FbTk/MenuItem.hh" 30#include "FbTk/MenuItem.hh"
31#include "FbTk/MemFun.hh"
31 32
32namespace { // anonymous 33namespace { // anonymous
33 34
@@ -79,14 +80,16 @@ private:
79}; // end anonymous namespace 80}; // end anonymous namespace
80 81
81ClientMenu::ClientMenu(BScreen &screen, Focusables &clients, 82ClientMenu::ClientMenu(BScreen &screen, Focusables &clients,
82 FbTk::Subject *refresh): 83 bool listen_for_iconlist_changes):
83 FbMenu(screen.menuTheme(), screen.imageControl(), 84 FbMenu(screen.menuTheme(), screen.imageControl(),
84 *screen.layerManager().getLayer(Layer::MENU)), 85 *screen.layerManager().getLayer(Layer::MENU)),
85 m_list(clients), 86 m_list(clients) {
86 m_refresh_sig(refresh) { 87
88 if (listen_for_iconlist_changes) {
89 m_slots.join(screen.iconListSig(),
90 FbTk::MemFun(*this, &ClientMenu::updateClientList));
91 }
87 92
88 if (refresh)
89 refresh->attach(this);
90 refreshMenu(); 93 refreshMenu();
91 94
92} 95}
@@ -116,9 +119,7 @@ void ClientMenu::refreshMenu() {
116} 119}
117 120
118void ClientMenu::update(FbTk::Subject *subj) { 121void ClientMenu::update(FbTk::Subject *subj) {
119 if (subj == m_refresh_sig) 122 if (subj && typeid(*subj) == typeid(Focusable::FocusSubject)) {
120 refreshMenu();
121 else if (subj && typeid(*subj) == typeid(Focusable::FocusSubject)) {
122 123
123 Focusable::FocusSubject *fsubj = static_cast<Focusable::FocusSubject *>(subj); 124 Focusable::FocusSubject *fsubj = static_cast<Focusable::FocusSubject *>(subj);
124 Focusable &win = fsubj->win(); 125 Focusable &win = fsubj->win();
diff --git a/src/ClientMenu.hh b/src/ClientMenu.hh
index dd43cbc..f0b6ce4 100644
--- a/src/ClientMenu.hh
+++ b/src/ClientMenu.hh
@@ -1,5 +1,5 @@
1// ClientMenu.hh 1// ClientMenu.hh
2// Copyright (c) 2007 Fluxbox Team (fluxgen at fluxbox dot org) 2// Copyright (c) 2007-2008 Fluxbox Team (fluxgen at fluxbox dot org)
3// 3//
4// Permission is hereby granted, free of charge, to any person obtaining a 4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"), 5// copy of this software and associated documentation files (the "Software"),
@@ -24,6 +24,8 @@
24 24
25#include "FbMenu.hh" 25#include "FbMenu.hh"
26 26
27#include "FbTk/Signal.hh"
28
27class BScreen; 29class BScreen;
28class FluxboxWindow; 30class FluxboxWindow;
29/** 31/**
@@ -38,19 +40,24 @@ public:
38 /** 40 /**
39 * @param screen the screen to show this menu on 41 * @param screen the screen to show this menu on
40 * @param client a list of clients to show in this menu 42 * @param client a list of clients to show in this menu
41 * @param refresh the refresh subject to listen to 43 * @param listen_for_iconlist_changes Listen for list changes from the \c screen.
42 */ 44 */
43 ClientMenu(BScreen &screen, 45 ClientMenu(BScreen &screen,
44 Focusables &clients, FbTk::Subject *refresh); 46 Focusables &clients, bool listen_for_iconlist_changes);
45 47
46private:
47 /// refresh the entire menu 48 /// refresh the entire menu
48 void refreshMenu(); 49 void refreshMenu();
50private:
51
52 void updateClientList(BScreen& screen) {
53 refreshMenu();
54 }
55
49 /// called when receiving a subject signal 56 /// called when receiving a subject signal
50 void update(FbTk::Subject *subj); 57 void update(FbTk::Subject *subj);
51 58
52 Focusables &m_list; ///< clients in the menu 59 Focusables &m_list; ///< clients in the menu
53 FbTk::Subject *m_refresh_sig; ///< signal to listen to 60 FbTk::SignalTracker m_slots; ///< track all the slots
54}; 61};
55 62
56#endif // CLIENTMENU_HH 63#endif // CLIENTMENU_HH
diff --git a/src/FbCommands.cc b/src/FbCommands.cc
index fd3f71e..3c69386 100644
--- a/src/FbCommands.cc
+++ b/src/FbCommands.cc
@@ -1,5 +1,5 @@
1// FbCommands.cc for Fluxbox 1// FbCommands.cc for Fluxbox
2// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) 2// Copyright (c) 2003 - 2008 Henrik Kinnunen (fluxgen at fluxbox dot org)
3// 3//
4// Permission is hereby granted, free of charge, to any person obtaining a 4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"), 5// copy of this software and associated documentation files (the "Software"),
@@ -340,7 +340,8 @@ void ShowClientMenuCmd::execute() {
340 m_list.push_back(static_cast<FluxboxWindow *>(*it)); 340 m_list.push_back(static_cast<FluxboxWindow *>(*it));
341 } 341 }
342 342
343 m_menu.reset(new ClientMenu(*screen, m_list, 0)); 343 m_menu.reset(new ClientMenu(*screen, m_list,
344 false)); // dont listen to list changes
344 ::showMenu(*screen, *m_menu.get()); 345 ::showMenu(*screen, *m_menu.get());
345} 346}
346 347
diff --git a/src/MenuCreator.cc b/src/MenuCreator.cc
index 8f9b9a7..7a2e9b4 100644
--- a/src/MenuCreator.cc
+++ b/src/MenuCreator.cc
@@ -1,5 +1,5 @@
1// MenuCreator.cc for Fluxbox 1// MenuCreator.cc for Fluxbox
2// Copyright (c) 2004 Henrik Kinnunen (fluxgen at fluxbox dot org) 2// Copyright (c) 2004-2008 Henrik Kinnunen (fluxgen at fluxbox dot org)
3// and Simon Bowden (rathnor at users.sourceforge.net) 3// and Simon Bowden (rathnor at users.sourceforge.net)
4// 4//
5// Permission is hereby granted, free of charge, to any person obtaining a 5// Permission is hereby granted, free of charge, to any person obtaining a
@@ -415,7 +415,7 @@ FbMenu *MenuCreator::createMenuType(const string &type, int screen_num) {
415 return 0; 415 return 0;
416 if (type == "iconmenu") 416 if (type == "iconmenu")
417 return new ClientMenu(*screen, screen->iconList(), 417 return new ClientMenu(*screen, screen->iconList(),
418 &screen->iconListSig()); 418 true); // listen to icon list changes
419 else if (type == "workspacemenu") 419 else if (type == "workspacemenu")
420 return new WorkspaceMenu(*screen); 420 return new WorkspaceMenu(*screen);
421 421
diff --git a/src/Screen.cc b/src/Screen.cc
index 2d55b31..8746fd2 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -339,7 +339,6 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
339 const string &screenname, 339 const string &screenname,
340 const string &altscreenname, 340 const string &altscreenname,
341 int scrn, int num_layers) : 341 int scrn, int num_layers) :
342 m_iconlist_sig(*this), // icon list signal
343 m_workspace_area_sig(*this), // workspace area signal 342 m_workspace_area_sig(*this), // workspace area signal
344 m_focusedwindow_sig(*this), // focused window signal 343 m_focusedwindow_sig(*this), // focused window signal
345 m_reconfigure_sig(*this), // reconfigure signal 344 m_reconfigure_sig(*this), // reconfigure signal
@@ -1034,7 +1033,7 @@ void BScreen::addIcon(FluxboxWindow *w) {
1034 m_icon_list.push_back(w); 1033 m_icon_list.push_back(w);
1035 1034
1036 // notify listeners 1035 // notify listeners
1037 m_iconlist_sig.notify(); 1036 m_iconlist_sig.emit(*this);
1038} 1037}
1039 1038
1040 1039
@@ -1049,7 +1048,7 @@ void BScreen::removeIcon(FluxboxWindow *w) {
1049 // change the iconlist 1048 // change the iconlist
1050 if (erase_it != m_icon_list.end()) { 1049 if (erase_it != m_icon_list.end()) {
1051 iconList().erase(erase_it); 1050 iconList().erase(erase_it);
1052 m_iconlist_sig.notify(); 1051 m_iconlist_sig.emit(*this);
1053 } 1052 }
1054} 1053}
1055 1054
@@ -1072,7 +1071,7 @@ void BScreen::removeClient(WinClient &client) {
1072 focusControl().removeClient(client); 1071 focusControl().removeClient(client);
1073 1072
1074 if (client.fbwindow() && client.fbwindow()->isIconic()) 1073 if (client.fbwindow() && client.fbwindow()->isIconic())
1075 iconListSig().notify(); 1074 iconListSig().emit(*this);
1076 1075
1077 using namespace FbTk; 1076 using namespace FbTk;
1078 1077
diff --git a/src/Screen.hh b/src/Screen.hh
index 263d4ba..a5e80ee 100644
--- a/src/Screen.hh
+++ b/src/Screen.hh
@@ -213,7 +213,7 @@ public:
213 /// client list signal 213 /// client list signal
214 ScreenSignal &clientListSig() { return m_clientlist_sig; } 214 ScreenSignal &clientListSig() { return m_clientlist_sig; }
215 /// icon list sig 215 /// icon list sig
216 FbTk::Subject &iconListSig() { return m_iconlist_sig; } 216 ScreenSignal &iconListSig() { return m_iconlist_sig; }
217 /// workspace count signal 217 /// workspace count signal
218 ScreenSignal &workspaceCountSig() { return m_workspacecount_sig; } 218 ScreenSignal &workspaceCountSig() { return m_workspacecount_sig; }
219 /// workspace names signal 219 /// workspace names signal
@@ -493,12 +493,12 @@ private:
493 const Strut* availableWorkspaceArea(int head) const; 493 const Strut* availableWorkspaceArea(int head) const;
494 494
495 ScreenSubject 495 ScreenSubject
496 m_iconlist_sig, ///< notify if a window gets iconified/deiconified
497 m_workspace_area_sig, ///< workspace area changed signal 496 m_workspace_area_sig, ///< workspace area changed signal
498 m_focusedwindow_sig, ///< focused window signal 497 m_focusedwindow_sig, ///< focused window signal
499 m_reconfigure_sig, ///< reconfigure signal 498 m_reconfigure_sig, ///< reconfigure signal
500 m_resize_sig; ///< resize signal 499 m_resize_sig; ///< resize signal
501 500
501 ScreenSignal m_iconlist_sig; ///< notify if a window gets iconified/deiconified
502 ScreenSignal m_clientlist_sig; ///< client signal 502 ScreenSignal m_clientlist_sig; ///< client signal
503 ScreenSignal m_bg_change_sig; ///< background change signal 503 ScreenSignal m_bg_change_sig; ///< background change signal
504 ScreenSignal m_workspacecount_sig; ///< workspace count signal 504 ScreenSignal m_workspacecount_sig; ///< workspace count signal
diff --git a/src/Workspace.cc b/src/Workspace.cc
index b266d78..ff3b21f 100644
--- a/src/Workspace.cc
+++ b/src/Workspace.cc
@@ -1,5 +1,5 @@
1// Workspace.cc for Fluxbox 1// Workspace.cc for Fluxbox
2// Copyright (c) 2001 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) 2// Copyright (c) 2001 - 2008 Henrik Kinnunen (fluxgen at fluxbox dot org)
3// 3//
4// Workspace.cc for Blackbox - an X11 Window manager 4// Workspace.cc for Blackbox - an X11 Window manager
5// Copyright (c) 1997 - 2000 Brad Hughes (bhughes at tcac.net) 5// Copyright (c) 1997 - 2000 Brad Hughes (bhughes at tcac.net)
@@ -34,6 +34,7 @@
34#include "FbTk/I18n.hh" 34#include "FbTk/I18n.hh"
35#include "FbTk/StringUtil.hh" 35#include "FbTk/StringUtil.hh"
36#include "FbTk/FbString.hh" 36#include "FbTk/FbString.hh"
37#include "FbTk/MemFun.hh"
37 38
38// use GNU extensions 39// use GNU extensions
39#ifndef _GNU_SOURCE 40#ifndef _GNU_SOURCE
@@ -70,13 +71,17 @@ using std::endl;
70 71
71Workspace::Workspace(BScreen &scrn, const string &name, unsigned int id): 72Workspace::Workspace(BScreen &scrn, const string &name, unsigned int id):
72 m_screen(scrn), 73 m_screen(scrn),
73 m_clientmenu(scrn, m_windowlist, &m_clientlist_sig), 74 m_clientmenu(scrn, m_windowlist, false),
74 m_name(name), 75 m_name(name),
75 m_id(id) { 76 m_id(id) {
76 77
78 m_clientlist_sig.connect(FbTk::MemFun(m_clientmenu,
79 &ClientMenu::refreshMenu));
80
77 menu().setInternalMenu(); 81 menu().setInternalMenu();
78 setName(name); 82 setName(name);
79 83
84
80} 85}
81 86
82 87
@@ -91,7 +96,7 @@ void Workspace::addWindow(FluxboxWindow &w) {
91 w.setWorkspace(m_id); 96 w.setWorkspace(m_id);
92 97
93 m_windowlist.push_back(&w); 98 m_windowlist.push_back(&w);
94 m_clientlist_sig.notify(); 99 m_clientlist_sig.emit();
95 100
96} 101}
97 102
@@ -108,7 +113,7 @@ int Workspace::removeWindow(FluxboxWindow *w, bool still_alive) {
108 FocusControl::unfocusWindow(w->winClient(), true, true); 113 FocusControl::unfocusWindow(w->winClient(), true, true);
109 114
110 m_windowlist.remove(w); 115 m_windowlist.remove(w);
111 m_clientlist_sig.notify(); 116 m_clientlist_sig.emit();
112 117
113 return m_windowlist.size(); 118 return m_windowlist.size();
114} 119}
@@ -190,5 +195,5 @@ void Workspace::shutdown() {
190} 195}
191 196
192void Workspace::updateClientmenu() { 197void Workspace::updateClientmenu() {
193 m_clientlist_sig.notify(); 198 m_clientlist_sig.emit();
194} 199}
diff --git a/src/Workspace.hh b/src/Workspace.hh
index a834174..790c4a6 100644
--- a/src/Workspace.hh
+++ b/src/Workspace.hh
@@ -1,5 +1,5 @@
1// Workspace.hh for Fluxbox 1// Workspace.hh for Fluxbox
2// Copyright (c) 2002 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) 2// Copyright (c) 2002 - 2008 Henrik Kinnunen (fluxgen at fluxbox dot org)
3// 3//
4// Workspace.hh for Blackbox - an X11 Window manager 4// Workspace.hh for Blackbox - an X11 Window manager
5// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) 5// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
@@ -28,6 +28,7 @@
28#include "ClientMenu.hh" 28#include "ClientMenu.hh"
29 29
30#include "FbTk/NotCopyable.hh" 30#include "FbTk/NotCopyable.hh"
31#include "FbTk/Signal.hh"
31 32
32#include <string> 33#include <string>
33#include <list> 34#include <list>
@@ -84,7 +85,7 @@ private:
84 BScreen &m_screen; 85 BScreen &m_screen;
85 86
86 Windows m_windowlist; 87 Windows m_windowlist;
87 FbTk::Subject m_clientlist_sig; 88 FbTk::Signal<void> m_clientlist_sig;
88 ClientMenu m_clientmenu; 89 ClientMenu m_clientmenu;
89 90
90 std::string m_name; ///< name of this workspace 91 std::string m_name; ///< name of this workspace