; Module/File: Window_GetCursor.pb ; Function: Query the GdkCursor for a window - Linux gtk2/gtk3 ; Author: Omi ; Date: Jul. 27, 2017 ; Version: 0.1 ; Target Compiler: PureBasic 5.22/5.3/5.4/5.5/5.6 ; Target OS: Linux: (X/K/L)ubuntu, Mint, 32/64, Ascii/Uni ; Link to topic: http://www.purebasic.fr/english/viewtopic.php?f=12&t=68840 ; Link to topic: http://www.purebasic.fr/english/viewtopic.php?f=12&t=65091&start=225 ;-------------------------------------------------------------- EnableExplicit ImportC "" gdk_cursor_get_cursor_type(*cursor.GdkCursor) gdk_window_get_cursor(*window) gtk_widget_get_window(*widget.GtkWidget) EndImport ; Object constants #Win_Main = 0 Global.i gEvent, gQuit Global *Cursor.GdkCursor Procedure Create_WinMain() If OpenWindow(#Win_Main, 300, 200, 500, 200, "Get GdkCursor - wait", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) Debug "Standard cursor (unset) ..." Debug "Custom cursor is set ?" *Cursor= gdk_window_get_cursor(gtk_widget_get_window(WindowID(#Win_Main))); NULL if no custom cursor ist set! Debug "GdkCursor: " + *Cursor Debug "" Delay(2000) Debug "Set custom cursor #GDK_BOX_SPIRAL ..." *Cursor= gdk_cursor_new_(#GDK_BOX_SPIRAL) gdk_window_set_cursor_(gtk_widget_get_window(WindowID(#Win_Main)), *Cursor) While WindowEvent() : Wend Debug "Custom cursor is set?" *Cursor= gdk_window_get_cursor(gtk_widget_get_window(WindowID(#Win_Main))); ! ! ! Debug "GdkCursor: " + *Cursor If *Cursor Debug "Type : " + gdk_cursor_get_cursor_type(*Cursor); enum GdkCursorType EndIf Debug "" Delay(2000) Debug "Set Standard cursor again ..." gdk_window_set_cursor_(gtk_widget_get_window(WindowID(#Win_Main)), #Null) While WindowEvent() : Wend Debug "Custom cursor is set?" *Cursor= gdk_window_get_cursor(gtk_widget_get_window(WindowID(#Win_Main))); ! ! ! Debug "GdkCursor: " + *Cursor If *Cursor; NULL if no custom cursor ist set! Debug "Type : " + gdk_cursor_get_cursor_type(*Cursor); should'nt appear EndIf EndIf EndProcedure Create_WinMain() Repeat gEvent= WaitWindowEvent() Select gEvent Case #PB_Event_CloseWindow gQuit= #True EndSelect Until gQuit ; IDE Options = PureBasic 5.44 LTS (Linux - x86) ; CursorPosition = 57 ; Folding = - ; EnableUnicode ; EnableXP