From 10c5dab8076ea7b99a1afb13b46582167eba7a31 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Sat, 18 Jun 2005 06:36:23 +0000 Subject: [PATCH] Added client side support for BScreen::RetraceSemaphore() and BScreen::GetModeList(). Server side support isn't yet there, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13207 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/app/ServerProtocol.h | 4 +++ src/kits/interface/PrivateScreen.cpp | 38 ++++++++++++++++++++-------- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/headers/private/app/ServerProtocol.h b/headers/private/app/ServerProtocol.h index 810d7f6e0d..907691c4ed 100644 --- a/headers/private/app/ServerProtocol.h +++ b/headers/private/app/ServerProtocol.h @@ -130,11 +130,15 @@ enum { // Screen methods AS_SCREEN_GET_MODE, AS_SCREEN_SET_MODE, + AS_GET_MODE_LIST, + AS_SCREEN_GET_COLORMAP, AS_GET_DESKTOP_COLOR, AS_SET_DESKTOP_COLOR, + AS_GET_RETRACE_SEMAPHORE, + // Global function call defs AS_SET_UI_COLORS, AS_GET_UI_COLORS, diff --git a/src/kits/interface/PrivateScreen.cpp b/src/kits/interface/PrivateScreen.cpp index 6a0e5ee0ea..d8ca367f40 100644 --- a/src/kits/interface/PrivateScreen.cpp +++ b/src/kits/interface/PrivateScreen.cpp @@ -141,7 +141,7 @@ BPrivateScreen::WaitForRetrace(bigtime_t timeout) // Get the retrace semaphore if it's the first time // we are called. Cache the value then. status_t status; - if (fRetraceSem == -1) + if (fRetraceSem < 0) fRetraceSem = RetraceSemaphore(); do { @@ -156,15 +156,15 @@ sem_id BPrivateScreen::RetraceSemaphore() { sem_id id = B_BAD_SEM_ID; - // TODO: Implement - /* + BPrivate::AppServerLink link; - PortMessage reply; - link.SetOpCode(AS_GET_RETRACE_SEMAPHORE); + link.StartMessage(AS_GET_RETRACE_SEMAPHORE); link.Attach(ID()); - link.FlushWithReply(&reply); - reply.Read(&id); - */ + int32 reply; + if (link.FlushWithReply(reply) == B_OK + && reply == SERVER_TRUE) + link.Read(&id); + return id; } @@ -269,10 +269,26 @@ BPrivateScreen::ProposeMode(display_mode *target, const display_mode *low, const status_t -BPrivateScreen::GetModeList(display_mode **mode_list, uint32 *count) +BPrivateScreen::GetModeList(display_mode **modeList, uint32 *count) { - // TODO: Implement - return B_ERROR; + if (modeList == NULL || count == NULL) + return B_BAD_VALUE; + + status_t status = B_ERROR; + BPrivate::AppServerLink link; + link.StartMessage(AS_GET_MODE_LIST); + link.Attach(ID()); + int32 reply; + if (link.FlushWithReply(reply) == B_OK && reply == SERVER_TRUE) { + link.Read(count); + int32 size = *count * sizeof(display_mode); + *modeList = (display_mode *)malloc(size); + link.Read(*modeList, size); + // TODO: get status from app_server + status = B_OK; + } + + return status; }