* AS_CURRENT_WORKSPACE now holds a single window lock before retrieving

the current workspace.
* This should fix bug #1765 as far as the app_server is concerned.
* Cleanup, removed extraneous white space.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24632 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-03-28 18:59:08 +00:00
parent b4bacb2a8a
commit 9dbce7a4e7
2 changed files with 81 additions and 60 deletions

View File

@ -61,7 +61,8 @@ class Desktop : public MessageLooper, public ScreenOwner {
uid_t UserID() const { return fUserID; }
virtual port_id MessagePort() const { return fMessagePort; }
area_id SharedReadOnlyArea() const { return fSharedReadOnlyArea; }
area_id SharedReadOnlyArea() const
{ return fSharedReadOnlyArea; }
::EventDispatcher& EventDispatcher() { return fEventDispatcher; }
@ -121,8 +122,10 @@ class Desktop : public MessageLooper, public ScreenOwner {
void MoveWindowBy(Window* window, float x, float y,
int32 workspace = -1);
void ResizeWindowBy(Window* window, float x, float y);
bool SetWindowTabLocation(Window* window, float location);
void ResizeWindowBy(Window* window, float x,
float y);
bool SetWindowTabLocation(Window* window,
float location);
bool SetWindowDecoratorSettings(Window* window,
const BMessage& settings);
@ -140,7 +143,8 @@ class Desktop : public MessageLooper, public ScreenOwner {
void SetWindowLook(Window* window, window_look look);
void SetWindowFeel(Window* window, window_feel feel);
void SetWindowFlags(Window* window, uint32 flags);
void SetWindowTitle(Window* window, const char* title);
void SetWindowTitle(Window* window,
const char* title);
Window* FocusWindow() const { return fFocus; }
Window* FrontWindow() const { return fFront; }
@ -148,10 +152,12 @@ class Desktop : public MessageLooper, public ScreenOwner {
Window* WindowAt(BPoint where);
Window* MouseEventWindow() const { return fMouseEventWindow; }
Window* MouseEventWindow() const
{ return fMouseEventWindow; }
void SetMouseEventWindow(Window* window);
void SetViewUnderMouse(const Window* window, int32 viewToken);
void SetViewUnderMouse(const Window* window,
int32 viewToken);
int32 ViewUnderMouse(const Window* window);
void SetFocusWindow(Window* window = NULL);
@ -161,17 +167,25 @@ class Desktop : public MessageLooper, public ScreenOwner {
team_id teamID);
#if USE_MULTI_LOCKER
bool LockSingleWindow() { return fWindowLock.ReadLock(); }
void UnlockSingleWindow() { fWindowLock.ReadUnlock(); }
bool LockSingleWindow()
{ return fWindowLock.ReadLock(); }
void UnlockSingleWindow()
{ fWindowLock.ReadUnlock(); }
bool LockAllWindows() { return fWindowLock.WriteLock(); }
void UnlockAllWindows() { fWindowLock.WriteUnlock(); }
bool LockAllWindows()
{ return fWindowLock.WriteLock(); }
void UnlockAllWindows()
{ fWindowLock.WriteUnlock(); }
#else // USE_MULTI_LOCKER
bool LockSingleWindow() { return fWindowLock.Lock(); }
void UnlockSingleWindow() { fWindowLock.Unlock(); }
bool LockSingleWindow()
{ return fWindowLock.Lock(); }
void UnlockSingleWindow()
{ fWindowLock.Unlock(); }
bool LockAllWindows() { return fWindowLock.Lock(); }
void UnlockAllWindows() { fWindowLock.Unlock(); }
bool LockAllWindows()
{ return fWindowLock.Lock(); }
void UnlockAllWindows()
{ fWindowLock.Unlock(); }
#endif // USE_MULTI_LOCKER
void MarkDirty(BRegion& region);
@ -211,8 +225,10 @@ class Desktop : public MessageLooper, public ScreenOwner {
status_t _ActivateApp(team_id team);
void _SendFakeMouseMoved(Window* window = NULL);
void _RebuildClippingForAllWindows(BRegion& stillAvailableOnScreen);
void _TriggerWindowRedrawing(BRegion& newDirtyRegion);
void _RebuildClippingForAllWindows(
BRegion& stillAvailableOnScreen);
void _TriggerWindowRedrawing(
BRegion& newDirtyRegion);
void _SetBackground(BRegion& background);
void _UpdateFloating(int32 previousWorkspace = -1,

View File

@ -787,8 +787,13 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
case AS_CURRENT_WORKSPACE:
STRACE(("ServerApp %s: get current workspace\n", Signature()));
if (fDesktop->LockSingleWindow()) {
fLink.StartMessage(B_OK);
fLink.Attach<int32>(fDesktop->CurrentWorkspace());
fDesktop->UnlockSingleWindow();
} else
fLink.StartMessage(B_ERROR);
fLink.Flush();
break;