.rainbow: SDL20GL

git-svn-id: svn://ultimatepp.org/upp/trunk@6384 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2013-09-29 17:20:45 +00:00
parent bc171f438d
commit 55bc7666e3
5 changed files with 29 additions and 32 deletions

View file

@ -28,7 +28,6 @@ private:
void NewTop() { top = new Top; top->owner_window = NULL; }
void PutForeground();
static void MouseEventFB(Ptr<Ctrl> t, int event, Point p, int zdelta);
Vector<Rect> GetPaintRects();
static void DrawLine(const Vector<Rect>& clip, int x, int y, int cx, int cy, bool horz,
const byte *pattern, int animation);

View file

@ -89,13 +89,4 @@ void FinishDragRect(Ctrl& q)
SDL_GL_SwapWindow(screen.win);
}
Vector<Rect> Ctrl::GetPaintRects() // TODO: Remove(?)
{
Vector<Rect> r;
r.Add(GetScreenRect());
for(int i = max(FindTopCtrl() + 1, 0); i < topctrl.GetCount(); i++)
Subtract(r, topctrl[i]->GetScreenRect());
return r;
}
END_UPP_NAMESPACE

View file

@ -126,6 +126,27 @@ void Ctrl::SetMouseCursor(const Image& image)
}
}
bool Ctrl::ProcessEvent(bool *quit)
{
LLOG("@ ProcessEvent");
ASSERT(IsMainThread());
if(!GetMouseLeft() && !GetMouseRight() && !GetMouseMiddle())
ReleaseCtrlCapture();
SDL_Event event;
if(SDL_PollEvent(&event)) {
if(event.type == SDL_QUIT && quit)
*quit = true;
HandleSDLEvent(&event);
SyncTopWindows();
DefferedFocusSync();
SyncCaret();
SyncTopWindows();
return true;
}
return false;
}
bool Ctrl::ProcessEvents(bool *quit)
{
//LOGBLOCK("@ ProcessEvents");

View file

@ -112,9 +112,16 @@ void HandleSDLEvent(SDL_Event* event)
}
}
break;
case SDL_MOUSEMOTION: //SDL_MouseMotionEvent
case SDL_MOUSEMOTION:
{
SDL_PumpEvents();
SDL_Event next_event;
if(SDL_PeepEvents(&next_event, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) > 0 &&
next_event.type == SDL_MOUSEMOTION)
break; // MouseMove compression
Ctrl::DoMouseFB(Ctrl::MOUSEMOVE, Point(event->motion.x, event->motion.y));
break;
}
case SDL_MOUSEWHEEL: Ctrl::DoMouseFB(Ctrl::MOUSEWHEEL, GetMousePos(), sgn(event->wheel.y) * 120); break;
case SDL_MOUSEBUTTONDOWN: //SDL_MouseButtonEvent, FIXME DoubleClick
{

View file

@ -166,27 +166,6 @@ void Ctrl::SyncTopWindows()
}
}
bool Ctrl::ProcessEvent(bool *quit)
{
LLOG("@ ProcessEvent");
ASSERT(IsMainThread());
if(!GetMouseLeft() && !GetMouseRight() && !GetMouseMiddle())
ReleaseCtrlCapture();
SDL_Event event;
if(SDL_PollEvent(&event)) {
if(event.type == SDL_QUIT && quit)
*quit = true;
HandleSDLEvent(&event);
SyncTopWindows();
DefferedFocusSync();
SyncCaret();
SyncTopWindows();
return true;
}
return false;
}
/*
ViewDraw::ViewDraw(Ctrl *ctrl)
{