langs a-z

This commit is contained in:
Ingy döt Net 2013-04-10 22:43:41 -07:00
parent db842d013d
commit d066446780
11389 changed files with 98361 additions and 1020 deletions

View 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;
;;

View file

@ -0,0 +1 @@
[X, Y, BUTTONS] = ginput(N);

View file

@ -0,0 +1,21 @@
declare
[QTk] = {Module.link ['x-oz://system/wp/QTk.ozf']}
WindowClosed = {NewCell false}
Label
Window = {QTk.build
td(action:proc {$} WindowClosed := true {Window close} end
label(text:"" handle:Label))}
in
{Window show}
for while:{Not @WindowClosed} do
TopmostWindow = {List.last {String.tokens {Tk.return wm(stackorder '.')} & }}
Winfo = {Record.mapInd winfo(rootx:_ rooty:_ pointerx:_ pointery:_)
fun {$ I _}
{Tk.returnInt winfo(I TopmostWindow)}
end}
in
{Label set(text:"x: "#(Winfo.pointerx - Winfo.rootx)
#", y: "#(Winfo.pointery - Winfo.rooty))}
{Delay 250}
end

View file

@ -0,0 +1,2 @@
x = WindowMouseX(#MyWindow)
y = WindowMouseY(#MyWindow)

View file

@ -0,0 +1,20 @@
#MyWindow = 0
#Label_txt = 0
#MousePos_txt = 1
If OpenWindow(#MyWindow,0,0,200,200,"Test",#PB_Window_SystemMenu)
TextGadget(#Label_txt,0,0,100,20,"Mouse Position (x,y):",#PB_Text_Right)
TextGadget(#MousePos_txt,120,0,60,20,"()")
Repeat
Repeat
event = WaitWindowEvent(10)
If event = #PB_Event_CloseWindow
Break 2 ;exit program
EndIf
Until event = 0
x = WindowMouseX(#MyWindow)
y = WindowMouseY(#MyWindow)
SetGadgetText(#MousePos_txt,"(" + Str(x) + "," + Str(y) + ")")
ForEver
EndIf

View file

@ -0,0 +1,2 @@
needs canvas'
^canvas'mouse

View file

@ -0,0 +1,2 @@
xPos := pointerXPos(curr_win);
yPos := pointerYPos(curr_win);

View file

@ -0,0 +1,5 @@
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'X and Y are in "twips" -- 15 twips per pixel
Me.Print "X:" & X
Me.Print "Y:" & Y
End Sub

View file

@ -0,0 +1,16 @@
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
'X and Y are in pixels, with (0,0) being the top left corner of the primary display
X As Long
Y As Long
End Type
Private Pt As POINTAPI
Private Sub Timer1_Timer()
GetCursorPos Pt
Me.Cls
Me.Print "X:" & Pt.X
Me.Print "Y:" & Pt.Y
End Sub

View file

@ -0,0 +1,6 @@
include c:\cxpl\stdlib;
if not OpenMouse then Text(0, "A mouse is required")
else [ShowMouse(true);
IntOut(0, GetMousePosition(0)); ChOut(0, ^,);
IntOut(0, GetMousePosition(1)); CrLf(0);
]