QT - StickyWindow does not work

Linux specific forum
User avatar
macros
User
User
Posts: 80
Joined: Wed Mar 15, 2006 1:47 pm
Location: Munich

QT - StickyWindow does not work

Post by macros »

Code: Select all

If OpenWindow(1, 0, 0, 322, 150, "Nonsticky Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  StickyWindow(1,1)
  Repeat     
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
What should happen:
Windows stays on top

What does happen:
Window moves to background, requires two clicks to be brought to active state.
Does not stay on top

Video
There is a button to make windows stay on top, it should be highlighted if the state is successfully activated, like it is when I click the button in the video.
Focus stealing prevention is turned off.

System:
Kubuntu 18.04
Purebasic 5.70

StickyWindow() works with gtk subsystems.
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: PB 5.70 QT - StickyWindow does not work

Post by #NULL »

What happens here is that running the code repeatedly without changes sometimes results in a sticky window and sometimes it doesn't.
PB570LTS x64, Ubuntu 18.04
deeproot
Enthusiast
Enthusiast
Posts: 271
Joined: Thu Dec 17, 2009 12:00 pm
Location: Llangadog, Wales, UK
Contact:

Re: PB 5.70 QT - StickyWindow does not work

Post by deeproot »

#NULL wrote:What happens here is that running the code repeatedly without changes sometimes results in a sticky window and sometimes it doesn't.
Same here - appears random.

However, inserting Delay(500) between the OpenWindow and StickyWindow results in the window always being sticky (well - so far at least !!)

PB 5.70LTS x64 (qt subs), MX Linux 18
User avatar
macros
User
User
Posts: 80
Joined: Wed Mar 15, 2006 1:47 pm
Location: Munich

Re: PB 5.70 QT - StickyWindow does not work

Post by macros »

On another PC (PC2) I do not get the behaviour that the windows move to the background.
and after a delay it sometimes works.

(On PC1 I tried: Delays, Delays with a window refresh loop, toggling off on, nothing worked)

Here a code which toggle the On Top state every second:

Code: Select all

If OpenWindow(1, 0, 0, 322, 150, "Nonsticky Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  Repeat
    If ElapsedMilliseconds()-time>1000
      state!1
      StickyWindow(1,state)
      time=ElapsedMilliseconds()
    EndIf
  Until WaitWindowEvent(10) = #PB_Event_CloseWindow
EndIf
With gtk this works as expected on PC2. With qt.... it gets weird.
The window flashes on each StickyWindow() call, but only changes its sticky state if the mouse hovers on it.
If the mouse gets to close to the title bar, it moves up a bit on the next state change.
In the video I do not click on the window till I close it.
Fred
Administrator
Administrator
Posts: 16664
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: PB 5.70 QT - StickyWindow does not work

Post by Fred »

We use the standard Qt::WindowStaysOnTopHint to set the window on top, but according to the QT doc, it can fail (https://doc.qt.io/qt-5/qt.html#WindowType-enum - I tried to use the X11Bypass flag as well, but it remove all window decoreation so it's worse).
It fails on Ubuntu 18.04 and Ubuntu 20.04 here. There was QT bug report about this as well, so may be it works for more recent QT version https://bugreports.qt.io/browse/QTBUG-69515
User avatar
macros
User
User
Posts: 80
Joined: Wed Mar 15, 2006 1:47 pm
Location: Munich

Re: PB 5.70 QT - StickyWindow does not work

Post by macros »

Thank you for revisiting this old bug report!

I can confirm that it works now under Kubuntu 23.04

In a VM with Kubuntu 22.04.2 LTS the bug still occurs.

So it appears to be fixed on QTs side :)
Post Reply