Page 1 of 1

Another Linux panel bug?

Posted: Mon Mar 03, 2025 5:06 pm
by tua
Can someone confirm?

Code: Select all

EnableExplicit

Procedure Main()
  If OpenWindow(0, 0, 0, 400, 400, "Bug? demo", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    Protected tsw, tsh
    
    PanelGadget(1, 10, 10, 380, 380)
       AddGadgetItem (1, -1, "Panel 1")  
       AddGadgetItem (1, -1, "Panel 1")  
       tsw = GetGadgetAttribute(1,  #PB_Panel_ItemWidth)   ; broken under linux - both come back as 0
       tsh = GetGadgetAttribute(1,  #PB_Panel_ItemHeight)  ; works fine under windows
       Debug Str(tsw) + #LF$ + Str(tsh)                                                                 
    CloseGadgetList()   
  EndIf     
EndProcedure
   
Main()   
     
Repeat: Until WaitWindowEvent() = #PB_Event_CloseWindow

Re: Another Linux panel bug?

Posted: Mon Mar 03, 2025 5:48 pm
by moulder61
Hi tua,

I just tried it on Void Linux using PB6.11 LTS beta 2 and they both come back as 1. Presumably they should both be 380?
I tried commenting out one of the panel gadgets and then renaming one of the panels, in case it made a difference but it was the same result.

Moulder.

Re: Another Linux panel bug?

Posted: Mon Mar 03, 2025 6:31 pm
by tua
My bad - I also get 1, not 0.

Under Windows 11 PB returns 374 & 353 (accounting for borders and the header tab)

Re: Another Linux panel bug?

Posted: Mon Mar 03, 2025 7:12 pm
by mk-soft
This is not because of PureBasic, but because GTK internally builds the window asynchronously.

Trick solution

Code: Select all

EnableExplicit

Procedure Main()
  If OpenWindow(0, 0, 0, 400, 400, "Bug? demo", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    Protected tsw, tsh
    
    PanelGadget(1, 10, 10, 380, 380)
    AddGadgetItem (1, -1, "Panel 1")  
    AddGadgetItem (1, -1, "Panel 2")  
    CloseGadgetList()
    
    ; Wait asynchrone GTK is ready
    While GetGadgetAttribute(1,  #PB_Panel_TabHeight) <= 0
      Delay(10)
    Wend
    
    tsw = GetGadgetAttribute(1,  #PB_Panel_ItemWidth)   ; broken under linux - both come back as 0
    tsh = GetGadgetAttribute(1,  #PB_Panel_ItemHeight)  ; works fine under windows
    Debug Str(tsw) + #LF$ + Str(tsh)                                                                 
    
  EndIf     
EndProcedure

Main()   

Repeat: Until WaitWindowEvent() = #PB_Event_CloseWindow

Re: Another Linux panel bug?

Posted: Tue Mar 04, 2025 12:03 pm
by Fred
Yes, it's an annoyance of GTK. QT is better regarding this

Re: Another Linux panel bug?

Posted: Tue Mar 04, 2025 12:19 pm
by NicTheQuick
Fred wrote: Tue Mar 04, 2025 12:03 pm Yes, it's an annoyance of GTK. QT is better regarding this
Do you know of a better way to wait for the asynchron window rendering?

Re: Another Linux panel bug?

Posted: Tue Mar 04, 2025 1:04 pm
by Fred
GTK provide a 'realize' event where you're supposed to wait before doing GUI manipulation, but it doesn't fit the PB model at all. We could may be approximate the innerheight/width of panel gadget somehow while the UI isn't really rendered, but it's more an hack than a solution