Fix X11 build with FLTK_CONSOLIDATE_MOTION turned off

This commit is contained in:
Albrecht Schlosser 2021-11-05 13:12:52 +01:00
parent 0ad192a27b
commit a0654b59ac
2 changed files with 21 additions and 4 deletions

View File

@ -17,7 +17,11 @@ Changes in FLTK 1.4.0 Released: ??? ?? 2021
New Features and Extensions New Features and Extensions
- (add new items here) - The undocumented feature FLTK_CONSOLIDATE_MOTION is now OFF on X11 like
on macOS. In FLTK 1.3 this feature has been ON on X11. The macro can now
be set on the compiler commandline and can be used to reduce the number
of mouse move events sent to the application but it may be unreliable.
Recommendation: let it switched OFF unless you really need it.
- The Windows platform now draws oblique and curved lines in antialiased - The Windows platform now draws oblique and curved lines in antialiased
form. The new function void fl_antialias(int state); allows to turn off form. The new function void fl_antialias(int state); allows to turn off
or on such antialiased drawing. The new function int fl_antialias(); returns or on such antialiased drawing. The new function int fl_antialias(); returns

View File

@ -206,6 +206,7 @@ extern int fl_send_system_handlers(void *e);
static Fl_Window* send_motion; static Fl_Window* send_motion;
extern Fl_Window* fl_xmousewin; extern Fl_Window* fl_xmousewin;
#endif #endif
static bool in_a_window; // true if in any of our windows, even destroyed ones static bool in_a_window; // true if in any of our windows, even destroyed ones
static void do_queued_events() { static void do_queued_events() {
in_a_window = true; in_a_window = true;
@ -1726,7 +1727,9 @@ int fl_handle(const XEvent& thisevent)
if ((Atom)(data[0]) == WM_DELETE_WINDOW) { if ((Atom)(data[0]) == WM_DELETE_WINDOW) {
event = FL_CLOSE; event = FL_CLOSE;
} else if (message == fl_XdndEnter) { } else if (message == fl_XdndEnter) {
#if FLTK_CONSOLIDATE_MOTION
fl_xmousewin = window; fl_xmousewin = window;
#endif // FLTK_CONSOLIDATE_MOTION
in_a_window = true; in_a_window = true;
fl_dnd_source_window = data[0]; fl_dnd_source_window = data[0];
// version number is data[1]>>24 // version number is data[1]>>24
@ -1776,7 +1779,9 @@ int fl_handle(const XEvent& thisevent)
break; break;
} else if (message == fl_XdndPosition) { } else if (message == fl_XdndPosition) {
#if FLTK_CONSOLIDATE_MOTION
fl_xmousewin = window; fl_xmousewin = window;
#endif // FLTK_CONSOLIDATE_MOTION
in_a_window = true; in_a_window = true;
fl_dnd_source_window = data[0]; fl_dnd_source_window = data[0];
float s = 1; float s = 1;
@ -1811,7 +1816,9 @@ int fl_handle(const XEvent& thisevent)
break; break;
} else if (message == fl_XdndDrop) { } else if (message == fl_XdndDrop) {
#if FLTK_CONSOLIDATE_MOTION
fl_xmousewin = window; fl_xmousewin = window;
#endif // FLTK_CONSOLIDATE_MOTION
in_a_window = true; in_a_window = true;
fl_dnd_source_window = data[0]; fl_dnd_source_window = data[0];
fl_event_time = data[2]; fl_event_time = data[2];
@ -2106,7 +2113,9 @@ int fl_handle(const XEvent& thisevent)
checkdouble(); checkdouble();
} }
#if FLTK_CONSOLIDATE_MOTION
fl_xmousewin = window; fl_xmousewin = window;
#endif // FLTK_CONSOLIDATE_MOTION
in_a_window = true; in_a_window = true;
break; break;
@ -2138,14 +2147,12 @@ int fl_handle(const XEvent& thisevent)
case MotionNotify: case MotionNotify:
set_event_xy(window); set_event_xy(window);
in_a_window = true;
# if FLTK_CONSOLIDATE_MOTION # if FLTK_CONSOLIDATE_MOTION
send_motion = fl_xmousewin = window; send_motion = fl_xmousewin = window;
in_a_window = true;
return 0; return 0;
# else # else
event = FL_MOVE; event = FL_MOVE;
fl_xmousewin = window;
in_a_window = true;
break; break;
# endif # endif
@ -2157,7 +2164,9 @@ int fl_handle(const XEvent& thisevent)
xevent.xbutton.button == Button5) return 0; xevent.xbutton.button == Button5) return 0;
event = FL_RELEASE; event = FL_RELEASE;
#if FLTK_CONSOLIDATE_MOTION
fl_xmousewin = window; fl_xmousewin = window;
#endif // FLTK_CONSOLIDATE_MOTION
in_a_window = true; in_a_window = true;
break; break;
@ -2168,7 +2177,9 @@ int fl_handle(const XEvent& thisevent)
Fl::e_state = xevent.xcrossing.state << 16; Fl::e_state = xevent.xcrossing.state << 16;
event = FL_ENTER; event = FL_ENTER;
#if FLTK_CONSOLIDATE_MOTION
fl_xmousewin = window; fl_xmousewin = window;
#endif // FLTK_CONSOLIDATE_MOTION
in_a_window = true; in_a_window = true;
{ XIMStyles *xim_styles = NULL; { XIMStyles *xim_styles = NULL;
if(!fl_xim_im || XGetIMValues(fl_xim_im, XNQueryInputStyle, &xim_styles, NULL, NULL)) { if(!fl_xim_im || XGetIMValues(fl_xim_im, XNQueryInputStyle, &xim_styles, NULL, NULL)) {
@ -2182,7 +2193,9 @@ int fl_handle(const XEvent& thisevent)
if (xevent.xcrossing.detail == NotifyInferior) break; if (xevent.xcrossing.detail == NotifyInferior) break;
set_event_xy(window); set_event_xy(window);
Fl::e_state = xevent.xcrossing.state << 16; Fl::e_state = xevent.xcrossing.state << 16;
#if FLTK_CONSOLIDATE_MOTION
fl_xmousewin = 0; fl_xmousewin = 0;
#endif // FLTK_CONSOLIDATE_MOTION
in_a_window = false; // make do_queued_events produce FL_LEAVE event in_a_window = false; // make do_queued_events produce FL_LEAVE event
return 0; return 0;