From 22944ec775b5c5de0f29d0ee05f4ed303235519c Mon Sep 17 00:00:00 2001 From: markt Date: Sat, 19 May 2007 22:59:02 +0000 Subject: added back limited behavior for session.screen0.followModel --- ChangeLog | 6 ++++-- doc/asciidoc/fluxbox.txt | 5 +++++ src/Ewmh.cc | 4 +++- src/Screen.cc | 1 + src/Screen.hh | 3 ++- src/Window.cc | 38 ++++++++++++++++++++++---------------- src/Window.hh | 3 ++- 7 files changed, 39 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index c50450a..db79872 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ (Format: Year/Month/Day) Changes for 1.1: *07/05/19: + * Changed behavior of resource session.screen.followModel (Mark) + - now only options are Ignore and Follow, the latter using the setting in + session.screen.userFollowModel + Window.cc/hh Ewmh.cc Screen.cc/hh * Fixed bug #1718112, memory leak in FbWindow::textProperty ( Henrik ) FbTk/FbWindow.cc *07/05/17: @@ -54,8 +58,6 @@ Changes for 1.1: Keys.cc/hh Toolbar.cc/hh Screen.cc/hh IconbarTool.cc fluxbox.cc * Menu when clicking workspacename in toolbar wasn't getting focused (Mark) ToolFactory.cc - * Removed followModel, since userFollowModel covers almost all cases (Mark) - IconbarTool.cc ClientMenu.cc Screen.cc/hh Ewmh.cc Window.cc * Buttons with different textures when pressed weren't getting reset properly (Mark) FbTk/Button.cc diff --git a/doc/asciidoc/fluxbox.txt b/doc/asciidoc/fluxbox.txt index 9feb7bc..6878235 100644 --- a/doc/asciidoc/fluxbox.txt +++ b/doc/asciidoc/fluxbox.txt @@ -843,6 +843,11 @@ session.screen0.userFollowModel: `SemiFollow' acts like `Current' for minimized windows and like `Follow' otherwise. Default: Follow +session.screen0.followModel: + This specifies the behavior when a window on another workspace requests to + be focused. `Ignore' does nothing, and `Follow' uses the setting in + session.screen0.userFollowModel. Default: Ignore + session.screen0.resizeMode: Bottom|Quadrant|Center Setting this resource to `Quadrant' makes resizing by using the modkey grab the corner closest to the mouse pointer instead of the bottom right diff --git a/src/Ewmh.cc b/src/Ewmh.cc index 019751f..b0269ec 100644 --- a/src/Ewmh.cc +++ b/src/Ewmh.cc @@ -782,7 +782,9 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, return true; // ce.window = window to focus - if (winclient->fbwindow()) { + // ce.data.l[0] == 2 means the request came from a pager + if (winclient->fbwindow() && (ce.data.l[0] == 2 || + winclient->fbwindow()->allowsFocusFromClient())) { winclient->focus(); winclient->fbwindow()->raise(); } diff --git a/src/Screen.cc b/src/Screen.cc index 2c24157..7f44e42 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -294,6 +294,7 @@ BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm, tab_placement(rm, FbWinFrame::TOPLEFT, scrname+".tab.placement", altscrname+".Tab.Placement"), windowmenufile(rm, "", scrname+".windowMenu", altscrname+".WindowMenu"), typing_delay(rm, 0, scrname+".noFocusWhileTypingDelay", altscrname+".NoFocusWhileTypingDelay"), + follow_model(rm, IGNORE_OTHER_WORKSPACES, scrname+".followModel", altscrname+".followModel"), user_follow_model(rm, FOLLOW_ACTIVE_WINDOW, scrname+".userFollowModel", altscrname+".UserFollowModel"), workspaces(rm, 1, scrname+".workspaces", altscrname+".Workspaces"), edge_snap_threshold(rm, 0, scrname+".edgeSnapThreshold", altscrname+".EdgeSnapThreshold"), diff --git a/src/Screen.hh b/src/Screen.hh index 2d1c31d..eb67067 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -144,6 +144,7 @@ public: ResizeModel getResizeModel() const { return *resource.resize_model; } inline unsigned int noFocusWhileTypingDelay() const { return *resource.typing_delay; } + inline FollowModel getFollowModel() const { return *resource.follow_model; } inline FollowModel getUserFollowModel() const { return *resource.user_follow_model; } inline const std::string &getScrollAction() const { return *resource.scroll_action; } @@ -569,7 +570,7 @@ private: FbTk::Resource tab_placement; FbTk::Resource windowmenufile; FbTk::Resource typing_delay; - FbTk::Resource user_follow_model; + FbTk::Resource follow_model, user_follow_model; bool ordered_dither; FbTk::Resource workspaces, edge_snap_threshold, focused_alpha, unfocused_alpha, menu_alpha, menu_delay, menu_delay_close, tab_width; diff --git a/src/Window.cc b/src/Window.cc index 41cc07d..4801f12 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -1376,9 +1376,8 @@ bool FluxboxWindow::focus() { FluxboxWindow *cur = FocusControl::focusedFbWindow(); WinClient *client = FocusControl::focusedWindow(); - if (cur && client && cur != this && - getRootTransientFor(m_client) != getRootTransientFor(client) && - (cur->isFullscreen() || cur->isTyping())) + if (cur && client && cur != this && cur->isFullscreen() && + getRootTransientFor(m_client) != getRootTransientFor(client)) return false; if (isIconic()) { @@ -2315,26 +2314,33 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent &re) { // Note: this function never gets called from WithdrawnState // initial state is handled in restoreAttributes() and init() + // if the user doesn't want the window, then ignore request + if (!allowsFocusFromClient()) + return; + + setCurrentClient(*client, false); // focus handled on MapNotify + deiconify(false); + +} + +bool FluxboxWindow::allowsFocusFromClient() { + // check what to do if window is on another workspace if (screen().currentWorkspaceID() != workspaceNumber() && !isStuck()) { - menu().hide(); - BScreen::FollowModel model = screen().getUserFollowModel(); + BScreen::FollowModel model = screen().getFollowModel(); if (model == BScreen::IGNORE_OTHER_WORKSPACES) - return; - // fetch the window to the current workspace - if (model == BScreen::FETCH_ACTIVE_WINDOW || - (isIconic() && model == BScreen::SEMIFOLLOW_ACTIVE_WINDOW)) - screen().sendToWorkspace(screen().currentWorkspaceID(), this, true); - // warp to the workspace of the window - else - screen().changeWorkspaceID(workspaceNumber()); + return false; } - setCurrentClient(*client, false); // focus handled on MapNotify - deiconify(false); + FluxboxWindow *cur = FocusControl::focusedFbWindow(); + WinClient *client = FocusControl::focusedWindow(); + if (cur && client && cur->isTyping() && + getRootTransientFor(m_client) != getRootTransientFor(client)) + return false; -} + return true; +} void FluxboxWindow::mapNotifyEvent(XMapEvent &ne) { WinClient *client = findClient(ne.window); diff --git a/src/Window.hh b/src/Window.hh index 82a5f3f..8a4866e 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -231,7 +231,8 @@ public: * @return true if it took focus. */ bool focus(); - + bool allowsFocusFromClient(); + /// Raises the window and takes focus (if possible). void raiseAndFocus() { raise(); focus(); } /// sets the internal focus flag -- cgit v0.11.2