Bug 1149986 - telegram-desktop cannot be started with enabled GTK integration and libqt5-qtstyleplugins-platformtheme-gtk2 installed
telegram-desktop cannot be started with enabled GTK integration and libqt5-qt...
Status: RESOLVED FIXED
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Other
Current
x86-64 Other
: P5 - None : Normal (vote)
: ---
Assigned To: Xu Zhao
E-mail List
:
Depends on:
Blocks: 1154112
  Show dependency treegraph
 
Reported: 2019-09-09 10:16 UTC by Marcel Kuehlhorn
Modified: 2022-08-27 19:15 UTC (History)
3 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
log of successful launch (3.22 KB, text/plain)
2019-09-18 09:05 UTC, Marcel Kuehlhorn
Details
log of failed launch (1.13 KB, text/plain)
2019-09-18 09:05 UTC, Marcel Kuehlhorn
Details
cursive chat titles (12.69 KB, image/png)
2019-09-18 09:07 UTC, Marcel Kuehlhorn
Details
Correctly set theme (254.22 KB, image/jpeg)
2019-09-26 13:27 UTC, Marcel Kuehlhorn
Details
Fallback theme (248.14 KB, image/jpeg)
2019-09-26 13:30 UTC, Marcel Kuehlhorn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel Kuehlhorn 2019-09-09 10:16:38 UTC
Trying to start telegram-desktop built with enabled GTK integration and libqt5-qtstyleplugins-platformtheme-gtk2 installed fails with
> ~>telegram-desktop 
> (telegram-desktop:4205): GLib-GObject-WARNING **: 17:15:44.346: cannot register existing type 'GdkDisplayManager'
> (telegram-desktop:4205): GLib-CRITICAL **: 17:15:44.346: g_once_init_leave: assertion 'result != 0' failed
> (telegram-desktop:4205): GLib-GObject-CRITICAL **: 17:15:44.346: g_object_new_with_properties: assertion 'G_TYPE_IS_OBJECT (object_type)' failed

Currently this is resolved by a conflict of telegram-desktop with libqt5-qtstyleplugins-platformtheme-gtk2 which leads to cunfusion of users (bug 1148509)

Ideally the root cause should be found and patched.

A package without the conflict for testing can be found at
https://build.opensuse.org/project/show/home:tux93:tdesktop-no-conflict
Comment 1 Marcel Kuehlhorn 2019-09-10 08:57:00 UTC
Due to libqt5-qtstyleplugins-platformtheme-gtk2 being hard required by Cinnamon GTK integration will be disabled again on the main package, a branch with it enabled will be kept for further testing at
https://build.opensuse.org/project/show/home:tux93:tdesktop
Comment 2 Xu Zhao 2019-09-17 10:53:18 UTC
(In reply to Marcel Kuehlhorn from comment #1)
> Due to libqt5-qtstyleplugins-platformtheme-gtk2 being hard required by
> Cinnamon GTK integration will be disabled again on the main package, a
> branch with it enabled will be kept for further testing at
> https://build.opensuse.org/project/show/home:tux93:tdesktop

Request for review:

I used the gtk2 patch along with some other patches from Arch PKGBUILD and disable the GTK integration, and removes the conflict. The package works on my KDE desktop. Could you please test it on GNOME and/or Cinnamon? If it works on both platforms, I will submit a request to server:messaging.

My latest packaging is at: https://build.opensuse.org/project/show/home:nuklly:branches:server:messaging.

Please let me know what you think.
Comment 3 Marcel Kuehlhorn 2019-09-17 14:16:47 UTC
Thanks for your efforts, unfortunately the problem persists for me on Xfce:
> ~> telegram-desktop 
> (telegram-desktop:5440): GLib-GObject-WARNING **: 16:10:00.852: cannot register existing type 'GdkDisplayManager'
> (telegram-desktop:5440): GLib-CRITICAL **: 16:10:00.852: g_once_init_leave: assertion 'result != 0' failed
> (telegram-desktop:5440): GLib-GObject-CRITICAL **: 16:10:00.852: g_object_new_with_properties: assertion 'G_TYPE_IS_OBJECT (object_type)' failed

> ~> zypper se -si telegram qtstyle
> S  | Name                                     | Type    | Version                | Arch   | Repository  
---+------------------------------------------+---------+------------------------+--------+-------------
> i+ | libqt5-qtstyleplugins-platformtheme-gtk2 | package | 5.0.0+git20170311-6.12 | x86_64 | openSUSE-Oss
> i+ | telegram-desktop                         | package | 1.8.8-62.1             | x86_64 | Local 

Please send your patches to server:messaging anyway, just leave GTK integration disabled
(and don't forget to add a changelog entry for the patches ;) )
Comment 4 Xu Zhao 2019-09-18 02:41:40 UTC
(In reply to Marcel Kuehlhorn from comment #3)
> Thanks for your efforts, unfortunately the problem persists for me on Xfce:
> > ~> telegram-desktop 
> > (telegram-desktop:5440): GLib-GObject-WARNING **: 16:10:00.852: cannot register existing type 'GdkDisplayManager'
> > (telegram-desktop:5440): GLib-CRITICAL **: 16:10:00.852: g_once_init_leave: assertion 'result != 0' failed
> > (telegram-desktop:5440): GLib-GObject-CRITICAL **: 16:10:00.852: g_object_new_with_properties: assertion 'G_TYPE_IS_OBJECT (object_type)' failed
> 
> > ~> zypper se -si telegram qtstyle
> > S  | Name                                     | Type    | Version                | Arch   | Repository  
> ---+------------------------------------------+---------+--------------------
> ----+--------+-------------
> > i+ | libqt5-qtstyleplugins-platformtheme-gtk2 | package | 5.0.0+git20170311-6.12 | x86_64 | openSUSE-Oss
> > i+ | telegram-desktop                         | package | 1.8.8-62.1             | x86_64 | Local 
> 
> Please send your patches to server:messaging anyway, just leave GTK
> integration disabled
> (and don't forget to add a changelog entry for the patches ;) )

Can I also have the log.txt from Telegram? It should locate at ~/.local/share/TelegramDesktop/log.txt. Please enable debug level logging by running "telegram-desktop -debug"
Comment 5 Marcel Kuehlhorn 2019-09-18 09:05:05 UTC
Created attachment 818688 [details]
log of successful launch
Comment 6 Marcel Kuehlhorn 2019-09-18 09:05:44 UTC
Created attachment 818689 [details]
log of failed launch
Comment 7 Marcel Kuehlhorn 2019-09-18 09:06:23 UTC
It seems the -debug flag has no effect :(

> [2019.09.18 10:52:38] Launched version: 1008008, install beta: [FALSE], alpha: 0, debug mode: [FALSE], test dc: [FALSE]
[...]
> [2019.09.18 10:52:38] Command line: telegram-desktop -debug

I attached the log for a successful start with uninstalled libqt5-qtstyleplugins-platformtheme-gtk2 and a failed one anyway.
Comment 8 Marcel Kuehlhorn 2019-09-18 09:07:05 UTC
Created attachment 818690 [details]
cursive chat titles

I also noticed that in your patched version the titles in the chatlist become cursive, is that intentional?
Comment 9 Xu Zhao 2019-09-19 01:18:05 UTC
(In reply to Marcel Kuehlhorn from comment #8)
> Created attachment 818690 [details]
> cursive chat titles
> 
> I also noticed that in your patched version the titles in the chatlist
> become cursive, is that intentional?

The patches remove the built-in Open Sans fonts and uses system built-in Open Sans fonts. So it may pick-up an alternate if some fonts are missing in your system. Check "Font Error" in your log.txt file for more details.

Sorry I am still searching for flags to enable debug logs in Telegram. Enabling debug messages will be very helpful to further diagnose the qtstyle plugin conflict.
Comment 10 Xu Zhao 2019-09-19 16:55:36 UTC
(In reply to Marcel Kuehlhorn from comment #8)
> Created attachment 818690 [details]
> cursive chat titles
> 
> I also noticed that in your patched version the titles in the chatlist
> become cursive, is that intentional?

Could you please create a file called "withdebug" with single line content "1" in ~/.local/share/TelegramDesktop/tdata, then start telegram-desktop? This should be enough to turn on the debug mode.
After turning on debug mode, please share the log.txt file when there is a conflict. You can verify that the debug mode is on by checking the first line of log.txt:
Launched version: 1008002, install beta: [TRUE], alpha: 0, debug mode: [TRUE], test dc: [FALSE]
Comment 11 Xu Zhao 2019-09-20 03:22:14 UTC
(In reply to Marcel Kuehlhorn from comment #8)
> Created attachment 818690 [details]
> cursive chat titles
> 
> I also noticed that in your patched version the titles in the chatlist
> become cursive, is that intentional?

Tonight I debugged it on a xfce virtual machine.
Some updates:
1. The libqt5-qtstyleplugins-platformtheme-gtk2 package has two so files: platformthemes/libqgtk2.so and plugins/styles/libqgtk2style.so. The problematic one is libqgtk2.so.
2. Qt plugin loader searches the folder /usr/lib64/qt5/plugins/platformthemes and finds two plugins: libqgtk2.so and libqgtk3.so. It incorrectly selects the libqgtk2.so even if it is a gtk3 environment (xfce/gnome in my case). If only gtk2 plugin exists, it has no problem. So it is really a Qt bug.

Up to now it is not clear why Qt prefer the gtk2 plugin over the gtk3 one, and whether a workaround exists.
Comment 12 Xu Zhao 2019-09-20 11:25:00 UTC
(In reply to Marcel Kuehlhorn from comment #8)
> Created attachment 818690 [details]
> cursive chat titles
> 
> I also noticed that in your patched version the titles in the chatlist
> become cursive, is that intentional?

I have already found the root cause. In https://build.opensuse.org/package/view_file/KDE:Qt:5.13/libqt5-qtbase/libqt5-prioritise-gtk2-platformtheme.patch?expand=1 , openSUSE is prioritizing gtk2 theme over gtk3. This is incorrect. Given the time now gtk2 is mostly deprecated by both XFCE and Cinnamon, we should at least place gtk2 theme after gtk3.
Comment 13 Marcel Kuehlhorn 2019-09-20 12:02:11 UTC
(In reply to Xu Zhao from comment #12)
> I have already found the root cause. In
> https://build.opensuse.org/package/view_file/KDE:Qt:5.13/libqt5-qtbase/
> libqt5-prioritise-gtk2-platformtheme.patch?expand=1 , openSUSE is
> prioritizing gtk2 theme over gtk3. This is incorrect. Given the time now
> gtk2 is mostly deprecated by both XFCE and Cinnamon, we should at least
> place gtk2 theme after gtk3.

Adding Dirk Mueller since he's bugowner of KDE:Qt to see if that would be possible.
Comment 14 Marcel Kuehlhorn 2019-09-20 12:42:35 UTC
I just made a test build of libqt5-qtbase without that patch and that indeed fixes the problem, what needs to be tested is if this would re-introduce bug 1002900 for which it was originally added
Comment 15 Marcel Kuehlhorn 2019-09-26 09:22:18 UTC
It seems we're still at a stalemate between working GTK <-> Qt themeing and working GTK integration in Telegram: completely removing the patch from libqt5-qtbase predictably brought back bug 1002900, replacing it with a patch that adds GTK2 second also results in QT apps on GTK falling back to the GNOME default theme...

https://build.opensuse.org/package/show/home:tux93:branches:KDE:Qt:5.13/libqt5-qtbase
Comment 16 Xu Zhao 2019-09-26 12:48:02 UTC
(In reply to Marcel Kuehlhorn from comment #15)
> It seems we're still at a stalemate between working GTK <-> Qt themeing and
> working GTK integration in Telegram: completely removing the patch from
> libqt5-qtbase predictably brought back bug 1002900, replacing it with a
> patch that adds GTK2 second also results in QT apps on GTK falling back to
> the GNOME default theme...
> 
> https://build.opensuse.org/package/show/home:tux93:branches:KDE:Qt:5.13/
> libqt5-qtbase

A quick question: which Cinnamon package hard depends on libqt5-qtstyleplugins-platformtheme-gtk2?
Comment 17 Xu Zhao 2019-09-26 12:52:29 UTC
(In reply to Marcel Kuehlhorn from comment #15)
> It seems we're still at a stalemate between working GTK <-> Qt themeing and
> working GTK integration in Telegram: completely removing the patch from
> libqt5-qtbase predictably brought back bug 1002900, replacing it with a
> patch that adds GTK2 second also results in QT apps on GTK falling back to
> the GNOME default theme...
> 
> https://build.opensuse.org/package/show/home:tux93:branches:KDE:Qt:5.13/
> libqt5-qtbase

Also, what do you mean by "QT apps on GTK falling back to the GNOME default theme"? My understanding of setting GTK3 as the first will result in QT apps on GTK3 falling back to GTK3 theme, which is correct behavior.
Comment 18 Marcel Kuehlhorn 2019-09-26 13:27:59 UTC
Created attachment 819626 [details]
Correctly set theme
Comment 19 Marcel Kuehlhorn 2019-09-26 13:30:50 UTC
Created attachment 819630 [details]
Fallback theme

> A quick question: which Cinnamon package hard depends on libqt5-qtstyleplugins-platformtheme-gtk2?

> ~> zypper se --requires libqt5-qtstyleplugins-platformtheme-gtk2
> S | Name                        | Summary                                      | Type   
> --+-----------------------------+----------------------------------------------+--------
>   | cinnamon-session            | The session manager for the Cinnamon Desktop | package
>   | libqt5-qtstyleplugins-devel | Qt 5 Style Plugins Development Files         | package
>   | mate-session-manager        | MATE Session Manager                         | package

> Also, what do you mean by "QT apps on GTK falling back to the GNOME default
> theme"? My understanding of setting GTK3 as the first will result in QT apps
> on GTK3 falling back to GTK3 theme, which is correct behavior.

If you look at this Screenshot, you notice that Keepass falls back to the default theme instead of using the GTK3 version of the set theme
Comment 20 Xu Zhao 2019-09-26 20:22:06 UTC
(In reply to Marcel Kuehlhorn from comment #19)
> Created attachment 819630 [details]
> Fallback theme
> 
> > A quick question: which Cinnamon package hard depends on libqt5-qtstyleplugins-platformtheme-gtk2?
> 
> > ~> zypper se --requires libqt5-qtstyleplugins-platformtheme-gtk2
> > S | Name                        | Summary                                      | Type   
> > --+-----------------------------+----------------------------------------------+--------
> >   | cinnamon-session            | The session manager for the Cinnamon Desktop | package
> >   | libqt5-qtstyleplugins-devel | Qt 5 Style Plugins Development Files         | package
> >   | mate-session-manager        | MATE Session Manager                         | package
> 
> > Also, what do you mean by "QT apps on GTK falling back to the GNOME default
> > theme"? My understanding of setting GTK3 as the first will result in QT apps
> > on GTK3 falling back to GTK3 theme, which is correct behavior.
> 
> If you look at this Screenshot, you notice that Keepass falls back to the
> default theme instead of using the GTK3 version of the set theme

Then I believe the problem is why the theme falls back to default instead of using the GTK3 version even though the theme in Qt is set to "GTK3". It shouldn't be GTK2 related anyway.
Comment 21 Xu Zhao 2019-11-03 23:02:51 UTC
After some research, I have finally fixed this problem completely.
This is because when the application starts up (step-1), it uses gtk2 theme prior to the gtk3 theme (specified by qt5-base).
However, when later Telegram initializes the gtk environment (step-2), it searches for the gtk3 library first, if found, use the gtk3 library. If not found, use the gtk2 library.
When both gtk2 and gtk3 libraries co-exist in the system, the application will first use gtk2 theme to start up (in step-1), then use gtk3 libraries to initialize (in step-2), mix using two libraries causes a failed start.

To fix this, I have created a patch to let Telegram always favor gtk2 over gtk3 during initialization, since openSUSE has chosen to enable gtk2 theme by default in qt5-base.

Please help test my patch at: https://build.opensuse.org/package/show/home:nuklly:branches:server:messaging/telegram-desktop on XFCE, Cinnamon, GNOME, etc. The version works on KDE.

Note that I have to add the libappindicator1 as a hard dependency because Telegram can only use gtk2 with libappindicator1 for notification.

(In reply to Marcel Kuehlhorn from comment #19)
> Created attachment 819630 [details]
> Fallback theme
> 
> > A quick question: which Cinnamon package hard depends on libqt5-qtstyleplugins-platformtheme-gtk2?
> 
> > ~> zypper se --requires libqt5-qtstyleplugins-platformtheme-gtk2
> > S | Name                        | Summary                                      | Type   
> > --+-----------------------------+----------------------------------------------+--------
> >   | cinnamon-session            | The session manager for the Cinnamon Desktop | package
> >   | libqt5-qtstyleplugins-devel | Qt 5 Style Plugins Development Files         | package
> >   | mate-session-manager        | MATE Session Manager                         | package
> 
> > Also, what do you mean by "QT apps on GTK falling back to the GNOME default
> > theme"? My understanding of setting GTK3 as the first will result in QT apps
> > on GTK3 falling back to GTK3 theme, which is correct behavior.
> 
> If you look at this Screenshot, you notice that Keepass falls back to the
> default theme instead of using the GTK3 version of the set theme
Comment 22 Marcel Kuehlhorn 2019-11-05 10:03:47 UTC
(In reply to Xu Zhao from comment #21)
> Please help test my patch at:
> https://build.opensuse.org/package/show/home:nuklly:branches:server:
> messaging/telegram-desktop on XFCE, Cinnamon, GNOME, etc. The version works
> on KDE.
> 
Thank you very much for your efforts, just tested it on Xfce now and it seems to work nicely!
Comment 23 Nathaniel Graham 2019-11-05 20:27:38 UTC
Sweet, can we get this done for the official packaging?
Comment 24 Xu Zhao 2019-11-05 21:00:54 UTC
(In reply to Nathaniel Graham from comment #23)
> Sweet, can we get this done for the official packaging?

I have submitted the request to server:messaging. Please help review on different DEs (esp. GTK ones). Thank you!
Comment 25 Xu Zhao 2019-11-07 22:30:58 UTC
Resolved by req#746365. Waiting for the Factory's adoption.
Comment 26 Marcel Kuehlhorn 2020-07-01 13:04:34 UTC
Starting with telegram-desktop 2.1.14 beta the patch no longer works.

I've built the current beta with rebased 0000-gtk2-default.patch here:
https://build.opensuse.org/package/show/home:tux93:tdesktop-beta/telegram-desktop

When trying to launch this version of Telegram while `libqt5-qtstyleplugins-platformtheme-gtk2` is installed on the system startup hangs with the following messages in terminal:
> (telegram-desktop:11961): GLib-GObject-WARNING **: 14:04:28.194: cannot register existing type 'GtkWidget'
> (telegram-desktop:11961): GLib-GObject-CRITICAL **: 14:04:28.194: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
> (telegram-desktop:11961): GLib-GObject-WARNING **: 14:04:28.194: cannot register existing type 'GtkBuildable'
> (telegram-desktop:11961): GLib-GObject-CRITICAL **: 14:04:28.194: g_type_interface_add_prerequisite: assertion 'G_TYPE_IS_INTERFACE (interface_type)' failed
> (telegram-desktop:11961): GLib-CRITICAL **: 14:04:28.194: g_once_init_leave: assertion 'result != 0' failed
> (telegram-desktop:11961): GLib-GObject-CRITICAL **: 14:04:28.194: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
> (telegram-desktop:11961): GLib-GObject-CRITICAL **: 14:04:28.194: g_type_register_static: assertion 'parent_type > 0' failed
Comment 27 Xu Zhao 2020-07-12 19:03:08 UTC
(In reply to Marcel Kuehlhorn from comment #26)
> Starting with telegram-desktop 2.1.14 beta the patch no longer works.
> 
> I've built the current beta with rebased 0000-gtk2-default.patch here:
> https://build.opensuse.org/package/show/home:tux93:tdesktop-beta/telegram-
> desktop
> 
> When trying to launch this version of Telegram while
> `libqt5-qtstyleplugins-platformtheme-gtk2` is installed on the system
> startup hangs with the following messages in terminal:
> > (telegram-desktop:11961): GLib-GObject-WARNING **: 14:04:28.194: cannot register existing type 'GtkWidget'
> > (telegram-desktop:11961): GLib-GObject-CRITICAL **: 14:04:28.194: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
> > (telegram-desktop:11961): GLib-GObject-WARNING **: 14:04:28.194: cannot register existing type 'GtkBuildable'
> > (telegram-desktop:11961): GLib-GObject-CRITICAL **: 14:04:28.194: g_type_interface_add_prerequisite: assertion 'G_TYPE_IS_INTERFACE (interface_type)' failed
> > (telegram-desktop:11961): GLib-CRITICAL **: 14:04:28.194: g_once_init_leave: assertion 'result != 0' failed
> > (telegram-desktop:11961): GLib-GObject-CRITICAL **: 14:04:28.194: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
> > (telegram-desktop:11961): GLib-GObject-CRITICAL **: 14:04:28.194: g_type_register_static: assertion 'parent_type > 0' failed

Just curious, why does openSUSE still have the gtk2 priortise patch in libqt5-qtbase? It doesn't make any sense to me to still favor gtk2 theme over gtk3 on Qt applications. Removing this patch will solve this problem automatically, based on my understanding of this bug.

https://build.opensuse.org/package/view_file/KDE:Qt:5.15/libqt5-qtbase/libqt5-prioritise-gtk2-platformtheme.patch
Comment 28 Marcel Kuehlhorn 2020-07-13 17:24:32 UTC
(In reply to Xu Zhao from comment #27)
> Just curious, why does openSUSE still have the gtk2 priortise patch in libqt5-qtbase? It doesn't make any sense to me to still favor gtk2 theme over gtk3 on Qt applications. Removing this patch will solve this problem automatically, based on my understanding of this bug.

Good question, maybe one of the maintainers could answer that?
Comment 29 Fabian Vogt 2020-07-16 15:28:26 UTC
(In reply to Marcel Kuehlhorn from comment #28)
> (In reply to Xu Zhao from comment #27)
> > Just curious, why does openSUSE still have the gtk2 priortise patch in libqt5-qtbase? It doesn't make any sense to me to still favor gtk2 theme over gtk3 on Qt applications. Removing this patch will solve this problem automatically, based on my understanding of this bug.
> 
> Good question, maybe one of the maintainers could answer that?

The gtk3 plugin is only a platform plugin, but not a theme or style, so it would use Fusion (or some other theme) with GTK 3 dialogs. The gtk2 style plugin is a complete style, theme and platform plugin.
Comment 30 Xu Zhao 2020-07-16 15:31:47 UTC
(In reply to Fabian Vogt from comment #29)
> (In reply to Marcel Kuehlhorn from comment #28)
> > (In reply to Xu Zhao from comment #27)
> > > Just curious, why does openSUSE still have the gtk2 priortise patch in libqt5-qtbase? It doesn't make any sense to me to still favor gtk2 theme over gtk3 on Qt applications. Removing this patch will solve this problem automatically, based on my understanding of this bug.
> > 
> > Good question, maybe one of the maintainers could answer that?
> 
> The gtk3 plugin is only a platform plugin, but not a theme or style, so it
> would use Fusion (or some other theme) with GTK 3 dialogs. The gtk2 style
> plugin is a complete style, theme and platform plugin.

I see. Sorry I am not familiar with this part of Qt. Could you please provide more details? Why prioritzing gtk3 platform plugin and using other gtk3 theme over gtk2 style plugin(w/ theme and style) is a problem?
Comment 31 Fabian Vogt 2020-07-16 15:35:24 UTC
(In reply to Xu Zhao from comment #30)
> (In reply to Fabian Vogt from comment #29)
> > (In reply to Marcel Kuehlhorn from comment #28)
> > > (In reply to Xu Zhao from comment #27)
> > > > Just curious, why does openSUSE still have the gtk2 priortise patch in libqt5-qtbase? It doesn't make any sense to me to still favor gtk2 theme over gtk3 on Qt applications. Removing this patch will solve this problem automatically, based on my understanding of this bug.
> > > 
> > > Good question, maybe one of the maintainers could answer that?
> > 
> > The gtk3 plugin is only a platform plugin, but not a theme or style, so it
> > would use Fusion (or some other theme) with GTK 3 dialogs. The gtk2 style
> > plugin is a complete style, theme and platform plugin.
> 
> I see. Sorry I am not familiar with this part of Qt. Could you please
> provide more details? Why prioritzing gtk3 platform plugin and using other
> gtk3 theme over gtk2 style plugin(w/ theme and style) is a problem?

Qt does not support GTK3 themes, only GTK2 ones.
Comment 32 Xu Zhao 2020-08-30 15:32:27 UTC
Please help test the new build on different GTK platforms. I've tested that it works on GNOME and KDE.
https://build.opensuse.org/package/show/home:nuklly:branches:server:messaging/telegram-desktop

Please also note that Telegram has officially warned that its GTK integration(incl. system native notifications, dark modes, etc) is not compatible with the qgtk2 platform plugin, see https://pastebin.com/vCwQiysz


Even though it works for now, telegram may break the GTK2 plugin environment at anytime (e.g., they may stop loading gtk2 libraries in their source code) since they don't care about it.
In summary I believe we should obsolete Qt GTK2 platform plugin, even though Qt supports it better.

(In reply to Marcel Kuehlhorn from comment #26)
> Starting with telegram-desktop 2.1.14 beta the patch no longer works.
> 
> I've built the current beta with rebased 0000-gtk2-default.patch here:
> https://build.opensuse.org/package/show/home:tux93:tdesktop-beta/telegram-
> desktop
> 
> When trying to launch this version of Telegram while
> `libqt5-qtstyleplugins-platformtheme-gtk2` is installed on the system
> startup hangs with the following messages in terminal:
> > (telegram-desktop:11961): GLib-GObject-WARNING **: 14:04:28.194: cannot register existing type 'GtkWidget'
> > (telegram-desktop:11961): GLib-GObject-CRITICAL **: 14:04:28.194: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
> > (telegram-desktop:11961): GLib-GObject-WARNING **: 14:04:28.194: cannot register existing type 'GtkBuildable'
> > (telegram-desktop:11961): GLib-GObject-CRITICAL **: 14:04:28.194: g_type_interface_add_prerequisite: assertion 'G_TYPE_IS_INTERFACE (interface_type)' failed
> > (telegram-desktop:11961): GLib-CRITICAL **: 14:04:28.194: g_once_init_leave: assertion 'result != 0' failed
> > (telegram-desktop:11961): GLib-GObject-CRITICAL **: 14:04:28.194: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
> > (telegram-desktop:11961): GLib-GObject-CRITICAL **: 14:04:28.194: g_type_register_static: assertion 'parent_type > 0' failed
Comment 33 Marcel Kuehlhorn 2020-08-30 18:18:47 UTC
(In reply to Xu Zhao from comment #32)
> Please help test the new build on different GTK platforms. I've tested that
> it works on GNOME and KDE.
> https://build.opensuse.org/package/show/home:nuklly:branches:server:
> messaging/telegram-desktop
> 
Thank you for your great work!
I can confirm your build launches on Xfce even with the GTK2 platformtheme present, so for now I think we're good (for now).

ps: before you submit it to server:messaging don't forgot to mention the renamed / added patches in the changelog for the factory bot
Comment 34 Marcel Kuehlhorn 2021-02-24 20:09:51 UTC
Telegram > 2.6 reintroduces this issue because the code part used for our patch was removed, unless someone more versed can have a look at the code and maybe find a new workaround I'll have to disable GTK integration in the package again
Comment 35 Xu Zhao 2021-04-12 16:18:29 UTC
(In reply to Marcel Kuehlhorn from comment #34)
> Telegram > 2.6 reintroduces this issue because the code part used for our
> patch was removed, unless someone more versed can have a look at the code
> and maybe find a new workaround I'll have to disable GTK integration in the
> package again

I added a tentative fix in: https://build.opensuse.org/package/show/home:nuklly:branches:server:messaging/telegram-desktop. However, I don't have means to test it because I don't use Gnome or GTK based DE.
Comment 36 Xu Zhao 2021-04-12 17:08:03 UTC
(In reply to Xu Zhao from comment #35)
> (In reply to Marcel Kuehlhorn from comment #34)
> > Telegram > 2.6 reintroduces this issue because the code part used for our
> > patch was removed, unless someone more versed can have a look at the code
> > and maybe find a new workaround I'll have to disable GTK integration in the
> > package again
> 
> I added a tentative fix in:
> https://build.opensuse.org/package/show/home:nuklly:branches:server:
> messaging/telegram-desktop. However, I don't have means to test it because I
> don't use Gnome or GTK based DE.

Please ignore this - I tested and it doesn't work.
I will work on this when I have more time.
Comment 37 Xu Zhao 2021-06-05 03:05:34 UTC
Submits a new request to fix this: https://build.opensuse.org/request/show/897600

Would be interested to know when we will finally obselete GTK2 though.
Comment 38 OBSbugzilla Bot 2021-06-05 14:50:06 UTC
This is an autogenerated message for OBS integration:
This bug (1149986) was mentioned in
https://build.opensuse.org/request/show/897722 Factory / telegram-desktop
Comment 39 Xu Zhao 2021-06-05 16:21:11 UTC
Fixed by the request https://build.opensuse.org/request/show/897722
Comment 40 OBSbugzilla Bot 2021-09-30 10:40:20 UTC
This is an autogenerated message for OBS integration:
This bug (1149986) was mentioned in
https://build.opensuse.org/request/show/922312 Factory / telegram-desktop
Comment 41 OBSbugzilla Bot 2022-07-10 10:40:02 UTC
This is an autogenerated message for OBS integration:
This bug (1149986) was mentioned in
https://build.opensuse.org/request/show/988087 Backports:SLE-15-SP4 / telegram-desktop
Comment 42 Swamp Workflow Management 2022-08-27 19:15:52 UTC
openSUSE-RU-2022:10105-1: An update that has three recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 1149986,1193516,1199323
CVE References: 
JIRA References: 
Sources used:
openSUSE Backports SLE-15-SP4 (src):    telegram-desktop-4.0.2-bp154.2.3.2