diff options
author | David Robillard <d@drobilla.net> | 2019-10-27 13:18:57 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-11-03 21:03:18 +0100 |
commit | c75c10d2385aaa1bbf7d8f5ae437ccd5d1e3803f (patch) | |
tree | 9dace3da383ca1edcc01118f8447f17b0eb52395 /pugl/detail/win.c | |
parent | 3c9a8a2ed86d08da842e11d32065da43b5bfdc77 (diff) | |
download | pugl-c75c10d2385aaa1bbf7d8f5ae437ccd5d1e3803f.tar.gz pugl-c75c10d2385aaa1bbf7d8f5ae437ccd5d1e3803f.tar.bz2 pugl-c75c10d2385aaa1bbf7d8f5ae437ccd5d1e3803f.zip |
Expose functional stub backend
Diffstat (limited to 'pugl/detail/win.c')
-rw-r--r-- | pugl/detail/win.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/pugl/detail/win.c b/pugl/detail/win.c index 408e7ba..b9004b2 100644 --- a/pugl/detail/win.c +++ b/pugl/detail/win.c @@ -21,6 +21,7 @@ #include "pugl/detail/implementation.h" #include "pugl/detail/win.h" #include "pugl/pugl.h" +#include "pugl/pugl_stub_backend.h" #include <windows.h> #include <windowsx.h> @@ -927,3 +928,40 @@ puglSetClipboard(PuglView* const view, CloseClipboard(); return PUGL_SUCCESS; } + +static PuglStatus +puglWinStubEnter(PuglView* view, bool drawing) +{ + if (drawing) { + PAINTSTRUCT ps; + BeginPaint(view->impl->hwnd, &ps); + } + + return PUGL_SUCCESS; +} + +static PuglStatus +puglWinStubLeave(PuglView* view, bool drawing) +{ + if (drawing) { + PAINTSTRUCT ps; + EndPaint(view->impl->hwnd, &ps); + SwapBuffers(view->impl->hdc); + } + + return PUGL_SUCCESS; +} + +const PuglBackend* +puglStubBackend(void) +{ + static const PuglBackend backend = {puglWinStubConfigure, + puglStubCreate, + puglStubDestroy, + puglWinStubEnter, + puglWinStubLeave, + puglStubResize, + puglStubGetContext}; + + return &backend; +} |