Fl::event_number() didn't always match the value sent to the

handle() method (STR #634)


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3930 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet
2004-12-03 03:14:17 +00:00
parent 416ff7f24e
commit b5562132e5
10 changed files with 77 additions and 39 deletions
+2
View File
@@ -1,5 +1,7 @@
CHANGES IN FLTK 1.1.7 CHANGES IN FLTK 1.1.7
- Fl::event_number() didn't always match the value sent
to the handle() method (STR #634)
- Fl_Shared_Image::reload() didn't set the image_ - Fl_Shared_Image::reload() didn't set the image_
pointer properly in all cases (STR #632) pointer properly in all cases (STR #632)
- Fl_Help_View::topline() incorrectly set the changed() - Fl_Help_View::topline() incorrectly set the changed()
+7 -7
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_Free.H,v 1.5.2.4.2.4 2004/04/11 04:38:54 easysw Exp $" // "$Id: Fl_Free.H,v 1.5.2.4.2.5 2004/12/03 03:14:15 easysw Exp $"
// //
// Forms free header file for the Fast Light Tool Kit (FLTK). // Forms free header file for the Fast Light Tool Kit (FLTK).
// //
@@ -51,14 +51,14 @@ public:
// old event names for compatability: // old event names for compatability:
#define FL_MOUSE FL_DRAG #define FL_MOUSE FL_DRAG
#define FL_DRAW 0 #define FL_DRAW 100 // NOT USED
#define FL_STEP 9 #define FL_STEP 101
#define FL_FREEMEM 12 #define FL_FREEMEM 102 // NOT USED
#define FL_FREEZE FL_UNMAP #define FL_FREEZE 103 // NOT USED
#define FL_THAW FL_MAP #define FL_THAW 104 // NOT USED
#endif #endif
// //
// End of "$Id: Fl_Free.H,v 1.5.2.4.2.4 2004/04/11 04:38:54 easysw Exp $". // End of "$Id: Fl_Free.H,v 1.5.2.4.2.5 2004/12/03 03:14:15 easysw Exp $".
// //
+18 -6
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl.cxx,v 1.24.2.41.2.71 2004/11/23 19:50:58 easysw Exp $" // "$Id: Fl.cxx,v 1.24.2.41.2.72 2004/12/03 03:14:15 easysw Exp $"
// //
// Main event handling code for the Fast Light Tool Kit (FLTK). // Main event handling code for the Fast Light Tool Kit (FLTK).
// //
@@ -447,10 +447,13 @@ void Fl::focus(Fl_Widget *o) {
Fl::compose_reset(); Fl::compose_reset();
focus_ = o; focus_ = o;
fl_oldfocus = 0; fl_oldfocus = 0;
int old_event = e_number;
e_number = FL_UNFOCUS;
for (; p; p = p->parent()) { for (; p; p = p->parent()) {
p->handle(FL_UNFOCUS); p->handle(FL_UNFOCUS);
fl_oldfocus = p; fl_oldfocus = p;
} }
e_number = old_event;
} }
} }
@@ -461,9 +464,12 @@ void Fl::belowmouse(Fl_Widget *o) {
Fl_Widget *p = belowmouse_; Fl_Widget *p = belowmouse_;
if (o != p) { if (o != p) {
belowmouse_ = o; belowmouse_ = o;
int old_event = e_number;
e_number = dnd_flag ? FL_DND_LEAVE : FL_LEAVE;
for (; p && !p->contains(o); p = p->parent()) { for (; p && !p->contains(o); p = p->parent()) {
p->handle(dnd_flag ? FL_DND_LEAVE : FL_LEAVE); p->handle(e_number);
} }
e_number = old_event;
} }
} }
@@ -516,13 +522,17 @@ void fl_fix_focus() {
if (w) { if (w) {
if (Fl::modal()) w = Fl::modal(); if (Fl::modal()) w = Fl::modal();
if (!w->contains(Fl::belowmouse())) { if (!w->contains(Fl::belowmouse())) {
w->handle(FL_ENTER); int old_event = Fl::e_number;
w->handle(Fl::e_number = FL_ENTER);
Fl::e_number = old_event;
if (!w->contains(Fl::belowmouse())) Fl::belowmouse(w); if (!w->contains(Fl::belowmouse())) Fl::belowmouse(w);
} else { } else {
// send a FL_MOVE event so the enter/leave state is up to date // send a FL_MOVE event so the enter/leave state is up to date
Fl::e_x = Fl::e_x_root-fl_xmousewin->x(); Fl::e_x = Fl::e_x_root-fl_xmousewin->x();
Fl::e_y = Fl::e_y_root-fl_xmousewin->y(); Fl::e_y = Fl::e_y_root-fl_xmousewin->y();
w->handle(FL_MOVE); int old_event = Fl::e_number;
w->handle(Fl::e_number = FL_MOVE);
Fl::e_number = old_event;
} }
} else { } else {
Fl::belowmouse(0); Fl::belowmouse(0);
@@ -568,6 +578,7 @@ void fl_throw_focus(Fl_Widget *o) {
// window the event was posted to by X: // window the event was posted to by X:
static int send(int event, Fl_Widget* to, Fl_Window* window) { static int send(int event, Fl_Widget* to, Fl_Window* window) {
int dx, dy; int dx, dy;
int old_event = Fl::e_number;
if (window) { if (window) {
dx = window->x(); dx = window->x();
dy = window->y(); dy = window->y();
@@ -578,7 +589,8 @@ static int send(int event, Fl_Widget* to, Fl_Window* window) {
if (w->type()>=FL_WINDOW) {dx -= w->x(); dy -= w->y();} if (w->type()>=FL_WINDOW) {dx -= w->x(); dy -= w->y();}
int save_x = Fl::e_x; Fl::e_x += dx; int save_x = Fl::e_x; Fl::e_x += dx;
int save_y = Fl::e_y; Fl::e_y += dy; int save_y = Fl::e_y; Fl::e_y += dy;
int ret = to->handle(event); int ret = to->handle(Fl::e_number = event);
Fl::e_number = old_event;
Fl::e_y = save_y; Fl::e_y = save_y;
Fl::e_x = save_x; Fl::e_x = save_x;
return ret; return ret;
@@ -1096,5 +1108,5 @@ Fl::do_widget_deletion() {
// //
// End of "$Id: Fl.cxx,v 1.24.2.41.2.71 2004/11/23 19:50:58 easysw Exp $". // End of "$Id: Fl.cxx,v 1.24.2.41.2.72 2004/12/03 03:14:15 easysw Exp $".
// //
+5 -3
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_Group.cxx,v 1.8.2.8.2.25 2004/10/18 20:22:22 easysw Exp $" // "$Id: Fl_Group.cxx,v 1.8.2.8.2.26 2004/12/03 03:14:16 easysw Exp $"
// //
// Group widget for the Fast Light Tool Kit (FLTK). // Group widget for the Fast Light Tool Kit (FLTK).
// //
@@ -227,7 +227,9 @@ int Fl_Group::handle(int event) {
o = *a++; o = *a++;
if (event == FL_HIDE && o == Fl::focus()) { if (event == FL_HIDE && o == Fl::focus()) {
// Give up input focus... // Give up input focus...
o->handle(FL_UNFOCUS); int old_event = Fl::e_number;
o->handle(Fl::e_number = FL_UNFOCUS);
Fl::e_number = old_event;
Fl::focus(0); Fl::focus(0);
} }
if (o->visible()) o->handle(event); if (o->visible()) o->handle(event);
@@ -591,5 +593,5 @@ void Fl_Group::draw_outside_label(const Fl_Widget& widget) const {
} }
// //
// End of "$Id: Fl_Group.cxx,v 1.8.2.8.2.25 2004/10/18 20:22:22 easysw Exp $". // End of "$Id: Fl_Group.cxx,v 1.8.2.8.2.26 2004/12/03 03:14:16 easysw Exp $".
// //
+11 -5
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_mac.cxx,v 1.1.2.65 2004/11/23 00:28:35 matthiaswm Exp $" // "$Id: Fl_mac.cxx,v 1.1.2.66 2004/12/03 03:14:16 easysw Exp $"
// //
// MacOS specific code for the Fast Light Tool Kit (FLTK). // MacOS specific code for the Fast Light Tool Kit (FLTK).
// //
@@ -1548,7 +1548,9 @@ static pascal OSErr dndReceiveHandler( WindowPtr w, void *userData, DragReferenc
// if ( Fl::e_text[Fl::e_length-1]==0 ) Fl::e_length--; // modify, if trailing 0 is part of string // if ( Fl::e_text[Fl::e_length-1]==0 ) Fl::e_length--; // modify, if trailing 0 is part of string
Fl::e_length = dst - Fl::e_text - 1; Fl::e_length = dst - Fl::e_text - 1;
// printf("Sending following text to widget %p:\n%s\n", Fl::belowmouse(), Fl::e_text); // printf("Sending following text to widget %p:\n%s\n", Fl::belowmouse(), Fl::e_text);
target->handle(FL_PASTE); int old_event = Fl::e_number;
target->handle(Fl::e_number = FL_PASTE);
Fl::e_number = old_event;
free( Fl::e_text ); free( Fl::e_text );
fl_dnd_target_window = 0L; fl_dnd_target_window = 0L;
@@ -1591,7 +1593,9 @@ void Fl_X::make(Fl_Window* w)
x->wait_for_expose = 0; x->wait_for_expose = 0;
x->next = Fl_X::first; // must be in the list for ::flush() x->next = Fl_X::first; // must be in the list for ::flush()
Fl_X::first = x; Fl_X::first = x;
w->handle(FL_SHOW); int old_event = Fl::e_number;
w->handle(Fl::e_number = FL_SHOW);
Fl::e_number = old_event;
w->redraw(); // force draw to happen w->redraw(); // force draw to happen
} }
fl_show_iconic = 0; fl_show_iconic = 0;
@@ -1760,7 +1764,9 @@ void Fl_X::make(Fl_Window* w)
w->x(rect.left); w->y(rect.top); w->x(rect.left); w->y(rect.top);
w->w(rect.right-rect.left); w->h(rect.bottom-rect.top); w->w(rect.right-rect.left); w->h(rect.bottom-rect.top);
w->handle(FL_SHOW); int old_event = Fl::e_number;
w->handle(Fl::e_number = FL_SHOW);
Fl::e_number = old_event;
w->redraw(); // force draw to happen w->redraw(); // force draw to happen
w->set_visible(); w->set_visible();
@@ -2065,6 +2071,6 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) {
// //
// End of "$Id: Fl_mac.cxx,v 1.1.2.65 2004/11/23 00:28:35 matthiaswm Exp $". // End of "$Id: Fl_mac.cxx,v 1.1.2.66 2004/12/03 03:14:16 easysw Exp $".
// //
+5 -3
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_win32.cxx,v 1.33.2.37.2.51 2004/10/19 18:21:52 easysw Exp $" // "$Id: Fl_win32.cxx,v 1.33.2.37.2.52 2004/12/03 03:14:16 easysw Exp $"
// //
// WIN32-specific code for the Fast Light Tool Kit (FLTK). // WIN32-specific code for the Fast Light Tool Kit (FLTK).
// //
@@ -1095,7 +1095,9 @@ Fl_X* Fl_X::make(Fl_Window* w) {
if (fl_show_iconic) {showit = 0; fl_show_iconic = 0;} if (fl_show_iconic) {showit = 0; fl_show_iconic = 0;}
if (showit) { if (showit) {
w->set_visible(); w->set_visible();
w->handle(FL_SHOW); // get child windows to appear int old_event = Fl::e_number;
w->handle(Fl::e_number = FL_SHOW); // get child windows to appear
Fl::e_number = old_event;
w->redraw(); // force draw to happen w->redraw(); // force draw to happen
} }
// If we've captured the mouse, we dont want do activate any // If we've captured the mouse, we dont want do activate any
@@ -1242,5 +1244,5 @@ void Fl_Window::make_current() {
} }
// //
// End of "$Id: Fl_win32.cxx,v 1.33.2.37.2.51 2004/10/19 18:21:52 easysw Exp $". // End of "$Id: Fl_win32.cxx,v 1.33.2.37.2.52 2004/12/03 03:14:16 easysw Exp $".
// //
+8 -4
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_x.cxx,v 1.24.2.24.2.40 2004/11/20 13:52:47 easysw Exp $" // "$Id: Fl_x.cxx,v 1.24.2.24.2.41 2004/12/03 03:14:16 easysw Exp $"
// //
// X specific code for the Fast Light Tool Kit (FLTK). // X specific code for the Fast Light Tool Kit (FLTK).
// //
@@ -555,7 +555,9 @@ int fl_handle(const XEvent& thisevent)
} }
Fl::e_text = buffer ? (char*)buffer : (char *)""; Fl::e_text = buffer ? (char*)buffer : (char *)"";
Fl::e_length = bytesread; Fl::e_length = bytesread;
fl_selection_requestor->handle(FL_PASTE); int old_event = Fl::e_number;
fl_selection_requestor->handle(Fl::e_number = FL_PASTE);
Fl::e_number = old_event;
// Detect if this paste is due to Xdnd by the property name (I use // Detect if this paste is due to Xdnd by the property name (I use
// XA_SECONDARY for that) and send an XdndFinished message. It is not // XA_SECONDARY for that) and send an XdndFinished message. It is not
// clear if this has to be delayed until now or if it can be done // clear if this has to be delayed until now or if it can be done
@@ -1140,7 +1142,9 @@ void Fl_X::make_xid(Fl_Window* win, XVisualInfo *visual, Colormap colormap)
XMapWindow(fl_display, xp->xid); XMapWindow(fl_display, xp->xid);
if (showit) { if (showit) {
win->set_visible(); win->set_visible();
win->handle(FL_SHOW); // get child windows to appear int old_event = Fl::e_number;
win->handle(Fl::e_number = FL_SHOW); // get child windows to appear
Fl::e_number = old_event;
win->redraw(); win->redraw();
} }
} }
@@ -1299,5 +1303,5 @@ void Fl_Window::make_current() {
#endif #endif
// //
// End of "$Id: Fl_x.cxx,v 1.24.2.24.2.40 2004/11/20 13:52:47 easysw Exp $". // End of "$Id: Fl_x.cxx,v 1.24.2.24.2.41 2004/12/03 03:14:16 easysw Exp $".
// //
+5 -3
View File
@@ -1,5 +1,5 @@
// //
// "$Id: fl_dnd_mac.cxx,v 1.1.2.7 2004/09/09 21:34:47 matthiaswm Exp $" // "$Id: fl_dnd_mac.cxx,v 1.1.2.8 2004/12/03 03:14:17 easysw Exp $"
// //
// Drag & Drop code for the Fast Light Tool Kit (FLTK). // Drag & Drop code for the Fast Light Tool Kit (FLTK).
// //
@@ -71,7 +71,9 @@ int Fl::dnd()
Fl_Widget *w = Fl::pushed(); Fl_Widget *w = Fl::pushed();
if ( w ) if ( w )
{ {
w->handle( FL_RELEASE ); int old_event = Fl::e_number;
w->handle(Fl::e_number = FL_RELEASE);
Fl::e_number = old_event;
Fl::pushed( 0 ); Fl::pushed( 0 );
} }
@@ -84,5 +86,5 @@ int Fl::dnd()
// //
// End of "$Id: fl_dnd_mac.cxx,v 1.1.2.7 2004/09/09 21:34:47 matthiaswm Exp $". // End of "$Id: fl_dnd_mac.cxx,v 1.1.2.8 2004/12/03 03:14:17 easysw Exp $".
// //
+11 -5
View File
@@ -1,5 +1,5 @@
// //
// "$Id: fl_dnd_win32.cxx,v 1.5.2.16 2004/04/11 04:38:59 easysw Exp $" // "$Id: fl_dnd_win32.cxx,v 1.5.2.17 2004/12/03 03:14:17 easysw Exp $"
// //
// Drag & Drop code for the Fast Light Tool Kit (FLTK). // Drag & Drop code for the Fast Light Tool Kit (FLTK).
// //
@@ -172,7 +172,9 @@ public:
//long len = GlobalSize( medium.hGlobal ); //long len = GlobalSize( medium.hGlobal );
Fl::e_length = strlen( (char*)stuff ); // min(strlen, len) Fl::e_length = strlen( (char*)stuff ); // min(strlen, len)
Fl::e_text = (char*)stuff; Fl::e_text = (char*)stuff;
Fl::belowmouse()->handle(FL_PASTE); // e_text will be invalid after this call int old_event = Fl::e_number;
Fl::belowmouse()->handle(Fl::e_number = FL_PASTE); // e_text will be invalid after this call
Fl::e_number = old_event;
GlobalUnlock( medium.hGlobal ); GlobalUnlock( medium.hGlobal );
ReleaseStgMedium( &medium ); ReleaseStgMedium( &medium );
SetForegroundWindow( hwnd ); SetForegroundWindow( hwnd );
@@ -197,7 +199,9 @@ public:
if ( i<nf-1 ) *dst++ = '\n'; if ( i<nf-1 ) *dst++ = '\n';
} }
*dst = 0; *dst = 0;
Fl::belowmouse()->handle(FL_PASTE); int old_event = Fl::e_number;
Fl::belowmouse()->handle(Fl::e_number = FL_PASTE);
Fl::e_number = old_event;
free( Fl::e_text ); free( Fl::e_text );
ReleaseStgMedium( &medium ); ReleaseStgMedium( &medium );
SetForegroundWindow( hwnd ); SetForegroundWindow( hwnd );
@@ -333,7 +337,9 @@ int Fl::dnd()
Fl_Widget *w = Fl::pushed(); Fl_Widget *w = Fl::pushed();
if ( w ) if ( w )
{ {
w->handle( FL_RELEASE ); int old_event = Fl::e_number;
w->handle(Fl::e_number = FL_RELEASE);
Fl::e_number = old_event;
Fl::pushed( 0 ); Fl::pushed( 0 );
} }
if ( ret==DRAGDROP_S_DROP ) return 1; // or DD_S_CANCEL if ( ret==DRAGDROP_S_DROP ) return 1; // or DD_S_CANCEL
@@ -349,5 +355,5 @@ int Fl::dnd()
// //
// End of "$Id: fl_dnd_win32.cxx,v 1.5.2.16 2004/04/11 04:38:59 easysw Exp $". // End of "$Id: fl_dnd_win32.cxx,v 1.5.2.17 2004/12/03 03:14:17 easysw Exp $".
// //
+5 -3
View File
@@ -1,5 +1,5 @@
// //
// "$Id: forms_free.cxx,v 1.4.2.4.2.4 2004/04/11 04:39:00 easysw Exp $" // "$Id: forms_free.cxx,v 1.4.2.4.2.5 2004/12/03 03:14:17 easysw Exp $"
// //
// Forms free widget routines for the Fast Light Tool Kit (FLTK). // Forms free widget routines for the Fast Light Tool Kit (FLTK).
// //
@@ -33,7 +33,9 @@
void Fl_Free::step(void *v) { void Fl_Free::step(void *v) {
Fl_Free *f = (Fl_Free *)v; Fl_Free *f = (Fl_Free *)v;
f->handle(FL_STEP); int old_event = Fl::e_number;
f->handle(Fl::e_number == FL_STEP);
Fl::e_number = old_event;
Fl::add_timeout(.01,step,v); Fl::add_timeout(.01,step,v);
} }
@@ -73,5 +75,5 @@ int Fl_Free::handle(int e) {
} }
// //
// End of "$Id: forms_free.cxx,v 1.4.2.4.2.4 2004/04/11 04:39:00 easysw Exp $". // End of "$Id: forms_free.cxx,v 1.4.2.4.2.5 2004/12/03 03:14:17 easysw Exp $".
// //