summaryrefslogtreecommitdiff
path: root/hw/kdrive/fake
diff options
context:
space:
mode:
authorDaniel Stone <daniel.stone@nokia.com>2006-07-19 16:51:04 -0400
committerDaniel Stone <daniels@endtroducing.fooishbar.org>2006-07-21 15:19:51 -0400
commit02d09105113fb9b560a770fe15f7bb041165831c (patch)
treecadb80dc7d1571d45481c316d1e8303bf5871b7c /hw/kdrive/fake
parenta274e7296b1bdd6f6c921f28b087610cec9548e0 (diff)
new KDrive input world order
Convert KDrive to GPE/GKE interface. Add first-class drivers and enumerate every device separately through Xi, instead of lamely attempting to aggregate them. Add XKB support to the Linux keyboard driver. Add 'thumb button' support to the tslib driver. Rejig InitInput, so each DDX has to add a list of drivers it supports. Support NewInputDeviceRequest, et al.
Diffstat (limited to 'hw/kdrive/fake')
-rw-r--r--hw/kdrive/fake/fake.c6
-rw-r--r--hw/kdrive/fake/fake.h4
-rw-r--r--hw/kdrive/fake/fakeinit.c17
-rw-r--r--hw/kdrive/fake/kbd.c48
-rw-r--r--hw/kdrive/fake/mouse.c26
5 files changed, 74 insertions, 27 deletions
diff --git a/hw/kdrive/fake/fake.c b/hw/kdrive/fake/fake.c
index d56512b3f..ca515f9b6 100644
--- a/hw/kdrive/fake/fake.c
+++ b/hw/kdrive/fake/fake.c
@@ -158,7 +158,7 @@ Bool
fakeMapFramebuffer (KdScreenInfo *screen)
{
FakeScrPriv *scrpriv = screen->driver;
- KdMouseMatrix m;
+ KdPointerMatrix m;
FakePriv *priv = screen->card->driver;
if (scrpriv->randr != RR_Rotate_0)
@@ -166,9 +166,9 @@ fakeMapFramebuffer (KdScreenInfo *screen)
else
scrpriv->shadow = FALSE;
- KdComputeMouseMatrix (&m, scrpriv->randr, screen->width, screen->height);
+ KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
- KdSetMouseMatrix (&m);
+ KdSetPointerMatrix (&m);
priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 5) << 2;
if (priv->base)
diff --git a/hw/kdrive/fake/fake.h b/hw/kdrive/fake/fake.h
index 4d90d3169..f7c8c3431 100644
--- a/hw/kdrive/fake/fake.h
+++ b/hw/kdrive/fake/fake.h
@@ -130,9 +130,9 @@ fakeRandRInit (ScreenPtr pScreen);
#endif
-extern KdMouseFuncs FakeMouseFuncs;
+extern KdPointerDriver FakePointerDriver;
-extern KdKeyboardFuncs FakeKeyboardFuncs;
+extern KdKeyboardDriver FakeKeyboardDriver;
extern KdOsFuncs FakeOsFuncs;
diff --git a/hw/kdrive/fake/fakeinit.c b/hw/kdrive/fake/fakeinit.c
index c5ee4bc3f..dd88bc5a7 100644
--- a/hw/kdrive/fake/fakeinit.c
+++ b/hw/kdrive/fake/fakeinit.c
@@ -44,7 +44,22 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
- KdInitInput (&FakeMouseFuncs, &FakeKeyboardFuncs);
+ KdPointerInfo *pi;
+ KdKeyboardInfo *ki;
+
+ pi = KdNewPointer ();
+ if (!pi)
+ return;
+ pi->driver = &FakePointerDriver;
+ KdAddPointer(pi);
+
+ ki = KdNewKeyboard ();
+ if (!ki)
+ return;
+ ki->driver = &FakeKeyboardDriver;
+ KdAddKeyboard(ki);
+
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/fake/kbd.c b/hw/kdrive/fake/kbd.c
index 9cf4de060..db224c995 100644
--- a/hw/kdrive/fake/kbd.c
+++ b/hw/kdrive/fake/kbd.c
@@ -27,7 +27,6 @@
#include <kdrive-config.h>
#endif
#include "fake.h"
-#include "kkeymap.h"
#include <X11/keysym.h>
#define FAKE_WIDTH 2
@@ -155,41 +154,58 @@ KeySym FakeKeymap[] = {
/* 116 123 */ NoSymbol, NoSymbol, /* tiny button */
};
-static void
-FakeKeyboardLoad (void)
+static Status
+FakeKeyboardInit (KdKeyboardInfo *ki)
+{
+ ki->keySyms.minKeyCode = 1;
+ ki->keySyms.maxKeyCode = (sizeof (FakeKeymap) / sizeof (FakeKeymap[0])) / FAKE_WIDTH;
+ ki->keySyms.mapWidth = FAKE_WIDTH;
+ if (ki->keySyms.map)
+ xfree(ki->keySyms.map);
+ ki->keySyms.map = (KeySym *)xalloc(sizeof(FakeKeymap));
+ if (!ki->keySyms.map)
+ return BadAlloc;
+ memcpy (ki->keySyms.map, FakeKeymap, sizeof (FakeKeymap));
+
+ return Success;
+}
+
+static Status
+FakeKeyboardEnable (KdKeyboardInfo *ki)
{
- kdMinScanCode = 1;
- kdKeymapWidth = FAKE_WIDTH;
- kdMaxScanCode = (sizeof (FakeKeymap) / sizeof (FakeKeymap[0])) / FAKE_WIDTH;
- memcpy (kdKeymap, FakeKeymap, sizeof (FakeKeymap));
+ return Success;
}
-static int
-FakeKeyboardInit (void)
+static void
+FakeKeyboardDisable (KdKeyboardInfo *ki)
{
- return 0;
+ return;
}
static void
-FakeKeyboardFini (void)
+FakeKeyboardFini (KdKeyboardInfo *ki)
{
+ xfree(ki->keySyms.map);
+ ki->keySyms.map = NULL;
}
static void
-FakeKeyboardLeds (int leds)
+FakeKeyboardLeds (KdKeyboardInfo *ki, int leds)
{
}
static void
-FakeKeyboardBell (int volume, int frequency, int duration)
+FakeKeyboardBell (KdKeyboardInfo *ki, int volume, int frequency, int duration)
{
}
-KdKeyboardFuncs FakeKeyboardFuncs = {
- FakeKeyboardLoad,
+KdKeyboardDriver FakeKeyboardDriver = {
+ "fake",
FakeKeyboardInit,
+ FakeKeyboardEnable,
FakeKeyboardLeds,
FakeKeyboardBell,
+ FakeKeyboardDisable,
FakeKeyboardFini,
- 0,
+ NULL,
};
diff --git a/hw/kdrive/fake/mouse.c b/hw/kdrive/fake/mouse.c
index 714a45123..beb6ff524 100644
--- a/hw/kdrive/fake/mouse.c
+++ b/hw/kdrive/fake/mouse.c
@@ -35,19 +35,35 @@
#include "scrnintstr.h"
#include "kdrive.h"
-static Bool
-MouseInit (void)
+static Status
+MouseInit (KdPointerInfo *pi)
{
- return TRUE;
+ return Success;
+}
+
+static Status
+MouseEnable (KdPointerInfo *pi)
+{
+ return Success;
+}
+
+static void
+MouseDisable (KdPointerInfo *pi)
+{
+ return;
}
static void
-MouseFini (void)
+MouseFini (KdPointerInfo *pi)
{
+ return;
}
-KdMouseFuncs FakeMouseFuncs = {
+KdPointerDriver FakePointerDriver = {
+ "fake",
MouseInit,
+ MouseEnable,
+ MouseDisable,
MouseFini,
};