[prev in list] [next in list] [prev in thread] [next in thread]
List: freedesktop-xorg
Subject: Some problem about writing a x driver
From: "antilife" <bamboo9527 () gmail ! com>
Date: 2007-12-29 12:15:42
Message-ID: 002c01c84a14$8d85b2d0$3601a8c0 () lgw3dce7a2070b
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
[Attachment #4 (text/plain)]
x driver:
......
......
xf86PostMotionEvent(device, 1, 0, 3, x, y, p);//for example: x=50,y=100
user program:
use xlib to fetch motion event:
XEvent event;
XNextEvent(disp, &event);
...
XDeviceMotionEvent *me = (XDeviceMotionEvent*)&event;
x = me->axis_data[0];//x=50
y = me->axis_data[1];//y=100
I get the correct values.
But use gtk, i get the wrong values:
static gint
motion_notify_event(GtkWidget *widget, GdkEventMotion *event)
{
...
x = event->x;// x less than the xf86PostMotionEvent'x
y = event->y;// y less than the xf86PostMotionEvent'y
...
return TRUE;
}
Anybody who can tell me the truth? many thanks...
[Attachment #5 (text/html)]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.2900.3132" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=宋体 size=2>x driver:</FONT></DIV>
<DIV><FONT face=宋体 size=2>......</FONT></DIV>
<DIV><FONT face=宋体 size=2>......</FONT></DIV>
<DIV><FONT face=宋体 size=2>xf86PostMotionEvent(device, 1, 0, 3, x, y, p);//for
example: x=50,y=100</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2>user program:</FONT></DIV>
<DIV><FONT face=宋体 size=2>use xlib to fetch motion event:</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2>XEvent event;</FONT></DIV>
<DIV><FONT face=宋体 size=2>XNextEvent(disp, &event);</FONT></DIV>
<DIV><FONT face=宋体 size=2>...</FONT></DIV>
<DIV><FONT face=宋体 size=2>XDeviceMotionEvent *me =
(XDeviceMotionEvent*)&event;</FONT></DIV>
<DIV><FONT face=宋体 size=2>x = me->axis_data[0];//x=50</FONT></DIV>
<DIV><FONT face=宋体 size=2>y = me->axis_data[1];//y=100</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2>I get the correct values.</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2>But use gtk, i get the wrong values:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体 size=2>static gint </FONT></DIV>
<DIV><FONT face=宋体 size=2>motion_notify_event(GtkWidget *widget, GdkEventMotion
*event)<BR>{<BR>...</FONT></DIV>
<DIV><FONT face=宋体 size=2>x = event->x;// x less than the
xf86PostMotionEvent'x</FONT></DIV>
<DIV><FONT face=宋体 size=2>y = event->y;// y less than the
xf86PostMotionEvent'y<BR>...<BR>return TRUE;<BR>}<BR>Anybody who can tell me the
truth? many thanks...</DIV></FONT></BODY></HTML>
_______________________________________________
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic