FLTK logo

[branch-1.3] 636cca4 - Make "FLTK_CONSOLIDATE_MOTION" user-definable (issue #76)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[branch-1.3] 636cca4 - Make "FLTK_CONSOLIDATE_MOTION" user-definable (issue #76) "Albrecht Schlosser" Nov 05, 2021  
 
commit 636cca4a2bd9d4fc05716b8b2359e11a8f8955d9
Author:     Albrecht Schlosser <albrechts.fltk@online.de>
AuthorDate: Fri Nov 5 12:40:34 2021 +0100
Commit:     Albrecht Schlosser <albrechts.fltk@online.de>
CommitDate: Fri Nov 5 12:40:34 2021 +0100

    Make "FLTK_CONSOLIDATE_MOTION" user-definable (issue #76)
    
    This undocumented macro is used on X11 and macOS platforms to
    consolidate mouse move events, i.e. to collect some events and send
    them later as one event. The old macro name CONSOLIDATE_MOTION has been
    renamed to FLTK_CONSOLIDATE_MOTION since it is now a "global" symbol.
    
    Users can define FLTK_CONSOLIDATE_MOTION in their build system, e.g.
    on the compiler commandline, as 0 or 1 to disable or enable this
    feature, respectively.
    
    For historical reasons the default is 0 (OFF) on macOS and 1 (ON) on
    X11 in FLTK 1.3. In FLTK 1.4 the default will always be 0 (OFF).

 src/Fl_cocoa.mm |  9 ++++++---
 src/Fl_x.cxx    | 13 ++++++++-----
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git src/Fl_cocoa.mm src/Fl_cocoa.mm
index f855a12..aa3cd8d 100644
--- src/Fl_cocoa.mm
+++ src/Fl_cocoa.mm
@@ -29,7 +29,10 @@
 
 #ifdef __APPLE__
 
-#define CONSOLIDATE_MOTION 0
+#ifndef FLTK_CONSOLIDATE_MOTION
+#define FLTK_CONSOLIDATE_MOTION 0
+#endif
+
 extern "C" {
 #include <pthread.h>
 }
@@ -114,7 +117,7 @@ static bool in_nsapp_run = false; // true during execution of [NSApp run]
 static NSMutableArray *dropped_files_list = nil; // list of files dropped at app launch
 typedef void (*open_cb_f_type)(const char *);
 static Fl_Window *starting_moved_window = NULL; // the moved window which brings its subwins with it
-#if CONSOLIDATE_MOTION
+#if FLTK_CONSOLIDATE_MOTION
 static Fl_Window* send_motion;
 extern Fl_Window* fl_xmousewin;
 #endif
@@ -906,7 +909,7 @@ static int do_queued_events( double time = 0.0 )
   }
   fl_lock_function();
   
-#if CONSOLIDATE_MOTION
+#if FLTK_CONSOLIDATE_MOTION
   if (send_motion && send_motion == fl_xmousewin) {
     send_motion = 0;
     Fl::handle(FL_MOVE, fl_xmousewin);
diff --git src/Fl_x.cxx src/Fl_x.cxx
index 46c5c5d..3ffe741 100644
--- src/Fl_x.cxx
+++ src/Fl_x.cxx
@@ -20,7 +20,10 @@
 //#  include "Fl_mac.cxx"	// now Fl_cocoa.mm
 #elif !defined(FL_DOXYGEN)
 
-#  define CONSOLIDATE_MOTION 1
+#ifndef FLTK_CONSOLIDATE_MOTION
+#  define FLTK_CONSOLIDATE_MOTION 1
+#endif
+
 /**** Define this if your keyboard lacks a backspace key... ****/
 /* #define BACKSPACE_HACK 1 */
 
@@ -193,7 +196,7 @@ void Fl::remove_fd(int n) {
 
 extern int fl_send_system_handlers(void *e);
 
-#if CONSOLIDATE_MOTION
+#if FLTK_CONSOLIDATE_MOTION
 static Fl_Window* send_motion;
 extern Fl_Window* fl_xmousewin;
 #endif
@@ -209,7 +212,7 @@ static void do_queued_events() {
   }
   // we send FL_LEAVE only if the mouse did not enter some other window:
   if (!in_a_window) Fl::handle(FL_LEAVE, 0);
-#if CONSOLIDATE_MOTION
+#if FLTK_CONSOLIDATE_MOTION
   else if (send_motion && send_motion == fl_xmousewin) {
     send_motion = 0;
     Fl::handle(FL_MOVE, fl_xmousewin);
@@ -1312,7 +1315,7 @@ static int px, py;
 static ulong ptime;
 
 static void set_event_xy() {
-#  if CONSOLIDATE_MOTION
+#  if FLTK_CONSOLIDATE_MOTION
   send_motion = 0;
 #  endif
   Fl::e_x_root  = fl_xevent->xbutton.x_root;
@@ -2122,7 +2125,7 @@ int fl_handle(const XEvent& thisevent)
 
   case MotionNotify:
     set_event_xy();
-#  if CONSOLIDATE_MOTION
+#  if FLTK_CONSOLIDATE_MOTION
     send_motion = fl_xmousewin = window;
     in_a_window = true;
     return 0;
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.