implement some focus policies for splash, dock, and desktop windows
This commit is contained in:
parent
7ace5e80be
commit
0113ca6b5e
2 changed files with 27 additions and 10 deletions
|
@ -264,6 +264,9 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm,
|
||||||
m_toggled_decos(false),
|
m_toggled_decos(false),
|
||||||
m_icon_hidden(false),
|
m_icon_hidden(false),
|
||||||
m_focus_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_pos_x(0), m_old_pos_y(0),
|
||||||
m_old_width(1), m_old_height(1),
|
m_old_width(1), m_old_height(1),
|
||||||
m_last_button_x(0), m_last_button_y(0),
|
m_last_button_x(0), m_last_button_y(0),
|
||||||
|
@ -548,8 +551,7 @@ void FluxboxWindow::init() {
|
||||||
deiconify(false);
|
deiconify(false);
|
||||||
// check if we should prevent this window from gaining focus
|
// check if we should prevent this window from gaining focus
|
||||||
m_focused = false; // deiconify sets this
|
m_focused = false; // deiconify sets this
|
||||||
if (!Fluxbox::instance()->isStartup() &&
|
if (!Fluxbox::instance()->isStartup() && m_focus_new) {
|
||||||
screen().focusControl().focusNew()) {
|
|
||||||
m_focused = focusRequestFromClient(*m_client);
|
m_focused = focusRequestFromClient(*m_client);
|
||||||
if (!m_focused)
|
if (!m_focused)
|
||||||
lower();
|
lower();
|
||||||
|
@ -655,13 +657,12 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
|
||||||
frame().clientArea().height());
|
frame().clientArea().height());
|
||||||
|
|
||||||
// right now, this block only happens with new windows or on restart
|
// right now, this block only happens with new windows or on restart
|
||||||
bool focus_new = screen().focusControl().focusNew();
|
|
||||||
bool is_startup = Fluxbox::instance()->isStartup();
|
bool is_startup = Fluxbox::instance()->isStartup();
|
||||||
|
|
||||||
// we use m_focused as a signal to focus the window when mapped
|
// 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);
|
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,
|
client.saveBlackboxAttribs(m_blackbox_attrib,
|
||||||
PropBlackboxAttributesElements);
|
PropBlackboxAttributesElements);
|
||||||
|
@ -1447,7 +1448,7 @@ void FluxboxWindow::deiconify(bool do_raise) {
|
||||||
// but not on startup: focus will be handled after creating everything
|
// but not on startup: focus will be handled after creating everything
|
||||||
// we use m_focused as a signal to focus the window when mapped
|
// we use m_focused as a signal to focus the window when mapped
|
||||||
if (screen().currentWorkspace()->numberOfWindows() == 1 ||
|
if (screen().currentWorkspace()->numberOfWindows() == 1 ||
|
||||||
screen().focusControl().focusNew() || m_client->isTransient())
|
m_focus_new || m_client->isTransient())
|
||||||
m_focused = true;
|
m_focused = true;
|
||||||
|
|
||||||
oplock = false;
|
oplock = false;
|
||||||
|
@ -2230,7 +2231,7 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent &re) {
|
||||||
setCurrentClient(*client, false); // focus handled on MapNotify
|
setCurrentClient(*client, false); // focus handled on MapNotify
|
||||||
deiconify();
|
deiconify();
|
||||||
|
|
||||||
if (screen().focusControl().focusNew()) {
|
if (m_focus_new) {
|
||||||
m_focused = false; // deiconify sets this
|
m_focused = false; // deiconify sets this
|
||||||
m_focused = focusRequestFromClient(*client);
|
m_focused = focusRequestFromClient(*client);
|
||||||
if (!m_focused)
|
if (!m_focused)
|
||||||
|
@ -2607,7 +2608,7 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) {
|
||||||
|
|
||||||
frame().tabcontainer().tryButtonPressEvent(be);
|
frame().tabcontainer().tryButtonPressEvent(be);
|
||||||
if (be.button == 1) {
|
if (be.button == 1) {
|
||||||
if (!m_focused && acceptsFocus()) //check focus
|
if (!m_focused && acceptsFocus() && m_click_focus) //check focus
|
||||||
focus();
|
focus();
|
||||||
|
|
||||||
if (frame().window().window() == be.window ||
|
if (frame().window().window() == be.window ||
|
||||||
|
@ -2908,8 +2909,7 @@ void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) {
|
||||||
ev.window == m_client->window() ||
|
ev.window == m_client->window() ||
|
||||||
client) {
|
client) {
|
||||||
|
|
||||||
if (screen().focusControl().isMouseFocus() && !isFocused() &&
|
if (m_mouse_focus && !isFocused() && acceptsFocus()) {
|
||||||
acceptsFocus() && getWindowType() != Focusable::TYPE_DESKTOP) {
|
|
||||||
|
|
||||||
// check that there aren't any subsequent leave notify events in the
|
// check that there aren't any subsequent leave notify events in the
|
||||||
// X event queue
|
// X event queue
|
||||||
|
@ -4157,6 +4157,9 @@ void FluxboxWindow::setWindowType(Focusable::WindowType type) {
|
||||||
*/
|
*/
|
||||||
setFocusHidden(true);
|
setFocusHidden(true);
|
||||||
setIconHidden(true);
|
setIconHidden(true);
|
||||||
|
setFocusNew(false);
|
||||||
|
setMouseFocus(false);
|
||||||
|
setClickFocus(false);
|
||||||
setDecorationMask(FbWinFrame::DECOR_NONE);
|
setDecorationMask(FbWinFrame::DECOR_NONE);
|
||||||
moveToLayer(::Layer::DOCK);
|
moveToLayer(::Layer::DOCK);
|
||||||
break;
|
break;
|
||||||
|
@ -4169,6 +4172,8 @@ void FluxboxWindow::setWindowType(Focusable::WindowType type) {
|
||||||
*/
|
*/
|
||||||
setFocusHidden(true);
|
setFocusHidden(true);
|
||||||
setIconHidden(true);
|
setIconHidden(true);
|
||||||
|
setFocusNew(false);
|
||||||
|
setMouseFocus(false);
|
||||||
moveToLayer(::Layer::DESKTOP);
|
moveToLayer(::Layer::DESKTOP);
|
||||||
setDecorationMask(FbWinFrame::DECOR_NONE);
|
setDecorationMask(FbWinFrame::DECOR_NONE);
|
||||||
setTabable(false);
|
setTabable(false);
|
||||||
|
@ -4185,6 +4190,9 @@ void FluxboxWindow::setWindowType(Focusable::WindowType type) {
|
||||||
setDecorationMask(FbWinFrame::DECOR_NONE);
|
setDecorationMask(FbWinFrame::DECOR_NONE);
|
||||||
setFocusHidden(true);
|
setFocusHidden(true);
|
||||||
setIconHidden(true);
|
setIconHidden(true);
|
||||||
|
setFocusNew(false);
|
||||||
|
setMouseFocus(false);
|
||||||
|
setClickFocus(false);
|
||||||
setMovable(false);
|
setMovable(false);
|
||||||
break;
|
break;
|
||||||
case Focusable::TYPE_DIALOG:
|
case Focusable::TYPE_DIALOG:
|
||||||
|
|
|
@ -286,6 +286,12 @@ public:
|
||||||
void setFocusHidden(bool value);
|
void setFocusHidden(bool value);
|
||||||
/// sets the window icon hidden state
|
/// sets the window icon hidden state
|
||||||
void setIconHidden(bool value);
|
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();
|
void reconfigure();
|
||||||
|
|
||||||
|
|
||||||
|
@ -603,6 +609,9 @@ private:
|
||||||
|
|
||||||
bool m_icon_hidden; ///< if the window is in the iconbar
|
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_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
|
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
|
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
|
int m_last_button_x, ///< last known x position of the mouse button
|
||||||
|
|
Loading…
Reference in a new issue