summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FL/Fl_Window.H6
-rw-r--r--src/Fl.cxx33
-rw-r--r--src/Fl_Gl_Window.cxx23
-rw-r--r--src/Fl_Menu_Window.cxx6
-rw-r--r--src/Fl_win32.cxx47
-rw-r--r--src/Fl_x.cxx5
-rw-r--r--src/fl_file_chooser.cxx16
-rw-r--r--src/fl_show_colormap.cxx7
8 files changed, 88 insertions, 55 deletions
diff --git a/FL/Fl_Window.H b/FL/Fl_Window.H
index 286e9ab98..155f6aa44 100644
--- a/FL/Fl_Window.H
+++ b/FL/Fl_Window.H
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Window.H,v 1.12.2.2 2000/04/25 22:15:58 mike Exp $"
+// "$Id: Fl_Window.H,v 1.12.2.3 2000/06/03 08:36:56 bill Exp $"
//
// Window header file for the Fast Light Tool Kit (FLTK).
//
@@ -48,11 +48,11 @@ class Fl_Window : public Fl_Group {
FL_FORCE_POSITION = 16,
FL_NON_MODAL = 32
};
- static FL_EXPORT Fl_Window *current_;
FL_EXPORT void _Fl_Window(); // constructor innards
protected:
+ static FL_EXPORT Fl_Window *current_;
virtual FL_EXPORT void draw();
virtual FL_EXPORT void flush();
@@ -113,5 +113,5 @@ public:
#endif
//
-// End of "$Id: Fl_Window.H,v 1.12.2.2 2000/04/25 22:15:58 mike Exp $".
+// End of "$Id: Fl_Window.H,v 1.12.2.3 2000/06/03 08:36:56 bill Exp $".
//
diff --git a/src/Fl.cxx b/src/Fl.cxx
index 227879ee7..874c55301 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl.cxx,v 1.24.2.22 2000/05/16 12:26:58 mike Exp $"
+// "$Id: Fl.cxx,v 1.24.2.23 2000/06/03 08:36:59 bill Exp $"
//
// Main event handling code for the Fast Light Tool Kit (FLTK).
//
@@ -360,8 +360,6 @@ void fl_fix_focus() {
if (Fl::grab()) return; // don't do anything while grab is on.
- Fl::e_keysym = 0; // make sure it is not confused with navigation key
-
// set focus based on Fl::modal() and fl_xfocus
Fl_Widget* w = fl_xfocus;
if (w) {
@@ -600,18 +598,35 @@ Fl_Window::~Fl_Window() {
hide();
}
-// Child windows must respond to FL_SHOW and FL_HIDE by actually
-// doing unmap operations. Outer windows assumme FL_SHOW & FL_HIDE
-// are messages from X:
+// FL_SHOW and FL_HIDE are called whenever the visibility of this widget
+// or any parent changes. We must correctly map/unmap the system's window.
+
+// For top-level windows it is assummed the window has already been
+// mapped or unmapped!!! This is because this should only happen when
+// Fl_Window::show() or Fl_Window::hide() is called, or in response to
+// iconize/deiconize events from the system.
int Fl_Window::handle(int event) {
if (parent()) switch (event) {
case FL_SHOW:
if (!shown()) show();
- else XMapWindow(fl_display, fl_xid(this));
+ else XMapWindow(fl_display, fl_xid(this)); // extra map calls are harmless
break;
case FL_HIDE:
- if (shown()) XUnmapWindow(fl_display, fl_xid(this));
+ if (shown()) {
+ // Find what really turned invisible, if is was a parent window
+ // we do nothing. We need to avoid unnecessary unmap calls
+ // because they cause the display to blink when the parent is
+ // remapped. However if this or any intermediate non-window
+ // widget has really had hide() called directly on it, we must
+ // unmap because when the parent window is remapped we don't
+ // want to reappear.
+ if (visible()) {
+ Fl_Widget* p = parent(); for (;p->visible();p = p->parent()) {}
+ if (p->type() >= FL_WINDOW) break; // don't do the unmap
+ }
+ XUnmapWindow(fl_display, fl_xid(this));
+ }
break;
}
return Fl_Group::handle(event);
@@ -705,5 +720,5 @@ void Fl_Window::flush() {
}
//
-// End of "$Id: Fl.cxx,v 1.24.2.22 2000/05/16 12:26:58 mike Exp $".
+// End of "$Id: Fl.cxx,v 1.24.2.23 2000/06/03 08:36:59 bill Exp $".
//
diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx
index f8d695884..16073c9dc 100644
--- a/src/Fl_Gl_Window.cxx
+++ b/src/Fl_Gl_Window.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Gl_Window.cxx,v 1.12.2.11 2000/04/25 22:16:24 mike Exp $"
+// "$Id: Fl_Gl_Window.cxx,v 1.12.2.12 2000/06/03 08:37:01 bill Exp $"
//
// OpenGL window code for the Fast Light Tool Kit (FLTK).
//
@@ -126,6 +126,7 @@ void Fl_Gl_Window::make_current() {
}
#endif // USE_COLORMAP
glDrawBuffer(GL_BACK);
+ current_ = this;
}
void Fl_Gl_Window::ortho() {
@@ -158,15 +159,17 @@ int fl_overlay_depth = 0;
void Fl_Gl_Window::flush() {
uchar save_valid = valid_;
+#ifdef _WIN32
+ // SGI 320 messes up overlay with user-defined cursors:
+ bool fixcursor =
+ Fl_X::i(this)->cursor && Fl_X::i(this)->cursor != fl_default_cursor;
+ if (fixcursor) SetCursor(0);
+#endif
#if HAVE_GL_OVERLAY && defined(_WIN32)
- bool fixcursor = false;
if (overlay && overlay != this &&
- ((damage()&(FL_DAMAGE_OVERLAY|FL_DAMAGE_ALL|FL_DAMAGE_EXPOSE))
+ ((damage()&(FL_DAMAGE_OVERLAY|FL_DAMAGE_EXPOSE))
|| !save_valid)) {
- // SGI 320 messes up overlay over singlebuffer
- fixcursor = !g->d;
- if (fixcursor) SetCursor(0);
// Draw into hardware overlay planes
fl_set_gl_context(this, (GLXContext)overlay);
if (fl_overlay_depth)
@@ -262,11 +265,11 @@ void Fl_Gl_Window::flush() {
draw();
if (overlay == this) draw_overlay();
glFlush();
-#if HAVE_GL_OVERLAY && defined(_WIN32)
- if (fixcursor) SetCursor(Fl_X::i(this)->cursor);
-#endif
}
+#ifdef _WIN32
+ if (fixcursor) SetCursor(Fl_X::i(this)->cursor);
+#endif
valid(1);
}
@@ -320,5 +323,5 @@ void Fl_Gl_Window::draw_overlay() {}
#endif
//
-// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.11 2000/04/25 22:16:24 mike Exp $".
+// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.12 2000/06/03 08:37:01 bill Exp $".
//
diff --git a/src/Fl_Menu_Window.cxx b/src/Fl_Menu_Window.cxx
index 75d4d4c58..e74763ba3 100644
--- a/src/Fl_Menu_Window.cxx
+++ b/src/Fl_Menu_Window.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Menu_Window.cxx,v 1.8.2.1 2000/04/25 22:16:27 mike Exp $"
+// "$Id: Fl_Menu_Window.cxx,v 1.8.2.2 2000/06/03 08:37:01 bill Exp $"
//
// Menu window code for the Fast Light Tool Kit (FLTK).
//
@@ -68,7 +68,7 @@ void Fl_Menu_Window::flush() {
if (!gc) gc = XCreateGC(fl_display, i->xid, 0, 0);
fl_gc = gc;
fl_overlay = 1;
- fl_clip_region(i->region); i->region = 0;
+ fl_clip_region(i->region); i->region = 0; current_ = this;
draw();
fl_overlay = 0;
#else
@@ -97,5 +97,5 @@ Fl_Menu_Window::~Fl_Menu_Window() {
}
//
-// End of "$Id: Fl_Menu_Window.cxx,v 1.8.2.1 2000/04/25 22:16:27 mike Exp $".
+// End of "$Id: Fl_Menu_Window.cxx,v 1.8.2.2 2000/06/03 08:37:01 bill Exp $".
//
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index 7436e388c..acae8ba9c 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_win32.cxx,v 1.33.2.24 2000/04/25 22:16:35 mike Exp $"
+// "$Id: Fl_win32.cxx,v 1.33.2.25 2000/06/03 08:37:02 bill Exp $"
//
// WIN32-specific code for the Fast Light Tool Kit (FLTK).
//
@@ -240,7 +240,7 @@ double fl_wait(int timeout_flag, double time) {
if (fl_msg.message == WM_FLSELECT) {
// Got notification for socket
for (int i = 0; i < nfds; i ++)
- if (fd[i].fd == fl_msg.wParam) {
+ if (fd[i].fd == (int)fl_msg.wParam) {
(fd[i].cb)(fd[i].fd, fd[i].arg);
break;
}
@@ -433,7 +433,7 @@ static Fl_Window* resize_bug_fix;
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- static char buffer[2];
+ Fl::e_keysym = 0;
#if 0
// Not sure what this is, it may be left over from earlier attempts to
@@ -537,26 +537,27 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
case WM_DEADCHAR:
case WM_SYSDEADCHAR:
case WM_CHAR:
- case WM_SYSCHAR:
- {ulong state = Fl::e_state & 0xff000000; // keep the mouse button state
- // if GetKeyState is expensive we might want to comment some of these out:
- if (GetKeyState(VK_SHIFT)&~1) state |= FL_SHIFT;
- if (GetKeyState(VK_CAPITAL)) state |= FL_CAPS_LOCK;
- if (GetKeyState(VK_CONTROL)&~1) state |= FL_CTRL;
- // Alt gets reported for the Alt-GR switch on foreign keyboards.
- // so we need to check the event as well to get it right:
- if ((lParam&(1<<29)) //same as GetKeyState(VK_MENU)
+ case WM_SYSCHAR: {
+ ulong state = Fl::e_state & 0xff000000; // keep the mouse button state
+ // if GetKeyState is expensive we might want to comment some of these out:
+ if (GetKeyState(VK_SHIFT)&~1) state |= FL_SHIFT;
+ if (GetKeyState(VK_CAPITAL)) state |= FL_CAPS_LOCK;
+ if (GetKeyState(VK_CONTROL)&~1) state |= FL_CTRL;
+ // Alt gets reported for the Alt-GR switch on foreign keyboards.
+ // so we need to check the event as well to get it right:
+ if ((lParam&(1<<29)) //same as GetKeyState(VK_MENU)
&& uMsg != WM_CHAR) state |= FL_ALT;
- if (GetKeyState(VK_NUMLOCK)) state |= FL_NUM_LOCK;
- if (GetKeyState(VK_LWIN)&~1 || GetKeyState(VK_RWIN)&~1) {
- // WIN32 bug? GetKeyState returns garbage if the user hit the
- // meta key to pop up start menu. Sigh.
- if ((GetAsyncKeyState(VK_LWIN)|GetAsyncKeyState(VK_RWIN))&~1)
- state |= FL_META;
- }
- if (GetKeyState(VK_SCROLL)) state |= FL_SCROLL_LOCK;
- Fl::e_state = state;}
+ if (GetKeyState(VK_NUMLOCK)) state |= FL_NUM_LOCK;
+ if (GetKeyState(VK_LWIN)&~1 || GetKeyState(VK_RWIN)&~1) {
+ // WIN32 bug? GetKeyState returns garbage if the user hit the
+ // meta key to pop up start menu. Sigh.
+ if ((GetAsyncKeyState(VK_LWIN)|GetAsyncKeyState(VK_RWIN))&~1)
+ state |= FL_META;
+ }
+ if (GetKeyState(VK_SCROLL)) state |= FL_SCROLL_LOCK;
+ Fl::e_state = state;
if (lParam & (1<<31)) goto DEFAULT; // ignore up events after fixing shift
+ static char buffer[2];
if (uMsg == WM_CHAR || uMsg == WM_SYSCHAR) {
buffer[0] = char(wParam);
Fl::e_length = 1;
@@ -571,7 +572,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
// for (int i = lParam&0xff; i--;)
while (window->parent()) window = window->window();
if (Fl::handle(FL_KEYBOARD,window)) return 0;
- break;
+ break;}
case WM_GETMINMAXINFO:
Fl_X::i(window)->set_minmax((LPMINMAXINFO)lParam);
@@ -966,5 +967,5 @@ void Fl_Window::make_current() {
}
//
-// End of "$Id: Fl_win32.cxx,v 1.33.2.24 2000/04/25 22:16:35 mike Exp $".
+// End of "$Id: Fl_win32.cxx,v 1.33.2.25 2000/06/03 08:37:02 bill Exp $".
//
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index 3089df3b6..56aa6114d 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_x.cxx,v 1.24.2.15 2000/04/25 22:16:36 mike Exp $"
+// "$Id: Fl_x.cxx,v 1.24.2.16 2000/06/03 08:37:06 bill Exp $"
//
// X specific code for the Fast Light Tool Kit (FLTK).
//
@@ -356,6 +356,7 @@ static Fl_Window* resize_bug_fix;
int fl_handle(const XEvent& xevent)
{
+ Fl::e_keysym = 0;
fl_xevent = &xevent;
Window xid = xevent.xany.window;
@@ -889,5 +890,5 @@ void Fl_Window::make_current() {
#endif
//
-// End of "$Id: Fl_x.cxx,v 1.24.2.15 2000/04/25 22:16:36 mike Exp $".
+// End of "$Id: Fl_x.cxx,v 1.24.2.16 2000/06/03 08:37:06 bill Exp $".
//
diff --git a/src/fl_file_chooser.cxx b/src/fl_file_chooser.cxx
index 0355a7d28..a18f5b8de 100644
--- a/src/fl_file_chooser.cxx
+++ b/src/fl_file_chooser.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_file_chooser.cxx,v 1.10.2.3 2000/04/25 22:16:41 mike Exp $"
+// "$Id: fl_file_chooser.cxx,v 1.10.2.4 2000/06/03 08:37:08 bill Exp $"
//
// File chooser widget for the Fast Light Tool Kit (FLTK).
//
@@ -147,6 +147,9 @@ void* FCB::item_prev(void* p) const {
return ((dirent**)p)-1;
}
+#ifdef _MSC_VER
+#pragma optimize("a",off) // without this it does not change *e
+#endif
static int ido_matching(const dirent* p, const char* e, const char* n) {
// replace / or 1 at end with 0 and do match, then put back. yukko
int save = *e; *(char*)e = 0;
@@ -154,6 +157,9 @@ static int ido_matching(const dirent* p, const char* e, const char* n) {
*(char*)e = save;
return(r);
}
+#ifdef _MSC_VER
+#pragma optimize("",on)
+#endif
int FCB::incr_height() const {return textsize()+2;}
@@ -225,7 +231,11 @@ int FCB::get(char* buf) {
for (dirent** r = q+1; n && r < last; r++) {
if (!item_height(*r, 0)) continue;
int i;
- for (i=0; i<n && (*q)->d_name[i]==(*r)->d_name[i]; i++);
+#ifdef _WIN32
+ for (i=0; i<n && tolower((*q)->d_name[i])==tolower((*r)->d_name[i]); i++) {}
+#else
+ for (i=0; i<n && (*q)->d_name[i]==(*r)->d_name[i]; i++) {}
+#endif
n = i;
}
}
@@ -622,5 +632,5 @@ char* fl_file_chooser(const char* message, const char* pat, const char* fname)
}
//
-// End of "$Id: fl_file_chooser.cxx,v 1.10.2.3 2000/04/25 22:16:41 mike Exp $".
+// End of "$Id: fl_file_chooser.cxx,v 1.10.2.4 2000/06/03 08:37:08 bill Exp $".
//
diff --git a/src/fl_show_colormap.cxx b/src/fl_show_colormap.cxx
index c446fa33d..a2b0f028c 100644
--- a/src/fl_show_colormap.cxx
+++ b/src/fl_show_colormap.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_show_colormap.cxx,v 1.5.2.1 2000/04/25 22:16:45 mike Exp $"
+// "$Id: fl_show_colormap.cxx,v 1.5.2.2 2000/06/03 08:37:09 bill Exp $"
//
// Colormap color selection dialog for the Fast Light Tool Kit (FLTK).
//
@@ -126,6 +126,9 @@ int ColorMenu::handle(int e) {
extern char fl_override_redirect; // hack for menus
+#ifdef _MSC_VER
+#pragma optimize("a",off) // needed to get the done check to work
+#endif
Fl_Color ColorMenu::run() {
if (which < 0 || which > 255) {
position(Fl::event_x_root()-w()/2, Fl::event_y_root()-y()/2);
@@ -147,5 +150,5 @@ Fl_Color fl_show_colormap(Fl_Color oldcol) {
}
//
-// End of "$Id: fl_show_colormap.cxx,v 1.5.2.1 2000/04/25 22:16:45 mike Exp $".
+// End of "$Id: fl_show_colormap.cxx,v 1.5.2.2 2000/06/03 08:37:09 bill Exp $".
//