aboutsummaryrefslogtreecommitdiff
path: root/src/Ewmh.cc
diff options
context:
space:
mode:
authormarkt <markt>2007-11-05 17:05:58 (GMT)
committermarkt <markt>2007-11-05 17:05:58 (GMT)
commit97f7c3e1b59b9a94e36a78d97c141f6a05f43e20 (patch)
tree982ba8f35083fb54e5058f564ec8e301d8a229dc /src/Ewmh.cc
parent2c4e1f9a024433396f17ea5f3ef3fda46e0d8edd (diff)
downloadfluxbox_pavel-97f7c3e1b59b9a94e36a78d97c141f6a05f43e20.zip
fluxbox_pavel-97f7c3e1b59b9a94e36a78d97c141f6a05f43e20.tar.bz2
various refactoring and minor changes
Diffstat (limited to 'src/Ewmh.cc')
-rw-r--r--src/Ewmh.cc126
1 files changed, 38 insertions, 88 deletions
diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index 5483b8e..3e01e36 100644
--- a/src/Ewmh.cc
+++ b/src/Ewmh.cc
@@ -214,19 +214,9 @@ void Ewmh::setupClient(WinClient &winclient) {
214 updateStrut(winclient); 214 updateStrut(winclient);
215 215
216 FbTk::FbString newtitle = winclient.textProperty(m_net_wm_name); 216 FbTk::FbString newtitle = winclient.textProperty(m_net_wm_name);
217 if (!newtitle.empty()) { 217 if (!newtitle.empty())
218 winclient.setTitle(newtitle); 218 winclient.setTitle(newtitle);
219 }
220 newtitle = winclient.textProperty(m_net_wm_icon_name);
221 if (!newtitle.empty()) {
222 winclient.setIconTitle(newtitle);
223 }
224
225 if ( winclient.fbwindow() )
226 winclient.fbwindow()->titleSig().notify();
227}
228 219
229void Ewmh::setupFrame(FluxboxWindow &win) {
230 Atom ret_type; 220 Atom ret_type;
231 int fmt; 221 int fmt;
232 unsigned long nitems, bytes_after; 222 unsigned long nitems, bytes_after;
@@ -248,95 +238,59 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
248 * 238 *
249 */ 239 */
250 240
251 win.winClient().property(m_net_wm_window_type, 0, 0x7fffffff, False, XA_ATOM, 241 winclient.property(m_net_wm_window_type, 0, 0x7fffffff, False, XA_ATOM,
252 &ret_type, &fmt, &nitems, &bytes_after, 242 &ret_type, &fmt, &nitems, &bytes_after,
253 &data); 243 &data);
244 Focusable::WindowType type = Focusable::TYPE_NORMAL;
254 if (data) { 245 if (data) {
255 Atom *atoms = (unsigned long *)data; 246 Atom *atoms = (unsigned long *)data;
256 for (unsigned long l = 0; l < nitems; ++l) { 247 for (unsigned long l = 0; l < nitems; ++l) {
257 /* From Extended Window Manager Hints, draft 1.3: 248 if (atoms[l] == m_net_wm_window_type_dock)
258 * 249 type = Focusable::TYPE_DOCK;
259 * _NET_WM_WINDOW_TYPE_DOCK indicates a dock or panel feature. 250 else if (atoms[l] == m_net_wm_window_type_desktop)
260 * Typically a Window Manager would keep such windows on top 251 type = Focusable::TYPE_DESKTOP;
261 * of all other windows. 252 else if (atoms[l] == m_net_wm_window_type_splash)
262 * 253 type = Focusable::TYPE_SPLASH;
254 else if (atoms[l] == m_net_wm_window_type_dialog)
255 type = Focusable::TYPE_DIALOG;
256 else if (atoms[l] == m_net_wm_window_type_menu)
257 type = Focusable::TYPE_MENU;
258 else if (atoms[l] == m_net_wm_window_type_toolbar)
259 type = Focusable::TYPE_TOOLBAR;
260 else if (atoms[l] != m_net_wm_window_type_normal)
261 continue;
262 /*
263 * NOT YET IMPLEMENTED:
264 * _NET_WM_WINDOW_TYPE_UTILITY
263 */ 265 */
264 if (atoms[l] == m_net_wm_window_type_dock) { 266 break;
265 // we also assume it shouldn't be visible in any toolbar
266 win.setFocusHidden(true);
267 win.setIconHidden(true);
268 win.setDecorationMask(FluxboxWindow::DECOR_NONE);
269 win.moveToLayer(Layer::DOCK);
270 } else if (atoms[l] == m_net_wm_window_type_desktop) {
271 /*
272 * _NET_WM_WINDOW_TYPE_DESKTOP indicates a "false desktop" window
273 * We let it be the size it wants, but it gets no decoration,
274 * is hidden in the toolbar and window cycling list, plus
275 * windows don't tab with it and is right on the bottom.
276 */
277
278 win.setFocusHidden(true);
279 win.setIconHidden(true);
280 win.moveToLayer(Layer::DESKTOP);
281 win.setDecorationMask(FluxboxWindow::DECOR_NONE);
282 win.setTabable(false);
283 win.setMovable(false);
284 win.setResizable(false);
285 win.stick();
286
287 } else if (atoms[l] == m_net_wm_window_type_splash) {
288 /*
289 * _NET_WM_WINDOW_TYPE_SPLASH indicates that the
290 * window is a splash screen displayed as an application
291 * is starting up.
292 */
293 win.setDecorationMask(FluxboxWindow::DECOR_NONE);
294 win.setFocusHidden(true);
295 win.setIconHidden(true);
296 win.setMovable(false);
297 } else if (atoms[l] == m_net_wm_window_type_normal) {
298 // do nothing, this is ..normal..
299 } else if (atoms[l] == m_net_wm_window_type_dialog) {
300 // dialog windows should not be tabable
301 win.setTabable(false);
302 } else if (atoms[l] == m_net_wm_window_type_menu) {
303 /*
304 * _NET_WM_WINDOW_TYPE_TOOLBAR and _NET_WM_WINDOW_TYPE_MENU
305 * indicate toolbar and pinnable menu windows, respectively
306 * (i.e. toolbars and menus "torn off" from the main
307 * application). Windows of this type may set the
308 * WM_TRANSIENT_FOR hint indicating the main application window.
309 */
310 win.setDecorationMask(FluxboxWindow::DECOR_TOOL);
311 win.setIconHidden(true);
312 win.moveToLayer(Layer::ABOVE_DOCK);
313 } else if (atoms[l] == m_net_wm_window_type_toolbar) {
314 win.setDecorationMask(FluxboxWindow::DECOR_NONE);
315 win.setIconHidden(true);
316 win.moveToLayer(Layer::ABOVE_DOCK);
317 }
318 } 267 }
319 XFree(data); 268 XFree(data);
320 } else { 269 } else if (winclient.isTransient()) {
321 // if _NET_WM_WINDOW_TYPE not set and this window 270 // 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 271 // has transient_for the type must be set to _NET_WM_WINDOW_TYPE_DIALOG
323 if ( win.winClient().isTransient() ) { 272 if (winclient.isTransient()) {
324 win.winClient(). 273 type = Focusable::TYPE_DIALOG;
274 winclient.
325 changeProperty(m_net_wm_window_type, 275 changeProperty(m_net_wm_window_type,
326 XA_ATOM, 32, PropModeReplace, 276 XA_ATOM, 32, PropModeReplace,
327 (unsigned char*)&m_net_wm_window_type_dialog, 1); 277 (unsigned char*)&m_net_wm_window_type_dialog, 1);
328 // and then we should treat it like a dialog 278
329 win.setTabable(false);
330 } 279 }
331 } 280 }
281 winclient.setWindowType(type);
332 282
333 /*
334 * NOT YET IMPLEMENTED:
335 * _NET_WM_WINDOW_TYPE_UTILITY
336 */
337 283
284}
285
286void Ewmh::setupFrame(FluxboxWindow &win) {
338 setupState(win); 287 setupState(win);
339 288
289 Atom ret_type;
290 int fmt;
291 unsigned long nitems, bytes_after;
292 unsigned char *data = 0;
293
340 if (win.winClient().property(m_net_wm_desktop, 0, 1, False, XA_CARDINAL, 294 if (win.winClient().property(m_net_wm_desktop, 0, 1, False, XA_CARDINAL,
341 &ret_type, &fmt, &nitems, &bytes_after, 295 &ret_type, &fmt, &nitems, &bytes_after,
342 (unsigned char **) &data) && data) { 296 (unsigned char **) &data) && data) {
@@ -929,11 +883,7 @@ bool Ewmh::propertyNotify(WinClient &winclient, Atom the_property) {
929 winclient.fbwindow()->titleSig().notify(); 883 winclient.fbwindow()->titleSig().notify();
930 return true; 884 return true;
931 } else if (the_property == m_net_wm_icon_name) { 885 } else if (the_property == m_net_wm_icon_name) {
932 FbTk::FbString newtitle = winclient.textProperty(the_property); 886 // we don't use icon title, since we don't show icons
933 if (!newtitle.empty())
934 winclient.setIconTitle(newtitle);
935 if (winclient.fbwindow())
936 winclient.fbwindow()->titleSig().notify();
937 return true; 887 return true;
938 } 888 }
939 889