Hi Richard,
i've tried your code again on Linux and got 3 problems:
- The new color
#Blue is missing in Linux.
- You reactivated the Windows-
beep_() again. However, the code for Linux is missing.
- You reactivated the
SetCursorPos_(MX,MY) again but the Linux part is missing.
Again, change the header part to this ...
Code: Select all
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
ImportC ""
gdk_device_manager_get_client_pointer(*device_manager); Gtk3
gdk_device_warp(*device.GdkDevice, *screen.GdkScreen, x, y); Gtk3
gdk_display_get_default()
gdk_display_get_device_manager(*display.GdkDisplay); Gtk3
gdk_display_warp_pointer(*display.GdkDisplay, *screen.GdkScreen, x, y); Gtk2
gdk_screen_get_default()
EndImport
#Red = $0000FF
#Green = $008000
#Cyan = $FFFF00
#Yellow= $00FFFF
#White = $FFFFFF
#Black = $0
#Blue = $FF0000
CompilerEndIf
Add this instead of your
beep_()-part:
Code: Select all
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
beep_(2500,50)
CompilerElseIf #PB_Compiler_OS = #PB_OS_Linux
RunProgram("beep", "-f 2500 -l 50", ""); 'beep' must be installed on Linux
CompilerEndIf
Add this instead of your
SetCursorPos_(MX,MY)-part:
Code: Select all
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
SetCursorPos_(MX,MY)
CompilerElseIf #PB_Compiler_OS = #PB_OS_Linux
gdk_display_warp_pointer(gdk_display_get_default (), gdk_screen_get_default(), MX, MY); Gtk2, officialy deprecated
;-> replace the line above with the following line, if 'gdk_display_warp_pointer' is finally deprecated on newer gtk3-systems...
; gdk_device_warp (gdk_device_manager_get_client_pointer(gdk_display_get_device_manager(gdk_display_get_default ())), gdk_screen_get_default(), MX, MY)
CompilerEndIf
...This seems to be unreliable in Linux...
I think some Linux window managers don't be in hurry to give the focus to the window at opening, and this could be the problem. If you want to see the error that occasionally happens on Linux, then change ...
Code: Select all
OpenWindow(1,0,0,600,380,"MultiBar_Test Rev 0.3", #PB_Window_ScreenCentered|#PB_Window_SystemMenu)
;to ...
OpenWindow(1,0,0,600,380,"MultiBar_Test Rev 0.3", #PB_Window_ScreenCentered|#PB_Window_NoActivate|#PB_Window_SystemMenu)
and eventually disable the following line ...
;SetActiveWindow(1)
Probably this shows on Windows what occasionally happens on Linux (don't tried it on Windows).
I think the most solid alternative would be an additional 'window'-parameter in
MTrackBarGadget()
Thus, the reliable operation no longer depends on how the user applies the MTrackBarGadget and and he no longer needs to force the window focus.
Best Regards, Charly