|
|
commit a0654b59ac17ad5b7739b7136d00f2469b03d5fa
Author: Albrecht Schlosser <albrechts.fltk@online.de>
AuthorDate: Fri Nov 5 13:12:52 2021 +0100
Commit: Albrecht Schlosser <albrechts.fltk@online.de>
CommitDate: Fri Nov 5 13:12:52 2021 +0100
Fix X11 build with FLTK_CONSOLIDATE_MOTION turned off
CHANGES.txt | 6 +++++-
src/Fl_x.cxx | 19 ++++++++++++++++---
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git CHANGES.txt CHANGES.txt
index dead987..ddbb9b9 100644
--- CHANGES.txt
+++ CHANGES.txt
@@ -17,7 +17,11 @@ Changes in FLTK 1.4.0 Released: ??? ?? 2021
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
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
diff --git src/Fl_x.cxx src/Fl_x.cxx
index dc64ce2..0a81f5a 100644
--- src/Fl_x.cxx
+++ src/Fl_x.cxx
@@ -206,6 +206,7 @@ extern int fl_send_system_handlers(void *e);
static Fl_Window* send_motion;
extern Fl_Window* fl_xmousewin;
#endif
+
static bool in_a_window; // true if in any of our windows, even destroyed ones
static void do_queued_events() {
in_a_window = true;
@@ -1726,7 +1727,9 @@ int fl_handle(const XEvent& thisevent)
if ((Atom)(data[0]) == WM_DELETE_WINDOW) {
event = FL_CLOSE;
} else if (message == fl_XdndEnter) {
+#if FLTK_CONSOLIDATE_MOTION
fl_xmousewin = window;
+#endif // FLTK_CONSOLIDATE_MOTION
in_a_window = true;
fl_dnd_source_window = data[0];
// version number is data[1]>>24
@@ -1776,7 +1779,9 @@ int fl_handle(const XEvent& thisevent)
break;
} else if (message == fl_XdndPosition) {
+#if FLTK_CONSOLIDATE_MOTION
fl_xmousewin = window;
+#endif // FLTK_CONSOLIDATE_MOTION
in_a_window = true;
fl_dnd_source_window = data[0];
float s = 1;
@@ -1811,7 +1816,9 @@ int fl_handle(const XEvent& thisevent)
break;
} else if (message == fl_XdndDrop) {
+#if FLTK_CONSOLIDATE_MOTION
fl_xmousewin = window;
+#endif // FLTK_CONSOLIDATE_MOTION
in_a_window = true;
fl_dnd_source_window = data[0];
fl_event_time = data[2];
@@ -2106,7 +2113,9 @@ int fl_handle(const XEvent& thisevent)
checkdouble();
}
+#if FLTK_CONSOLIDATE_MOTION
fl_xmousewin = window;
+#endif // FLTK_CONSOLIDATE_MOTION
in_a_window = true;
break;
@@ -2138,14 +2147,12 @@ int fl_handle(const XEvent& thisevent)
case MotionNotify:
set_event_xy(window);
+ in_a_window = true;
# if FLTK_CONSOLIDATE_MOTION
send_motion = fl_xmousewin = window;
- in_a_window = true;
return 0;
# else
event = FL_MOVE;
- fl_xmousewin = window;
- in_a_window = true;
break;
# endif
@@ -2157,7 +2164,9 @@ int fl_handle(const XEvent& thisevent)
xevent.xbutton.button == Button5) return 0;
event = FL_RELEASE;
+#if FLTK_CONSOLIDATE_MOTION
fl_xmousewin = window;
+#endif // FLTK_CONSOLIDATE_MOTION
in_a_window = true;
break;
@@ -2168,7 +2177,9 @@ int fl_handle(const XEvent& thisevent)
Fl::e_state = xevent.xcrossing.state << 16;
event = FL_ENTER;
+#if FLTK_CONSOLIDATE_MOTION
fl_xmousewin = window;
+#endif // FLTK_CONSOLIDATE_MOTION
in_a_window = true;
{ XIMStyles *xim_styles = 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;
set_event_xy(window);
Fl::e_state = xevent.xcrossing.state << 16;
+#if FLTK_CONSOLIDATE_MOTION
fl_xmousewin = 0;
+#endif // FLTK_CONSOLIDATE_MOTION
in_a_window = false; // make do_queued_events produce FL_LEAVE event
return 0;
[ Direct Link to Message ] | |
|
| |