aboutsummaryrefslogtreecommitdiff
path: root/src/Ewmh.cc
diff options
context:
space:
mode:
authormathias <mathias>2006-10-30 19:31:15 (GMT)
committermathias <mathias>2006-10-30 19:31:15 (GMT)
commite5e76e7761f52ba7c0deca75bcecae4fbd3e2ff5 (patch)
treec84838a84802805e9b1463045e86200b7cef917f /src/Ewmh.cc
parent426c12c25c2ef095a882619ad7424684b88465b8 (diff)
downloadfluxbox-e5e76e7761f52ba7c0deca75bcecae4fbd3e2ff5.zip
fluxbox-e5e76e7761f52ba7c0deca75bcecae4fbd3e2ff5.tar.bz2
Cosmetic patch from Slava Semushin
Diffstat (limited to 'src/Ewmh.cc')
-rw-r--r--src/Ewmh.cc99
1 files changed, 51 insertions, 48 deletions
diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index cb9f0f6..aada7cf 100644
--- a/src/Ewmh.cc
+++ b/src/Ewmh.cc
@@ -43,7 +43,10 @@
43#include <algorithm> 43#include <algorithm>
44#include <new> 44#include <new>
45 45
46using namespace std; 46using std::cerr;
47using std::endl;
48using std::vector;
49using std::list;
47 50
48// mipspro has no new(nothrow) 51// mipspro has no new(nothrow)
49#if defined sgi && ! defined GCC 52#if defined sgi && ! defined GCC
@@ -61,7 +64,7 @@ enum EwmhMoveResizeDirection {
61 _NET_WM_MOVERESIZE_SIZE_BOTTOM = 5, 64 _NET_WM_MOVERESIZE_SIZE_BOTTOM = 5,
62 _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT = 6, 65 _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT = 6,
63 _NET_WM_MOVERESIZE_SIZE_LEFT = 7, 66 _NET_WM_MOVERESIZE_SIZE_LEFT = 7,
64 _NET_WM_MOVERESIZE_MOVE = 8, // movement only 67 _NET_WM_MOVERESIZE_MOVE = 8, // movement only
65 _NET_WM_MOVERESIZE_SIZE_KEYBOARD = 9, // size via keyboard 68 _NET_WM_MOVERESIZE_SIZE_KEYBOARD = 9, // size via keyboard
66 _NET_WM_MOVERESIZE_MOVE_KEYBOARD = 10, // move via keyboard 69 _NET_WM_MOVERESIZE_MOVE_KEYBOARD = 10, // move via keyboard
67 _NET_WM_MOVERESIZE_CANCEL = 11 // cancel operation 70 _NET_WM_MOVERESIZE_CANCEL = 11 // cancel operation
@@ -84,19 +87,19 @@ void Ewmh::initForScreen(BScreen &screen) {
84 /* From Extended Window Manager Hints, draft 1.3: 87 /* From Extended Window Manager Hints, draft 1.3:
85 * 88 *
86 * _NET_SUPPORTING_WM_CHECK 89 * _NET_SUPPORTING_WM_CHECK
87 * 90 *
88 * The Window Manager MUST set this property on the root window 91 * The Window Manager MUST set this property on the root window
89 * to be the ID of a child window created by himself, to indicate 92 * to be the ID of a child window created by himself, to indicate
90 * that a compliant window manager is active. The child window 93 * that a compliant window manager is active. The child window
91 * MUST also have the _NET_SUPPORTING_WM_CHECK property set to 94 * MUST also have the _NET_SUPPORTING_WM_CHECK property set to
92 * the ID of the child window. The child window MUST also have 95 * the ID of the child window. The child window MUST also have
93 * the _NET_WM_NAME property set to the name of the Window Manager. 96 * the _NET_WM_NAME property set to the name of the Window Manager.
94 * 97 *
95 * Rationale: The child window is used to distinguish an active 98 * Rationale: The child window is used to distinguish an active
96 * Window Manager from a stale _NET_SUPPORTING_WM_CHECK property 99 * Window Manager from a stale _NET_SUPPORTING_WM_CHECK property
97 * that happens to point to another window. If the 100 * that happens to point to another window. If the
98 * _NET_SUPPORTING_WM_CHECK window on the client window is missing 101 * _NET_SUPPORTING_WM_CHECK window on the client window is missing
99 * or not properly set, clients SHOULD assume that no conforming 102 * or not properly set, clients SHOULD assume that no conforming
100 * Window Manager is present. 103 * Window Manager is present.
101 */ 104 */
102 105
@@ -137,7 +140,7 @@ void Ewmh::initForScreen(BScreen &screen) {
137 m_net_wm_state_below, 140 m_net_wm_state_below,
138 m_net_wm_state_above, 141 m_net_wm_state_above,
139 m_net_wm_state_demands_attention, 142 m_net_wm_state_demands_attention,
140 143
141 // window type 144 // window type
142 m_net_wm_window_type, 145 m_net_wm_window_type,
143 m_net_wm_window_type_dock, 146 m_net_wm_window_type_dock,
@@ -174,7 +177,7 @@ void Ewmh::initForScreen(BScreen &screen) {
174 m_net_request_frame_extents, 177 m_net_request_frame_extents,
175 178
176 m_net_wm_moveresize, 179 m_net_wm_moveresize,
177 180
178 m_net_frame_extents, 181 m_net_frame_extents,
179 182
180 // desktop properties 183 // desktop properties
@@ -289,8 +292,8 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
289 292
290 } else if (atoms[l] == m_net_wm_window_type_splash) { 293 } else if (atoms[l] == m_net_wm_window_type_splash) {
291 /* 294 /*
292 * _NET_WM_WINDOW_TYPE_SPLASH indicates that the 295 * _NET_WM_WINDOW_TYPE_SPLASH indicates that the
293 * window is a splash screen displayed as an application 296 * window is a splash screen displayed as an application
294 * is starting up. 297 * is starting up.
295 */ 298 */
296 win.setDecoration(FluxboxWindow::DECOR_NONE); 299 win.setDecoration(FluxboxWindow::DECOR_NONE);
@@ -318,11 +321,11 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
318 } 321 }
319 XFree(data); 322 XFree(data);
320 } else { 323 } else {
321 // if _NET_WM_WINDOW_TYPE not set and this window 324 // if _NET_WM_WINDOW_TYPE not set and this window
322 // has transient_for the type must be set to _NET_WM_WINDOW_TYPE_DIALOG 325 // has transient_for the type must be set to _NET_WM_WINDOW_TYPE_DIALOG
323 if ( win.winClient().isTransient() ) { 326 if ( win.winClient().isTransient() ) {
324 win.winClient(). 327 win.winClient().
325 changeProperty(m_net_wm_window_type, 328 changeProperty(m_net_wm_window_type,
326 XA_ATOM, 32, PropModeReplace, 329 XA_ATOM, 32, PropModeReplace,
327 (unsigned char*)&m_net_wm_window_type_dialog, 1); 330 (unsigned char*)&m_net_wm_window_type_dialog, 1);
328 } 331 }
@@ -379,20 +382,20 @@ void Ewmh::updateClientClose(WinClient &winclient){
379 382
380void Ewmh::updateClientList(BScreen &screen) { 383void Ewmh::updateClientList(BScreen &screen) {
381 384
382 std::list<WinClient *> creation_order_list = screen.focusControl().creationOrderList(); 385 list<WinClient *> creation_order_list = screen.focusControl().creationOrderList();
383 386
384 size_t num = creation_order_list.size(); 387 size_t num = creation_order_list.size();
385 Window *wl = FB_new_nothrow Window[num]; 388 Window *wl = FB_new_nothrow Window[num];
386 if (wl == 0) { 389 if (wl == 0) {
387 _FB_USES_NLS; 390 _FB_USES_NLS;
388 cerr<<_FB_CONSOLETEXT(Ewmh, OutOfMemoryClientList, 391 cerr<<_FB_CONSOLETEXT(Ewmh, OutOfMemoryClientList,
389 "Fatal: Out of memory, can't allocate for EWMH client list", "")<<endl; 392 "Fatal: Out of memory, can't allocate for EWMH client list", "")<<endl;
390 return; 393 return;
391 } 394 }
392 395
393 int win=0; 396 int win=0;
394 std::list<WinClient *>::iterator client_it = creation_order_list.begin(); 397 list<WinClient *>::iterator client_it = creation_order_list.begin();
395 std::list<WinClient *>::iterator client_it_end = creation_order_list.end(); 398 list<WinClient *>::iterator client_it_end = creation_order_list.end();
396 for (; client_it != client_it_end; ++client_it) 399 for (; client_it != client_it_end; ++client_it)
397 wl[win++] = (*client_it)->window(); 400 wl[win++] = (*client_it)->window();
398 401
@@ -594,11 +597,11 @@ void Ewmh::updateWorkarea(BScreen &screen) {
594} 597}
595 598
596void Ewmh::updateState(FluxboxWindow &win) { 599void Ewmh::updateState(FluxboxWindow &win) {
597 600
598 601
599 updateActions(win); 602 updateActions(win);
600 603
601 typedef std::vector<unsigned int> StateVec; 604 typedef vector<unsigned int> StateVec;
602 605
603 StateVec state; 606 StateVec state;
604 607
@@ -622,7 +625,7 @@ void Ewmh::updateState(FluxboxWindow &win) {
622 FluxboxWindow::ClientList::iterator it = win.clientList().begin(); 625 FluxboxWindow::ClientList::iterator it = win.clientList().begin();
623 FluxboxWindow::ClientList::iterator it_end = win.clientList().end(); 626 FluxboxWindow::ClientList::iterator it_end = win.clientList().end();
624 for (; it != it_end; ++it) { 627 for (; it != it_end; ++it) {
625 628
626 // search the old states for _NET_WM_STATE_SKIP_PAGER and append it 629 // search the old states for _NET_WM_STATE_SKIP_PAGER and append it
627 // to the current state, so it wont get deleted by us. 630 // to the current state, so it wont get deleted by us.
628 StateVec client_state(state); 631 StateVec client_state(state);
@@ -646,7 +649,7 @@ void Ewmh::updateState(FluxboxWindow &win) {
646 649
647 if (!client_state.empty()) { 650 if (!client_state.empty()) {
648 (*it)->changeProperty(m_net_wm_state, XA_ATOM, 32, PropModeReplace, 651 (*it)->changeProperty(m_net_wm_state, XA_ATOM, 32, PropModeReplace,
649 reinterpret_cast<unsigned char*>(&client_state.front()), 652 reinterpret_cast<unsigned char*>(&client_state.front()),
650 client_state.size()); 653 client_state.size());
651 } else 654 } else
652 (*it)->deleteProperty(m_net_wm_state); 655 (*it)->deleteProperty(m_net_wm_state);
@@ -782,7 +785,7 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce,
782 FluxboxWindow* fbwin = winclient->fbwindow(); 785 FluxboxWindow* fbwin = winclient->fbwindow();
783 786
784 // if the raised window is on a different workspace 787 // if the raised window is on a different workspace
785 // we do what the user wish: 788 // we do what the user wish:
786 // either ignore|go to that workspace|get the window 789 // either ignore|go to that workspace|get the window
787 if (fbwin->screen().currentWorkspaceID() != fbwin->workspaceNumber() 790 if (fbwin->screen().currentWorkspaceID() != fbwin->workspaceNumber()
788 && !fbwin->isStuck()) { 791 && !fbwin->isStuck()) {
@@ -801,7 +804,7 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce,
801 } // else we ignore it. my favourite mode :) 804 } // else we ignore it. my favourite mode :)
802 } 805 }
803 fbwin->raise(); 806 fbwin->raise();
804 } 807 }
805 winclient->focus(); 808 winclient->focus();
806 return true; 809 return true;
807 } else if (ce.message_type == m_net_close_window) { 810 } else if (ce.message_type == m_net_close_window) {
@@ -836,7 +839,7 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce,
836 // ce.data.l[0] = source indication 839 // ce.data.l[0] = source indication
837 // ce.data.l[1] = sibling window 840 // ce.data.l[1] = sibling window
838 // ce.data.l[2] = detail 841 // ce.data.l[2] = detail
839 842
840 843
841 WinClient *above_win = Fluxbox::instance()->searchWindow(ce.data.l[1]); 844 WinClient *above_win = Fluxbox::instance()->searchWindow(ce.data.l[1]);
842 if (above_win == 0 || above_win->fbwindow() == 0 || 845 if (above_win == 0 || above_win->fbwindow() == 0 ||
@@ -877,7 +880,7 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce,
877 } else if (ce.message_type == m_net_wm_moveresize) { 880 } else if (ce.message_type == m_net_wm_moveresize) {
878 if (winclient == 0 || winclient->fbwindow() == 0) 881 if (winclient == 0 || winclient->fbwindow() == 0)
879 return true; 882 return true;
880 // data.l[0] = x_root 883 // data.l[0] = x_root
881 // data.l[1] = y_root 884 // data.l[1] = y_root
882 // data.l[2] = direction 885 // data.l[2] = direction
883 // data.l[3] = button 886 // data.l[3] = button
@@ -1030,7 +1033,7 @@ void Ewmh::createAtoms() {
1030void Ewmh::setFullscreen(FluxboxWindow &win, bool value) { 1033void Ewmh::setFullscreen(FluxboxWindow &win, bool value) {
1031 // fullscreen implies maximised, above dock layer, 1034 // fullscreen implies maximised, above dock layer,
1032 // and no decorations (or decorations offscreen) 1035 // and no decorations (or decorations offscreen)
1033 // 1036 //
1034 // TODO: do we need the WindowState etc here anymore? 1037 // TODO: do we need the WindowState etc here anymore?
1035 // FluxboxWindow::setFullscreen() remembering old values 1038 // FluxboxWindow::setFullscreen() remembering old values
1036 // already and set them... 1039 // already and set them...
@@ -1157,8 +1160,8 @@ void Ewmh::updateStrut(WinClient &winclient) {
1157 (unsigned char **) &data) && data) { 1160 (unsigned char **) &data) && data) {
1158 1161
1159 int head = winclient.screen().getHead(winclient); 1162 int head = winclient.screen().getHead(winclient);
1160 winclient.setStrut(winclient.screen().requestStrut(head, 1163 winclient.setStrut(winclient.screen().requestStrut(head,
1161 data[0], data[1], 1164 data[0], data[1],
1162 data[2], data[3])); 1165 data[2], data[3]));
1163 winclient.screen().updateAvailableWorkspaceArea(); 1166 winclient.screen().updateAvailableWorkspaceArea();
1164 } 1167 }
@@ -1172,17 +1175,17 @@ void Ewmh::updateActions(FluxboxWindow &win) {
1172 * 1175 *
1173 * _NET_WM_ALLOWED_ACTIONS, ATOM[] 1176 * _NET_WM_ALLOWED_ACTIONS, ATOM[]
1174 * 1177 *
1175 * A list of atoms indicating user operations that the 1178 * A list of atoms indicating user operations that the
1176 * Window Manager supports for this window. Atoms present in the 1179 * Window Manager supports for this window. Atoms present in the
1177 * list indicate allowed actions, atoms not present in the list 1180 * list indicate allowed actions, atoms not present in the list
1178 * indicate actions that are not supported for this window. The 1181 * indicate actions that are not supported for this window. The
1179 * Window Manager MUST keep this property updated to reflect the 1182 * Window Manager MUST keep this property updated to reflect the
1180 * actions which are currently "active" or "sensitive" for a window. 1183 * actions which are currently "active" or "sensitive" for a window.
1181 * Taskbars, Pagers, and other tools use _NET_WM_ALLOWED_ACTIONS to 1184 * Taskbars, Pagers, and other tools use _NET_WM_ALLOWED_ACTIONS to
1182 * decide which actions should be made available to the user. 1185 * decide which actions should be made available to the user.
1183 */ 1186 */
1184 1187
1185 typedef std::vector<Atom> ActionsVector; 1188 typedef vector<Atom> ActionsVector;
1186 ActionsVector actions; 1189 ActionsVector actions;
1187 actions.reserve(10); 1190 actions.reserve(10);
1188 // all windows can change desktop, 1191 // all windows can change desktop,
@@ -1190,7 +1193,7 @@ void Ewmh::updateActions(FluxboxWindow &win) {
1190 actions.push_back(m_net_wm_action_change_desktop); 1193 actions.push_back(m_net_wm_action_change_desktop);
1191 actions.push_back(m_net_wm_action_shade); 1194 actions.push_back(m_net_wm_action_shade);
1192 actions.push_back(m_net_wm_action_stick); 1195 actions.push_back(m_net_wm_action_stick);
1193 1196
1194 if (win.isResizable()) 1197 if (win.isResizable())
1195 actions.push_back(m_net_wm_action_resize); 1198 actions.push_back(m_net_wm_action_resize);
1196 if (win.isMoveable()) 1199 if (win.isMoveable())
@@ -1225,7 +1228,7 @@ void Ewmh::updateActions(FluxboxWindow &win) {
1225 for (; it != it_end; ++it) { 1228 for (; it != it_end; ++it) {
1226 (*it)->changeProperty(m_net_wm_allowed_actions, XA_ATOM, 32, PropModeReplace, 1229 (*it)->changeProperty(m_net_wm_allowed_actions, XA_ATOM, 32, PropModeReplace,
1227 reinterpret_cast<unsigned char*>(&actions.front()), 1230 reinterpret_cast<unsigned char*>(&actions.front()),
1228 actions.size()); 1231 actions.size());
1229 } 1232 }
1230 1233
1231} 1234}
@@ -1267,7 +1270,7 @@ void Ewmh::setupState(FluxboxWindow &win) {
1267} 1270}
1268 1271
1269void Ewmh::updateFrameExtents(FluxboxWindow &win) { 1272void Ewmh::updateFrameExtents(FluxboxWindow &win) {
1270 /* Frame extents are basically the amount the window manager frame 1273 /* Frame extents are basically the amount the window manager frame
1271 protrudes from the client window, on left, right, top, bottom 1274 protrudes from the client window, on left, right, top, bottom
1272 (it is independent of window position). 1275 (it is independent of window position).
1273 */ 1276 */