-
Notifications
You must be signed in to change notification settings - Fork 0
/
mouse.nim
27 lines (18 loc) · 1.08 KB
/
mouse.nim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import gintro/[glib, gobject, gtk, gio]
import gintro/gdk except Window
#---------------------------------------------------------------------------------------------------
proc onButtonPress(window: ApplicationWindow; event: Event; data: pointer): bool =
echo event.getCoords()
result = true
#---------------------------------------------------------------------------------------------------
proc activate(app: Application) =
## Activate the application.
let window = app.newApplicationWindow()
window.setTitle("Mouse position")
window.setSizeRequest(640, 480)
discard window.connect("button-press-event", onButtonPress, pointer(nil))
window.showAll()
#———————————————————————————————————————————————————————————————————————————————————————————————————
let app = newApplication(Application, "Rosetta.MousePosition")
discard app.connect("activate", activate)
discard app.run()