Page 1 of 1

[Linux] [Fixed in 6.30] CanvasGadget doesn't always get EventType_Resize

Posted: Tue Nov 11, 2025 5:51 am
by kenmo
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.

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

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.

Re: [Linux] CanvasGadget doesn't always get EventType_Resize

Posted: Tue Nov 11, 2025 9:54 am
by PeDe
With PB v6.30b4 arm64 and Raspberry Pi OS (Debian 13, Trixie), resizing works without errors.
I can't test with PB v6.21 because the version no longer works with Trixie.

Peter

Re: [Linux] CanvasGadget doesn't always get EventType_Resize

Posted: Wed Nov 12, 2025 4:32 am
by kenmo
Thanks for testing. I will download the 6.30 Beta and try it there...
I added more OS info to my original post.

Re: [Linux] CanvasGadget doesn't always get EventType_Resize

Posted: Wed Nov 12, 2025 6:56 am
by PeDe
I can now confirm the error with PB v6.21 arm64 and Raspberry Pi OS (Debian 13).

Peter

Re: [Linux] CanvasGadget doesn't always get EventType_Resize

Posted: Wed Nov 12, 2025 7:14 pm
by mk-soft
Fixed with PB v6.30 ;)

Re: [Linux] [Fixed in 6.30] CanvasGadget doesn't always get EventType_Resize

Posted: Thu Nov 13, 2025 4:21 am
by kenmo
I guess I have bad timing with bug reports.

Yes, this appears to be fixed between PB 6.21 and PB 6.30. (I just tested 6.30 Beta 4.) So never mind! Thanks team!