Mouse position: Difference between revisions
Content added Content deleted
(→{{header|Standard ML}}: now wrt focus) |
|||
Line 1,306: | Line 1,306: | ||
val w = XCreateSimpleWindow (RootWindow dp) origin (Area {x=0,y=0,w=400,h=300}) 3 0 0xffffff ; |
val w = XCreateSimpleWindow (RootWindow dp) origin (Area {x=0,y=0,w=400,h=300}) 3 0 0xffffff ; |
||
XMapWindow w; |
XMapWindow w; |
||
val (focus,_)=( Posix.Process.sleep (Time.fromReal 2.0); (* time to move from interpreter and |
val (focus,_)=( Posix.Process.sleep (Time.fromReal 2.0); (* time to move from interpreter and arbitrary window *) |
||
XGetInputFocus dp |
XGetInputFocus dp |
||
) ; |
) ; |
||
XQueryPointer focus ; |
XQueryPointer focus ; |
||
XQueryPointer w;</lang> |
|||
result: position wrt root window and active window |
result: position wrt root window and active window, resp wrt root window and window w |
||
val it = |
val it = |
||
(true, Drawable, Drawable, XPoint {x = |
(true, Drawable, Drawable, XPoint {x = 1259, y = 979}, |
||
XPoint {x = |
XPoint {x = 236, y = 105}, []): |
||
bool * Drawable * Drawable * XPoint * XPoint * Modifier list |
|||
val it = |
|||
(true, Drawable, Drawable, XPoint {x = 1259, y = 979}, |
|||
XPoint {x = 1056, y = 817}, []): |
|||
bool * Drawable * Drawable * XPoint * XPoint * Modifier list |
bool * Drawable * Drawable * XPoint * XPoint * Modifier list |
||