* Since ServerWindow::Window() can also be NULL in case the window hadn't been

added to the Desktop yet, we better make sure in AS_GET_SCREEN_ID_FROM_WINDOW
  that this is not the case.
* Removed the now superfluous ServerWindow::IsOffscreen() again.
+alphabranch


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32653 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-08-24 15:22:34 +00:00
parent 4693495cf0
commit fe9c291b29
3 changed files with 30 additions and 36 deletions
+5 -1
View File
@@ -2267,8 +2267,12 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
if (window->ClientToken() == clientToken) { if (window->ClientToken() == clientToken) {
// found it! // found it!
if (window->IsOffscreen()) if (window->Window() == NULL) {
// The window hasn't been added to the desktop yet,
// or it's an offscreen window
break; break;
}
fLink.StartMessage(B_OK); fLink.StartMessage(B_OK);
fLink.Attach<int32>(window->Window()->Screen()->ID()); fLink.Attach<int32>(window->Window()->Screen()->ID());
status = B_OK; status = B_OK;
+17 -26
View File
@@ -285,6 +285,23 @@ ServerWindow::Init(BRect frame, window_look look, window_feel feel,
} }
/*! Returns the ServerWindow's Window, if it exists and has been
added to the Desktop already.
In other words, you cannot assume this method will always give you
a valid pointer.
*/
Window*
ServerWindow::Window() const
{
ASSERT_MULTI_LOCKED(fDesktop->WindowLocker());
if (!fWindowAddedToDesktop)
return NULL;
return fWindow;
}
void void
ServerWindow::_PrepareQuit() ServerWindow::_PrepareQuit()
{ {
@@ -472,32 +489,6 @@ ServerWindow::ResyncDrawState()
} }
/*! Returns the ServerWindow's Window, if it exists and has been
added to the Desktop already.
In other words, you cannot assume this method will always give you
a valid pointer.
*/
Window*
ServerWindow::Window() const
{
// TODO: ensure desktop is locked!
if (!fWindowAddedToDesktop)
return NULL;
return fWindow;
}
bool
ServerWindow::IsOffscreen() const
{
// TODO: ensure desktop is locked!
// TODO: ensure the Window has been created!
return fWindow->IsOffscreenWindow();
}
View* View*
ServerWindow::_CreateView(BPrivate::LinkReceiver& link, View** _parent) ServerWindow::_CreateView(BPrivate::LinkReceiver& link, View** _parent)
{ {
+5 -6
View File
@@ -57,10 +57,15 @@ public:
status_t Init(BRect frame, window_look look, status_t Init(BRect frame, window_look look,
window_feel feel, uint32 flags, window_feel feel, uint32 flags,
uint32 workspace); uint32 workspace);
virtual port_id MessagePort() const { return fMessagePort; } virtual port_id MessagePort() const { return fMessagePort; }
::EventTarget& EventTarget() { return fEventTarget; } ::EventTarget& EventTarget() { return fEventTarget; }
inline ServerApp* App() const { return fServerApp; }
::Desktop* Desktop() const { return fDesktop; }
::Window* Window() const;
// methods for sending various messages to client. // methods for sending various messages to client.
void NotifyQuitRequested(); void NotifyQuitRequested();
void NotifyMinimize(bool minimize); void NotifyMinimize(bool minimize);
@@ -80,12 +85,6 @@ public:
window_look look, window_feel feel, window_look look, window_feel feel,
uint32 flags, uint32 workspace); uint32 flags, uint32 workspace);
// to who we belong. who do we own. our title.
inline ServerApp* App() const { return fServerApp; }
::Desktop* Desktop() const { return fDesktop; }
::Window* Window() const;
bool IsOffscreen() const;
void SetTitle(const char* newTitle); void SetTitle(const char* newTitle);
inline const char* Title() const { return fTitle; } inline const char* Title() const { return fTitle; }