Index: Fl.cxx
===================================================================
RCS file: /cvsroot/fltk/fltk/src/Fl.cxx,v
retrieving revision 1.24.2.41.2.71
diff -u -r1.24.2.41.2.71 Fl.cxx
--- Fl.cxx	23 Nov 2004 19:50:58 -0000	1.24.2.41.2.71
+++ Fl.cxx	3 Dec 2004 03:11:18 -0000
@@ -447,10 +447,13 @@
     Fl::compose_reset();
     focus_ = o;
     fl_oldfocus = 0;
+    int old_event = e_number;
+    e_number = FL_UNFOCUS;
     for (; p; p = p->parent()) {
       p->handle(FL_UNFOCUS);
       fl_oldfocus = p;
     }
+    e_number = old_event;
   }
 }
 
@@ -461,9 +464,12 @@
   Fl_Widget *p = belowmouse_;
   if (o != p) {
     belowmouse_ = o;
+    int old_event = e_number;
+    e_number = dnd_flag ? FL_DND_LEAVE : FL_LEAVE;
     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 @@
     if (w) {
       if (Fl::modal()) w = Fl::modal();
       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);
       } else {
 	// 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_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 {
       Fl::belowmouse(0);
@@ -568,6 +578,7 @@
 // window the event was posted to by X:
 static int send(int event, Fl_Widget* to, Fl_Window* window) {
   int dx, dy;
+  int old_event = Fl::e_number;
   if (window) {
     dx = window->x();
     dy = window->y();
@@ -578,7 +589,8 @@
     if (w->type()>=FL_WINDOW) {dx -= w->x(); dy -= w->y();}
   int save_x = Fl::e_x; Fl::e_x += dx;
   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_x = save_x;
   return ret;
Index: Fl_Group.cxx
===================================================================
RCS file: /cvsroot/fltk/fltk/src/Fl_Group.cxx,v
retrieving revision 1.8.2.8.2.25
diff -u -r1.8.2.8.2.25 Fl_Group.cxx
--- Fl_Group.cxx	18 Oct 2004 20:22:22 -0000	1.8.2.8.2.25
+++ Fl_Group.cxx	3 Dec 2004 03:11:18 -0000
@@ -227,7 +227,9 @@
       o = *a++;
       if (event == FL_HIDE && o == Fl::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);
       }
       if (o->visible()) o->handle(event);
Index: Fl_mac.cxx
===================================================================
RCS file: /cvsroot/fltk/fltk/src/Fl_mac.cxx,v
retrieving revision 1.1.2.65
diff -u -r1.1.2.65 Fl_mac.cxx
--- Fl_mac.cxx	23 Nov 2004 00:28:35 -0000	1.1.2.65
+++ Fl_mac.cxx	3 Dec 2004 03:11:19 -0000
@@ -1548,7 +1548,9 @@
 //  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;
 //  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 );
 
   fl_dnd_target_window = 0L;
@@ -1591,7 +1593,9 @@
       x->wait_for_expose = 0;
       x->next = Fl_X::first; // must be in the list for ::flush()
       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
     }
     fl_show_iconic = 0;
@@ -1760,7 +1764,9 @@
     w->x(rect.left); w->y(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->set_visible();
     
Index: Fl_win32.cxx
===================================================================
RCS file: /cvsroot/fltk/fltk/src/Fl_win32.cxx,v
retrieving revision 1.33.2.37.2.51
diff -u -r1.33.2.37.2.51 Fl_win32.cxx
--- Fl_win32.cxx	19 Oct 2004 18:21:52 -0000	1.33.2.37.2.51
+++ Fl_win32.cxx	3 Dec 2004 03:11:19 -0000
@@ -1095,7 +1095,9 @@
   if (fl_show_iconic) {showit = 0; fl_show_iconic = 0;}
   if (showit) {
     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
   }
   // If we've captured the mouse, we dont want do activate any
Index: Fl_x.cxx
===================================================================
RCS file: /cvsroot/fltk/fltk/src/Fl_x.cxx,v
retrieving revision 1.24.2.24.2.40
diff -u -r1.24.2.24.2.40 Fl_x.cxx
--- Fl_x.cxx	20 Nov 2004 13:52:47 -0000	1.24.2.24.2.40
+++ Fl_x.cxx	3 Dec 2004 03:11:19 -0000
@@ -555,7 +555,9 @@
     }
     Fl::e_text = buffer ? (char*)buffer : (char *)"";
     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
     // 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
@@ -1140,7 +1142,9 @@
   XMapWindow(fl_display, xp->xid);
   if (showit) {
     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();
   }
 }
Index: fl_dnd_mac.cxx
===================================================================
RCS file: /cvsroot/fltk/fltk/src/fl_dnd_mac.cxx,v
retrieving revision 1.1.2.7
diff -u -r1.1.2.7 fl_dnd_mac.cxx
--- fl_dnd_mac.cxx	9 Sep 2004 21:34:47 -0000	1.1.2.7
+++ fl_dnd_mac.cxx	3 Dec 2004 03:11:19 -0000
@@ -71,7 +71,9 @@
   Fl_Widget *w = Fl::pushed();
   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 );
   }
 
Index: fl_dnd_win32.cxx
===================================================================
RCS file: /cvsroot/fltk/fltk/src/fl_dnd_win32.cxx,v
retrieving revision 1.5.2.16
diff -u -r1.5.2.16 fl_dnd_win32.cxx
--- fl_dnd_win32.cxx	11 Apr 2004 04:38:59 -0000	1.5.2.16
+++ fl_dnd_win32.cxx	3 Dec 2004 03:11:19 -0000
@@ -172,7 +172,9 @@
       //long len = GlobalSize( medium.hGlobal );
       Fl::e_length = strlen( (char*)stuff ); // min(strlen, len)
       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 );
       ReleaseStgMedium( &medium );
       SetForegroundWindow( hwnd );
@@ -197,7 +199,9 @@
 	if ( i<nf-1 ) *dst++ = '\n';
       }
       *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 );
       ReleaseStgMedium( &medium );
       SetForegroundWindow( hwnd );
@@ -333,7 +337,9 @@
   Fl_Widget *w = Fl::pushed();
   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 );
   }
   if ( ret==DRAGDROP_S_DROP ) return 1; // or DD_S_CANCEL
Index: forms_free.cxx
===================================================================
RCS file: /cvsroot/fltk/fltk/src/Attic/forms_free.cxx,v
retrieving revision 1.4.2.4.2.4
diff -u -r1.4.2.4.2.4 forms_free.cxx
--- forms_free.cxx	11 Apr 2004 04:39:00 -0000	1.4.2.4.2.4
+++ forms_free.cxx	3 Dec 2004 03:11:19 -0000
@@ -33,7 +33,9 @@
 
 void Fl_Free::step(void *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);
 }
 
