Lines Matching refs:window

148 	// TODO: this is a try to not steal focus from the current window
149 // in case you enter some text and a window pops up you haven't
150 // triggered yourself (like a pop-up window in your browser while
151 // you're typing a password in another window) - maybe this should
276 Window* window = fDesktop->MouseEventWindow();
277 if (window == NULL)
278 window = fDesktop->WindowAt(where);
280 if (window != NULL) {
281 // dispatch event to the window
285 int32 windowToken = window->ServerWindow()->ServerToken();
291 // only check the window of the click target here; we'll recheck
292 // after asking the window.
312 // notify the window
314 window->MouseDown(message, where, fLastClickTarget, clickCount,
341 fDesktop->NotifyMouseDown(window, message, where);
346 window->MouseUp(message, where, &viewToken);
349 fDesktop->NotifyMouseUp(window, message, where);
353 window->MouseMoved(message, where, &viewToken,
356 fDesktop->NotifyMouseMoved(window, message, where);
361 fDesktop->SetViewUnderMouse(window, viewToken);
364 *_target = &window->EventTarget();
367 // the mouse-down didn't hit a window -- reset the click target
375 if (window == NULL || viewToken == B_NULL_TOKEN) {
376 // mouse is not over a window or over a decorator
377 fDesktop->SetViewUnderMouse(window, B_NULL_TOKEN);
383 fDesktop->SetLastMouseState(where, buttons, window);
435 fWindowLock("window lock"),
620 for (Window* window = fAllWindows.FirstWindow(); window != NULL;
621 window = window->NextWindow(kAllWindowList)) {
622 window->ServerWindow()->PostMessage(code);
633 for (Window* window = fAllWindows.FirstWindow(); window != NULL;
634 window = window->NextWindow(kAllWindowList)) {
635 message.AddTarget(window->ServerWindow()->MessagePort());
660 Window* window = MouseEventWindow();
661 if (window == NULL)
662 window = WindowAt(fLastMousePosition);
664 if (window != NULL) {
666 window->ModifiersChanged(modifiers);
721 // The all-window-lock is write-locked.
993 You must not hold any window lock when calling this method.
1026 // either update the workspaces window, or switch to
1028 // the workspaces window automatically
1066 You must hold the window lock when calling this method.
1107 /*! \brief Activates or focusses the window based on the pointer position.
1110 Desktop::SelectWindow(Window* window)
1113 // Only bring the window to front when it is not the window under the
1115 if (window != fWindowUnderMouse
1116 || (window == fWindowUnderMouse && window != FocusWindow()))
1117 ActivateWindow(window);
1119 SetFocusWindow(window);
1121 ActivateWindow(window);
1125 /*! \brief Tries to move the specified window to the front of the screen,
1126 and make it the focus window.
1129 become the frontmost window, though, as modal windows stay in front
1133 Desktop::ActivateWindow(Window* window)
1135 STRACE(("ActivateWindow(%p, %s)\n", window, window
1136 ? window->Title() : "<none>"));
1138 if (window == NULL) {
1143 if (window->Workspaces() == 0 && window->IsNormal())
1148 NotifyWindowActivated(window);
1150 bool windowOnOtherWorkspace = !window->InWorkspace(fCurrentWorkspace);
1152 && (window->Flags() & B_NOT_ANCHORED_ON_ACTIVATE) == 0) {
1153 if ((window->Flags() & B_NO_WORKSPACE_ACTIVATION) == 0) {
1154 // Switch to the workspace on which this window is
1155 // (we'll take the first one that the window is on)
1156 uint32 workspaces = window->Workspaces();
1170 if (!window->IsNormal()) {
1171 // Bring a window to front that this floating window belongs to
1172 Window* front = _LastFocusSubsetWindow(window);
1180 if (!window->InWorkspace(fCurrentWorkspace)) {
1181 // This window can't be made active
1185 // Bring the window to the current workspace
1186 // TODO: what if this window is on multiple workspaces?!?
1188 SetWindowWorkspaces(window, workspaces);
1192 if (window->IsMinimized()) {
1194 // so we will just unminimize the window here.
1195 window->SetMinimized(false);
1196 ShowWindow(window);
1199 if (window == FrontWindow()) {
1200 // see if there is a normal B_AVOID_FRONT window still in front of us
1201 Window* avoidsFront = window->NextWindow(fCurrentWorkspace);
1208 // we're already the frontmost window, we might just not have focus
1210 if ((window->Flags() & B_AVOID_FOCUS) == 0)
1211 SetFocusWindow(window);
1217 Window* frontmost = window->Frontmost();
1220 CurrentWindows().RemoveWindow(window);
1221 windows.AddWindow(window);
1222 window->MoveToTopStackLayer();
1231 // get the next modal window
1236 if (nextModal != NULL && !nextModal->HasInSubset(window))
1246 if ((window->Flags() & B_AVOID_FOCUS) == 0)
1247 SetFocusWindow(window);
1259 Desktop::SendWindowBehind(Window* window, Window* behindOf, bool sendStack)
1264 Window* orgWindow = window;
1265 WindowStack* stack = window->GetWindowStack();
1267 window = stack->TopLayerWindow();
1271 if (window == BackWindow()
1272 || !window->InWorkspace(fCurrentWorkspace)
1278 // Is this a valid behindOf window?
1279 if (behindOf != NULL && window->HasInSubset(behindOf))
1282 // what is currently visible of the window
1283 // might be dirty after the window is send to back
1284 BRegion dirty(window->VisibleRegion());
1286 Window* backmost = window->Backmost(behindOf);
1289 CurrentWindows().RemoveWindow(window);
1290 CurrentWindows().AddWindow(window, backmost
1296 // only redraw the top layer window to avoid flicker
1299 BRegion clean(window->VisibleRegion());
1310 _WindowChanged(window);
1315 if (stackWindow == window)
1332 Desktop::ShowWindow(Window* window)
1334 if (!window->IsHidden())
1339 window->SetHidden(false);
1340 fFocusList.AddWindow(window);
1342 // If the window is on the current workspace, we'll show it. Special
1345 if (window->InWorkspace(fCurrentWorkspace)
1346 || (window->IsFloating() && _LastFocusSubsetWindow(window) != NULL)) {
1347 _ShowWindow(window, true);
1348 _UpdateSubsetWorkspaces(window);
1349 ActivateWindow(window);
1352 _WindowChanged(window);
1356 if (window->HasWorkspacesViews()) {
1359 window->FindWorkspacesViews(fWorkspacesViews);
1362 // If the mouse cursor is directly over the newly visible window,
1363 // we'll send a fake mouse moved message to the window, so that
1366 _SendFakeMouseMoved(window);
1371 Desktop::HideWindow(Window* window, bool fromMinimize)
1373 if (window->IsHidden())
1379 window->SetHidden(true);
1380 fFocusList.RemoveWindow(window);
1382 if (fMouseEventWindow == window) {
1386 window->MouseUp(&message, fLastMousePosition, &viewToken);
1391 if (fLockedFocusWindow == window) {
1396 if (window->InWorkspace(fCurrentWorkspace)) {
1397 _UpdateSubsetWorkspaces(window);
1398 _HideWindow(window);
1401 _WindowChanged(window);
1403 if (FocusWindow() == window)
1406 _WindowRemoved(window);
1408 if (window->HasWorkspacesViews()) {
1409 // remove workspaces views from this window
1411 window->FindWorkspacesViews(list);
1420 NotifyWindowHidden(window, fromMinimize);
1424 if (window == fWindowUnderMouse)
1430 Desktop::MinimizeWindow(Window* window, bool minimize)
1435 if (minimize && !window->IsHidden()) {
1436 HideWindow(window, true);
1437 window->SetMinimized(minimize);
1438 NotifyWindowMinimized(window, minimize);
1439 } else if (!minimize && window->IsHidden()) {
1440 ActivateWindow(window);
1441 // this will unminimize the window for us
1442 NotifyWindowMinimized(window, minimize);
1450 Desktop::MoveWindowBy(Window* window, float x, float y, int32 workspace)
1457 Window* topWindow = window->TopLayerStackWindow();
1459 window = topWindow;
1463 if (!window->IsVisible() || workspace != fCurrentWorkspace) {
1465 WindowStack* stack = window->GetWindowStack();
1469 // move the window on another workspace - this doesn't
1483 window->MoveBy((int32)x, (int32)y);
1485 NotifyWindowMoved(window);
1489 // the dirty region starts with the visible area of the window being moved
1490 BRegion newDirtyRegion(window->VisibleRegion());
1494 if (window->ServerWindow()->IsDirectlyAccessing()) {
1495 window->ServerWindow()->HandleDirectConnection(B_DIRECT_STOP);
1499 window->MoveBy((int32)x, (int32)y);
1505 // to move the contents of the window
1506 BRegion copyRegion(window->VisibleRegion());
1511 // include the the new visible region of the window being
1513 newDirtyRegion.Include(&window->VisibleRegion());
1529 _WindowChanged(window);
1533 // TODO: the clipping actually only changes when we move our window
1534 // off screen, or behind some other window
1535 window->ServerWindow()->HandleDirectConnection(
1539 NotifyWindowMoved(window);
1544 Desktop::ResizeWindowBy(Window* window, float x, float y)
1551 Window* topWindow = window->TopLayerStackWindow();
1553 window = topWindow;
1555 if (!window->IsVisible()) {
1556 window->ResizeBy((int32)x, (int32)y, NULL);
1557 NotifyWindowResized(window);
1561 // The dirty region for the inside of the window is constructed by the window itself in
1564 // Track the dirty region outside the window in case it is shrunk in "previouslyOccupiedRegion"
1565 BRegion previouslyOccupiedRegion(window->VisibleRegion());
1568 BRegion previousVisibleContentRegion(window->VisibleContentRegion());
1572 if (window->ServerWindow()->IsDirectlyAccessing()) {
1573 window->ServerWindow()->HandleDirectConnection(B_DIRECT_STOP);
1577 window->ResizeBy((int32)x, (int32)y, &newDirtyRegion);
1582 // we just care for the region outside the window
1583 previouslyOccupiedRegion.Exclude(&window->VisibleRegion());
1585 // make sure the window cannot mark stuff dirty outside
1587 newDirtyRegion.IntersectWith(&window->VisibleRegion());
1591 // calculate old expose region as window visible region difference
1593 exposeRegion.Exclude(&window->VisibleRegion());
1594 // ...and new expose region as window content visible region difference
1595 BRegion tmp(window->VisibleContentRegion());
1601 _WindowChanged(window);
1605 window->ServerWindow()->HandleDirectConnection(
1609 NotifyWindowResized(window);
1614 Desktop::SetWindowOutlinesDelta(Window* window, BPoint delta)
1618 if (!window->IsVisible())
1622 window->SetOutlinesDelta(delta, &newDirtyRegion);
1633 Desktop::SetWindowTabLocation(Window* window, float location, bool isShifting)
1638 bool changed = window->SetTabLocation(location, isShifting, dirty);
1640 RebuildAndRedrawAfterWindowChange(window, dirty);
1642 NotifyWindowTabLocationChanged(window, location, isShifting);
1649 Desktop::SetWindowDecoratorSettings(Window* window, const BMessage& settings)
1654 bool changed = window->SetDecoratorSettings(settings, dirty);
1655 bool listenerChanged = SetDecoratorSettings(window, settings);
1657 RebuildAndRedrawAfterWindowChange(window, dirty);
1664 Desktop::SetWindowWorkspaces(Window* window, uint32 workspaces)
1668 if (window->IsNormal() && workspaces == B_CURRENT_WORKSPACE)
1671 WindowStack* stack = window->GetWindowStack();
1674 window = stack->LayerOrder().ItemAt(s);
1676 uint32 oldWorkspaces = window->Workspaces();
1677 window->WorkspacesChanged(oldWorkspaces, workspaces);
1678 _ChangeWindowWorkspaces(window, oldWorkspaces, workspaces);
1685 /*! \brief Adds the window to the desktop.
1686 At this point, the window is still hidden and must be shown explicitly
1690 Desktop::AddWindow(Window *window)
1694 fAllWindows.AddWindow(window);
1695 if (!window->IsNormal())
1696 fSubsetWindows.AddWindow(window);
1698 if (window->IsNormal()) {
1699 if (window->Workspaces() == B_CURRENT_WORKSPACE)
1700 window->SetWorkspaces(workspace_to_workspaces(CurrentWorkspace()));
1703 window->SetWorkspaces(window->SubsetWorkspaces());
1706 _ChangeWindowWorkspaces(window, 0, window->Workspaces());
1708 NotifyWindowAdded(window);
1715 Desktop::RemoveWindow(Window *window)
1719 if (!window->IsHidden())
1720 HideWindow(window);
1722 fAllWindows.RemoveWindow(window);
1723 if (!window->IsNormal())
1724 fSubsetWindows.RemoveWindow(window);
1726 _ChangeWindowWorkspaces(window, window->Workspaces(), 0);
1728 NotifyWindowRemoved(window);
1732 // make sure this window won't get any events anymore
1734 EventDispatcher().RemoveTarget(window->EventTarget());
1739 Desktop::AddWindowToSubset(Window* subset, Window* window)
1741 if (!subset->AddToSubset(window))
1751 Desktop::RemoveWindowFromSubset(Window* subset, Window* window)
1753 subset->RemoveFromSubset(window);
1760 Desktop::FontsChanged(Window* window)
1765 window->FontsChanged(&dirty);
1767 RebuildAndRedrawAfterWindowChange(window, dirty);
1772 Desktop::ColorUpdated(Window* window, color_which which, rgb_color color)
1776 window->TopView()->ColorUpdated(which, color);
1791 window->ColorsChanged(&dirty);
1792 RebuildAndRedrawAfterWindowChange(window, dirty);
1797 Desktop::SetWindowLook(Window* window, window_look newLook)
1799 if (window->Look() == newLook)
1805 window->SetLook(newLook, &dirty);
1806 // TODO: test what happens when the window
1809 RebuildAndRedrawAfterWindowChange(window, dirty);
1811 NotifyWindowLookChanged(window, newLook);
1816 Desktop::SetWindowFeel(Window* window, window_feel newFeel)
1818 if (window->Feel() == newFeel)
1823 bool wasNormal = window->IsNormal();
1825 window->SetFeel(newFeel);
1827 // move the window out of or into the subset window list as needed
1828 if (window->IsNormal() && !wasNormal)
1829 fSubsetWindows.RemoveWindow(window);
1830 else if (!window->IsNormal() && wasNormal)
1831 fSubsetWindows.AddWindow(window);
1833 // A normal window that was once a floating or modal window will
1834 // adopt the window's current workspaces
1836 if (!window->IsNormal()) {
1837 _ChangeWindowWorkspaces(window, window->Workspaces(),
1838 window->SubsetWorkspaces());
1841 // make sure the window has the correct position in the window lists
1845 if (!workspace_in_workspaces(i, window->Workspaces()))
1850 if (i == fCurrentWorkspace && window->IsVisible())
1851 visibleBefore = window->VisibleRegion();
1853 Window* backmost = window->Backmost(_Windows(i).LastWindow(), i);
1855 // check if the backmost window is really behind it
1856 Window* previous = window->PreviousWindow(i);
1865 // need to reinsert window before its backmost window
1866 _Windows(i).RemoveWindow(window);
1867 _Windows(i).AddWindow(window, backmost->NextWindow(i));
1872 Window* frontmost = window->Frontmost(_Windows(i).FirstWindow(), i);
1874 // check if the frontmost window is really in front of it
1875 Window* next = window->NextWindow(i);
1884 // need to reinsert window behind its frontmost window
1885 _Windows(i).RemoveWindow(window);
1886 _Windows(i).AddWindow(window, frontmost);
1897 BRegion visibleAfter(window->VisibleRegion());
1909 if (window == FocusWindow() && !window->IsVisible())
1912 NotifyWindowFeelChanged(window, newFeel);
1919 Desktop::SetWindowFlags(Window *window, uint32 newFlags)
1921 if (window->Flags() == newFlags)
1927 window->SetFlags(newFlags, &dirty);
1928 // TODO: test what happens when the window
1931 RebuildAndRedrawAfterWindowChange(window, dirty);
1936 Desktop::SetWindowTitle(Window *window, const char* title)
1941 window->SetTitle(title, dirty);
1943 RebuildAndRedrawAfterWindowChange(window, dirty);
1947 /*! Returns the window under the mouse cursor.
1953 for (Window* window = CurrentWindows().LastWindow(); window;
1954 window = window->PreviousWindow(fCurrentWorkspace)) {
1955 if (window->IsVisible() && window->VisibleRegion().Contains(where))
1956 return window->StackedWindowAt(where);
1964 Desktop::SetMouseEventWindow(Window* window)
1966 fMouseEventWindow = window;
1971 Desktop::SetViewUnderMouse(const Window* window, int32 viewToken)
1973 fWindowUnderMouse = window;
1979 Desktop::ViewUnderMouse(const Window* window)
1981 if (window != NULL && fWindowUnderMouse == window)
1989 top-most window (in case it has the kAcceptKeyboardFocusFlag flag set), or
1991 The window lock must be held when calling this function.
1996 // Get the top most non-hidden window
1997 Window* window = CurrentWindows().LastWindow();
1998 while (window != NULL && window->IsHidden()) {
1999 window = window->PreviousWindow(fCurrentWorkspace);
2002 if (window != NULL && (window->Flags() & kAcceptKeyboardFocusFlag) != 0)
2003 return &window->EventTarget();
2012 /*! Tries to set the focus to the specified \a focus window. It will make sure,
2013 however, that the window actually can have focus. You are allowed to pass
2016 Besides the B_AVOID_FOCUS flag, a modal window, or a BWindowScreen can both
2019 In any case, this method makes sure that there is a focus window, if there
2020 is any window at all, that is.
2038 // Check whether or not a window screen is in front of the window
2040 Window* window = nextFocus;
2042 window = window->NextWindow(fCurrentWorkspace);
2043 if (window == NULL || window->Feel() == kWindowScreenFeel)
2046 if (window != NULL)
2053 // the window that is supposed to get focus already has focus
2069 // If the last window having focus is a window that cannot make it
2079 // make sure no window is chosen that doesn't want focus or cannot have it
2085 // turns out the window that is supposed to get focus now already has it
2134 Desktop::SetFocusLocked(const Window* window)
2138 if (window != NULL) {
2146 fLockedFocusWindow = window;
2153 for (Window *window = fAllWindows.FirstWindow(); window != NULL;
2154 window = window->NextWindow(kAllWindowList)) {
2155 if (window->ServerWindow()->ClientToken() == token
2156 && window->ServerWindow()->ClientTeam() == teamID) {
2157 return window;
2168 for (Window *window = fAllWindows.FirstWindow(); window != NULL;
2169 window = window->NextWindow(kAllWindowList)) {
2170 if (window->EventTarget().Messenger() == messenger)
2171 return &window->EventTarget();
2201 /*! \brief Redraws the background (ie. the desktop window, if any).
2210 Window* window = CurrentWindows().FirstWindow();
2211 if (window != NULL && window->Feel() == kDesktopWindowFeel) {
2212 redraw = window->VisibleContentRegion();
2216 View* view = window->TopView();
2228 window->ProcessDirtyRegion(redraw);
2256 for (Window* window = fAllWindows.FirstWindow(); window != NULL;
2257 window = window->NextWindow(kAllWindowList)) {
2259 window->GetBorderRegion(&oldBorder);
2261 if (!window->ReloadDecor()) {
2267 window->GetBorderRegion(&border);
2270 RebuildAndRedrawAfterWindowChange(window, border);
2290 for (Window *window = fAllWindows.FirstWindow(); window != NULL;
2291 window = window->NextWindow(kAllWindowList)) {
2292 if (window->ServerWindow()->ClientTeam() != team)
2295 window->ServerWindow()->NotifyMinimize(true);
2308 for (Window *window = fAllWindows.FirstWindow(); window != NULL;
2309 window = window->NextWindow(kAllWindowList)) {
2310 if (window->ServerWindow()->ClientTeam() != team)
2313 window->ServerWindow()->NotifyMinimize(false);
2327 Window* window;
2330 || (window = serverWindow->Window()) == NULL) {
2335 if (action == B_BRING_TO_FRONT && !window->IsMinimized()) {
2336 // the window is visible, we just need to make it the front window
2337 ActivateWindow(window);
2339 // if not, ask the window if it wants to be unminimized
2356 for (Window *window = fAllWindows.FirstWindow(); window != NULL;
2357 window = window->NextWindow(kAllWindowList)) {
2358 if (team < B_OK || window->ServerWindow()->ClientTeam() == team)
2368 for (Window *window = CurrentWindows().LastWindow(); window != NULL;
2369 window = window->PreviousWindow(fCurrentWorkspace)) {
2370 if (team >= B_OK && window->ServerWindow()->ClientTeam() != team)
2373 sender.Attach<int32>(window->ServerWindow()->ServerToken());
2377 for (Window *window = fAllWindows.FirstWindow(); window != NULL;
2378 window = window->NextWindow(kAllWindowList)) {
2379 if ((team >= B_OK && window->ServerWindow()->ClientTeam() != team)
2380 || window->InWorkspace(fCurrentWorkspace))
2383 sender.Attach<int32>(window->ServerWindow()->ServerToken());
2396 ::ServerWindow* window;
2398 B_SERVER_TOKEN, (void**)&window) != B_OK) {
2405 window->GetInfo(info);
2409 ::Window* tmp = window->Window();
2420 int32 length = window->Title() ? strlen(window->Title()) : 0;
2429 sender.Attach(window->Title(), length + 1);
2458 for (Window *window = _Windows(workspace).LastWindow(); window != NULL;
2459 window = window->PreviousWindow(workspace)) {
2460 sender.Attach<int32>(window->ServerWindow()->ServerToken());
2478 // as long as we hold the window lock, no new window can appear
2501 for (Window *window = _Windows(workspace).LastWindow(); window != NULL;
2502 window = window->PreviousWindow(workspace)) {
2503 team_id team = window->ServerWindow()->ClientTeam();
2900 for (Window* window = fAllWindows.FirstWindow(); window != NULL;
2901 window = window->NextWindow(kAllWindowList)) {
2902 if (window->ServerWindow()->ClientLooperPort() == port)
2903 return window;
2945 for (Window* window = fAllWindows.FirstWindow(); window != NULL;
2946 window = window->NextWindow(kAllWindowList)) {
2947 ColorUpdated(window, which, color);
3001 // TODO: put the floating last in the floating window list to
3002 // preserve the on screen window order
3019 /*! Search the visible windows for a valid back window
3027 for (Window* window = CurrentWindows().FirstWindow(); window != NULL;
3028 window = window->NextWindow(fCurrentWorkspace)) {
3029 if (window->IsHidden() || window->Feel() == kDesktopWindowFeel)
3032 fBack = window;
3038 /*! Search the visible windows for a valid front window
3050 for (Window* window = CurrentWindows().LastWindow(); window != NULL;
3051 window = window->PreviousWindow(fCurrentWorkspace)) {
3052 if (window->IsHidden() || window->IsFloating()
3053 || !window->SupportsFront())
3056 fFront = window;
3074 Desktop::_WindowHasModal(Window* window) const
3076 if (window == NULL)
3085 if (modal->HasInSubset(window))
3093 /*! Determines whether or not the specified \a window can have focus at all.
3096 Desktop::_WindowCanHaveFocus(Window* window) const
3098 return window != NULL
3099 && window->InWorkspace(fCurrentWorkspace)
3100 && (window->Flags() & B_AVOID_FOCUS) == 0
3101 && !_WindowHasModal(window)
3102 && !window->IsHidden();
3106 /*! You must at least hold a single window lock when calling this method.
3109 Desktop::_WindowChanged(Window* window)
3117 view->WindowChanged(window);
3122 /*! You must at least hold a single window lock when calling this method.
3125 Desktop::_WindowRemoved(Window* window)
3133 view->WindowRemoved(window);
3138 /*! Shows the window on the screen - it does this independently of the
3142 Desktop::_ShowWindow(Window* window, bool affectsOtherWindows)
3147 _WindowChanged(window);
3149 BRegion dirty(window->VisibleRegion());
3153 // window needs a redraw, but other windows
3155 // of the window, and don't have to use MarkDirty()
3156 window->ProcessDirtyRegion(dirty);
3160 if (window->ServerWindow()->HasDirectFrameBufferAccess()) {
3161 window->ServerWindow()->HandleDirectConnection(
3167 /*! Hides the window from the screen - it does this independently of the
3171 Desktop::_HideWindow(Window* window)
3173 if (window->ServerWindow()->IsDirectlyAccessing())
3174 window->ServerWindow()->HandleDirectConnection(B_DIRECT_STOP);
3177 // this window will not have a visible
3183 BRegion dirty(window->VisibleRegion());
3188 _WindowChanged(window);
3195 specifed window.
3197 the specifed window to the new workspace; this form is only called by
3201 Desktop::_UpdateSubsetWorkspaces(Window* window, int32 previousIndex,
3204 STRACE(("_UpdateSubsetWorkspaces(window %p, %s)\n", window,
3205 window->Title()));
3207 // if the window is hidden, the subset windows are up-to-date already
3208 if (!window->IsNormal() || window->IsHidden())
3227 if (subset->HasInSubset(window)) {
3235 /*! \brief Adds or removes the window to or from the workspaces it's on.
3238 Desktop::_ChangeWindowWorkspaces(Window* window, uint32 oldWorkspaces,
3244 // apply changes to the workspaces' window lists
3253 // window is on this workspace, is it anymore?
3255 _Windows(i).RemoveWindow(window);
3256 if (fLastWorkspaceFocus[i] == window)
3261 window->SetCurrentWorkspace(-1);
3263 if (!window->IsHidden())
3264 _HideWindow(window);
3268 // window was not on this workspace, is it now?
3270 _Windows(i).AddWindow(window,
3271 window->Frontmost(_Windows(i).FirstWindow(), i));
3274 // make the window visible in current workspace
3275 window->SetCurrentWorkspace(fCurrentWorkspace);
3277 if (!window->IsHidden()) {
3278 // This only affects other windows if this window has
3282 _ShowWindow(window, FrontWindow() == window);
3289 // If the window is visible only on one workspace, we set it's current
3302 window->Anchor(firstWorkspace).position = window->Frame().LeftTop();
3305 _UpdateSubsetWorkspaces(window);
3307 NotifyWindowWorkspacesChanged(window, newWorkspaces);
3317 // visible of the window
3320 for (Window* window = windows.FirstWindow(); window != NULL;
3321 window = window->NextWindow(list)) {
3323 clean.Include(&window->VisibleRegion());
3325 CurrentWindows().AddWindow(window,
3326 window->Frontmost(CurrentWindows().FirstWindow(),
3329 _WindowChanged(window);
3335 // redraw what became visible of the window(s)
3338 for (Window* window = windows.FirstWindow(); window != NULL;
3339 window = window->NextWindow(list)) {
3340 dirty.Include(&window->VisibleRegion());
3353 /*! Returns the last focussed non-hidden subset window belonging to the
3354 specified \a window.
3357 Desktop::_LastFocusSubsetWindow(Window* window)
3359 if (window == NULL)
3364 if (front != window && !front->IsHidden()
3365 && window->HasInSubset(front))
3374 to the previous mouse window.
3376 You need to have the all window lock held when calling this method.
3381 Window* window = WindowAt(fLastMousePosition);
3382 return window != lastWindowUnderMouse;
3386 /*! \brief Sends a fake B_MOUSE_MOVED event to the window under the mouse,
3390 ie. because of a workspace change, a closing window, or programmatic window
3396 Desktop::_SendFakeMouseMoved(Window* window)
3403 if (window == NULL)
3404 window = WindowAt(fLastMousePosition);
3406 if (window != NULL) {
3408 window->MouseMoved(&message, fLastMousePosition, &viewToken, true,
3412 target = &window->EventTarget();
3416 SetViewUnderMouse(window, viewToken);
3443 // each window on the screen will take a portion from that area
3448 // set clipping of each window
3449 for (Window* window = CurrentWindows().LastWindow(); window != NULL;
3450 window = window->PreviousWindow(fCurrentWorkspace)) {
3451 if (!window->IsHidden()) {
3452 window->SetClipping(&stillAvailableOnScreen);
3453 window->SetScreen(_DetermineScreenFor(window->Frame()));
3455 if (window->ServerWindow()->IsDirectlyAccessing()) {
3456 window->ServerWindow()->HandleDirectConnection(
3461 stillAvailableOnScreen.Exclude(&window->VisibleRegion());
3471 for (Window* window = CurrentWindows().LastWindow(); window != NULL;
3472 window = window->PreviousWindow(fCurrentWorkspace)) {
3473 if (!window->IsHidden()
3474 && dirtyRegion.Intersects(window->VisibleRegion().Frame()))
3475 window->ProcessDirtyRegion(dirtyRegion, exposeRegion);
3505 //! The all window lock must be held when calling this function.
3521 // set clipping of each window
3522 for (Window* window = CurrentWindows().LastWindow(); window != NULL;
3523 window = window->PreviousWindow(fCurrentWorkspace)) {
3524 if (!window->IsHidden()) {
3525 if (window == changedWindow)
3528 window->SetClipping(&stillAvailableOnScreen);
3529 window->SetScreen(_DetermineScreenFor(window->Frame()));
3531 if (window->ServerWindow()->IsDirectlyAccessing()) {
3532 window->ServerWindow()->HandleDirectConnection(
3537 stillAvailableOnScreen.Exclude(&window->VisibleRegion());
3554 for (Window* window = fAllWindows.FirstWindow(); window != NULL;
3555 window = window->NextWindow(kAllWindowList)) {
3556 if (window->ServerWindow()->IsDirectlyAccessing())
3557 window->ServerWindow()->HandleDirectConnection(B_DIRECT_STOP);
3568 for (Window* window = fAllWindows.FirstWindow(); window != NULL;
3569 window = window->NextWindow(kAllWindowList)) {
3570 if (window->IsHidden() || !window->InWorkspace(fCurrentWorkspace))
3573 if (window->ServerWindow()->HasDirectFrameBufferAccess()) {
3574 window->ServerWindow()->HandleDirectConnection(
3626 for (Window* window = fAllWindows.FirstWindow(); window != NULL;
3627 window = window->NextWindow(kAllWindowList)) {
3628 if (window->Screen() == screen)
3629 window->ServerWindow()->ScreenChanged(&update);
3639 // search for an unhidden window in the current workspace
3643 for (Window* window = CurrentWindows().LastWindow(); window != NULL;
3644 window = window->PreviousWindow(fCurrentWorkspace)) {
3645 if (!window->IsHidden() && window->IsNormal()
3646 && window->ServerWindow()->ClientTeam() == team) {
3647 ActivateWindow(window);
3652 // search for an unhidden window to give focus to
3654 for (Window* window = fAllWindows.FirstWindow(); window != NULL;
3655 window = window->NextWindow(kAllWindowList)) {
3656 // if window is a normal window of the team, and not hidden,
3658 if (!window->IsHidden() && window->IsNormal()
3659 && window->ServerWindow()->ClientTeam() == team) {
3660 ActivateWindow(window);
3665 // TODO: we cannot maximize minimized windows here (with the window lock
3667 // the ServerApp of this team - it maintains its own window list, and can
3668 // therefore call ActivateWindow() without holding the window lock.
3705 You must hold the all window lock when calling this method.
3726 // The window currently being dragged will follow us to this
3773 for (Window* window = CurrentWindows().FirstWindow();
3774 window != NULL; window = window->NextWindow(previousIndex)) {
3776 window->Anchor(previousIndex).position = window->Frame().LeftTop();
3778 if (!window->IsHidden()
3779 && window->ServerWindow()->IsDirectlyAccessing())
3780 window->ServerWindow()->HandleDirectConnection(B_DIRECT_STOP);
3782 window->WorkspaceActivated(previousIndex, false);
3784 if (window->InWorkspace(index))
3787 if (!window->IsHidden()) {
3788 // this window will no longer be visible
3789 dirty.Include(&window->VisibleRegion());
3792 window->SetCurrentWorkspace(-1);
3807 for (Window* window = _Windows(index).FirstWindow();
3808 window != NULL; window = window->NextWindow(index)) {
3809 BPoint position = window->Anchor(index).position;
3811 window->SetCurrentWorkspace(index);
3813 if (window->IsHidden())
3818 // of the window in the previous workspace is adopted
3819 position = window->Frame().LeftTop();
3820 // TODO: make sure the window is still on-screen if it
3824 if (!window->InWorkspace(previousIndex)) {
3825 // This window was not visible before, make sure its frame
3827 if (window->Frame().LeftTop() != position) {
3828 BPoint offset = position - window->Frame().LeftTop();
3829 window->MoveBy((int32)offset.x, (int32)offset.y);
3834 if (window->Frame().LeftTop() != position) {
3835 // the window was visible before, but its on-screen location changed
3836 BPoint offset = position - window->Frame().LeftTop();
3837 MoveWindowBy(window, offset.x, offset.y);
3841 // window if they changed their order
3843 BRegion(window->VisibleRegion()));
3846 windows.AddWindow(window);
3859 for (Window* window = _Windows(index).FirstWindow(); window != NULL;
3860 window = window->NextWindow(index)) {
3862 window->WorkspaceActivated(index, true);
3864 if (!window->IsHidden()
3865 && window->ServerWindow()->HasDirectFrameBufferAccess()) {
3866 window->ServerWindow()->HandleDirectConnection(
3870 if (window->InWorkspace(previousIndex) || window->IsHidden()
3871 || (window == movedWindow && movedWindow->IsNormal())
3872 || (!window->IsNormal()
3873 && window->HasInSubset(movedWindow))) {
3874 // This window was visible before, and is already handled in the
3879 dirty.Include(&window->VisibleRegion());
3882 // Catch order changes in the new workspaces window list
3884 for (Window* window = windows.FirstWindow(); window != NULL;
3885 window = window->NextWindow(kWorkingList), i++) {
3887 region->ExclusiveInclude(&window->VisibleRegion());
3892 // Set new focus, but keep focus to a floating window if still visible