aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Ewmh.cc77
-rw-r--r--src/Ewmh.hh16
2 files changed, 2 insertions, 91 deletions
diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index 3942fb9..646fa0e 100644
--- a/src/Ewmh.cc
+++ b/src/Ewmh.cc
@@ -357,7 +357,6 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
357} 357}
358 358
359void Ewmh::updateFrameClose(FluxboxWindow &win) { 359void Ewmh::updateFrameClose(FluxboxWindow &win) {
360 clearState(win);
361} 360}
362 361
363void Ewmh::updateFocusedWindow(BScreen &screen, Window win) { 362void Ewmh::updateFocusedWindow(BScreen &screen, Window win) {
@@ -1029,40 +1028,6 @@ void Ewmh::createAtoms() {
1029 utf8_string = XInternAtom(disp, "UTF8_STRING", False); 1028 utf8_string = XInternAtom(disp, "UTF8_STRING", False);
1030} 1029}
1031 1030
1032
1033void Ewmh::setFullscreen(FluxboxWindow &win, bool value) {
1034 // fullscreen implies maximised, above dock layer,
1035 // and no decorations (or decorations offscreen)
1036 //
1037 // TODO: do we need the WindowState etc here anymore?
1038 // FluxboxWindow::setFullscreen() remembering old values
1039 // already and set them...
1040 // only reason i can see is that the user manually
1041 // moved the (fullscreened) window
1042 WindowState *saved_state = getState(win);
1043 if (value) {
1044 // fullscreen on
1045 if (!saved_state) { // not already fullscreen
1046 saved_state = new WindowState(win.x(), win.y(), win.width(),
1047 win.height(), win.layerNum(), win.decorationMask());
1048 saveState(win, saved_state);
1049 win.setFullscreen(true);
1050 }
1051 } else { // turn off fullscreen
1052 if (saved_state) { // no saved state, can't restore it
1053 win.setFullscreen(false);
1054 /*
1055 win.setDecorationMask(saved_state->decor);
1056 win.moveResize(saved_state->x, saved_state->y,
1057 saved_state->width, saved_state->height);
1058 win.moveToLayer(saved_state->layer);
1059 */
1060 clearState(win);
1061 saved_state = 0;
1062 }
1063 }
1064}
1065
1066// set window state 1031// set window state
1067void Ewmh::setState(FluxboxWindow &win, Atom state, bool value) { 1032void Ewmh::setState(FluxboxWindow &win, Atom state, bool value) {
1068 if (state == m_net_wm_state_sticky) { // STICKY 1033 if (state == m_net_wm_state_sticky) { // STICKY
@@ -1084,7 +1049,7 @@ void Ewmh::setState(FluxboxWindow &win, Atom state, bool value) {
1084 } else if (state == m_net_wm_state_fullscreen) { // fullscreen 1049 } else if (state == m_net_wm_state_fullscreen) { // fullscreen
1085 if ((value && !win.isFullscreen()) || 1050 if ((value && !win.isFullscreen()) ||
1086 (!value && win.isFullscreen())) 1051 (!value && win.isFullscreen()))
1087 setFullscreen(win, value); 1052 win.setFullscreen(value);
1088 } else if (state == m_net_wm_state_hidden) { // minimized 1053 } else if (state == m_net_wm_state_hidden) { // minimized
1089 if (value && !win.isIconic()) 1054 if (value && !win.isIconic())
1090 win.iconify(); 1055 win.iconify();
@@ -1126,7 +1091,7 @@ void Ewmh::toggleState(FluxboxWindow &win, Atom state) {
1126 } else if (state == m_net_wm_state_maximized_vert) { // maximized Vertical 1091 } else if (state == m_net_wm_state_maximized_vert) { // maximized Vertical
1127 win.maximizeVertical(); 1092 win.maximizeVertical();
1128 } else if (state == m_net_wm_state_fullscreen) { // fullscreen 1093 } else if (state == m_net_wm_state_fullscreen) { // fullscreen
1129 setFullscreen(win, getState(win) == 0); // toggle current state 1094 win.setFullscreen(!win.isFullscreen()); // toggle current state
1130 } else if (state == m_net_wm_state_hidden) { // minimized 1095 } else if (state == m_net_wm_state_hidden) { // minimized
1131 if(win.isIconic()) 1096 if(win.isIconic())
1132 win.deiconify(); 1097 win.deiconify();
@@ -1289,41 +1254,3 @@ void Ewmh::updateFrameExtents(FluxboxWindow &win) {
1289 (unsigned char *)extents, 4); 1254 (unsigned char *)extents, 4);
1290 } 1255 }
1291} 1256}
1292
1293
1294Ewmh::WindowState::WindowState(int t_x, int t_y,
1295 unsigned int t_width,
1296 unsigned int t_height,
1297 int t_layer, unsigned int t_decor) :
1298 x(t_x), y(t_y),
1299 layer(t_layer),
1300 width(t_width),
1301 height(t_height),
1302 decor(t_decor)
1303{}
1304
1305Ewmh::WindowState *Ewmh::getState(FluxboxWindow &win) {
1306 SavedState::iterator it = m_savedstate.find(&win);
1307 if (it == m_savedstate.end())
1308 return 0;
1309 else
1310 return it->second;
1311}
1312
1313void Ewmh::clearState(FluxboxWindow &win) {
1314 WindowState *state = 0;
1315 SavedState::iterator it = m_savedstate.find(&win);
1316 if (it == m_savedstate.end())
1317 return;
1318
1319 state = it->second;
1320
1321 m_savedstate.erase(it);
1322 delete state;
1323}
1324
1325void Ewmh::saveState(FluxboxWindow &win, WindowState *state) {
1326 m_savedstate[&win] = state;
1327}
1328
1329
diff --git a/src/Ewmh.hh b/src/Ewmh.hh
index 8652c6b..f917390 100644
--- a/src/Ewmh.hh
+++ b/src/Ewmh.hh
@@ -60,20 +60,10 @@ public:
60 void updateFrameClose(FluxboxWindow &win); 60 void updateFrameClose(FluxboxWindow &win);
61 61
62 void updateClientClose(WinClient &winclient); 62 void updateClientClose(WinClient &winclient);
63
64
65 void setFullscreen(FluxboxWindow &win, bool value);
66 63
67 void updateFrameExtents(FluxboxWindow &win); 64 void updateFrameExtents(FluxboxWindow &win);
68private: 65private:
69 66
70 typedef struct WindowState {
71 WindowState(int x, int y, unsigned int width, unsigned int height,
72 int layer, unsigned int decor);
73 int x, y, layer;
74 unsigned int width, height, decor;
75 } WindowState;
76
77 enum { STATE_REMOVE = 0, STATE_ADD = 1, STATE_TOGGLE = 2}; 67 enum { STATE_REMOVE = 0, STATE_ADD = 1, STATE_TOGGLE = 2};
78 68
79 void setState(FluxboxWindow &win, Atom state, bool value); 69 void setState(FluxboxWindow &win, Atom state, bool value);
@@ -153,12 +143,6 @@ private:
153 Atom utf8_string; 143 Atom utf8_string;
154 144
155 std::vector<Window> m_windows; 145 std::vector<Window> m_windows;
156 typedef std::map<FluxboxWindow *, WindowState *> SavedState;
157 SavedState m_savedstate;
158
159 WindowState *getState(FluxboxWindow &win);
160 void clearState(FluxboxWindow &win);
161 void saveState(FluxboxWindow &win, WindowState *state);
162 146
163 FbTk::FbString getUTF8Property(Atom property); 147 FbTk::FbString getUTF8Property(Atom property);
164}; 148};