[haiku-commits] haiku: hrev45665 - src/servers/app

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 11 May 2013 07:30:34 +0200 (CEST)

hrev45665 adds 1 changeset to branch 'master'
old head: ee7f4fab922f4dbfa30748cd2753c5d8beea4099
new head: 9e1a0720cb3f2e15944658003beac1db18bf5c09
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=9e1a072+%5Eee7f4fa

----------------------------------------------------------------------------

9e1a072: Fix FFM focus loss on window close
  
  kFocusList is an invalid index for _Windows(). fWorkspaces would be
  accessed out of bounds.

                                    [ Ingo Weinhold <ingo_weinhold@xxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev45665
Commit:      9e1a0720cb3f2e15944658003beac1db18bf5c09
URL:         http://cgit.haiku-os.org/haiku/commit/?id=9e1a072
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Sat May 11 05:29:34 2013 UTC

----------------------------------------------------------------------------

1 file changed, 8 insertions(+), 5 deletions(-)
src/servers/app/Desktop.cpp | 13 ++++++++-----

----------------------------------------------------------------------------

diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp
index 4663c0b..f9e8d45 100644
--- a/src/servers/app/Desktop.cpp
+++ b/src/servers/app/Desktop.cpp
@@ -1903,12 +1903,15 @@ Desktop::SetFocusWindow(Window* nextFocus)
                return;
        }
 
-       uint32 list = fCurrentWorkspace;
-       if (!fSettings->NormalMouse())
-               list = kFocusList;
+       uint32 listIndex = fCurrentWorkspace;
+       WindowList* list = &_Windows(fCurrentWorkspace);
+       if (!fSettings->NormalMouse()) {
+               listIndex = kFocusList;
+               list = &fFocusList;
+       }
 
        if (nextFocus == NULL || hasModal || hasWindowScreen) {
-               nextFocus = _Windows(list).LastWindow();
+               nextFocus = list->LastWindow();
 
                if (fSettings->NormalMouse()) {
                        // If the last window having focus is a window that 
cannot make it
@@ -1923,7 +1926,7 @@ Desktop::SetFocusWindow(Window* nextFocus)
 
        // make sure no window is chosen that doesn't want focus or cannot have 
it
        while (nextFocus != NULL && !_WindowCanHaveFocus(nextFocus)) {
-               nextFocus = nextFocus->PreviousWindow(list);
+               nextFocus = nextFocus->PreviousWindow(listIndex);
        }
 
        if (fFocus == nextFocus) {


Other related posts:

  • » [haiku-commits] haiku: hrev45665 - src/servers/app - ingo_weinhold