Mouse position: Difference between revisions

(→‎{{header|Tcl}}: + standard ML)
Line 1,304:
<lang Standard ML>open XWindows ;
val dp = XOpenDisplay "" ;
val w = XCreateSimpleWindow (RootWindow dp) origin (Area {x=0,y=0,w=400,h=200300}) 3 0 0xffffff ;
XMapWindow w;
val (focus,_)=( Posix.Process.sleep (Time.fromReal 2.0); (* time to move from interpreter and activate window *)
XFlush dp ;
XGetInputFocus dp
XQueryPointer w ;</lang>
) ;
result: relative to the root window and the window w:
XQueryPointer wfocus ;</lang>
result: relativeposition to thewrt root window and theactive window w:
val it =
(true, Drawable, Drawable, XPoint {x = 12671230, y = 327940},
XPoint {x = 1133211, y = 23462}, []):
bool * Drawable * Drawable * XPoint * XPoint * Modifier list
 
There does not seem to be a function to query the window manager which window is active
=={{header|Tcl}}==
{{libheader|Tk}}
Anonymous user