Thu 09 Jun 2011 11:39:04 AM UTC, comment #5:
Here is a patch for version 0.8.9 with some not-so-clean code inside:
<pre>
diff -ru gnash-0.8.9/gui/fb/TouchDevice.cpp gnash-0.8.9.modified/gui/fb/TouchDevice.cpp
--- gnash-0.8.9/gui/fb/TouchDevice.cpp 2011-02-26 19:11:07.000000000 +0100
+++ gnash-0.8.9.modified/gui/fb/TouchDevice.cpp 2011-06-09 10:09:13.000000000 +0200
@@ -80,15 +80,12 @@
_type = TouchDevice::TOUCHSCREEN;
_filespec = filespec;
- char *devname = getenv(TSLIB_DEVICE_ENV);
+ const char *devname = getenv(TSLIB_DEVICE_ENV);
if (!devname) {
- devname = const_cast<char *>(TSLIB_DEVICE_NAME);
- } else {
- if (!filespec.empty()) {
- devname = const_cast<char *>(_filespec.c_str());
- } else {
+ if (!filespec.empty())
+ devname = _filespec.c_str();
+ else
log_error("No filespec specified for the touchscreen device.");
- }
}
_tsDev = ts_open(devname, 1); //Open tslib non-blocking
@@ -134,10 +131,8 @@
if (event.y > static_cast<int>(_gui->getStage()->getStageHeight())) {
event.y = static_cast<int>(_gui->getStage()->getStageHeight());
}
- // FIXME: the API for these mouse events has changed, so this needs to be
- // updated.
- _gui->notifyMouseMove(int(event.x / _gui->getXScale()),
- int(event.y / _gui->getYScale()));
+
+ _gui->notifyMouseMove(int(event.x), int(event.y));
_gui->notifyMouseClick(true); //fire mouse click event into Gnash
log_debug("Touched x: %d y: %d width: %d height: %d",
@@ -285,9 +280,16 @@
struct ts_types touch[] = {
InputDevice::TOUCHSCREEN, "/dev/ts",
+ InputDevice::UNKNOWN, 0,
InputDevice::UNKNOWN, 0
};
+ const char *devname = getenv(TSLIB_DEVICE_ENV);
+ if (devname) {
+ touch[1].type = InputDevice::TOUCHSCREEN;
+ touch[1].filespec = devname;
+ }
+
int i = 0;
while (touch[i].type != InputDevice::UNKNOWN) {
int fd = 0;
</pre>
|