diff --git a/src/servers/app/server/AppServer.cpp b/src/servers/app/server/AppServer.cpp index efde0a1fa1..b720021026 100644 --- a/src/servers/app/server/AppServer.cpp +++ b/src/servers/app/server/AppServer.cpp @@ -45,6 +45,7 @@ AppServer *app_server=NULL; //! Default background color for workspaces RGBColor workspace_default_color(51,102,160); + /*! \brief Constructor @@ -96,8 +97,7 @@ AppServer::AppServer(void) // TODO: fix the cursor display extern int8 default_cursor_data[]; ServerCursor *sc=new ServerCursor(default_cursor_data); -// extern int8 cross_cursor[]; -// ServerCursor *sc=new ServerCursor(cross_cursor); + cursormanager->AddCursor(sc); cursormanager->ChangeCursor(B_CURSOR_DEFAULT, sc->ID()); cursormanager->SetCursor(B_CURSOR_DEFAULT); diff --git a/src/servers/app/server/DesktopClasses.cpp b/src/servers/app/server/DesktopClasses.cpp index 8b2a0b571d..ec5cf38877 100644 --- a/src/servers/app/server/DesktopClasses.cpp +++ b/src/servers/app/server/DesktopClasses.cpp @@ -26,9 +26,11 @@ // //------------------------------------------------------------------------------ #include "DesktopClasses.h" +#include "TokenHandler.h" // Defined and initialized in AppServer.cpp extern RGBColor workspace_default_color; +TokenHandler screen_id_handler; /*! \brief Sets up internal variables needed by the Workspace @@ -116,6 +118,16 @@ void Workspace::GetData(graphics_card_info *gcinfo, frame_buffer_info *fbinfo) *fbinfo=_fbinfo; } +/*! + + \brief Changes the size and mode of the workspace + \param res The new resolution mode of the workspace +*/ +void Workspace::SetSpace(int32 res) +{ + // TODO: Implement +} + /*! \brief Sets up internal variables needed by Screen \param gfxmodule Pointer to the uninitialized display driver to use @@ -132,6 +144,7 @@ Screen::Screen(DisplayDriver *gfxmodule, uint8 workspaces) _workspacecount=0; _init=false; _active=false; + _id=screen_id_handler.GetToken(); if (_driver) { @@ -143,8 +156,13 @@ Screen::Screen(DisplayDriver *gfxmodule, uint8 workspaces) _fbinfo.height=_driver->GetHeight(); _fbinfo.display_width=_driver->GetWidth(); _fbinfo.display_height=_driver->GetHeight(); - _fbinfo.display_x=_driver->GetWidth();; + _fbinfo.display_x=_driver->GetWidth(); _fbinfo.display_y=_driver->GetHeight(); + + _gcinfo.width=_driver->GetWidth(); + _gcinfo.height=_driver->GetHeight(); + _gcinfo.bytes_per_row=_driver->GetBytesPerRow(); + _gcinfo.bits_per_pixel=_driver->GetDepth(); // right now, we won't do anything with the gcinfo structure. ** LAZY PROGRAMMER ALERT ** :P @@ -285,6 +303,18 @@ DisplayDriver *Screen::GetGfxDriver(void) */ status_t Screen::SetSpace(int32 index, int32 res,bool stick) { + // the specified workspace isn't active, so this should be easy... + Workspace *wkspc=(Workspace*)_workspacelist->ItemAt(index); + if(!wkspc) + return B_ERROR; + wkspc->SetSpace(res); + + if(index==_currentworkspace) + { + // change the statistics of the current workspace + if(_driver) + _driver->SetMode(res); + } return B_OK; } @@ -299,6 +329,7 @@ status_t Screen::SetSpace(int32 index, int32 res,bool stick) */ void Screen::AddWindow(ServerWindow *win, int32 workspace) { + //TODO: Implement if(!win) return; } @@ -312,6 +343,7 @@ void Screen::AddWindow(ServerWindow *win, int32 workspace) */ void Screen::RemoveWindow(ServerWindow *win) { + //TODO: Implement if(!win) return; } @@ -335,7 +367,7 @@ ServerWindow *Screen::ActiveWindow(void) */ void Screen::SetActiveWindow(ServerWindow *win) { - + //TODO: Implement } /*! diff --git a/src/servers/app/server/DesktopClasses.h b/src/servers/app/server/DesktopClasses.h index 31f3d1af71..e62e19f7a9 100644 --- a/src/servers/app/server/DesktopClasses.h +++ b/src/servers/app/server/DesktopClasses.h @@ -54,7 +54,7 @@ public: RootLayer *GetRoot(void); void SetData(const graphics_card_info &gcinfo, const frame_buffer_info &fbinfo); void GetData(graphics_card_info *gcinfo, frame_buffer_info *fbinfo); - + void SetSpace(int32 res); protected: RootLayer *_rootlayer; graphics_card_info _gcinfo; @@ -89,7 +89,8 @@ public: Layer *GetRootLayer(int32 workspace=B_CURRENT_WORKSPACE); bool IsInitialized(void); Workspace *GetActiveWorkspace(void); - + //! Returns the unique identifier for the screen + int32 GetID(void) { return _id; } protected: int32 _resolution; ServerWindow *_activewin; @@ -101,6 +102,7 @@ protected: Workspace *_activeworkspace; graphics_card_info _gcinfo; frame_buffer_info _fbinfo; + int32 _id; }; #endif diff --git a/src/servers/app/server/ScreenDriver.cpp b/src/servers/app/server/ScreenDriver.cpp index 2842ec309c..573e583f1c 100644 --- a/src/servers/app/server/ScreenDriver.cpp +++ b/src/servers/app/server/ScreenDriver.cpp @@ -183,166 +183,7 @@ void FrameBuffer::MessageReceived(BMessage *msg) write_port(serverport,B_QUIT_REQUESTED,NULL,0); break; } -/* -#ifdef ENABLE_INPUT_SERVER_EMULATION - case 0x57: // up arrow - { - // Attach data: - // 1) int64 - time of mouse click - // 2) float - x coordinate of mouse click - // 3) float - y coordinate of mouse click - // 4) int32 - modifier keys down - // 5) int32 - buttons down - // 6) int32 - clicks - - - if(mousepos.y<=0) - { - mousepos.y=0; - break; - } - - uint32 clicks=1; // can't get the # of clicks without a *lot* of extra work :( - int64 time=(int64)real_time_clock(); - - if(modifiers & B_SHIFT_KEY) - mousepos.y--; - else - { - mousepos.y-=10; - if(mousepos.y<0) - mousepos.y=0; - } - - serverlink->SetOpCode(B_MOUSE_MOVED); - serverlink->Attach(&time, sizeof(int64)); - serverlink->Attach(&mousepos.x,sizeof(float)); - serverlink->Attach(&mousepos.y,sizeof(float)); - serverlink->Attach(&servermods, sizeof(int32)); - serverlink->Attach(&buttons, sizeof(uint32)); - serverlink->Attach(&clicks, sizeof(uint32)); - serverlink->Flush(); - break; - } - case 0x62: // down arrow - { - // Attach data: - // 1) int64 - time of mouse click - // 2) float - x coordinate of mouse click - // 3) float - y coordinate of mouse click - // 4) int32 - modifier keys down - // 5) int32 - buttons down - // 6) int32 - clicks - - - if(mousepos.y>= (gcinfo.height-1)) - { - mousepos.y=gcinfo.height-1; - break; - } - - uint32 clicks=1; // can't get the # of clicks without a *lot* of extra work :( - int64 time=(int64)real_time_clock(); - - if(modifiers & B_SHIFT_KEY) - mousepos.y++; - else - { - mousepos.y+=10; - if(mousepos.y>gcinfo.height-1) - mousepos.y=gcinfo.height-1; - } - - serverlink->SetOpCode(B_MOUSE_MOVED); - serverlink->Attach(&time, sizeof(int64)); - serverlink->Attach(&mousepos.x,sizeof(float)); - serverlink->Attach(&mousepos.y,sizeof(float)); - serverlink->Attach(&servermods, sizeof(int32)); - serverlink->Attach(&buttons, sizeof(uint32)); - serverlink->Attach(&clicks, sizeof(uint32)); - serverlink->Flush(); - break; - } - case 0x61: // left arrow - { - // Attach data: - // 1) int64 - time of mouse click - // 2) float - x coordinate of mouse click - // 3) float - y coordinate of mouse click - // 4) int32 - modifier keys down - // 5) int32 - buttons down - // 6) int32 - clicks - - - if(mousepos.x<=0) - { - mousepos.x=0; - break; - } - - uint32 clicks=1; // can't get the # of clicks without a *lot* of extra work :( - int64 time=(int64)real_time_clock(); - - if(modifiers & B_SHIFT_KEY) - mousepos.x--; - else - { - mousepos.x-=10; - if(mousepos.x<0) - mousepos.x=0; - } - - serverlink->SetOpCode(B_MOUSE_MOVED); - serverlink->Attach(&time, sizeof(int64)); - serverlink->Attach(&mousepos.x,sizeof(float)); - serverlink->Attach(&mousepos.y,sizeof(float)); - serverlink->Attach(&servermods, sizeof(int32)); - serverlink->Attach(&buttons, sizeof(uint32)); - serverlink->Attach(&clicks, sizeof(uint32)); - serverlink->Flush(); - break; - } - case 0x63: // right arrow - { - // Attach data: - // 1) int64 - time of mouse click - // 2) float - x coordinate of mouse click - // 3) float - y coordinate of mouse click - // 4) int32 - modifier keys down - // 5) int32 - buttons down - // 6) int32 - clicks - - - if(mousepos.x>= (gcinfo.width-1)) - { - mousepos.x=gcinfo.width-1; - break; - } - - uint32 clicks=1; // can't get the # of clicks without a *lot* of extra work :( - int64 time=(int64)real_time_clock(); - - if(modifiers & B_SHIFT_KEY) - mousepos.x++; - else - { - mousepos.x+=10; - if(mousepos.x>gcinfo.width-1) - mousepos.x=gcinfo.width-1; - } - - serverlink->SetOpCode(B_MOUSE_MOVED); - serverlink->Attach(&time, sizeof(int64)); - serverlink->Attach(&mousepos.x,sizeof(float)); - serverlink->Attach(&mousepos.y,sizeof(float)); - serverlink->Attach(&servermods, sizeof(int32)); - serverlink->Attach(&buttons, sizeof(uint32)); - serverlink->Attach(&clicks, sizeof(uint32)); - serverlink->Flush(); - break; - } -#endif // end server emu code -*/ default: + default: break; } } @@ -362,74 +203,7 @@ void FrameBuffer::MessageReceived(BMessage *msg) break; } #endif - -/* case B_MODIFIERS_CHANGED: - { - int32 modifiers; - if(msg->FindInt32("modifiers",&modifiers)==B_OK) - { - -#ifdef ENABLE_INPUT_SERVER_EMULATION - - uint32 clicks=1; // can't get the # of clicks without a *lot* of extra work :( - int64 time=(int64)real_time_clock(); - - // we need to be able to shift click & such, so we will construct - // a new modifiers value which excludes our mouse click keys - int32 servermods=0; - servermods|=modifiers & B_RIGHT_COMMAND_KEY; - servermods|=modifiers & B_RIGHT_OPTION_KEY; - servermods|=modifiers & B_RIGHT_CONTROL_KEY; - servermods|=modifiers & B_SHIFT_KEY; - - if(modifiers & B_LEFT_OPTION_KEY) - { - buttons=B_PRIMARY_MOUSE_BUTTON; - - serverlink->SetOpCode(B_MOUSE_DOWN); - serverlink->Attach(&time, sizeof(int64)); - serverlink->Attach(&mousepos.x,sizeof(float)); - serverlink->Attach(&mousepos.y,sizeof(float)); - serverlink->Attach(&servermods, sizeof(uint32)); - serverlink->Attach(&buttons, sizeof(uint32)); - serverlink->Attach(&clicks, sizeof(uint32)); - serverlink->Flush(); - } - else - if(modifiers & B_LEFT_CONTROL_KEY) - { - buttons=B_SECONDARY_MOUSE_BUTTON; - - serverlink->SetOpCode(B_MOUSE_DOWN); - serverlink->Attach(&time, sizeof(int64)); - serverlink->Attach(&mousepos.x,sizeof(float)); - serverlink->Attach(&mousepos.y,sizeof(float)); - serverlink->Attach(&servermods, sizeof(uint32)); - serverlink->Attach(&buttons, sizeof(uint32)); - serverlink->Attach(&clicks, sizeof(uint32)); - serverlink->Flush(); - } - else - { - // well, we got this far so none of the buttons - // are down. set our mouse buttons to up and if this - // is a change, send a B_MOUSE_UP message - if(buttons>0) - { - serverlink->SetOpCode(B_MOUSE_UP); - serverlink->Attach(&time, sizeof(int64)); - serverlink->Attach(&mousepos.x,sizeof(float)); - serverlink->Attach(&mousepos.y,sizeof(float)); - serverlink->Attach(&servermods, sizeof(uint32)); - serverlink->Flush(); - } - buttons=0; - } -#endif // end server emu code - } - break; - } -*/ default: + default: BWindowScreen::MessageReceived(msg); } } diff --git a/src/servers/app/server/ScreenDriver.h b/src/servers/app/server/ScreenDriver.h index fca8153c1b..49959e79ca 100644 --- a/src/servers/app/server/ScreenDriver.h +++ b/src/servers/app/server/ScreenDriver.h @@ -92,7 +92,9 @@ public: bool IsConnected(void) const { return is_connected; } bool QuitRequested(void); static int32 MouseMonitor(void *data); + graphics_card_info gcinfo; + protected: friend ScreenDriver; diff --git a/src/servers/app/server/ServerApp.cpp b/src/servers/app/server/ServerApp.cpp index 9bb328eb3c..c1db9e866c 100644 --- a/src/servers/app/server/ServerApp.cpp +++ b/src/servers/app/server/ServerApp.cpp @@ -81,6 +81,7 @@ ServerApp::ServerApp(port_id sendport, port_id rcvport, char *signature) _lock=create_sem(1,"ServerApp sem"); _driver=GetGfxDriver(); + _cursorhidden=false; } //! Does all necessary teardown for application @@ -386,11 +387,13 @@ void ServerApp::DispatchMessage(int32 code, int8 *buffer) case SHOW_CURSOR: { cursormanager->ShowCursor(); + _cursorhidden=false; break; } case HIDE_CURSOR: { cursormanager->HideCursor(); + _cursorhidden=true; break; } case OBSCURE_CURSOR: @@ -398,7 +401,16 @@ void ServerApp::DispatchMessage(int32 code, int8 *buffer) cursormanager->ObscureCursor(); break; } - + case QUERY_CURSOR_HIDDEN: + { + // Attached data + // 1) int32 port to reply to + if(_cursorhidden) + write_port(*((port_id*)index),SERVER_TRUE,NULL,0); + else + write_port(*((port_id*)index),SERVER_FALSE,NULL,0); + break; + } case SET_CURSOR_DATA: { // Attached data: 68 bytes of _appcursor data diff --git a/src/servers/app/server/ServerApp.h b/src/servers/app/server/ServerApp.h index eeca2e1505..2b93200159 100644 --- a/src/servers/app/server/ServerApp.h +++ b/src/servers/app/server/ServerApp.h @@ -82,7 +82,7 @@ protected: DisplayDriver *_driver; ServerCursor *_appcursor; sem_id _lock; - + bool _cursorhidden; bool _isactive; }; diff --git a/src/servers/app/server/ServerConfig.h b/src/servers/app/server/ServerConfig.h index acda939b08..ef5dfd82e3 100644 --- a/src/servers/app/server/ServerConfig.h +++ b/src/servers/app/server/ServerConfig.h @@ -21,7 +21,11 @@ #define HWDRIVER 3 // Display driver to be used by the server. -#define DISPLAYDRIVER VIEWDRIVER +#define DISPLAYDRIVER SCREENDRIVER + +// Uncomment this if the DisplayDriver should only rely on drawing functions implemented +// in software even though hardware-accelerated functions are available +//#define DISABLE_HARDWARE_ACCELERATION // Define this for a quick hack to test some of the drawing functions //#define DISPLAYDRIVER_TEST_HACK @@ -34,12 +38,6 @@ // regular application. When running as the app_server, this is not used. #define SERVER_SIGNATURE "application/x-vnd.obe-OBAppServer" -// Server port names. The input port is the port which is used to receive -// input messages from the Input Server. The other is the "main" port for -// the server and is utilized mostly by BApplication objects. -#define SERVER_PORT_NAME "OBappserver" -#define SERVER_INPUT_PORT "OBinputport" - // Directory for all app_server-related settings. #define SERVER_SETTINGS_DIR "/boot/home/config/settings/app_server/" diff --git a/src/servers/app/server/ServerProtocol.h b/src/servers/app/server/ServerProtocol.h index 151b43be04..69d1eebc7e 100644 --- a/src/servers/app/server/ServerProtocol.h +++ b/src/servers/app/server/ServerProtocol.h @@ -1,6 +1,12 @@ #ifndef _APPSERVER_PROTOCOL_ #define _APPSERVER_PROTOCOL_ +// Server port names. The input port is the port which is used to receive +// input messages from the Input Server. The other is the "main" port for +// the server and is utilized mostly by BApplication objects. +#define SERVER_PORT_NAME "OBappserver" +#define SERVER_INPUT_PORT "OBinputport" + #define CREATE_APP 'drca' #define DELETE_APP 'drda' #define QUIT_APP 'srqa' @@ -33,12 +39,17 @@ #define SET_DECORATOR 'sdec' #define GET_DECORATOR 'gdec' +// Cursor-related communications #define SET_CURSOR_DATA 'sscd' #define SET_CURSOR_BCURSOR 'sscb' #define SET_CURSOR_BBITMAP 'sscB' #define SHOW_CURSOR 'srsc' #define HIDE_CURSOR 'srhc' #define OBSCURE_CURSOR 'sroc' +#define QUERY_CURSOR_HIDDEN 'sqch' + +#define BEGIN_RECT_TRACKING 'sbrt' +#define END_RECT_TRACKING 'sert' #define GFX_COUNT_WORKSPACES 'gcws' #define GFX_SET_WORKSPACE_COUNT 'ggwc' @@ -103,9 +114,6 @@ #define LAYER_INVALIDATE 'lyin' #define LAYER_DRAW 'lydr' -#define BEGIN_RECT_TRACKING 'rtbg' -#define END_RECT_TRACKING 'rten' - #define VIEW_GET_TOKEN 'vgtk' #define VIEW_ADD 'vadd' #define VIEW_REMOVE 'vrem'