diff options
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/src/Window.cc b/src/Window.cc index 2943366..09b048b 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -1309,8 +1309,8 @@ void FluxboxWindow::maxSize(unsigned int &max_width, unsigned int &max_height) { | |||
1309 | 1309 | ||
1310 | // returns whether the focus was "set" to this window | 1310 | // returns whether the focus was "set" to this window |
1311 | // it doesn't guarantee that it has focus, but says that we have | 1311 | // it doesn't guarantee that it has focus, but says that we have |
1312 | // tried. A FocusqIn event should eventually arrive for that | 1312 | // tried. A FocusIn event should eventually arrive for that |
1313 | // window if it actually got the focus, then setFocusedFlag is called, | 1313 | // window if it actually got the focus, then setFocusFlag is called, |
1314 | // which updates all the graphics etc | 1314 | // which updates all the graphics etc |
1315 | bool FluxboxWindow::focus() { | 1315 | bool FluxboxWindow::focus() { |
1316 | 1316 | ||
@@ -1343,6 +1343,20 @@ bool FluxboxWindow::focus() { | |||
1343 | if (! m_client->validateClient()) | 1343 | if (! m_client->validateClient()) |
1344 | return false; | 1344 | return false; |
1345 | 1345 | ||
1346 | if (screen().currentWorkspaceID() != workspaceNumber() && !isStuck()) { | ||
1347 | menu().hide(); | ||
1348 | BScreen::FollowModel model = screen().getUserFollowModel(); | ||
1349 | if (model == BScreen::IGNORE_OTHER_WORKSPACES) | ||
1350 | return false; | ||
1351 | // fetch the window to the current workspace | ||
1352 | if (model == BScreen::FETCH_ACTIVE_WINDOW || | ||
1353 | (isIconic() && model == BScreen::SEMIFOLLOW_ACTIVE_WINDOW)) | ||
1354 | screen().sendToWorkspace(screen().currentWorkspaceID(), this, true); | ||
1355 | // warp to the workspace of the window | ||
1356 | else | ||
1357 | screen().changeWorkspaceID(workspaceNumber()); | ||
1358 | } | ||
1359 | |||
1346 | // this needs to be here rather than setFocusFlag because | 1360 | // this needs to be here rather than setFocusFlag because |
1347 | // FocusControl::revertFocus will return before FocusIn events arrive | 1361 | // FocusControl::revertFocus will return before FocusIn events arrive |
1348 | m_screen.focusControl().setScreenFocusedWindow(*m_client); | 1362 | m_screen.focusControl().setScreenFocusedWindow(*m_client); |
@@ -2310,6 +2324,22 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent &re) { | |||
2310 | 2324 | ||
2311 | // Note: this function never gets called from WithdrawnState | 2325 | // Note: this function never gets called from WithdrawnState |
2312 | // initial state is handled in restoreAttributes() and init() | 2326 | // initial state is handled in restoreAttributes() and init() |
2327 | |||
2328 | // check what to do if window is on another workspace | ||
2329 | if (screen().currentWorkspaceID() != workspaceNumber() && !isStuck()) { | ||
2330 | menu().hide(); | ||
2331 | BScreen::FollowModel model = screen().getUserFollowModel(); | ||
2332 | if (model == BScreen::IGNORE_OTHER_WORKSPACES) | ||
2333 | return; | ||
2334 | // fetch the window to the current workspace | ||
2335 | if (model == BScreen::FETCH_ACTIVE_WINDOW || | ||
2336 | (isIconic() && model == BScreen::SEMIFOLLOW_ACTIVE_WINDOW)) | ||
2337 | screen().sendToWorkspace(screen().currentWorkspaceID(), this, true); | ||
2338 | // warp to the workspace of the window | ||
2339 | else | ||
2340 | screen().changeWorkspaceID(workspaceNumber()); | ||
2341 | } | ||
2342 | |||
2313 | setCurrentClient(*client, false); // focus handled on MapNotify | 2343 | setCurrentClient(*client, false); // focus handled on MapNotify |
2314 | deiconify(false); | 2344 | deiconify(false); |
2315 | 2345 | ||
@@ -2330,8 +2360,6 @@ void FluxboxWindow::mapNotifyEvent(XMapEvent &ne) { | |||
2330 | #ifdef DEBUG | 2360 | #ifdef DEBUG |
2331 | cerr<<"FluxboxWindow::mapNotify: not override redirect ans visible!"<<endl; | 2361 | cerr<<"FluxboxWindow::mapNotify: not override redirect ans visible!"<<endl; |
2332 | #endif // DEBUG | 2362 | #endif // DEBUG |
2333 | Fluxbox *fluxbox = Fluxbox::instance(); | ||
2334 | fluxbox->grab(); | ||
2335 | if (! client->validateClient()) | 2363 | if (! client->validateClient()) |
2336 | return; | 2364 | return; |
2337 | 2365 | ||
@@ -2345,17 +2373,7 @@ void FluxboxWindow::mapNotifyEvent(XMapEvent &ne) { | |||
2345 | else if (m_screen.focusControl().focusNew()) | 2373 | else if (m_screen.focusControl().focusNew()) |
2346 | Fluxbox::instance()->attentionHandler().addAttention(*client); | 2374 | Fluxbox::instance()->attentionHandler().addAttention(*client); |
2347 | 2375 | ||
2348 | |||
2349 | iconic = false; | 2376 | iconic = false; |
2350 | |||
2351 | // Auto-group from tab? | ||
2352 | if (!client->isTransient()) { | ||
2353 | #ifdef DEBUG | ||
2354 | cerr<<__FILE__<<"("<<__FUNCTION__<<") TODO check grouping here"<<endl; | ||
2355 | #endif // DEBUG | ||
2356 | } | ||
2357 | |||
2358 | fluxbox->ungrab(); | ||
2359 | } | 2377 | } |
2360 | } | 2378 | } |
2361 | 2379 | ||