stop focus cycling on explicit workspace changes

Otherwise implicit focus changes by the workspace change would be
perceived as focus stealing and the focus restored to the last window on
the original desktop
This commit is contained in:
Thomas Lübking 2016-11-20 14:05:07 +01:00
parent 3d7b466e7a
commit 26c1cfcc07
2 changed files with 5 additions and 0 deletions

View file

@ -1535,6 +1535,7 @@ void BScreen::setLayer(FbTk::LayerItem &item, int layernum) {
Goes to the workspace "right" of the current
*/
void BScreen::nextWorkspace(int delta) {
focusControl().stopCyclingFocus();
if (delta)
changeWorkspaceID( (currentWorkspaceID() + delta) % numberOfWorkspaces());
else if (m_former_workspace)
@ -1545,6 +1546,7 @@ void BScreen::nextWorkspace(int delta) {
Goes to the workspace "left" of the current
*/
void BScreen::prevWorkspace(int delta) {
focusControl().stopCyclingFocus();
if (delta)
changeWorkspaceID( (static_cast<signed>(numberOfWorkspaces()) + currentWorkspaceID() - (delta % numberOfWorkspaces())) % numberOfWorkspaces());
else if (m_former_workspace)
@ -1555,6 +1557,7 @@ void BScreen::prevWorkspace(int delta) {
Goes to the workspace "right" of the current
*/
void BScreen::rightWorkspace(int delta) {
focusControl().stopCyclingFocus();
if (currentWorkspaceID()+delta < numberOfWorkspaces())
changeWorkspaceID(currentWorkspaceID()+delta);
}
@ -1563,6 +1566,7 @@ void BScreen::rightWorkspace(int delta) {
Goes to the workspace "left" of the current
*/
void BScreen::leftWorkspace(int delta) {
focusControl().stopCyclingFocus();
if (currentWorkspaceID() >= static_cast<unsigned int>(delta))
changeWorkspaceID(currentWorkspaceID()-delta);
}

View file

@ -383,6 +383,7 @@ JumpToWorkspaceCmd::JumpToWorkspaceCmd(int workspace_num):m_workspace_num(worksp
void JumpToWorkspaceCmd::execute() {
BScreen *screen = Fluxbox::instance()->mouseScreen();
if (screen != 0) {
screen->focusControl().stopCyclingFocus();
int num = screen->numberOfWorkspaces();
int actual = m_workspace_num;
// we need an extra +1, since it's subtracted in FbCommandFactory