gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, openvg, updated. 3a7e71da5c21bc855ad9


From: Rob Savoye
Subject: [Gnash-commit] [SCM] Gnash branch, openvg, updated. 3a7e71da5c21bc855ad97882f335c21f3852f1e4
Date: Sat, 18 Dec 2010 20:27:30 +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, openvg has been updated
       via  3a7e71da5c21bc855ad97882f335c21f3852f1e4 (commit)
       via  15eb78428b969da999dc07b632e374cfc8a8d45c (commit)
       via  8d1f2388fa4844853c430800e43e0caa31577c7f (commit)
       via  5e77bb13b810a0d72e615fdc2560af0775b5abc0 (commit)
      from  89e176609a00bdb96fdcb438d1578192a762f8f4 (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=3a7e71da5c21bc855ad97882f335c21f3852f1e4


commit 3a7e71da5c21bc855ad97882f335c21f3852f1e4
Author: Rob Savoye <address@hidden>
Date:   Sat Dec 18 13:27:04 2010 -0700

    also look for a FAKE_FRAMEBUFFER in the environment, and use that for the 
device to open.

diff --git a/libdevice/rawfb/RawFBDevice.cpp b/libdevice/rawfb/RawFBDevice.cpp
index be654a5..5b304b5 100644
--- a/libdevice/rawfb/RawFBDevice.cpp
+++ b/libdevice/rawfb/RawFBDevice.cpp
@@ -47,6 +47,7 @@ RawFBDevice::RawFBDevice()
       _fbmem(0)
 {
     GNASH_REPORT_FUNCTION;
+    dbglogfile.setVerbosity();
 }
 
 RawFBDevice::RawFBDevice(int vid)
@@ -95,13 +96,23 @@ bool
 RawFBDevice::initDevice(int /* argc */, char **/* argv[] */)
 {
     GNASH_REPORT_FUNCTION;
-
+    
     // Open the framebuffer device
 #ifdef ENABLE_FAKE_FRAMEBUFFER
     _fd = open(FAKEFB, O_RDWR);
     log_debug("WARNING: Using %s as a fake framebuffer!", FAKEFB);
 #else
-    _fd = open("/dev/fb0", O_RDWR);
+    char *devname = getenv("FRAMEBUFFER");
+    if (!devname) {
+        // We can't use the fake framebuffer with the FRAMEBUFFER
+        // environment variable, as it coinfuses X11. So this
+        // lets us redefine this at runtime.
+        devname = getenv("FAKE_FRAMEBUFFER");
+        if (!devname) {
+            devname = "/dev/fb0";
+        }
+    }
+    _fd = open(devname, O_RDWR);
 #endif
     if (_fd < 0) {
         log_error("Could not open framebuffer device: %s", strerror(errno));

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


commit 15eb78428b969da999dc07b632e374cfc8a8d45c
Author: Rob Savoye <address@hidden>
Date:   Sat Dec 18 13:26:11 2010 -0700

    use new method for coordinate range checking, add some more documentation

diff --git a/libdevice/events/InputDevice.cpp b/libdevice/events/InputDevice.cpp
index 0a5a4b8..1661272 100644
--- a/libdevice/events/InputDevice.cpp
+++ b/libdevice/events/InputDevice.cpp
@@ -112,7 +112,7 @@ InputDevice::addData(bool pressed, key::code key, int 
modifier, int x, int y)
 boost::shared_array<boost::uint8_t>
 InputDevice::readData(size_t size)
 {
-    GNASH_REPORT_FUNCTION;
+    // GNASH_REPORT_FUNCTION;
 
     boost::shared_array<boost::uint8_t> inbuf;
 
diff --git a/libdevice/events/InputDevice.h b/libdevice/events/InputDevice.h
index ffdb82a..ddc0c84 100644
--- a/libdevice/events/InputDevice.h
+++ b/libdevice/events/InputDevice.h
@@ -118,6 +118,12 @@ 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);
 };
 
 class TouchDevice : public InputDevice
diff --git a/libdevice/events/MouseDevice.cpp b/libdevice/events/MouseDevice.cpp
index 08b2262..ec5736c 100644
--- a/libdevice/events/MouseDevice.cpp
+++ b/libdevice/events/MouseDevice.cpp
@@ -23,6 +23,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <boost/shared_array.hpp>
 
 #include "GnashSleep.h"
 #include "log.h"
@@ -212,7 +213,7 @@ MouseDevice::init(const std::string &filespec, size_t size)
 bool
 MouseDevice::check()
 {
-    GNASH_REPORT_FUNCTION;
+    // GNASH_REPORT_FUNCTION;
 
     if (_fd < 0) {
         return false;   // no mouse available
@@ -262,6 +263,14 @@ MouseDevice::check()
 #endif
     } else {                    // end of InputDevice::TOUCHMOUSE
         // PS/2 Mouse
+        // The movement values are 9-bit 2's complement integers,
+        // where the most significant bit appears as a "sign" bit in
+        // byte 1 of the movement data packet. Their value represents
+        // the mouse's offset relative to its position when the
+        // 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.  
         xmove = buf[1];
         ymove = buf[2];
     
@@ -286,15 +295,17 @@ MouseDevice::check()
         if (_y < 0) {
             _y = 0;
         }
-#if 0
-        // FIXME: don't calculate here, this should be done by the GUI
-        if (_x > static_cast<int>(_gui->getStage()->getStageWidth())) {
-            _x = static_cast<int>(_gui->getStage()->getStageWidth());
-        }
-        if (_y > static_cast<int>(_gui->getStage()->getStageHeight())) {
-            _y = static_cast<int>(_gui->getStage()->getStageHeight());
-        }
-#endif
+        // 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(_x, _y, 1024, 768);
+//          MouseDevice::convertCoordinates(_x, _y,
+//                                 _gui->getStage()->getStageWidth(),
+//                                 _gui->getStage()->getStageHeight());
+        _x = coords[0];
+        _y = coords[1];
     } // end of InputDevice::MOUSE
     
     log_debug(_("read mouse @ %d / %d, btn %d"), _x, _y, _button);
@@ -346,6 +357,30 @@ 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 4564467..08b8039 100644
--- a/libdevice/events/TouchDevice.cpp
+++ b/libdevice/events/TouchDevice.cpp
@@ -121,15 +121,14 @@ TouchDevice::check()
     if (n == 1) {
         if (event.pressure > 0) {
             // the screen is touched
+            boost::shared_array<int> coords =
+                MouseDevice::convertCoordinates(event.x, event.y, 1024, 768);
+//          MouseDevice::convertCoordinates(event.x, event.y,
+//                                 _gui->getStage()->getStageWidth(),
+//                                 _gui->getStage()->getStageHeight());
+            event.x = coords[0];
+            event.y = coords[1];
 #if 0
-        // FIXME: don't calculate here, this should be done by the GUI
-            if (event.x > static_cast<int>(_gui->getStage()->getStageWidth())) 
{
-                event.x = static_cast<int>(_gui->getStage()->getStageWidth());
-            }
-            if (event.y > 
static_cast<int>(_gui->getStage()->getStageHeight())) {
-                event.y = static_cast<int>(_gui->getStage()->getStageHeight());
-            }
-#endif
             // FIXME: the API for these mouse events has changed, so this 
needs to be
             // updated.
             _gui->notifyMouseMove(int(event.x / _gui->getXScale()),
diff --git a/libdevice/events/test_events.cpp b/libdevice/events/test_events.cpp
index c50f261..e749230 100644
--- a/libdevice/events/test_events.cpp
+++ b/libdevice/events/test_events.cpp
@@ -90,6 +90,7 @@ main(int argc, char *argv[])
 
     cerr << "Starting inactivity timeout to 10 seconds..." << endl;
     alarm(10);
+    
     // This loops endlessly at the frame rate
     while (loop) {  
         std::vector<boost::shared_ptr<InputDevice> >::iterator it;
@@ -101,9 +102,14 @@ main(int argc, char *argv[])
                 boost::shared_ptr<InputDevice::input_data_t> ie = 
id->popData();
 #if 1
                 if (ie) {
-                    std::cerr << "Got data: " << ie->pressed;
-                    std::cerr << ", " << ie->key << ", " << ie->modifier;
-                    std::cerr << ", " << ie->x << ", " << ie->y << std::endl;
+                    cerr << "Got data: " << ie->pressed;
+                    cerr << ", " << ie->key << ", " << ie->modifier;
+                    cerr << ", " << ie->x << ", " << ie->y << endl;
+                    // Range check and convert the position
+                    boost::shared_array<int> coords =
+                        MouseDevice::convertCoordinates(ie->x, ie->y, 1024, 
768);
+                    cerr << "X = " << coords[0] << endl;
+                    cerr << "Y = " << coords[1] << endl;
                 }
             } else {
                 std::cerr << ".";
@@ -111,8 +117,9 @@ main(int argc, char *argv[])
 #endif
         }
         
-        // wait the "heartbeat" inteval
-        sleep(1);    
+        // wait the "heartbeat" interval. The default mouse update rate is
+        // only 100 samples/sec. so why rush...
+        usleep(1000000);
     }
     
     std::cerr << std::endl;

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


commit 8d1f2388fa4844853c430800e43e0caa31577c7f
Author: Rob Savoye <address@hidden>
Date:   Sat Dec 18 13:24:42 2010 -0700

    scanForDevices() doesn't need the Gui argument anymore. ::run() now polls 
the input devices in the main loop, and notify's the Gui of events.

diff --git a/gui/fb/fb.cpp b/gui/fb/fb.cpp
index 6269bc1..cf7dba5 100644
--- a/gui/fb/fb.cpp
+++ b/gui/fb/fb.cpp
@@ -110,6 +110,7 @@
 #include "Renderer.h"
 
 #include <linux/input.h>    // for /dev/input/event*
+#include <events/InputDevice.h>
 
 #ifdef RENDERER_AGG
 #include "fb_glue_agg.h"
@@ -191,44 +192,12 @@ FBGui::init(int argc, char *** argv)
     // Initialize all the input devices
 
     // Look for Mice that use the PS/2 mouse protocol
-    _inputs = InputDevice::scanForDevices(this);
+    _inputs = InputDevice::scanForDevices();
     if (_inputs.empty()) {
         log_error("Found no accessible input event devices");
     }
     
 #if 0
-    // FIME: moved to fb_glue_agg.cpp
-    
-    // Open the framebuffer device
-#ifdef ENABLE_FAKE_FRAMEBUFFER
-    _fd = open(FAKEFB, O_RDWR);
-    log_debug("WARNING: Using %s as a fake framebuffer!", FAKEFB);
-#else
-    _fd = open("/dev/fb0", O_RDWR);
-#endif
-    if (_fd < 0) {
-        log_error("Could not open framebuffer device: %s", strerror(errno));
-        return false;
-    }
-  
-    // Load framebuffer properties
-#ifdef ENABLE_FAKE_FRAMEBUFFER
-    fakefb_ioctl(_fd, FBIOGET_VSCREENINFO, &_var_screeninfo);
-    fakefb_ioctl(_fd, FBIOGET_FSCREENINFO, &_fix_screeninfo);
-#else
-    ioctl(_fd, FBIOGET_VSCREENINFO, &_var_screeninfo);
-    ioctl(_fd, FBIOGET_FSCREENINFO, &_fix_screeninfo);
-#endif
-    log_debug(_("Framebuffer device uses %d bytes of memory."),
-              _fix_screeninfo.smem_len);
-    log_debug(_("Video mode: %dx%d with %d bits per pixel."),
-              _var_screeninfo.xres, _var_screeninfo.yres,
-              _var_screeninfo.bits_per_pixel);
-
-    _fbmem.reset(static_cast<boost::uint8_t *>(mmap(0, _fixinfo.smem_len,
-                                                    PROT_READ|PROT_WRITE, 
MAP_SHARED,
-                                                    _fd, 0)));
-    
     // Set "window" size
     _width    = _var_screeninfo.xres;
     _height   = _var_screeninfo.yres;
@@ -281,6 +250,8 @@ FBGui::init(int argc, char *** argv)
     // Initialize the glue layer between the renderer and the gui toolkit
     _glue->init(argc, argv);
 
+    disable_terminal();
+    
     return true;
 }
 
@@ -312,6 +283,9 @@ FBGui::run()
         
         // check input devices
         checkForData();
+
+        // FIXME: process the input data
+        // boost::shared_ptr<input_event_t> popData();
         
         // advance movie  
         Gui::advance_movie(this);
@@ -449,6 +423,7 @@ FBGui::setInvalidatedRegions(const InvalidatedRanges& 
ranges)
 char *
 FBGui::find_accessible_tty(int no)
 {
+    GNASH_REPORT_FUNCTION;
     char* fn;
     
     fn = find_accessible_tty("/dev/vc/%d", no);   if (fn) return fn;
@@ -482,6 +457,7 @@ FBGui::find_accessible_tty(const char* format, int no)
 bool
 FBGui::disable_terminal() 
 {
+    GNASH_REPORT_FUNCTION;
     _original_kd = -1;
     
     struct vt_stat vts;
@@ -613,6 +589,7 @@ FBGui::disable_terminal()
 bool
 FBGui::enable_terminal() 
 {
+    GNASH_REPORT_FUNCTION;
     log_debug(_("Restoring terminal..."));
 
     char* tty = find_accessible_tty(_own_vt);
@@ -662,6 +639,30 @@ 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
+            std::cerr << "Got data: " << ie->pressed;
+            std::cerr << ", " << ie->key << ", " << ie->modifier;
+            std::cerr << ", " << ie->x << ", " << ie->y << std::endl;
+            // cerr << "X = " << coords[0] << endl;
+            // cerr << "Y = " << coords[1] << endl;
+#endif
+            // Range check and convert the position
+            boost::shared_array<int> coords =
+                MouseDevice::convertCoordinates(ie->x, ie->y,
+                                                getStage()->getStageWidth(),
+                                                getStage()->getStageHeight());
+            // See if a mouse button was clicked
+            if (ie->pressed) {
+                notifyMouseClick(true);
+            }
+            
+            // The mouse was moved
+            if (coords) {
+                notifyMouseMove(coords[0], coords[1]);
+            }
+        }
     }
 }
 

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


commit 5e77bb13b810a0d72e615fdc2560af0775b5abc0
Author: Rob Savoye <address@hidden>
Date:   Sat Dec 18 13:22:42 2010 -0700

    input events are now in libdevice

diff --git a/gui/fb/fb.am b/gui/fb/fb.am
index 37686e4..2db221c 100644
--- a/gui/fb/fb.am
+++ b/gui/fb/fb.am
@@ -15,35 +15,12 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 # 
 
-# These are used to handle input events from a keyboard, mouse, or
-# touchscreen. These are only used by the Framebuffer GUI, as without
-# X11, it has no event handling. We do it this way so the optionally
-# built source files still get included in the source tarball.
-DEVICES =
-if ENABLE_INPUT_DEVICES
-DEVICES += fb/InputDevice.cpp fb/InputDevice.h
-
-# Touchscreen
-if ENABLE_TSLIB
-DEVICES += fb/TouchDevice.cpp
-endif
-# PS/2 Mouse
-if ENABLE_MOUSE
-DEVICES += fb/MouseDevice.cpp
-endif
-# Linux input events
-if ENABLE_INPUT_EVENTS
-DEVICES += fb/EventDevice.cpp
-endif
-endif
-
 #
 # Build the FB gui
 #
 if BUILD_FB_GUI
 bin_PROGRAMS += fb-gnash
 fb_gnash_SOURCES = $(GUI_SRCS) \
-    $(DEVICES) \
        fb/fb.cpp \
        fb/fbsup.h \
        fb/fb_glue.h

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

Summary of changes:
 gui/fb/fb.am                     |   23 -------------
 gui/fb/fb.cpp                    |   67 +++++++++++++++++++------------------
 libdevice/events/InputDevice.cpp |    2 +-
 libdevice/events/InputDevice.h   |    6 +++
 libdevice/events/MouseDevice.cpp |   55 +++++++++++++++++++++++++------
 libdevice/events/TouchDevice.cpp |   15 ++++----
 libdevice/events/test_events.cpp |   17 +++++++---
 libdevice/rawfb/RawFBDevice.cpp  |   15 +++++++-
 8 files changed, 118 insertions(+), 82 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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