1
// Remember.hh for Fluxbox Window Manager
2
// Copyright (c) 2003 - 2005 Henrik Kinnunen (fluxgen at fluxbox dot org)
3
// and Simon Bowden (rathnor at users.sourceforge.net)
4
// Copyright (c) 2002 Xavier Brouckaert
6
// Permission is hereby granted, free of charge, to any person obtaining a
7
// copy of this software and associated documentation files (the "Software"),
8
// to deal in the Software without restriction, including without limitation
9
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
// and/or sell copies of the Software, and to permit persons to whom the
11
// Software is furnished to do so, subject to the following conditions:
13
// The above copyright notice and this permission notice shall be included in
14
// all copies or substantial portions of the Software.
16
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
// DEALINGS IN THE SOFTWARE.
24
// $Id: Remember.hh 4064 2005-06-23 03:10:26Z fluxgen $
26
/* Based on the original "Remember patch" by Xavier Brouckaert */
31
#include "AtomHandler.hh"
46
Application(bool grouped);
47
inline void forgetWorkspace() { workspace_remember = false; }
48
inline void forgetHead() { head_remember = false; }
49
inline void forgetDimensions() { dimensions_remember = false; }
50
inline void forgetPosition() { position_remember = false; }
51
inline void forgetShadedstate() { shadedstate_remember = false; }
52
inline void forgetTabstate() { tabstate_remember = false; }
53
inline void forgetDecostate() { decostate_remember = false; }
54
inline void forgetFocusHiddenstate() { focushiddenstate_remember= false; }
55
inline void forgetIconHiddenstate() { iconhiddenstate_remember= false; }
56
inline void forgetStuckstate() { stuckstate_remember = false; }
57
inline void forgetJumpworkspace() { jumpworkspace_remember = false; }
58
inline void forgetLayer() { layer_remember = false; }
59
inline void forgetSaveOnClose() { save_on_close_remember = false; }
61
inline void rememberWorkspace(int ws)
62
{ workspace = ws; workspace_remember = true; }
63
inline void rememberHead(int h)
64
{ head = h; head_remember = true; }
65
inline void rememberDimensions(int width, int height)
66
{ w = width; h = height; dimensions_remember = true; }
67
inline void rememberFocusHiddenstate(bool state)
68
{ focushiddenstate= state; focushiddenstate_remember= true; }
69
inline void rememberIconHiddenstate(bool state)
70
{ iconhiddenstate= state; iconhiddenstate_remember= true; }
71
inline void rememberPosition(int posx, int posy, unsigned char rfc= 0 )
72
{ x = posx; y = posy; refc = rfc; position_remember = true; }
73
inline void rememberShadedstate(bool state)
74
{ shadedstate = state; shadedstate_remember = true; }
75
inline void rememberTabstate(bool state)
76
{ tabstate = state; tabstate_remember = true; }
77
inline void rememberDecostate(unsigned int state)
78
{ decostate = state; decostate_remember = true; }
79
inline void rememberStuckstate(bool state)
80
{ stuckstate = state; stuckstate_remember = true; }
81
inline void rememberJumpworkspace(bool state)
82
{ jumpworkspace = state; jumpworkspace_remember = true; }
83
inline void rememberLayer(int layernum)
84
{ layer = layernum; layer_remember = true; }
85
inline void rememberSaveOnClose(bool state)
86
{ save_on_close = state; save_on_close_remember = true; }
89
bool workspace_remember;
90
unsigned int workspace;
95
bool dimensions_remember;
96
int w,h; // width, height
98
bool position_remember;
100
unsigned char refc; // referenceCorner-> 0 - upperleft
105
bool shadedstate_remember;
108
bool tabstate_remember;
111
bool decostate_remember;
112
unsigned int decostate;
114
bool stuckstate_remember;
117
bool focushiddenstate_remember;
118
bool focushiddenstate;
120
bool iconhiddenstate_remember;
121
bool iconhiddenstate;
123
bool jumpworkspace_remember;
129
bool save_on_close_remember;
133
FluxboxWindow *group;
138
* Class Remember is an atomhandler to avoid interfering with
139
* the main code as much as possible, since we hope that one day
140
* things like this (and maybe toolbar/slit) can become some sort
141
* of modular plugin. Doing this should help give an idea of what
142
* sort of interface abilities we'll need...
144
class Remember : public AtomHandler {
147
* holds which attributes to remember
152
REM_FOCUSHIDDENSTATE,
160
//REM_TABSTATE, ... external tabs disabled atm
163
REM_LASTATTRIB // not actually used
177
// a "pattern" to the relevant app
178
// each app exists ONLY for that pattern.
179
// And we need to keep a list of pairs as we want to keep the
180
// applications in the same order as they will be in the apps file
181
typedef std::list< std::pair<ClientPattern *, Application *> > Patterns;
183
// We keep track of which app is assigned to a winclient
184
// particularly useful to update counters etc on windowclose
185
typedef std::map<WinClient *, Application *> Clients;
187
// we have to remember any startups we did so that they are saved again
188
typedef std::list<std::string> Startups;
193
Application* find(WinClient &winclient);
194
Application* add(WinClient &winclient);
199
bool isRemembered(WinClient &win, Attribute attrib);
200
void rememberAttrib(WinClient &win, Attribute attrib);
201
void forgetAttrib(WinClient &win, Attribute attrib);
203
// Functions relating to AtomHandler
205
// Functions we actually use
206
void setupFrame(FluxboxWindow &win);
207
void setupClient(WinClient &winclient);
208
void updateFrameClose(FluxboxWindow &win);
209
void updateClientClose(WinClient &winclient);
211
void initForScreen(BScreen &screen);
213
// Functions we ignore (zero from AtomHandler)
214
// Leaving here in case they might be useful later
218
void updateFocusedWindow(BScreen &, Window) { }
219
void updateClientList(BScreen &screen) {}
220
void updateWorkspaceNames(BScreen &screen) {}
221
void updateCurrentWorkspace(BScreen &screen) {}
222
void updateWorkspaceCount(BScreen &screen) {}
223
void updateWorkarea(BScreen &) { }
225
void updateWorkspace(FluxboxWindow &win) {}
226
void updateState(FluxboxWindow &win) {}
227
void updateHints(FluxboxWindow &win) {}
228
void updateLayer(FluxboxWindow &win) {}
230
bool checkClientMessage(const XClientMessageEvent &ce,
231
BScreen * screen, WinClient * const winclient) { return false; }
233
bool propertyNotify(WinClient &winclient, Atom the_property) { return false; }
235
static Remember &instance() { return *s_instance; }
238
// returns number of lines read
239
// optionally can give a line to read before the first (lookahead line)
240
int parseApp(std::ifstream &file, Application &app, std::string *first_line = 0);
245
static Remember *s_instance;
248
#endif // REMEMBER_HH