.developing fb backend

git-svn-id: svn://ultimatepp.org/upp/trunk@3568 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2011-06-26 22:27:01 +00:00
commit 1b438f125c
8 changed files with 83 additions and 58 deletions

View file

@ -35,5 +35,5 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int nCmdSh
void GuiMainFn_()
#endif
void SetDesktop(Ctrl& desktop);
extern Ctrl *desktop;
void SetDesktop(Ctrl& desktop);
Ctrl *GetDesktop();

View file

@ -10,10 +10,6 @@ void Ctrl::GuiPlatformConstruct()
{
}
void Ctrl::GuiPlatformDestruct()
{
}
void Ctrl::GuiPlatformRemove()
{
}

View file

@ -2,6 +2,7 @@
public:
static void InitFB();
static void DoMouseFB(int event, Point p, int zdelta = 0);
static bool DoKeyFB(dword key, int cnt);
void SetOpen(bool b) { isopen = b; }
void SetTop() { top = new Top; }

View file

@ -2,20 +2,45 @@
NAMESPACE_UPP
#define LLOG(x) LOG(x)
static Point fbmousepos;
Point GetMousePos() {
return fbmousepos;
}
void Ctrl::DoMouseFB(int event, Point p, int zdelta)
{
fbmousepos = p;
int a = event & Ctrl::ACTION;
// if(a == DOWN)
// ClickActivateWnd();
if(a == Ctrl::UP && Ctrl::ignoreclick)
if(a == Ctrl::UP && Ctrl::ignoreclick) {
EndIgnore();
return;
}
else
if(a != Ctrl::DOWN || !ignoreclick)
LOG("Mouse " << p << ' ' << zdelta);
desktop->DispatchMouse(event, p, zdelta);
desktop->PostInput();
if(a == Ctrl::DOWN && ignoreclick)
return;
LLOG("Mouse event: " << event << " position " << p << " zdelta " << zdelta);
Ctrl *desktop = GetDesktop();
if(desktop) {
desktop->DispatchMouse(event, p, zdelta);
desktop->PostInput();
}
// if(a == Ctrl::MOUSEMOVE)
// DoCursorShape();
}
bool Ctrl::DoKeyFB(dword key, int cnt)
{
bool b = DispatchKey(key, cnt);
SyncCaret();
Ctrl *desktop = GetDesktop();
if(desktop)
desktop->PostInput();
return b;
}
END_UPP_NAMESPACE

View file

@ -6,7 +6,7 @@ NAMESPACE_UPP
#define LLOG(x)
Ctrl *desktop;
Ptr<Ctrl> desktop;
ImageBuffer framebuffer;
Vector<Rect> invalid;
@ -19,6 +19,11 @@ void SetDesktop(Ctrl& q)
invalid.Add(framebuffer.GetSize());
}
Ctrl *GetDesktop()
{
return desktop;
}
void Ctrl::InitFB()
{
Ctrl::GlobalBackBuffer();
@ -26,7 +31,6 @@ void Ctrl::InitFB()
framebuffer.Create(1000, 1000);
}
bool Ctrl::IsAlphaSupported()
{
return false;
@ -40,7 +44,8 @@ bool Ctrl::IsCompositedGui()
Vector<Ctrl *> Ctrl::GetTopCtrls()
{
Vector<Ctrl *> ctrl;
ctrl.Add(desktop);
if(desktop)
ctrl.Add(desktop);
return ctrl;
}
@ -292,32 +297,33 @@ void Ctrl::WndEnable0(bool *b)
void Ctrl::SetWndFocus0(bool *b)
{
GuiLock __;
*b = true;
}
bool Ctrl::HasWndFocus() const
{
GuiLock __;
return false;
return focusCtrl && focusCtrl->GetTopCtrl() == this;
}
bool Ctrl::SetWndCapture()
{
GuiLock __;
ASSERT(IsMainThread());
return false;
return true;
}
bool Ctrl::ReleaseWndCapture()
{
GuiLock __;
ASSERT(IsMainThread());
return false;
return true;
}
bool Ctrl::HasWndCapture() const
{
GuiLock __;
return false;
return captureCtrl && captureCtrl->GetTopCtrl() == this;
}
void Ctrl::WndInvalidateRect0(const Rect& r)