diff options
| author | Manolo Gouy <Manolo> | 2016-04-19 19:37:49 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-04-19 19:37:49 +0000 |
| commit | 1e8a53ecc425cb91c39bdff263192fae2c372edb (patch) | |
| tree | 02943c37fe4e984532109eadb6f752471d76421b /src | |
| parent | 4aa388d4ffb2f62986fb5dc7b06325a4dd0cf56a (diff) | |
Move private_dc from Fl_X for WIN32 platform to Fl_WinAPI_Window_Driver.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11664 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Gl_Choice.cxx | 7 | ||||
| -rw-r--r-- | src/Fl_Gl_Overlay.cxx | 6 | ||||
| -rw-r--r-- | src/Fl_Gl_Window.cxx | 10 | ||||
| -rw-r--r-- | src/Fl_win32.cxx | 2 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx | 2 |
6 files changed, 17 insertions, 11 deletions
diff --git a/src/Fl_Gl_Choice.cxx b/src/Fl_Gl_Choice.cxx index 1ea351e57..6d5e8f6e4 100644 --- a/src/Fl_Gl_Choice.cxx +++ b/src/Fl_Gl_Choice.cxx @@ -29,6 +29,7 @@ # include <FL/fl_utf8.h> #if defined(WIN32) +#include "drivers/WinAPI/Fl_WinAPI_Window_Driver.H" #elif defined(__APPLE__) // PORTME: platform OpenGL management #include "drivers/Cocoa/Fl_Cocoa_Screen_Driver.H" #elif defined(FL_PORTING) @@ -227,9 +228,9 @@ GLContext fl_create_gl_context(XVisualInfo* vis) { GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer) { Fl_X* i = Fl_X::i(window); - HDC hdc = i->private_dc; + HDC hdc = Fl_WinAPI_Window_Driver::driver(window)->private_dc; if (!hdc) { - hdc = i->private_dc = GetDCEx(i->xid, 0, DCX_CACHE); + hdc = Fl_WinAPI_Window_Driver::driver(window)->private_dc = GetDCEx(i->xid, 0, DCX_CACHE); fl_save_dc(i->xid, hdc); SetPixelFormat(hdc, g->pixelformat, (PIXELFORMATDESCRIPTOR*)(&g->pfd)); # if USE_COLORMAP @@ -273,7 +274,7 @@ void fl_set_gl_context(Fl_Window* w, GLContext context) { # if defined(USE_X11) glXMakeCurrent(fl_display, fl_xid(w), context); # elif defined(WIN32) - wglMakeCurrent(Fl_X::i(w)->private_dc, context); + wglMakeCurrent(Fl_WinAPI_Window_Driver::driver(w)->private_dc, context); # elif defined(__APPLE__) // PORTME: platform OpenGL management Fl_Cocoa_Screen_Driver::GLcontext_makecurrent(context); # else diff --git a/src/Fl_Gl_Overlay.cxx b/src/Fl_Gl_Overlay.cxx index d7b5e251d..e82fa22a1 100644 --- a/src/Fl_Gl_Overlay.cxx +++ b/src/Fl_Gl_Overlay.cxx @@ -25,7 +25,9 @@ #include <FL/Fl_Gl_Window.H> #include <stdlib.h> -#if defined(WIN32) || defined(__APPLE__) // PORTME: platform OpenGL management +#if defined(WIN32) // PORTME: platform OpenGL management +#include "drivers/WinAPI/Fl_WinAPI_Window_Driver.H" +#elif defined(__APPLE__) #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement OpenGL hardware overlays if they are availbale in a compatible way. This is rarely needed." #else @@ -148,7 +150,7 @@ void Fl_Gl_Window::make_overlay() { GLContext context = fl_create_gl_context(this, g, 1); if (!context) {overlay = this; return;} // fake the overlay - HDC hdc = Fl_X::i(this)->private_dc; + HDC hdc = Fl_WinAPI_Window_Driver::driver(this)->private_dc; overlay = context; LAYERPLANEDESCRIPTOR pfd; wglDescribeLayerPlane(hdc, g->pixelformat, 1, sizeof(pfd), &pfd); diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx index 241221698..fc8c47c51 100644 --- a/src/Fl_Gl_Window.cxx +++ b/src/Fl_Gl_Window.cxx @@ -32,6 +32,8 @@ extern int fl_gl_load_plugin; #include <OpenGL/OpenGL.h> #include "drivers/Cocoa/Fl_Cocoa_Window_Driver.H" #include "drivers/Cocoa/Fl_Cocoa_Screen_Driver.H" +#elif defined(WIN32) +#include "drivers/WinAPI/Fl_WinAPI_Window_Driver.H" #endif #include <FL/Fl_Gl_Window.H> #include <FL/Fl_Device.H> @@ -257,10 +259,10 @@ void Fl_Gl_Window::swap_buffers() { #elif defined(WIN32) # if HAVE_GL_OVERLAY // Do not swap the overlay, to match GLX: - BOOL ret = wglSwapLayerBuffers(Fl_X::i(this)->private_dc, WGL_SWAP_MAIN_PLANE); + BOOL ret = wglSwapLayerBuffers(Fl_WinAPI_Window_Driver::driver(this)->private_dc, WGL_SWAP_MAIN_PLANE); DWORD err = GetLastError();; # else - SwapBuffers(Fl_X::i(this)->private_dc); + SwapBuffers(Fl_WinAPI_Window_Driver::driver(this)->private_dc); # endif #elif defined(__APPLE_QUARTZ__) // PORTME: platform OpenGL management if(overlay != NULL) { @@ -322,14 +324,14 @@ void Fl_Gl_Window::flush() { && (damage()&(FL_DAMAGE_OVERLAY|FL_DAMAGE_EXPOSE) || !save_valid)) { fl_set_gl_context(this, (GLContext)overlay); if (fl_overlay_depth) - wglRealizeLayerPalette(Fl_X::i(this)->private_dc, 1, TRUE); + wglRealizeLayerPalette(Fl_WinAPI_Window_Driver::driver(this)->private_dc, 1, TRUE); glDisable(GL_SCISSOR_TEST); glClear(GL_COLOR_BUFFER_BIT); fl_overlay = 1; draw_overlay(); fl_overlay = 0; valid_f_ = save_valid_f; - wglSwapLayerBuffers(Fl_X::i(this)->private_dc, WGL_SWAP_OVERLAY1); + wglSwapLayerBuffers(Fl_WinAPI_Window_Driver::driver(this)->private_dc, WGL_SWAP_OVERLAY1); // if only the overlay was damaged we are done, leave main layer alone: if (damage() == FL_DAMAGE_OVERLAY) { return; diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index b30bfde69..49814dd59 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -1801,7 +1801,7 @@ Fl_X* Fl_WinAPI_Window_Driver::makeWindow() { x->w = w; i(x); x->region = 0; - x->private_dc = 0; + Fl_WinAPI_Window_Driver::driver(w)->private_dc = 0; cursor = LoadCursor(NULL, IDC_ARROW); custom_cursor = 0; if (!fl_codepage) fl_get_codepage(); diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H index 775b40f9b..ad4d853f5 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H @@ -69,6 +69,7 @@ public: Fl_WinAPI_Window_Driver(Fl_Window*); ~Fl_WinAPI_Window_Driver(); static inline Fl_WinAPI_Window_Driver* driver(Fl_Window *w) {return (Fl_WinAPI_Window_Driver*)w->driver();} + HDC private_dc; // used for OpenGL struct icon_data *icon_; HCURSOR cursor; diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx index ab4f7a543..c7976afb1 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx @@ -431,7 +431,7 @@ void Fl_WinAPI_Window_Driver::hide() { fl_clipboard_notify_retarget(ip->xid); // Send a message to myself so that I'll get out of the event loop... PostMessage(ip->xid, WM_APP, 0, 0); - if (ip->private_dc) fl_release_dc(ip->xid, ip->private_dc); + if (private_dc) fl_release_dc(ip->xid, private_dc); if (ip->xid == fl_window && fl_graphics_driver->gc()) { fl_release_dc(fl_window, (HDC)fl_graphics_driver->gc()); fl_window = (HWND)-1; |
