<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1088,6 +1088,8 @@ mouse.
 ::
 
   : get-coords ( -xy ) -1 12 out wait ;
+  : button? ( -n ) -2 12 out wait ;
+
 
 ==========================
 Section 6: Core Extensions</diff>
      <filename>doc/RetroLanguage.rst</filename>
    </modified>
    <modified>
      <diff>@@ -27,6 +27,7 @@ typedef struct {
   SDL_Surface *font;
   int mouse_x;
   int mouse_y;
+  int mouse_b;
 } DEVICES;
 
 DEVICES io;
@@ -94,6 +95,23 @@ int handle_devices(void *unused)
              io.mouse_x = event.motion.x;
              io.mouse_y = event.motion.y;
              break;
+        case SDL_MOUSEBUTTONDOWN:
+             switch(event.button.button)
+             {
+               case SDL_BUTTON_LEFT:
+                    io.mouse_b = 1;
+                    break;
+               case SDL_BUTTON_RIGHT:
+                    io.mouse_b = 2;
+                    break;
+               case SDL_BUTTON_MIDDLE:
+                    io.mouse_b = 3;
+                    break;
+             }
+             break;
+        case SDL_MOUSEBUTTONUP:
+             io.mouse_b = 0;
+             break;
       }
     }
     if (vm.ports[2] == 1)
@@ -155,6 +173,12 @@ int handle_devices(void *unused)
       vm.ports[12] = 0;
       vm.ports[0] = 1;
     }
+    if (vm.ports[12] == -2)
+    {
+      vm.sp++; vm.data[vm.sp] = io.mouse_b;
+      vm.ports[12] = 0;
+      vm.ports[0] = 1;
+    }
   }
   return 0;
 }</diff>
      <filename>vm/framebuffer/devices.c</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>936c0976fd2df4b35ef685bcb98e062d3cf69a8b</id>
    </parent>
  </parents>
  <author>
    <name>Charles Childers</name>
    <email>crc.platypus@gmail.com</email>
  </author>
  <url>http://github.com/crcx/retro10/commit/4a479955639cce9ab007fdcbc6a21d71abb9e1b5</url>
  <id>4a479955639cce9ab007fdcbc6a21d71abb9e1b5</id>
  <committed-date>2009-06-15T18:22:36-07:00</committed-date>
  <authored-date>2009-06-15T18:22:36-07:00</authored-date>
  <message>support for detecting left, right, and middle mouse buttons [framebuffer]</message>
  <tree>a692fcf8080ae547cdded6a5b6348c018813d815</tree>
  <committer>
    <name>Charles Childers</name>
    <email>crc.platypus@gmail.com</email>
  </committer>
</commit>
