[PB 6.21] Canvas Gadget #PB_EventType_Resize unreliable
Posted: Wed Aug 20, 2025 12:38 pm
Under Kubuntu Linux 25.04 with a plasma X11 or Wayland session the Resize event does not work as it should.
Under the GTK subsystem it fires in most cases, but not all of them. Especially when enlarging a windows slowly the event does not fire.
Unter the QT subsystem the event does not fire at all.
Below a sample code which works under a Windows 10 VM:
The code should always show a circular gradient centered in the canvas and filling it.
Example picture of the behavior under GTK:

The gadget has been resized as can be seen from the white background, the gradient has not been redrawn.
Under QT the CanvasGadget does not receive a single PB_EventType_Resize.
The canvas gadget itself is correctly resized as evident by the red border showing the window background color.
Under the GTK subsystem it fires in most cases, but not all of them. Especially when enlarging a windows slowly the event does not fire.
Unter the QT subsystem the event does not fire at all.
Below a sample code which works under a Windows 10 VM:
Code: Select all
Procedure RedrawCallback()
StartVectorDrawing(CanvasVectorOutput(0))
w=VectorOutputWidth()
h=VectorOutputHeight()
VectorSourceCircularGradient(w/2, h/2, (w+h)/2)
VectorSourceGradientColor(RGBA(255, 255, 255, 255), 0.0)
VectorSourceGradientColor(RGBA(0, 0, 0, 255), 1.0)
FillVectorOutput()
StopVectorDrawing()
EndProcedure
OpenWindow(0,0,0,400,400,"#PB_EventType_Resize Test",#PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_SizeGadget)
CanvasGadget(0,5,5,390,390)
BindGadgetEvent(0, @RedrawCallback(),#PB_EventType_Resize)
RedrawCallback() ; fill the canvas with an initial gradient
SetWindowColor(0,$ff)
Repeat
event=WaitWindowEvent()
If #PB_Event_SizeWindow
ResizeGadget(0,5,5,WindowWidth(0)-10,WindowHeight(0)-10)
EndIf
Until event=#PB_Event_CloseWindow
Example picture of the behavior under GTK:

The gadget has been resized as can be seen from the white background, the gradient has not been redrawn.
Under QT the CanvasGadget does not receive a single PB_EventType_Resize.
The canvas gadget itself is correctly resized as evident by the red border showing the window background color.