Fixed definition of glutBitmapWidth to match header file.
Does not turn visible() on when a window is iconized() or if a modal window is shown and it's parent is iconized. This allows the code "while (w->visible() && w->damage()) Fl::check();" to reliably wait for the window to be mapped and drawn the first time. Some comments added to Fl_win32.cxx to explain how the WM_PAINT works. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1085 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
9e3610c75f
commit
4edd134933
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_win32.cxx,v 1.33.2.22 2000/03/05 06:51:06 bill Exp $"
|
||||
// "$Id: Fl_win32.cxx,v 1.33.2.23 2000/04/25 07:48:04 bill Exp $"
|
||||
//
|
||||
// WIN32-specific code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -434,14 +434,19 @@ static Fl_Window* resize_bug_fix;
|
||||
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static char buffer[2];
|
||||
static int cnt=0;
|
||||
|
||||
#if 0
|
||||
// Not sure what this is, it may be left over from earlier attempts to
|
||||
// treat WM_PAINT as an expose event, rather than painting in response
|
||||
// to it.
|
||||
static int cnt=0;
|
||||
if(uMsg == WM_SYNCPAINT) {
|
||||
if(cnt) {
|
||||
InvalidateRect(fl_window,0,FALSE);
|
||||
cnt = 0;
|
||||
} else cnt = 1;
|
||||
} else if (uMsg == WM_PAINT) cnt = 0;
|
||||
#endif
|
||||
|
||||
fl_msg.message = uMsg;
|
||||
|
||||
@ -458,16 +463,13 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
|
||||
|
||||
case WM_PAINT: {
|
||||
|
||||
// This might be a better alternative, where we fully ignore NT's
|
||||
// "facilities" for painting. MS expects applications to paint according
|
||||
// to a very restrictive paradigm, and this is the way I found of
|
||||
// working around it. In a sense, we are using WM_PAINT simply as an
|
||||
// "exposure alert", like the X event.
|
||||
|
||||
Fl_X *i = Fl_X::i(window);
|
||||
i->wait_for_expose = 0;
|
||||
// if region == entire window we should delete i->region, else
|
||||
// We need to merge this damage into fltk's damage. I do this in
|
||||
// reverse, telling Win32 about fltk's damage and then reading back
|
||||
// the new accumulated region.
|
||||
if (window->damage()) {
|
||||
// If there is no region the entire window is damaged
|
||||
if (i->region) {
|
||||
InvalidateRgn(hWnd,i->region,FALSE);
|
||||
GetUpdateRgn(hWnd,i->region,0);
|
||||
@ -477,10 +479,14 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
|
||||
GetUpdateRgn(hWnd,i->region,0);
|
||||
}
|
||||
window->clear_damage(window->damage()|FL_DAMAGE_EXPOSE);
|
||||
// These next two statements should not be here, so that all update
|
||||
// is deferred until Fl::flush() is called during idle. However Win32
|
||||
// apparently is very unhappy if we don't obey it and draw right now.
|
||||
// Very annoying!
|
||||
i->flush();
|
||||
window->clear_damage();
|
||||
// This convinces MSWindows we have painted whatever they wanted
|
||||
// us to paint, and stops it from sending WM_PAINT messages.
|
||||
// us to paint, and stops it from sending WM_PAINT messages:
|
||||
ValidateRgn(hWnd,NULL);
|
||||
} break;
|
||||
|
||||
@ -511,8 +517,9 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
|
||||
break;
|
||||
|
||||
case WM_SHOWWINDOW:
|
||||
if (!window->parent())
|
||||
if (!window->parent()) {
|
||||
Fl::handle(wParam ? FL_SHOW : FL_HIDE, window);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
@ -753,6 +760,8 @@ Fl_X* Fl_X::make(Fl_Window* w) {
|
||||
int wp = w->w();
|
||||
int hp = w->h();
|
||||
|
||||
int showit = 1;
|
||||
|
||||
if (w->parent()) {
|
||||
style |= WS_CHILD;
|
||||
styleEx |= WS_EX_WINDOWEDGE | WS_EX_CONTROLPARENT;
|
||||
@ -802,6 +811,7 @@ Fl_X* Fl_X::make(Fl_Window* w) {
|
||||
Fl_Window* w = Fl_X::first->w;
|
||||
while (w->parent()) w = w->window();
|
||||
parent = fl_xid(w);
|
||||
if (!w->visible()) showit = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -824,14 +834,16 @@ Fl_X* Fl_X::make(Fl_Window* w) {
|
||||
Fl_X::first = x;
|
||||
|
||||
x->wait_for_expose = 1;
|
||||
w->set_visible();
|
||||
w->handle(FL_SHOW); // get child windows to appear
|
||||
w->redraw(); // force draw to happen
|
||||
if (fl_show_iconic) {showit = 0; fl_show_iconic = 0;}
|
||||
if (showit) {
|
||||
w->set_visible();
|
||||
w->handle(FL_SHOW); // get child windows to appear
|
||||
w->redraw(); // force draw to happen
|
||||
}
|
||||
// If we've captured the mouse, we dont want do activate any
|
||||
// other windows from the code, or we loose the capture.
|
||||
ShowWindow(x->xid, fl_show_iconic ? SW_SHOWMINNOACTIVE :
|
||||
fl_capture? SW_SHOWNOACTIVATE : SW_SHOWNORMAL);
|
||||
fl_show_iconic = 0;
|
||||
ShowWindow(x->xid, !showit ? SW_SHOWMINNOACTIVE :
|
||||
fl_capture? SW_SHOWNOACTIVATE : SW_SHOWNORMAL);
|
||||
if (w->modal()) {Fl::modal_ = w; fl_fix_focus();}
|
||||
return x;
|
||||
}
|
||||
@ -954,5 +966,5 @@ void Fl_Window::make_current() {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_win32.cxx,v 1.33.2.22 2000/03/05 06:51:06 bill Exp $".
|
||||
// End of "$Id: Fl_win32.cxx,v 1.33.2.23 2000/04/25 07:48:04 bill Exp $".
|
||||
//
|
||||
|
||||
15
src/Fl_x.cxx
15
src/Fl_x.cxx
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_x.cxx,v 1.24.2.13 2000/02/23 09:23:53 bill Exp $"
|
||||
// "$Id: Fl_x.cxx,v 1.24.2.14 2000/04/25 07:48:06 bill Exp $"
|
||||
//
|
||||
// X specific code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -684,9 +684,7 @@ void Fl_X::make_xid(Fl_Window* w, XVisualInfo *visual, Colormap colormap)
|
||||
InputOutput,
|
||||
visual->visual,
|
||||
mask, &attr));
|
||||
w->set_visible();
|
||||
w->handle(FL_SHOW); // get child windows to appear
|
||||
w->redraw();
|
||||
int showit = 1;
|
||||
|
||||
if (!w->parent() && !attr.override_redirect) {
|
||||
// Communicate all kinds 'o junk to the X Window Manager:
|
||||
@ -719,6 +717,7 @@ void Fl_X::make_xid(Fl_Window* w, XVisualInfo *visual, Colormap colormap)
|
||||
Fl_Window* w = x->next->w;
|
||||
while (w->parent()) w = w->window();
|
||||
XSetTransientForHint(fl_display, x->xid, fl_xid(w));
|
||||
if (!w->visible()) showit = 0; // guess that wm will not show it
|
||||
}
|
||||
|
||||
XWMHints hints;
|
||||
@ -728,6 +727,7 @@ void Fl_X::make_xid(Fl_Window* w, XVisualInfo *visual, Colormap colormap)
|
||||
hints.flags |= StateHint;
|
||||
hints.initial_state = IconicState;
|
||||
fl_show_iconic = 0;
|
||||
showit = 0;
|
||||
}
|
||||
if (w->icon()) {
|
||||
hints.icon_pixmap = (Pixmap)w->icon();
|
||||
@ -737,6 +737,11 @@ void Fl_X::make_xid(Fl_Window* w, XVisualInfo *visual, Colormap colormap)
|
||||
}
|
||||
|
||||
XMapWindow(fl_display, x->xid);
|
||||
if (showit) {
|
||||
w->set_visible();
|
||||
w->handle(FL_SHOW); // get child windows to appear
|
||||
w->redraw();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
@ -884,5 +889,5 @@ void Fl_Window::make_current() {
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_x.cxx,v 1.24.2.13 2000/02/23 09:23:53 bill Exp $".
|
||||
// End of "$Id: Fl_x.cxx,v 1.24.2.14 2000/04/25 07:48:06 bill Exp $".
|
||||
//
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: glut_font.cxx,v 1.4 1999/01/07 19:17:46 mike Exp $"
|
||||
// "$Id: glut_font.cxx,v 1.4.2.1 2000/04/25 07:48:07 bill Exp $"
|
||||
//
|
||||
// GLUT bitmap font routines for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -40,13 +40,13 @@ Glut_Bitmap_Font glutBitmapHelvetica10 = {FL_HELVETICA, 10};
|
||||
Glut_Bitmap_Font glutBitmapHelvetica12 = {FL_HELVETICA, 12};
|
||||
Glut_Bitmap_Font glutBitmapHelvetica18 = {FL_HELVETICA, 18};
|
||||
|
||||
void glutBitmapCharacter(void *font, int character) {
|
||||
void glutBitmapCharacter(void* font, int character) {
|
||||
gl_font(((Glut_Bitmap_Font *)font)->font,((Glut_Bitmap_Font *)font)->size);
|
||||
char a[1]; a[0] = character;
|
||||
gl_draw(a,1);
|
||||
}
|
||||
|
||||
int glutBitmapWidth(int font, int character) {
|
||||
int glutBitmapWidth(void* font, int character) {
|
||||
gl_font(((Glut_Bitmap_Font *)font)->font,((Glut_Bitmap_Font *)font)->size);
|
||||
return int(gl_width(character)+.5);
|
||||
}
|
||||
@ -54,5 +54,5 @@ int glutBitmapWidth(int font, int character) {
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id: glut_font.cxx,v 1.4 1999/01/07 19:17:46 mike Exp $".
|
||||
// End of "$Id: glut_font.cxx,v 1.4.2.1 2000/04/25 07:48:07 bill Exp $".
|
||||
//
|
||||
|
||||
Loading…
Reference in New Issue
Block a user