diff options
author | fluxgen <fluxgen> | 2002-09-07 20:22:08 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-09-07 20:22:08 (GMT) |
commit | 314c3116f0778f8a91c4aa605f7d3ffe57246e80 (patch) | |
tree | 44c5696ce4304c73ef7b978dca49489a0673610a | |
parent | 54d855ee5947d6575d04d2a26cf5132df1f003ec (diff) | |
download | fluxbox-314c3116f0778f8a91c4aa605f7d3ffe57246e80.zip fluxbox-314c3116f0778f8a91c4aa605f7d3ffe57246e80.tar.bz2 |
added subjects and removed gnome stuff
-rw-r--r-- | src/Screen.cc | 152 | ||||
-rw-r--r-- | src/Screen.hh | 47 |
2 files changed, 59 insertions, 140 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index 60c8a63..492f0d1 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Screen.cc,v 1.65 2002/08/30 14:03:31 fluxgen Exp $ | 25 | // $Id: Screen.cc,v 1.66 2002/09/07 20:22:08 fluxgen Exp $ |
26 | 26 | ||
27 | //use GNU extensions | 27 | //use GNU extensions |
28 | #ifndef _GNU_SOURCE | 28 | #ifndef _GNU_SOURCE |
@@ -220,9 +220,11 @@ toolbar_placement(rm, Toolbar::BOTTOMCENTER, scrname+".toolbar.placement", altsc | |||
220 | BScreen::BScreen(ResourceManager &rm, Fluxbox *b, | 220 | BScreen::BScreen(ResourceManager &rm, Fluxbox *b, |
221 | const string &screenname, const string &altscreenname, | 221 | const string &screenname, const string &altscreenname, |
222 | int scrn) : ScreenInfo(b, scrn), | 222 | int scrn) : ScreenInfo(b, scrn), |
223 | #ifdef GNOME | 223 | m_clientlist_sig(*this), // client signal |
224 | gnome_win(None), | 224 | m_workspacecount_sig(*this), // workspace count signal |
225 | #endif | 225 | m_workspacenames_sig(*this), // workspace names signal |
226 | m_currentworkspace_sig(*this), // current workspace signal | ||
227 | |||
226 | theme(0), | 228 | theme(0), |
227 | resource(rm, screenname, altscreenname) | 229 | resource(rm, screenname, altscreenname) |
228 | { | 230 | { |
@@ -279,9 +281,6 @@ resource(rm, screenname, altscreenname) | |||
279 | theme = new Theme(getBaseDisplay()->getXDisplay(), getRootWindow(), colormap(), getScreenNumber(), | 281 | theme = new Theme(getBaseDisplay()->getXDisplay(), getRootWindow(), colormap(), getScreenNumber(), |
280 | image_control, fluxbox->getStyleFilename(), getRootCommand().c_str()); | 282 | image_control, fluxbox->getStyleFilename(), getRootCommand().c_str()); |
281 | 283 | ||
282 | #ifdef GNOME | ||
283 | initGnomeAtoms(); | ||
284 | #endif | ||
285 | 284 | ||
286 | #ifdef NEWWMSPEC | 285 | #ifdef NEWWMSPEC |
287 | Atom netwmsupported[] = { | 286 | Atom netwmsupported[] = { |
@@ -446,6 +445,8 @@ resource(rm, screenname, altscreenname) | |||
446 | if (!win->isManaged()) { | 445 | if (!win->isManaged()) { |
447 | delete win; | 446 | delete win; |
448 | win = 0; | 447 | win = 0; |
448 | } else { | ||
449 | Fluxbox::instance()->attachSignals(*win); | ||
449 | } | 450 | } |
450 | 451 | ||
451 | if (win) { | 452 | if (win) { |
@@ -475,9 +476,6 @@ namespace { | |||
475 | } | 476 | } |
476 | 477 | ||
477 | BScreen::~BScreen() { | 478 | BScreen::~BScreen() { |
478 | #ifdef GNOME | ||
479 | XDestroyWindow(getBaseDisplay()->getXDisplay(), gnome_win); | ||
480 | #endif | ||
481 | if (! managed) return; | 479 | if (! managed) return; |
482 | 480 | ||
483 | if (geom_pixmap != None) | 481 | if (geom_pixmap != None) |
@@ -666,30 +664,7 @@ void BScreen::removeWorkspaceNames() { | |||
666 | } | 664 | } |
667 | 665 | ||
668 | void BScreen::updateWorkspaceNamesAtom() { | 666 | void BScreen::updateWorkspaceNamesAtom() { |
669 | 667 | m_workspacenames_sig.notify(); | |
670 | #ifdef GNOME | ||
671 | XTextProperty text; | ||
672 | int number_of_desks = workspaceNames.size(); | ||
673 | |||
674 | char s[1024]; | ||
675 | char *names[number_of_desks]; | ||
676 | |||
677 | for (int i = 0; i < number_of_desks; i++) { | ||
678 | sprintf(s, "Desktop %i", i); | ||
679 | names[i] = new char[strlen(s) + 1]; | ||
680 | strcpy(names[i], s); | ||
681 | } | ||
682 | |||
683 | if (XStringListToTextProperty(names, number_of_desks, &text)) { | ||
684 | XSetTextProperty(getBaseDisplay()->getXDisplay(), getRootWindow(), | ||
685 | &text, FbAtoms::instance()->getGnomeWorkspaceNamesAtom()); | ||
686 | XFree(text.value); | ||
687 | } | ||
688 | |||
689 | for (int i = 0; i < number_of_desks; i++) | ||
690 | delete names[i]; | ||
691 | |||
692 | #endif | ||
693 | 668 | ||
694 | } | 669 | } |
695 | 670 | ||
@@ -899,21 +874,15 @@ void BScreen::removeNetizen(Window w) { | |||
899 | 874 | ||
900 | 875 | ||
901 | void BScreen::updateNetizenCurrentWorkspace() { | 876 | void BScreen::updateNetizenCurrentWorkspace() { |
902 | #ifdef NEWWMSPEC | 877 | #ifdef NEWWMSPEC |
903 | //update _NET_WM_CURRENT_DESKTOP | 878 | //update _NET_WM_CURRENT_DESKTOP |
904 | int workspace = getCurrentWorkspaceID(); | 879 | int workspace = getCurrentWorkspaceID(); |
905 | XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(), | 880 | XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(), |
906 | getBaseDisplay()->getNETCurrentDesktopAtom(), XA_CARDINAL, 32, PropModeReplace, | 881 | getBaseDisplay()->getNETCurrentDesktopAtom(), XA_CARDINAL, 32, PropModeReplace, |
907 | (unsigned char *)&workspace, 1); | 882 | (unsigned char *)&workspace, 1); |
908 | #endif | 883 | #endif // NEWWMSPEC |
909 | #ifdef GNOME | 884 | |
910 | //update _WIN_WORKSPACE | 885 | m_currentworkspace_sig.notify(); |
911 | int gnome_workspace = getCurrentWorkspaceID(); | ||
912 | XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(), | ||
913 | FbAtoms::instance()->getGnomeWorkspaceAtom(), XA_CARDINAL, 32, PropModeReplace, | ||
914 | (unsigned char *)&gnome_workspace, 1); | ||
915 | updateGnomeClientList(); | ||
916 | #endif | ||
917 | 886 | ||
918 | Netizens::iterator it = netizenList.begin(); | 887 | Netizens::iterator it = netizenList.begin(); |
919 | Netizens::iterator it_end = netizenList.end(); | 888 | Netizens::iterator it_end = netizenList.end(); |
@@ -931,22 +900,15 @@ void BScreen::updateNetizenWorkspaceCount() { | |||
931 | for (; it != it_end; ++it) { | 900 | for (; it != it_end; ++it) { |
932 | (*it)->sendWorkspaceCount(); | 901 | (*it)->sendWorkspaceCount(); |
933 | } | 902 | } |
934 | #ifdef NEWWMSPEC | 903 | #ifdef NEWWMSPEC |
935 | //update _NET_WM_NUMBER_OF_DESKTOPS | 904 | //update _NET_WM_NUMBER_OF_DESKTOPS |
936 | int numworkspaces = getCount()-1; | 905 | int numworkspaces = getCount()-1; |
937 | XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(), | 906 | XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(), |
938 | getBaseDisplay()->getNETNumberOfDesktopsAtom(), XA_CARDINAL, 32, PropModeReplace, | 907 | getBaseDisplay()->getNETNumberOfDesktopsAtom(), XA_CARDINAL, 32, PropModeReplace, |
939 | (unsigned char *)&numworkspaces, 1); | 908 | (unsigned char *)&numworkspaces, 1); |
940 | #endif | 909 | #endif // NEWWMSPEC |
941 | 910 | ||
942 | #ifdef GNOME | 911 | m_workspacecount_sig.notify(); |
943 | { | ||
944 | int numworkspaces = getCount(); | ||
945 | XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(), | ||
946 | FbAtoms::instance()->getGnomeWorkspaceCountAtom(), XA_CARDINAL, 32, PropModeReplace, | ||
947 | (unsigned char *)&numworkspaces, 1); | ||
948 | } | ||
949 | #endif | ||
950 | 912 | ||
951 | } | 913 | } |
952 | 914 | ||
@@ -969,9 +931,8 @@ void BScreen::updateNetizenWindowAdd(Window w, unsigned long p) { | |||
969 | for (; it != it_end; ++it) { | 931 | for (; it != it_end; ++it) { |
970 | (*it)->sendWindowAdd(w, p); | 932 | (*it)->sendWindowAdd(w, p); |
971 | } | 933 | } |
972 | #ifdef GNOME | 934 | |
973 | updateGnomeClientList(); | 935 | m_clientlist_sig.notify(); |
974 | #endif | ||
975 | 936 | ||
976 | } | 937 | } |
977 | 938 | ||
@@ -982,9 +943,8 @@ void BScreen::updateNetizenWindowDel(Window w) { | |||
982 | for (; it != it_end; ++it) { | 943 | for (; it != it_end; ++it) { |
983 | (*it)->sendWindowDel(w); | 944 | (*it)->sendWindowDel(w); |
984 | } | 945 | } |
985 | #ifdef GNOME | 946 | |
986 | updateGnomeClientList(); | 947 | m_clientlist_sig.notify(); |
987 | #endif | ||
988 | } | 948 | } |
989 | 949 | ||
990 | 950 | ||
@@ -1761,73 +1721,3 @@ FluxboxWindow* BScreen::useAutoGroupWindow() { | |||
1761 | return w ? Fluxbox::instance()->searchWindow(w) : 0; | 1721 | return w ? Fluxbox::instance()->searchWindow(w) : 0; |
1762 | } | 1722 | } |
1763 | 1723 | ||
1764 | #ifdef GNOME | ||
1765 | void BScreen::initGnomeAtoms() { | ||
1766 | |||
1767 | /* create the GNOME window */ | ||
1768 | gnome_win = XCreateSimpleWindow(getBaseDisplay()->getXDisplay(), | ||
1769 | getRootWindow(), 0, 0, 5, 5, 0, 0, 0); | ||
1770 | FbAtoms *fba = FbAtoms::instance(); | ||
1771 | /* supported WM check */ | ||
1772 | XChangeProperty(getBaseDisplay()->getXDisplay(), | ||
1773 | getRootWindow(), fba->getGnomeSupportingWMCheckAtom(), | ||
1774 | XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &gnome_win, 1); | ||
1775 | |||
1776 | XChangeProperty(getBaseDisplay()->getXDisplay(), gnome_win, | ||
1777 | fba->getGnomeSupportingWMCheckAtom(), | ||
1778 | XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &gnome_win, 1); | ||
1779 | |||
1780 | Atom gnomeatomlist[] = { | ||
1781 | fba->getGnomeWorkspaceAtom(), | ||
1782 | fba->getGnomeWorkspaceCountAtom(), | ||
1783 | fba->getGnomeStateAtom(), | ||
1784 | fba->getGnomeWorkspaceNamesAtom(), | ||
1785 | fba->getGnomeHintsAtom(), | ||
1786 | fba->getGnomeClientListAtom(), | ||
1787 | // getBaseDisplay()->getGnomeLayerAtom(), // not supported yet | ||
1788 | }; | ||
1789 | |||
1790 | //list atoms that we support | ||
1791 | XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(), | ||
1792 | fba->getGnomeProtAtom(), XA_ATOM, 32, PropModeReplace, | ||
1793 | (unsigned char *)gnomeatomlist, (sizeof gnomeatomlist)/sizeof gnomeatomlist[0]); | ||
1794 | |||
1795 | } | ||
1796 | |||
1797 | void BScreen::updateGnomeClientList() { | ||
1798 | int num=0; | ||
1799 | Workspaces::iterator workspace_it = workspacesList.begin(); | ||
1800 | Workspaces::iterator workspace_it_end = workspacesList.end(); | ||
1801 | for (; workspace_it != workspace_it_end; ++workspace_it) { | ||
1802 | num += (*workspace_it)->getWindowList().size(); | ||
1803 | } | ||
1804 | //int num = getCurrentWorkspace()->getWindowList().size(); | ||
1805 | |||
1806 | Window *wl = new Window[num]; | ||
1807 | //start the iterator from begining | ||
1808 | workspace_it = workspacesList.begin(); | ||
1809 | int win=0; | ||
1810 | for (; workspace_it != workspace_it_end; ++workspace_it) { | ||
1811 | |||
1812 | // Fill in array of window ID's | ||
1813 | Workspace::Windows::const_iterator it = (*workspace_it)->getWindowList().begin(); | ||
1814 | Workspace::Windows::const_iterator it_end = (*workspace_it)->getWindowList().end(); | ||
1815 | for (; it != it_end; ++it) { | ||
1816 | //check if the window don't want to be visible in the list | ||
1817 | if (! ( (*it)->getGnomeHints() & FluxboxWindow::WIN_STATE_HIDDEN) ) { | ||
1818 | wl[win++] = (*it)->getClientWindow(); | ||
1819 | } | ||
1820 | } | ||
1821 | } | ||
1822 | //number of windows to show in client list | ||
1823 | num = win; | ||
1824 | XChangeProperty(getBaseDisplay()->getXDisplay(), | ||
1825 | getRootWindow(), FbAtoms::instance()->getGnomeClientListAtom(), XA_CARDINAL, 32, | ||
1826 | PropModeReplace, (unsigned char *)wl, num); | ||
1827 | |||
1828 | if (wl) | ||
1829 | delete wl; | ||
1830 | } | ||
1831 | |||
1832 | #endif //!GNOME | ||
1833 | |||
diff --git a/src/Screen.hh b/src/Screen.hh index 967804e..78d518f 100644 --- a/src/Screen.hh +++ b/src/Screen.hh | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Screen.hh,v 1.43 2002/08/30 14:03:31 fluxgen Exp $ | 25 | // $Id: Screen.hh,v 1.44 2002/09/07 20:19:13 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef SCREEN_HH | 27 | #ifndef SCREEN_HH |
28 | #define SCREEN_HH | 28 | #define SCREEN_HH |
@@ -64,6 +64,9 @@ | |||
64 | 64 | ||
65 | class BScreen : public ScreenInfo { | 65 | class BScreen : public ScreenInfo { |
66 | public: | 66 | public: |
67 | typedef std::vector<Workspace *> Workspaces; | ||
68 | typedef std::vector<std::string> WorkspaceNames; | ||
69 | |||
67 | BScreen(ResourceManager &rm, Fluxbox *b, | 70 | BScreen(ResourceManager &rm, Fluxbox *b, |
68 | const std::string &screenname, const std::string &altscreenname, | 71 | const std::string &screenname, const std::string &altscreenname, |
69 | int scrn); | 72 | int scrn); |
@@ -133,8 +136,20 @@ public: | |||
133 | inline unsigned int getIconCount() const { return iconList.size(); } | 136 | inline unsigned int getIconCount() const { return iconList.size(); } |
134 | inline const Icons &getIconList() const { return iconList; } | 137 | inline const Icons &getIconList() const { return iconList; } |
135 | inline Icons &getIconList() { return iconList; } | 138 | inline Icons &getIconList() { return iconList; } |
139 | const Workspaces &getWorkspacesList() const { return workspacesList; } | ||
140 | const WorkspaceNames &getWorkspaceNames() const { return workspaceNames; } | ||
141 | |||
142 | /// client list signal | ||
143 | FbTk::Subject &clientListSig() { return m_clientlist_sig; } | ||
144 | /// workspace count signal | ||
145 | FbTk::Subject &workspaceCountSig() { return m_workspacecount_sig; } | ||
146 | /// workspace names signal | ||
147 | FbTk::Subject &workspaceNamesSig() { return m_workspacenames_sig; } | ||
148 | /// current workspace signal | ||
149 | FbTk::Subject ¤tWorkspaceSig() { return m_currentworkspace_sig; } | ||
150 | |||
136 | /// @return the resource value of number of workspace | 151 | /// @return the resource value of number of workspace |
137 | inline int getNumberOfWorkspaces() const { return *resource.workspaces; } | 152 | inline int getNumberOfWorkspaces() const { return *resource.workspaces; } |
138 | inline Toolbar::Placement getToolbarPlacement() const { return *resource.toolbar_placement; } | 153 | inline Toolbar::Placement getToolbarPlacement() const { return *resource.toolbar_placement; } |
139 | #ifdef XINERAMA | 154 | #ifdef XINERAMA |
140 | inline int getToolbarOnHead() { return *resource.toolbar_on_head; } | 155 | inline int getToolbarOnHead() { return *resource.toolbar_on_head; } |
@@ -255,13 +270,27 @@ public: | |||
255 | // prevFocus/nextFocus option bits | 270 | // prevFocus/nextFocus option bits |
256 | enum { CYCLESKIPLOWERTABS = 0x01, CYCLESKIPSTUCK = 0x02, CYCLESKIPSHADED = 0x04, | 271 | enum { CYCLESKIPLOWERTABS = 0x01, CYCLESKIPSTUCK = 0x02, CYCLESKIPSHADED = 0x04, |
257 | CYCLEDEFAULT = 0x00 }; | 272 | CYCLEDEFAULT = 0x00 }; |
273 | |||
274 | class ScreenSubject:public FbTk::Subject { | ||
275 | public: | ||
276 | ScreenSubject(BScreen &scr):m_scr(scr) { } | ||
277 | const BScreen &screen() const { return m_scr; } | ||
278 | BScreen &screen() { return m_scr; } | ||
279 | private: | ||
280 | BScreen &m_scr; | ||
281 | }; | ||
282 | |||
258 | private: | 283 | private: |
259 | bool doSkipWindow(const FluxboxWindow *w, int options); | 284 | bool doSkipWindow(const FluxboxWindow *w, int options); |
260 | #ifdef GNOME | 285 | |
261 | void initGnomeAtoms(); | 286 | ScreenSubject |
262 | void updateGnomeClientList(); | 287 | m_clientlist_sig, ///< client signal |
263 | Window gnome_win; | 288 | m_workspacecount_sig, ///< workspace count signal |
264 | #endif | 289 | m_workspacenames_sig, ///< workspace names signal |
290 | m_currentworkspace_sig; ///< current workspace signal | ||
291 | |||
292 | |||
293 | |||
265 | Theme *theme; | 294 | Theme *theme; |
266 | 295 | ||
267 | Bool root_colormap_installed, managed, geom_visible; | 296 | Bool root_colormap_installed, managed, geom_visible; |
@@ -294,8 +323,8 @@ private: | |||
294 | unsigned int geom_w, geom_h; | 323 | unsigned int geom_w, geom_h; |
295 | unsigned long event_mask; | 324 | unsigned long event_mask; |
296 | 325 | ||
297 | typedef std::vector<std::string> WorkspaceNames; | 326 | |
298 | typedef std::vector<Workspace *> Workspaces; | 327 | |
299 | 328 | ||
300 | WorkspaceNames workspaceNames; | 329 | WorkspaceNames workspaceNames; |
301 | Workspaces workspacesList; | 330 | Workspaces workspacesList; |