Recent

Author Topic: 30sec Freeze per click in GTK3 file dialog under QT5 widgetset  (Read 14799 times)

dbannon

  • Hero Member
  • *****
  • Posts: 3171
    • tomboy-ng, a rewrite of the classic Tomboy
Re: 30sec Freeze per click in GTK3 file dialog under QT5 widgetset
« Reply #45 on: September 16, 2023, 02:18:50 pm »
here is my solution, its the best we can do with every DE I tested except Cinnamon -
line 669
 
Code: Pascal  [Select][+][-]
  1.    
  2.        Result := TLCLHandle(FileDialog);            // this is line 669
  3.   end else begin                                                                
  4.     Result := TQtWSFileDialog.CreateHandle(ACommonDialog);
  5.     if (pos('metacity', QtWidgetSet.WindowManagerName) > 0)
  6.        or (pos('xfwm4', QtWidgetSet.WindowManagerName) > 0) then
  7.           QFileDialog_setOption(QFileDialogH(TQtFileDialog(Result).Widget),
  8.              QFileDialogDontUseNativeDialog, True);
  9.     end;

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

irfanbagus

  • Jr. Member
  • **
  • Posts: 73
Re: 30sec Freeze per click in GTK3 file dialog under QT5 widgetset
« Reply #46 on: September 16, 2023, 02:32:16 pm »
here is my solution, its the best we can do with every DE I tested except Cinnamon -
line 669
 
Code: Pascal  [Select][+][-]
  1.    
  2.        Result := TLCLHandle(FileDialog);            // this is line 669
  3.   end else begin                                                                
  4.     Result := TQtWSFileDialog.CreateHandle(ACommonDialog);
  5.     if (pos('metacity', QtWidgetSet.WindowManagerName) > 0)
  6.        or (pos('xfwm4', QtWidgetSet.WindowManagerName) > 0) then
  7.           QFileDialog_setOption(QFileDialogH(TQtFileDialog(Result).Widget),
  8.              QFileDialogDontUseNativeDialog, True);
  9.     end;

Davo
can you test my latest patch? with my patch in my dekstop, gtk3 file dialog works.

edit : test without qt5ct
« Last Edit: September 16, 2023, 02:34:12 pm by irfanbagus »

dbannon

  • Hero Member
  • *****
  • Posts: 3171
    • tomboy-ng, a rewrite of the classic Tomboy
Re: 30sec Freeze per click in GTK3 file dialog under QT5 widgetset
« Reply #47 on: September 17, 2023, 03:17:05 am »
OK, I have tested against the same list I did yesterday and, rca, its looking good !

Code: [Select]
OK    Ubuntu 20.04 Mate X
OK    Ubuntu 23.04 XFCe, gtk2, fusion
OK    Ubuntu 23.04 fusion, Cinnamon
OK    Ubuntu 23.04 Budgie fusion
OK    Ubuntu 23.04 Ubuntu-Gnome fusion
OK    Debian Bookworm Plasma, breeze
OK    Debian Bookworm Cinnamon, qt5ct-style, fusion
OK ?  Debian Bookworm OpenBox, qt5ct-style, fusion (QT Default Dialog)
OK ?  Debian Bookworm LXDE, qt5ct-style, fusion (QT Default Dialog_
OK    Debian Bookworm LXQt X, lxqt, fusion
OK    Debian Bullseye Mate fusion
OK    Fedora 37 Mate Fusion
OK    Fedora 38 Gnome adwaita
OK ?  Debian Bookworm enlightenment gtk2, fusion (QT Default Dialog)
OK    Debian Bookworm Budgie, fusion

Only things to worry about there is that in the OpenBox distros and enlightenment we appear to to be using the default QT dialogs. That does not surprise me in the OpenBox ones, its a very minimal system and does not appear to have its own, more elaberate dialogs. In the past, I have found enlightenment to be somewhat idiosyncratic if not buggy and it does have smaller user base than most. I have a friend who swears by it, I will ask him about his experience there but overall, I am not concerned about this as a problem. Its still usable.

My feeling is we need to get this into Fixes as soon as possible, if Lazarus 3.0 is released as it is now, it would  be very sad.

I am guessing there is a take away here for Qt6 too ? My own app will only work on Qt6 with a strict qt6ct config.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

irfanbagus

  • Jr. Member
  • **
  • Posts: 73
Re: 30sec Freeze per click in GTK3 file dialog under QT5 widgetset
« Reply #48 on: September 17, 2023, 04:27:40 am »
OK, I have tested against the same list I did yesterday and, rca, its looking good !

Code: [Select]
OK    Ubuntu 20.04 Mate X
OK    Ubuntu 23.04 XFCe, gtk2, fusion
OK    Ubuntu 23.04 fusion, Cinnamon
OK    Ubuntu 23.04 Budgie fusion
OK    Ubuntu 23.04 Ubuntu-Gnome fusion
OK    Debian Bookworm Plasma, breeze
OK    Debian Bookworm Cinnamon, qt5ct-style, fusion
OK ?  Debian Bookworm OpenBox, qt5ct-style, fusion (QT Default Dialog)
OK ?  Debian Bookworm LXDE, qt5ct-style, fusion (QT Default Dialog_
OK    Debian Bookworm LXQt X, lxqt, fusion
OK    Debian Bullseye Mate fusion
OK    Fedora 37 Mate Fusion
OK    Fedora 38 Gnome adwaita
OK ?  Debian Bookworm enlightenment gtk2, fusion (QT Default Dialog)
OK    Debian Bookworm Budgie, fusion

Only things to worry about there is that in the OpenBox distros and enlightenment we appear to to be using the default QT dialogs. That does not surprise me in the OpenBox ones, its a very minimal system and does not appear to have its own, more elaberate dialogs. In the past, I have found enlightenment to be somewhat idiosyncratic if not buggy and it does have smaller user base than most. I have a friend who swears by it, I will ask him about his experience there but overall, I am not concerned about this as a problem. Its still usable.

My feeling is we need to get this into Fixes as soon as possible, if Lazarus 3.0 is released as it is now, it would  be very sad.

I am guessing there is a take away here for Qt6 too ? My own app will only work on Qt6 with a strict qt6ct config.

Davo

thank you for testing.

before trying fix this problem, i have zero knowledge about qt (as developer), so CMIIW. file dialog has nothing to do with window manager. it's job for qt platformthemes.
if i run
Code: [Select]
QT_DEBUG_PLUGINS=1 ./project1i got this line
Code: [Select]
.....
loaded library "/usr/lib/qt/plugins/platformthemes/libqgtk3.so"
.....
lxqt has no problem, even it's using openbox by default, because it provide qt based file dialog via lxqt-qtplugin. qt5ct works only if we select default dialog, which qt5ct provide native qt filedialog, but not working if we use xdg-portal dialog.

not tested with qt6 yet.
« Last Edit: September 17, 2023, 04:40:07 am by irfanbagus »

dbannon

  • Hero Member
  • *****
  • Posts: 3171
    • tomboy-ng, a rewrite of the classic Tomboy
Re: 30sec Freeze per click in GTK3 file dialog under QT5 widgetset
« Reply #49 on: September 17, 2023, 06:05:22 am »
Hmm, I just had a second look at enlightenment, just because its users are probably keen on look and feel issues. The problem seems to be that 'something' is demanding it load gtk2 stuff, even if I installed qt5ct and set everything in there to not be gtk2. But it still wants to load gtk2 and finds it invalid.

Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

irfanbagus

  • Jr. Member
  • **
  • Posts: 73
Re: 30sec Freeze per click in GTK3 file dialog under QT5 widgetset
« Reply #50 on: September 17, 2023, 07:40:23 am »
Hmm, I just had a second look at enlightenment, just because its users are probably keen on look and feel issues. The problem seems to be that 'something' is demanding it load gtk2 stuff, even if I installed qt5ct and set everything in there to not be gtk2. But it still wants to load gtk2 and finds it invalid.

try

Code: Pascal  [Select][+][-]
  1. QT_QPA_PLATFORMTHEME=gtk3 QT_STYLE_OVERRIDE=Fusion ./MyApp

you should get Fusion theme and gtk3 file dialog.

edit:
patch works for qt6
« Last Edit: September 17, 2023, 07:48:11 am by irfanbagus »

dbannon

  • Hero Member
  • *****
  • Posts: 3171
    • tomboy-ng, a rewrite of the classic Tomboy
Re: 30sec Freeze per click in GTK3 file dialog under QT5 widgetset
« Reply #51 on: September 17, 2023, 08:28:00 am »
you should get Fusion theme and gtk3 file dialog.

Indeed, you are right. So that proves the patch works across the board, the problems I saw relate to idiosyncrasies of some platforms. Thats great !
Quote from: irfanbagus
edit:
patch works for qt6
And thats even better !  Do you have an updated patch or should I just manually edited the qt6 source ? 

David
« Last Edit: September 17, 2023, 11:27:12 am by dbannon »
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dbannon

  • Hero Member
  • *****
  • Posts: 3171
    • tomboy-ng, a rewrite of the classic Tomboy
Re: 30sec Freeze per click in GTK3 file dialog under QT5 widgetset
« Reply #52 on: September 17, 2023, 12:49:52 pm »
Here is my patch made after manually copying what irfanbagus's qt5 does to version to qt6.

And it appears to work ! 

I'll do some more through tests tomorrow but it looks like  irfanbagus is right on top of it !

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

zeljko

  • Hero Member
  • *****
  • Posts: 1686
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: 30sec Freeze per click in GTK3 file dialog under QT5 widgetset
« Reply #53 on: September 17, 2023, 05:38:21 pm »
I've found why exactly is that problem. It's Qt bug. When it activates gtk(2,3) dialog with Qt platform theme it sends that selection clipboard is changed BUT that selection have 0 formats and I don't know how to evaluate if QMimeData is valid at that moment. Inside TQtClipboard.signalSelectionChanged() we are calling QMimeData_text() and others which then wait x11 for selection which is clearly invalid - no formats and nothing selected. If I cannot fix it somehow through QMimeData, I'll set x11SelectionLock in qtwsdialogs.

zeljko

  • Hero Member
  • *****
  • Posts: 1686
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: 30sec Freeze per click in GTK3 file dialog under QT5 widgetset
« Reply #54 on: September 17, 2023, 06:05:50 pm »
Just follow https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40206, I'll commit fix, and also merge to the fixes.

zeljko

  • Hero Member
  • *****
  • Posts: 1686
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: 30sec Freeze per click in GTK3 file dialog under QT5 widgetset
« Reply #55 on: September 17, 2023, 06:29:04 pm »
Commited to trunk and fixes_3_0, please test now, I cannot reproduce any delay with any kind of dialog now with qt5 and qt6.

AlexTP

  • Hero Member
  • *****
  • Posts: 2519
    • UVviewsoft
Re: 30sec Freeze per click in GTK3 file dialog under QT5 widgetset
« Reply #56 on: September 17, 2023, 07:32:33 pm »
Lazarus from git 'main'.
Ubuntu 22.04.
Before today's fix: Save-as dialog (not Open dialog) gives pause 25 secs in Qt5 app.
With today's fix: all is fast! Great!

irfanbagus

  • Jr. Member
  • **
  • Posts: 73
Re: 30sec Freeze per click in GTK3 file dialog under QT5 widgetset
« Reply #57 on: September 18, 2023, 01:01:07 am »
testing main with gtk3 file dialog

open save dialog : no freeze.
open save dialog, select filename field then copy or cut : freeze.

zeljko, QMimeData_text still called via signalDataChanged and IsClipboardChanged and make application freeze.

dbannon

  • Hero Member
  • *****
  • Posts: 3171
    • tomboy-ng, a rewrite of the classic Tomboy
Re: 30sec Freeze per click in GTK3 file dialog under QT5 widgetset
« Reply #58 on: September 18, 2023, 02:33:39 am »
Yes, sadly, irfanbagus is right. Any copy and past in the open save dialog with qt6 freezes.

Slightly different in Qt5, in my test it won't copy from within the dialog but does paste. Pasting outside the dialog does, after a delay, paste what you think you copied ?? Next time you try it, it just freezes as per Qt6. Erratic anyway.

Sorry to deliver such tidings.

Davo

Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

irfanbagus

  • Jr. Member
  • **
  • Posts: 73
Re: 30sec Freeze per click in GTK3 file dialog under QT5 widgetset
« Reply #59 on: September 18, 2023, 03:49:10 am »
and it's getting complicated. 'locking' signalDataChanged is not enough if other part of application access clipboard, like from TAction. see attachment. if patch used, opening save dialog and copy works, no freeze. if TEditPaste enabled , copy make application freeze.
i will try extend x11SelectionLock.

 

TinyPortal © 2005-2018