* Resolved a TODO and got rid of Desktop::ActiveScreen().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32566 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -302,9 +302,8 @@ Desktop::Desktop(uid_t userID)
|
|||||||
fSubsetWindows(kSubsetList),
|
fSubsetWindows(kSubsetList),
|
||||||
fFocusList(kFocusList),
|
fFocusList(kFocusList),
|
||||||
fWorkspacesViews(false),
|
fWorkspacesViews(false),
|
||||||
fWorkspacesLock("workspaces list"),
|
|
||||||
fActiveScreen(NULL),
|
|
||||||
|
|
||||||
|
fWorkspacesLock("workspaces list"),
|
||||||
fWindowLock("window lock"),
|
fWindowLock("window lock"),
|
||||||
|
|
||||||
fMouseEventWindow(NULL),
|
fMouseEventWindow(NULL),
|
||||||
@@ -369,9 +368,6 @@ Desktop::Init()
|
|||||||
fVirtualScreen.SetConfiguration(*this,
|
fVirtualScreen.SetConfiguration(*this,
|
||||||
fWorkspaces[0].CurrentScreenConfiguration());
|
fWorkspaces[0].CurrentScreenConfiguration());
|
||||||
|
|
||||||
// TODO: temporary workaround, fActiveScreen will be removed
|
|
||||||
fActiveScreen = fVirtualScreen.ScreenAt(0);
|
|
||||||
|
|
||||||
if (fVirtualScreen.HWInterface() == NULL) {
|
if (fVirtualScreen.HWInterface() == NULL) {
|
||||||
debug_printf("Could not initialize graphics output. Exiting.\n");
|
debug_printf("Could not initialize graphics output. Exiting.\n");
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|||||||
@@ -113,15 +113,10 @@ public:
|
|||||||
int32* buttons) const;
|
int32* buttons) const;
|
||||||
// for use by ServerWindow
|
// for use by ServerWindow
|
||||||
|
|
||||||
// Screen and drawing related methods
|
|
||||||
|
|
||||||
Screen* ScreenAt(int32 index) const
|
|
||||||
{ return fActiveScreen; }
|
|
||||||
Screen* ActiveScreen() const
|
|
||||||
{ return fActiveScreen; }
|
|
||||||
|
|
||||||
CursorManager& GetCursorManager() { return fCursorManager; }
|
CursorManager& GetCursorManager() { return fCursorManager; }
|
||||||
|
|
||||||
|
// Screen and drawing related methods
|
||||||
|
|
||||||
status_t SetScreenMode(int32 workspace, int32 id,
|
status_t SetScreenMode(int32 workspace, int32 id,
|
||||||
const display_mode& mode, bool makeDefault);
|
const display_mode& mode, bool makeDefault);
|
||||||
status_t GetScreenMode(int32 workspace, int32 id,
|
status_t GetScreenMode(int32 workspace, int32 id,
|
||||||
@@ -317,8 +312,6 @@ private:
|
|||||||
BObjectList<WorkspacesView> fWorkspacesViews;
|
BObjectList<WorkspacesView> fWorkspacesViews;
|
||||||
BLocker fWorkspacesLock;
|
BLocker fWorkspacesLock;
|
||||||
|
|
||||||
Screen* fActiveScreen;
|
|
||||||
|
|
||||||
CursorManager fCursorManager;
|
CursorManager fCursorManager;
|
||||||
|
|
||||||
#if USE_MULTI_LOCKER
|
#if USE_MULTI_LOCKER
|
||||||
|
|||||||
@@ -2263,11 +2263,11 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
ServerWindow* window = fWindowList.ItemAt(i);
|
ServerWindow* window = fWindowList.ItemAt(i);
|
||||||
|
|
||||||
if (window->ClientToken() == clientToken) {
|
if (window->ClientToken() == clientToken) {
|
||||||
// got it!
|
// found it!
|
||||||
fLink.StartMessage(B_OK);
|
fLink.StartMessage(B_OK);
|
||||||
fLink.Attach<int32>(B_MAIN_SCREEN_ID.id);
|
fLink.Attach<int32>(window->Window()->Screen()->ID());
|
||||||
// TODO: for now...
|
|
||||||
status = B_OK;
|
status = B_OK;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3550,14 +3550,14 @@ ServerWindow::_MessageLooper()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerWindow::ScreenChanged(const BMessage *message)
|
ServerWindow::ScreenChanged(const BMessage* message)
|
||||||
{
|
{
|
||||||
// TODO: execute the stop notification earlier
|
// TODO: execute the stop notification earlier
|
||||||
//HandleDirectConnection(B_DIRECT_STOP);
|
//HandleDirectConnection(B_DIRECT_STOP);
|
||||||
SendMessageToClient(message);
|
SendMessageToClient(message);
|
||||||
|
|
||||||
if (fDirectWindowData != NULL && fDirectWindowData->full_screen) {
|
if (fDirectWindowData != NULL && fDirectWindowData->full_screen) {
|
||||||
BRect screenFrame = fDesktop->ActiveScreen()->Frame();
|
BRect screenFrame = fWindow->Screen()->Frame();
|
||||||
fDesktop->ResizeWindowBy(fWindow,
|
fDesktop->ResizeWindowBy(fWindow,
|
||||||
screenFrame.Width() - fWindow->Frame().Width(),
|
screenFrame.Width() - fWindow->Frame().Width(),
|
||||||
screenFrame.Height() - fWindow->Frame().Height());
|
screenFrame.Height() - fWindow->Frame().Height());
|
||||||
@@ -3575,7 +3575,7 @@ ServerWindow::SendMessageToClient(const BMessage* msg, int32 target) const
|
|||||||
target = fClientToken;
|
target = fClientToken;
|
||||||
|
|
||||||
BMessenger reply;
|
BMessenger reply;
|
||||||
BMessage::Private messagePrivate((BMessage *)msg);
|
BMessage::Private messagePrivate((BMessage*)msg);
|
||||||
return messagePrivate.SendMessage(fClientLooperPort, fClientTeam, target,
|
return messagePrivate.SendMessage(fClientLooperPort, fClientTeam, target,
|
||||||
0, false, reply);
|
0, false, reply);
|
||||||
}
|
}
|
||||||
@@ -3587,7 +3587,7 @@ ServerWindow::MakeWindow(BRect frame, const char* name,
|
|||||||
{
|
{
|
||||||
// The non-offscreen ServerWindow uses the DrawingEngine instance from
|
// The non-offscreen ServerWindow uses the DrawingEngine instance from
|
||||||
// the desktop.
|
// the desktop.
|
||||||
return new (nothrow) ::Window(frame, name, look, feel, flags,
|
return new(std::nothrow) ::Window(frame, name, look, feel, flags,
|
||||||
workspace, this, new (nothrow) DrawingEngine(fDesktop->HWInterface()));
|
workspace, this, new (nothrow) DrawingEngine(fDesktop->HWInterface()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3799,8 +3799,7 @@ ServerWindow::_DirectWindowSetFullScreen(bool enable)
|
|||||||
fDesktop->HWInterface()->SetCursorVisible(false);
|
fDesktop->HWInterface()->SetCursorVisible(false);
|
||||||
|
|
||||||
fDirectWindowData->old_window_frame = fWindow->Frame();
|
fDirectWindowData->old_window_frame = fWindow->Frame();
|
||||||
BRect screenFrame =
|
BRect screenFrame = fWindow->Screen()->Frame();
|
||||||
fDesktop->ActiveScreen()->Frame();
|
|
||||||
fDirectWindowFeel = fWindow->Feel();
|
fDirectWindowFeel = fWindow->Feel();
|
||||||
fDesktop->MoveWindowBy(fWindow, -fWindow->Frame().left,
|
fDesktop->MoveWindowBy(fWindow, -fWindow->Frame().left,
|
||||||
-fWindow->Frame().top);
|
-fWindow->Frame().top);
|
||||||
|
|||||||
@@ -162,9 +162,8 @@ Window::Window(const BRect& frame, const char *name,
|
|||||||
uint16 width, height;
|
uint16 width, height;
|
||||||
uint32 colorSpace;
|
uint32 colorSpace;
|
||||||
float frequency;
|
float frequency;
|
||||||
if (fDesktop->ScreenAt(0)) {
|
if (Screen() != NULL) {
|
||||||
fDesktop->ScreenAt(0)->GetMode(width, height,
|
Screen()->GetMode(width, height, colorSpace, frequency);
|
||||||
colorSpace, frequency);
|
|
||||||
// TODO: MOVE THIS AWAY!!! ResizeBy contains calls to virtual methods!
|
// TODO: MOVE THIS AWAY!!! ResizeBy contains calls to virtual methods!
|
||||||
// Also, there is no TopView()!
|
// Also, there is no TopView()!
|
||||||
fFrame.OffsetTo(B_ORIGIN);
|
fFrame.OffsetTo(B_ORIGIN);
|
||||||
@@ -564,6 +563,16 @@ Window::PreviousWindow(int32 index) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
::Screen*
|
||||||
|
Window::Screen() const
|
||||||
|
{
|
||||||
|
ASSERT_MULTI_LOCKED(fDesktop->WindowLocker());
|
||||||
|
|
||||||
|
// TODO: we need to know which screen the window is on
|
||||||
|
return fDesktop->VirtualScreen().ScreenAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
@@ -1147,7 +1156,7 @@ Window::_AlterDeltaForSnap(BPoint& delta, bigtime_t now)
|
|||||||
BRect frame = fFrame;
|
BRect frame = fFrame;
|
||||||
BPoint offsetWithinFrame;
|
BPoint offsetWithinFrame;
|
||||||
// TODO: Perhaps obtain the usable area (not covered by the Deskbar)?
|
// TODO: Perhaps obtain the usable area (not covered by the Deskbar)?
|
||||||
BRect screenFrame = fDesktop->ActiveScreen()->Frame();
|
BRect screenFrame = Screen()->Frame();
|
||||||
|
|
||||||
if (fDecorator) {
|
if (fDecorator) {
|
||||||
BRegion reg;
|
BRegion reg;
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class Decorator;
|
|||||||
class Desktop;
|
class Desktop;
|
||||||
class DrawingEngine;
|
class DrawingEngine;
|
||||||
class EventDispatcher;
|
class EventDispatcher;
|
||||||
|
class Screen;
|
||||||
class WorkspacesView;
|
class WorkspacesView;
|
||||||
|
|
||||||
// TODO: move this into a proper place
|
// TODO: move this into a proper place
|
||||||
@@ -41,6 +42,7 @@ enum {
|
|||||||
UPDATE_EXPOSE = 0x02,
|
UPDATE_EXPOSE = 0x02,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Window {
|
class Window {
|
||||||
public:
|
public:
|
||||||
Window(const BRect& frame, const char *name,
|
Window(const BRect& frame, const char *name,
|
||||||
@@ -65,6 +67,8 @@ public:
|
|||||||
::EventTarget& EventTarget() const
|
::EventTarget& EventTarget() const
|
||||||
{ return fWindow->EventTarget(); }
|
{ return fWindow->EventTarget(); }
|
||||||
|
|
||||||
|
::Screen* Screen() const;
|
||||||
|
|
||||||
// setting and getting the "hard" clipping, you need to have
|
// setting and getting the "hard" clipping, you need to have
|
||||||
// WriteLock()ed the clipping!
|
// WriteLock()ed the clipping!
|
||||||
void SetClipping(BRegion* stillAvailableOnScreen);
|
void SetClipping(BRegion* stillAvailableOnScreen);
|
||||||
|
|||||||
Reference in New Issue
Block a user