all repos — fluxbox @ 0113ca6b5e5143ca28be5fc4be0acb3d417d153d

custom fork of the fluxbox windowmanager

implement some focus policies for splash, dock, and desktop windows
Mark Tiefenbruck mark@fluxbox.org
commit

0113ca6b5e5143ca28be5fc4be0acb3d417d153d

parent

7ace5e80be863a6d9e4170fc76ba157312e890d5

2 files changed, 27 insertions(+), 10 deletions(-)

jump to
M src/Window.ccsrc/Window.cc

@@ -264,6 +264,9 @@ m_client(&client),

m_toggled_decos(false), m_icon_hidden(false), m_focus_hidden(false), + m_focus_new(screen().focusControl().focusNew()), + m_mouse_focus(screen().focusControl().isMouseFocus()), + m_click_focus(true), m_old_pos_x(0), m_old_pos_y(0), m_old_width(1), m_old_height(1), m_last_button_x(0), m_last_button_y(0),

@@ -548,8 +551,7 @@ iconic = true;

deiconify(false); // check if we should prevent this window from gaining focus m_focused = false; // deiconify sets this - if (!Fluxbox::instance()->isStartup() && - screen().focusControl().focusNew()) { + if (!Fluxbox::instance()->isStartup() && m_focus_new) { m_focused = focusRequestFromClient(*m_client); if (!m_focused) lower();

@@ -655,13 +657,12 @@ frame().clientArea().width(),

frame().clientArea().height()); // right now, this block only happens with new windows or on restart - bool focus_new = screen().focusControl().focusNew(); bool is_startup = Fluxbox::instance()->isStartup(); // we use m_focused as a signal to focus the window when mapped - if (focus_new && !is_startup) + if (m_focus_new && !is_startup) m_focused = focusRequestFromClient(client); - focused_win = (focus_new || is_startup) ? &client : m_client; + focused_win = (m_focus_new || is_startup) ? &client : m_client; client.saveBlackboxAttribs(m_blackbox_attrib, PropBlackboxAttributesElements);

@@ -1447,7 +1448,7 @@ // focus new, OR if it's the only window on the workspace

// but not on startup: focus will be handled after creating everything // we use m_focused as a signal to focus the window when mapped if (screen().currentWorkspace()->numberOfWindows() == 1 || - screen().focusControl().focusNew() || m_client->isTransient()) + m_focus_new || m_client->isTransient()) m_focused = true; oplock = false;

@@ -2230,7 +2231,7 @@

setCurrentClient(*client, false); // focus handled on MapNotify deiconify(); - if (screen().focusControl().focusNew()) { + if (m_focus_new) { m_focused = false; // deiconify sets this m_focused = focusRequestFromClient(*client); if (!m_focused)

@@ -2607,7 +2608,7 @@ }

frame().tabcontainer().tryButtonPressEvent(be); if (be.button == 1) { - if (!m_focused && acceptsFocus()) //check focus + if (!m_focused && acceptsFocus() && m_click_focus) //check focus focus(); if (frame().window().window() == be.window ||

@@ -2908,8 +2909,7 @@ if (ev.window == frame().window() ||

ev.window == m_client->window() || client) { - if (screen().focusControl().isMouseFocus() && !isFocused() && - acceptsFocus() && getWindowType() != Focusable::TYPE_DESKTOP) { + if (m_mouse_focus && !isFocused() && acceptsFocus()) { // check that there aren't any subsequent leave notify events in the // X event queue

@@ -4157,6 +4157,9 @@ *

*/ setFocusHidden(true); setIconHidden(true); + setFocusNew(false); + setMouseFocus(false); + setClickFocus(false); setDecorationMask(FbWinFrame::DECOR_NONE); moveToLayer(::Layer::DOCK); break;

@@ -4169,6 +4172,8 @@ * windows don't tab with it and is right on the bottom.

*/ setFocusHidden(true); setIconHidden(true); + setFocusNew(false); + setMouseFocus(false); moveToLayer(::Layer::DESKTOP); setDecorationMask(FbWinFrame::DECOR_NONE); setTabable(false);

@@ -4185,6 +4190,9 @@ */

setDecorationMask(FbWinFrame::DECOR_NONE); setFocusHidden(true); setIconHidden(true); + setFocusNew(false); + setMouseFocus(false); + setClickFocus(false); setMovable(false); break; case Focusable::TYPE_DIALOG:
M src/Window.hhsrc/Window.hh

@@ -286,6 +286,12 @@ void placeWindow(int head);

void setFocusHidden(bool value); /// sets the window icon hidden state void setIconHidden(bool value); + /// sets whether or not the window normally gets focus when mapped + void setFocusNew(bool value) { m_focus_new = value; } + /// sets whether or not the window gets focused with mouse + void setMouseFocus(bool value) { m_mouse_focus = value; } + /// sets whether or not the window gets focused with click + void setClickFocus(bool value) { m_click_focus = value; } void reconfigure();

@@ -603,6 +609,9 @@ } functions;

bool m_icon_hidden; ///< if the window is in the iconbar bool m_focus_hidden; ///< if the window is in the NextWindow list + bool m_focus_new; ///< if the window is normally focused when mapped + bool m_mouse_focus; ///< if the window is focused with EnterNotify + bool m_click_focus; ///< if the window is focused by clicking int m_old_pos_x, m_old_pos_y; ///< old position so we can restore from maximized unsigned int m_old_width, m_old_height; ///< old size so we can restore from maximized state int m_last_button_x, ///< last known x position of the mouse button