summaryrefslogtreecommitdiff
path: root/devel
diff options
context:
space:
mode:
authorjmcneill <jmcneill>2015-01-29 01:56:02 +0000
committerjmcneill <jmcneill>2015-01-29 01:56:02 +0000
commitacac0fc7501b5b2a47e40e1731bdd584d1e2499a (patch)
treef4ebf0f88c199ee305690b38caeb9e82932f73e2 /devel
parentbd7a424c02b2ed17120ce2d7a1851b3144b4fc3e (diff)
downloadpkgsrc-acac0fc7501b5b2a47e40e1731bdd584d1e2499a.tar.gz
add wsmouse support to wscons driver
Diffstat (limited to 'devel')
-rw-r--r--devel/SDL/distinfo8
-rw-r--r--devel/SDL/patches/patch-src_video_wscons_SDL__wsconsevents.c122
-rw-r--r--devel/SDL/patches/patch-src_video_wscons_SDL__wsconsevents__c.h13
-rw-r--r--devel/SDL/patches/patch-src_video_wscons_SDL__wsconsvideo.c65
-rw-r--r--devel/SDL/patches/patch-src_video_wscons_SDL__wsconsvideo.h12
5 files changed, 205 insertions, 15 deletions
diff --git a/devel/SDL/distinfo b/devel/SDL/distinfo
index 147c17cd04a..3e3d3832ddc 100644
--- a/devel/SDL/distinfo
+++ b/devel/SDL/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.67 2015/01/28 17:14:47 jmcneill Exp $
+$NetBSD: distinfo,v 1.68 2015/01/29 01:56:02 jmcneill Exp $
SHA1 (SDL-1.2.15.tar.gz) = 0c5f193ced810b0d7ce3ab06d808cbb5eef03a2c
RMD160 (SDL-1.2.15.tar.gz) = d4802a090cb4a24eeb0c8ce5690802f596d394c3
@@ -8,6 +8,8 @@ SHA1 (patch-ac) = 8b2dddff9ad449b19b35ef364e2d960e46284563
SHA1 (patch-src_audio_sun_SDL__sunaudio.c) = 4b492b40d39e6444037dfda55766e4a149cc6c30
SHA1 (patch-src_joystick_bsd_SDL__sysjoystick.c) = 4ea0136f231729129b82e5f7ee4b9eaf68a13876
SHA1 (patch-src_video_quartz_SDL__QuartzVideo.h) = 19d952bade06dbd646e94f42139c38436969b1a8
-SHA1 (patch-src_video_wscons_SDL__wsconsevents.c) = 6ae894622078c2cc2a0add0b496944567d38f797
-SHA1 (patch-src_video_wscons_SDL__wsconsvideo.c) = 356a8817cc41dde5e24cb23f032215931f85a84b
+SHA1 (patch-src_video_wscons_SDL__wsconsevents.c) = f7519864e9c13ad69eae9a42df22a944586ab93b
+SHA1 (patch-src_video_wscons_SDL__wsconsevents__c.h) = 97206e2aca0b620005217d9d07ad1177516cac92
+SHA1 (patch-src_video_wscons_SDL__wsconsvideo.c) = 17e048ccb201ae961e820ab880d5a588b2db2639
+SHA1 (patch-src_video_wscons_SDL__wsconsvideo.h) = 82028df57cf3de95152278924ffe3134fe32f85a
SHA1 (patch-src_video_x11_SDL_x11video.c) = 624fbb7e701d6de6ec93096beea7c085125934aa
diff --git a/devel/SDL/patches/patch-src_video_wscons_SDL__wsconsevents.c b/devel/SDL/patches/patch-src_video_wscons_SDL__wsconsevents.c
index 6f87837c460..42775408128 100644
--- a/devel/SDL/patches/patch-src_video_wscons_SDL__wsconsevents.c
+++ b/devel/SDL/patches/patch-src_video_wscons_SDL__wsconsevents.c
@@ -1,6 +1,4 @@
-$NetBSD: patch-src_video_wscons_SDL__wsconsevents.c,v 1.5 2015/01/28 17:14:47 jmcneill Exp $
-
-Add support for USB keyboards on NetBSD.
+$NetBSD: patch-src_video_wscons_SDL__wsconsevents.c,v 1.6 2015/01/29 01:56:02 jmcneill Exp $
--- src/video/wscons/SDL_wsconsevents.c.orig 2012-01-19 06:30:06.000000000 +0000
+++ src/video/wscons/SDL_wsconsevents.c
@@ -18,7 +16,121 @@ Add support for USB keyboards on NetBSD.
if (tcgetattr(private->fd, &private->saved_tty) == -1) {
WSCONS_ReportError("cannot get terminal attributes: %s", strerror(errno));
return -1;
-@@ -146,7 +153,72 @@ void WSCONS_InitOSKeymap(_THIS)
+@@ -65,6 +72,7 @@ int WSCONS_InitKeyboard(_THIS)
+ WSCONS_ReportError("cannot set terminal attributes: %s", strerror(errno));
+ return -1;
+ }
++
+ if (ioctl(private->fd, KDSKBMODE, K_RAW) == -1) {
+ WSCONS_ReportError("cannot set raw keyboard mode: %s", strerror(errno));
+ return -1;
+@@ -89,8 +97,57 @@ void WSCONS_ReleaseKeyboard(_THIS)
+ }
+ }
+
+-static void updateMouse()
++int WSCONS_InitMouse(_THIS)
++{
++ if (private->mouseFd != -1) {
++#if defined(WSMOUSEIO_SETVERSION)
++ int version = WSMOUSE_EVENT_VERSION;
++ if (ioctl(private->mouseFd, WSMOUSEIO_SETVERSION, &version) == -1) {
++ WSCONS_ReportError("cannot set mouse API version: %s", strerror(errno));
++ return -1;
++ }
++#endif
++ }
++ return 0;
++}
++
++void WSCONS_ReleaseMouse(_THIS)
++{
++}
++
++#define NUMEVENTS 64
++
++static void updateMouse(_THIS)
+ {
++ struct wscons_event evlist[NUMEVENTS];
++ struct wscons_event *ev = evlist;
++ int nev, i;
++ ssize_t len;
++
++ len = read(private->mouseFd, evlist, sizeof(evlist));
++ if (len == -1) {
++ WSCONS_ReportError("Failed to read wsmouse event: %s", strerror(errno));
++ return;
++ }
++
++ nev = len / sizeof(*ev);
++
++ for (i = 0; i < nev; i++, ev++) {
++ switch (ev->type) {
++ case WSCONS_EVENT_MOUSE_UP:
++ posted += SDL_PrivateMouseButton(SDL_RELEASED, ev->value+1, 0, 0);
++ break;
++ case WSCONS_EVENT_MOUSE_DOWN:
++ posted += SDL_PrivateMouseButton(SDL_PRESSED, ev->value+1, 0, 0);
++ break;
++ case WSCONS_EVENT_MOUSE_DELTA_X:
++ posted += SDL_PrivateMouseMotion(0, 1, ev->value, 0);
++ break;
++ case WSCONS_EVENT_MOUSE_DELTA_Y:
++ posted += SDL_PrivateMouseMotion(0, 1, 0, -ev->value);
++ break;
++ }
++ }
+ }
+
+ static SDLKey keymap[128];
+@@ -120,19 +177,42 @@ static void updateKeyboard(_THIS)
+ for (i = 0; i < n; i++) {
+ unsigned char c = buf[i] & 0x7f;
+ if (c == 224) // special key prefix -- what should we do with it?
+- continue;
++ continue;
+ posted += SDL_PrivateKeyboard((buf[i] & 0x80) ? SDL_RELEASED : SDL_PRESSED,
+- TranslateKey(c, &keysym));
++ TranslateKey(c, &keysym));
+ }
+ }
+ }
+
+ void WSCONS_PumpEvents(_THIS)
+ {
++ static struct timeval zero;
++ int maxfd = 0;
++
++ if (private->fd > maxfd)
++ maxfd = private->fd;
++ if (private->mouseFd > maxfd)
++ maxfd = private->mouseFd;
++
+ do {
++ fd_set fds;
++
+ posted = 0;
+- updateMouse();
+- updateKeyboard(this);
++
++ FD_ZERO(&fds);
++ if (private->fd != -1)
++ FD_SET(private->fd, &fds);
++ if (private->mouseFd != -1)
++ FD_SET(private->mouseFd, &fds);
++
++ if (select(maxfd+1, &fds, NULL, NULL, &zero) > 0) {
++ if (private->mouseFd != -1 && FD_ISSET(private->mouseFd, &fds)) {
++ updateMouse(this);
++ }
++ if (private->fd != -1 && FD_ISSET(private->fd, &fds)) {
++ updateKeyboard(this);
++ }
++ }
+ } while (posted);
+ }
+
+@@ -146,7 +226,72 @@ void WSCONS_InitOSKeymap(_THIS)
}
switch (private->kbdType) {
@@ -92,7 +204,7 @@ Add support for USB keyboards on NetBSD.
case WSKBD_TYPE_ZAURUS:
/* top row */
keymap[2] = SDLK_1;
-@@ -220,7 +292,7 @@ void WSCONS_InitOSKeymap(_THIS)
+@@ -220,7 +365,7 @@ void WSCONS_InitOSKeymap(_THIS)
keymap[77] = SDLK_RIGHT;
keymap[80] = SDLK_DOWN;
break;
diff --git a/devel/SDL/patches/patch-src_video_wscons_SDL__wsconsevents__c.h b/devel/SDL/patches/patch-src_video_wscons_SDL__wsconsevents__c.h
new file mode 100644
index 00000000000..2438cd8844c
--- /dev/null
+++ b/devel/SDL/patches/patch-src_video_wscons_SDL__wsconsevents__c.h
@@ -0,0 +1,13 @@
+$NetBSD: patch-src_video_wscons_SDL__wsconsevents__c.h,v 1.1 2015/01/29 01:56:23 jmcneill Exp $
+
+--- src/video/wscons/SDL_wsconsevents_c.h.orig 2012-01-19 06:30:06.000000000 +0000
++++ src/video/wscons/SDL_wsconsevents_c.h
+@@ -25,6 +25,8 @@
+
+ int WSCONS_InitKeyboard(_THIS);
+ void WSCONS_ReleaseKeyboard(_THIS);
++int WSCONS_InitMouse(_THIS);
++void WSCONS_ReleaseMouse(_THIS);
+
+ /* Variables and functions exported by SDL_sysevents.c to other parts
+ of the native video subsystem (SDL_sysvideo.c)
diff --git a/devel/SDL/patches/patch-src_video_wscons_SDL__wsconsvideo.c b/devel/SDL/patches/patch-src_video_wscons_SDL__wsconsvideo.c
index 13e1831ff68..e9970584b5f 100644
--- a/devel/SDL/patches/patch-src_video_wscons_SDL__wsconsvideo.c
+++ b/devel/SDL/patches/patch-src_video_wscons_SDL__wsconsvideo.c
@@ -1,10 +1,8 @@
-$NetBSD: patch-src_video_wscons_SDL__wsconsvideo.c,v 1.3 2012/01/24 15:17:05 wiz Exp $
+$NetBSD: patch-src_video_wscons_SDL__wsconsvideo.c,v 1.4 2015/01/29 01:56:02 jmcneill Exp $
-Fix tty device and color patterns for wscons driver on NetBSD.
-
---- src/video/wscons/SDL_wsconsvideo.c.orig 2009-10-12 23:07:14.000000000 +0000
+--- src/video/wscons/SDL_wsconsvideo.c.orig 2012-01-19 06:30:06.000000000 +0000
+++ src/video/wscons/SDL_wsconsvideo.c
-@@ -141,7 +141,13 @@ VideoBootStrap WSCONS_bootstrap = {
+@@ -141,12 +141,18 @@ VideoBootStrap WSCONS_bootstrap = {
WSCONS_CreateDevice
};
@@ -18,7 +16,37 @@ Fix tty device and color patterns for wscons driver on NetBSD.
int WSCONS_VideoInit(_THIS, SDL_PixelFormat *vformat)
{
-@@ -184,6 +190,11 @@ int WSCONS_VideoInit(_THIS, SDL_PixelFor
+ char devnamebuf[30];
+- char *devname;
++ char *devname, *mouse_devname;
+ char *rotation;
+ int wstype;
+ int wsmode = WSDISPLAYIO_MODE_DUMBFB;
+@@ -166,11 +172,23 @@ int WSCONS_VideoInit(_THIS, SDL_PixelFor
+ devname = devnamebuf;
+ }
+
++ mouse_devname = SDL_getenv("SDL_WSMOUSEDEV");
++ if (mouse_devname == NULL) {
++ mouse_devname = "/dev/wsmouse";
++ }
++
+ private->fd = open(devname, O_RDWR | O_NONBLOCK, 0);
+ if (private->fd == -1) {
+ WSCONS_ReportError("open %s: %s", devname, strerror(errno));
+ return -1;
+ }
++
++ private->mouseFd = open(mouse_devname, O_RDWR | O_NONBLOCK, 0);
++ if (private->mouseFd == -1) {
++ WSCONS_ReportError("open %s: %s", mouse_devname, strerror(errno));
++ return -1;
++ }
++
+ if (ioctl(private->fd, WSDISPLAYIO_GINFO, &private->info) == -1) {
+ WSCONS_ReportError("ioctl WSDISPLAY_GINFO: %s", strerror(errno));
+ return -1;
+@@ -184,6 +202,11 @@ int WSCONS_VideoInit(_THIS, SDL_PixelFor
return -1;
}
if (private->info.depth > 8) {
@@ -30,7 +58,7 @@ Fix tty device and color patterns for wscons driver on NetBSD.
if (wstype == WSDISPLAY_TYPE_SUN24 ||
wstype == WSDISPLAY_TYPE_SUNCG12 ||
wstype == WSDISPLAY_TYPE_SUNCG14 ||
-@@ -202,6 +213,7 @@ int WSCONS_VideoInit(_THIS, SDL_PixelFor
+@@ -202,6 +225,7 @@ int WSCONS_VideoInit(_THIS, SDL_PixelFor
WSCONS_ReportError("Unknown video hardware");
return -1;
}
@@ -38,3 +66,26 @@ Fix tty device and color patterns for wscons driver on NetBSD.
} else {
WSCONS_ReportError("Displays with 8 bpp or less are not supported");
return -1;
+@@ -326,6 +350,9 @@ int WSCONS_VideoInit(_THIS, SDL_PixelFor
+ if (WSCONS_InitKeyboard(this) == -1) {
+ return -1;
+ }
++ if (WSCONS_InitMouse(this) == -1) {
++ return -1;
++ }
+
+ return 0;
+ }
+@@ -601,7 +628,12 @@ void WSCONS_VideoQuit(_THIS)
+ }
+
+ WSCONS_ReleaseKeyboard(this);
++ WSCONS_ReleaseMouse(this);
+
++ if (private->mouseFd != -1) {
++ close(private->mouseFd);
++ private->mouseFd = -1;
++ }
+ if (private->fd != -1) {
+ close(private->fd);
+ private->fd = -1;
diff --git a/devel/SDL/patches/patch-src_video_wscons_SDL__wsconsvideo.h b/devel/SDL/patches/patch-src_video_wscons_SDL__wsconsvideo.h
new file mode 100644
index 00000000000..ba25bbfd3ba
--- /dev/null
+++ b/devel/SDL/patches/patch-src_video_wscons_SDL__wsconsvideo.h
@@ -0,0 +1,12 @@
+$NetBSD: patch-src_video_wscons_SDL__wsconsvideo.h,v 1.1 2015/01/29 01:56:23 jmcneill Exp $
+
+--- src/video/wscons/SDL_wsconsvideo.h.orig 2012-01-19 06:30:06.000000000 +0000
++++ src/video/wscons/SDL_wsconsvideo.h
+@@ -50,6 +50,7 @@ typedef void WSCONS_bitBlit(Uint8 *src_p
+
+ struct SDL_PrivateVideoData {
+ int fd; /* file descriptor of open device */
++ int mouseFd; /* file descriptor of open mouse device */
+ struct wsdisplay_fbinfo info; /* frame buffer characteristics */
+ int physlinebytes; /* number of bytes per row */
+ int redMask, greenMask, blueMask;