summaryrefslogtreecommitdiff
path: root/src/Fl_Gl_Window.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-04-19 13:03:49 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-04-19 13:03:49 +0200
commitebbee5301b975f2afcf22a0649b3ba7724c78089 (patch)
tree89711e685a15efb557c96e8e93d6044fdb7b2f94 /src/Fl_Gl_Window.cxx
parent698fe39ff16df2b7440df3cdbb969cba09798935 (diff)
macOS: simpler handling of GL windows when first displayed.
tested on macOS versions 10.3, 10.6, 10.9, 10.14
Diffstat (limited to 'src/Fl_Gl_Window.cxx')
-rw-r--r--src/Fl_Gl_Window.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx
index dc031d0e6..ee4de475f 100644
--- a/src/Fl_Gl_Window.cxx
+++ b/src/Fl_Gl_Window.cxx
@@ -72,7 +72,7 @@ int Fl_Gl_Window::can_do(int a, const int *b) {
}
void Fl_Gl_Window::show() {
- int need_redraw = 0;
+ int need_after = 0;
if (!shown()) {
if (!g) {
g = pGlWindowDriver->find(mode_,alist);
@@ -86,10 +86,10 @@ void Fl_Gl_Window::show() {
return;
}
}
- pGlWindowDriver->before_show(need_redraw);
+ pGlWindowDriver->before_show(need_after);
}
Fl_Window::show();
- pGlWindowDriver->after_show(need_redraw);
+ if (need_after) pGlWindowDriver->after_show();
}
@@ -513,13 +513,13 @@ Fl_Gl_Window_Driver *Fl_Gl_Window_Driver::newGlWindowDriver(Fl_Gl_Window *w)
return new Fl_Cocoa_Gl_Window_Driver(w);
}
-void Fl_Cocoa_Gl_Window_Driver::before_show(int& need_redraw) {
- if( ! pWindow->parent() ) need_redraw=1;
+void Fl_Cocoa_Gl_Window_Driver::before_show(int& need_after) {
+ need_after = 1;
}
-void Fl_Cocoa_Gl_Window_Driver::after_show(int need_redraw) {
- pWindow->set_visible();
- if(need_redraw) pWindow->redraw();//necessary only after creation of a top-level GL window
+void Fl_Cocoa_Gl_Window_Driver::after_show() {
+ // Makes sure the GL context is created to avoid drawing twice the window when first shown
+ pWindow->make_current();
}
float Fl_Cocoa_Gl_Window_Driver::pixels_per_unit()
@@ -703,7 +703,7 @@ Fl_Gl_Window_Driver *Fl_Gl_Window_Driver::newGlWindowDriver(Fl_Gl_Window *w)
return new Fl_X11_Gl_Window_Driver(w);
}
-void Fl_X11_Gl_Window_Driver::before_show(int& need_redraw) {
+void Fl_X11_Gl_Window_Driver::before_show(int&) {
Fl_X::make_xid(pWindow, g()->vis, g()->colormap);
if (overlay() && overlay() != pWindow) ((Fl_Gl_Window*)overlay())->show();
}