mirror of
https://github.com/fltk/fltk.git
synced 2026-05-30 21:25:30 +08:00
Fix OpenGL resize bug some more - still have an outstanding issue with
the parent window not setting its xywh members until after the children have resized... git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2960 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+38
-20
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.18 2003/03/31 17:27:35 easysw Exp $"
|
// "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.19 2003/03/31 18:23:53 easysw Exp $"
|
||||||
//
|
//
|
||||||
// OpenGL window code for the Fast Light Tool Kit (FLTK).
|
// OpenGL window code for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@@ -124,22 +124,31 @@ int Fl_Gl_Window::mode(int m, const int *a) {
|
|||||||
#define NON_LOCAL_CONTEXT 0x80000000
|
#define NON_LOCAL_CONTEXT 0x80000000
|
||||||
|
|
||||||
void Fl_Gl_Window::make_current() {
|
void Fl_Gl_Window::make_current() {
|
||||||
|
// puts("Fl_Gl_Window::make_current()");
|
||||||
|
// printf("make_current: context_=%p\n", context_);
|
||||||
if (!context_) {
|
if (!context_) {
|
||||||
mode_ &= ~NON_LOCAL_CONTEXT;
|
mode_ &= ~NON_LOCAL_CONTEXT;
|
||||||
context_ = fl_create_gl_context(this, g);
|
context_ = fl_create_gl_context(this, g);
|
||||||
valid(0);
|
valid(0);
|
||||||
|
|
||||||
#ifdef __APPLE__
|
//#ifdef __APPLE__
|
||||||
if (window()) {
|
// GLint xywh[4];
|
||||||
GLint xywh[4];
|
//
|
||||||
xywh[0] = x();
|
// if (parent() && parent()->window()) {
|
||||||
xywh[1] = window()->h() - y() - h();
|
// xywh[0] = x();
|
||||||
xywh[2] = w();
|
// xywh[1] = parent()->window()->h() - y() - h();
|
||||||
xywh[3] = h();
|
// } else {
|
||||||
aglSetInteger(context_, AGL_BUFFER_RECT, xywh);
|
// xywh[0] = 0;
|
||||||
aglUpdateContext(context_);
|
// xywh[1] = 0;
|
||||||
}
|
// }
|
||||||
#endif // __APPLE__
|
//
|
||||||
|
// xywh[2] = w();
|
||||||
|
// xywh[3] = h();
|
||||||
|
// aglSetInteger(context_, AGL_BUFFER_RECT, xywh);
|
||||||
|
// printf("make_current: xywh=[%d %d %d %d]\n", xywh[0], xywh[1], xywh[2], xywh[3]);
|
||||||
|
//
|
||||||
|
// aglUpdateContext(context_);
|
||||||
|
//#endif // __APPLE__
|
||||||
}
|
}
|
||||||
fl_set_gl_context(this, context_);
|
fl_set_gl_context(this, context_);
|
||||||
#if defined(WIN32) && USE_COLORMAP
|
#if defined(WIN32) && USE_COLORMAP
|
||||||
@@ -326,18 +335,27 @@ void Fl_Gl_Window::flush() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Fl_Gl_Window::resize(int X,int Y,int W,int H) {
|
void Fl_Gl_Window::resize(int X,int Y,int W,int H) {
|
||||||
|
// printf("Fl_Gl_Window::resize(X=%d, Y=%d, W=%d, H=%d)\n", X, Y, W, H);
|
||||||
if (W != w() || H != h()) {
|
if (W != w() || H != h()) {
|
||||||
valid(0);
|
valid(0);
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
GLint xywh[4];
|
||||||
|
|
||||||
if (window()) {
|
if (window()) {
|
||||||
GLint xywh[4];
|
// MRS: This isn't quite right, but the parent window won't have its W and H updated yet...
|
||||||
xywh[0] = X;
|
xywh[0] = x();
|
||||||
xywh[1] = window()->h() - Y - H;
|
xywh[1] = window()->h() - y() - h();
|
||||||
xywh[2] = W;
|
} else {
|
||||||
xywh[3] = H;
|
xywh[0] = 0;
|
||||||
aglSetInteger(context_, AGL_BUFFER_RECT, xywh);
|
xywh[1] = 0;
|
||||||
aglUpdateContext(context_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xywh[2] = W;
|
||||||
|
xywh[3] = H;
|
||||||
|
aglSetInteger(context_, AGL_BUFFER_RECT, xywh);
|
||||||
|
// printf("resize: xywh=[%d %d %d %d]\n", xywh[0], xywh[1], xywh[2], xywh[3]);
|
||||||
|
|
||||||
|
aglUpdateContext(context_);
|
||||||
#elif !defined(WIN32)
|
#elif !defined(WIN32)
|
||||||
if (!resizable() && overlay && overlay != this)
|
if (!resizable() && overlay && overlay != this)
|
||||||
((Fl_Gl_Window*)overlay)->resize(0,0,W,H);
|
((Fl_Gl_Window*)overlay)->resize(0,0,W,H);
|
||||||
@@ -391,5 +409,5 @@ void Fl_Gl_Window::draw_overlay() {}
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.18 2003/03/31 17:27:35 easysw Exp $".
|
// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.19 2003/03/31 18:23:53 easysw Exp $".
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user