; Module/File: Monitor_GetNoAtPos.pb ; Function: Get the monitor no. on which the mouse-pointer is currently placed (or where a point lies) - Linux < gtk3.22 ; Author: Omi ; Date: Sep. 03, 2016 ; Version: 0.1 ; Target Compiler: PureBasic 5.22/5.31/5.4 ; Target OS: Linux: (X/K/L)ubuntu, Mint, 32/64, Ascii/Uni ;-------------------------------------------------------------- EnableExplicit ; Object constants #Win_Main = 0 #But0 = 0 #Txt1 = 1 #Txt2 = 2 Global.i gEvent, gQuit If OpenWindow(#Win_Main, 300, 200, 300, 100, "Debug monitor @ pointer", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) ButtonGadget(#But0, 5, 35, 290, 26, "Get monitor no. @ mouse-pointer", #PB_Button_Toggle) TextGadget (#Txt2, 5, 65, 290, 22, "") TextGadget (#Txt1, 5, 5, 290, 22, "Monitor at or near 100,1500: " + Str(gdk_screen_get_monitor_at_point_(gdk_screen_get_default_(), 100, 1500))) Repeat gEvent= WaitWindowEvent() Select gEvent Case #PB_Event_CloseWindow gQuit= #True Case #PB_Event_Gadget If EventGadget() = #But0 If GetGadgetState(#But0) AddWindowTimer(#Win_Main, 999, 500) Else RemoveWindowTimer(#Win_Main, 999) SetGadgetText(#Txt2, "") EndIf EndIf Case #PB_Event_Timer If EventTimer() = 999 SetGadgetText(#Txt2, "Mouse is in Monitor: " + Str(gdk_screen_get_monitor_at_point_(gdk_screen_get_default_(), DesktopMouseX(), DesktopMouseY()))) EndIf EndSelect Until gQuit EndIf ; IDE Options = PureBasic 5.46 LTS (Linux - x86) ; CursorPosition = 1 ; EnableUnicode ; EnableXP