]> git.tdb.fi Git - libs/gui.git/blobdiff - source/gbase/glcontext.cpp
Hide the platform-specific parts of other classes as well
[libs/gui.git] / source / gbase / glcontext.cpp
index 4783e0cbc995c0eee85908e4e63f7ab76a0333fc..6e02018b897ca013ee71079fc0f915a9869e938b 100644 (file)
@@ -19,8 +19,8 @@ Distributed under the LGPL
 #include <msp/core/except.h>
 #include "display.h"
 #include "glcontext.h"
-#include "types.h"
 #include "window.h"
+#include "display_priv.h"
 
 namespace Msp {
 namespace Graphics {
@@ -59,7 +59,7 @@ GLContext::GLContext(Window &wnd, const GLOptions &opts):
        priv=new Private;
 
 #ifdef WIN32
-       HDC dc=GetDC(window.get_handle());
+       HDC dc=GetDC(window.get_private().window);
 
        PIXELFORMATDESCRIPTOR pfd;
        memset(&pfd, 0, sizeof(pfd));
@@ -84,7 +84,7 @@ GLContext::GLContext(Window &wnd, const GLOptions &opts):
        priv->context=wglCreateContext(dc);
        wglMakeCurrent(dc, priv->context);
 
-       ReleaseDC(window.get_handle(), dc);
+       ReleaseDC(window.get_private().window, dc);
 #else
        std::vector<int> attribs;
        
@@ -115,7 +115,7 @@ GLContext::GLContext(Window &wnd, const GLOptions &opts):
        
        attribs.push_back(0);
 
-       ::Display *dpy=display.get_display();
+       ::Display *dpy=display.get_private().display;
 
        XVisualInfo *vi=glXChooseVisual(dpy, DefaultScreen(dpy), &attribs.front());
        if(!vi)
@@ -125,8 +125,8 @@ GLContext::GLContext(Window &wnd, const GLOptions &opts):
        XSetWindowAttributes attr;
        attr.colormap=XCreateColormap(dpy, DefaultRootWindow(dpy), vi->visual, AllocNone);
 
-       priv->subwnd=XCreateWindow(dpy, window.get_handle(), 0, 0, window.get_width(), window.get_height(), 0, vi->depth, InputOutput, vi->visual, CWColormap, &attr);
-       XMapWindow(display.get_display(), priv->subwnd);
+       priv->subwnd=XCreateWindow(dpy, window.get_private().window, 0, 0, window.get_width(), window.get_height(), 0, vi->depth, InputOutput, vi->visual, CWColormap, &attr);
+       XMapWindow(dpy, priv->subwnd);
 
        XFree(vi);
 
@@ -148,7 +148,7 @@ GLContext::~GLContext()
        wglMakeCurrent(0, 0);
        wglDeleteContext(priv->context);
 #else
-       ::Display *dpy=display.get_display();
+       ::Display *dpy=display.get_private().display;
 
        glXMakeCurrent(dpy, 0, 0);
        glXDestroyContext(dpy, priv->context);
@@ -162,11 +162,11 @@ void GLContext::swap_buffers()
 {
 #ifdef WITH_OPENGL
 #ifdef WIN32
-       HDC dc=GetDC(window.get_handle());
+       HDC dc=GetDC(window.get_private().window);
        SwapBuffers(dc);
-       ReleaseDC(window.get_handle(), dc);
+       ReleaseDC(window.get_private().window, dc);
 #else
-       glXSwapBuffers(display.get_display(), priv->subwnd);
+       glXSwapBuffers(display.get_private().display, priv->subwnd);
 #endif
 #endif
 }
@@ -175,7 +175,7 @@ void GLContext::window_resized(unsigned w, unsigned h)
 {
 #ifdef WITH_OPENGL
 #ifndef WIN32
-       XMoveResizeWindow(display.get_display(), priv->subwnd, 0, 0, w, h);
+       XMoveResizeWindow(display.get_private().display, priv->subwnd, 0, 0, w, h);
 #endif
        glViewport(0, 0, w, h);
 #else