; Module/File: GdkGetDisplayMousePos.pb ; Function: Get the mouse postion desktop coordinates - Linux ; Author: Omi ; Date: Oct. 11, 2016 ; Version: 0.1 ; Target Compiler: PureBasic 5.22/5.31/5.4x/5.5x ; Target OS: Linux: (X/K/L)ubuntu, Mint, 32/64, Ascii/Uni ;-------------------------------------------------------------- EnableExplicit ImportC "" gdk_display_get_default() gdk_display_get_pointer(*display.GdkDisplay, *screen.GdkScreen, *x, *y, *mask) EndImport ; Object constants #MainWin = 0 Global.i gEvent, gQuit Global.i gMX, gMY Procedure Display_GetMousePos(*mX.LONG, *mY.LONG) gdk_display_get_pointer(gdk_display_get_default(), #Null, @*mX\l, @*mY\l, #Null) EndProcedure If OpenWindow(#MainWin, 0, 0, 800, 600, "Get display mouse pos. (on click)", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) Repeat gEvent= WaitWindowEvent() Select gEvent Case #PB_Event_CloseWindow gQuit= #True Case #PB_Event_LeftClick Display_GetMousePos(@gMX, @gMY) Debug Str(gMX) + "," + Str(gMY) EndSelect Until gQuit EndIf ; IDE Options = PureBasic 5.45 LTS (Linux - x86) ; CursorPosition = 26 ; Folding = - ; EnableUnicode ; EnableXP