Sync
This commit is contained in:
parent
6f050a029e
commit
776bba907c
3887 changed files with 59894 additions and 7280 deletions
3
Task/Mouse-position/Emacs-Lisp/mouse-position.l
Normal file
3
Task/Mouse-position/Emacs-Lisp/mouse-position.l
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(mouse-pixel-position)
|
||||
=>
|
||||
(FRAME . (X . Y))
|
||||
|
|
@ -3,3 +3,4 @@ until *Pending() > 0 & Event() == "q" do { # loop until there is something to do
|
|||
py := WAttrib("pointery")
|
||||
# do whatever is needed
|
||||
WDelay(5) # wait and share processor
|
||||
}
|
||||
|
|
|
|||
38
Task/Mouse-position/Rust/mouse-position.rust
Normal file
38
Task/Mouse-position/Rust/mouse-position.rust
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
// rust 0.9-pre
|
||||
|
||||
use std::libc::types::os::arch::extra::{BOOL, HANDLE};
|
||||
use std::ptr::mut_null;
|
||||
|
||||
type LONG = i32;
|
||||
type HWND = HANDLE;
|
||||
|
||||
#[deriving(Eq)]
|
||||
struct POINT {
|
||||
x: LONG,
|
||||
y: LONG
|
||||
}
|
||||
|
||||
#[link_args = "-luser32"]
|
||||
extern "stdcall" {
|
||||
pub fn GetCursorPos(lpPoint:&mut POINT) -> BOOL;
|
||||
pub fn GetForegroundWindow() -> HWND;
|
||||
pub fn ScreenToClient(hWnd:HWND, lpPoint:&mut POINT);
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn main() {
|
||||
let mut pt = POINT{x:0, y:0};
|
||||
loop {
|
||||
std::rt::io::timer::sleep(100); // sleep duration in milliseconds
|
||||
|
||||
let pt_prev = pt;
|
||||
unsafe { GetCursorPos(&mut pt) };
|
||||
if pt != pt_prev {
|
||||
let h = unsafe { GetForegroundWindow() };
|
||||
if h == mut_null() { continue }
|
||||
let mut ptc = pt;
|
||||
unsafe { ScreenToClient(h, &mut ptc) };
|
||||
println!("x: {}, y: {}", ptc.x, ptc.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
6
Task/Mouse-position/Scala/mouse-position.scala
Normal file
6
Task/Mouse-position/Scala/mouse-position.scala
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import java.awt.MouseInfo
|
||||
|
||||
object MousePosition extends App {
|
||||
val mouseLocation = MouseInfo.getPointerInfo().getLocation()
|
||||
println (mouseLocation)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue