Pointer motion compression patch from Bill.

git-svn-id: file:///fltk/svn/fltk/trunk@139 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 1998-12-07 13:34:27 +00:00
parent 88559817dd
commit ddc55fd591

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_x.cxx,v 1.9 1998/11/12 14:14:57 mike Exp $" // "$Id: Fl_x.cxx,v 1.10 1998/12/07 13:34:27 mike Exp $"
// //
// X specific code for the Fast Light Tool Kit (FLTK). // X specific code for the Fast Light Tool Kit (FLTK).
// //
@ -27,6 +27,8 @@
#include "Fl_win32.C" #include "Fl_win32.C"
#else #else
#define CONSOLIDATE_MOTION 1
#include <config.h> #include <config.h>
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/x.H> #include <FL/x.H>
@ -128,12 +130,22 @@ int fl_ready() {
#endif #endif
} }
#if CONSOLIDATE_MOTION
static Fl_Window* send_motion;
#endif
static void do_queued_events() { static void do_queued_events() {
while (XEventsQueued(fl_display,QueuedAfterReading)) { while (XEventsQueued(fl_display,QueuedAfterReading)) {
XEvent xevent; XEvent xevent;
XNextEvent(fl_display, &xevent); XNextEvent(fl_display, &xevent);
fl_handle(xevent); fl_handle(xevent);
} }
#if CONSOLIDATE_MOTION
if (send_motion) {
Fl_Window* w = send_motion;
send_motion = 0;
Fl::handle(FL_MOVE, w);
}
#endif
} }
double fl_wait(int timeout_flag, double time) { double fl_wait(int timeout_flag, double time) {
@ -263,12 +275,6 @@ void Fl::get_mouse(int &x, int &y) {
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
extern Fl_Window *fl_xfocus; // in Fl.C
extern Fl_Window *fl_xmousewin; // in Fl.C
void fl_fix_focus(); // in Fl.C
////////////////////////////////////////////////////////////////
const XEvent* fl_xevent; // the current x event const XEvent* fl_xevent; // the current x event
ulong fl_event_time; // the last timestamp from an x event ulong fl_event_time; // the last timestamp from an x event
@ -283,6 +289,9 @@ static int px, py;
static ulong ptime; static ulong ptime;
static void set_event_xy(Fl_Window* window) { static void set_event_xy(Fl_Window* window) {
#if CONSOLIDATE_MOTION
send_motion = 0;
#endif
Fl::e_x_root = fl_xevent->xbutton.x_root; Fl::e_x_root = fl_xevent->xbutton.x_root;
Fl::e_x = fl_xevent->xbutton.x; Fl::e_x = fl_xevent->xbutton.x;
Fl_X::x(window,Fl::e_x_root-Fl::e_x); Fl_X::x(window,Fl::e_x_root-Fl::e_x);
@ -370,8 +379,13 @@ int fl_handle(const XEvent& xevent)
case MotionNotify: case MotionNotify:
set_event_xy(window); set_event_xy(window);
#if CONSOLIDATE_MOTION
send_motion = window;
return 0;
#else
event = FL_MOVE; event = FL_MOVE;
break; break;
#endif
case ButtonRelease: case ButtonRelease:
Fl::e_keysym = FL_Button + xevent.xbutton.button; Fl::e_keysym = FL_Button + xevent.xbutton.button;
@ -499,6 +513,8 @@ void Fl_Window::resize(int X,int Y,int W,int H) {
// A subclass of Fl_Window may call this to associate an X window it // A subclass of Fl_Window may call this to associate an X window it
// creates with the Fl_Window: // creates with the Fl_Window:
void fl_fix_focus(); // in Fl.cxx
Fl_X* Fl_X::set_xid(Fl_Window* w, Window xid) { Fl_X* Fl_X::set_xid(Fl_Window* w, Window xid) {
Fl_X* x = new Fl_X; Fl_X* x = new Fl_X;
x->xid = xid; x->xid = xid;
@ -842,5 +858,5 @@ void Fl_Window::flush() {
#endif #endif
// //
// End of "$Id: Fl_x.cxx,v 1.9 1998/11/12 14:14:57 mike Exp $". // End of "$Id: Fl_x.cxx,v 1.10 1998/12/07 13:34:27 mike Exp $".
// //