diff --git a/examples/gldemos/tripaint.c b/examples/gldemos/tripaint.c index 069315a..11eaffd 100644 --- a/examples/gldemos/tripaint.c +++ b/examples/gldemos/tripaint.c @@ -108,13 +108,14 @@ static void MWAPI mouse_move(MwWidget handle, void* user, void* call) { int main() { MwSizeHints hints; - MwWidget window; + MwWidget window, viewport; MwLibraryInit(); - window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 640, 480, - MwNtitle, "tripaint", - NULL); + window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 640, 480, + MwNtitle, "tripaint", + NULL); + viewport = MwCreateWidget(MwViewportClass, "viewport", window, 5, 5, 630, 470 - 16 - 5); hints.min_width = hints.max_width = 640; hints.min_height = hints.max_height = 480; @@ -126,7 +127,7 @@ int main() { t = malloc(sizeof(*t)); - opengl = MwCreateWidget(MwOpenGLClass, "opengl", window, 0, 0, 640, 460); + opengl = MwCreateWidget(MwOpenGLClass, "opengl", viewport, 0, 0, 1024, 768); MwAddUserHandler(window, MwNtickHandler, tick, NULL); MwAddUserHandler(opengl, MwNtickHandler, tick, NULL); diff --git a/src/widget/opengl.c b/src/widget/opengl.c index 2012a47..5269d62 100644 --- a/src/widget/opengl.c +++ b/src/widget/opengl.c @@ -1,4 +1,3 @@ -#include #ifndef __APPLE__ #include @@ -56,6 +55,7 @@ typedef struct x11opengl { #ifdef USE_WAYLAND #include #include +#include #include typedef void* EGLLabelKHR; @@ -595,8 +595,8 @@ static void func_handler(MwWidget handle, const char* name, void* out, } } -static void frontbuffer_draw(MwWidget handle) { #ifdef USE_WAYLAND +static void frontbuffer_draw(MwWidget handle) { if(handle->lowlevel->common.type == MwLLBackendWayland) { waylandopengl_t* o = handle->internal; MwRect r; @@ -606,9 +606,8 @@ static void frontbuffer_draw(MwWidget handle) { r.height = handle->lowlevel->wayland.wh; MwLLDrawPixmap(handle->lowlevel, &r, o->frontbuffer); } - -#endif } +#endif MwClassRec MwOpenGLClassRec = {wcreate, /* create */ destroy, /* destroy */