aboutsummaryrefslogtreecommitdiff
path: root/src/Remember.hh
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-04-26 07:57:00 (GMT)
committerrathnor <rathnor>2003-04-26 07:57:00 (GMT)
commit52a89a92254b7c55f97ee08055d42a4a8e48259f (patch)
tree44aa6cc1d38fac83605410e0380db53eb790d979 /src/Remember.hh
parent216db9159fafe20eab591dca62856e5fe55d5837 (diff)
downloadfluxbox-52a89a92254b7c55f97ee08055d42a4a8e48259f.zip
fluxbox-52a89a92254b7c55f97ee08055d42a4a8e48259f.tar.bz2
Remember functionality
Diffstat (limited to 'src/Remember.hh')
-rw-r--r--src/Remember.hh174
1 files changed, 174 insertions, 0 deletions
diff --git a/src/Remember.hh b/src/Remember.hh
new file mode 100644
index 0000000..bc7b292
--- /dev/null
+++ b/src/Remember.hh
@@ -0,0 +1,174 @@
1// Remember.hh for Fluxbox Window Manager
2// Copyright (c) 2002 Xavier Brouckaert
3// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
4//
5// Permission is hereby granted, free of charge, to any person obtaining a
6// copy of this software and associated documentation files (the "Software"),
7// to deal in the Software without restriction, including without limitation
8// the rights to use, copy, modify, merge, publish, distribute, sublicense,
9// and/or sell copies of the Software, and to permit persons to whom the
10// Software is furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE.
22
23// $Id: Remember.hh,v 1.1 2003/04/26 07:57:00 rathnor Exp $
24
25/* Based on the original "Remember patch" by Xavier Brouckaert */
26
27#ifndef REMEMBER_HH
28#define REMEMBER_HH
29
30#include "Window.hh"
31#include "AtomHandler.hh"
32#include "Screen.hh"
33
34/*
35#include <iostream>
36#include <string>
37#include "StringUtil.hh"
38*/
39#include <fstream>
40#include <map>
41
42class Application {
43public:
44 Application();
45 inline void forgetWorkspace() { workspace_remember = false; }
46 inline void forgetDimensions() { dimensions_remember = false; }
47 inline void forgetPosition() { position_remember = false; }
48 inline void forgetShadedstate() { shadedstate_remember = false; }
49 inline void forgetTabstate() { tabstate_remember = false; }
50 inline void forgetDecostate() { decostate_remember = false; }
51 inline void forgetStuckstate() { stuckstate_remember = false; }
52 inline void forgetJumpworkspace() { jumpworkspace_remember = false; }
53 inline void forgetSaveOnClose() { save_on_close_remember = false; }
54
55 inline void rememberWorkspace(int ws)
56 { workspace = ws; workspace_remember = true; }
57 inline void rememberDimensions(int width, int height)
58 { w = width; h = height; dimensions_remember = true; }
59 inline void rememberPosition(int posx, int posy)
60 { x = posx; y = posy; position_remember = true; }
61 inline void rememberShadedstate(bool state)
62 { shadedstate = state; shadedstate_remember = true; }
63 inline void rememberTabstate(bool state)
64 { tabstate = state; tabstate_remember = true; }
65 inline void rememberDecostate(unsigned int state)
66 { decostate = state; decostate_remember = true; }
67 inline void rememberStuckstate(bool state)
68 { stuckstate = state; stuckstate_remember = true; }
69 inline void rememberJumpworkspace(bool state)
70 { jumpworkspace = state; jumpworkspace_remember = true; }
71 inline void rememberSaveOnClose(bool state)
72 { save_on_close = state; save_on_close_remember = true; }
73
74
75 bool workspace_remember;
76 unsigned int workspace;
77
78 bool dimensions_remember;
79 int w,h; // width, height
80
81 bool position_remember;
82 int x,y;
83
84 bool shadedstate_remember;
85 bool shadedstate;
86
87 bool tabstate_remember;
88 bool tabstate;
89
90 bool decostate_remember;
91 unsigned int decostate;
92
93 bool stuckstate_remember;
94 bool stuckstate;
95
96 bool jumpworkspace_remember;
97 bool jumpworkspace;
98
99 bool save_on_close_remember;
100 bool save_on_close;
101};
102
103
104/*
105 * Class Remember is an atomhandler to avoid interfering with
106 * the main code as much as possible, since we hope that one day
107 * things like this (and maybe toolbar/slit) can become some sort
108 * of modular plugin. Doing this should help give an idea of what
109 * sort of interface abilities we'll need...
110 */
111class Remember : public AtomHandler {
112public:
113 enum Attribute {
114 REM_WORKSPACE=0,
115 REM_DIMENSIONS,
116 REM_POSITION,
117 REM_STUCKSTATE,
118 REM_DECOSTATE,
119 REM_SHADEDSTATE,
120 //REM_TABSTATE, ... external tabs disabled atm
121 REM_JUMPWORKSPACE,
122 REM_SAVEONCLOSE,
123 REM_LASTATTRIB // not actually used
124 };
125
126 typedef std::map<string,Application *> Apps;
127 Remember();
128
129 Application* find(WinClient &winclient);
130 Application* find(const char* app_name);
131 Application* add(WinClient &winclient);
132 Application* add(const char* app_name);
133
134 void load();
135 void save();
136
137 bool isRemembered(WinClient &win, Attribute attrib);
138 void rememberAttrib(WinClient &win, Attribute attrib);
139 void forgetAttrib(WinClient &win, Attribute attrib);
140
141 // Functions relating to AtomHandler
142
143 // Functions we actually use
144 void setupWindow(FluxboxWindow &win);
145 void updateWindowClose(FluxboxWindow &win);
146
147 // Functions we ignore (zero from AtomHandler)
148 // Leaving here in case they might be useful later
149
150 void initForScreen(BScreen &screen) {}
151
152 void updateClientList(BScreen &screen) {}
153 void updateWorkspaceNames(BScreen &screen) {}
154 void updateCurrentWorkspace(BScreen &screen) {}
155 void updateWorkspaceCount(BScreen &screen) {}
156
157 void updateWorkspace(FluxboxWindow &win) {}
158 void updateState(FluxboxWindow &win) {}
159 void updateHints(FluxboxWindow &win) {}
160 void updateLayer(FluxboxWindow &win) {}
161
162 bool checkClientMessage(const XClientMessageEvent &ce,
163 BScreen * screen, FluxboxWindow * const win) { return false; }
164
165
166private:
167
168 // returns number of lines read
169 int parseApp(ifstream &file, Application *a);
170 Apps apps;
171
172};
173
174#endif // REMEMBER_HH