Author: manolo
Date: 2011-05-21 14:55:59 -0700 (Sat, 21 May 2011)
New Revision: 8710
Log:
Fix STR #2638. The X11 part is simplified as suggested by Bill.

Modified:
   branches/branch-1.3/FL/Enumerations.H
   branches/branch-1.3/src/Fl.cxx
   branches/branch-1.3/src/Fl_win32.cxx
   branches/branch-1.3/src/Fl_x.cxx

Modified: branches/branch-1.3/FL/Enumerations.H
===================================================================
--- branches/branch-1.3/FL/Enumerations.H       2011-05-21 21:41:12 UTC (rev 
8709)
+++ branches/branch-1.3/FL/Enumerations.H       2011-05-21 21:55:59 UTC (rev 
8710)
@@ -366,6 +366,27 @@
 #define FL_Alt_R       0xffea  ///< The right alt key. 
 #define FL_Delete      0xffff  ///< The delete key.
 
+// These use the Private Use Area (PUA) of the Basic Multilingual Plane
+// of Unicode. Guaranteed not to conflict with a proper Unicode character.
+
+// These primarily map to the XFree86 keysym range
+#define FL_Volume_Down  0xEF11   /* Volume control down        */
+#define FL_Volume_Mute  0xEF12   /* Mute sound from the system */
+#define FL_Volume_Up    0xEF13   /* Volume control up          */
+#define FL_Media_Play   0xEF14   /* Start playing of audio     */
+#define FL_Media_Stop   0xEF15   /* Stop playing audio         */
+#define FL_Media_Prev   0xEF16   /* Previous track             */
+#define FL_Media_Next   0xEF17   /* Next track                 */
+#define FL_Home_Page    0xEF18   /* Display user's home page   */
+#define FL_Mail         0xEF19   /* Invoke user's mail program */
+#define FL_Search       0xEF1B   /* Search                     */
+#define FL_Back         0xEF26   /* Like back on a browser     */
+#define FL_Forward      0xEF27   /* Like forward on a browser  */
+#define FL_Stop         0xEF28   /* Stop current operation     */
+#define FL_Refresh      0xEF29   /* Refresh the page           */
+#define FL_Sleep        0xEF2F   /* Put system to sleep        */
+#define FL_Favorites    0xEF30   /* Show favorite locations    */
+
 /*@}*/ // group: Mouse and Keyboard Events
 
 /** \name Mouse Buttons

Modified: branches/branch-1.3/src/Fl.cxx
===================================================================
--- branches/branch-1.3/src/Fl.cxx      2011-05-21 21:41:12 UTC (rev 8709)
+++ branches/branch-1.3/src/Fl.cxx      2011-05-21 21:55:59 UTC (rev 8710)
@@ -35,6 +35,16 @@
 #include <FL/Fl_Window.H>
 #include <FL/Fl_Tooltip.H>
 
+/* We require Windows 2000 features (e.g. VK definitions) */
+#if defined(WIN32)
+# if !defined(WINVER) || (WINVER < 0x0500)
+#  define WINVER 0x0500
+# endif
+# if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)
+#  define _WIN32_WINNT 0x0500
+# endif
+#endif
+
 // recent versions of MinGW warn: "Please include winsock2.h before windows.h",
 // hence we must include winsock2.h before FL/x.H (A.S. Dec. 2010)
 #if defined(WIN32) && !defined(__CYGWIN__)

Modified: branches/branch-1.3/src/Fl_win32.cxx
===================================================================
--- branches/branch-1.3/src/Fl_win32.cxx        2011-05-21 21:41:12 UTC (rev 
8709)
+++ branches/branch-1.3/src/Fl_win32.cxx        2011-05-21 21:55:59 UTC (rev 
8710)
@@ -742,6 +742,7 @@
   {VK_LWIN,    FL_Meta_L},
   {VK_RWIN,    FL_Meta_R},
   {VK_APPS,    FL_Menu},
+  {VK_SLEEP, FL_Sleep},
   {VK_MULTIPLY,        FL_KP+'*'},
   {VK_ADD,     FL_KP+'+'},
   {VK_SUBTRACT,        FL_KP+'-'},
@@ -749,6 +750,23 @@
   {VK_DIVIDE,  FL_KP+'/'},
   {VK_NUMLOCK, FL_Num_Lock},
   {VK_SCROLL,  FL_Scroll_Lock},
+# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0500)
+  {VK_BROWSER_BACK, FL_Back},
+  {VK_BROWSER_FORWARD, FL_Forward},
+  {VK_BROWSER_REFRESH, FL_Refresh},
+  {VK_BROWSER_STOP, FL_Stop},
+  {VK_BROWSER_SEARCH, FL_Search},
+  {VK_BROWSER_FAVORITES, FL_Favorites},
+  {VK_BROWSER_HOME, FL_Home_Page},
+  {VK_VOLUME_MUTE, FL_Volume_Mute},
+  {VK_VOLUME_DOWN, FL_Volume_Down},
+  {VK_VOLUME_UP, FL_Volume_Up},
+  {VK_MEDIA_NEXT_TRACK, FL_Media_Next},
+  {VK_MEDIA_PREV_TRACK, FL_Media_Prev},
+  {VK_MEDIA_STOP, FL_Media_Stop},
+  {VK_MEDIA_PLAY_PAUSE, FL_Media_Play},
+  {VK_LAUNCH_MAIL, FL_Mail},
+#endif
   {0xba,       ';'},
   {0xbb,       '='},
   {0xbc,       ','},

Modified: branches/branch-1.3/src/Fl_x.cxx
===================================================================
--- branches/branch-1.3/src/Fl_x.cxx    2011-05-21 21:41:12 UTC (rev 8709)
+++ branches/branch-1.3/src/Fl_x.cxx    2011-05-21 21:55:59 UTC (rev 8710)
@@ -1337,6 +1337,57 @@
          keysym = FL_Meta_R;
          break;
       }
+    // Convert the multimedia keys to safer, portable values
+    switch (keysym) { // XF names come from X11/XF86keysym.h
+      case 0x1008FF11: // XF86XK_AudioLowerVolume:
+       keysym = FL_Volume_Down;
+       break;
+      case 0x1008FF12: // XF86XK_AudioMute:
+       keysym = FL_Volume_Mute;
+       break;
+      case 0x1008FF13: // XF86XK_AudioRaiseVolume:
+       keysym = FL_Volume_Up;
+       break;
+      case 0x1008FF14: // XF86XK_AudioPlay:
+       keysym = FL_Media_Play;
+       break;
+      case 0x1008FF15: // XF86XK_AudioStop:
+       keysym = FL_Media_Stop;
+       break;
+      case 0x1008FF16: // XF86XK_AudioPrev:
+       keysym = FL_Media_Prev;
+       break;
+      case 0x1008FF17: // XF86XK_AudioNext:
+       keysym = FL_Media_Next;
+       break;
+      case 0x1008FF18: // XF86XK_HomePage:
+       keysym = FL_Home_Page;
+       break;
+      case 0x1008FF19: // XF86XK_Mail:
+       keysym = FL_Mail;
+       break;
+      case 0x1008FF1B: // XF86XK_Search:
+       keysym = FL_Search;
+       break;
+      case 0x1008FF26: // XF86XK_Back:
+       keysym = FL_Back;
+       break;
+      case 0x1008FF27: // XF86XK_Forward:
+       keysym = FL_Forward;
+       break;
+      case 0x1008FF28: // XF86XK_Stop:
+       keysym = FL_Stop;
+       break;
+      case 0x1008FF29: // XF86XK_Refresh:
+       keysym = FL_Refresh;
+       break;
+      case 0x1008FF2F: // XF86XK_Sleep:
+       keysym = FL_Sleep;
+       break;
+      case 0x1008FF30: // XF86XK_Favorites:
+       keysym = FL_Favorites;
+       break;
+    }
     // We have to get rid of the XK_KP_function keys, because they are
     // not produced on Windoze and thus case statements tend not to check
     // for them.  There are 15 of these in the range 0xff91 ... 0xff9f

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to