; Module/File: Window_GetUsedMonitorNo.pb ; Function: Get the currently mainly used monitor for the window - Linux ; 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 ImportC "" gtk_widget_get_window(*widget.GtkWidget) EndImport ; Object constants #Win_Main = 0 #But0 = 0 #Txt0 = 1 Global.i gEvent, gQuit Procedure.i GetGdkWindow(Window) ProcedureReturn gtk_widget_get_window(WindowID(Window)) EndProcedure If OpenWindow(#Win_Main, 300, 200, 300, 100, "Debug used monitor no.", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) ButtonGadget(#But0, 5, 5, 290, 26, "Get monitor no. w. window") TextGadget (#Txt0, 5, 35, 290, 22, "") Repeat gEvent= WaitWindowEvent() Select gEvent Case #PB_Event_CloseWindow gQuit= #True Case #PB_Event_Gadget If EventGadget() = #But0 SetGadgetText(#Txt0, "I'm mainly on monitor " + Str(gdk_screen_get_monitor_at_window_(gdk_screen_get_default_(), GetGdkWindow(#Win_Main)))) EndIf EndSelect Until gQuit EndIf ; IDE Options = PureBasic 5.45 LTS (Linux - x86) ; CursorPosition = 14 ; Folding = - ; EnableUnicode ; EnableXP