* Forgot to update Screen.h with the last commit...
* Introduced and implemented AS_GET_SCREEN_ID_FROM_WINDOW - it only returns B_MAIN_SCREEN_ID, though. * renamed ServerWindow::fHandlerToken to fClientToken. * The BScreen(BWindow *) constructor now really asks the server for the screen ID. * ServerApp::fWindowList is now a BObjectList. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14910 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -85,7 +85,7 @@ private:
|
||||
void* BaseAddress();
|
||||
uint32 BytesPerRow();
|
||||
|
||||
BPrivateScreen *screen;
|
||||
BPrivateScreen *fScreen;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -143,23 +143,24 @@ enum {
|
||||
AS_SCREEN_SET_MODE,
|
||||
AS_PROPOSE_MODE,
|
||||
AS_GET_MODE_LIST,
|
||||
|
||||
|
||||
AS_GET_PIXEL_CLOCK_LIMITS,
|
||||
AS_GET_TIMING_CONSTRAINTS,
|
||||
|
||||
AS_SCREEN_GET_COLORMAP,
|
||||
AS_GET_DESKTOP_COLOR,
|
||||
AS_SET_DESKTOP_COLOR,
|
||||
AS_GET_SCREEN_ID_FROM_WINDOW,
|
||||
|
||||
AS_READ_BITMAP,
|
||||
|
||||
|
||||
AS_GET_RETRACE_SEMAPHORE,
|
||||
AS_GET_ACCELERANT_INFO,
|
||||
|
||||
AS_SET_DPMS,
|
||||
AS_GET_DPMS_STATE,
|
||||
AS_GET_DPMS_CAPABILITIES,
|
||||
|
||||
|
||||
// Global function call defs
|
||||
AS_SET_UI_COLORS,
|
||||
AS_GET_UI_COLORS,
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "AppMisc.h"
|
||||
#include "AppServerLink.h"
|
||||
#include "PrivateScreen.h"
|
||||
#include "ServerProtocol.h"
|
||||
@@ -47,8 +48,19 @@ using namespace BPrivate;
|
||||
BPrivateScreen *
|
||||
BPrivateScreen::CheckOut(BWindow *window)
|
||||
{
|
||||
// TODO: get screen ID from window!
|
||||
return CheckOut(B_MAIN_SCREEN_ID);
|
||||
screen_id id = B_MAIN_SCREEN_ID;
|
||||
|
||||
if (window != NULL) {
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_GET_SCREEN_ID_FROM_WINDOW);
|
||||
link.Attach<int32>(_get_object_token_(window));
|
||||
|
||||
status_t status;
|
||||
if (link.FlushWithReply(status) == B_OK && status == B_OK)
|
||||
link.Read<screen_id>(&id);
|
||||
}
|
||||
|
||||
return CheckOut(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ ServerApp::~ServerApp(void)
|
||||
// quit all server windows
|
||||
|
||||
for (int32 i = fWindowList.CountItems(); i-- > 0;) {
|
||||
ServerWindow* window = (ServerWindow*)fWindowList.ItemAt(i);
|
||||
ServerWindow* window = fWindowList.ItemAt(i);
|
||||
window->Quit();
|
||||
}
|
||||
int32 tries = fWindowList.CountItems() + 1;
|
||||
@@ -177,7 +177,7 @@ ServerApp::~ServerApp(void)
|
||||
fWindowListLock.Lock();
|
||||
|
||||
for (int32 i = 0; i < fWindowList.CountItems(); i++) {
|
||||
ServerWindow* window = (ServerWindow*)fWindowList.ItemAt(i);
|
||||
ServerWindow* window = fWindowList.ItemAt(i);
|
||||
printf("kill window \"%s\"\n", window->Title());
|
||||
|
||||
kill_thread(window->Thread());
|
||||
@@ -650,7 +650,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
STRACE(("ServerApp %s: Received decorator update notification\n", Signature()));
|
||||
|
||||
for (int32 i = 0; i < fWindowList.CountItems(); i++) {
|
||||
ServerWindow *window = (ServerWindow*)fWindowList.ItemAt(i);
|
||||
ServerWindow *window = fWindowList.ItemAt(i);
|
||||
window->Lock();
|
||||
const_cast<WinBorder *>(window->GetWinBorder())->UpdateDecorator();
|
||||
window->Unlock();
|
||||
@@ -1968,7 +1968,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
}
|
||||
}
|
||||
|
||||
for (int32 i=0; i<numStrings; i++)
|
||||
for (int32 i = 0; i < numStrings; i++)
|
||||
free(stringArray[i]);
|
||||
|
||||
if (!success)
|
||||
@@ -1980,6 +1980,37 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
|
||||
/* screen commands */
|
||||
|
||||
case AS_GET_SCREEN_ID_FROM_WINDOW:
|
||||
{
|
||||
status_t status = B_ENTRY_NOT_FOUND;
|
||||
|
||||
// Attached data
|
||||
// 1) int32 - window client token
|
||||
int32 clientToken;
|
||||
if (link.Read<int32>(&clientToken) != B_OK)
|
||||
status = B_BAD_DATA;
|
||||
else {
|
||||
BAutolock locker(fWindowListLock);
|
||||
|
||||
for (int32 i = fWindowList.CountItems(); i-- > 0;) {
|
||||
ServerWindow* window = fWindowList.ItemAt(i);
|
||||
|
||||
if (window->ClientToken() == clientToken) {
|
||||
// got it!
|
||||
fLink.StartMessage(B_OK);
|
||||
fLink.Attach<screen_id>(B_MAIN_SCREEN_ID);
|
||||
// TODO: for now...
|
||||
status = B_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (status != B_OK)
|
||||
fLink.StartMessage(status);
|
||||
fLink.Flush();
|
||||
break;
|
||||
}
|
||||
|
||||
case AS_SCREEN_GET_MODE:
|
||||
{
|
||||
STRACE(("ServerApp %s: AS_SCREEN_GET_MODE\n", Signature()));
|
||||
|
||||
@@ -17,17 +17,19 @@
|
||||
#include "SubWindowList.h"
|
||||
#include "BGet++.h"
|
||||
|
||||
#include <ObjectList.h>
|
||||
#include <String.h>
|
||||
|
||||
|
||||
class AreaPool;
|
||||
class BMessage;
|
||||
class BList;
|
||||
class Desktop;
|
||||
class DrawingEngine;
|
||||
class ServerPicture;
|
||||
class ServerCursor;
|
||||
class ServerBitmap;
|
||||
class Desktop;
|
||||
class ServerWindow;
|
||||
|
||||
namespace BPrivate {
|
||||
class PortLink;
|
||||
@@ -93,7 +95,7 @@ class ServerApp : public MessageLooper {
|
||||
team_id fClientTeam;
|
||||
|
||||
BLocker fWindowListLock;
|
||||
BList fWindowList;
|
||||
BObjectList<ServerWindow> fWindowList;
|
||||
|
||||
// TODO:
|
||||
// - Are really Bitmaps and Pictures stored per application and not globally ?
|
||||
|
||||
@@ -131,7 +131,7 @@ struct dw_sync_data {
|
||||
monitor thread.
|
||||
*/
|
||||
ServerWindow::ServerWindow(const char *title, ServerApp *app,
|
||||
port_id clientPort, port_id looperPort, int32 handlerID)
|
||||
port_id clientPort, port_id looperPort, int32 clientToken)
|
||||
: MessageLooper(title && *title ? title : "Unnamed Window"),
|
||||
fTitle(NULL),
|
||||
fDesktop(app->GetDesktop()),
|
||||
@@ -142,7 +142,7 @@ ServerWindow::ServerWindow(const char *title, ServerApp *app,
|
||||
fClientReplyPort(clientPort),
|
||||
fClientLooperPort(looperPort),
|
||||
fClientViewsWithInvalidCoords(B_VIEW_RESIZED),
|
||||
fHandlerToken(handlerID),
|
||||
fClientToken(clientToken),
|
||||
fCurrentLayer(NULL),
|
||||
fDirectWindowData(NULL)
|
||||
{
|
||||
@@ -208,7 +208,7 @@ ServerWindow::Run()
|
||||
// Send a reply to our window - it is expecting fMessagePort
|
||||
// port and some other info
|
||||
|
||||
fLink.StartMessage(SERVER_TRUE);
|
||||
fLink.StartMessage(B_OK);
|
||||
fLink.Attach<port_id>(fMessagePort);
|
||||
|
||||
float minWidth, maxWidth, minHeight, maxHeight;
|
||||
|
||||
@@ -50,7 +50,7 @@ class ServerWindow : public MessageLooper {
|
||||
public:
|
||||
ServerWindow(const char *title, ServerApp *app,
|
||||
port_id clientPort, port_id looperPort,
|
||||
int32 handlerID);
|
||||
int32 clientToken);
|
||||
virtual ~ServerWindow();
|
||||
|
||||
status_t Init(BRect frame, uint32 look,
|
||||
@@ -97,8 +97,7 @@ public:
|
||||
|
||||
void HandleDirectConnection(int bufferState = -1, int driverState = -1);
|
||||
|
||||
// server "private" - try not to use.
|
||||
inline int32 ClientToken() const { return fHandlerToken; }
|
||||
inline int32 ClientToken() const { return fClientToken; }
|
||||
inline int32 ServerToken() const { return fServerToken; }
|
||||
|
||||
void GetInfo(window_info& info);
|
||||
@@ -143,7 +142,7 @@ private:
|
||||
BMessage fClientViewsWithInvalidCoords;
|
||||
|
||||
int32 fServerToken;
|
||||
int32 fHandlerToken;
|
||||
int32 fClientToken;
|
||||
|
||||
Layer* fCurrentLayer;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user