diff --git a/include/Mw/GDI.h b/include/Mw/GDI.h index 0bf97a1..a61c600 100644 --- a/include/Mw/GDI.h +++ b/include/Mw/GDI.h @@ -17,6 +17,7 @@ struct _MwLL { HWND hWnd; HDC hDC; void* user; + int copy_buffer; MwLLHandler handler; }; diff --git a/include/Mw/X11.h b/include/Mw/X11.h index 709f6a1..3a0e961 100644 --- a/include/Mw/X11.h +++ b/include/Mw/X11.h @@ -24,6 +24,7 @@ struct _MwLL { Colormap colormap; void* user; Atom wm_delete; + int copy_buffer; unsigned int width; unsigned int height; diff --git a/src/gdi.c b/src/gdi.c index c422f9a..7e695c7 100644 --- a/src/gdi.c +++ b/src/gdi.c @@ -28,9 +28,11 @@ static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { u->ll->hDC = hbdc; MwLLDispatch(u->ll, draw); - dc = BeginPaint(hWnd, &ps); - StretchBlt(dc, 0, 0, rc.right - rc.left, rc.bottom - rc.top, hbdc, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SRCCOPY); - EndPaint(hWnd, &ps); + if(u->ll->copy_buffer) { + dc = BeginPaint(hWnd, &ps); + StretchBlt(dc, 0, 0, rc.right - rc.left, rc.bottom - rc.top, hbdc, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SRCCOPY); + EndPaint(hWnd, &ps); + } DeleteDC(hbdc); DeleteObject(hbmp); @@ -82,7 +84,8 @@ MwLL MwLLCreate(MwLL parent, int x, int y, int width, int height) { RegisterClassEx(&wc); - r->hWnd = CreateWindow(parent == NULL ? "milsko" : "STATIC", "Milsko", parent == NULL ? (WS_OVERLAPPEDWINDOW) : (WS_CHILD | WS_VISIBLE), x, y, width, height, parent == NULL ? NULL : parent->hWnd, 0, wc.hInstance, NULL); + r->copy_buffer = 1; + r->hWnd = CreateWindow(parent == NULL ? "milsko" : "STATIC", "Milsko", parent == NULL ? (WS_OVERLAPPEDWINDOW) : (WS_CHILD | WS_VISIBLE), x, y, width, height, parent == NULL ? NULL : parent->hWnd, 0, wc.hInstance, NULL); u->ll = r; if(parent == NULL) { diff --git a/src/opengl.c b/src/opengl.c index 0cbfa2a..dc5b0ec 100644 --- a/src/opengl.c +++ b/src/opengl.c @@ -52,7 +52,8 @@ static void create(MwWidget handle) { o->visual = glXChooseVisual(handle->lowlevel->display, DefaultScreen(handle->lowlevel->display), attribs); o->gl = glXCreateContext(handle->lowlevel->display, o->visual, NULL, GL_TRUE); #endif - handle->internal = o; + handle->internal = o; + handle->lowlevel->copy_buffer = 0; MwSetDefault(handle); } diff --git a/src/x11.c b/src/x11.c index 7b80ea4..808aec2 100644 --- a/src/x11.c +++ b/src/x11.c @@ -34,7 +34,8 @@ MwLL MwLLCreate(MwLL parent, int x, int y, int width, int height) { r->display = parent->display; p = parent->window; } - r->window = XCreateSimpleWindow(r->display, p, x, y, width, height, 0, 0, WhitePixel(r->display, XDefaultScreen(r->display))); + r->window = XCreateSimpleWindow(r->display, p, x, y, width, height, 0, 0, WhitePixel(r->display, XDefaultScreen(r->display))); + r->copy_buffer = 1; r->width = width; r->height = height; @@ -168,7 +169,7 @@ void MwLLNextEvent(MwLL handle) { MwLLGetXYWH(handle, &x, &y, &w, &h); MwLLDispatch(handle, draw); - XCopyArea(handle->display, handle->pixmap, handle->window, handle->gc, 0, 0, w, h, 0, 0); + if(handle->copy_buffer) XCopyArea(handle->display, handle->pixmap, handle->window, handle->gc, 0, 0, w, h, 0, 0); } } }