[Linux] [Fixed in 6.30] CanvasGadget doesn't always get EventType_Resize
Posted: Tue Nov 11, 2025 5:51 am
PB 6.21 x64 on Linux with or without "Wayland Support" enabled
EDIT: ElementaryOS 7 (Ubuntu 22.04 based)
EDIT 2: Appears to be fixed in PB 6.30!
Here's an odd one... Try mouse-resizing the window, which has a callback, which resizes the CanvasGadget, which also has a callback.
If I resize the window diagonally, I get both callbacks to trigger and it redraws correctly.
If I resize the window horizontally-only or vertically-only, it only triggers the window callback, not the gadget callback, and the redraw doesn't happen.
Confirmed by calling ResizeGadget() directly too, without the interactive window dragging.
If ResizeGadget() only changes one dimension, I don't get the EventType_Resize callback.
If I change both width AND height, I get the callback.
EDIT: ElementaryOS 7 (Ubuntu 22.04 based)
EDIT 2: Appears to be fixed in PB 6.30!
Here's an odd one... Try mouse-resizing the window, which has a callback, which resizes the CanvasGadget, which also has a callback.
If I resize the window diagonally, I get both callbacks to trigger and it redraws correctly.
If I resize the window horizontally-only or vertically-only, it only triggers the window callback, not the gadget callback, and the redraw doesn't happen.
Code: Select all
CompilerIf #PB_Compiler_OS <> #PB_OS_Linux
MessageRequester("Warning", "This bug report is intended for Linux!", #PB_MessageRequester_Warning)
CompilerEndIf
OpenWindow(0, 0, 0, 480, 480, "Resize Callback Test", #PB_Window_ScreenCentered | #PB_Window_SizeGadget)
CanvasGadget(0, 0, 0, WindowWidth(0), WindowHeight(0), #PB_Canvas_Keyboard)
Procedure SizeWindowCallback()
Debug #PB_Compiler_Procedure
ResizeGadget(0, 0, 0, WindowWidth(0), WindowHeight(0))
EndProcedure
Procedure ResizeCanvasCallback()
Debug #PB_Compiler_Procedure
If StartDrawing(CanvasOutput(0))
Box(0, 0, OutputWidth(), OutputHeight(), #White)
LineXY(0, 0, OutputWidth(), OutputHeight(), #Red)
LineXY(OutputWidth(), 0, 0, OutputHeight(), #Red)
StopDrawing()
EndIf
EndProcedure
ResizeCanvasCallback()
ClearDebugOutput()
MessageRequester("Info", "Try resizing window diagonally, horizontally, vertically...", #PB_MessageRequester_Info)
BindEvent(#PB_Event_SizeWindow, @SizeWindowCallback())
BindGadgetEvent(0, @ResizeCanvasCallback(), #PB_EventType_Resize)
;ResizeGadget(0, #PB_Ignore, #PB_Ignore, 490, 480) ; resize width only
;ResizeGadget(0, #PB_Ignore, #PB_Ignore, 480, 490) ; resize height only
;ResizeGadget(0, #PB_Ignore, #PB_Ignore, 490, 490) ; resize width and height - gets callback!
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
If ResizeGadget() only changes one dimension, I don't get the EventType_Resize callback.
If I change both width AND height, I get the callback.