Index: FL/Enumerations.H
===================================================================
--- FL/Enumerations.H	(revision 12020)
+++ FL/Enumerations.H	(working copy)
@@ -240,6 +240,10 @@
 
       In order to receive the FL_RELEASE event, the widget must return 
       non-zero when handling FL_PUSH.
+
+      Tablet devices will have valid data for tilt, pen pressure, etc.
+      See the FL_TABLET event for details.
+
    */
   FL_RELEASE		= 2,
 
@@ -249,6 +253,9 @@
       returning non-zero from its handle() method. It then
       becomes the Fl::belowmouse() widget and will receive 
       FL_MOVE and FL_LEAVE events.
+
+      Tablet devices will have valid data for tilt, pen pressure, etc.
+      See the FL_TABLET event for details.
    */
   FL_ENTER		= 3,
 
@@ -264,6 +271,9 @@
 
       In order to receive FL_DRAG events, the widget must return non-zero 
       when handling FL_PUSH.
+
+      Tablet devices will have valid data for tilt, pen pressure, etc.
+      See the FL_TABLET event for details.
    */
   FL_DRAG		= 5,
 
@@ -427,6 +437,30 @@
       Fl::event_x() and Fl::event_y() are set as well.
      */
   FL_ZOOM_GESTURE	= 26
+#if FLTK_ABI_VERSION >= 10304
+  ,
+  /** A tablet specific pointer event (e.g. pen pressure or tilt changed
+      without affecting pen position).
+      Valid data during this event (depending on your tablet hardware):
+          - Fl::tablet_pen_tilt_x() 
+          - Fl::tablet_pen_tilt_y() 
+          - Fl::tablet_pen_pressure() 
+          - Fl::tablet_pen_tangential_pressure() 
+          - Fl::tablet_pen_rotation() 
+          - Fl::tablet_proximity() -- set to 1
+          - Fl::tablet_pen_type() -- the type of pen
+          - Fl::tablet_pen_eraser() -- if pen is an eraser
+   */
+  FL_TABLET = 27,
+  /** The Tablet pen has either 'entered' or 'left' the proximity of the tablet.
+      Typically this transition occurs the the pen is hovering near the tablet.
+      Valid data during this event:
+          - Fl::tablet_proximity() -- 1 if pen entered proximity, 0 if left.
+          - Fl::tablet_pen_type() -- the type of pen that entered/left the tablet's proximity
+          - Fl::tablet_pen_eraser() -- if pen is an eraser
+   */
+  FL_TABLET_PROXIMITY = 28
+#endif
 };
 
 /** \name When Conditions */
Index: FL/Fl.H
===================================================================
--- FL/Fl.H	(revision 12020)
+++ FL/Fl.H	(working copy)
@@ -150,6 +150,21 @@
   static int e_state;
   static int e_clicks;
   static int e_is_click;
+#if FLTK_ABI_VERSION >= 10304
+  //ERCO
+  // Tablet-specific variables
+  //    Can probably also be used for touchpad finger pressure, etc
+  //
+  static int   e_tablet_w;                // tablet width/height in counts
+  static int   e_tablet_h;
+  static float e_tablet_pen_tilt_x;       // 0-1.0: pen x tilt: left=negative, right=positive
+  static float e_tablet_pen_tilt_y;       // 0-1.0: pen y tilt: top=negative, bottom=positive
+  static float e_tablet_pen_pressure;     // 0-1.0: positive values only: 0=no pressure
+  static float e_tablet_pen_tan_pressure; // 0-1.0: aka. barrel pressure, or pressure wheel
+  static float e_tablet_pen_rotation;     // 0-360.0 degrees
+  static int   e_tablet_pen_type;         // 0=pen, 1=eraser, >1 reserved
+  static int   e_tablet_pen_proximity;    // 1 if pen entered tablet, 0 if left tablet
+#endif
   static int e_keysym;
   static char* e_text;
   static int e_length;
@@ -674,6 +689,49 @@
     \see Fl::event_buttons()
   */
   static int event_button()	{return e_keysym-FL_Button;}
+
+#if FLTK_ABI_VERSION >= 10304
+  //ERCO
+  /// Returns the tablet's full width and height in counts.
+  static int tablet_w() { return Fl::e_tablet_w; }	//TODO
+  static int tablet_h() { return Fl::e_tablet_h; }	//TODO
+
+  /// Returns the tablet pen tilt on x as a +/- signed float between 0.0 and 1.0;
+  /// left is negative, right is positive.
+  ///
+  static float tablet_pen_tilt_x() { return Fl::e_tablet_pen_tilt_x; }
+
+  /// Returns the tablet pen tilt on y as a +/- signed float between 0.0 and 1.0;
+  /// Tilting up towads top of tablet is positive, tilting down towards bottom is negative.
+  ///
+  static float tablet_pen_tilt_y() { return Fl::e_tablet_pen_tilt_y; }
+
+  /// Returns the tablet pen point pressure as a floating point value between 0.0 and 1.0.
+  static float tablet_pen_pressure() { return Fl::e_tablet_pen_pressure; }
+
+  /// Returns the tablet pen's tangential pressure (usually barrel pressure or pressure wheel)
+  /// as a floating point value between 0.0 and 1.0.
+  ///
+  static float tablet_pen_tangential_pressure() { return Fl::e_tablet_pen_tan_pressure; }
+
+  /// Returns the tablet pen's rotational orientation as a floating point value in degrees (0.0-360.0).
+  static float tablet_pen_rotation() { return Fl::e_tablet_pen_rotation; }
+
+  /// Returns 1 if pen is in proximity of tablet, 0 if not.
+  static int tablet_pen_proximity() { return Fl::e_tablet_pen_proximity; }
+
+  /// Returns type of pen on tablet.
+  ///    -1=unknown, 0=cursor, 1=pen, 2=eraser, >2 reserved.
+  ///
+  static int tablet_pen_type() { return Fl::e_tablet_pen_type; }
+
+  /// Returns 1 if tablet pen's eraser is down, 0 if not.
+  /// Convenience function: same as testing tablet_pen_type() for 2.
+  ///
+  static int tablet_pen_eraser() { return Fl::e_tablet_pen_type == 2 ? 1 : 0; }
+
+#endif
+
   /**
     Returns the keyboard and mouse button states of the last event.
 
Index: FL/names.h
===================================================================
--- FL/names.h	(revision 12020)
+++ FL/names.h	(working copy)
@@ -69,8 +69,15 @@
   "FL_SCREEN_CONFIGURATION_CHANGED",
   "FL_FULLSCREEN",
   "FL_ZOOM_GESTURE",
+#if FLTK_ABI_VERSION >= 10304
+  // NEW
+  "FL_TABLET",           // 27
+  "FL_TABLET_PROXIMITY", // 28
+#else
+  // OLD
   "FL_EVENT_27",  // not yet defined, just in case they /will/ be defined ...
   "FL_EVENT_28",
+#endif
   "FL_EVENT_29",
   "FL_EVENT_30"
 };
Index: src/Fl.cxx
===================================================================
--- src/Fl.cxx	(revision 12020)
+++ src/Fl.cxx	(working copy)
@@ -118,6 +118,20 @@
                 Fl::e_original_keysym,
 		Fl::scrollbar_size_ = 16;
 
+#if FLTK_ABI_VERSION >= 10304
+  //ERCO
+  // Tablet-specific variables
+  int   Fl::e_tablet_w = 0;
+  int   Fl::e_tablet_h = 0;
+  float Fl::e_tablet_pen_tilt_x = 0.0;
+  float Fl::e_tablet_pen_tilt_y = 0.0;
+  float Fl::e_tablet_pen_pressure = 0.0;
+  float Fl::e_tablet_pen_tan_pressure = 0.0;
+  float Fl::e_tablet_pen_rotation = 0.0;
+  int   Fl::e_tablet_pen_type = 0;
+  int   Fl::e_tablet_pen_proximity = 0;
+#endif
+
 char		*Fl::e_text = (char *)"";
 int		Fl::e_length;
 const char*	Fl::e_clipboard_type = "";
Index: src/Fl_cocoa.mm
===================================================================
--- src/Fl_cocoa.mm	(revision 12020)
+++ src/Fl_cocoa.mm	(working copy)
@@ -1057,6 +1057,26 @@
 #endif
 }
 
+#if FLTK_ABI_VERSION >= 10304 && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+static void handleTabletPointerEvent(NSEvent *theEvent) {	//ERCO
+  // See: https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/EventOverview/EventObjectsTypes/EventObjectsTypes.html
+  //
+  // OSX tablet code modification map:
+  //     o Added 3 new FLTK tablet events to FL/Enumerations.H: pointer, proximity enter/leave
+  //     o Added new data and accessors to FL/Fl.H
+  //     o Added initializers to src/Fl.cxx
+  //     o Added code hooks in src/Fl_cocoa.mm
+  //     o Test code: examples/tablet-test.cxx
+  //
+  Fl::e_tablet_pen_tilt_x = [theEvent tilt].x; // 10.4
+  Fl::e_tablet_pen_tilt_y = [theEvent tilt].y; // 10.4
+  Fl::e_tablet_pen_pressure = [theEvent pressure];
+  Fl::e_tablet_pen_tan_pressure = [theEvent tangentialPressure]; // 10.4
+  // the doc says [theEvent rotation] returns an angle in degrees as a float
+  Fl::e_tablet_pen_rotation = [theEvent rotation] / 64.0;	// 10.4 converts 16 bit int value to 0.0 - 360.0 degrees
+}
+#endif
+
 /*
  * Cocoa Mouse Button Handler
  */
@@ -1090,9 +1110,28 @@
     if (btn == 1) Fl::e_state &= ~FL_BUTTON1;
     else if (btn == 3) Fl::e_state &= ~FL_BUTTON2;
     else if (btn == 2) Fl::e_state &= ~FL_BUTTON3;
+  }
+  switch ( etype ) {
+#if FLTK_ABI_VERSION >= 10304 && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+    case NSTabletProximity: {		// this constant has new name NSEventTypeTabletProximity in 10.12
+      // Pen either entered or left tablet's proximity
+      Fl::e_tablet_pen_proximity = [theEvent isEnteringProximity];		// 10.4 determine proximity
+      switch ( [theEvent pointingDeviceType] ) {				// 10.4 keep device type
+        case NSPointingDeviceTypeCursor: Fl::e_tablet_pen_type =  0; break;	// cursor 10.4
+        case NSPointingDeviceTypePen:    Fl::e_tablet_pen_type =  1; break;	// pen    10.4
+        case NSPointingDeviceTypeEraser: Fl::e_tablet_pen_type =  2; break;	// eraser 10.4
+	default:                         Fl::e_tablet_pen_type = -1; break;	// unknown
+      }
+      Fl::handle(FL_TABLET_PROXIMITY, window);
+      break;
     }
-    
-  switch ( etype ) {
+    case NSTabletPoint: {		// this constant has new name NSEventTypeTabletPoint in 10.12
+      // A tablet-specific event not covered by normal mouse events
+      handleTabletPointerEvent(theEvent);
+      Fl::handle(FL_TABLET, window);
+      break;
+    }
+#endif
     case NSLeftMouseDown:
     case NSRightMouseDown:
     case NSOtherMouseDown:
@@ -1121,6 +1160,9 @@
     case NSLeftMouseDragged:
     case NSRightMouseDragged:
     case NSOtherMouseDragged: {
+#if FLTK_ABI_VERSION >= 10304 && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+      if (fl_mac_os_version >= 100400) handleTabletPointerEvent(theEvent);	//ERCO
+#endif
       if ( !sendEvent ) {
         sendEvent = FL_MOVE; // Fl::handle will convert into FL_DRAG
         if (fabs(pos.x-px)>5 || fabs(pos.y-py)>5) 
@@ -2244,6 +2286,10 @@
 - (BOOL)acceptsFirstMouse:(NSEvent*)theEvent;
 - (void)resetCursorRects;
 - (BOOL)performKeyEquivalent:(NSEvent*)theEvent;
+#if FLTK_ABI_VERSION >= 10304 && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+- (void)tabletProximity:(NSEvent *)theEvent;	//ERCO 10.4
+- (void)tabletPoint:(NSEvent *)theEvent;	//ERCO 10.4
+#endif
 - (void)mouseUp:(NSEvent *)theEvent;
 - (void)rightMouseUp:(NSEvent *)theEvent;
 - (void)otherMouseUp:(NSEvent *)theEvent;
@@ -2348,6 +2394,14 @@
   else
     [self addCursorRect:[self visibleRect] cursor:[NSCursor arrowCursor]];
 }
+#if FLTK_ABI_VERSION >= 10304 && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+- (void)tabletProximity:(NSEvent *)theEvent {	//ERCO
+  cocoaMouseHandler(theEvent);
+}
+- (void)tabletPoint:(NSEvent *)theEvent {	//ERCO
+  cocoaMouseHandler(theEvent);
+}
+#endif
 - (void)mouseUp:(NSEvent *)theEvent {
   cocoaMouseHandler(theEvent);
 }
