; Module/File: EditField_CaptureRClick.pb ; Function: Detect and Block or capture a rightclick-syspopup in StringGadgets - Linux ; Author: Omi ; Date: Sep. 06, 2016 ; Version: 0.2 ; Target Compiler: PureBasic 5.22/5.31/5.40/5.5 ; Target OS: Linux: (X/K/L)ubuntu, Mint, 32/64, Ascii/Uni ;-------------------------------------------------------------- EnableExplicit ImportC "" g_signal_connect(*instance, detailed_signal.p-utf8, *c_handler, *data, destroy= 0, flags= 0) As "g_signal_connect_data" EndImport ; Object constants #Win_Main = 0 #StG1 = 0 Enumeration #PB_Event_FirstCustomValue #Event_Rightclick EndEnumeration Global.i gEvent, gQuit ProcedureC Callback_GtkEntrySingleRClick(*widget.GtkWidget, *Event.GdkEventButton, user_data) If user_data = #StG1 If *Event\button = 3 If *Event\type = #GDK_BUTTON_PRESS PostEvent(#Event_Rightclick, GetActiveWindow(), user_data) ProcedureReturn #True; #True blocks popup, #False NOT! EndIf EndIf EndIf EndProcedure If OpenWindow(#Win_Main, 0, 0, 400, 100, "Single rightclick on StringGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) StringGadget(#StG1, 5, 5, 390, 26, "Try a rightclick on me (sys-popup blocked) ...") g_signal_connect(GadgetID(#StG1), "button-press-event", @Callback_GtkEntrySingleRClick(), #StG1) Repeat gEvent= WaitWindowEvent() Select gEvent Case #PB_Event_CloseWindow gQuit= #True Case #Event_Rightclick If EventGadget() = #StG1 Debug "Rightclick on StringGadget " + Str(#StG1) + ". Popup is blocked!" EndIf EndSelect Until gQuit EndIf ; IDE Options = PureBasic 5.45 LTS (Linux - x86) ; CursorPosition = 3 ; Folding = - ; EnableUnicode ; EnableXP