xf86-input-mouse port: fix mouse device

This commit is contained in:
Matheus
2024-04-20 15:48:13 -03:00
parent 5f4513794f
commit 1748ff0afa
@@ -14,10 +14,10 @@ index 6c453cd..e27bdcb 100644
diff --git xf86-input-mouse-workdir/src/astral_mouse.c xf86-input-mouse-workdir/src/astral_mouse.c diff --git xf86-input-mouse-workdir/src/astral_mouse.c xf86-input-mouse-workdir/src/astral_mouse.c
new file mode 100644 new file mode 100644
index 0000000..49644ac index 0000000..d3a4a60
--- /dev/null --- /dev/null
+++ xf86-input-mouse-workdir/src/astral_mouse.c +++ xf86-input-mouse-workdir/src/astral_mouse.c
@@ -0,0 +1,126 @@ @@ -0,0 +1,119 @@
+#ifdef HAVE_XORG_CONFIG_H +#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h> +#include <xorg-config.h>
+#endif +#endif
@@ -41,20 +41,18 @@ index 0000000..49644ac
+ +
+#include <sys/stat.h> +#include <sys/stat.h>
+ +
+
+#define MOUSE_FLAG_RB 1 +#define MOUSE_FLAG_RB 1
+#define MOUSE_FLAG_MB 2 +#define MOUSE_FLAG_MB 2
+#define MOUSE_FLAG_LB 4 +#define MOUSE_FLAG_LB 4
+#define MOUSE_FLAG_B4 8 +#define MOUSE_FLAG_B4 8
+#define MOUSE_FLAG_B5 16 +#define MOUSE_FLAG_B5 16
+ +
+
+typedef struct { +typedef struct {
+ int flags; + int flags;
+ int x,y,z; + int x,y,z;
+} mousepacket_t; +} mousepacket_t;
+ +
+static void astralReadInput(InputInfoPtr pInfo){ +static void astralReadInput(InputInfoPtr pInfo) {
+ MouseDevPtr mouse = pInfo->private; + MouseDevPtr mouse = pInfo->private;
+ mousepacket_t packet; + mousepacket_t packet;
+ +
@@ -67,11 +65,9 @@ index 0000000..49644ac
+ +
+ mouse->PostEvent(pInfo, b, packet.x, -packet.y, packet.z, 0); + mouse->PostEvent(pInfo, b, packet.x, -packet.y, packet.z, 0);
+ } + }
+
+} +}
+ +
+static Bool astralPreInit(InputInfoPtr pInfo, const char* proto, int flag){ +static Bool astralPreInit(InputInfoPtr pInfo, const char* proto, int flag) {
+
+ MouseDevPtr mouse; + MouseDevPtr mouse;
+ +
+ mouse = pInfo->private; + mouse = pInfo->private;
@@ -89,14 +85,11 @@ index 0000000..49644ac
+ mouse->CommonOptions(pInfo); + mouse->CommonOptions(pInfo);
+ pInfo->read_input = astralReadInput; + pInfo->read_input = astralReadInput;
+ return true; + return true;
+
+
+} +}
+ +
+#define DEVPATH "/dev/mouse" +#define DEVPATH "/dev/mouse0"
+ +
+static const char* getdevice(InputInfoPtr pInfo, const char* proto, int flag){ +static const char* getdevice(InputInfoPtr pInfo, const char* proto, int flag){
+
+ struct stat st; + struct stat st;
+ +
+ if(stat(DEVPATH, &st) == -1) + if(stat(DEVPATH, &st) == -1)
@@ -105,10 +98,9 @@ index 0000000..49644ac
+ pInfo->options = xf86AddNewOption(pInfo->options, "Device", DEVPATH); + pInfo->options = xf86AddNewOption(pInfo->options, "Device", DEVPATH);
+ +
+ return DEVPATH; + return DEVPATH;
+
+} +}
+ +
+static int interfacesupport(){ +static int interfacesupport() {
+ return MSE_PS2; + return MSE_PS2;
+} +}
+ +
@@ -116,25 +108,26 @@ index 0000000..49644ac
+ "AstralMouseDev", NULL + "AstralMouseDev", NULL
+}; +};
+ +
+static const char** protonames(){ +static const char** protonames() {
+ return names; + return names;
+} +}
+ +
+static const char* defaultproto(){ +static const char* defaultproto() {
+ return "AstralMouseDev"; + return "AstralMouseDev";
+} +}
+ +
+static Bool isdefault(const char *protocol){ +static Bool isdefault(const char *protocol) {
+ return strcmp(protocol, defaultproto()) == 0; + return strcmp(protocol, defaultproto()) == 0;
+} +}
+ +
+OSMouseInfoPtr OSMouseInit(int flag){ +OSMouseInfoPtr OSMouseInit(int flag) {
+ OSMouseInfoPtr p; + OSMouseInfoPtr p;
+ +
+ p = calloc(sizeof(OSMouseInfoRec), 1); + p = calloc(sizeof(OSMouseInfoRec), 1);
+ +
+ if (!p) + if (!p)
+ return NULL; + return NULL;
+
+ p->SupportedInterfaces = interfacesupport; + p->SupportedInterfaces = interfacesupport;
+ p->BuiltinNames = protonames; + p->BuiltinNames = protonames;
+ p->FindDevice = getdevice; + p->FindDevice = getdevice;