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

Post bugreports for the Linux version here
User avatar
kenmo
Addict
Addict
Posts: 2066
Joined: Tue Dec 23, 2003 3:54 am

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

Post 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.
Last edited by kenmo on Thu Nov 13, 2025 4:20 am, edited 3 times in total.
PeDe
Enthusiast
Enthusiast
Posts: 314
Joined: Sun Nov 26, 2017 3:13 pm

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

Post 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
User avatar
kenmo
Addict
Addict
Posts: 2066
Joined: Tue Dec 23, 2003 3:54 am

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

Post 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.
PeDe
Enthusiast
Enthusiast
Posts: 314
Joined: Sun Nov 26, 2017 3:13 pm

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

Post by PeDe »

I can now confirm the error with PB v6.21 arm64 and Raspberry Pi OS (Debian 13).

Peter
User avatar
mk-soft
Always Here
Always Here
Posts: 6402
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

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

Post by mk-soft »

Fixed with PB v6.30 ;)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
kenmo
Addict
Addict
Posts: 2066
Joined: Tue Dec 23, 2003 3:54 am

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

Post 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!
Post Reply