Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
24
Task/Mouse-position/OCaml/mouse-position.ocaml
Normal file
24
Task/Mouse-position/OCaml/mouse-position.ocaml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
open Xlib
|
||||
|
||||
let () =
|
||||
let d = xOpenDisplay "" in
|
||||
|
||||
(* ask for active window (no error check);
|
||||
the client must be freedesktop compliant *)
|
||||
let _, _, _, _, props =
|
||||
xGetWindowProperty_window d
|
||||
(xDefaultRootWindow d)
|
||||
(xInternAtom d "_NET_ACTIVE_WINDOW" true)
|
||||
0 1 false AnyPropertyType
|
||||
in
|
||||
|
||||
let _, _, _, child, _ = xQueryPointer d props in
|
||||
begin match child with
|
||||
| Some(_, childx, childy) ->
|
||||
Printf.printf "relative to active window: %d,%d\n%!" childx childy;
|
||||
| None ->
|
||||
print_endline "the pointer is not on the same screen as the specified window"
|
||||
end;
|
||||
|
||||
xCloseDisplay d;
|
||||
;;
|
||||
Loading…
Add table
Add a link
Reference in a new issue