Integrated Adi's new desktop code into the server

Implemented a bunch of BScreen-related functions in ViewDriver


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6023 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm
2004-01-11 22:12:55 +00:00
parent 3df88aae3d
commit a0f01f6cba
26 changed files with 3198 additions and 1416 deletions
+7 -6
View File
@@ -123,7 +123,7 @@ AppServer::AppServer(void)
InitDecorators();
// Set up the Desktop
InitDesktop();
desktop=new Desktop();
// Create the cursor manager. Object declared in CursorManager.cpp
cursormanager=new CursorManager();
@@ -142,7 +142,7 @@ AppServer::AppServer(void)
_decor_lock=create_sem(1,"app_server_decor_sem");
// Get the driver first - Poller thread utilizes the thing
_driver=GetGfxDriver(ActiveScreen());
_driver=desktop->GetGfxDriver();
// Spawn our input-polling thread
_poller_id=spawn_thread(PollerThread, "Poller", B_NORMAL_PRIORITY, this);
@@ -183,8 +183,6 @@ AppServer::~AppServer(void)
delete bitmapmanager;
delete cursormanager;
ShutdownDesktop();
// If these threads are still running, kill them - after this, if exit_poller
// is deleted, who knows what will happen... These things will just return an
// error and fail if the threads have already exited.
@@ -194,6 +192,8 @@ AppServer::~AppServer(void)
delete fontserver;
make_decorator=NULL;
delete desktop;
desktop=NULL;
}
/*!
@@ -824,7 +824,7 @@ void AppServer::HandleKeyMessage(int32 code, int8 *buffer)
if(modifiers & B_CONTROL_KEY)
{
STRACE(("Set Workspace %ld\n",scancode-1));
SetWorkspace(scancode-2);
desktop->SetWorkspace(scancode-2);
break;
}
@@ -878,7 +878,7 @@ void AppServer::HandleKeyMessage(int32 code, int8 *buffer)
if(modifiers & (B_LEFT_SHIFT_KEY | B_LEFT_CONTROL_KEY))
{
STRACE(("Set Workspace %ld\n",scancode-1));
SetWorkspace(scancode-2);
desktop->SetWorkspace(scancode-2);
break;
}
}
@@ -1101,6 +1101,7 @@ Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel
\param argv String array of the command-line arguments
\return -1 if the app_server is already running, 0 if everything's OK.
*/
int main( int argc, char** argv )
{
// There can be only one....
+15 -5
View File
@@ -177,31 +177,37 @@ void CursorManager::RemoveAppCursors(const char *signature)
//! Wrapper around the DisplayDriver ShowCursor call
void CursorManager::ShowCursor(void)
{
Lock();
// TODO: Fix
/* Lock();
DisplayDriver *driver=GetGfxDriver(ActiveScreen());
driver->ShowCursor();
Unlock();
*/
}
//! Wrapper around the DisplayDriver HideCursor call
void CursorManager::HideCursor(void)
{
Lock();
// TODO: Fix
/* Lock();
DisplayDriver *driver=GetGfxDriver(ActiveScreen());
driver->HideCursor();
Unlock();
*/
}
//! Wrapper around the DisplayDriver ObscureCursor call
void CursorManager::ObscureCursor(void)
{
Lock();
// TODO: Fix
/* Lock();
DisplayDriver *driver=GetGfxDriver(ActiveScreen());
driver->ObscureCursor();
Unlock();
*/
}
/*!
@@ -210,7 +216,8 @@ void CursorManager::ObscureCursor(void)
*/
void CursorManager::SetCursor(int32 token)
{
Lock();
// TODO: Fix
/* Lock();
ServerCursor *c=_FindCursor(token);
if(c)
{
@@ -219,11 +226,13 @@ void CursorManager::SetCursor(int32 token)
_current_which=B_CURSOR_OTHER;
}
Unlock();
*/
}
void CursorManager::SetCursor(cursor_which which)
{
Lock();
// TODO: Fix
/* Lock();
DisplayDriver *driver=GetGfxDriver(ActiveScreen());
switch(which)
@@ -287,6 +296,7 @@ void CursorManager::SetCursor(cursor_which which)
}
Unlock();
*/
}
/*!
File diff suppressed because it is too large Load Diff
+93 -76
View File
@@ -1,89 +1,106 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: Desktop.h
// Author: DarkWyrm <[email protected]>
// Description: Functions used to work with workspaces and general desktop stuff
//
//------------------------------------------------------------------------------
#ifndef DESKTOP_H_
#define DESKTOP_H_
#ifndef _DESKTOP_H_
#define _DESKTOP_H_
#include <Window.h>
#include <ScrollBar.h>
#include <Locker.h>
#include <List.h>
#include <Menu.h>
#include <GraphicsDefs.h>
#include <InterfaceDefs.h>
//#include "WinBorder.h"
class ServerWindow;
class Screen;
class DisplayDriver;
class RootLayer;
class Screen;
class Layer;
class BMessage;
class PortMessage;
class WinBorder;
void InitDesktop(void);
void ShutdownDesktop(void);
class Desktop
{
public:
// startup methods
Desktop(void);
~Desktop(void);
void Init(void);
void AddWorkspace(int32 index=-1);
void DeleteWorkspace(int32 index);
int32 CountWorkspaces(void);
void SetWorkspaceCount(int32 count);
int32 CurrentWorkspace(void);
void SetWorkspace(int32 workspace);
// 1-BigScreen or n-SmallScreens
void InitMode(void);
// Methods for multiple monitors.
Screen *ScreenAt(int32 index) const;
int32 ScreenCount(void) const;
Screen *ActiveScreen(void) const { return fActiveScreen; }
void SetActiveScreen(int32 index);
void SetActiveRootLayerByIndex(int32 listIndex);
void SetActiveRootLayer(RootLayer* rl);
RootLayer* RootLayerAt(int32 index);
RootLayer* ActiveRootLayer(void) const;
int32 ActiveRootLayerIndex(void) const;
int32 CountRootLayers(void) const;
void SetScreen(screen_id id);
int32 CountScreens(void);
screen_id ActiveScreen(void);
Screen *GetActiveScreen(void);
DisplayDriver *GetGfxDriver(screen_id screen);
status_t SetSpace(int32 index, int32 res, screen_id screen, bool stick=true);
// Stuff for easy access
DisplayDriver *GetGfxDriver(void);
void SetWorkspace(int32 index);
// Methods for layer(WinBorder) manipulation.
void AddWinBorder(WinBorder* winBorder);
void RemoveWinBorder(WinBorder* winBorder);
bool HasWinBorder(WinBorder* winBorder);
void SetFrontWinBorder(WinBorder* winBorder);
void SetFocusWinBorder(WinBorder* winBorder);
WinBorder* FrontWinBorder(void) const;
WinBorder* FocusWinBorder(void) const;
// Input related methods
void MouseEventHandler(PortMessage *msg);
void KeyboardEventHandler(PortMessage *msg);
void SetDragMessage(BMessage* msg);
BMessage* DragMessage(void) const;
// Methods for various desktop stuff handled by the server
void SetScrollBarInfo(const scroll_bar_info &info);
scroll_bar_info ScrollBarInfo(void) const;
void SetMenuInfo(const menu_info &info);
menu_info MenuInfo(void) const;
void UseFFMouse(const bool &useffm);
bool FFMouseInUse(void) const;
void SetFFMouseMode(const mode_mouse &value);
mode_mouse FFMouseMode(void) const;
bool ReadWorkspaceData(void);
void SaveWorkspaceData(void);
// Debugging methods
void PrintToStream(void);
void PrintVisibleInRootLayerNo(int32 no);
// "Private" to app_server :-) - means they should not be used very much
void RemoveSubsetWindow(WinBorder* wb);
void AddWindowToDesktop(ServerWindow *win, int32 workspace, screen_id screen);
void RemoveWindowFromDesktop(ServerWindow *win);
WinBorder* WindowContainsPoint( BPoint pt );
ServerWindow *GetActiveWindow(void);
void SetActiveWindow(ServerWindow *win);
Layer *GetRootLayer(int32 workspace, screen_id screen);
private:
BLocker fLayerLock;
BList fWinBorderList;
BMessage *fDragMessage;
BList fRootLayerList;
RootLayer* fActiveRootLayer;
WinBorder* fFrontWinBorder;
WinBorder* fFocusWinBorder;
BList fScreenList;
scroll_bar_info fScrollBarInfo;
menu_info fMenuInfo;
mode_mouse fMouseMode;
bool fFFMouseMode;
Screen *fActiveScreen;
};
void set_drag_message(int32 size, int8 *flattened);
int8* get_drag_message(int32 *size);
void empty_drag_message(void);
extern Desktop* desktop;
scroll_bar_info GetScrollBarInfo(void);
void SetScrollBarInfo(const scroll_bar_info &info);
menu_info GetMenuInfo(void);
void SetMenuInfo(const menu_info &info);
bool GetFFMouse(void);
void SetFFMouse(const bool &value);
mode_mouse GetFFMouseMode(void);
void SetFFMouseMode(const mode_mouse &value);
void lock_layers(void);
void unlock_layers(void);
void lock_dragdata(void);
void unlock_dragdata(void);
void lock_workspaces(void);
void unlock_workspaces(void);
#endif
#endif // _DESKTOP_H_
+55 -35
View File
@@ -27,6 +27,7 @@
//
//------------------------------------------------------------------------------
#include <Accelerant.h>
#include <stdio.h>
#include "DisplayDriver.h"
#include "LayerData.h"
#include "ServerCursor.h"
@@ -332,11 +333,11 @@ void DisplayDriver::DrawString(const char *string, int32 length, BPoint pt, Laye
{
}
void DisplayDriver::FillArc(const BRect r, float angle, float span, const RGBColor& color)
void DisplayDriver::FillArc(const BRect r, float angle, float span, RGBColor &color)
{
}
void DisplayDriver::FillArc(const BRect r, float angle, float span, const Pattern& pattern, const RGBColor& high_color, const RGBColor& low_color)
void DisplayDriver::FillArc(const BRect r, float angle, float span, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
{
}
@@ -715,11 +716,11 @@ void DisplayDriver::FillArc(const BRect r, float angle, float span, DisplayDrive
Unlock();
}
void DisplayDriver::FillBezier(BPoint *pts, const RGBColor& color)
void DisplayDriver::FillBezier(BPoint *pts, RGBColor &color)
{
}
void DisplayDriver::FillBezier(BPoint *pts, const Pattern& pattern, const RGBColor& high_color, const RGBColor& low_color)
void DisplayDriver::FillBezier(BPoint *pts, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
{
}
@@ -803,11 +804,11 @@ void DisplayDriver::FillBezier(BPoint *pts, DisplayDriver* driver, SetHorizontal
*/
}
void DisplayDriver::FillEllipse(BRect r, const RGBColor& color)
void DisplayDriver::FillEllipse(BRect r, RGBColor &color)
{
}
void DisplayDriver::FillEllipse(BRect r, const Pattern& pattern, const RGBColor& high_color, const RGBColor& low_color)
void DisplayDriver::FillEllipse(BRect r, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
{
}
@@ -877,11 +878,11 @@ void DisplayDriver::FillEllipse(BRect r, DisplayDriver* driver, SetHorizontalLin
Unlock();
}
void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const RGBColor& color)
void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, RGBColor &color)
{
}
void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const Pattern& pattern, const RGBColor& high_color, const RGBColor& low_color)
void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
{
}
@@ -1018,7 +1019,7 @@ void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, DisplayDriver* dri
\param r BRect to be filled. Guaranteed to be in the frame buffer's coordinate space
\param color The color used to fill the rectangle
*/
void DisplayDriver::FillRect(const BRect r, const RGBColor& color)
void DisplayDriver::FillRect(const BRect r, RGBColor &color)
{
}
@@ -1029,7 +1030,7 @@ void DisplayDriver::FillRect(const BRect r, const RGBColor& color)
\param high_color The high color of the pattern
\param low_color The low color of the pattern
*/
void DisplayDriver::FillRect(const BRect r, const Pattern& pattern, const RGBColor& high_color, const RGBColor& low_color)
void DisplayDriver::FillRect(const BRect r, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
{
}
@@ -1038,7 +1039,7 @@ void DisplayDriver::FillRect(const BRect r, const Pattern& pattern, const RGBCol
\param r BRegion to be filled
\param color The color used to fill the region
*/
void DisplayDriver::FillRegion(BRegion& r, const RGBColor& color)
void DisplayDriver::FillRegion(BRegion& r, RGBColor &color)
{
Lock();
@@ -1055,7 +1056,7 @@ void DisplayDriver::FillRegion(BRegion& r, const RGBColor& color)
\param high_color The high color of the pattern
\param low_color The low color of the pattern
*/
void DisplayDriver::FillRegion(BRegion& r, const Pattern& pattern, const RGBColor& high_color, const RGBColor& low_color)
void DisplayDriver::FillRegion(BRegion& r, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
{
Lock();
@@ -1065,11 +1066,11 @@ void DisplayDriver::FillRegion(BRegion& r, const Pattern& pattern, const RGBColo
Unlock();
}
void DisplayDriver::FillRoundRect(BRect r, float xrad, float yrad, const RGBColor& color)
void DisplayDriver::FillRoundRect(BRect r, float xrad, float yrad, RGBColor &color)
{
}
void DisplayDriver::FillRoundRect(BRect r, float xrad, float yrad, const Pattern& pattern, const RGBColor& high_color, const RGBColor& low_color)
void DisplayDriver::FillRoundRect(BRect r, float xrad, float yrad, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
{
}
@@ -1102,11 +1103,11 @@ void DisplayDriver::FillRoundRect(BRect r, float xrad, float yrad, DisplayDriver
//{
//}
void DisplayDriver::FillTriangle(BPoint *pts, const RGBColor& color)
void DisplayDriver::FillTriangle(BPoint *pts, RGBColor &color)
{
}
void DisplayDriver::FillTriangle(BPoint *pts, const Pattern& pattern, const RGBColor& high_color, const RGBColor& low_color)
void DisplayDriver::FillTriangle(BPoint *pts, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
{
}
@@ -1306,11 +1307,11 @@ void DisplayDriver::SetCursor(ServerCursor *cursor)
Unlock();
}
void DisplayDriver::StrokeArc(BRect r, float angle, float span, float pensize, const RGBColor& color)
void DisplayDriver::StrokeArc(BRect r, float angle, float span, float pensize, RGBColor &color)
{
}
void DisplayDriver::StrokeArc(BRect r, float angle, float span, float pensize, const Pattern& pattern, const RGBColor& high_color, const RGBColor& low_color)
void DisplayDriver::StrokeArc(BRect r, float angle, float span, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
{
}
@@ -1472,11 +1473,11 @@ void DisplayDriver::StrokeArc(BRect r, float angle, float span, DisplayDriver* d
}
void DisplayDriver::StrokeBezier(BPoint *pts, float pensize, const RGBColor& color)
void DisplayDriver::StrokeBezier(BPoint *pts, float pensize, RGBColor &color)
{
}
void DisplayDriver::StrokeBezier(BPoint *pts, float pensize, const Pattern& pattern, const RGBColor& high_color, const RGBColor& low_color)
void DisplayDriver::StrokeBezier(BPoint *pts, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
{
}
@@ -1539,11 +1540,11 @@ void DisplayDriver::StrokeBezier(BPoint *pts, DisplayDriver* driver, SetPixelFun
}
}
void DisplayDriver::StrokeEllipse(BRect r, float pensize, const RGBColor& color)
void DisplayDriver::StrokeEllipse(BRect r, float pensize, RGBColor &color)
{
}
void DisplayDriver::StrokeEllipse(BRect r, float pensize, const Pattern& pattern, const RGBColor& high_color, const RGBColor& low_color)
void DisplayDriver::StrokeEllipse(BRect r, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
{
}
@@ -1614,11 +1615,11 @@ void DisplayDriver::StrokeEllipse(BRect r, DisplayDriver* driver, SetPixelFuncTy
}
}
void DisplayDriver::StrokeLine(BPoint start, BPoint end, float pensize, const RGBColor& color)
void DisplayDriver::StrokeLine(BPoint start, BPoint end, float pensize, RGBColor &color)
{
}
void DisplayDriver::StrokeLine(BPoint start, BPoint end, float pensize, const Pattern& pattern, const RGBColor& high_color, const RGBColor& low_color)
void DisplayDriver::StrokeLine(BPoint start, BPoint end, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
{
}
@@ -1657,15 +1658,15 @@ void DisplayDriver::StrokeLine(BPoint start, BPoint end, DisplayDriver* driver,
}
}
void DisplayDriver::StrokePoint(BPoint& pt, const RGBColor& color)
void DisplayDriver::StrokePoint(BPoint& pt, RGBColor &color)
{
}
void DisplayDriver::StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, const RGBColor& color, bool is_closed)
void DisplayDriver::StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, RGBColor &color, bool is_closed)
{
}
void DisplayDriver::StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, const Pattern& pattern, const RGBColor& high_color, const RGBColor& low_color, bool is_closed)
void DisplayDriver::StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color, bool is_closed)
{
}
@@ -1689,11 +1690,11 @@ void DisplayDriver::StrokePolygon(BPoint *ptlist, int32 numpts, DisplayDriver* d
\param pensize Thickness of the lines
\param color The color of the rectangle
*/
void DisplayDriver::StrokeRect(BRect r, float pensize, const RGBColor& color)
void DisplayDriver::StrokeRect(BRect r, float pensize, RGBColor &color)
{
}
void DisplayDriver::StrokeRect(BRect r, float pensize, const Pattern& pattern, const RGBColor& high_color, const RGBColor& low_color)
void DisplayDriver::StrokeRect(BRect r, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
{
}
@@ -1712,7 +1713,7 @@ void DisplayDriver::StrokeRect(BRect r, DisplayDriver* driver, SetHorizontalLine
\param pat 8-byte array containing the const Pattern &to use. Always non-NULL.
*/
void DisplayDriver::StrokeRegion(BRegion& r, float pensize, const RGBColor& color)
void DisplayDriver::StrokeRegion(BRegion& r, float pensize, RGBColor &color)
{
Lock();
@@ -1722,7 +1723,7 @@ void DisplayDriver::StrokeRegion(BRegion& r, float pensize, const RGBColor& colo
Unlock();
}
void DisplayDriver::StrokeRegion(BRegion& r, float pensize, const Pattern& pattern, const RGBColor& high_color, const RGBColor& low_color)
void DisplayDriver::StrokeRegion(BRegion& r, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
{
Lock();
@@ -1732,11 +1733,11 @@ void DisplayDriver::StrokeRegion(BRegion& r, float pensize, const Pattern& patte
Unlock();
}
void DisplayDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, const RGBColor& color)
void DisplayDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, RGBColor &color)
{
}
void DisplayDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, const Pattern& pattern, const RGBColor& high_color, const RGBColor& low_color)
void DisplayDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
{
}
@@ -1786,7 +1787,7 @@ void DisplayDriver::StrokeRoundRect(BRect r, float xrad, float yrad, DisplayDriv
\param pensize The line thickness
\param color The color of the lines
*/
void DisplayDriver::StrokeTriangle(BPoint *pts, float pensize, const RGBColor& color)
void DisplayDriver::StrokeTriangle(BPoint *pts, float pensize, RGBColor &color)
{
Lock();
StrokeLine(pts[0],pts[1],pensize,color);
@@ -1795,7 +1796,7 @@ void DisplayDriver::StrokeTriangle(BPoint *pts, float pensize, const RGBColor& c
Unlock();
}
void DisplayDriver::StrokeTriangle(BPoint *pts, float pensize, const Pattern& pattern, const RGBColor& high_color, const RGBColor& low_color)
void DisplayDriver::StrokeTriangle(BPoint *pts, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
{
Lock();
StrokeLine(pts[0],pts[1],pensize,pattern,high_color,low_color);
@@ -1826,6 +1827,25 @@ void DisplayDriver::SetMode(int32 mode)
{
}
/*
\brief Sets the screen mode to specified resolution and color depth.
\param mode Data structure as defined in Screen.h
Subclasses must include calls to _SetDepth, _SetHeight, _SetWidth, and _SetMode
to update the state variables kept internally by the DisplayDriver class.
*/
void DisplayDriver::SetMode(const display_mode &mode)
{
}
/*!
\brief Sets the attributes in mode to reflect the current display mode
\param mode Structure to receive the current display mode's status
*/
void DisplayDriver::GetMode(display_mode *mode)
{
}
/*!
\brief Dumps the contents of the frame buffer to a file.
\param path Path and leaf of the file to be created without an extension
+141
View File
@@ -0,0 +1,141 @@
#include <stdio.h>
#include "FMWList.h"
#include "WinBorder.h"
#include "ServerWindow.h"
FMWList::FMWList()
{
}
FMWList::~FMWList()
{
//printf("~FMWList()\n");
// if (fList.CountItems() > 0)
// printf("SERVER: WARNING: FMWList NOT empty in destructor!\n");
}
void FMWList::AddItem(void* item)
{
int32 feelItem = ((WinBorder*)item)->Window()->GetFeel();
int32 feelTemp = 0;
int32 location = 0;
for(int32 i=0; i<fList.CountItems(); i++)
{
location = i + 1;
feelTemp = ((WinBorder*)fList.ItemAt(i))->Window()->GetFeel();
// in short: if 'item' is a floating window and 'temp' is a modal one, then
// we have found the place for our window('wb')
if( (feelItem == B_FLOATING_SUBSET_WINDOW_FEEL ||
feelItem == B_FLOATING_APP_WINDOW_FEEL ||
feelItem == B_FLOATING_ALL_WINDOW_FEEL)
&&
(feelTemp == B_MODAL_SUBSET_WINDOW_FEEL ||
feelTemp == B_MODAL_APP_WINDOW_FEEL ||
feelTemp == B_MODAL_ALL_WINDOW_FEEL)
)
{
location--;
break;
}
}
fList.AddItem(item, location);
}
bool FMWList::HasItem(void* item) const
{
return fList.HasItem(item);
}
bool FMWList::RemoveItem(void* item)
{
return fList.RemoveItem(item);
}
void* FMWList::ItemAt(int32 i) const
{
return fList.ItemAt(i);
}
int32 FMWList::CountItems() const
{
return fList.CountItems();
}
void* FMWList::LastItem() const
{
return fList.LastItem();
}
void* FMWList::FirstItem() const
{
return fList.FirstItem();
}
int32 FMWList::IndexOf(void *item)
{
return fList.IndexOf(item);
}
void FMWList::AddFMWList(FMWList *list)
{
int32 i = 0;
for(i=0; i<fList.CountItems(); i++)
{
int32 feel = ((WinBorder*)fList.ItemAt(i))->Window()->GetFeel();
if(feel == B_MODAL_SUBSET_WINDOW_FEEL ||
feel == B_MODAL_APP_WINDOW_FEEL ||
feel == B_MODAL_ALL_WINDOW_FEEL)
{
break;
}
}
int32 j = 0;
for(j=0; j<list->CountItems(); j++)
{
void *item = list->ItemAt(j);
int32 feel = ((WinBorder*)item)->Window()->GetFeel();
if(feel == B_MODAL_SUBSET_WINDOW_FEEL ||
feel == B_MODAL_APP_WINDOW_FEEL ||
feel == B_MODAL_ALL_WINDOW_FEEL)
{
fList.AddItem(item, fList.CountItems());
}
else
{
fList.AddItem(item, i);
i++;
}
}
}
void FMWList::PrintToStream() const
{
printf("Floating and modal windows list:\n");
WinBorder *wb = NULL;
for (int32 i=0; i<fList.CountItems(); i++)
{
wb = (WinBorder*)fList.ItemAt(i);
printf("\t%s", wb->GetName());
if (wb->Window()->GetFeel() == B_FLOATING_SUBSET_WINDOW_FEEL)
printf("\t%s\n", "B_FLOATING_SUBSET_WINDOW_FEEL");
if (wb->Window()->GetFeel() == B_FLOATING_APP_WINDOW_FEEL)
printf("\t%s\n", "B_FLOATING_APP_WINDOW_FEEL");
if (wb->Window()->GetFeel() == B_FLOATING_ALL_WINDOW_FEEL)
printf("\t%s\n", "B_FLOATING_ALL_WINDOW_FEEL");
if (wb->Window()->GetFeel() == B_MODAL_SUBSET_WINDOW_FEEL)
printf("\t%s\n", "B_MODAL_SUBSET_WINDOW_FEEL");
if (wb->Window()->GetFeel() == B_MODAL_APP_WINDOW_FEEL)
printf("\t%s\n", "B_MODAL_APP_WINDOW_FEEL");
if (wb->Window()->GetFeel() == B_MODAL_ALL_WINDOW_FEEL)
printf("\t%s\n", "B_MODAL_ALL_WINDOW_FEEL");
// this should NOT happen
if (wb->Window()->GetFeel() == B_NORMAL_WINDOW_FEEL)
printf("\t%s\n", "B_NORMAL_WINDOW_FEEL");
}
}
+29
View File
@@ -0,0 +1,29 @@
#ifndef _FMWLIST_H_
#define _FMWLIST_H_
#include <List.h>
#include <Window.h>
class FMWList{
public:
FMWList();
virtual ~FMWList();
void AddItem(void* item);
bool HasItem(void* item) const;
bool RemoveItem(void* item);
void* ItemAt(int32 i) const;
int32 CountItems() const;
void* LastItem() const;
void* FirstItem() const;
int32 IndexOf(void *item);
// special
void AddFMWList(FMWList *list);
// debugging methods
void PrintToStream() const;
private:
BList fList;
};
#endif
+14
View File
@@ -0,0 +1,14 @@
#ifndef _GLOBALS_H_
#define _GLOBALS_H_
#define B_SYSTEM_LAST 10
#define B_NORMAL_FEEL 11
#define B_FLOATING_SUBSET_FEEL 12
#define B_FLOATING_APP_FEEL 13
#define B_MODAL_SUBSET_FEEL 14
#define B_MODAL_APP_FEEL 15
#define B_FLOATING_ALL_FEEL 16
#define B_MODAL_ALL_FEEL 17
#define B_SYSTEM_FIRST 18
#endif
+5 -2
View File
@@ -36,6 +36,7 @@ Server app_server :
# Misc. Sources
Angle.cpp
CursorData.cpp
FMWList.cpp
PicturePlayer.cpp
PNGDump.cpp
SessionStreamReader.cpp
@@ -55,11 +56,13 @@ Server app_server :
ScreenDriver.cpp
ViewDriver.cpp
DefaultDecorator.cpp
DesktopClasses.cpp
Layer.cpp
RootLayer.cpp
WinBorder.cpp
ServerPicture.cpp
ServerScreen.cpp
WinBorder.cpp
Workspace.cpp
;
LINKFLAGS on app_server ?= $(LINKFLAGS) ;
+49 -9
View File
@@ -39,6 +39,7 @@
#include "ServerCursor.h"
#include "CursorManager.h"
#include "TokenHandler.h"
#include "RectUtils.h"
#include "RootLayer.h"
#include "DisplayDriver.h"
#include "Desktop.h"
@@ -93,8 +94,10 @@ Layer::Layer(BRect frame, const char *name, int32 token, uint32 resize,
_serverwin = win;
_cursor = NULL;
clipToPicture = NULL;
fDriver = GetGfxDriver(ActiveScreen());
//TODO: Fix
// fDriver = GetGfxDriver(ActiveScreen());
}
//! Destructor frees all allocated heap space
@@ -161,6 +164,24 @@ void Layer::AddChild(Layer *layer, Layer *before)
}
}
/*!
\brief Used in the new Desktop Management code
*/
void Layer::AddChild(Layer *layer, RootLayer *rootLayer)
{
// TODO: Document
if (layer->GetRootLayer())
{
printf("Error: Layer already belongs to a RootLayer!\n");
return;
}
layer->fRootLayer = rootLayer;
fLayerList.AddItem(layer);
}
/*!
\brief Removes a layer from the child stack
\param layer The layer to remove
@@ -172,8 +193,10 @@ void Layer::RemoveChild(Layer *layer)
printf("ERROR: RemoveChild(): Layer doesn't have a _parent\n");
return;
}
if( layer->_parent != this ){
printf("ERROR: RemoveChild(): Layer is not a child of this layer\n");
if (!(fLayerList.HasItem(layer)))
{
printf("Error: Layer is not a child of this RootLayer!\n");
return;
}
@@ -213,6 +236,9 @@ void Layer::RemoveChild(Layer *layer)
DoInvalidate( BRegion(invalidRect), cachedUpperSibling );
}
}
fRootLayer = NULL;
fLayerList.RemoveItem(layer);
}
/*!
@@ -229,13 +255,33 @@ void Layer::RemoveSelf()
_parent->RemoveChild(this);
}
/*!
\brief Used in the new Desktop Management code
*/
bool Layer::HasChild(Layer* layer) const
{
return fLayerList.HasItem(layer);
}
/*!
\brief Used in the new Desktop Management code
*/
void Layer::SetRootLayer(RootLayer* rl)
{
fRootLayer = rl;
}
/*!
\brief Finds the first child at a given point.
\param pt Point to look for a child
\param recursive Flag to look for the bottom-most child
\return non-NULL if found, NULL if not
Find out which child gets hit if we click at a certain spot. Returns NULL
if there are no _visible children or if the click does not hit a child layer
If recursive==true, then it will continue to call until it reaches a layer
which has no children, i.e. a layer that is at the top of its 'branch' in
the layer tree
*/
Layer* Layer::GetLayerAt(const BPoint &pt)
{
@@ -1265,9 +1311,3 @@ void Layer::MakeBottomChild(void)
_parent->_bottomchild=this;
}
/*
@log
* added 2 new methods - DoMoveTo and DoResizeTo. They move/resize the frame rectangle of Layer class.
In DoResizeTo() I added some code for autoresizing(based on BView's resizeMask parameter) of children. Still, the effective code for resizing need to be written. :-) I could do that, but other things have greater priority. :-)
*/
+86 -86
View File
@@ -35,7 +35,6 @@
#include <OS.h>
#include <Locker.h>
#include "LayerData.h"
#include "DesktopClasses.h"
#include "TokenHandler.h"
class ServerWindow;
@@ -57,66 +56,69 @@ class DisplayDriver;
class Layer
{
public:
Layer(BRect frame, const char *name, int32 token, uint32 resize,
uint32 flags, ServerWindow *win);
virtual ~Layer(void);
void AddChild(Layer *child, Layer *before=NULL);
void RemoveChild(Layer *child);
void RemoveSelf();
uint32 CountChildren(void) const;
void MakeTopChild(void);
void MakeBottomChild(void);
Layer* FindLayer(const int32 token);
Layer* GetLayerAt(const BPoint &pt);
Layer* GetUpperSibling() const { return _uppersibling; }
Layer* GetLowerSibling() const { return _lowersibling; }
const char* GetName(void) const { return (_name)?_name->String():NULL; }
LayerData* GetLayerData(void) const { return _layerdata; }
Layer(BRect frame, const char *name, int32 token, uint32 resize, uint32 flags, ServerWindow *win);
virtual ~Layer(void);
void SetLayerCursor(ServerCursor *csr);
ServerCursor* GetLayerCursor(void) const;
virtual void MouseTransit(uint32 transit);
void Invalidate(const BRect &rect);
void Invalidate(const BRegion &region);
void DoInvalidate(const BRegion &reg, Layer *start);
virtual void RebuildRegions( const BRect& r );
void RebuildChildRegions( const BRect &r, Layer* startFrom );
void RebuildFullRegion(void);
void MoveRegionsBy(float x, float y);
void ResizeRegionsBy(float x, float y);
void AddChild(Layer *child, Layer *before=NULL);
void AddChild(Layer *layer, RootLayer *rootLayer);
void RemoveChild(Layer *child);
void RemoveSelf();
bool HasChild(Layer* layer) const;
uint32 CountChildren(void) const;
void MakeTopChild(void);
void MakeBottomChild(void);
Layer* FindLayer(const int32 token);
Layer* GetLayerAt(const BPoint &pt);
Layer* GetUpperSibling() const { return _uppersibling; }
Layer* GetLowerSibling() const { return _lowersibling; }
RootLayer *GetRootLayer() const { return fRootLayer; }
void SetRootLayer(RootLayer* rl);
void RequestClientUpdate(const BRect &rect);
void RequestDraw(const BRect &r);
virtual void Draw(const BRect &r);
const char* GetName(void) const { return (_name)?_name->String():NULL; }
LayerData* GetLayerData(void) const { return _layerdata; }
void Show(void);
void Hide(void);
bool IsHidden(void) const;
BRect Bounds(void) const;
BRect Frame(void) const;
virtual void MoveBy(float x, float y);
virtual void ResizeBy(float x, float y);
BRect ConvertToParent(BRect rect);
BRegion ConvertToParent(BRegion *reg);
BRect ConvertFromParent(BRect rect);
BRegion ConvertFromParent(BRegion *reg);
BRegion ConvertToTop(BRegion *reg);
BRect ConvertToTop(BRect rect);
BRegion ConvertFromTop(BRegion *reg);
BRect ConvertFromTop(BRect rect);
void PruneTree(void);
void PrintToStream(void);
void PrintNode(void);
void PrintTree();
void SetLayerCursor(ServerCursor *csr);
ServerCursor *GetLayerCursor(void) const;
virtual void MouseTransit(uint32 transit);
void Invalidate(const BRect &rect);
void Invalidate(const BRegion &region);
void DoInvalidate(const BRegion &reg, Layer *start);
virtual void RebuildRegions( const BRect& r );
void RebuildChildRegions( const BRect &r, Layer* startFrom );
void RebuildFullRegion(void);
void MoveRegionsBy(float x, float y);
void ResizeRegionsBy(float x, float y);
void RequestClientUpdate(const BRect &rect);
void RequestDraw(const BRect &r);
virtual void Draw(const BRect &r);
void Show(void);
void Hide(void);
bool IsHidden(void) const;
BRect Bounds(void) const;
BRect Frame(void) const;
virtual void MoveBy(float x, float y);
virtual void ResizeBy(float x, float y);
BRect ConvertToParent(BRect rect);
BRegion ConvertToParent(BRegion *reg);
BRect ConvertFromParent(BRect rect);
BRegion ConvertFromParent(BRegion *reg);
BRegion ConvertToTop(BRegion *reg);
BRect ConvertToTop(BRect rect);
BRegion ConvertFromTop(BRegion *reg);
BRect ConvertFromTop(BRect rect);
void PruneTree(void);
void PrintToStream(void);
void PrintNode(void);
void PrintTree();
protected:
friend class RootLayer;
@@ -124,37 +126,35 @@ protected:
friend class Screen;
friend class ServerWindow;
BRect _frame;
BPoint _boundsLeftTop;
Layer *_parent,
*_uppersibling,
*_lowersibling,
*_topchild,
*_bottomchild;
BRect _frame;
BPoint _boundsLeftTop;
Layer *_parent,
*_uppersibling,
*_lowersibling,
*_topchild,
*_bottomchild;
BRegion _visible,
_fullVisible,
_full;
BRegion _visible,
_fullVisible,
_full;
BRegion *clipToPicture;
bool clipToPictureInverse;
BRegion *clipToPicture;
bool clipToPictureInverse;
ServerWindow *_serverwin;
BString *_name;
int32 _view_token;
int32 _level;
uint32 _flags;
uint32 _resize_mode;
bool _hidden;
bool _is_updating;
LayerData *_layerdata;
ServerCursor *_cursor;
DisplayDriver *fDriver;
ServerWindow *_serverwin;
BString *_name;
int32 _view_token;
int32 _level;
uint32 _flags;
uint32 _resize_mode;
bool _hidden;
bool _is_updating;
LayerData *_layerdata;
ServerCursor *_cursor;
DisplayDriver* fDriver;
RootLayer* fRootLayer;
BList fLayerList;
};
#endif
/*
@log
* added a new member, BPoint _boundsLeftTop. Beside other uses, (DW don't forget!)it will be needed in redraw code.
* _flags is now declared as uint32
*/
+2 -2
View File
@@ -247,7 +247,7 @@ void RGBColor::SetColor(const RGBColor &col)
\brief Set the object to specified color
\param col color to copy
*/
RGBColor & RGBColor::operator=(const RGBColor &col)
const RGBColor & RGBColor::operator=(const RGBColor &col)
{
color32=col.color32;
color16=col.color16;
@@ -261,7 +261,7 @@ RGBColor & RGBColor::operator=(const RGBColor &col)
\brief Set the object to specified color
\param col color to copy
*/
RGBColor & RGBColor::operator=(const rgb_color &col)
const RGBColor & RGBColor::operator=(const rgb_color &col)
{
color32=col;
update8=update16=true;
+463 -95
View File
@@ -1,112 +1,480 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2003, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: RootLayer.cpp
// Author: Gabe Yoder <[email protected]>
// DarkWyrm <[email protected]>
// Description: Class used for the top layer of each workspace's Layer tree
//
//------------------------------------------------------------------------------
#include <View.h>
#include "DisplayDriver.h"
#include "Layer.h"
#include "RootLayer.h"
#include "Desktop.h"
#include "PatternHandler.h" // for pattern_union
#include "ServerConfig.h"
#include "TokenHandler.h"
#include <TokenSpace.h>
#include <stdio.h>
#include <Window.h>
#include <List.h>
//! TokenHandler object used to provide IDs for RootLayers(WorkSpaces)
TokenHandler rlayer_token_handler;
#include "ServerApp.h"
#include "Globals.h"
#include "RootLayer.h"
#include "Layer.h"
#include "Workspace.h"
#include "ServerScreen.h"
#include "WinBorder.h"
#include "ServerWindow.h"
#include "Desktop.h"
#include "FMWList.h"
//#define DEBUG_ROOTLAYER
/*!
\brief Sets up internal variables needed by the RootLayer
\param rect Frame of the root layer
\param layername Name of the root layer. Not really used.
\param gfxdriver Pointer to the related graphics driver
*/
RootLayer::RootLayer(BRect rect, const char *layername, DisplayDriver *gfxdriver)
: Layer(rect, layername, B_NULL_TOKEN, B_FOLLOW_NONE, 0, NULL)
//---------------------------------------------------------------------------
RootLayer::RootLayer(const char *layername, int32 workspaceCount, Desktop *desktop)
: Layer(BRect(0,0,0,0), layername, 0, B_NORMAL_WINDOW_FEEL, 0, NULL)
{
_view_token = rlayer_token_handler.GetToken();
fDesktop = desktop;
fActiveWorkspace = NULL;
fRows = 0;
fColumns = 0;
// TODO: read these 3 from a configuration file.
fScreenXResolution = 0;
fScreenYResolution = 0;
fColorSpace = B_RGB32;
fDriver = gfxdriver;
_hidden = false;
_view_token = 0; // is this used for WinBorders?
_hidden = false;
SetWorkspaceCount(workspaceCount);
}
//! Frees all allocated heap memory (which happens to be none) ;)
RootLayer::~RootLayer()
{
//---------------------------------------------------------------------------
RootLayer::~RootLayer(){
//printf("~RootLayer( %s )\n", Name());
// RootLayer object just uses Screen objects, it is not allowed to delete them.
}
//---------------------------------------------------------------------------
void RootLayer::Draw(const BRect &r){
/* THIS method is here because of DisplayDriver testing!
* It SHOULD BE REMOVED as soon as testing is done!!!!
*/
/*
#ifdef DISPLAYDRIVER_TEST_HACK
int8 pattern[8];
int8 pattern2[8];
memset(pattern,255,8);
memset(pattern2,128+64+32+16,8);
BRect r1(100,100,1500,1100);
BPoint pts[4];
pts[0].x = 200;
pts[0].y = 200;
pts[1].x = 400;
pts[1].y = 1000;
pts[2].x = 600;
pts[2].y = 400;
pts[3].x = 1200;
pts[3].y = 800;
BPoint triangle[3];
BRect triangleRect(100,100,400,300);
triangle[0].x = 100;
triangle[0].y = 100;
triangle[1].x = 100;
triangle[1].y = 300;
triangle[2].x = 400;
triangle[2].y = 300;
BPoint polygon[6];
BRect polygonRect(100,100,300,400);
polygon[0].x = 100;
polygon[0].y = 100;
polygon[1].x = 100;
polygon[1].y = 400;
polygon[2].x = 200;
polygon[2].y = 300;
polygon[3].x = 300;
polygon[3].y = 400;
polygon[4].x = 300;
polygon[4].y = 100;
polygon[5].x = 200;
polygon[5].y = 200;
/*!
\brief Sets the background color of the Screen
\param col The new background color
_layerdata->highcolor.SetColor(255,0,0,255);
_layerdata->lowcolor.SetColor(255,255,255,255);
_driver->FillRect(r1,_layerdata,pattern);
_layerdata->highcolor.SetColor(255,255,0,255);
_driver->StrokeLine(BPoint(100,100),BPoint(1500,1100),_layerdata,pattern);
_layerdata->highcolor.SetColor(0,0,255,255);
_driver->StrokeBezier(pts,_layerdata,pattern);
_driver->StrokeArc(BRect(200,300,400,600),30,270,_layerdata,pattern);
_driver->StrokeEllipse(BRect(200,700,400,900),_layerdata,pattern);
_driver->StrokeRect(BRect(650,1000,750,1090),_layerdata,pattern);
_driver->StrokeRoundRect(BRect(200,1000,600,1090),30,40,_layerdata,pattern);
// _driver->StrokePolygon(polygon,6,polygonRect,_layerdata,pattern);
// _driver->StrokeTriangle(triangle,triangleRect,_layerdata,pattern);
_layerdata->highcolor.SetColor(255,0,255,255);
_driver->FillArc(BRect(1250,300,1450,600),30,270,_layerdata,pattern);
// _driver->FillBezier(pts,_layerdata,pattern);
_driver->FillEllipse(BRect(800,300,1200,600),_layerdata,pattern);
_driver->FillRoundRect(BRect(800,1000,1200,1090),30,40,_layerdata,pattern2);
_driver->FillPolygon(polygon,6,polygonRect,_layerdata,pattern);
// _driver->FillTriangle(triangle,triangleRect,_layerdata,pattern);
#endif
*/
void RootLayer::SetColor(const RGBColor &col)
{
}
//---------------------------------------------------------------------------
void RootLayer::MoveBy(float x, float y){
}
//---------------------------------------------------------------------------
void RootLayer::ResizeBy(float x, float y){
}
//---------------------------------------------------------------------------
Layer* RootLayer::VirtualTopChild() const{
return fActiveWorkspace->GoToTopItem();
}
//---------------------------------------------------------------------------
Layer* RootLayer::VirtualLowerSibling() const{
return fActiveWorkspace->GoToLowerItem();
}
//---------------------------------------------------------------------------
Layer* RootLayer::VirtualUpperSibling() const{
return fActiveWorkspace->GoToUpperItem();
}
//---------------------------------------------------------------------------
Layer* RootLayer::VirtualBottomChild() const{
return fActiveWorkspace->GoToBottomItem();
}
//---------------------------------------------------------------------------
void RootLayer::AddWinBorderToWorkspaces(WinBorder* winBorder, uint32 wks){
if (wks == B_CURRENT_WORKSPACE){
ActiveWorkspace()->AddLayerPtr(winBorder);
return;
}
for( int32 i=0; i < 32; i++){
if( wks & (0x00000001 << i) && i < WorkspaceCount()){
WorkspaceAt(i+1)->AddLayerPtr(winBorder);
}
}
}
/* The main job, beside adding winBorder as a child, is to determine
* in witch workspaces to add this window.
*/
//---------------------------------------------------------------------------
void RootLayer::AddWinBorder(WinBorder* winBorder){
// add winBorder to the known list of WinBorders so we can keep track of it.
AddChild(winBorder, this);
// add winBorder to the desired workspaces
switch(winBorder->Window()->GetFeel()){
case B_MODAL_SUBSET_WINDOW_FEEL:{
/* this kind of window isn't added anywhere. It *will* be added
to main window's subset when winBorder::AddToSubsetOf(main)
will be called.*/
break;
}
case B_MODAL_APP_WINDOW_FEEL:{
// add to ***app's*** list of Floating/Modal Windows.
winBorder->Window()->GetApp()->GetFMWList()->AddItem(winBorder);
// determine in witch workspaces to add this winBorder.
uint32 wks = 0;
// TODO: change later when you put this code into the server
for (int32 i=0; i<WorkspaceCount(); i++){
Workspace *ws = WorkspaceAt(i+1);
for (WinBorder *wb = ws->GoToBottomItem(); wb!=NULL; wb = ws->GoToUpperItem()){
if ( !(wb->IsHidden()) &&
winBorder->Window()->GetClientTeamID() == wb->Window()->GetClientTeamID())
{
wks = wks | winBorder->Window()->GetWorkspaces();
break;
}
}
}
// by using _bottomchild and _uppersibling.
AddWinBorderToWorkspaces(winBorder, wks);
break;
}
case B_MODAL_ALL_WINDOW_FEEL:{
// add to ***system's*** list of Floating/Modal Windows.
fMainFMWList.AddItem(winBorder);
// add this winBorder to all workspaces
AddWinBorderToWorkspaces(winBorder, 0xffffffffUL);
break;
}
case B_FLOATING_SUBSET_WINDOW_FEEL:{
/* this kind of window isn't added anywhere. It *will* be added to WS's list
when its main window will become the front one.
Also, it will be added to MainWinBorder's list when
winBorder::AddToSubset(main) is called.*/
break;
}
case B_FLOATING_APP_WINDOW_FEEL:{
// add to ***app's*** list of Floating/Modal Windows.
winBorder->Window()->GetApp()->GetFMWList()->AddItem(winBorder);
for (int32 i=0; i<WorkspaceCount(); i++){
Workspace *ws = WorkspaceAt(i+1);
WinBorder *wb = ws->FrontLayer();
if(wb && wb->Window()->GetClientTeamID() == winBorder->Window()->GetClientTeamID()
&& wb->Window()->GetFeel() == B_NORMAL_WINDOW_FEEL)
{
ws->AddLayerPtr(winBorder);
}
}
break;
}
case B_FLOATING_ALL_WINDOW_FEEL:{
// add to ***system's*** list of Floating/Modal Windows.
fMainFMWList.AddItem(winBorder);
// add this winBorder to all workspaces
AddWinBorderToWorkspaces(winBorder, 0xffffffffUL);
break;
}
case B_NORMAL_WINDOW_FEEL:{
// add this winBorder to the specified workspaces
AddWinBorderToWorkspaces(winBorder, winBorder->Window()->GetWorkspaces());
break;
}
case B_SYSTEM_LAST:
case B_SYSTEM_FIRST:{
// add this winBorder to all workspaces
AddWinBorderToWorkspaces(winBorder, 0xffffffffUL);
break;
}
default:
break;
}
}
/* This method does 3 things:
* 1) Removes MODAL/SUBSET windows from system/app/window subset list.
* 2) Removes this window from any workspace it appears in.
* 3) Removes this window from RootLayer's list of chilren.
*/
//---------------------------------------------------------------------------
void RootLayer::RemoveWinBorder(WinBorder* winBorder){
int32 feel = winBorder->Window()->GetFeel();
if(feel == B_MODAL_SUBSET_WINDOW_FEEL || feel == B_FLOATING_SUBSET_WINDOW_FEEL){
desktop->RemoveSubsetWindow(winBorder);
}
else if (feel == B_MODAL_APP_WINDOW_FEEL || feel == B_FLOATING_APP_WINDOW_FEEL){
RemoveAppWindow(winBorder);
}
else if(feel == B_MODAL_ALL_WINDOW_FEEL || feel == B_FLOATING_ALL_WINDOW_FEEL
|| feel == B_SYSTEM_FIRST || feel == B_SYSTEM_LAST)
{
if(feel == B_MODAL_ALL_WINDOW_FEEL || feel == B_FLOATING_ALL_WINDOW_FEEL)
fMainFMWList.RemoveItem(winBorder);
int32 count = WorkspaceCount();
for(int32 i=0; i < count; i++)
WorkspaceAt(i+1)->RemoveLayerPtr(winBorder);
}
else{ // for B_NORMAL_WINDOW_FEEL
uint32 workspaces = winBorder->Window()->GetWorkspaces();
int32 count = WorkspaceCount();
for( int32 i=0; i < 32 && i < count; i++)
if( workspaces & (0x00000001 << i))
WorkspaceAt(i+1)->RemoveLayerPtr(winBorder);
}
RemoveChild(winBorder);
}
//---------------------------------------------------------------------------
void RootLayer::ChangeWorkspacesFor(WinBorder* winBorder, uint32 newWorkspaces){
// only NORMAL windows are affected by this change
if(!winBorder->_level != B_NORMAL_FEEL)
return;
uint32 oldWorkspaces = winBorder->Window()->GetWorkspaces();
for(int32 i=0; i < WorkspaceCount(); i++){
if ((oldWorkspaces & (0x00000001 << i)) && (newWorkspaces & (0x00000001 << i))){
// do nothing.
}
else if(oldWorkspaces & (0x00000001 << i)){
WorkspaceAt(i+1)->RemoveLayerPtr(winBorder);
}
else if (newWorkspaces & (0x00000001 << i)){
WorkspaceAt(i+1)->AddLayerPtr(winBorder);
}
}
}
//---------------------------------------------------------------------------
void RootLayer::SetScreens(Screen *screen[], int32 rows, int32 columns){
// NOTE: *All* Screens *MUST* have the same resolution.
fScreenPtrList.MakeEmpty();
BRect newFrame(0, 0, 0, 0);
for (int32 i=0; i < rows; i++){
if (i==0)
for(int32 j=0; j < columns; j++){
fScreenPtrList.AddItem(screen[i*rows + j]);
newFrame.right += screen[i*rows + j]->Resolution().x;
}
newFrame.bottom += screen[i*rows]->Resolution().y;
}
newFrame.right -= 1;
newFrame.bottom -= 1;
_frame = newFrame;
fRows = rows;
fColumns = columns;
fScreenXResolution = (int32)(screen[0]->Resolution().x);
fScreenYResolution = (int32)(screen[0]->Resolution().y);
// RebuildRegions(Frame());
// Invalidate(Frame());
}
//---------------------------------------------------------------------------
Screen** RootLayer::Screens(){
return (Screen**)fScreenPtrList.Items();
}
//---------------------------------------------------------------------------
bool RootLayer::SetScreenResolution(int32 width, int32 height, uint32 colorspace){
// if there is no need to change resolution... exit
if (fScreenXResolution == width && fScreenYResolution == height &&
fColorSpace == colorspace)
return false;
bool accepted = true;
for (int i=0; i < fScreenPtrList.CountItems(); i++){
Screen *screen;
screen = static_cast<Screen*>(fScreenPtrList.ItemAt(i));
if ( !(screen->SupportsResolution(BPoint(width, height), colorspace)) )
accepted = false;
}
if (accepted){
for (int i=0; i < fScreenPtrList.CountItems(); i++){
Screen *screen;
screen = static_cast<Screen*>(fScreenPtrList.ItemAt(i));
screen->SetResolution(BPoint(width, height), colorspace);
}
Screen **screens = (Screen**)fScreenPtrList.Items();
SetScreens(screens, fRows, fColumns);
return true;
}
return false;
}
//---------------------------------------------------------------------------
void RootLayer::SetWorkspaceCount(const int32 count){
if ((count < 1 && count > 32) || count == WorkspaceCount())
return;
int32 exActiveWorkspaceIndex = ActiveWorkspaceIndex();
BList newWSPtrList;
void *workspacePtr;
for(int i=0; i < count; i++){
workspacePtr = fWSPtrList.ItemAt(i);
if (workspacePtr){
newWSPtrList.AddItem(workspacePtr);
}
else{
Workspace *ws;
ws = new Workspace(fColorSpace, i+1, BGColor());
newWSPtrList.AddItem(ws);
}
}
// delete other Workspace objects if WS count is smaller than current one.
for (int j=count; j < fWSPtrList.CountItems(); j++){
Workspace *ws = NULL;
ws = static_cast<Workspace*>(fWSPtrList.ItemAt(j));
if (ws){
delete ws;
}
else{
printf("\nSERVER: PANIC: in RootLayer::SetWorkspaceCount()\n\n");
return;
}
}
fWSPtrList = newWSPtrList;
if (exActiveWorkspaceIndex > count)
SetActiveWorkspaceByIndex(count);
// if true, this is the first time this method is called.
if (exActiveWorkspaceIndex == -1)
SetActiveWorkspaceByIndex(1);
}
//---------------------------------------------------------------------------
int32 RootLayer::WorkspaceCount() const{
return fWSPtrList.CountItems();
}
//---------------------------------------------------------------------------
Workspace* RootLayer::WorkspaceAt(const int32 index) const{
Workspace *ws = NULL;
ws = static_cast<Workspace*>(fWSPtrList.ItemAt(index-1));
return ws;
}
//---------------------------------------------------------------------------
void RootLayer::SetActiveWorkspaceByIndex(const int32 index){
Workspace *ws = NULL;
ws = static_cast<Workspace*>(fWSPtrList.ItemAt(index-1));
if (ws)
SetActiveWorkspace(ws);
}
//---------------------------------------------------------------------------
void RootLayer::SetActiveWorkspace(Workspace *ws){
if (fActiveWorkspace == ws || !ws)
return;
fActiveWorkspace = ws;
// RebuildRegions(Frame());
// Invalidate(Frame());
}
//---------------------------------------------------------------------------
int32 RootLayer::ActiveWorkspaceIndex() const{
if (fActiveWorkspace)
return fActiveWorkspace->ID();
else
return -1;
}
//---------------------------------------------------------------------------
Workspace* RootLayer::ActiveWorkspace() const{
return fActiveWorkspace;
}
//---------------------------------------------------------------------------
void RootLayer::SetBGColor(const RGBColor &col){
ActiveWorkspace()->SetBGColor(col);
_layerdata->viewcolor = col;
}
/*!
\brief Returns the background color of the Screen
\return The background color
*/
RGBColor RootLayer::GetColor(void) const
{
// Invalidate(Frame());
}
//---------------------------------------------------------------------------
RGBColor RootLayer::BGColor(void) const{
return _layerdata->viewcolor;
}
//---------------------------------------------------------------------------
void RootLayer::RemoveAppWindow(WinBorder *wb){
wb->Window()->GetApp()->GetFMWList()->RemoveItem(wb);
//! Empty function to disable moving the RootLayer
void RootLayer::MoveBy(float x, float y)
{
int32 count = WorkspaceCount();
for(int32 i=0; i < count; i++){
WorkspaceAt(i+1)->RemoveLayerPtr(wb);
}
}
//---------------------------------------------------------------------------
void RootLayer::PrintToStream(){
printf("\nRootLayer '%s' internals:\n", GetName());
printf("Screen list:\n");
for(int32 i=0; i<fScreenPtrList.CountItems(); i++){
printf("\t%ld\n", ((Screen*)fScreenPtrList.ItemAt(i))->ScreenNumber());
}
printf("Screen rows: %ld\nScreen columns: %ld\n", fRows, fColumns);
printf("Resolution for all Screens: %ldx%ldx%ld\n", fScreenXResolution, fScreenYResolution, fColorSpace);
printf("Workspace list:\n");
for(int32 i=0; i<fWSPtrList.CountItems(); i++){
printf("\t~~~Workspace: %ld\n", ((Workspace*)fWSPtrList.ItemAt(i))->ID());
((Workspace*)fWSPtrList.ItemAt(i))->PrintToStream();
printf("~~~~~~~~\n");
}
printf("Active Workspace: %ld\n", fActiveWorkspace? fActiveWorkspace->ID(): -1);
//! Reimplemented for RootLayer special case
void RootLayer::ResizeBy(float x, float y)
{
_frame.right += x;
_frame.bottom += y;
_full.Set( _frame ); // NO ConvertTopTop !!!
// We need to rebuild ALL regions because the screen is black now,
// and ALL views/Layers need redrawing.
RebuildRegions( _frame );
// Invalidate the hole screen, because we've changed resolution
// and the screen is black.
Invalidate( _frame );
}
/*!
\brief Assigns a particular display driver to the RootLayer
\param d The new display driver (ignored if NULL)
*/
void RootLayer::SetDriver(DisplayDriver *driver)
{
fDriver = driver;
}
+60 -12
View File
@@ -28,9 +28,16 @@
#ifndef _ROOTLAYER_H_
#define _ROOTLAYER_H_
class DisplayDriver;
#include <List.h>
#include "Layer.h"
#include "FMWList.h"
class RGBColor;
//class Layer;
class Workspace;
class Screen;
class WinBorder;
class Desktop;
/*!
\class RootLayer RootLayer.h
@@ -43,19 +50,60 @@ class RGBColor;
class RootLayer : public Layer
{
public:
RootLayer(BRect rect, const char *layername,
DisplayDriver *gfxdriver);
virtual ~RootLayer();
RootLayer(const char *layername, int32 workspaceCount, Desktop *desktop);
virtual ~RootLayer();
virtual void Draw(const BRect &r);
virtual void MoveBy(float x, float y);
virtual void ResizeBy(float x, float y);
virtual void MoveBy(float x, float y);
virtual void ResizeBy(float x, float y);
virtual Layer* VirtualTopChild() const; //
virtual Layer* VirtualLowerSibling() const; // ... for the active workspace
virtual Layer* VirtualUpperSibling() const; //
virtual Layer* VirtualBottomChild() const; //
void AddWinBorder(WinBorder* winBorder);
void RemoveWinBorder(WinBorder* winBorder);
void ChangeWorkspacesFor(WinBorder* winBorder, uint32 newWorkspaces);
void SetScreens(Screen *screen[], int32 rows, int32 columns);
Screen** Screens();
bool SetScreenResolution(int32 width, int32 height, uint32 colorspace);
int32 ScreenRows() const { return fRows; }
int32 ScreenColumns() const { return fColumns; }
void SetWorkspaceCount(const int32 count);
int32 WorkspaceCount(void) const;
Workspace* WorkspaceAt(const int32 index) const;
void SetActiveWorkspaceByIndex(const int32 index);
void SetActiveWorkspace(Workspace *ws);
int32 ActiveWorkspaceIndex(void) const;
Workspace* ActiveWorkspace(void) const;
void SetBGColor(const RGBColor &col);
RGBColor BGColor(void) const;
void AddWinBorderToWorkspaces(WinBorder* winBorder, uint32 wks);
void SetDriver(DisplayDriver *driver);
void SetColor(const RGBColor &col);
RGBColor GetColor(void) const;
// ------- debugging methods -------
void PrintToStream();
// "Private" to app_server :-) - they should not be used
void RemoveAppWindow(WinBorder *wb);
FMWList fMainFMWList;
private:
Desktop *fDesktop;
BList fScreenPtrList;
int32 fRows;
int32 fColumns;
int32 fScreenXResolution;
int32 fScreenYResolution;
uint32 fColorSpace;
BList fWSPtrList;
Workspace *fActiveWorkspace;
};
#endif
+28 -16
View File
@@ -102,7 +102,9 @@ ServerApp::ServerApp(port_id sendport, port_id rcvport, int32 handlerID, char *s
_appcursor=(defaultc)?new ServerCursor(defaultc):NULL;
_lock=create_sem(1,"ServerApp sem");
_driver=GetGfxDriver(ActiveScreen());
// TODO: Fix
// _driver=GetGfxDriver(ActiveScreen());
_cursorhidden=false;
STRACE(("ServerApp %s:\n",_signature.String()));
@@ -351,7 +353,9 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
}
case AS_UPDATE_COLORS:
{
ServerWindow *win;
// TODO: move message def to ServerProtocol.h to allow for
// complete build compatibility under R5
/* ServerWindow *win;
BMessage msg(_COLORS_UPDATED);
for(int32 i=0; i<_winlist->CountItems(); i++)
@@ -362,11 +366,14 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
win->SendMessageToClient(&msg);
win->Unlock();
}
break;
*/ break;
}
case AS_UPDATE_FONTS:
{
ServerWindow *win;
// TODO: move message def to ServerProtocol.h to allow for
// complete build compatibility under R5
/* ServerWindow *win;
BMessage msg(_FONTS_UPDATED);
for(int32 i=0; i<_winlist->CountItems(); i++)
@@ -377,11 +384,13 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
win->SendMessageToClient(&msg);
win->Unlock();
}
break;
*/ break;
}
case AS_UPDATE_DECORATOR:
{
ServerWindow *win;
// TODO: move message def to ServerProtocol.h to allow for
// complete build compatibility under R5
/* ServerWindow *win;
for(int32 i=0; i<_winlist->CountItems(); i++)
{
@@ -390,7 +399,7 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
win->_winborder->UpdateDecorator();
win->Unlock();
}
break;
*/ break;
}
case AS_CREATE_WINDOW:
{
@@ -592,8 +601,9 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
msg->Read<int32>(&workspace);
msg->Read<uint32>(&mode);
msg->Read<bool>(&stick);
SetSpace(workspace,mode,ActiveScreen(),stick);
// TODO: Fix
// SetSpace(workspace,mode,ActiveScreen(),stick);
break;
}
@@ -605,7 +615,9 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
// Error-checking is done in ActivateWorkspace, so this is a safe call
int32 workspace;
msg->Read<int32>(&workspace);
SetWorkspace(workspace);
// TODO: Fix
// SetWorkspace(workspace);
break;
}
@@ -723,7 +735,7 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
{
// Attached data:
// 1) port_id reply port - synchronous message
scroll_bar_info sbi=GetScrollBarInfo();
scroll_bar_info sbi=desktop->ScrollBarInfo();
port_id replyport;
msg->Read<int32>(&replyport);
@@ -739,7 +751,7 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
// 1) scroll_bar_info scroll bar info structure
scroll_bar_info sbi;
msg->Read<scroll_bar_info>(&sbi);
SetScrollBarInfo(sbi);
desktop->SetScrollBarInfo(sbi);
break;
}
case AS_FOCUS_FOLLOWS_MOUSE:
@@ -751,7 +763,7 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
msg->Read<int32>(&replyport);
PortLink link(replyport);
link.Attach<bool>(GetFFMouse());
link.Attach<bool>(desktop->FFMouseInUse());
link.Flush();
break;
}
@@ -761,7 +773,7 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
// 1) scroll_bar_info scroll bar info structure
scroll_bar_info sbi;
msg->Read<scroll_bar_info>(&sbi);
SetScrollBarInfo(sbi);
desktop->SetScrollBarInfo(sbi);
break;
}
case AS_SET_MOUSE_MODE:
@@ -770,14 +782,14 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
// 1) enum mode_mouse FFM mouse mode
mode_mouse mmode;
msg->Read<mode_mouse>(&mmode);
SetFFMouseMode(mmode);
desktop->SetFFMouseMode(mmode);
break;
}
case AS_GET_MOUSE_MODE:
{
// Attached data:
// 1) port_id reply port - synchronous message
mode_mouse mmode=GetFFMouseMode();
mode_mouse mmode=desktop->FFMouseMode();
port_id replyport;
msg->Read<int32>(&replyport);
+21
View File
@@ -29,6 +29,8 @@
#include <OS.h>
#include <String.h>
#include <ServerBitmap.h>
#include "FMWList.h"
class AppServer;
class BMessage;
@@ -38,6 +40,22 @@ class BList;
class DisplayDriver;
class ServerCursor;
/*
class ServerApp{
public:
ServerApp(team_id clientTeamID){
fClientTeamID = clientTeamID;
}
virtual ~ServerApp(){ }
team_id ClientTeamID(){ return fClientTeamID; }
FMWList fAppFMWList;
private:
team_id fClientTeamID;
};
*/
/*!
\class ServerApp ServerApp.h
\brief Counterpart to BApplication within the app_server
@@ -66,6 +84,8 @@ public:
void PostMessage(int32 code, size_t size=0, int8 *buffer=NULL);
void SetAppCursor(void);
FMWList *GetFMWList(void) { return &fAppFMWList; }
protected:
friend class AppServer;
friend class ServerWindow;
@@ -84,6 +104,7 @@ protected:
bool _cursorhidden;
bool _isactive;
int32 _handlertoken;
FMWList fAppFMWList;
};
#endif
+72
View File
@@ -0,0 +1,72 @@
#include <Accelerant.h>
#include <Point.h>
#include <GraphicsDefs.h>
#include <stdio.h>
#include "ServerScreen.h"
#include "DisplayDriver.h"
Screen::Screen(DisplayDriver *dDriver, BPoint res, uint32 colorspace,
const int32 &ID)
{
fID = ID;
fDriver = dDriver;
SetResolution(res, colorspace);
}
Screen::Screen(void)
{
}
Screen::~Screen(void){
//printf("~Screen( %ld )\n", fID);
}
bool Screen::SupportsResolution(const BPoint &res, const uint32 &colorspace)
{
display_mode *dm=NULL;
uint32 count;
fDriver->GetModeList(&dm, &count);
for (uint32 i=0; i < count; i++)
{
if (dm[i].virtual_width == (uint16)res.x &&
dm[i].virtual_height == (uint16)res.y &&
dm[i].space == colorspace)
return true;
}
delete dm;
return false;
}
bool Screen::SetResolution(const BPoint &res, const uint32 &colorspace)
{
if (!SupportsResolution(res, colorspace))
return false;
display_mode mode;
mode.virtual_width = (uint16)res.x;
mode.virtual_height = (uint16)res.y;
mode.space = colorspace;
fDriver->SetMode(mode);
return true;
}
BPoint Screen::Resolution() const{
display_mode mode;
fDriver->GetMode(&mode);
return BPoint(mode.virtual_width, mode.virtual_height);
}
int32 Screen::ScreenNumber(void) const{
return fID;
}
+30
View File
@@ -0,0 +1,30 @@
#ifndef _SERVERSCREEN_H_
#define _SERVERSCREEN_H_
#include <Point.h>
#include "DisplayDriver.h"
class Screen{
public:
Screen(DisplayDriver *dDriver, BPoint res, uint32 colorspace, const int32 &ID);
Screen(void);
~Screen(void);
void SetID(int32 ID){ fID = ID; }
// TODO: get/set prototype methods for graphic card features
bool SupportsResolution(const BPoint &res, const uint32 &colorspace);
bool SetResolution(const BPoint &res, const uint32 &colorspace);
BPoint Resolution() const;
int32 ScreenNumber(void) const;
DisplayDriver* GetDriver(void) const { return fDriver; }
private:
// TODO: add members in which we should store data.
int32 fID;
DisplayDriver *fDriver;
};
#endif
+220 -189
View File
@@ -41,7 +41,7 @@
#include "ServerProtocol.h"
#include "WinBorder.h"
#include "Desktop.h"
#include "DesktopClasses.h"
#include "Workspace.h"
#include "TokenHandler.h"
#include "Utils.h"
#include "DisplayDriver.h"
@@ -131,7 +131,7 @@ ServerWindow::ServerWindow(BRect rect, const char *string, uint32 wlook,
_feel = wfeel;
_handlertoken = handlerID;
winLooperPort = looperPort;
_workspace_index= index;
_workspaces = index;
_workspace = NULL;
_token = win_token_handler.GetToken();
@@ -177,7 +177,7 @@ ServerWindow::ServerWindow(BRect rect, const char *string, uint32 wlook,
top_layer= new Layer(vFrame, vName, vToken, vResizeMode, vFlags, this);
delete vName;
cl = top_layer;
currentlayer = top_layer;
// Create a WindoBorder object for our ServerWindow.
@@ -191,7 +191,7 @@ ServerWindow::ServerWindow(BRect rect, const char *string, uint32 wlook,
// Add window to desktop structure.
AddWindowToDesktop(this,index,ActiveScreen());
desktop->AddWinBorder(_winborder);
STRACE(("ServerWindow %s:\n",_title->String()));
STRACE(("\tFrame (%.1f,%.1f,%.1f,%.1f)\n",rect.left,rect.top,rect.right,rect.bottom));
@@ -203,7 +203,8 @@ ServerWindow::ServerWindow(BRect rect, const char *string, uint32 wlook,
ServerWindow::~ServerWindow(void)
{
STRACE(("ServerWindow %s:~ServerWindow()\n",_title->String()));
RemoveWindowFromDesktop(this);
desktop->RemoveWinBorder(_winborder);
if(_applink)
{
delete _applink;
@@ -212,7 +213,7 @@ STRACE(("ServerWindow %s:~ServerWindow()\n",_title->String()));
delete _winlink;
delete _winborder;
cl = NULL;
currentlayer = NULL;
if (top_layer)
delete top_layer;
}
@@ -340,6 +341,30 @@ void ServerWindow::Zoom(){
// TODO: implement;
}
void ServerWindow::SetLook(int32 look)
{
// TODO: Finish
_look=look;
}
void ServerWindow::SetFeel(int32 feel)
{
// TODO: Finish
_feel=feel;
}
void ServerWindow::SetFlags(int32 flags)
{
// TODO: Finish
_flags=flags;
}
void ServerWindow::SetWorkspaces(int32 workspaces)
{
// TODO: Finish
_workspaces=workspaces;
}
/*!
\brief Handles focus and redrawing when changing focus states
@@ -490,11 +515,11 @@ void ServerWindow::DispatchMessage(PortMessage msg)
Layer *current = FindLayer(top_layer, token);
if (current)
cl = current;
currentlayer = current;
else // hope this NEVER happens! :-)
debugger("Server PANIC: window cannot find Layer with ID\n");
STRACE(("ServerWindow %s: Message AS_SET_CURRENT_LAYER: Layer name: %s\n", _title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_SET_CURRENT_LAYER: Layer name: %s\n", _title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_CREATE:
@@ -507,7 +532,7 @@ TODO: Figure out what Adi did here and convert to PortMessages
// the area in which the new layer resides assuming that it is
// visible.
STRACE(("ServerWindow %s: AS_LAYER_CREATE...\n", _title->String()));
Layer *oldCL = cl;
Layer *oldCL = currentlayer;
int32 token;
BRect frame;
@@ -532,7 +557,7 @@ TODO: Figure out what Adi did here and convert to PortMessages
newLayer->_hidden = hidden;
// we set Layer's attributes (BView's state)
cl = newLayer;
currentlayer = newLayer;
int32 msgCode;
msg.Read<int32>(&msgCode); // this is AS_LAYER_SET_FONT_STATE
@@ -550,9 +575,9 @@ TODO: Figure out what Adi did here and convert to PortMessages
DispatchMessage(msgCode);
}
cl = oldCL;
currentlayer = oldCL;
STRACE(("DONE: ServerWindow %s: Message AS_CREATE_LAYER: Parent: %s, Child: %s\n", _title->String(), cl->_name->String(), name));
STRACE(("DONE: ServerWindow %s: Message AS_CREATE_LAYER: Parent: %s, Child: %s\n", _title->String(), currentlayer->_name->String(), name));
*/
break;
}
@@ -564,20 +589,20 @@ TODO: Figure out what Adi did here and convert to PortMessages
// area assuming that the view was visible when removed
STRACE(("SW %s: AS_LAYER_DELETE(self)...\n", _title->String()));
Layer *parent;
parent = cl->_parent;
parent = currentlayer->_parent;
// here we remove current layer from list.
cl->RemoveSelf();
currentlayer->RemoveSelf();
// TODO: invalidate the region occupied by this view.
// Should be done in Layer::RemoveChild() though!
cl->PruneTree();
currentlayer->PruneTree();
parent->PrintTree();
STRACE(("DONE: ServerWindow %s: Message AS_DELETE_LAYER: Parent: %s Layer: %s\n", _title->String(), parent->_name->String(), cl->_name->String()));
STRACE(("DONE: ServerWindow %s: Message AS_DELETE_LAYER: Parent: %s Layer: %s\n", _title->String(), parent->_name->String(), currentlayer->_name->String()));
delete cl;
delete currentlayer;
cl = parent;
currentlayer = parent;
break;
}
case AS_LAYER_SET_STATE:
@@ -588,53 +613,53 @@ TODO: Figure out what Adi did here and convert to PortMessages
pattern patt;
int32 clippRegRects;
msg.Read<BPoint>(&(cl->_layerdata->penlocation));
msg.Read<float>(&(cl->_layerdata->pensize));
msg.Read<BPoint>(&(currentlayer->_layerdata->penlocation));
msg.Read<float>(&(currentlayer->_layerdata->pensize));
msg.Read<rgb_color>(&highColor);
msg.Read<rgb_color>(&lowColor);
msg.Read<rgb_color>(&viewColor);
msg.Read<pattern>(&patt);
msg.Read<int8>((int8*)&(cl->_layerdata->draw_mode));
msg.Read<BPoint>(&(cl->_layerdata->coordOrigin));
msg.Read<int8>((int8*)&(cl->_layerdata->lineJoin));
msg.Read<int8>((int8*)&(cl->_layerdata->lineCap));
msg.Read<float>(&(cl->_layerdata->miterLimit));
msg.Read<int8>((int8*)&(cl->_layerdata->alphaSrcMode));
msg.Read<int8>((int8*)&(cl->_layerdata->alphaFncMode));
msg.Read<float>(&(cl->_layerdata->scale));
msg.Read<bool>(&(cl->_layerdata->fontAliasing));
msg.Read<int8>((int8*)&(currentlayer->_layerdata->draw_mode));
msg.Read<BPoint>(&(currentlayer->_layerdata->coordOrigin));
msg.Read<int8>((int8*)&(currentlayer->_layerdata->lineJoin));
msg.Read<int8>((int8*)&(currentlayer->_layerdata->lineCap));
msg.Read<float>(&(currentlayer->_layerdata->miterLimit));
msg.Read<int8>((int8*)&(currentlayer->_layerdata->alphaSrcMode));
msg.Read<int8>((int8*)&(currentlayer->_layerdata->alphaFncMode));
msg.Read<float>(&(currentlayer->_layerdata->scale));
msg.Read<bool>(&(currentlayer->_layerdata->fontAliasing));
msg.Read<int32>(&clippRegRects);
cl->_layerdata->patt.Set(*((uint64*)&patt));
cl->_layerdata->highcolor.SetColor(highColor);
cl->_layerdata->lowcolor.SetColor(lowColor);
cl->_layerdata->viewcolor.SetColor(viewColor);
currentlayer->_layerdata->patt.Set(*((uint64*)&patt));
currentlayer->_layerdata->highcolor.SetColor(highColor);
currentlayer->_layerdata->lowcolor.SetColor(lowColor);
currentlayer->_layerdata->viewcolor.SetColor(viewColor);
if(clippRegRects != 0){
if(cl->_layerdata->clippReg == NULL)
cl->_layerdata->clippReg = new BRegion();
if(currentlayer->_layerdata->clippReg == NULL)
currentlayer->_layerdata->clippReg = new BRegion();
else
cl->_layerdata->clippReg->MakeEmpty();
currentlayer->_layerdata->clippReg->MakeEmpty();
BRect rect;
for(int32 i = 0; i < clippRegRects; i++){
msg.Read<BRect>(&rect);
cl->_layerdata->clippReg->Include(rect);
currentlayer->_layerdata->clippReg->Include(rect);
}
cl->RebuildFullRegion();
currentlayer->RebuildFullRegion();
}
else{
if (cl->_layerdata->clippReg){
delete cl->_layerdata->clippReg;
cl->_layerdata->clippReg = NULL;
if (currentlayer->_layerdata->clippReg){
delete currentlayer->_layerdata->clippReg;
currentlayer->_layerdata->clippReg = NULL;
cl->RebuildFullRegion();
currentlayer->RebuildFullRegion();
}
}
STRACE(("ServerWindow %s: Message AS_LAYER_SET_STATE: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_SET_STATE: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_SET_FONT_STATE:
@@ -648,52 +673,52 @@ TODO: Figure out what Adi did here and convert to PortMessages
msg.Read<int32>((int32*)&fontID);
// TODO: implement later. Currently there is no SetFamAndStyle(uint32)
// in ServerFont class. DW, could you add one?
//cl->_layerdata->font->
//currentlayer->_layerdata->font->
}
if (mask & B_FONT_SIZE){
float size;
msg.Read<float>(&size);
cl->_layerdata->font.SetSize(size);
currentlayer->_layerdata->font.SetSize(size);
}
if (mask & B_FONT_SHEAR){
float shear;
msg.Read<float>(&shear);
cl->_layerdata->font.SetShear(shear);
currentlayer->_layerdata->font.SetShear(shear);
}
if (mask & B_FONT_ROTATION){
float rotation;
msg.Read<float>(&rotation);
cl->_layerdata->font.SetRotation(rotation);
currentlayer->_layerdata->font.SetRotation(rotation);
}
if (mask & B_FONT_SPACING){
uint8 spacing;
msg.Read<uint8>(&spacing); // uint8
cl->_layerdata->font.SetSpacing(spacing);
currentlayer->_layerdata->font.SetSpacing(spacing);
}
if (mask & B_FONT_ENCODING){
uint8 encoding;
msg.Read<int8>((int8*)&encoding); // uint8
cl->_layerdata->font.SetEncoding(encoding);
currentlayer->_layerdata->font.SetEncoding(encoding);
}
if (mask & B_FONT_FACE){
uint16 face;
msg.Read<uint16>(&face); // uint16
cl->_layerdata->font.SetFace(face);
currentlayer->_layerdata->font.SetFace(face);
}
if (mask & B_FONT_FLAGS){
uint32 flags;
msg.Read<uint32>(&flags); // uint32
cl->_layerdata->font.SetFlags(flags);
currentlayer->_layerdata->font.SetFlags(flags);
}
STRACE(("ServerWindow %s: Message AS_LAYER_SET_FONT_STATE: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_SET_FONT_STATE: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_GET_STATE:
@@ -703,7 +728,7 @@ TODO: Figure out what Adi did here and convert to PortMessages
rgb_color hc, lc, vc; // high, low and view colors
uint64 patt; // current pattern as a uint64
ld = cl->_layerdata; // now we write fewer characters. :-)
ld = currentlayer->_layerdata; // now we write fewer characters. :-)
hc = ld->highcolor.GetColor32();
lc = ld->lowcolor.GetColor32();
vc = ld->viewcolor.GetColor32();
@@ -746,12 +771,12 @@ TODO: Figure out what Adi did here and convert to PortMessages
_winlink->Attach<BRect>(ld->clippReg->RectAt(i));
}
_winlink->Attach<float>(cl->_frame.left);
_winlink->Attach<float>(cl->_frame.top);
_winlink->Attach<BRect>(cl->_frame.OffsetToCopy(cl->_boundsLeftTop));
_winlink->Attach<float>(currentlayer->_frame.left);
_winlink->Attach<float>(currentlayer->_frame.top);
_winlink->Attach<BRect>(currentlayer->_frame.OffsetToCopy(currentlayer->_boundsLeftTop));
_winlink->Flush();
STRACE(("ServerWindow %s: Message AS_LAYER_GET_STATE: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_GET_STATE: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_MOVETO:
@@ -761,9 +786,9 @@ TODO: Figure out what Adi did here and convert to PortMessages
msg.Read<float>(&x);
msg.Read<float>(&y);
cl->MoveBy(x, y);
currentlayer->MoveBy(x, y);
STRACE(("ServerWindow %s: Message AS_LAYER_MOVETO: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_MOVETO: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_RESIZETO:
@@ -775,19 +800,19 @@ TODO: Figure out what Adi did here and convert to PortMessages
/* TODO: check for minimum alowed. WinBorder should provide such
* a method, based on its decorator.
*/
cl->ResizeBy(newWidth, newHeight);
currentlayer->ResizeBy(newWidth, newHeight);
STRACE(("ServerWindow %s: Message AS_LAYER_RESIZETO: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_RESIZETO: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_GET_COORD:
{
_winlink->Attach<float>(cl->_frame.left);
_winlink->Attach<float>(cl->_frame.top);
_winlink->Attach<BRect>(cl->_frame.OffsetToCopy(cl->_boundsLeftTop));
_winlink->Attach<float>(currentlayer->_frame.left);
_winlink->Attach<float>(currentlayer->_frame.top);
_winlink->Attach<BRect>(currentlayer->_frame.OffsetToCopy(currentlayer->_boundsLeftTop));
_winlink->Flush();
STRACE(("ServerWindow %s: Message AS_LAYER_GET_COORD: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_GET_COORD: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_SET_ORIGIN:
@@ -797,24 +822,24 @@ TODO: Figure out what Adi did here and convert to PortMessages
msg.Read<float>(&x);
msg.Read<float>(&y);
cl->_layerdata->coordOrigin.Set(x, y);
currentlayer->_layerdata->coordOrigin.Set(x, y);
STRACE(("ServerWindow %s: Message AS_LAYER_SET_ORIGIN: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_SET_ORIGIN: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_GET_ORIGIN:
{
_winlink->Attach<BPoint>(cl->_layerdata->coordOrigin);
_winlink->Attach<BPoint>(currentlayer->_layerdata->coordOrigin);
_winlink->Flush();
STRACE(("ServerWindow %s: Message AS_LAYER_GET_ORIGIN: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_GET_ORIGIN: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_RESIZE_MODE:
{
msg.Read<uint32>(&(cl->_resize_mode));
msg.Read<uint32>(&(currentlayer->_resize_mode));
STRACE(("ServerWindow %s: Message AS_LAYER_RESIZE_MODE: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_RESIZE_MODE: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_CURSOR:
@@ -825,28 +850,28 @@ TODO: Figure out what Adi did here and convert to PortMessages
cursormanager->SetCursor(token);
STRACE(("ServerWindow %s: Message AS_LAYER_CURSOR: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_CURSOR: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_SET_FLAGS:
{
msg.Read<uint32>(&(cl->_flags));
msg.Read<uint32>(&(currentlayer->_flags));
STRACE(("ServerWindow %s: Message AS_LAYER_SET_FLAGS: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_SET_FLAGS: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_HIDE:
{
cl->Hide();
currentlayer->Hide();
STRACE(("ServerWindow %s: Message AS_LAYER_HIDE: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_HIDE: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_SHOW:
{
cl->Show();
currentlayer->Show();
STRACE(("ServerWindow %s: Message AS_LAYER_SHOW: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_SHOW: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_SET_LINE_MODE:
@@ -859,61 +884,61 @@ TODO: Figure out what Adi did here and convert to PortMessages
*/
msg.Read<int8>(&lineCap);
msg.Read<int8>(&lineJoin);
msg.Read<float>(&(cl->_layerdata->miterLimit));
msg.Read<float>(&(currentlayer->_layerdata->miterLimit));
cl->_layerdata->lineCap = (cap_mode)lineCap;
cl->_layerdata->lineJoin = (join_mode)lineJoin;
currentlayer->_layerdata->lineCap = (cap_mode)lineCap;
currentlayer->_layerdata->lineJoin = (join_mode)lineJoin;
STRACE(("ServerWindow %s: Message AS_LAYER_SET_LINE_MODE: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_SET_LINE_MODE: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_GET_LINE_MODE:
{
_winlink->Attach<int8>((int8)(cl->_layerdata->lineCap));
_winlink->Attach<int8>((int8)(cl->_layerdata->lineJoin));
_winlink->Attach<float>(cl->_layerdata->miterLimit);
_winlink->Attach<int8>((int8)(currentlayer->_layerdata->lineCap));
_winlink->Attach<int8>((int8)(currentlayer->_layerdata->lineJoin));
_winlink->Attach<float>(currentlayer->_layerdata->miterLimit);
_winlink->Flush();
STRACE(("ServerWindow %s: Message AS_LAYER_GET_LINE_MODE: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_GET_LINE_MODE: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_PUSH_STATE:
{
LayerData *ld = new LayerData();
ld->prevState = cl->_layerdata;
cl->_layerdata = ld;
ld->prevState = currentlayer->_layerdata;
currentlayer->_layerdata = ld;
cl->RebuildFullRegion();
currentlayer->RebuildFullRegion();
STRACE(("ServerWindow %s: Message AS_LAYER_PUSH_STATE: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_PUSH_STATE: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_POP_STATE:
{
if (!(cl->_layerdata->prevState)) {
STRACE(("WARNING: SW(%s): User called BView(%s)::PopState(), but there is NO state on stack!\n", _title->String(), cl->_name->String()));
if (!(currentlayer->_layerdata->prevState)) {
STRACE(("WARNING: SW(%s): User called BView(%s)::PopState(), but there is NO state on stack!\n", _title->String(), currentlayer->_name->String()));
break;
}
LayerData *ld = cl->_layerdata;
cl->_layerdata = cl->_layerdata->prevState;
LayerData *ld = currentlayer->_layerdata;
currentlayer->_layerdata = currentlayer->_layerdata->prevState;
delete ld;
cl->RebuildFullRegion();
currentlayer->RebuildFullRegion();
STRACE(("ServerWindow %s: Message AS_LAYER_POP_STATE: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_POP_STATE: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_SET_SCALE:
{
msg.Read<float>(&(cl->_layerdata->scale));
msg.Read<float>(&(currentlayer->_layerdata->scale));
STRACE(("ServerWindow %s: Message AS_LAYER_SET_SCALE: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_SET_SCALE: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_GET_SCALE:
{
LayerData *ld = cl->_layerdata;
LayerData *ld = currentlayer->_layerdata;
float scale = ld->scale;
while((ld = ld->prevState))
@@ -922,7 +947,7 @@ TODO: Figure out what Adi did here and convert to PortMessages
_winlink->Attach<float>(scale);
_winlink->Flush();
STRACE(("ServerWindow %s: Message AS_LAYER_SET_SCALE: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_SET_SCALE: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_SET_PEN_LOC:
@@ -932,32 +957,32 @@ TODO: Figure out what Adi did here and convert to PortMessages
msg.Read<float>(&x);
msg.Read<float>(&y);
cl->_layerdata->penlocation.Set(x, y);
currentlayer->_layerdata->penlocation.Set(x, y);
STRACE(("ServerWindow %s: Message AS_LAYER_SET_PEN_LOC: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_SET_PEN_LOC: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_GET_PEN_LOC:
{
_winlink->Attach<BPoint>(cl->_layerdata->penlocation);
_winlink->Attach<BPoint>(currentlayer->_layerdata->penlocation);
_winlink->Flush();
STRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_LOC: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_LOC: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_SET_PEN_SIZE:
{
msg.Read<float>(&(cl->_layerdata->pensize));
msg.Read<float>(&(currentlayer->_layerdata->pensize));
STRACE(("ServerWindow %s: Message AS_LAYER_SET_PEN_SIZE: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_SET_PEN_SIZE: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_GET_PEN_SIZE:
{
_winlink->Attach<float>(cl->_layerdata->pensize);
_winlink->Attach<float>(currentlayer->_layerdata->pensize);
_winlink->Flush();
STRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_SIZE: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_SIZE: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_SET_HIGH_COLOR:
@@ -966,9 +991,9 @@ TODO: Figure out what Adi did here and convert to PortMessages
msg.Read<rgb_color>(&c);
cl->_layerdata->highcolor.SetColor(c);
currentlayer->_layerdata->highcolor.SetColor(c);
STRACE(("ServerWindow %s: Message AS_LAYER_SET_HIGH_COLOR: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_SET_HIGH_COLOR: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_SET_LOW_COLOR:
@@ -977,9 +1002,9 @@ TODO: Figure out what Adi did here and convert to PortMessages
msg.Read<rgb_color>(&c);
cl->_layerdata->lowcolor.SetColor(c);
currentlayer->_layerdata->lowcolor.SetColor(c);
STRACE(("ServerWindow %s: Message AS_LAYER_SET_LOW_COLOR: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_SET_LOW_COLOR: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_SET_VIEW_COLOR:
@@ -988,25 +1013,25 @@ TODO: Figure out what Adi did here and convert to PortMessages
msg.Read<rgb_color>(&c);
cl->_layerdata->viewcolor.SetColor(c);
currentlayer->_layerdata->viewcolor.SetColor(c);
STRACE(("ServerWindow %s: Message AS_LAYER_SET_VIEW_COLOR: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_SET_VIEW_COLOR: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_GET_COLORS:
{
rgb_color highColor, lowColor, viewColor;
highColor = cl->_layerdata->highcolor.GetColor32();
lowColor = cl->_layerdata->lowcolor.GetColor32();
viewColor = cl->_layerdata->viewcolor.GetColor32();
highColor = currentlayer->_layerdata->highcolor.GetColor32();
lowColor = currentlayer->_layerdata->lowcolor.GetColor32();
viewColor = currentlayer->_layerdata->viewcolor.GetColor32();
_winlink->Attach<rgb_color>(highColor);
_winlink->Attach<rgb_color>(lowColor);
_winlink->Attach<rgb_color>(viewColor);
_winlink->Flush();
STRACE(("ServerWindow %s: Message AS_LAYER_GET_COLORS: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_GET_COLORS: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_SET_BLEND_MODE:
@@ -1016,19 +1041,19 @@ TODO: Figure out what Adi did here and convert to PortMessages
msg.Read<int8>(&srcAlpha);
msg.Read<int8>(&alphaFunc);
cl->_layerdata->alphaSrcMode = (source_alpha)srcAlpha;
cl->_layerdata->alphaFncMode = (alpha_function)alphaFunc;
currentlayer->_layerdata->alphaSrcMode = (source_alpha)srcAlpha;
currentlayer->_layerdata->alphaFncMode = (alpha_function)alphaFunc;
STRACE(("ServerWindow %s: Message AS_LAYER_SET_BLEND_MODE: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_SET_BLEND_MODE: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_GET_BLEND_MODE:
{
_winlink->Attach<int8>((int8)(cl->_layerdata->alphaSrcMode));
_winlink->Attach<int8>((int8)(cl->_layerdata->alphaFncMode));
_winlink->Attach<int8>((int8)(currentlayer->_layerdata->alphaSrcMode));
_winlink->Attach<int8>((int8)(currentlayer->_layerdata->alphaFncMode));
_winlink->Flush();
STRACE(("ServerWindow %s: Message AS_LAYER_GET_BLEND_MODE: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_GET_BLEND_MODE: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_SET_DRAW_MODE:
@@ -1037,24 +1062,24 @@ TODO: Figure out what Adi did here and convert to PortMessages
msg.Read<int8>(&drawingMode);
cl->_layerdata->draw_mode = (drawing_mode)drawingMode;
currentlayer->_layerdata->draw_mode = (drawing_mode)drawingMode;
STRACE(("ServerWindow %s: Message AS_LAYER_SET_DRAW_MODE: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_SET_DRAW_MODE: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_GET_DRAW_MODE:
{
_winlink->Attach<int8>((int8)(cl->_layerdata->draw_mode));
_winlink->Attach<int8>((int8)(currentlayer->_layerdata->draw_mode));
_winlink->Flush();
STRACE(("ServerWindow %s: Message AS_LAYER_GET_DRAW_MODE: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_GET_DRAW_MODE: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_PRINT_ALIASING:
{
msg.Read<bool>(&(cl->_layerdata->fontAliasing));
msg.Read<bool>(&(currentlayer->_layerdata->fontAliasing));
STRACE(("ServerWindow %s: Message AS_LAYER_PRINT_ALIASING: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_PRINT_ALIASING: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_CLIP_TO_PICTURE:
@@ -1072,8 +1097,8 @@ TODO: Figure out what Adi did here and convert to PortMessages
// if we had a picture to clip to, include the FULL visible region(if any) in the area to be redrawn
// in other words: invalidate what ever is visible for this layer and his children.
if (cl->clipToPicture && cl->_fullVisible.CountRects() > 0){
reg.Include(&cl->_fullVisible);
if (currentlayer->clipToPicture && currentlayer->_fullVisible.CountRects() > 0){
reg.Include(&currentlayer->_fullVisible);
redraw = true;
}
@@ -1081,12 +1106,12 @@ TODO: Figure out what Adi did here and convert to PortMessages
ServerPicture *sp = NULL;
int32 i = 0;
for(;;){
sp = static_cast<ServerPicture*>(cl->_serverwin->_app->_piclist->ItemAt(i++));
sp = static_cast<ServerPicture*>(currentlayer->_serverwin->_app->_piclist->ItemAt(i++));
if (!sp)
break;
if(sp->GetToken() == pictureToken){
// cl->clipToPicture = sp;
// currentlayer->clipToPicture = sp;
// TODO: increase that picture's reference count.(~ allocate a picture)
break;
}
@@ -1095,34 +1120,34 @@ TODO: Figure out what Adi did here and convert to PortMessages
i = 0;
// we have a new picture to clip to, so rebuild our full region
if(cl->clipToPicture) {
if(currentlayer->clipToPicture) {
cl->clipToPictureInverse = false;
currentlayer->clipToPictureInverse = false;
cl->RebuildFullRegion();
currentlayer->RebuildFullRegion();
}
// we need to rebuild the visible region, we may have a valid one.
if (cl->_parent && !(cl->_hidden)){
cl->_parent->RebuildChildRegions(cl->_full.Frame(), cl);
if (currentlayer->_parent && !(currentlayer->_hidden)){
currentlayer->_parent->RebuildChildRegions(currentlayer->_full.Frame(), currentlayer);
}
else{
// will this happen? Maybe...
cl->RebuildRegions(cl->_full.Frame());
currentlayer->RebuildRegions(currentlayer->_full.Frame());
}
// include our full visible region in the region to be redrawn
if (!(cl->_hidden) && (cl->_fullVisible.CountRects() > 0)){
reg.Include(&(cl->_fullVisible));
if (!(currentlayer->_hidden) && (currentlayer->_fullVisible.CountRects() > 0)){
reg.Include(&(currentlayer->_fullVisible));
redraw = true;
}
// redraw if: we had OR if we NOW have a picture to clip to.
if (redraw){
cl->Invalidate(reg);
currentlayer->Invalidate(reg);
}
STRACE(("ServerWindow %s: Message AS_LAYER_CLIP_TO_PICTURE: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_CLIP_TO_PICTURE: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_CLIP_TO_INVERSE_PICTURE:
@@ -1138,12 +1163,12 @@ TODO: Figure out what Adi did here and convert to PortMessages
int32 i = 0;
for(;;){
sp = static_cast<ServerPicture*>(cl->_serverwin->_app->_piclist->ItemAt(i++));
sp = static_cast<ServerPicture*>(currentlayer->_serverwin->_app->_piclist->ItemAt(i++));
if (!sp)
break;
if(sp->GetToken() == pictureToken){
// cl->clipToPicture = sp;
// currentlayer->clipToPicture = sp;
// TODO: increase that picture's reference count.(~ allocate a picture)
break;
}
@@ -1152,16 +1177,16 @@ TODO: Figure out what Adi did here and convert to PortMessages
i = 0;
// if a picture has been found...
if(cl->clipToPicture) {
if(currentlayer->clipToPicture) {
cl->clipToPictureInverse = true;
currentlayer->clipToPictureInverse = true;
cl->RebuildFullRegion();
currentlayer->RebuildFullRegion();
cl->RequestDraw(cl->clipToPicture->Frame());
currentlayer->RequestDraw(currentlayer->clipToPicture->Frame());
}
STRACE(("ServerWindow %s: Message AS_LAYER_CLIP_TO_INVERSE_PICTURE: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_CLIP_TO_INVERSE_PICTURE: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_GET_CLIP_REGION:
@@ -1171,8 +1196,8 @@ TODO: Figure out what Adi did here and convert to PortMessages
LayerData *ld;
int32 noOfRects;
ld = cl->_layerdata;
reg = cl->ConvertFromParent(&(cl->_visible));
ld = currentlayer->_layerdata;
reg = currentlayer->ConvertFromParent(&(currentlayer->_visible));
if(ld->clippReg)
reg.IntersectWith(ld->clippReg);
@@ -1190,7 +1215,7 @@ TODO: Figure out what Adi did here and convert to PortMessages
_winlink->Flush();
STRACE(("ServerWindow %s: Message AS_LAYER_GET_CLIP_REGION: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_GET_CLIP_REGION: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_SET_CLIP_REGION:
@@ -1199,23 +1224,23 @@ TODO: Figure out what Adi did here and convert to PortMessages
int32 noOfRects;
BRect r;
if(cl->_layerdata->clippReg)
cl->_layerdata->clippReg->MakeEmpty();
if(currentlayer->_layerdata->clippReg)
currentlayer->_layerdata->clippReg->MakeEmpty();
else
cl->_layerdata->clippReg = new BRegion();
currentlayer->_layerdata->clippReg = new BRegion();
msg.Read<int32>(&noOfRects);
for(int i = 0; i < noOfRects; i++){
msg.Read<BRect>(&r);
cl->_layerdata->clippReg->Include(r);
currentlayer->_layerdata->clippReg->Include(r);
}
cl->RebuildFullRegion();
currentlayer->RebuildFullRegion();
cl->RequestDraw(cl->clipToPicture->Frame());
currentlayer->RequestDraw(currentlayer->clipToPicture->Frame());
STRACE(("ServerWindow %s: Message AS_LAYER_SET_CLIP_REGION: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_SET_CLIP_REGION: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
@@ -1226,11 +1251,11 @@ TODO: Figure out what Adi did here and convert to PortMessages
msg.Read<BRect>(&invalRect);
cl->Invalidate(invalRect);
currentlayer->Invalidate(invalRect);
cl->RequestDraw(invalRect);
currentlayer->RequestDraw(invalRect);
STRACE(("ServerWindow %s: Message AS_LAYER_INVAL_RECT: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_INVAL_RECT: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
case AS_LAYER_INVAL_REGION:
@@ -1247,11 +1272,11 @@ TODO: Figure out what Adi did here and convert to PortMessages
invalReg.Include(rect);
}
cl->Invalidate(invalReg);
currentlayer->Invalidate(invalReg);
cl->RequestDraw(invalReg.Frame());
currentlayer->RequestDraw(invalReg.Frame());
STRACE(("ServerWindow %s: Message AS_LAYER_INVAL_RECT: Layer: %s\n",_title->String(), cl->_name->String()));
STRACE(("ServerWindow %s: Message AS_LAYER_INVAL_RECT: Layer: %s\n",_title->String(), currentlayer->_name->String()));
break;
}
@@ -1448,7 +1473,7 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer)
{
code = read_from_buffer<int32>(&msgbuffer);
view_token = read_from_buffer<int32>(&msgbuffer);
layer = _workspace->GetRoot()->FindLayer(view_token);
layer = desktop->ActiveRootLayer()->FindLayer(view_token);
if (layer)
{
layerdata = layer->GetLayerData();
@@ -2002,7 +2027,7 @@ int32 ServerWindow::MonitorWin(void *data)
//void ServerWindow::HandleMouseEvent(int32 code, int8 *buffer)
void ServerWindow::HandleMouseEvent(PortMessage *msg)
{
ServerWindow *mousewin=NULL;
/* ServerWindow *mousewin=NULL;
// int8 *index=buffer;
// Find the window which will receive our mouse event.
@@ -2072,10 +2097,10 @@ void ServerWindow::HandleMouseEvent(PortMessage *msg)
msg->Read(&y);
BPoint pt(x,y);
/* set_is_sliding_tab(false);
set_is_moving_window(false);
set_is_resizing_window(false);
*/ _winborder = WindowContainsPoint(pt);
// set_is_sliding_tab(false);
// set_is_moving_window(false);
// set_is_resizing_window(false);
_winborder = WindowContainsPoint(pt);
active_winborder=NULL;
if(_winborder)
{
@@ -2104,28 +2129,29 @@ void ServerWindow::HandleMouseEvent(PortMessage *msg)
msg->Read(&dummy);
msg->Read(&x);
msg->Read(&y);
/* BPoint pt(x,y);
if(is_moving_window() || is_resizing_window() || is_sliding_tab())
{
active_winborder->MouseMoved((int8*)msg->Buffer());
}
else
{
_winborder = WindowContainsPoint(pt);
if(_winborder)
{
mousewin=_winborder->Window();
_winborder->MouseMoved((int8*)msg->Buffer());
}
}
*/ break;
// BPoint pt(x,y);
//
// if(is_moving_window() || is_resizing_window() || is_sliding_tab())
// {
// active_winborder->MouseMoved((int8*)msg->Buffer());
// }
// else
// {
// _winborder = WindowContainsPoint(pt);
// if(_winborder)
// {
// mousewin=_winborder->Window();
// _winborder->MouseMoved((int8*)msg->Buffer());
// }
// }
break;
}
default:
{
break;
}
}
*/
}
/*!
@@ -2155,13 +2181,18 @@ STRACE_KEY(("ServerWindow::HandleKeyEvent unimplemented\n"));
If the window belongs to all workspaces, it returns the current workspace
*/
/*
Workspace *ServerWindow::GetWorkspace(void)
{
if(_workspace_index==B_ALL_WORKSPACES)
{
return _workspace->GetScreen()->GetActiveWorkspace();
}
return _workspace;
}
*/
/*!
\brief Assign the window to a particular workspace object
+86 -73
View File
@@ -35,6 +35,7 @@
#include <String.h>
#include <Window.h>
#include <PortMessage.h>
#include "FMWList.h"
class BString;
class BMessenger;
@@ -64,55 +65,68 @@ class Layer;
class ServerWindow
{
public:
ServerWindow(BRect rect, const char *string,
uint32 wlook, uint32 wfeel, uint32 wflags,
ServerApp *winapp, port_id winport,
port_id looperPort, port_id replyport, uint32 index,
int32 handlerID);
~ServerWindow(void);
ServerWindow(BRect rect, const char *string, uint32 wlook, uint32 wfeel,
uint32 wflags, ServerApp *winapp, port_id winport,
port_id looperPort, port_id replyport, uint32 index,int32 handlerID);
~ServerWindow(void);
void ReplaceDecorator(void);
void Quit(void);
const char* GetTitle(void);
ServerApp* GetApp(void);
void Show(void);
void Hide(void);
bool IsHidden(void);
void Minimize(bool status);
void Zoom(void);
void SetFocus(bool value);
bool HasFocus(void);
void RequestDraw(BRect rect);
void RequestDraw(void);
void WorkspaceActivated(int32 workspace, bool active);
void WorkspacesChanged(int32 oldone,int32 newone);
void WindowActivated(bool active);
void ScreenModeChanged(const BRect frame, const color_space cspace);
void SetFrame(const BRect &rect);
BRect Frame(void);
status_t Lock(void);
void Unlock(void);
bool IsLocked(void);
void DispatchMessage(PortMessage msg);
void DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer);
static int32 MonitorWin(void *data);
static void HandleMouseEvent(PortMessage *msg);
static void HandleKeyEvent(int32 code, int8 *buffer);
//! Returns the index of the workspaces to which it belongs
int32 GetWorkspaceIndex(void) { return _workspace_index; }
Workspace* GetWorkspace(void);
void SetWorkspace(Workspace *wkspc);
void ReplaceDecorator(void);
void Quit(void);
//! Returns the window's title
const char* Title(void) { return _title->String(); }
const char *GetTitle(void);
ServerApp *GetApp(void);
int32 GetLook(void) const { return _look; }
int32 GetFeel(void) const { return _feel; }
int32 GetFlags(void) const { return _flags; }
int32 GetHandlerID(void) const { return _handlertoken; }
//! Returns the index of the workspaces to which it belongs
uint32 GetWorkspaces(void) const { return _workspaces; }
Layer* FindLayer(const Layer* start, int32 token) const;
void SendMessageToClient( const BMessage* msg ) const;
team_id GetClientTeamID(void) const { return fClientTeamID; }
FMWList *GetFMWList(void) { return &fWinFMWList; }
void SetLook(int32 look);
void SetFeel(int32 feel);
void SetFlags(int32 flags);
void SetWorkspaces(int32 workspaces);
void Show(void);
void Hide(void);
bool IsHidden(void);
void Minimize(bool status);
void Zoom(void);
void SetFocus(bool value);
bool HasFocus(void);
void RequestDraw(BRect rect);
void RequestDraw(void);
void WorkspaceActivated(int32 workspace, bool active);
void WorkspacesChanged(int32 oldone,int32 newone);
void WindowActivated(bool active);
void ScreenModeChanged(const BRect frame, const color_space cspace);
void SetFrame(const BRect &rect);
BRect Frame(void);
status_t Lock(void);
void Unlock(void);
bool IsLocked(void);
void DispatchMessage(PortMessage msg);
void DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer);
static int32 MonitorWin(void *data);
static void HandleMouseEvent(PortMessage *msg);
static void HandleKeyEvent(int32 code, int8 *buffer);
// Workspace* GetWorkspace(void);
void SetWorkspace(Workspace *wkspc);
//! Returns the window's title
const char *Title(void) { return _title->String(); }
Layer* FindLayer(const Layer* start, int32 token) const;
void SendMessageToClient( const BMessage* msg ) const;
protected:
friend class ServerApp;
@@ -120,39 +134,38 @@ protected:
friend class Screen;
friend class Layer;
BString *_title;
int32 _look,
_feel,
_flags;
uint32 _workspace_index;
Workspace *_workspace;
bool _active;
BString *_title;
int32 _look,
_feel,
_flags;
uint32 _workspaces;
Workspace *_workspace;
bool _active;
ServerApp *_app;
WinBorder *_winborder;
ServerApp *_app;
WinBorder *_winborder;
thread_id _monitorthread;
port_id _receiver; // Messages from window
port_id _sender; // Messages to window
PortLink *_winlink,
*_applink;
BLocker _locker;
BRect _frame;
uint32 _token;
int32 _handlertoken;
thread_id _monitorthread;
port_id _receiver; // Messages from window
port_id _sender; // Messages to window
PortLink *_winlink,
*_applink;
BLocker _locker;
BRect _frame;
uint32 _token;
int32 _handlertoken;
port_id winLooperPort;
Layer *top_layer;
Layer *cl; // short for currentLayer. We'll use it a lot, that's why it's short :-)
port_id winLooperPort;
Layer *top_layer;
Layer *currentlayer;
FMWList fWinFMWList;
team_id fClientTeamID;
};
void ActivateWindow(ServerWindow *oldwin,ServerWindow *newwin);
#endif
/*
@log
* added Layer as a friend.
* added a new member: port_id winLooperPort; We'll use it to send flattened BMessages(like _UPDATE_ / B_VIEW_RESIZED(MOVED)) to our BWindow counterpart.
* SendMessageToClient( BMessage ) sends that message BWindow's looper port.
*/
+171
View File
@@ -36,6 +36,7 @@
#include <BitmapStream.h>
#include <File.h>
#include <Entry.h>
#include <Screen.h>
#include <TranslatorRoster.h>
#include "Angle.h"
@@ -572,6 +573,45 @@ void ViewDriver::Shutdown(void)
Unlock();
}
void ViewDriver::SetMode(const display_mode &mode)
{
screenwin->Lock();
BBitmap *tempbmp=new BBitmap(BRect(0,0,mode.virtual_width-1,mode.virtual_height-1),
(color_space)mode.space,true);
if(!tempbmp)
return;
if(!tempbmp->IsValid())
{
delete tempbmp;
return;
}
delete framebuffer;
// don't forget to update the internal vars!
_SetWidth(mode.virtual_width);
_SetHeight(mode.virtual_height);
_SetMode(mode.space);
screenwin->view->viewbmp=tempbmp;
framebuffer=screenwin->view->viewbmp;
drawview=new BView(framebuffer->Bounds(),"drawview",B_FOLLOW_ALL, B_WILL_DRAW);
framebuffer->AddChild(drawview);
framebuffer->Lock();
drawview->SetHighColor(workspace_default_color.GetColor32());
drawview->FillRect(drawview->Bounds());
drawview->Sync();
framebuffer->Unlock();
_SetBytesPerRow(framebuffer->BytesPerRow());
screenwin->view->Invalidate();
screenwin->Unlock();
}
void ViewDriver::SetMode(int32 space)
{
screenwin->Lock();
@@ -2062,3 +2102,134 @@ rgb_color ViewDriver::GetBlitColor(rgb_color src, rgb_color dest, LayerData *d,
}
return returncolor;
}
status_t ViewDriver::SetDPMSMode(const uint32 &state)
{
// TODO: Implement software DPMS
return B_ERROR;
}
uint32 ViewDriver::DPMSMode(void) const
{
// TODO: Implement software DPMS
return B_DPMS_ON;
}
uint32 ViewDriver::DPMSCapabilities(void) const
{
// TODO: Implement software DPMS
return B_DPMS_ON;
}
status_t ViewDriver::GetDeviceInfo(accelerant_device_info *info)
{
if(!info)
return B_ERROR;
// We really don't have to provide anything here because this is strictly
// a software-only driver, but we'll have some fun, anyway.
info->version=100;
sprintf(info->name,"OpenBeOS ViewDriver");
sprintf(info->chipset,"OpenBeOS Chipset");
sprintf(info->serial_no,"3.14159265358979323846");
info->memory=134217728; // 128 MB, not that we really have that much. :)
info->dac_speed=0xFFFFFFFF; // *heh*
return B_OK;
}
status_t ViewDriver::GetModeList(display_mode **modes, uint32 *count)
{
if(!count)
return B_ERROR;
screenwin->Lock();
// TODO: Figure out good timing values to be returned in each of the modes
// supported.
*modes=new display_mode[13];
*count=13;
modes[0]->virtual_width=640;
modes[0]->virtual_width=480;
modes[0]->space=B_CMAP8;
modes[1]->virtual_width=640;
modes[1]->virtual_width=480;
modes[1]->space=B_RGB16;
modes[2]->virtual_width=640;
modes[2]->virtual_width=480;
modes[2]->space=B_RGB32;
modes[3]->virtual_width=640;
modes[3]->virtual_width=480;
modes[3]->space=B_RGBA32;
modes[4]->virtual_width=800;
modes[4]->virtual_width=600;
modes[4]->space=B_CMAP8;
modes[5]->virtual_width=800;
modes[5]->virtual_width=600;
modes[5]->space=B_RGB16;
modes[6]->virtual_width=800;
modes[6]->virtual_width=600;
modes[6]->space=B_RGB32;
modes[7]->virtual_width=1024;
modes[7]->virtual_width=768;
modes[7]->space=B_CMAP8;;
modes[8]->virtual_width=1024;
modes[8]->virtual_width=768;
modes[8]->space=B_RGB16;
modes[9]->virtual_width=1024;
modes[9]->virtual_width=768;
modes[9]->space=B_RGB32;
modes[10]->virtual_width=1152;
modes[10]->virtual_width=864;
modes[10]->space=B_CMAP8;
modes[11]->virtual_width=1152;
modes[11]->virtual_width=864;
modes[11]->space=B_RGB16;
modes[12]->virtual_width=1152;
modes[12]->virtual_width=864;
modes[12]->space=B_RGB32;
for(int32 i=0; i<13; i++)
{
modes[i]->h_display_start=0;
modes[i]->v_display_start=0;
modes[i]->flags=B_PARALLEL_ACCESS;
}
screenwin->Unlock();
return B_OK;
}
status_t ViewDriver::GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high)
{
return B_ERROR;
}
status_t ViewDriver::GetTimingConstraints(display_timing_constraints *dtc)
{
return B_ERROR;
}
status_t ViewDriver::ProposeMode(display_mode *candidate, const display_mode *low, const display_mode *high)
{
// TODO: Unhack
// We should be able to get away with this because we're not dealing with any
// specific hardware. This is a Good Thing(TM) because we can support any hardware
// we wish within reasbonable expectaions and programmer laziness. :P
return B_OK;
}
status_t ViewDriver::WaitForRetrace(bigtime_t timeout=B_INFINITE_TIMEOUT)
{
// Locking shouldn't be necessary here - R5 should handle this for us. :)
BScreen screen;
return screen.WaitForRetrace(timeout);
}
+14 -1
View File
@@ -126,7 +126,7 @@ public:
// void SetDrawingMode(drawing_mode mode);
void ShowCursor(void);
virtual void FillArc(const BRect r, float angle, float span, RGBColor& color);
virtual void FillArc(const BRect r, float angle, float span, RGBColor& color);
virtual void FillArc(const BRect r, float angle, float span, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void FillBezier(BPoint *pts, RGBColor& color);
virtual void FillBezier(BPoint *pts, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
@@ -162,10 +162,23 @@ virtual void FillArc(const BRect r, float angle, float span, RGBColor& color);
virtual void StrokeLineArray(BPoint *pts, int32 numlines, float pensize, RGBColor *colors);
void SetMode(int32 mode);
void SetMode(const display_mode &mode);
float StringWidth(const char *string, int32 length, LayerData *d);
float StringHeight(const char *string, int32 length, LayerData *d);
bool DumpToFile(const char *path);
VDWindow *screenwin;
virtual status_t SetDPMSMode(const uint32 &state);
virtual uint32 DPMSMode(void) const;
virtual uint32 DPMSCapabilities(void) const;
virtual status_t GetDeviceInfo(accelerant_device_info *info);
virtual status_t GetModeList(display_mode **mode_list, uint32 *count);
virtual status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high);
virtual status_t GetTimingConstraints(display_timing_constraints *dtc);
virtual status_t ProposeMode(display_mode *candidate, const display_mode *low, const display_mode *high);
virtual status_t WaitForRetrace(bigtime_t timeout=B_INFINITE_TIMEOUT);
protected:
void SetLayerData(LayerData *d, bool set_font_data=false);
void BlitMono2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d);
+42 -1
View File
@@ -27,8 +27,10 @@
#include <Region.h>
#include <String.h>
#include <Locker.h>
#include <Region.h>
#include <Debug.h>
#include <TokenSpace.h>
#include "Globals.h"
#include "View.h" // for mouse button defines
#include "ServerWindow.h"
#include "Decorator.h"
@@ -322,9 +324,48 @@ void WinBorder::SetFocus(const bool &active)
_decorator->SetFocus(active);
}
void WinBorder::SetServerFeel(int32 feel)
{
switch(_win->GetFeel())
{
case B_NORMAL_WINDOW_FEEL:
_serverfeel = B_NORMAL_FEEL;
break;
case B_FLOATING_SUBSET_WINDOW_FEEL:
_serverfeel = B_FLOATING_SUBSET_FEEL;
break;
case B_FLOATING_APP_WINDOW_FEEL:
_serverfeel = B_FLOATING_APP_FEEL;
break;
case B_FLOATING_ALL_WINDOW_FEEL:
_serverfeel = B_FLOATING_ALL_FEEL;
break;
case B_MODAL_SUBSET_WINDOW_FEEL:
_serverfeel = B_MODAL_SUBSET_FEEL;
break;
case B_MODAL_APP_WINDOW_FEEL:
_serverfeel = B_MODAL_APP_FEEL;
break;
case B_MODAL_ALL_WINDOW_FEEL:
_serverfeel = B_MODAL_ALL_FEEL;
break;
case B_SYSTEM_LAST:
case B_SYSTEM_FIRST:
// if(_win->ServerTeamID() != _win->ClientTeamID())
// _win->QuietlySetFeel(B_NORMAL_WINDOW_FEEL);
// else
// _serverfeel = _win->GetFeel();
break;
default:
_win->SetFeel(B_NORMAL_WINDOW_FEEL);
_serverfeel = B_NORMAL_FEEL;
break;
}
}
void WinBorder::RebuildRegions( const BRect& r ){
/* WinBorder is a little bit special. It doesn't have a visible region
in which to do its drawings. Instead the whole visible region is split
in witch to do its drawings. Instead the hole visible region is split
between decorator and top_layer.
*/
+63 -53
View File
@@ -38,64 +38,74 @@ class DisplayDriver;
class WinBorder : public Layer
{
public:
WinBorder(const BRect &r, const char *name, const int32 look,
const int32 feel, const int32 flags, ServerWindow *win);
virtual ~WinBorder(void);
virtual void RebuildRegions( const BRect& r );
virtual void Draw(const BRect &r);
virtual void MoveBy(float x, float y);
virtual void ResizeBy(float x, float y);
WinBorder(const BRect &r, const char *name, const int32 look,
const int32 feel, const int32 flags, ServerWindow *win);
virtual ~WinBorder(void);
void MoveToBack();
void MoveToFront();
void MouseDown(int8 *buffer);
void MouseMoved(int8 *buffer);
void MouseUp(int8 *buffer);
void UpdateColors(void);
void UpdateDecorator(void);
void UpdateFont(void);
void UpdateScreen(void);
void SetFocus(const bool &active);
ServerWindow* Window(void) const { return _win; }
Decorator* GetDecorator(void) const { return _decorator; }
virtual void RebuildRegions( const BRect& r );
virtual void Draw(const BRect &r);
virtual void MoveBy(float x, float y);
virtual void ResizeBy(float x, float y);
void SetServerFeel(int32 feel);
int32 GetServerFeel(void) const { return _serverfeel; }
void MoveToBack();
void MoveToFront();
void MouseDown(int8 *buffer);
void MouseMoved(int8 *buffer);
void MouseUp(int8 *buffer);
void UpdateColors(void);
void UpdateDecorator(void);
void UpdateFont(void);
void UpdateScreen(void);
void SetFocus(const bool &active);
ServerWindow* Window(void) const { return _win; }
Decorator* GetDecorator(void) const { return _decorator; }
WinBorder *MainWinBorder(void) const { return fMainWinBorder; }
// Server "private" :-) - should not be used
void SetMainWinBorder(WinBorder *newMain) { fMainWinBorder=newMain; }
protected:
ServerWindow *_win;
//BString *_title;
Decorator *_decorator;
int32 _flags;
BRect _clientframe;
int32 _mbuttons,
_kmodifiers;
BPoint fLastMousePosition;
bool _update;
bool _hresizewin,_vresizewin;
BRegion *fDecFull,
*fDecFullVisible,
*fDecVisible;
/* bool fIsMoving;
bool fIsResizing;
bool fIsClosing;
bool fIsMinimizing;
bool fIsZooming
ServerWindow *_win;
Decorator *_decorator;
int32 _flags;
BRect _clientframe;
int32 _mbuttons,
_kmodifiers;
int32 _serverfeel;
BPoint fLastMousePosition;
bool _update;
bool _hresizewin,_vresizewin;
WinBorder *fMainWinBorder;
BRegion *fDecFull,
*fDecFullVisible,
*fDecVisible;
//BString *_title;
/* bool fIsMoving;
bool fIsResizing;
bool fIsClosing;
bool fIsMinimizing;
bool fIsZooming
*/
};
bool is_moving_window(void);
void set_is_moving_window(bool state);
bool is_resizing_window(void);
void set_is_resizing_window(bool state);
void set_active_winborder(WinBorder *win);
WinBorder* get_active_winborder(void);
void set_is_resizing_window(bool state);
void set_is_sliding_tab(bool state);
bool is_sliding_tab(void);
bool is_moving_window(void);
void set_is_moving_window(bool state);
bool is_resizing_window(void);
void set_is_resizing_window(bool state);
void set_active_winborder(WinBorder *win);
WinBorder *get_active_winborder(void);
void set_is_resizing_window(bool state);
void set_is_sliding_tab(bool state);
bool is_sliding_tab(void);
#endif
File diff suppressed because it is too large Load Diff
+76
View File
@@ -0,0 +1,76 @@
#ifndef _WORKSPACE_H_
#define _WORKSPACE_H_
#include <SupportDefs.h>
#include "RGBColor.h"
class WinBorder;
class RBGColor;
struct ListData{
WinBorder *layerPtr;
ListData *upperItem;
ListData *lowerItem;
};
class Workspace
{
public:
Workspace(const uint32 colorspace,
int32 ID,
const RGBColor& BGColor);
~Workspace();
bool AddLayerPtr(WinBorder* layer);
bool RemoveLayerPtr(WinBorder* layer);
bool SetFocusLayer(WinBorder* layer);
WinBorder* FocusLayer() const;
bool SetFrontLayer(WinBorder* layer);
WinBorder* FrontLayer() const;
void MoveToBack(WinBorder* newLast);
WinBorder* GoToBottomItem(); // the one that's visible.
WinBorder* GoToUpperItem();
WinBorder* GoToTopItem();
WinBorder* GoToLowerItem();
bool GoToItem(WinBorder* layer);
void SetLocalSpace(const uint32 colorspace);
uint32 LocalSpace() const;
void SetBGColor(const RGBColor &c);
RGBColor BGColor(void) const;
int32 ID() const { return fID; }
// void SetFlags(const uint32 flags);
// uint32 Flags(void) const;
// debug methods
void PrintToStream() const;
private:
void InsertItem(ListData* item, ListData* before);
void RemoveItem(ListData* item);
ListData* HasItem(ListData* item);
ListData* HasItem(WinBorder* layer);
ListData* FindPlace(ListData* pref);
void SearchAndSetNewFront(WinBorder* preferred);
void SearchAndSetNewFocus(WinBorder* preferred);
int32 fID;
uint32 fSpace;
// uint32 fFlags;
RGBColor fBGColor;
ListData *fBottomItem, // first visible onscreen
*fTopItem, // the last visible(or covered by other Layers)
*fCurrentItem, // pointer to the currect element in the list
*fFocusItem, // the focus WinBorder - for keyboard events
*fFrontItem; // the one the mouse can bring in front as possible(in its set)
};
#endif