new desktop management code

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6053 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca 2004-01-13 00:29:47 +00:00
parent 155cec7523
commit 6b19651048
2 changed files with 114 additions and 0 deletions

View File

@ -0,0 +1,78 @@
#include <Accelerant.h>
#include <Point.h>
#include <GraphicsDefs.h>
#include <stdio.h>
#include "Screen.h"
#include "DisplayDriver.h"
Screen::Screen(DisplayDriver *dDriver, BPoint res, uint32 colorspace,
const int32 &ID)
{
fID = ID;
fDDriver = dDriver;
SetResolution(res, colorspace);
}
Screen::~Screen(void){
//printf("~Screen( %ld )\n", fID);
}
void Screen::SetColorSpace(const uint32 &colorspace){
// fDDriver->SetColorSpace(colorspace);
}
uint32 Screen::ColorSpace(void) const{
// return fDDriver->ColorSpace();
}
bool Screen::SupportsResolution(BPoint res, uint32 colorspace){
// TODO: remove/improve
return true;
display_mode *dm = NULL;
uint32 count;
fDDriver->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(BPoint res, 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;
// fDDriver->SetMode(&mode);
return true;
}
BPoint Screen::Resolution() const{
display_mode mode;
// fDDriver->GetMode(&mode);
//TODO: remove!
return BPoint(fDDriver->GetWidth(), fDDriver->GetHeight());
//------------
return BPoint(mode.virtual_width, mode.virtual_height);
}
int32 Screen::ScreenNumber(void) const{
return fID;
}

View File

@ -0,0 +1,36 @@
#ifndef _SCREEN_H_
#define _SCREEN_H_
#include <Point.h>
//#include "DisplayDriver.h"
class DisplayDriver;
class Screen{
public:
Screen(DisplayDriver *dDriver, BPoint res,
uint32 colorspace, const int32 &ID);
Screen(){ ; }
~Screen(void);
void SetColorSpace(const uint32 &colorspace);
uint32 ColorSpace(void) const;
void SetID(int32 ID){ fID = ID; }
// TODO: get/set prototype methods for graphic card features
bool SupportsResolution(BPoint res, uint32 colorspace);
bool SetResolution(BPoint res, uint32 colorspace);
BPoint Resolution() const;
int32 ScreenNumber(void) const;
DisplayDriver* DDriver() const { return fDDriver; }
private:
// TODO: members in witch we should store data.
int32 fID;
DisplayDriver *fDDriver;
};
#endif