After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 121347 - Patch to provide GDK_MOUSE_DEVICE
Patch to provide GDK_MOUSE_DEVICE
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
2.2.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2003-09-03 11:04 UTC by junk
Modified: 2013-03-18 04:03 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
PATCH for GDK_MOUSE_DEVICE (2.76 KB, patch)
2003-09-03 11:06 UTC, junk
none Details | Review

Description junk 2003-09-03 11:04:31 UTC
Implements the environment variable GDK_MOUSE_DEVICE which 
allows a user to select the input device

--- /tmp/gdkmouse-fb.c	2003-09-02 13:43:32.000000000 +0200
+++ gdkmouse-fb.c	2003-09-03 10:10:45.000000000 +0200
@@ -15,6 +15,9 @@
  * License along with this library; if not, write to the
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
+ *
+ * Changes: Tue Sep  2 15:41:57 SAST 2003 Marc Welz
+ * Added GDK_MOUSE_DEVICE environment variable
  */
 
 #include <gdk/gdk.h>
@@ -36,6 +39,7 @@
 
 struct _GdkFBMouse {
   gint fd; /* Set by open */
+  gchar *file;
 
   /* These are written to by parse_packet */
   gdouble x, y;
@@ -252,7 +256,8 @@
  */
 
 struct _GdkFBMouseDevice {
-  char *name;
+  gchar *name;
+  gchar *file;
   gint packet_size;
   gboolean (*open)(GdkFBMouse *mouse);
   void (*close)(GdkFBMouse *mouse);
@@ -280,6 +285,7 @@
 static GdkFBMouseDevice mouse_devs[] =
 {
   { "ps2",
+    "/dev/psaux",
     3,
     gdk_fb_mouse_ps2_open,
     gdk_fb_mouse_ps2_close,
@@ -287,6 +293,7 @@
     { 0xc0, 0x00 }
   },
   { "imps2",
+    "/dev/psaux",
     4,
     gdk_fb_mouse_imps2_open,
     gdk_fb_mouse_ps2_close,
@@ -294,6 +301,7 @@
     { 0xc0, 0x00 }
   },
   { "ms",
+    "/dev/mouse",
     3,
     gdk_fb_mouse_ms_open,
     gdk_fb_mouse_ms_close,
@@ -301,6 +309,7 @@
     { 0x40, 0x40 }
   },
   { "fidmour",
+    "/dev/fidmour",
     5,
     gdk_fb_mouse_fidmour_open,
     gdk_fb_mouse_fidmour_close,
@@ -312,7 +321,7 @@
 gboolean
 gdk_fb_mouse_init (gboolean open_dev)
 {
-  char *mouse_type;
+  gchar *mouse_type, *mouse_file;
   int i;
 
   gdk_fb_mouse = g_new0 (GdkFBMouse, 1);
@@ -336,6 +345,12 @@
 
   gdk_fb_mouse->dev = &mouse_devs[i];
 
+  mouse_file = getenv ("GDK_MOUSE_DEVICE");
+  if (!mouse_file) 
+    mouse_file = mouse_devs[i].file;
+
+  gdk_fb_mouse->file = mouse_file;
+      
   gdk_fb_mouse->x = gdk_display->fb_width / 2;
   gdk_fb_mouse->y = gdk_display->fb_height / 2;
 
@@ -476,7 +491,7 @@
   guchar buf[7];
   int i = 0;
 
-  fd = gdk_fb_mouse_dev_open ("/dev/psaux", O_RDWR);
+  fd = gdk_fb_mouse_dev_open (mouse->file, O_RDWR);
   if (fd < 0)
     return FALSE;
   
@@ -511,7 +526,7 @@
   guchar buf[7];
   int i = 0;
 
-  fd = gdk_fb_mouse_dev_open ("/dev/psaux", O_RDWR);
+  fd = gdk_fb_mouse_dev_open (mouse->file, O_RDWR);
   if (fd < 0)
     return FALSE;
   
@@ -632,10 +647,10 @@
   guchar buf[7];
   struct termios tty;
 
-  fd = gdk_fb_mouse_dev_open ("/dev/mouse", O_RDWR);
+  fd = gdk_fb_mouse_dev_open (mouse->file, O_RDWR);
   if (fd < 0) 
     {
-      g_print ("Error opening /dev/mouse: %s\n", strerror (errno));
+      g_print ("Error opening %s: %s\n", mouse->file, strerror (errno));
       return FALSE;
     }
   
@@ -741,7 +756,7 @@
 {
   gint fd;
 
-  fd = gdk_fb_mouse_dev_open ("/dev/fidmour", O_RDONLY);
+  fd = gdk_fb_mouse_dev_open (mouse->file, O_RDONLY);
   if (fd < 0)
     return FALSE;
Comment 1 junk 2003-09-03 11:06:12 UTC
Created attachment 19695 [details] [review]
PATCH for GDK_MOUSE_DEVICE
Comment 2 Eric Warmenhoven 2003-09-16 18:03:59 UTC
Added to HEAD. Thanks.