; Module/File: Window_GetInnerMousePos.pb ; Function: Get the inner-window mouse postion 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 ;-------------------------------------------------------------- ;equivalent to WindowMouseX(), WindowMouseY() ;For display coordinates see /System/GdkGetDisplayMousePos.pb EnableExplicit ImportC "" gtk_widget_get_window(*widget.GtkWidget) gdk_window_get_pointer(*window, *x, *y, *mask) EndImport ; Object constants #Win_Main = 0 Global.i gEvent, gQuit Global.i gMX, gMY Procedure Window_GetInnerMousePos(Window, *mX.LONG, *mY.LONG) gdk_window_get_pointer(gtk_widget_get_window(WindowID(#Win_Main)), @*mX\l, @*mY\l, #Null) EndProcedure If OpenWindow(#Win_Main, 0, 0, 800, 600, "Get inner window 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 Window_GetInnerMousePos(#Win_Main, @gMX, @gMY) Debug Str(gMX) + "," + Str(gMY) Debug Str(WindowMouseX(#Win_Main)) + "," + Str(WindowMouseY(#Win_Main)) EndSelect Until gQuit EndIf ; IDE Options = PureBasic 5.45 LTS (Linux - x86) ; CursorPosition = 10 ; Folding = - ; EnableUnicode ; EnableXP