aboutsummaryrefslogtreecommitdiff
path: root/src/Ewmh.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ewmh.cc')
-rw-r--r--src/Ewmh.cc77
1 files changed, 2 insertions, 75 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