Fixed OS X SDL double buffering issue and mouse dragging.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12139 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2016-12-06 23:21:52 +00:00
parent 307dd033f0
commit 0a1eed150a
3 changed files with 9 additions and 4 deletions

View File

@ -112,9 +112,9 @@ double Fl_PicoSDL_Screen_Driver::wait(double time_to_wait)
Fl::e_y = e.motion.y;
Fl::e_x_root = e.motion.x + window->x();
Fl::e_y_root = e.motion.y + window->y();
if (e.motion.state & SDL_BUTTON_LMASK) Fl::e_state |= FL_BUTTON1; else Fl::e_state &= ~FL_BUTTON1; break;
if (e.motion.state & SDL_BUTTON_MMASK) Fl::e_state |= FL_BUTTON2; else Fl::e_state &= ~FL_BUTTON2; break;
if (e.motion.state & SDL_BUTTON_RMASK) Fl::e_state |= FL_BUTTON3; else Fl::e_state &= ~FL_BUTTON3; break;
if (e.motion.state & SDL_BUTTON_LMASK) Fl::e_state |= FL_BUTTON1; else Fl::e_state &= ~FL_BUTTON1;
if (e.motion.state & SDL_BUTTON_MMASK) Fl::e_state |= FL_BUTTON2; else Fl::e_state &= ~FL_BUTTON2;
if (e.motion.state & SDL_BUTTON_RMASK) Fl::e_state |= FL_BUTTON3; else Fl::e_state &= ~FL_BUTTON3;
if ((e.motion.state & (SDL_BUTTON_LMASK|SDL_BUTTON_MMASK|SDL_BUTTON_RMASK)) == 0 )
Fl::handle(FL_MOVE, window);
else

View File

@ -35,6 +35,7 @@
class FL_EXPORT Fl_PicoSDL_Window_Driver : public Fl_Pico_Window_Driver
{
SDL_Window *pNativeWindow;
SDL_Texture *pNativeTexture;
public:
Fl_PicoSDL_Window_Driver(Fl_Window *win);
virtual ~Fl_PicoSDL_Window_Driver();

View File

@ -76,6 +76,7 @@ Fl_X *Fl_PicoSDL_Window_Driver::makeWindow()
pNativeWindow = SDL_CreateWindow(pWindow->label(), pWindow->x(), pWindow->y(), pWindow->w(), pWindow->h(), 0);
}
x->xid = SDL_CreateRenderer(pNativeWindow, -1, SDL_RENDERER_ACCELERATED);
pNativeTexture = SDL_CreateTexture((SDL_Renderer*)x->xid, SDL_PIXELFORMAT_RGB888, SDL_TEXTUREACCESS_TARGET, w(), h());
x->next = Fl_X::first;
wait_for_expose_value = 0;
pWindow->i = x;
@ -95,6 +96,9 @@ Fl_X *Fl_PicoSDL_Window_Driver::makeWindow()
void Fl_PicoSDL_Window_Driver::draw_end()
{
Fl_X *i = Fl_X::i(pWindow);
SDL_SetRenderTarget((SDL_Renderer*)pWindow->i->xid, 0L);
//SDL_RenderClear((SDL_Renderer*)i->xid);
SDL_RenderCopy((SDL_Renderer*)i->xid, pNativeTexture, 0L, 0L);
SDL_RenderPresent((SDL_Renderer*)i->xid);
}
@ -102,6 +106,7 @@ void Fl_PicoSDL_Window_Driver::draw_end()
void Fl_PicoSDL_Window_Driver::make_current()
{
fl_window = pWindow->i->xid;
SDL_SetRenderTarget((SDL_Renderer*)pWindow->i->xid, pNativeTexture);
}
@ -112,7 +117,6 @@ void Fl_PicoSDL_Window_Driver::show() {
}
//
// End of "$Id$".
//