gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-


From: Rob Savoye
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-1323-gab931a1
Date: Sun, 11 Dec 2011 21:08:12 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  ab931a106bb3aa93e5e07ba6a9168e1da66ba60b (commit)
       via  d0cc551ed868404b601cfb84a928d1bcb27ab6b8 (commit)
       via  44a4e8988530b4794b7504c5c43cf8ec849c75c5 (commit)
       via  3d329957ee66cf39ccacafade57cb6e599eebdeb (commit)
       via  cf2df86c566fe057155c33461922f1d9d16acaa7 (commit)
       via  c1df7a6a363e22f78135971b9ca21877fa7f93d0 (commit)
       via  abab83684600c9e09148389ba286310bb2390808 (commit)
       via  314b36841f168801eca9b8a1d466d1794112ebe8 (commit)
       via  6bf5de1e575901eb9e0d1b3add6b22c415806cd4 (commit)
       via  548622f46f26424a4c785d37c3ee2060b85cc753 (commit)
       via  4e82296287d28142f3d02a196980370140be65db (commit)
       via  2d7840986b25a3c1471d9cb6bb2beccc42dbe8c7 (commit)
       via  3f09f88a5b22178cbd72176b46480a3857a29027 (commit)
       via  88cce64a1d1030166784f66ce2bec6c817ead5f4 (commit)
       via  c32b73a328edfa001189b26fd91964f97c218fac (commit)
       via  a7af918e32a9bafbe2d545ec591a550d3e430a72 (commit)
       via  10723c4a0c4713b9f4eb2fdb21d4f7958a9c9984 (commit)
       via  cc9c6132d3e1fa87f54ae9f55e2963b7258db476 (commit)
       via  af793a40e4f2259a46244ffeae5419912a8af3a5 (commit)
       via  040e7ea13fa8f080e02508b517017d11462da014 (commit)
       via  3bf5e4607b866c336dc4471facdd1c410c8d0e51 (commit)
       via  dc9ad048750c562869648722b4ed4ae4805cb42c (commit)
       via  53241bfe34d2791071ab4de13497f5bc0f8a6c8f (commit)
       via  4c5d96106b64987360121a4a9277a485c190a0c2 (commit)
       via  c1ea116948702e2fa9e8ce6f168de57f66d4eaff (commit)
       via  5d64bf77cabfd8c4e5a84feb776d90d988ebaa4d (commit)
       via  5d546de608127a70d10539261e836d0bdfa0b968 (commit)
       via  311abd475fcc86afa891b2087bf2661866d2d6b0 (commit)
       via  a6af9710cbab16b0693dcb05a851dc618f79919e (commit)
       via  2a9e81f3f85c1e39b51543669b51e12d4fdf2bc0 (commit)
       via  3f06fb38778854fe7301f2a49dcac6310db86020 (commit)
       via  87824d1de4e05f509e0b2928e31ad4e3e23b87ff (commit)
       via  bc96f587c6bb35fb45d34afd432048b5eee2d644 (commit)
       via  80baf93137dacc802609ddf3eef520c4e9c1d2d7 (commit)
       via  40e8f708b49b71839681973923efbe72d5247962 (commit)
       via  0b5fc40fd9e48b569b4467281b463f1d3451ce6d (commit)
       via  16b7a3aeac7957b4aee5f01c7af1e573f6e3396d (commit)
       via  cac4d53390873466ba710bda7b3512f4d0ec135f (commit)
       via  d7e21679125e98814dee3ba0649f1d7f37f48b06 (commit)
       via  b2cab90c32c10cbc72296d3ecaef397de6ae7888 (commit)
       via  6d6b7560b8a45f9b09b9c80927644fba84646a22 (commit)
       via  44afdfbc3440d05db451cfea7551f2babe89fce4 (commit)
       via  6969f2a7bbd483d2228fc4da41f4d7b67af30904 (commit)
      from  23b5ee46323b8460dbbb90d676c2f0ba30e789d6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=ab931a106bb3aa93e5e07ba6a9168e1da66ba60b


commit ab931a106bb3aa93e5e07ba6a9168e1da66ba60b
Author: Rob Savoye <address@hidden>
Date:   Sun Dec 11 12:25:42 2011 -0700

    initialize private data

diff --git a/libdevice/events/EventDevice.cpp b/libdevice/events/EventDevice.cpp
index cc462dc..766be72 100644
--- a/libdevice/events/EventDevice.cpp
+++ b/libdevice/events/EventDevice.cpp
@@ -38,8 +38,16 @@ static const char *INPUT_DEVICE = "/dev/input/event0";
 static LogFile& dbglogfile = LogFile::getDefaultInstance();
 
 EventDevice::EventDevice()
+    :  keyb_lshift(false),
+       keyb_rshift(false),
+       keyb_lctrl(false),
+       keyb_rctrl(false),
+       keyb_lalt(false),
+       keyb_ralt(false)
 {
     // GNASH_REPORT_FUNCTION;
+
+    memset(&_device_info, 0, sizeof(struct input_id));
 }
 
 bool

http://git.savannah.gnu.org/cgit//commit/?id=d0cc551ed868404b601cfb84a928d1bcb27ab6b8


commit d0cc551ed868404b601cfb84a928d1bcb27ab6b8
Author: Rob Savoye <address@hidden>
Date:   Sun Dec 11 11:28:38 2011 -0700

    eliminate compiler warnings

diff --git a/cygnal/rtmp_server.cpp b/cygnal/rtmp_server.cpp
index be0652e..ad34af2 100644
--- a/cygnal/rtmp_server.cpp
+++ b/cygnal/rtmp_server.cpp
@@ -289,8 +289,8 @@ RTMPServer::handShakeResponse(int fd, cygnal::Buffer 
&handshake)
 {
     GNASH_REPORT_FUNCTION;
 
-    boost::uint8_t byte;
-    byte = RTMP_VERSION;
+    // boost::uint8_t byte;
+    // byte = RTMP_VERSION;
 
     // the response handshake is twice the size of the one we just
     // received for a total of 3072 bytes, plus room for the version.
@@ -1064,9 +1064,13 @@ RTMPServer::encodeAudio(boost::uint8_t *data, size_t 
size)
 }
 
 boost::shared_ptr<cygnal::Buffer>
-RTMPServer::encodeVideo(boost::uint8_t *data, size_t size)
+RTMPServer::encodeVideo(boost::uint8_t * /* data */, size_t /* size */)
 {
     GNASH_REPORT_FUNCTION;
+
+    boost::shared_ptr<cygnal::Buffer> buf;
+    
+    return buf;
 }
 
 #if 0
@@ -1351,7 +1355,7 @@ rtmp_handler(Network::thread_params_t *args)
     url = docroot;
     bool done = false;
     boost::shared_ptr<RTMPMsg> body;
-    static bool initialize = true;
+    // static bool initialize = true;
 //     bool sendfile = false;
     log_network(_("Starting RTMP Handler for fd #%d, cgi-bin is \"%s\""),
                args->netfd, args->filespec);
@@ -1694,13 +1698,13 @@ rtmp_handler(Network::thread_params_t *args)
                    log_error("Couldn't send Ping to client!");
                }
 #endif
-               initialize = true;
+               // initialize = true;
                return true;
            }
        } else {
            // log_error("Communication error with client using fd #%d", 
args->netfd);
            rtmp->closeNet(args->netfd);
-           initialize = true;
+           // initialize = true;
            return false;
        }
     } while (!done);

http://git.savannah.gnu.org/cgit//commit/?id=44a4e8988530b4794b7504c5c43cf8ec849c75c5


commit 44a4e8988530b4794b7504c5c43cf8ec849c75c5
Author: Rob Savoye <address@hidden>
Date:   Sun Dec 11 11:24:17 2011 -0700

    eliminate compiler warnings

diff --git a/cygnal/http_server.cpp b/cygnal/http_server.cpp
index 71b98b1..d63a294 100644
--- a/cygnal/http_server.cpp
+++ b/cygnal/http_server.cpp
@@ -87,13 +87,13 @@ HTTPServer::~HTTPServer()
 }
 
 HTTP::http_method_e
-HTTPServer::processClientRequest(int fd)
+HTTPServer::processClientRequest(int /* fd */)
 {
     GNASH_REPORT_FUNCTION;
     
-    cygnal::Buffer *buf = new cygnal::Buffer;
-
+    //cygnal::Buffer *buf = new cygnal::Buffer;
     // return processClientRequest(fd, buf);
+    
     return HTTP::HTTP_NONE;
 }
 
@@ -270,7 +270,7 @@ HTTPServer::processGetRequest(Handler *hand, int fd, 
cygnal::Buffer *buf)
 // the header like we normally do, we then read the amount of bytes specified 
by
 // the "content-length" field, and then write that data to disk, or decode the 
amf.
 boost::shared_ptr<cygnal::Buffer>
-HTTPServer::processPostRequest(int fd, cygnal::Buffer *bufFIXME)
+HTTPServer::processPostRequest(int fd, cygnal::Buffer * /* bufFIXME */)
 {
     GNASH_REPORT_FUNCTION;
 
@@ -301,6 +301,9 @@ HTTPServer::processPostRequest(int fd, cygnal::Buffer 
*bufFIXME)
     } else {   
 //     cerr << "Need to read more data, only have "  << buf->allocated() << " 
bytes" << endl;
        ret = readNet(fd, *content, 2);
+       if (ret < 0) {
+           log_error("couldn't read data!");
+       }
        data = content->reference();
     }    
     
diff --git a/cygnal/libnet/cque.cpp b/cygnal/libnet/cque.cpp
index 08bef87..7b4d170 100644
--- a/cygnal/libnet/cque.cpp
+++ b/cygnal/libnet/cque.cpp
@@ -249,7 +249,8 @@ CQue::merge(boost::shared_ptr<cygnal::Buffer> start)
     }
 
     // Finally erase all merged elements, and replace with the composite one
-    que_t::iterator nextIter = _que.erase(from, to);
+    _que.erase(from, to);
+    //que_t::iterator nextIter = _que.erase(from, to);
 //    _que.insert(nextIter, newbuf.get()); FIXME:
 
     return newbuf; //->release(); // ownership is transferred. TODO: return 
auto_ptr

http://git.savannah.gnu.org/cgit//commit/?id=3d329957ee66cf39ccacafade57cb6e599eebdeb


commit 3d329957ee66cf39ccacafade57cb6e599eebdeb
Author: Rob Savoye <address@hidden>
Date:   Sun Dec 11 11:19:08 2011 -0700

    only dump data when -d is specified

diff --git a/utilities/flvdumper.cpp b/utilities/flvdumper.cpp
index 09870a4..c45e34d 100644
--- a/utilities/flvdumper.cpp
+++ b/utilities/flvdumper.cpp
@@ -235,7 +235,9 @@ main(int argc, char *argv[])
                     log_error("Couldn't read the entire tag");
                 }
                 tag  = flv.decodeTagHeader(buf);
-                flv.dump();
+                if (dump) {
+                    flv.dump();
+                }
                 //total -= sizeof(Flv::previous_size_t);
                 size_t bodysize = flv.convert24(tag->bodysize);
                 if (bodysize == 0) {

http://git.savannah.gnu.org/cgit//commit/?id=cf2df86c566fe057155c33461922f1d9d16acaa7


commit cf2df86c566fe057155c33461922f1d9d16acaa7
Author: Rob Savoye <address@hidden>
Date:   Sun Dec 11 11:17:48 2011 -0700

    initialize netfd to eliminate compiler warning

diff --git a/cygnal/cgi-bin/echo/echo.cpp b/cygnal/cgi-bin/echo/echo.cpp
index ab1b552..0b06f4a 100644
--- a/cygnal/cgi-bin/echo/echo.cpp
+++ b/cygnal/cgi-bin/echo/echo.cpp
@@ -163,7 +163,7 @@ main(int argc, char *argv[])
     }
 
     EchoTest net;
-    int netfd;
+    int netfd = 0;
     
     if (infile.empty()) {
         if (netdebug) {

http://git.savannah.gnu.org/cgit//commit/?id=c1df7a6a363e22f78135971b9ca21877fa7f93d0


commit c1df7a6a363e22f78135971b9ca21877fa7f93d0
Merge: abab836 314b368
Author: Rob Savoye <address@hidden>
Date:   Sun Dec 11 11:06:40 2011 -0700

    Merge branch 'dbbuf'


http://git.savannah.gnu.org/cgit//commit/?id=abab83684600c9e09148389ba286310bb2390808


commit abab83684600c9e09148389ba286310bb2390808
Author: Rob Savoye <address@hidden>
Date:   Sun Dec 11 11:06:14 2011 -0700

    use nil instead of t for emacs indent-tabs-mode

diff --git a/cygnal/cygnal.cpp b/cygnal/cygnal.cpp
index 9639c7d..abd807c 100644
--- a/cygnal/cygnal.cpp
+++ b/cygnal/cygnal.cpp
@@ -1163,5 +1163,5 @@ event_handler(Network::thread_params_t *args)
 
 // local Variables:
 // mode: C++
-// indent-tabs-mode: t
+// indent-tabs-mode: nil
 // End:

http://git.savannah.gnu.org/cgit//commit/?id=314b36841f168801eca9b8a1d466d1794112ebe8


commit 314b36841f168801eca9b8a1d466d1794112ebe8
Author: Rob Savoye <address@hidden>
Date:   Sun Dec 11 11:05:07 2011 -0700

    fix input device mouse support.

diff --git a/libdevice/events/EventDevice.cpp b/libdevice/events/EventDevice.cpp
index f82ea17..cc462dc 100644
--- a/libdevice/events/EventDevice.cpp
+++ b/libdevice/events/EventDevice.cpp
@@ -60,25 +60,29 @@ EventDevice::init(const std::string &filespec, size_t /* 
size */)
     _filespec = filespec;
     
     // Try to open mouse device, be error tolerant (FD is kept open all the 
time)
-    _fd = open(filespec.c_str(), O_RDONLY);
+    _fd = open(filespec.c_str(), O_RDONLY | O_NONBLOCK);
   
     if (_fd < 0) {
-        log_debug(_("Could not open %s: %s"), filespec.c_str(), 
strerror(errno));    
+        log_debug(_("Could not open %s: %s"), filespec, strerror(errno));    
         return false;
     }
-  
+
+#if 0
     if (fcntl(_fd, F_SETFL, fcntl(_fd, F_GETFL) | O_NONBLOCK) < 0) {
         log_error(_("Could not set non-blocking mode for pointing device: %s"),
                   strerror(errno));
-        close(_fd);
-        _fd = -1;
-        return false; 
+        if (_fd) {
+            close(_fd);
+            _fd = -1;
+            return false;
+        }
     }
-
+#endif
+    
     // Get the version number of the input event subsystem
     int version;
     if (ioctl(_fd, EVIOCGVERSION, &version)) {
-        perror("evdev ioctl");
+        log_error("ioctl (EVIOCGVERSION)");
     }
 #if 0
     log_debug("evdev driver version is %d.%d.%d",
@@ -87,12 +91,12 @@ EventDevice::init(const std::string &filespec, size_t /* 
size */)
 #endif
     
     if(ioctl(_fd, EVIOCGID, &_device_info)) {
-        perror("evdev ioctl");
+        log_error("ioctl (EVIOCGID): %s", strerror(errno));
     }
     
     char name[256]= "Unknown";
     if(ioctl(_fd, EVIOCGNAME(sizeof(name)), name) < 0) {
-        perror("evdev ioctl");
+        log_error("ioctl (EVIOCGNAME): %s", strerror(errno));
     }
     log_debug("The device on %s says its name is %s", filespec, name);
     // /dev/mxc_ts is the Touchscreen driver used by the Freescale Babbage 
board
@@ -115,7 +119,10 @@ EventDevice::init(const std::string &filespec, size_t /* 
size */)
           // device things truly are.          
           log_debug("is on a Universal Serial Bus");
           // ID 0eef:0001 D-WAV Scientific Co., Ltd eGalax TouchScreen
-          if ((_device_info.product == 0x0001) && (_device_info.vendor == 
0x0eef)) {
+          if ((_device_info.product == 0) && (_device_info.vendor == 0)) {
+              _type = InputDevice::UMOUSE;
+              // ID 046d:c001 Logitech, Inc. N48/M-BB48 [FirstMouse Plus]
+          } else if ((_device_info.product == 0x0001) && (_device_info.vendor 
== 0x0eef)) {
               _type = InputDevice::TOUCHMOUSE;
               // ID 046d:c001 Logitech, Inc. N48/M-BB48 [FirstMouse Plus]
           } else if ((_device_info.product == 0xc001) && (_device_info.vendor 
== 0x046d)) {
@@ -202,29 +209,36 @@ EventDevice::init(const std::string &filespec, size_t /* 
size */)
     }
     
     log_debug("Event enabled for %s on fd #%d", _filespec, _fd);
-    
-    // Set the scale of the display so the absolute postions
-    // we get from the touchscreen driver are correct.
-    struct input_absinfo abs;
-    abs.minimum = 0;
-    abs.fuzz = 4;
-    abs.flat = 8;
+
+#if 0
+    // FIXME: this has probably been replaced by the uinput device code
+    if (_type == InputDevice::MOUSE) {
+        // Get the existing absolute info
+        struct input_absinfo abs;
+        memset(&abs, 0, sizeof(struct input_absinfo));
+        if (ioctl (_fd, EVIOCGABS(ABS_X), &abs) < 0) {
+            log_error("ioctl (EVIOCGABS(ABS_X)): %s", strerror(errno));
+        }
 #ifdef ABSINFO_RESOLUTION
-    abs.resolution = 0;
+        abs.resolution = 0;
 #endif
-    abs.maximum = 800;
-    if (ioctl(_fd, EVIOCSABS(ABS_X), &abs) < 0) {
-        perror("ioctl(EVIOCSABS(ABS_X))");
-    }
-    abs.maximum = 480;
-    if (ioctl(_fd, EVIOCSABS(ABS_Y), &abs) < 0) {
-        perror("ioctl(EVIOCSABS(ABS_Y))");
-    }
-#if 0
-    if (ioctl(_fd, EVIOCGRAB, (void *)1) < 0) {
-        perror("ioctl(EVIOCGRAB(1))");
-    }
+        abs.minimum = 0;
+        abs.maximum = _screen_width;
+        // Set the scale of the display so the absolute postions
+        // we get from the touchscreen driver are correct.
+        if (ioctl (_fd, EVIOCSABS(ABS_X), &abs) < 0) {
+            log_error("ioctl (EVIOCSABS(ABS_X)): %s", strerror(errno));
+        }
+        if (ioctl(_fd, EVIOCGABS(ABS_Y), &abs) < 0) {
+            log_error("ioctl (EVIOCGABS(ABS_Y)): %s", strerror(errno));
+        }
+        abs.maximum = _screen_height;
+        if (ioctl (_fd, EVIOCSABS(ABS_Y), &abs) < 0) {
+            log_error("ioctl (EVIOCSABS(ABS_Y)): %s", strerror(errno));
+        }
+    }  // end of _type
 #endif
+    
     return true;
 }
 
@@ -653,7 +667,7 @@ EventDevice::scancode_to_gnash_key(int code, bool shift)
 std::vector<boost::shared_ptr<InputDevice> > 
 EventDevice::scanForDevices()
 {
-    GNASH_REPORT_FUNCTION;
+    // GNASH_REPORT_FUNCTION;
 
     struct stat st;
 
@@ -689,13 +703,13 @@ EventDevice::scanForDevices()
 
         char name[256] = "Unknown";
         if(ioctl(fd, EVIOCGNAME(sizeof(name)), name) < 0) {
-            perror("evdev ioctl");
+            log_error("ioctl (EVIOCGNAME): %s", strerror(errno));
         }
         log_debug("The device on %s says its name is %s", filespec, name);
 
         struct input_id device_info;
         if(ioctl(fd, EVIOCGID, &device_info)) {
-            perror("evdev ioctl");
+            log_error("ioctl (EVIOCGID): %s", strerror(errno));
         }
         log_debug("vendor %04hx product %04hx version %04hx",
                   device_info.vendor, device_info.product,
@@ -703,10 +717,19 @@ EventDevice::scanForDevices()
         close(fd);
         boost::shared_ptr<InputDevice> dev;
         dev = boost::shared_ptr<InputDevice>(new EventDevice());
-        if (dev->init(filespec, DEFAULT_BUFFER_SIZE)) {
-            devices.push_back(dev);
+        // The Uinput device has no product, vendor, or version data.
+        if ((device_info.vendor + device_info.product + device_info.version) > 
0) {
+            if (dev->init(filespec, DEFAULT_BUFFER_SIZE)) {
+                // dev->dump();
+                // We don't care about power buttons, we mostly just want
+                // keyboards, mice, and touchscreens. Power buttons don't have
+                // a vendor ID.
+                if (device_info.vendor != 0) {
+                    log_debug("Enabling USB device: %s", name);
+                    devices.push_back(dev);
+                }
+            }
         }
-//        dev->dump();
         
         // setup the next device filespec to try
         total++;
diff --git a/libdevice/events/InputDevice.cpp b/libdevice/events/InputDevice.cpp
index c31e278..4bc36aa 100644
--- a/libdevice/events/InputDevice.cpp
+++ b/libdevice/events/InputDevice.cpp
@@ -153,7 +153,7 @@ InputDevice::dump() const
 {
     // Debug strings to make output more readable
     const char *debug[] = {
-        "UNKNOWN",
+        "Sleep Button",
         "Keyboard",
         "User mode Mouse",
         "Mouse",
@@ -172,19 +172,17 @@ InputDevice::dump() const
 //    std::cerr << "\tX is: " << _x << ", Y is: " << _y << std::endl;
 }
 
-// The Babbage touchscreen gives is absolute coordinates, but they don't
+// The Babbage touchscreen gives is relative coordinates, but they don't
 // match the actual screen resolution. So we convert the coordinates
 // to a new absolute location.
-// For example, if the LCD is 480 x 800, the tablet thinks this is 1010 x 960.
-// This should really use a calibration function, but as we know the numbers...
 boost::shared_array<int>
 InputDevice::convertAbsCoords(int x, int y, int width, int height)
 {
     // GNASH_REPORT_FUNCTION;
     boost::shared_array<int> coords(new int[2]);
 
-    coords[0] = (x/width) * x;
-    coords[1] = (y/height) * y;
+    coords[0] = int((x/256) * width);
+    coords[1] = int((y/256) * height);
     
     return coords;
 }
@@ -209,6 +207,8 @@ InputDevice::scanForDevices()
     for (it=id.begin(); it!=id.end(); ++it) {
         devices.push_back(*it);
     }
+#else
+    log_debug("WARNING: PS/2 Mouse support disabled as it conflicts with the 
input event support.");
 #endif
 #if defined(HAVE_TSLIB_H) && defined(USE_TSLIB)
     id = TouchDevice::scanForDevices();
diff --git a/libdevice/events/InputDevice.h b/libdevice/events/InputDevice.h
index aeec6f2..5ebe47c 100644
--- a/libdevice/events/InputDevice.h
+++ b/libdevice/events/InputDevice.h
@@ -45,6 +45,26 @@ namespace gnash {
 // default size.
 static const int DEFAULT_BUFFER_SIZE = 256;
 
+
+// The Uinput device is write only, and is used to control the mouse movements.
+// It's not really an input device, but uses the same subsystem.
+class UinputDevice
+{
+public:
+    UinputDevice();
+    ~UinputDevice();
+    const char *id() { return "Uinput"; };
+    bool init();
+
+    bool scanForDevice();
+    
+    // Move the mouse cursor to a specified location
+    bool moveTo(int x, int y);
+private:
+    int _fd;
+    std::string _filespec;
+};
+
 // This is an InputDevice class to cover the various touchscreens, Mice, or
 // keyboards supported.
 class InputDevice
@@ -83,7 +103,9 @@ public:
         POWERBUTTON,
         SLEEPBUTTON,
         SERIALUSB,
-        INFRARED
+        INFRARED,
+        UINPUT,
+        TSLIB
     } devicetype_e;
     InputDevice();
     // Instantiate with the screen size
@@ -157,16 +179,6 @@ public:
     /// Sends a command to the mouse and waits for the response
     bool command(unsigned char cmd, unsigned char *buf, int count);
 
-    /// \brief. Mouse movements are relative to the last position, so
-    /// this method is used to convert from relative position to
-    /// the absolute position Gnash needs.
-    static boost::shared_array<int> convertCoordinates(int x, int y, int width,
-        int height);
-
-    // Move the mouse cursor to a specified location
-    bool moveToUMouse(int x, int y);
-    bool initUMouse();
-    
 private:
     int _previous_x;
     int _previous_y;
diff --git a/libdevice/events/MouseDevice.cpp b/libdevice/events/MouseDevice.cpp
index d8f08bb..d38af2f 100644
--- a/libdevice/events/MouseDevice.cpp
+++ b/libdevice/events/MouseDevice.cpp
@@ -44,11 +44,6 @@ MouseDevice::MouseDevice()
 MouseDevice::~MouseDevice()
 {
     // GNASH_REPORT_FUNCTION;
-    if (_type == InputDevice::UMOUSE) {
-        if (ioctl(_fd, UI_DEV_DESTROY) < 0) {
-            log_error("ioctl(UI_DEV_DESTROY)");
-        }
-    }
 }
 
 std::vector<boost::shared_ptr<InputDevice> >
@@ -81,8 +76,6 @@ MouseDevice::scanForDevices()
     };    
 
     struct mouse_types mice[] = {
-        {InputDevice::UMOUSE, "/dev/uinput"},          // User mode Mouse
-        {InputDevice::UMOUSE, "/dev/input/uinput"},    // User mode Mouse
         {InputDevice::MOUSE, "/dev/input/mice"},       // PS/2 Mouse
 #ifdef MULTIPLE_DEVICES
         {InputDevice::MOUSE, "/dev/input/mouse0"},
@@ -97,32 +90,32 @@ MouseDevice::scanForDevices()
         int fd = 0;
         if (stat(mice[i].filespec, &st) == 0) {
             // Then see if we can open it
-            if ((fd = open(mice[i].filespec, O_RDWR)) < 0) {
+            if ((fd = open(mice[i].filespec, O_RDWR|O_NONBLOCK)) < 0) {
                 log_error("You don't have the proper permissions to open %s",
                           mice[i].filespec);
                 i++;
                 continue;
             }
-            close(fd);
             log_debug("Found a %s device for mouse input using %s",
                       debug[mice[i].type], mice[i].filespec);
             
             boost::shared_ptr<InputDevice> dev;
 #if defined(USE_MOUSE_PS2) || defined(USE_MOUSE_ETT)
             dev = boost::shared_ptr<InputDevice>(new MouseDevice());
+            // The User Mode Mouse is write only, so we don't consider
+            // it an input device.
             dev->setType(mice[i].type);
+            // Close the device now that we know the permissions are
+            // correct. It's reopened correctly by init() when each
+            // found device is instantiated.
+            if (fd) {
+                close(fd);
+            }
             if (dev->init(mice[i].filespec, DEFAULT_BUFFER_SIZE)) {
                 devices.push_back(dev);
             }
             // dev->dump();
 #endif
-#if 0
-            // The User mode Mouse driver is preferred over the others.
-            if ((mice[i].type = InputDevice::UMOUSE)) {
-                log_debug("Defaulting to User Mode Mouse support");
-                return devices;
-            }
-#endif
         }     // stat()
         
         i++;
@@ -142,48 +135,43 @@ MouseDevice::init()
 bool
 MouseDevice::init(const std::string &filespec, size_t size)
 {
-    // GNASH_REPORT_FUNCTION;
+    GNASH_REPORT_FUNCTION;
 
     _filespec = filespec;
-    _buffer.reset(new boost::uint8_t[size]);
 
-    // see http://www.computer-engineering.org/ps2mouse/ 
+    _fd = open(filespec.c_str(), O_RDWR | O_NDELAY);
     
-    // Try to open mouse device, be error tolerant (FD is kept open all the 
time
-    if (_type == InputDevice::UMOUSE) {
-        _fd = open(filespec.c_str(), O_WRONLY | O_NDELAY);       
-        if (initUMouse()) {
-            moveToUMouse(400, 400);
-            return true;
-        }
-    } else {
-        _fd = open(filespec.c_str(), O_RDWR);
+    if (_fd < 0) {
+        log_debug("Could not open %s: %s", filespec, strerror(errno));
+        return false;
+    }
     
-        if (_fd < 0) {
-            log_debug("Could not open %s: %s", filespec, strerror(errno));
-            return false;
-        }
-        
-        if (fcntl(_fd, F_SETFL, fcntl(_fd, F_GETFL) | O_NONBLOCK) < 0) {
-            log_error("Could not set non-blocking mode for mouse device: %s", 
strerror(errno));
+#if 0
+    if (fcntl(_fd, F_SETFL, fcntl(_fd, F_GETFL) | O_NONBLOCK) < 0) {
+        log_error("Could not set non-blocking mode for mouse device: %s", 
strerror(errno));
+        if (_fd) {
             close(_fd);
             _fd = -1;
             return false; 
         }
     }
-    
+#endif
+
+    // see http://www.computer-engineering.org/ps2mouse/    
     // Clear input buffer
     unsigned char buf[10], byte;
     while (read(_fd, buf, size) > 0 ) { }
-
+    
     // A touchscreen works similar to a Mouse, but not exactly...
     if (_type == InputDevice::MOUSE) {
         // Reset mouse
         if ((!command(0xFF, buf, 3)) || (buf[0] != 0xFA)) {
-            log_debug(_("Mouse reset failed"));
-            close(_fd);
-            _fd = -1;
-            return false; 
+            log_error(_("Mouse reset failed"));
+            if (_fd) {
+                close(_fd);
+                _fd = -1;
+                return false;
+            }
         }
         
         // Get Device ID (not crucial, debug only)
@@ -198,9 +186,11 @@ MouseDevice::init(const std::string &filespec, size_t size)
         // Enable mouse data reporting
         if ((!command(0xF4, &byte, 1)) || (byte != 0xFA)) {
             log_debug(_("Could not activate Data Reporting mode for mouse"));
-            close(_fd);
-            _fd = -1;
-            return false; 
+            if (_fd) {
+                close(_fd);
+                _fd = -1;
+                return false;
+            }
         }  
         
         log_debug("Mouse enabled for %s on fd #%d", _filespec, _fd);
@@ -209,92 +199,6 @@ MouseDevice::init(const std::string &filespec, size_t size)
     return true;
 }
 
-bool
-MouseDevice::initUMouse()
-{
-    GNASH_REPORT_FUNCTION;
-
-    _type = UMOUSE;
-
-    struct uinput_user_dev uidev;
-    
-    if (ioctl(_fd, UI_SET_EVBIT, EV_KEY) < 0) {
-        log_error("ioctl(UI_SET_EVBIT, EV_KEY)");
-        return false;
-    }
-    if (ioctl(_fd, UI_SET_KEYBIT, BTN_MOUSE) < 0) {
-        log_error("ioctl(UI_SET_KEYBIT, BTN_MOUSE)");
-        return false;
-    }
-    if (ioctl(_fd, UI_SET_KEYBIT, BTN_LEFT) < 0) {
-        log_error("ioctl(UI_SET_KEYBIT, BTN_LEFT))");
-        return false;
-    }
-    if (ioctl(_fd, UI_SET_KEYBIT, BTN_RIGHT) < 0) {
-        log_error("ioctl(UI_SET_KEYBIT, BTN_RIGHT)");
-        return false;
-    }
-    if (ioctl(_fd, UI_SET_EVBIT, EV_REL) < 0) {
-        log_error("ioctl(UI_SET_EVBIT, EV_REL)");
-        return false;
-    }
-    if (ioctl(_fd, UI_SET_RELBIT, REL_X) < 0) {
-        log_error("ioctl(UI_SET_RELBIT, REL_X)");
-        return false;
-    }
-    if (ioctl(_fd, UI_SET_RELBIT, REL_Y) < 0) {
-        log_error("ioctl( UI_SET_RELBIT, REL_Y)");
-        return false;
-    }
-    if (ioctl(_fd, UI_SET_EVBIT, EV_ABS) < 0) {
-        log_error("ioctl(UI_SET_EVBIT, EV_ABS)");
-        return false;
-    }
-    if (ioctl(_fd, UI_SET_ABSBIT,ABS_X) < 0) {
-        log_error("ioctl(UI_SET_ABSBIT,ABS_X)");
-        return false;
-    }
-    if (ioctl(_fd, UI_SET_ABSBIT, ABS_Y) < 0) {
-        log_error("ioctl(UI_SET_ABSBIT, ABS_Y)");
-        return false;
-    }
-
-    for (int i=0; i<256; i++) {
-        if (ioctl(_fd, UI_SET_KEYBIT, i) < 0) {
-            log_error("ioctl(UI_SET_KEYBIT, i)");
-            return false;
-        }
-    }
-    
-    memset(&uidev, 0, sizeof(uidev));
-    snprintf(uidev.name, UINPUT_MAX_NAME_SIZE, "uinput");
-    uidev.id.bustype = BUS_USB;
-    uidev.id.vendor  = 0x1;
-    uidev.id.product = 0x1;
-    uidev.id.version = 1;
-
-    uidev.absmin[ABS_X] = 0;
-    uidev.absmax[ABS_X] = _screen_width;
-    uidev.absfuzz[ABS_X] = 0;
-    uidev.absflat[ABS_X] = 0;
-    uidev.absmin[ABS_Y] = 0;
-    uidev.absmax[ABS_Y] = _screen_height;
-    uidev.absfuzz[ABS_Y] = 0;
-    uidev.absflat[ABS_Y ] = 0;
-
-    if (::write(_fd, (char *)&uidev, sizeof(uidev)) < 0) {
-        log_error("write uidev");
-        return false;
-    }
-
-    if (ioctl(_fd, UI_DEV_CREATE) < 0) {
-        log_error("ioctl(UI_DEV_CREATED)");
-        return false;
-    }
-
-    return true;
-}
-
 // From http://www.computer-engineering.org/ps2mouse
 //
 // PS/2 Mouse mouse data is always in a 3 byte packet that looks like this:
@@ -333,17 +237,13 @@ MouseDevice::check()
 {
     // GNASH_REPORT_FUNCTION;
 
-    if (_fd < 0) {
-        return false;   // no mouse available
-    }
-    
     int xmove, ymove, btn;
     boost::shared_array<boost::uint8_t> buf;
     if (_type == InputDevice::TOUCHMOUSE) {
         // The eTurboTouch has a 4 byte packet
         buf = readData(4);
-    } else {
-        // PS/2 Mouse packets are always 3 bytes
+    } else if (_type == InputDevice::MOUSE) {
+            // PS/2 Mouse packets are always 3 bytes
         buf = readData(3);
     }
     
@@ -360,7 +260,7 @@ MouseDevice::check()
     // A Touchscreen works similar to a Mouse, but not exactly.
     // At least for the eTurboTouch, it has a different layout
     // in the packet for the location as it has an additional byte
-    btn   = buf[0] & 0x7;
+    btn = buf[0] & 0x7;
     if (_type == InputDevice::TOUCHMOUSE) {
         xmove = (buf[1] << 7) | (buf[2]);
         ymove = (buf[3] << 7) | (buf[4]);
@@ -401,41 +301,48 @@ MouseDevice::check()
         // Byte 2  Horizontal movement count in two’s complement; -256 
through 255.
         //     Note that the sign bit is in the first byte.
         // Byte 3  Vertical movement count in two’s complement; -256 through 
255.
-        //     Note that the sign bit is in the first byte.
-        xmove = buf[1];
-        ymove = buf[2];
-    
+        //  Note that the sign bit is in the first byte.
+        //
+        xmove = (~buf[1])+1;
+        ymove = (~buf[2])+1;
+ 
+        if (buf[0] & 0x40) {
+            log_debug("Vertical mouse movement overflow bit set");
+        }
+        if (buf[0] & 0x80) {
+            log_debug("Horizontal mouse movement overflow bit set");
+        }
+        // 0,0 is the lower left of the display, so the negative bits are set
+        // when going from the upper left to the lower right.
+        
         if (buf[0] & 0x10) {
-            xmove = -(256-xmove);
+            log_debug("Horizontal mouse movement negative bit set");
+        } else {
+            xmove *= -1;
         }
         if (buf[0] & 0x20) {
-            ymove = -(256-ymove);
+            log_debug("Vertical mouse movement negative bit set");
+        } else {
+            ymove *= -1;
         }
         
-        ymove *= -1; // vertical movement is upside-down
-        
         log_debug(_("PS/2 Mouse: Xmove=%d, Ymove=%d,  Button %d"),
                   xmove, ymove, btn);
         
-        // movement    
         _input_data.x += xmove;
-        _input_data.y += ymove;
-        
         if (_input_data.x < 0) {
             _input_data.x = 0;
         }
+
+        _input_data.y += ymove;
         if (_input_data.y < 0) {
             _input_data.y = 0;
         }
-        // FIXME: this is a bit of a temporary hack. The last two
-        // arguments are a range, so hardcoding them is safe for
-        // now. In the future more conversion may be done, making this
-        // then be incorrect.
         boost::shared_array<int> coords =
             InputDevice::convertAbsCoords(_input_data.x, _input_data.y,
                                           _screen_width, _screen_height);
-            // MouseDevice::convertCoordinates(_input_data.x, _input_data.y,
-            //                          _screen_width, _screen_height);
+        // MouseDevice::convertCoordinates(_input_data.x, _input_data.y,
+        //                          _screen_width, _screen_height);
         log_debug(_("convert: Xin=%d, Yin=%d, Xout=%d, Yout=%d"),
                   _input_data.x, _input_data.y, coords[0],coords[1]);
         
@@ -457,78 +364,6 @@ MouseDevice::check()
     return true;
 }
 
-// Move the mouse cursor to a specified location
-bool
-MouseDevice::moveToUMouse(int x, int y)
-{
-    GNASH_REPORT_FUNCTION;
-
-    struct input_event ev;
-    
-    memset(&ev, 0, sizeof(ev));
-    gettimeofday(&ev.time, NULL);
-    ev.type = EV_ABS;
-    ev.code = ABS_X;
-    ev.value = x;
-    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
-        log_error("write ABS_X");
-        return false;
-    }
-    
-    gettimeofday(&ev.time, NULL);
-    ev.code = SYN_REPORT;
-    ev.type = EV_SYN;
-    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
-        log_error("write SYN");
-        return false;
-    }
-
-    gettimeofday(&ev.time, NULL);
-    ev.type = EV_ABS;
-    ev.code = ABS_Y;
-    ev.value = y;
-    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
-        log_error("write ABS_Y");
-        return false;
-    }
-
-    gettimeofday(&ev.time, NULL);
-    ev.code = SYN_REPORT;
-    ev.type = EV_SYN;
-    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
-        log_error("write SYN");
-        return false;
-    }
-
-    ////////////////////////////
-    gettimeofday(&ev.time, NULL);
-    ev.type = EV_KEY;
-    ev.code = BTN_LEFT;
-    ev.value = 0;
-    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
-        log_error("write SYN");
-        return false;
-    }
-    gettimeofday(&ev.time, NULL);
-    ev.type = EV_KEY;
-    ev.code = BTN_LEFT;
-    ev.value = 1;
-    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
-        log_error("write SYN");
-        return false;
-    }
-    
-    gettimeofday(&ev.time, NULL);
-    ev.type = EV_SYN;
-    ev.code = SYN_REPORT;
-    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
-        log_error("write SYN");
-        return false;
-    }
-
-    return true;
-}   
-
 bool
 MouseDevice::command(unsigned char cmd, unsigned char *buf, int count)
 {
@@ -566,30 +401,6 @@ MouseDevice::command(unsigned char cmd, unsigned char 
*buf, int count)
     
 } // command()
 
-/// \brief. Mouse movements are relative to the last position, so
-/// this method is used to convert from relative position to
-/// the absolute position Gnash needs.
-boost::shared_array<int>
-MouseDevice::convertCoordinates(int x, int y, int width, int height)
-{
-//    GNASH_REPORT_FUNCTION;
-    
-    boost::shared_array<int> coords(new int[2]);
-    
-    if (x > width) {
-        coords[0] = width;
-    } else {
-        coords[0] = x;
-    }
-    if (y > height) {
-        coords[1] = height;
-    } else {
-        coords[1] = y;
-    }
-
-    return coords;
-}
-
 // end of namespace
 }
 
diff --git a/libdevice/events/TouchDevice.cpp b/libdevice/events/TouchDevice.cpp
index da3d80a..c40c587 100644
--- a/libdevice/events/TouchDevice.cpp
+++ b/libdevice/events/TouchDevice.cpp
@@ -127,7 +127,7 @@ TouchDevice::check()
             // now. In the future more conversion may be done, making this
             // then be incorrect.
             boost::shared_array<int> coords =
-                MouseDevice::convertCoordinates(event.x, event.y,
+                InputDevice::convertAbsCoords(event.x, event.y,
                                                 _screen_width, _screen_height);
             log_debug("Touched x: %d, y: %d", event.x , event.y);
             addData(true, gnash::key::INVALID, 0, event.x, event.y);
@@ -140,7 +140,7 @@ TouchDevice::check()
     return true;
 }
 
-// FIXME: this currently is lacking thw swf program used to generate the
+// FIXME: this currently is lacking the swf program used to generate the
 // input data. Instead use the tslib utility 'ts_calibrate', as Gnash now
 // has TSlib support.
 void
diff --git a/libdevice/events/UinputDevice.cpp 
b/libdevice/events/UinputDevice.cpp
index 8447889..818a115 100644
--- a/libdevice/events/UinputDevice.cpp
+++ b/libdevice/events/UinputDevice.cpp
@@ -33,22 +33,23 @@
 namespace gnash {
 
 UinputDevice::UinputDevice()
+    : _fd(-1)
 {
-    GNASH_REPORT_FUNCTION;
+    // GNASH_REPORT_FUNCTION;
 }
 
 UinputDevice::~UinputDevice()
 {
-    GNASH_REPORT_FUNCTION;
-    if (_type == InputDevice::UMOUSE && _fd) {
-        if (ioctl(_fd, UI_DEV_DESTROY) < 0) {
+    // GNASH_REPORT_FUNCTION;
+    if (_fd) {
+        if (ioctl(_fd, UI_DEV_DESTROY, 0) < 0) {
             log_error("ioctl(UI_DEV_DESTROY)");
         }
     }
 }
 
-boost::shared_ptr<UinputDevice>
-UinputDevice::scanForDevices()
+bool
+UinputDevice::scanForDevice()
 {
     // GNASH_REPORT_FUNCTION;
 
@@ -61,7 +62,8 @@ UinputDevice::scanForDevices()
     };    
 
     // The Uinput device is found in one of these two locations.
-    const char mice[] = {
+    const char *mice[] = {
+        "/dev/input/event4",
         "/dev/uinput",
         "/dev/input/uinput",
         0
@@ -69,51 +71,51 @@ UinputDevice::scanForDevices()
 
     int i = 0;
     while (mice[i]) {
-        int fd = 0;
         if (stat(mice[i], &st) == 0) {
-            // Then see if we can open it
-            if ((fd = open(mice[i].filespec, O_RDWR|O_NONBLOCK)) < 0) {
+            // Then see if we can open it, this is a write only device
+            if ((_fd = open(mice[i], O_WRONLY)) < 0) {
                 log_error("You don't have the proper permissions to open %s",
                           mice[i]);
                 i++;
                 continue;
             }
-            if (fd) {
-                close(fd);
-            }
-            log_debug("Found a Uinput device for mouse input using %s", 
mice[i]);
+            log_debug("Found a User mode input device at %s", mice[i]);
+            return true;
             
-        }     // stat()        
+        }     // stat()      
         i++;
     }         // while()
     
-    return devices;
+    return false;
 }
 
 bool
 UinputDevice::init()
 {
-    GNASH_REPORT_FUNCTION;
-
-    _type = UMOUSE;
+    // GNASH_REPORT_FUNCTION;
 
+    if (_fd < 0) {
+        log_error("User Mode Input device not initialized yet!");
+        return false;
+    }
+    
     if (ioctl(_fd, UI_SET_EVBIT, EV_KEY) < 0) {
         log_error("ioctl(UI_SET_EVBIT, EV_KEY)");
-        return false;
+        // return false;
     }
 
 #if 0 // USE_RELATIVE_POINTER
     if (ioctl(_fd, UI_SET_EVBIT, EV_REL) < 0) {
         log_error("ioctl(UI_SET_EVBIT, EV_REL)");
-        return false;
+        // return false;
     }
     if (ioctl(_fd, UI_SET_RELBIT, REL_X) < 0) {
         log_error("ioctl(UI_SET_RELBIT, REL_X)");
-        return false;
+        // return false;
     }
     if (ioctl(_fd, UI_SET_RELBIT, REL_Y) < 0) {
         log_error("ioctl( UI_SET_RELBIT, REL_Y)");
-        return false;
+        // return false;
     }
 #else
 #if 1 // USE_ABSOLUTE_POINTER
@@ -121,7 +123,7 @@ UinputDevice::init()
 
     memset(&uidev, 0, sizeof(uidev));
     snprintf(uidev.name, UINPUT_MAX_NAME_SIZE, "uinput");
-    // uidev.id.bustype = BUS_USB;
+    uidev.id.bustype = BUS_USB;
     // uidev.id.vendor  = 0x1;
     // uidev.id.product = 0x1;
     // uidev.id.version = 1;
@@ -138,98 +140,50 @@ UinputDevice::init()
 
     if (::write(_fd, (char *)&uidev, sizeof(uidev)) < 0) {
         log_error("write uidev");
-        return false;
+        // return false;
     }
 #endif
     if (ioctl(_fd, UI_SET_EVBIT, EV_ABS) < 0) {
-        log_error("ioctl(UI_SET_EVBIT, EV_ABS)");
-        return false;
+        log_error("ioctl(UI_SET_EVBIT, EV_ABS): %s", strerror(errno));
+        // return false;
     }
     if (ioctl(_fd, UI_SET_ABSBIT,ABS_X) < 0) {
-        log_error("ioctl(UI_SET_ABSBIT,ABS_X)");
-        return false;
+        log_error("ioctl(UI_SET_ABSBIT,ABS_X): %s", strerror(errno));
+        // return false;
     }
     if (ioctl(_fd, UI_SET_ABSBIT, ABS_Y) < 0) {
-        log_error("ioctl(UI_SET_ABSBIT, ABS_Y)");
-        return false;
+        log_error("ioctl(UI_SET_ABSBIT, ABS_Y): %s", strerror(errno));
+        // return false;
     }
 #endif
     
     if (ioctl(_fd, UI_SET_KEYBIT, BTN_LEFT) < 0) {
-        log_error("ioctl(UI_SET_KEYBIT, BTN_LEFT))");
-        return false;
+        log_error("ioctl(UI_SET_KEYBIT, BTN_LEFT)): %s", strerror(errno));
+        // return false;
     }
     if (ioctl(_fd, UI_SET_KEYBIT, BTN_RIGHT) < 0) {
-        log_error("ioctl(UI_SET_KEYBIT, BTN_RIGHT)");
-        return false;
+        log_error("ioctl(UI_SET_KEYBIT, BTN_RIGHT): %s", strerror(errno));
+        // return false;
     }
     if (ioctl(_fd, UI_SET_EVBIT, ABS_PRESSURE) < 0) {
-        log_error("ioctl(UI_SET_EVBIT, ABS_PRESSURE)");
-        return false;
+        log_error("ioctl(UI_SET_EVBIT, ABS_PRESSURE): %s", strerror(errno));
+        // return false;
     }
     // if (ioctl(_fd, UI_SET_EVBIT, ABS_TOUCH) < 0) {
     //     log_error("ioctl(UI_SET_EVBIT, ABS_TOUCH)");
     //     return false;
     // }
     if (ioctl(_fd, UI_SET_KEYBIT, BTN_MOUSE) < 0) {
-        log_error("ioctl(UI_SET_KEYBIT, BTN_MOUSE)");
-        return false;
+        log_error("ioctl(UI_SET_KEYBIT, BTN_MOUSE): %s", strerror(errno));
+        // return false;
     }
 
-#if 0
-    for (int i=0; i<256; i++) {
-        if (ioctl(_fd, UI_SET_KEYBIT, i) < 0) {
-            log_error("ioctl(UI_SET_KEYBIT, i)");
-            return false;
-        }
-    }
-#endif
-
     if (ioctl(_fd, UI_DEV_CREATE, 0) < 0) {
         perror("UI_DEV_CREATE");
         log_error("ioctl(UI_DEV_CREATED) failed!");
-        return false;
-    }
-
-#if 1
-    ///////////////////
-    struct input_event ev;
-    memset(&ev, 0, sizeof(ev));
-    gettimeofday(&ev.time, NULL);
-    ev.type = EV_ABS;
-    ev.code = ABS_X;
-    ev.value = 10;
-    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
-        log_error("write ABS_X");
-        return false;
-    }
-    
-    ev.type = EV_ABS;
-    ev.code = ABS_Y;
-    ev.value = 10;
-    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
-        log_error("write ABS_Y");
-        return false;
+        // return false;
     }
     
-    memset(&ev, 0, sizeof(ev));
-    gettimeofday(&ev.time, NULL);
-    ev.type = EV_REL;
-    ev.code = REL_X;
-    ev.value = 10;
-    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
-        log_error("write ABS_X");
-        return false;
-    }
-    
-    ev.type = EV_SYN;
-    ev.code = SYN_REPORT;
-    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
-        log_error("write SYN");
-        return false;
-    }
-#endif
-    
     return true;
 }
 
@@ -237,7 +191,7 @@ UinputDevice::init()
 bool
 UinputDevice::moveTo(int x, int y)
 {
-    GNASH_REPORT_FUNCTION;
+    // GNASH_REPORT_FUNCTION;
 
     struct input_event ev;
     
@@ -273,32 +227,6 @@ UinputDevice::moveTo(int x, int y)
         return false;
     }
 
-    // ////////////////////////////
-    // gettimeofday(&ev.time, NULL);
-    // ev.type = EV_KEY;
-    // ev.code = BTN_LEFT;
-    // ev.value = 0;
-    // if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
-    //     log_error("write SYN");
-    //     return false;
-    // }
-    // gettimeofday(&ev.time, NULL);
-    // ev.type = EV_KEY;
-    // ev.code = BTN_LEFT;
-    // ev.value = 1;
-    // if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
-    //     log_error("write SYN");
-    //     return false;
-    // }
-    
-    // gettimeofday(&ev.time, NULL);
-    // ev.type = EV_SYN;
-    // ev.code = SYN_REPORT;
-    // if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
-    //     log_error("write SYN");
-    //     return false;
-    // }
-
     return true;
 }   
 
diff --git a/libdevice/events/test_events.cpp b/libdevice/events/test_events.cpp
index 6779eb4..8e64f27 100644
--- a/libdevice/events/test_events.cpp
+++ b/libdevice/events/test_events.cpp
@@ -85,6 +85,7 @@ main(int argc, char *argv[])
         cerr << "Found " << id->id() << " device" << endl;
         if (id->init()) {
             runtest.pass("InputDevice::init()");
+            id->setScreenSize(1024, 768);        
         } else {
             runtest.fail("InputDevice::init()()");
         }

http://git.savannah.gnu.org/cgit//commit/?id=6bf5de1e575901eb9e0d1b3add6b22c415806cd4


commit 6bf5de1e575901eb9e0d1b3add6b22c415806cd4
Author: Rob Savoye <address@hidden>
Date:   Sun Dec 11 10:59:19 2011 -0700

    cleanup optional PS/2 mouse handlingm use InputDevice::convertAbsCoords() 
instead of MouseDevice::convertCoordinates()

diff --git a/gui/fb/fb.cpp b/gui/fb/fb.cpp
index 9f05771..da2bc9b 100644
--- a/gui/fb/fb.cpp
+++ b/gui/fb/fb.cpp
@@ -257,16 +257,15 @@ FBGui::init(int argc, char *** argv)
         // mouse locations from relative ones.
         (*it)->setScreenSize(_width, _height);
         // (*it)->dump();
+#if defined(USE_MOUSE_PS2) || defined(USE_MOUSE_ETT)
         if ((*it)->getType() == InputDevice::MOUSE) {
-#if 0
-            log_debug("WARNING: Mouse support disabled as it conflicts with 
the input event support.");
+            log_debug("WARNING: Mouse support may conflict with the input 
event support.");
             // For now we only want keyboard input events, as the mouse
             // interface default of /dev/input/mice supports hotpluging 
devices,
             // unlike the regular events.
-#else
             _inputs.push_back(*it);
-#endif
         }
+#endif
         if ((*it)->getType() == InputDevice::KEYBOARD) {
             _inputs.push_back(*it);
         }
@@ -286,6 +285,7 @@ FBGui::init(int argc, char *** argv)
 #endif
         }
         if ((*it)->getType() == InputDevice::POWERBUTTON) {
+            log_debug("Enabling Power Button support");
             _inputs.push_back(*it);
         }
     }
@@ -719,19 +719,18 @@ FBGui::checkForData()
             // cerr << "X = " << coords[0] << endl;
             // cerr << "Y = " << coords[1] << endl;
 #endif
-#if 0
             // Range check and convert the position from relative to
             // absolute
             boost::shared_array<int> coords =
-                MouseDevice::convertCoordinates(ie->x, ie->y,
-                                                getStage()->getStageWidth(),
-                                                getStage()->getStageHeight());
+                InputDevice::convertAbsCoords(ie->x, ie->y,
+                                              getStage()->getStageWidth(),
+                                              getStage()->getStageHeight());
             // The mouse was moved
-            _uinput.moveTo(ie.x, ie.y);
+            _uinput.moveTo(coords[0], coords[1]);
             if (coords) {
                 notifyMouseMove(coords[0], coords[1]);
             }
-#endif
+            
             // See if a mouse button was clicked
             if (ie->pressed) {
                 notifyMouseClick(true);

http://git.savannah.gnu.org/cgit//commit/?id=548622f46f26424a4c785d37c3ee2060b85cc753


commit 548622f46f26424a4c785d37c3ee2060b85cc753
Author: Rob Savoye <address@hidden>
Date:   Sun Dec 11 10:57:55 2011 -0700

    don't enable the PS/2 mouse by default, we use input events for the mouse 
instead.

diff --git a/configure.ac b/configure.ac
index ab9e940..48825f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -808,7 +808,7 @@ dnl or keyboard attached.
 dnl By default, don't build any of these, as they are only for the 
 dnl Framebuffer running without X11.
 if test x"${build_fb}" = xyes -a x"${linux}" = xyes; then
-  build_ps2mouse=yes
+  build_ps2mouse=no
   build_ps2keyboard=yes
   build_input_events=yes
   build_tslib=yes
@@ -852,7 +852,7 @@ AC_ARG_ENABLE(input,
         build_ps2mouse=yes
         build_ps2keyboard=yes
         build_tslib=yes
-        if test x"${build_fb}" = xyes -a x"${linux}" = xyes; then
+        if test x"${linux}" = xyes; then
           build_input_events=yes
           input_events="PS/2 Mouse, PS/2 Keyboard, Input Devices, Touchscreen 
via Tslib"                
         else
@@ -1867,11 +1867,11 @@ dnl or keyboard attached.
 dnl By default, don't build any of these, as they are only for the Framebuffer
 dnl running without X11.
 if test x"${build_fb}" = xyes; then
-  build_ps2mouse=yes
-  build_ps2keyboard=no
+  build_ps2mouse=no
+  build_ps2keyboard=yes
   build_input_events=yes
   build_tslib=yes
-  input_events="PS/2 Mouse, Input Devices, Touchscreen via Tslib"
+  input_events="Input Devices, Touchscreen via Tslib"
 else
   build_ps2mouse=no
   build_ps2keyboard=no

http://git.savannah.gnu.org/cgit//commit/?id=4e82296287d28142f3d02a196980370140be65db


commit 4e82296287d28142f3d02a196980370140be65db
Author: Rob Savoye <address@hidden>
Date:   Sat Dec 10 21:48:20 2011 -0700

    use new uinput device to control the cursor

diff --git a/gui/fb/fb.cpp b/gui/fb/fb.cpp
index 56440d3..9f05771 100644
--- a/gui/fb/fb.cpp
+++ b/gui/fb/fb.cpp
@@ -230,7 +230,16 @@ FBGui::init(int argc, char *** argv)
     }
     
     disable_terminal();
-    
+
+    // Look for the User Mode Input (Uinput) device, which is used to
+    // control the movement and coordinates of the mouse cursor.
+    if (_uinput.scanForDevice()) {
+        _uinput.init();
+        _uinput.moveTo(0, 0);
+    } else {
+        log_error("Found no accessible User mode input event device");
+    }
+        
     // Initialize all the input devices
 
     // Look for Mice that use the PS/2 mouse protocol
@@ -247,13 +256,16 @@ FBGui::init(int argc, char *** argv)
         // Set the screen size, which is used for calculating absolute
         // mouse locations from relative ones.
         (*it)->setScreenSize(_width, _height);
-        (*it)->dump();
+        // (*it)->dump();
         if ((*it)->getType() == InputDevice::MOUSE) {
+#if 0
             log_debug("WARNING: Mouse support disabled as it conflicts with 
the input event support.");
             // For now we only want keyboard input events, as the mouse
             // interface default of /dev/input/mice supports hotpluging 
devices,
             // unlike the regular events.
+#else
             _inputs.push_back(*it);
+#endif
         }
         if ((*it)->getType() == InputDevice::KEYBOARD) {
             _inputs.push_back(*it);
@@ -517,7 +529,6 @@ FBGui::disable_terminal()
 
     _original_kd = -1;
     
-    struct vt_stat vts;
     
     // Find the TTY device name
     
@@ -540,6 +551,7 @@ FBGui::disable_terminal()
         return false;
     }
     
+    struct vt_stat vts;
     if (ioctl(fd, VT_GETSTATE, &vts) == -1) {
         log_debug(_("WARNING: Could not get current VT state"));
         close(_fd);
@@ -700,7 +712,7 @@ FBGui::checkForData()
         boost::shared_ptr<InputDevice::input_data_t> ie = (*it)->popData();
         if (ie) {            
             // notifyMouseMove(ie->x, ie->y);
-#if 1
+#if 0
             std::cerr << "Got data: " << ((ie->pressed) ? "true" : "false");
             std::cerr << ", " << ie->key << ", " << ie->modifier;
             std::cerr << ", " << ie->x << ", " << ie->y << std::endl;
@@ -715,6 +727,7 @@ FBGui::checkForData()
                                                 getStage()->getStageWidth(),
                                                 getStage()->getStageHeight());
             // The mouse was moved
+            _uinput.moveTo(ie.x, ie.y);
             if (coords) {
                 notifyMouseMove(coords[0], coords[1]);
             }

http://git.savannah.gnu.org/cgit//commit/?id=2d7840986b25a3c1471d9cb6bb2beccc42dbe8c7


commit 2d7840986b25a3c1471d9cb6bb2beccc42dbe8c7
Author: Rob Savoye <address@hidden>
Date:   Sat Dec 10 21:47:36 2011 -0700

    add a UInput device to the base class.

diff --git a/gui/fb/fbsup.h b/gui/fb/fbsup.h
index 3948e4e..f505403 100644
--- a/gui/fb/fbsup.h
+++ b/gui/fb/fbsup.h
@@ -201,7 +201,8 @@ private:
     /// This is the array of functioning input devices.
     std::vector<boost::shared_ptr<InputDevice> > _inputs;
 
-    boost::shared_ptr<Renderer>         _renderer;
+    boost::shared_ptr<Renderer> _renderer;
+    UinputDevice                _uinput;
 };
 
 } // end of namespace gui

http://git.savannah.gnu.org/cgit//commit/?id=3f09f88a5b22178cbd72176b46480a3857a29027


commit 3f09f88a5b22178cbd72176b46480a3857a29027
Author: Rob Savoye <address@hidden>
Date:   Sat Dec 10 21:46:55 2011 -0700

    add events/UinputDevice.cpp to build

diff --git a/libdevice/events/events.am b/libdevice/events/events.am
index 1808a06..b2e5128 100644
--- a/libdevice/events/events.am
+++ b/libdevice/events/events.am
@@ -40,7 +40,11 @@ libgnashdevice_la_SOURCES += events/EventDevice.cpp
 endif
 endif
 
-if ENABLE_DEVELOPER_TESTS
+# The Uinput device is write only, and is used to control the mouse
+# movements.
+libgnashdevice_la_SOURCES += events/UinputDevice.cpp
+
+# if ENABLE_DEVELOPER_TESTS
 check_PROGRAMS += test_events evtest
 test_events_SOURCES = events/test_events.cpp
 test_events_CPPFLAGS = $(AM_CPPFLAGS)
@@ -59,4 +63,5 @@ evtest_LDADD = \
        $(TS_LIBS) \
        $(EVENTS_LIBS) \
        $(GNASH_LIBS)
-endif
\ No newline at end of file
+#endif
+

http://git.savannah.gnu.org/cgit//commit/?id=88cce64a1d1030166784f66ce2bec6c817ead5f4


commit 88cce64a1d1030166784f66ce2bec6c817ead5f4
Author: Rob Savoye <address@hidden>
Date:   Sat Dec 10 13:26:24 2011 -0700

    add .gdb_history

diff --git a/.gitignore b/.gitignore
index ca696f2..e6ceb0b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+.gdb_history
 TAGS
 *~
 *.frame*.pp

http://git.savannah.gnu.org/cgit//commit/?id=c32b73a328edfa001189b26fd91964f97c218fac


commit c32b73a328edfa001189b26fd91964f97c218fac
Author: Rob Savoye <address@hidden>
Date:   Sat Dec 10 12:59:37 2011 -0700

    new file for the Uinput device

diff --git a/libdevice/events/UinputDevice.cpp 
b/libdevice/events/UinputDevice.cpp
new file mode 100644
index 0000000..8447889
--- /dev/null
+++ b/libdevice/events/UinputDevice.cpp
@@ -0,0 +1,311 @@
+// 
+//   Copyright (C) 2010, 2011 Free Software Foundation, Inc
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <boost/shared_array.hpp>
+
+#include "GnashSleep.h"
+#include "log.h"
+#include "InputDevice.h"
+
+namespace gnash {
+
+UinputDevice::UinputDevice()
+{
+    GNASH_REPORT_FUNCTION;
+}
+
+UinputDevice::~UinputDevice()
+{
+    GNASH_REPORT_FUNCTION;
+    if (_type == InputDevice::UMOUSE && _fd) {
+        if (ioctl(_fd, UI_DEV_DESTROY) < 0) {
+            log_error("ioctl(UI_DEV_DESTROY)");
+        }
+    }
+}
+
+boost::shared_ptr<UinputDevice>
+UinputDevice::scanForDevices()
+{
+    // GNASH_REPORT_FUNCTION;
+
+    struct stat st;
+
+    // Look for these files for mouse input
+    struct mouse_types {
+        InputDevice::devicetype_e type;
+        const char *filespec;
+    };    
+
+    // The Uinput device is found in one of these two locations.
+    const char mice[] = {
+        "/dev/uinput",
+        "/dev/input/uinput",
+        0
+    };
+
+    int i = 0;
+    while (mice[i]) {
+        int fd = 0;
+        if (stat(mice[i], &st) == 0) {
+            // Then see if we can open it
+            if ((fd = open(mice[i].filespec, O_RDWR|O_NONBLOCK)) < 0) {
+                log_error("You don't have the proper permissions to open %s",
+                          mice[i]);
+                i++;
+                continue;
+            }
+            if (fd) {
+                close(fd);
+            }
+            log_debug("Found a Uinput device for mouse input using %s", 
mice[i]);
+            
+        }     // stat()        
+        i++;
+    }         // while()
+    
+    return devices;
+}
+
+bool
+UinputDevice::init()
+{
+    GNASH_REPORT_FUNCTION;
+
+    _type = UMOUSE;
+
+    if (ioctl(_fd, UI_SET_EVBIT, EV_KEY) < 0) {
+        log_error("ioctl(UI_SET_EVBIT, EV_KEY)");
+        return false;
+    }
+
+#if 0 // USE_RELATIVE_POINTER
+    if (ioctl(_fd, UI_SET_EVBIT, EV_REL) < 0) {
+        log_error("ioctl(UI_SET_EVBIT, EV_REL)");
+        return false;
+    }
+    if (ioctl(_fd, UI_SET_RELBIT, REL_X) < 0) {
+        log_error("ioctl(UI_SET_RELBIT, REL_X)");
+        return false;
+    }
+    if (ioctl(_fd, UI_SET_RELBIT, REL_Y) < 0) {
+        log_error("ioctl( UI_SET_RELBIT, REL_Y)");
+        return false;
+    }
+#else
+#if 1 // USE_ABSOLUTE_POINTER
+    struct uinput_user_dev uidev;
+
+    memset(&uidev, 0, sizeof(uidev));
+    snprintf(uidev.name, UINPUT_MAX_NAME_SIZE, "uinput");
+    // uidev.id.bustype = BUS_USB;
+    // uidev.id.vendor  = 0x1;
+    // uidev.id.product = 0x1;
+    // uidev.id.version = 1;
+
+    uidev.absmin[ABS_X] = 0;
+    uidev.absmax[ABS_X] = 1024; //_screen_width;
+    uidev.absfuzz[ABS_X] = 0;
+    uidev.absflat[ABS_X] = 0;
+    uidev.absmin[ABS_Y] = 0;
+    uidev.absmax[ABS_Y] = 768; //_screen_height;
+    uidev.absfuzz[ABS_Y] = 0;
+    uidev.absflat[ABS_Y ] = 0;
+    uidev.absmax[ABS_PRESSURE]=400;
+
+    if (::write(_fd, (char *)&uidev, sizeof(uidev)) < 0) {
+        log_error("write uidev");
+        return false;
+    }
+#endif
+    if (ioctl(_fd, UI_SET_EVBIT, EV_ABS) < 0) {
+        log_error("ioctl(UI_SET_EVBIT, EV_ABS)");
+        return false;
+    }
+    if (ioctl(_fd, UI_SET_ABSBIT,ABS_X) < 0) {
+        log_error("ioctl(UI_SET_ABSBIT,ABS_X)");
+        return false;
+    }
+    if (ioctl(_fd, UI_SET_ABSBIT, ABS_Y) < 0) {
+        log_error("ioctl(UI_SET_ABSBIT, ABS_Y)");
+        return false;
+    }
+#endif
+    
+    if (ioctl(_fd, UI_SET_KEYBIT, BTN_LEFT) < 0) {
+        log_error("ioctl(UI_SET_KEYBIT, BTN_LEFT))");
+        return false;
+    }
+    if (ioctl(_fd, UI_SET_KEYBIT, BTN_RIGHT) < 0) {
+        log_error("ioctl(UI_SET_KEYBIT, BTN_RIGHT)");
+        return false;
+    }
+    if (ioctl(_fd, UI_SET_EVBIT, ABS_PRESSURE) < 0) {
+        log_error("ioctl(UI_SET_EVBIT, ABS_PRESSURE)");
+        return false;
+    }
+    // if (ioctl(_fd, UI_SET_EVBIT, ABS_TOUCH) < 0) {
+    //     log_error("ioctl(UI_SET_EVBIT, ABS_TOUCH)");
+    //     return false;
+    // }
+    if (ioctl(_fd, UI_SET_KEYBIT, BTN_MOUSE) < 0) {
+        log_error("ioctl(UI_SET_KEYBIT, BTN_MOUSE)");
+        return false;
+    }
+
+#if 0
+    for (int i=0; i<256; i++) {
+        if (ioctl(_fd, UI_SET_KEYBIT, i) < 0) {
+            log_error("ioctl(UI_SET_KEYBIT, i)");
+            return false;
+        }
+    }
+#endif
+
+    if (ioctl(_fd, UI_DEV_CREATE, 0) < 0) {
+        perror("UI_DEV_CREATE");
+        log_error("ioctl(UI_DEV_CREATED) failed!");
+        return false;
+    }
+
+#if 1
+    ///////////////////
+    struct input_event ev;
+    memset(&ev, 0, sizeof(ev));
+    gettimeofday(&ev.time, NULL);
+    ev.type = EV_ABS;
+    ev.code = ABS_X;
+    ev.value = 10;
+    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
+        log_error("write ABS_X");
+        return false;
+    }
+    
+    ev.type = EV_ABS;
+    ev.code = ABS_Y;
+    ev.value = 10;
+    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
+        log_error("write ABS_Y");
+        return false;
+    }
+    
+    memset(&ev, 0, sizeof(ev));
+    gettimeofday(&ev.time, NULL);
+    ev.type = EV_REL;
+    ev.code = REL_X;
+    ev.value = 10;
+    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
+        log_error("write ABS_X");
+        return false;
+    }
+    
+    ev.type = EV_SYN;
+    ev.code = SYN_REPORT;
+    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
+        log_error("write SYN");
+        return false;
+    }
+#endif
+    
+    return true;
+}
+
+// Move the mouse cursor to a specified location
+bool
+UinputDevice::moveTo(int x, int y)
+{
+    GNASH_REPORT_FUNCTION;
+
+    struct input_event ev;
+    
+    memset(&ev, 0, sizeof(ev));
+    gettimeofday(&ev.time, NULL);
+    ev.type = EV_ABS;
+    ev.code = ABS_X;
+    ev.value = x;
+    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
+        log_error("write ABS_X");
+        return false;
+    }
+    
+    ev.code = SYN_REPORT;
+    ev.type = EV_SYN;
+    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
+        log_error("write SYN");
+        return false;
+    }
+
+    ev.type = EV_ABS;
+    ev.code = ABS_Y;
+    ev.value = y;
+    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
+        log_error("write ABS_Y");
+        return false;
+    }
+
+    ev.code = SYN_REPORT;
+    ev.type = EV_SYN;
+    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
+        log_error("write SYN");
+        return false;
+    }
+
+    // ////////////////////////////
+    // gettimeofday(&ev.time, NULL);
+    // ev.type = EV_KEY;
+    // ev.code = BTN_LEFT;
+    // ev.value = 0;
+    // if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
+    //     log_error("write SYN");
+    //     return false;
+    // }
+    // gettimeofday(&ev.time, NULL);
+    // ev.type = EV_KEY;
+    // ev.code = BTN_LEFT;
+    // ev.value = 1;
+    // if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
+    //     log_error("write SYN");
+    //     return false;
+    // }
+    
+    // gettimeofday(&ev.time, NULL);
+    // ev.type = EV_SYN;
+    // ev.code = SYN_REPORT;
+    // if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
+    //     log_error("write SYN");
+    //     return false;
+    // }
+
+    return true;
+}   
+
+// end of namespace
+}
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:

http://git.savannah.gnu.org/cgit//commit/?id=a7af918e32a9bafbe2d545ec591a550d3e430a72


commit a7af918e32a9bafbe2d545ec591a550d3e430a72
Author: Rob Savoye <address@hidden>
Date:   Wed Dec 7 22:15:20 2011 -0700

    add initial support for uinout, ie.. User Mode mouse control, so we can 
move the cursor.

diff --git a/gui/fb/fb.cpp b/gui/fb/fb.cpp
index 0cf69af..56440d3 100644
--- a/gui/fb/fb.cpp
+++ b/gui/fb/fb.cpp
@@ -26,7 +26,7 @@
 ///
 /// Since there can be multiple input devices in /dev/input/ you have to
 /// specify which device to use using the 
-///  POINTING_DEVICE environment variable for the mouse and
+//  POINTING_DEVICE environment variable for the mouse and
 ///  KEYBOARD_DEVICE environment variable for the keyboard
 
 /// \page fb_calibration FB GUI Touchscreen Calibration
@@ -244,13 +244,16 @@ FBGui::init(int argc, char *** argv)
     
     std::vector<boost::shared_ptr<InputDevice> >::iterator it;
     for (it=possibles.begin(); it!=possibles.end(); ++it) {
-        //(*it)->dump();
+        // Set the screen size, which is used for calculating absolute
+        // mouse locations from relative ones.
+        (*it)->setScreenSize(_width, _height);
+        (*it)->dump();
         if ((*it)->getType() == InputDevice::MOUSE) {
             log_debug("WARNING: Mouse support disabled as it conflicts with 
the input event support.");
             // For now we only want keyboard input events, as the mouse
             // interface default of /dev/input/mice supports hotpluging 
devices,
             // unlike the regular events.
-            // _inputs.push_back(*it);
+            _inputs.push_back(*it);
         }
         if ((*it)->getType() == InputDevice::KEYBOARD) {
             _inputs.push_back(*it);
@@ -307,7 +310,7 @@ FBGui::init(int argc, char *** argv)
 
     log_debug("X:%d, Y:%d", _xpos, _ypos);
 #endif
-
+    
     _validbounds.setTo(0, 0, _width - 1, _height - 1);
     
     return true;
@@ -320,7 +323,7 @@ FBGui::resize_view(int width, int height)
 
 //   _glue.prepDrawingArea(width, height, 0);
     Gui::resize_view(width, height);
-
+ 
     return true;
 }
 
@@ -350,12 +353,14 @@ FBGui::run()
         // 10ms per heart beat
         delay = 10000;
     }
-    log_debug("Movie Frame Rate is %d, adjusting delay to %dms", fps, delay);
+    log_debug("Movie Frame Rate is %d, adjusting delay to %dms", fps,
+              _interval * delay);
     
     // This loops endlessly at the frame rate
     while (!terminate_request) {  
-        // wait the "heartbeat" inteval
-        gnashSleep(_interval * delay);
+        // wait the "heartbeat" inteval. _interval is in milliseconds,
+        // but gnashSleep() wants nanoseconds, so adjust by 1000.
+        gnashSleep(_interval * 1000);
         // TODO: Do we need to check the real time slept or is it OK when we 
woke
         // up early because of some Linux signal sent to our process (and thus
         // "advance" faster than the "heartbeat" interval)? - Udo
@@ -693,8 +698,9 @@ FBGui::checkForData()
     for (it=_inputs.begin(); it!=_inputs.end(); ++it) {
         (*it)->check();
         boost::shared_ptr<InputDevice::input_data_t> ie = (*it)->popData();
-        if (ie) {
-#if 0
+        if (ie) {            
+            // notifyMouseMove(ie->x, ie->y);
+#if 1
             std::cerr << "Got data: " << ((ie->pressed) ? "true" : "false");
             std::cerr << ", " << ie->key << ", " << ie->modifier;
             std::cerr << ", " << ie->x << ", " << ie->y << std::endl;
@@ -716,7 +722,7 @@ FBGui::checkForData()
             // See if a mouse button was clicked
             if (ie->pressed) {
                 notifyMouseClick(true);
-#if 0
+#if 1
                 double x = 0.655 * ie->x;
                 double y = 0.46875 * ie->y;
                 log_debug("Mouse clicked at: %g:%g", x, y);
diff --git a/libdevice/events/EventDevice.cpp b/libdevice/events/EventDevice.cpp
index 20f5eab..f82ea17 100644
--- a/libdevice/events/EventDevice.cpp
+++ b/libdevice/events/EventDevice.cpp
@@ -231,7 +231,7 @@ EventDevice::init(const std::string &filespec, size_t /* 
size */)
 bool
 EventDevice::check()
 {
-//    GNASH_REPORT_FUNCTION;
+    // GNASH_REPORT_FUNCTION;
     
     bool activity = false;
   
@@ -260,8 +260,32 @@ EventDevice::check()
     /// queue of events. As the GUI polls for events, there may be multiple 
events
     /// in the queue by the time the main event loop comes around to process 
the
     /// events.
+#if 1
+    // FIXME: debug crap
+    const char *debug[] = {
+        "EV_SYN",
+        "EV_KEY",
+        "EV_REL",
+        "EV_ABS",
+        "EV_MSC",
+        "EV_SW",
+        "unknown",
+        "unknown",
+        "unknown",
+        "unknown",
+        "unknown",
+        "EV_LED",
+        "EV_SND",
+        "EV_REP",
+        "EV_FF",
+        "EV_PWR",
+        "EV_FF_STATUS"
+    };    
     struct input_event *ev = reinterpret_cast<struct input_event *>(buf.get());
-    log_debug("Type is: %hd, Code is: %hd, Val us: %d", ev->type, ev->code, 
ev->value);
+    log_debug("Type is: %s(%hd), Code is: %hd, Val us: %d", debug[ev->type],
+              ev->type, ev->type, ev->code, ev->value);
+#endif
+    
     switch (ev->type) {
       case EV_SYN:
       {
@@ -337,7 +361,43 @@ EventDevice::check()
       } // case EV_KEY
       // Mouse
       case EV_REL:
-          log_unimpl("Relative move event from Input Event Device");
+          switch (ev->code) {
+            case REL_X:
+                log_debug("REL_X: %d", ev->value);
+                _input_data.x = ev->value;
+                break;
+            case REL_Y:
+                log_debug("REL_Y: %d", ev->value);
+                _input_data.y = ev->value;
+                break;
+            case REL_Z:
+                log_debug("REL_Z: %d", ev->value);
+                _input_data.z = ev->value;
+                break;
+            case REL_RX:
+                log_debug("REL_RX: %d", ev->value);
+                _input_data.rx = ev->value;
+                break;
+            case REL_RY:
+                log_debug("REL_RY: %d", ev->value);
+                _input_data.ry = ev->value;
+                break;
+            case REL_RZ:
+                log_debug("REL_RZ: %d", ev->value);
+                _input_data.rz = ev->value;
+                break;
+            case REL_HWHEEL:
+                log_debug("REL_HWHEEL: %d", ev->value);
+            case REL_DIAL:
+                log_debug("REL_DIAL: %d", ev->value);
+            case REL_WHEEL:
+                log_debug("REL_WHEEL: %d", ev->value);
+            case REL_MISC:
+                log_debug("REL_MISC: %d", ev->value);
+            default:
+                log_unimpl("Relative move event %d from Input Event Device",
+                           ev->value);
+          }
           // Touchscreen or joystick
           break;
           // Absolute coordinates come as multiple events, one for
diff --git a/libdevice/events/InputDevice.cpp b/libdevice/events/InputDevice.cpp
index f0f32ae..c31e278 100644
--- a/libdevice/events/InputDevice.cpp
+++ b/libdevice/events/InputDevice.cpp
@@ -30,7 +30,19 @@ namespace gnash {
 
 InputDevice::InputDevice()
     : _type(InputDevice::UNKNOWN),
-      _fd(-1)
+      _fd(-1),
+      _screen_width(0),
+      _screen_height(0)
+{
+    // GNASH_REPORT_FUNCTION;
+    memset(&_input_data, 0, sizeof(InputDevice::input_data_t));
+}
+
+InputDevice::InputDevice(int x, int y)
+    : _type(InputDevice::UNKNOWN),
+      _fd(-1),
+      _screen_width(x),
+      _screen_height(y)
 {
     // GNASH_REPORT_FUNCTION;
     memset(&_input_data, 0, sizeof(InputDevice::input_data_t));
@@ -143,6 +155,7 @@ InputDevice::dump() const
     const char *debug[] = {
         "UNKNOWN",
         "Keyboard",
+        "User mode Mouse",
         "Mouse",
         "Tablet",
         "Touchscreen",
@@ -167,6 +180,7 @@ InputDevice::dump() const
 boost::shared_array<int>
 InputDevice::convertAbsCoords(int x, int y, int width, int height)
 {
+    // GNASH_REPORT_FUNCTION;
     boost::shared_array<int> coords(new int[2]);
 
     coords[0] = (x/width) * x;
diff --git a/libdevice/events/InputDevice.h b/libdevice/events/InputDevice.h
index 2a57914..aeec6f2 100644
--- a/libdevice/events/InputDevice.h
+++ b/libdevice/events/InputDevice.h
@@ -30,6 +30,7 @@
 #include <vector>
 #include <queue>
 #include <linux/input.h>
+#include <linux/uinput.h>
 
 #include "GnashKey.h"
 
@@ -55,6 +56,7 @@ public:
         int modifier;
         int x;
         int y;
+        int z;
         int button;
         int position;
         int pressure;
@@ -73,6 +75,7 @@ public:
     typedef enum {
         UNKNOWN,
         KEYBOARD,
+        UMOUSE,
         MOUSE,
         TABLET,
         TOUCHSCREEN,
@@ -83,6 +86,8 @@ public:
         INFRARED
     } devicetype_e;
     InputDevice();
+    // Instantiate with the screen size
+    InputDevice(int x, int y);
     virtual ~InputDevice();
 
     virtual const char *id() = 0;
@@ -98,6 +103,7 @@ public:
     static std::vector<boost::shared_ptr<InputDevice> > scanForDevices();
     
     InputDevice::devicetype_e getType() { return _type; };
+    void setType(InputDevice::devicetype_e x) { _type = x; };
 
     // Read data into the Device input buffer.
     boost::shared_array<boost::uint8_t> readData(size_t size);
@@ -115,6 +121,11 @@ public:
     static boost::shared_array<int> convertAbsCoords(int x, int y,
                                                      int width, int height);
 
+    void setScreenSize(int x, int y)
+    {
+        _screen_width = x;
+        _screen_height = y;
+    }
     void dump() const;
 
 protected:
@@ -127,12 +138,15 @@ protected:
     // These hold the data queue
     boost::scoped_array<boost::uint8_t> _buffer;
     std::queue<boost::shared_ptr<input_data_t> > _data;
+    int                 _screen_width;
+    int                 _screen_height;    
 };
 
 class MouseDevice : public InputDevice
 {
 public:
     MouseDevice();
+    ~MouseDevice();
     const char *id() { return "Mouse"; };
     bool init();
     bool init(const std::string &filespec, size_t size);
@@ -146,8 +160,16 @@ public:
     /// \brief. Mouse movements are relative to the last position, so
     /// this method is used to convert from relative position to
     /// the absolute position Gnash needs.
-    static boost::shared_array<int> convertCoordinates(int x, int y,
-                                                       int width, int height);
+    static boost::shared_array<int> convertCoordinates(int x, int y, int width,
+        int height);
+
+    // Move the mouse cursor to a specified location
+    bool moveToUMouse(int x, int y);
+    bool initUMouse();
+    
+private:
+    int _previous_x;
+    int _previous_y;
 };
 
 class TouchDevice : public InputDevice
diff --git a/libdevice/events/MouseDevice.cpp b/libdevice/events/MouseDevice.cpp
index 7f38189..d8f08bb 100644
--- a/libdevice/events/MouseDevice.cpp
+++ b/libdevice/events/MouseDevice.cpp
@@ -35,10 +35,22 @@ namespace gnash {
 static const char *MOUSE_DEVICE = "/dev/input/mice";
 
 MouseDevice::MouseDevice()
+    : _previous_x(0),
+      _previous_y(0)
 {
     // GNASH_REPORT_FUNCTION;
 }
 
+MouseDevice::~MouseDevice()
+{
+    // GNASH_REPORT_FUNCTION;
+    if (_type == InputDevice::UMOUSE) {
+        if (ioctl(_fd, UI_DEV_DESTROY) < 0) {
+            log_error("ioctl(UI_DEV_DESTROY)");
+        }
+    }
+}
+
 std::vector<boost::shared_ptr<InputDevice> >
 MouseDevice::scanForDevices()
 {
@@ -58,7 +70,8 @@ MouseDevice::scanForDevices()
     const char *debug[] = {
         "UNKNOWN",
         "Keyboard",
-        "Mouse",
+        "User Mode Mouse",
+        "PS/2 Mouse",
         "Touchscreen",
         "Touchscreen Mouse",
         "Power Button",
@@ -68,7 +81,9 @@ MouseDevice::scanForDevices()
     };    
 
     struct mouse_types mice[] = {
-        {InputDevice::MOUSE, "/dev/input/mice"},      // PS/2 Mouse
+        {InputDevice::UMOUSE, "/dev/uinput"},          // User mode Mouse
+        {InputDevice::UMOUSE, "/dev/input/uinput"},    // User mode Mouse
+        {InputDevice::MOUSE, "/dev/input/mice"},       // PS/2 Mouse
 #ifdef MULTIPLE_DEVICES
         {InputDevice::MOUSE, "/dev/input/mouse0"},
         {InputDevice::MOUSE, "/dev/input/mouse1"},
@@ -95,12 +110,21 @@ MouseDevice::scanForDevices()
             boost::shared_ptr<InputDevice> dev;
 #if defined(USE_MOUSE_PS2) || defined(USE_MOUSE_ETT)
             dev = boost::shared_ptr<InputDevice>(new MouseDevice());
+            dev->setType(mice[i].type);
             if (dev->init(mice[i].filespec, DEFAULT_BUFFER_SIZE)) {
                 devices.push_back(dev);
             }
-//            dev->dump();
+            // dev->dump();
+#endif
+#if 0
+            // The User mode Mouse driver is preferred over the others.
+            if ((mice[i].type = InputDevice::UMOUSE)) {
+                log_debug("Defaulting to User Mode Mouse support");
+                return devices;
+            }
 #endif
         }     // stat()
+        
         i++;
     }         // while()
     
@@ -120,30 +144,37 @@ MouseDevice::init(const std::string &filespec, size_t 
size)
 {
     // GNASH_REPORT_FUNCTION;
 
-    _type = MOUSE;
     _filespec = filespec;
     _buffer.reset(new boost::uint8_t[size]);
 
     // see http://www.computer-engineering.org/ps2mouse/ 
     
-    // Try to open mouse device, be error tolerant (FD is kept open all the 
time)
-    _fd = open(filespec.c_str(), O_RDWR);
-    
-    if (_fd < 0) {
-        log_debug("Could not open %s: %s", filespec, strerror(errno));
-        return false;
-    }
+    // Try to open mouse device, be error tolerant (FD is kept open all the 
time
+    if (_type == InputDevice::UMOUSE) {
+        _fd = open(filespec.c_str(), O_WRONLY | O_NDELAY);       
+        if (initUMouse()) {
+            moveToUMouse(400, 400);
+            return true;
+        }
+    } else {
+        _fd = open(filespec.c_str(), O_RDWR);
     
-    if (fcntl(_fd, F_SETFL, fcntl(_fd, F_GETFL) | O_NONBLOCK) < 0) {
-        log_error("Could not set non-blocking mode for mouse device: %s", 
strerror(errno));
-        close(_fd);
-        _fd = -1;
-        return false; 
+        if (_fd < 0) {
+            log_debug("Could not open %s: %s", filespec, strerror(errno));
+            return false;
+        }
+        
+        if (fcntl(_fd, F_SETFL, fcntl(_fd, F_GETFL) | O_NONBLOCK) < 0) {
+            log_error("Could not set non-blocking mode for mouse device: %s", 
strerror(errno));
+            close(_fd);
+            _fd = -1;
+            return false; 
+        }
     }
     
     // Clear input buffer
     unsigned char buf[10], byte;
-    while (read(_fd, buf, sizeof buf) > 0 ) { }
+    while (read(_fd, buf, size) > 0 ) { }
 
     // A touchscreen works similar to a Mouse, but not exactly...
     if (_type == InputDevice::MOUSE) {
@@ -178,6 +209,92 @@ MouseDevice::init(const std::string &filespec, size_t size)
     return true;
 }
 
+bool
+MouseDevice::initUMouse()
+{
+    GNASH_REPORT_FUNCTION;
+
+    _type = UMOUSE;
+
+    struct uinput_user_dev uidev;
+    
+    if (ioctl(_fd, UI_SET_EVBIT, EV_KEY) < 0) {
+        log_error("ioctl(UI_SET_EVBIT, EV_KEY)");
+        return false;
+    }
+    if (ioctl(_fd, UI_SET_KEYBIT, BTN_MOUSE) < 0) {
+        log_error("ioctl(UI_SET_KEYBIT, BTN_MOUSE)");
+        return false;
+    }
+    if (ioctl(_fd, UI_SET_KEYBIT, BTN_LEFT) < 0) {
+        log_error("ioctl(UI_SET_KEYBIT, BTN_LEFT))");
+        return false;
+    }
+    if (ioctl(_fd, UI_SET_KEYBIT, BTN_RIGHT) < 0) {
+        log_error("ioctl(UI_SET_KEYBIT, BTN_RIGHT)");
+        return false;
+    }
+    if (ioctl(_fd, UI_SET_EVBIT, EV_REL) < 0) {
+        log_error("ioctl(UI_SET_EVBIT, EV_REL)");
+        return false;
+    }
+    if (ioctl(_fd, UI_SET_RELBIT, REL_X) < 0) {
+        log_error("ioctl(UI_SET_RELBIT, REL_X)");
+        return false;
+    }
+    if (ioctl(_fd, UI_SET_RELBIT, REL_Y) < 0) {
+        log_error("ioctl( UI_SET_RELBIT, REL_Y)");
+        return false;
+    }
+    if (ioctl(_fd, UI_SET_EVBIT, EV_ABS) < 0) {
+        log_error("ioctl(UI_SET_EVBIT, EV_ABS)");
+        return false;
+    }
+    if (ioctl(_fd, UI_SET_ABSBIT,ABS_X) < 0) {
+        log_error("ioctl(UI_SET_ABSBIT,ABS_X)");
+        return false;
+    }
+    if (ioctl(_fd, UI_SET_ABSBIT, ABS_Y) < 0) {
+        log_error("ioctl(UI_SET_ABSBIT, ABS_Y)");
+        return false;
+    }
+
+    for (int i=0; i<256; i++) {
+        if (ioctl(_fd, UI_SET_KEYBIT, i) < 0) {
+            log_error("ioctl(UI_SET_KEYBIT, i)");
+            return false;
+        }
+    }
+    
+    memset(&uidev, 0, sizeof(uidev));
+    snprintf(uidev.name, UINPUT_MAX_NAME_SIZE, "uinput");
+    uidev.id.bustype = BUS_USB;
+    uidev.id.vendor  = 0x1;
+    uidev.id.product = 0x1;
+    uidev.id.version = 1;
+
+    uidev.absmin[ABS_X] = 0;
+    uidev.absmax[ABS_X] = _screen_width;
+    uidev.absfuzz[ABS_X] = 0;
+    uidev.absflat[ABS_X] = 0;
+    uidev.absmin[ABS_Y] = 0;
+    uidev.absmax[ABS_Y] = _screen_height;
+    uidev.absfuzz[ABS_Y] = 0;
+    uidev.absflat[ABS_Y ] = 0;
+
+    if (::write(_fd, (char *)&uidev, sizeof(uidev)) < 0) {
+        log_error("write uidev");
+        return false;
+    }
+
+    if (ioctl(_fd, UI_DEV_CREATE) < 0) {
+        log_error("ioctl(UI_DEV_CREATED)");
+        return false;
+    }
+
+    return true;
+}
+
 // From http://www.computer-engineering.org/ps2mouse
 //
 // PS/2 Mouse mouse data is always in a 3 byte packet that looks like this:
@@ -257,11 +374,9 @@ MouseDevice::check()
                                   * 1536 + 256));
         ymove = static_cast<int>(((static_cast<double>(ymove) - 482) / (1771 - 
482)
                                   * 1536 + 256));
-#if 0
         // FIXME: don't calculate here, this should be done by the GUI
-        xmove = xmove * _gui->getStage()->getStageWidth() / 2048;
-        ymove = (2048-ymove) * _gui->getStage()->getStageHeight() / 2048;
-#endif
+        xmove = xmove * _screen_width / 2048;
+        ymove = (2048-ymove) * _screen_height / 2048;
     } else {                    // end of InputDevice::TOUCHMOUSE
         // PS/2 Mouse
         // The movement values are 9-bit 2's complement integers,
@@ -271,7 +386,22 @@ MouseDevice::check()
         // previous packet was sent, in units determined by the
         // current resolution. The range of values that can be
         // expressed is -255 to +255. If this range is exceeded, the
-        // appropriate overflow bit is set.  
+        // appropriate overflow bit is set.
+        // (from the manpage for the psm driver)
+        // Byte 1
+        //     bit 7  One indicates overflow in the vertical movement count.
+        //     bit 6  One indicates overflow in the horizontal movement count.
+        //     bit 5  Set if the vertical movement count is negative.
+        //     bit 4  Set if the horizontal movement count is negative.
+        //     bit 3  Always one.
+        //     bit 2  Middle button status; set if pressed.  For devices 
without
+        //             the middle button, this bit is always zero.
+        //     bit 1  Right button status; set if pressed.
+        //     bit 0  Left button status; set if pressed.
+        // Byte 2  Horizontal movement count in two’s complement; -256 
through 255.
+        //     Note that the sign bit is in the first byte.
+        // Byte 3  Vertical movement count in two’s complement; -256 through 
255.
+        //     Note that the sign bit is in the first byte.
         xmove = buf[1];
         ymove = buf[2];
     
@@ -284,7 +414,8 @@ MouseDevice::check()
         
         ymove *= -1; // vertical movement is upside-down
         
-        log_debug(_("x/y %d/%d button %d"), xmove, ymove, btn);
+        log_debug(_("PS/2 Mouse: Xmove=%d, Ymove=%d,  Button %d"),
+                  xmove, ymove, btn);
         
         // movement    
         _input_data.x += xmove;
@@ -301,21 +432,24 @@ MouseDevice::check()
         // now. In the future more conversion may be done, making this
         // then be incorrect.
         boost::shared_array<int> coords =
-            MouseDevice::convertCoordinates(_input_data.x, _input_data.y, 
1024, 768);
-//          MouseDevice::convertCoordinates(_x, _y,
-//                                 _gui->getStage()->getStageWidth(),
-//                                 _gui->getStage()->getStageHeight());
+            InputDevice::convertAbsCoords(_input_data.x, _input_data.y,
+                                          _screen_width, _screen_height);
+            // MouseDevice::convertCoordinates(_input_data.x, _input_data.y,
+            //                          _screen_width, _screen_height);
+        log_debug(_("convert: Xin=%d, Yin=%d, Xout=%d, Yout=%d"),
+                  _input_data.x, _input_data.y, coords[0],coords[1]);
+        
         _input_data.x = coords[0];
         _input_data.y = coords[1];
     } // end of InputDevice::MOUSE
     
-    log_debug(_("read mouse @ %d / %d, btn %d"), _input_data.x, _input_data.y, 
_input_data.button);
+    log_debug(_("read mouse: X=%d, Y=%d, Btn: btn %d"), _input_data.x,
+              _input_data.y, _input_data.button);
     addData(false, gnash::key::INVALID, 0, _input_data.x, _input_data.y);
     
     // button
     if (btn != _input_data.button) {
         _input_data.button = btn;
-        log_debug("clicked: %d", btn); 
         addData(true, gnash::key::INVALID, 0, _input_data.x, _input_data.y);
         log_debug(_("mouse click! %d"), btn);
     }
@@ -323,6 +457,78 @@ MouseDevice::check()
     return true;
 }
 
+// Move the mouse cursor to a specified location
+bool
+MouseDevice::moveToUMouse(int x, int y)
+{
+    GNASH_REPORT_FUNCTION;
+
+    struct input_event ev;
+    
+    memset(&ev, 0, sizeof(ev));
+    gettimeofday(&ev.time, NULL);
+    ev.type = EV_ABS;
+    ev.code = ABS_X;
+    ev.value = x;
+    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
+        log_error("write ABS_X");
+        return false;
+    }
+    
+    gettimeofday(&ev.time, NULL);
+    ev.code = SYN_REPORT;
+    ev.type = EV_SYN;
+    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
+        log_error("write SYN");
+        return false;
+    }
+
+    gettimeofday(&ev.time, NULL);
+    ev.type = EV_ABS;
+    ev.code = ABS_Y;
+    ev.value = y;
+    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
+        log_error("write ABS_Y");
+        return false;
+    }
+
+    gettimeofday(&ev.time, NULL);
+    ev.code = SYN_REPORT;
+    ev.type = EV_SYN;
+    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
+        log_error("write SYN");
+        return false;
+    }
+
+    ////////////////////////////
+    gettimeofday(&ev.time, NULL);
+    ev.type = EV_KEY;
+    ev.code = BTN_LEFT;
+    ev.value = 0;
+    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
+        log_error("write SYN");
+        return false;
+    }
+    gettimeofday(&ev.time, NULL);
+    ev.type = EV_KEY;
+    ev.code = BTN_LEFT;
+    ev.value = 1;
+    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
+        log_error("write SYN");
+        return false;
+    }
+    
+    gettimeofday(&ev.time, NULL);
+    ev.type = EV_SYN;
+    ev.code = SYN_REPORT;
+    if (::write(_fd, &ev, sizeof(struct input_event)) < 0) {
+        log_error("write SYN");
+        return false;
+    }
+
+    return true;
+}   
+
 bool
 MouseDevice::command(unsigned char cmd, unsigned char *buf, int count)
 {
@@ -333,13 +539,13 @@ MouseDevice::command(unsigned char cmd, unsigned char 
*buf, int count)
     // flush input buffer
     char trash[16];
     do {
-        n = read(_fd, trash, sizeof trash);
+        n = ::read(_fd, trash, sizeof trash);
         if (n > 0) 
             log_debug(_("mouse_command: discarded %d bytes from input 
buffer"), n);
     } while (n > 0);
     
     // send command
-    if ( -1 == write(_fd, &cmd, 1) ) {
+    if ( -1 == ::write(_fd, &cmd, 1) ) {
         return false;
     }
 
@@ -349,7 +555,9 @@ MouseDevice::command(unsigned char cmd, unsigned char *buf, 
int count)
         // TODO: use select() instead
         
         n = read(_fd, buf, count);
-        if (n <= 0) return false;
+        if (n <= 0) {
+            return false;
+        }
         count -= n;
         buf += n;
     }
@@ -364,10 +572,10 @@ MouseDevice::command(unsigned char cmd, unsigned char 
*buf, int count)
 boost::shared_array<int>
 MouseDevice::convertCoordinates(int x, int y, int width, int height)
 {
-    // GNASH_REPORT_FUNCTION;
+//    GNASH_REPORT_FUNCTION;
     
     boost::shared_array<int> coords(new int[2]);
-
+    
     if (x > width) {
         coords[0] = width;
     } else {
@@ -378,7 +586,7 @@ MouseDevice::convertCoordinates(int x, int y, int width, 
int height)
     } else {
         coords[1] = y;
     }
-    
+
     return coords;
 }
 
diff --git a/libdevice/events/TouchDevice.cpp b/libdevice/events/TouchDevice.cpp
index a92d038..da3d80a 100644
--- a/libdevice/events/TouchDevice.cpp
+++ b/libdevice/events/TouchDevice.cpp
@@ -122,8 +122,13 @@ TouchDevice::check()
     if (n == 1) {
         if (event.pressure > 0) {
             // the screen is touched
+            // FIXME: this is a bit of a temporary hack. The last two
+            // arguments are a range, so hardcoding them is safe for
+            // now. In the future more conversion may be done, making this
+            // then be incorrect.
             boost::shared_array<int> coords =
-                MouseDevice::convertCoordinates(event.x, event.y, 800, 480);
+                MouseDevice::convertCoordinates(event.x, event.y,
+                                                _screen_width, _screen_height);
             log_debug("Touched x: %d, y: %d", event.x , event.y);
             addData(true, gnash::key::INVALID, 0, event.x, event.y);
         } else {

http://git.savannah.gnu.org/cgit//commit/?id=10723c4a0c4713b9f4eb2fdb21d4f7958a9c9984


commit 10723c4a0c4713b9f4eb2fdb21d4f7958a9c9984
Merge: 040e7ea 23b5ee4
Author: Rob Savoye <address@hidden>
Date:   Wed Dec 7 09:46:17 2011 -0700

    Merge branch 'master' of git.sv.gnu.org:/srv/git/gnash


http://git.savannah.gnu.org/cgit//commit/?id=cc9c6132d3e1fa87f54ae9f55e2963b7258db476


commit cc9c6132d3e1fa87f54ae9f55e2963b7258db476
Author: Rob Savoye <address@hidden>
Date:   Tue Dec 6 17:38:02 2011 -0700

    add support for EV_MSC events when used for keyboard input

diff --git a/libdevice/events/EventDevice.cpp b/libdevice/events/EventDevice.cpp
index 788ddf0..20f5eab 100644
--- a/libdevice/events/EventDevice.cpp
+++ b/libdevice/events/EventDevice.cpp
@@ -247,7 +247,7 @@ EventDevice::check()
     }
 
     /// @note
-    /// A typical touchscreen event is actuall a series of events, one for each
+    /// A typical touchscreen event is actually a series of events, one for 
each
     /// piece of data. The sequence is terminated by the EV_SYN message. An
     /// example from evtests looks like this:
     /// Event: time 697585.633672, type 3 (Absolute), code 0 (X), value 127
@@ -261,7 +261,7 @@ EventDevice::check()
     /// in the queue by the time the main event loop comes around to process 
the
     /// events.
     struct input_event *ev = reinterpret_cast<struct input_event *>(buf.get());
-    // log_debug("Type is: %hd, Code is: %hd, Val us: %d", ev->type, ev->code, 
ev->value);
+    log_debug("Type is: %hd, Code is: %hd, Val us: %d", ev->type, ev->code, 
ev->value);
     switch (ev->type) {
       case EV_SYN:
       {
@@ -300,19 +300,19 @@ EventDevice::check()
           // value == 0  key has been released
           // value == 1  key has been pressed
           // value == 2  repeated key reporting (while holding the key)
-          if (ev->code == KEY_LEFTSHIFT) {
+          if (ev->code == KEY_LEFTSHIFT) {              // 42
               keyb_lshift = ev->value;
-          } else if (ev->code == KEY_RIGHTSHIFT) {
+          } else if (ev->code == KEY_RIGHTSHIFT) {      // 54
               keyb_rshift = ev->value;
-          } else if (ev->code == KEY_LEFTCTRL) {
+          } else if (ev->code == KEY_LEFTCTRL) {        // 29
               keyb_lctrl = ev->value;
-          } else if (ev->code == KEY_RIGHTCTRL) {
+          } else if (ev->code == KEY_RIGHTCTRL) {       // 97
               keyb_rctrl = ev->value;
-          } else if (ev->code == KEY_LEFTALT) {
+          } else if (ev->code == KEY_LEFTALT) {         // 56
               keyb_lalt = ev->value;
-          } else if (ev->code == KEY_RIGHTALT) {
+          } else if (ev->code == KEY_RIGHTALT) {        // 100
               keyb_ralt = ev->value;
-          } else if (ev->code == BTN_TOUCH) {
+          } else if (ev->code == BTN_TOUCH) {           // 0x14a
               // keyb_ralt = ev->value;
           } else {
               _input_data.key = scancode_to_gnash_key(ev->code,
@@ -413,8 +413,39 @@ EventDevice::check()
           }
           break;
       }
+      // EV_MSC is also used for the keyboard
       case EV_MSC:
-          log_unimpl("Misc event from Input Event Device");
+          switch (ev->code) {
+            case MSC_SERIAL:
+            case MSC_PULSELED:
+            case MSC_GESTURE:
+            case MSC_RAW:
+                log_unimpl("Misc event from Input Event Device");
+                break;
+            case MSC_SCAN:
+                
+                _input_data.key = scancode_to_gnash_key(ev->value,
+                                                        keyb_lshift || 
keyb_rshift);
+                _input_data.modifier = gnash::key::GNASH_MOD_NONE;
+                
+                if (keyb_lshift || keyb_rshift) {
+                    _input_data.modifier = _input_data.modifier | 
gnash::key::GNASH_MOD_SHIFT;
+                }
+                
+                if (keyb_lctrl || keyb_rctrl) {
+                    _input_data.modifier = _input_data.modifier | 
gnash::key::GNASH_MOD_CONTROL;
+                }
+                
+                if (keyb_lalt || keyb_ralt) {
+                    _input_data.modifier = _input_data.modifier | 
gnash::key::GNASH_MOD_ALT;
+                }
+                activity = true;
+                break;
+            case MSC_MAX:
+            case MSC_CNT:
+            default:
+                log_unimpl("Misc event from Input Event Device");
+          }
           break;
       case EV_LED:
           log_unimpl("LED event from Input Event Device");

http://git.savannah.gnu.org/cgit//commit/?id=af793a40e4f2259a46244ffeae5419912a8af3a5


commit af793a40e4f2259a46244ffeae5419912a8af3a5
Merge: 3bf5e46 4c5d961
Author: Rob Savoye <address@hidden>
Date:   Tue Dec 6 12:16:07 2011 -0700

    merge from noise branch so adjusting the time interval works the same way 
for the framebuffer

diff --cc gui/fb/fb.cpp
index 130f2c9,b2ab1ad..0cf69af
--- a/gui/fb/fb.cpp
+++ b/gui/fb/fb.cpp
@@@ -339,19 -340,6 +339,19 @@@ FBGui::run(
      // let the GUI recompute the x/y scale factors to best fit the whole 
screen
      resize_view(_validbounds.width(), _validbounds.height());
  
 +    float fps = getFPS();
 +    
 +    // FIXME: this value is arbitrary, and will make any movie with
 +    // less than 12 frames eat up more of the cpu. It should probably
 +    // be a much lower value, like 2.
-     if (fps >= 12) {
++    if (fps > 12) {
 +        delay = static_cast<int>(100000/fps);
 +    } else {
 +        // 10ms per heart beat
 +        delay = 10000;
 +    }
 +    log_debug("Movie Frame Rate is %d, adjusting delay to %dms", fps, delay);
 +    
      // This loops endlessly at the frame rate
      while (!terminate_request) {  
          // wait the "heartbeat" inteval

http://git.savannah.gnu.org/cgit//commit/?id=040e7ea13fa8f080e02508b517017d11462da014


commit 040e7ea13fa8f080e02508b517017d11462da014
Merge: 3bf5e46 8fc19a8
Author: Rob Savoye <address@hidden>
Date:   Tue Dec 6 10:50:42 2011 -0700

    Merge branch 'master' of git.sv.gnu.org:/srv/git/gnash


http://git.savannah.gnu.org/cgit//commit/?id=3bf5e4607b866c336dc4471facdd1c410c8d0e51


commit 3bf5e4607b866c336dc4471facdd1c410c8d0e51
Author: Rob Savoye <address@hidden>
Date:   Tue Dec 6 10:45:56 2011 -0700

    use the movie frame rate to adjust the delay between frames. Also make the 
default interval larger, too small a value eats the cpu

diff --git a/gui/fb/fb.cpp b/gui/fb/fb.cpp
index 529415a..130f2c9 100644
--- a/gui/fb/fb.cpp
+++ b/gui/fb/fb.cpp
@@ -334,14 +334,28 @@ FBGui::run()
 #endif
 
     VirtualClock& timer = getClock();
+    int delay = 0;
     
     // let the GUI recompute the x/y scale factors to best fit the whole screen
     resize_view(_validbounds.width(), _validbounds.height());
 
+    float fps = getFPS();
+    
+    // FIXME: this value is arbitrary, and will make any movie with
+    // less than 12 frames eat up more of the cpu. It should probably
+    // be a much lower value, like 2.
+    if (fps >= 12) {
+        delay = static_cast<int>(100000/fps);
+    } else {
+        // 10ms per heart beat
+        delay = 10000;
+    }
+    log_debug("Movie Frame Rate is %d, adjusting delay to %dms", fps, delay);
+    
     // This loops endlessly at the frame rate
     while (!terminate_request) {  
         // wait the "heartbeat" inteval
-        gnashSleep(_interval * 1000);    
+        gnashSleep(_interval * delay);
         // TODO: Do we need to check the real time slept or is it OK when we 
woke
         // up early because of some Linux signal sent to our process (and thus
         // "advance" faster than the "heartbeat" interval)? - Udo

http://git.savannah.gnu.org/cgit//commit/?id=dc9ad048750c562869648722b4ed4ae4805cb42c


commit dc9ad048750c562869648722b4ed4ae4805cb42c
Author: Rob Savoye <address@hidden>
Date:   Tue Dec 6 10:44:50 2011 -0700

    add accesor to get the movie's FPS

diff --git a/gui/gui.h b/gui/gui.h
index 6de9d10..2c2c54c 100644
--- a/gui/gui.h
+++ b/gui/gui.h
@@ -428,6 +428,10 @@ public:
     /// Height of a window pixel, in stage pseudopixel units.
     float getYScale() const { return _yscale; };
 
+    /// Height of a window pixel, in stage pseudopixel units.
+    float getFPS() const { return (_movieDef) ? _movieDef->get_frame_rate() : 
0;
+    };
+
 protected:
 
     /// Default constructor. Initialises members to safe defaults.

http://git.savannah.gnu.org/cgit//commit/?id=53241bfe34d2791071ab4de13497f5bc0f8a6c8f


commit 53241bfe34d2791071ab4de13497f5bc0f8a6c8f
Author: Rob Savoye <address@hidden>
Date:   Mon Dec 5 14:02:07 2011 -0700

    reenable fullscreen support

diff --git a/gui/fb/fb.cpp b/gui/fb/fb.cpp
index 965f445..529415a 100644
--- a/gui/fb/fb.cpp
+++ b/gui/fb/fb.cpp
@@ -155,7 +155,8 @@ FBGui::FBGui(unsigned long xid, float scale, bool loop, 
RunResources& r)
       _own_vt(-1),
       _xpos(0),
       _ypos(0),  
-      _timeout(0)
+      _timeout(0),
+      _fullscreen(true)
 {
     // GNASH_REPORT_FUNCTION;
     
@@ -409,17 +410,20 @@ FBGui::setTimeout(unsigned int timeout)
     _timeout = timeout;
 }
 
-// void
-// FBGui::setFullscreen()
-// {
-//     // FB GUI always runs fullscreen; ignore...
-// }
-
-// void
-// FBGui::unsetFullscreen()
-// {
-//   // FB GUI always runs fullscreen; ignore...
-// }
+// The Framebuffer GUI usually always runs fullscreen, which is
+// the default, but occasionally users want to run the SWF movie
+// it's actual size, or in different locations.
+void
+FBGui::setFullscreen()
+{
+    _fullscreen = true;
+}
+
+void
+FBGui::unsetFullscreen()
+{
+    _fullscreen = false;
+}
 
 void
 FBGui::showMenu(bool /*show*/)
diff --git a/gui/fb/fbsup.h b/gui/fb/fbsup.h
index 8011821..3948e4e 100644
--- a/gui/fb/fbsup.h
+++ b/gui/fb/fbsup.h
@@ -159,8 +159,8 @@ public:
 
     // For the framebuffer, these are mostly just stubs.
 
-    // void setFullscreen() {};
-    // void unsetFullscreen() {};
+    void setFullscreen();
+    void unsetFullscreen();
     
     bool createMenu();
     bool setupEvents();
@@ -194,6 +194,7 @@ private:
     int         _xpos;          // X position of the output window
     int         _ypos;          // Y position of the output window
     size_t      _timeout;       // timeout period for the event loop
+    bool        _fullscreen;
 
     boost::shared_ptr<FBGlue>   _glue;
 

http://git.savannah.gnu.org/cgit//commit/?id=4c5d96106b64987360121a4a9277a485c190a0c2


commit 4c5d96106b64987360121a4a9277a485c190a0c2
Merge: c1ea116 45044b0
Author: Rob Savoye <address@hidden>
Date:   Thu Nov 24 10:52:17 2011 -0700

    Merge branch 'master' into noise


http://git.savannah.gnu.org/cgit//commit/?id=c1ea116948702e2fa9e8ce6f168de57f66d4eaff


commit c1ea116948702e2fa9e8ce6f168de57f66d4eaff
Author: Rob Savoye <address@hidden>
Date:   Tue Nov 1 10:43:18 2011 -0600

    add comment about the threshold value

diff --git a/gui/Player.cpp b/gui/Player.cpp
index f7935b8..a8f1f28 100644
--- a/gui/Player.cpp
+++ b/gui/Player.cpp
@@ -544,6 +544,9 @@ Player::run(int argc, char* argv[], const std::string& 
infile,
     if (! _delay) {
         float fps = _movieDef->get_frame_rate();
         log_debug("Movie Frame Rate is %d, adjusting delay", fps);
+        // FIXME: this value is arbitrary, and will make any movie with
+        // less than 12 frames eat up more of the cpu. It should probably
+        // be a much lower value, like 2.
         if (fps > 12) {
             _delay = static_cast<int>(1000/fps);
         } else {

http://git.savannah.gnu.org/cgit//commit/?id=5d64bf77cabfd8c4e5a84feb776d90d988ebaa4d


commit 5d64bf77cabfd8c4e5a84feb776d90d988ebaa4d
Author: Rob Savoye <address@hidden>
Date:   Tue Nov 1 10:15:12 2011 -0600

    add comment about the interval

diff --git a/gui/Player.cpp b/gui/Player.cpp
index 7a6fe0b..f7935b8 100644
--- a/gui/Player.cpp
+++ b/gui/Player.cpp
@@ -542,15 +542,17 @@ Player::run(int argc, char* argv[], const std::string& 
infile,
     _movieDef->completeLoad();
 
     if (! _delay) {
-        // 10ms per heart beat
         float fps = _movieDef->get_frame_rate();
         log_debug("Movie Frame Rate is %d, adjusting delay", fps);
         if (fps > 12) {
             _delay = static_cast<int>(1000/fps);
         } else {
+            // 10ms per heart beat
             _delay = 10;
         }
     }
+    // This is the time between the main loop waking up and processing
+    // network messages, external calls, and displaying the next frame.
     _gui->setInterval(_delay);
 
     if (_exitTimeout) {

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                        |    1 +
 configure.ac                      |   10 +-
 cygnal/cgi-bin/echo/echo.cpp      |    2 +-
 cygnal/cygnal.cpp                 |    2 +-
 cygnal/http_server.cpp            |   11 +-
 cygnal/libnet/cque.cpp            |    3 +-
 cygnal/rtmp_server.cpp            |   16 ++-
 gui/Player.cpp                    |   22 +++-
 gui/fb/fb.cpp                     |   92 ++++++++++-----
 gui/fb/fbsup.h                    |    8 +-
 gui/gtk/gtk.cpp                   |   27 ++++-
 gui/gui.cpp                       |   24 ++--
 gui/gui.h                         |    4 +
 libbase/rc.cpp                    |    4 +
 libbase/rc.h                      |   10 ++-
 libcore/MouseButtonState.h        |    2 +-
 libcore/asobj/Sound_as.cpp        |    1 -
 libcore/asobj/Video_as.cpp        |    3 +-
 libcore/movie_root.cpp            |   34 ++++--
 libdevice/events/EventDevice.cpp  |  220 ++++++++++++++++++++++++++--------
 libdevice/events/InputDevice.cpp  |   28 ++++-
 libdevice/events/InputDevice.h    |   46 ++++++-
 libdevice/events/MouseDevice.cpp  |  189 ++++++++++++++++-------------
 libdevice/events/TouchDevice.cpp  |    9 +-
 libdevice/events/UinputDevice.cpp |  239 +++++++++++++++++++++++++++++++++++++
 libdevice/events/events.am        |    9 +-
 libdevice/events/test_events.cpp  |    1 +
 utilities/flvdumper.cpp           |    4 +-
 28 files changed, 781 insertions(+), 240 deletions(-)
 create mode 100644 libdevice/events/UinputDevice.cpp


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]