Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 910544 - net-im/telegram-desktop-4.8.4 + dev-qt/qtbase-6.5.2 + wayland (sway) -> CSD
Summary: net-im/telegram-desktop-4.8.4 + dev-qt/qtbase-6.5.2 + wayland (sway) -> CSD
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Esteve Varela Colominas
URL:
Whiteboard:
Keywords:
Depends on: 915992
Blocks:
  Show dependency tree
 
Reported: 2023-07-19 07:14 UTC by Vasily Pupkin
Modified: 2023-12-11 13:25 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
CMakeCache (CMakeCache.txt,142.41 KB, text/plain)
2023-07-23 15:24 UTC, Vasily Pupkin
Details
CMakeCache.txt (CMakeCache.txt,128.16 KB, text/plain)
2023-07-23 15:25 UTC, Vasily Pupkin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vasily Pupkin 2023-07-19 07:14:35 UTC
After update (not sure what exactly has been updated) I have CSD in sway for telegram. Telegram built with Qt6, and for a long time there were no issues with that. I checked that other Qt6 apps does not start with CSD, so likely this is telegram related thing. However I'm not even sure how to debug this.

Reproducible: Always
Comment 1 Mike Gilbert gentoo-dev 2023-07-20 17:17:02 UTC
What is CSD?
Comment 2 Vasily Pupkin 2023-07-20 17:24:47 UTC
Client side decorations. Ugly window, border etc which draws app
Comment 3 Esteve Varela Colominas 2023-07-20 19:28:18 UTC
This is a known issue upstream https://github.com/telegramdesktop/tdesktop/issues/8734

You were likely building Qt without USE=wayland before, or something else caused telegram to run under Xwayland.
If you believe that's not the case, test the official binary release, and if it doesn't happen there, re-open this bug.
Comment 4 Vasily Pupkin 2023-07-20 19:44:27 UTC
Well, official telegram binary also draws decorations. And it does not run under Xwayland.
Comment 5 Vasily Pupkin 2023-07-22 21:04:15 UTC
After some investigation I figured out several things.
1. Default client does *not* show CSD. For some reason this option is not enabled by default, that's why I thought it does.
2. CMake sets DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION to ON *regardless* to value which has been passed by command line and it's not even in cache.
I removed  option definition from external/qt/package.cmake (https://github.com/desktop-app/cmake_helpers/blob/0620bb7b87a0ec9195151fd5eb0cf38656c1280b/external/qt/package.cmake#L51) and it built fine. So I assume that condition has not passed.
In cache I see 

> grep -e QT_VERSION -e LINUX CMakeCache.txt 
QT_VERSION_MAJOR:UNINITIALIZED=6

Maybe that's is the reason..
Comment 6 Esteve Varela Colominas 2023-07-22 23:55:51 UTC
From what I gather the official binary still has X support so it should be possible to runnundr Xwayland, but I digress.

So if DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION is ON, this issue is solved for you? That's at least a bit odd, does that force it to run under Xwayland or does it do something else? Have you tried simply running with QT_QPA_PLATFORM=xcb (I think)?
I'll fix this to be properly configurable in the ebuild but I must say that running telegram on wayland with USE=-wayland is at least a bit questionable, and I can't promise things won't break further down the line.
Thanks a lot for figuring this out, anyway.
Comment 7 Vasily Pupkin 2023-07-23 05:22:33 UTC
Issue solved for me when https://github.com/desktop-app/cmake_helpers/blob/0620bb7b87a0ec9195151fd5eb0cf38656c1280b/external/qt/package.cmake#L51 this line removed. If so, cmake uses passed DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION (which is in my case OFF, as I use wayland and have this flag enabled).

The issue is, that cmake is broken for me - it does not properly detects that I'm building on linux & qt>6.5 at that place.
Comment 8 Esteve Varela Colominas 2023-07-23 11:32:28 UTC
Oh, I see. Thanks for clarifying.
It's weird thought that the QT_VERSION_MINOR variable doesn't appear in your CMakeCache.txt. Could you check if it's being set in /usr/lib64/cmake/Qt6/Qt6Config.cmake and QtAutogenHelpers.cmake ?
I want the DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION option to remain configurable, and I'd rather force using the newest qt6 version rather than patching around this.
Maybe removing these lines in the ebuild works? https://github.com/gentoo/gentoo/blob/8a5a0205dc4f55b099c6ccffd6599458a154dd78/net-im/telegram-desktop/telegram-desktop-4.8.4-r2.ebuild#L134-L139
You don't have to rebuild the entire program to test this, just check if -DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION appears in your build log.
Comment 9 Vasily Pupkin 2023-07-23 15:23:29 UTC
I commented out that part, and looks like nothing changed. 
I addedd message() to CMakeLists to show actual IF/ELSE branch, as in cache it's DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION:INTERNAL=no while actual branch is for DISABLE_WAYLAND_INTEGRATION=ON

I also added messages to show values which are used to take that expression:
LINUX=1                            
qt_version_6_5_or_greater=0
QT_VERSION_MAJOR=6
QT_VERSION_MINOR=


Regarding /usr/lib64/cmake/Qt6/Qt6Config.cmake I'm not sure I do have good understanding what is going on there. There is branch 

if (NOT QT_NO_CREATE_TARGETS)
    include("${CMAKE_CURRENT_LIST_DIR}/Qt6Targets.cmake")
    if(NOT QT_NO_CREATE_VERSIONLESS_TARGETS)
        include("${CMAKE_CURRENT_LIST_DIR}/Qt6VersionlessTargets.cmake")
    endif()
else()
    # For examples using `find_package(...)` inside their CMakeLists.txt files:
    # Make CMake's AUTOGEN detect this Qt version properly
    set_directory_properties(PROPERTIES
                             QT_VERSION_MAJOR 6
                             QT_VERSION_MINOR 5
                             QT_VERSION_PATCH 2)
endif()


However I'm not sure how it works.
Comment 10 Vasily Pupkin 2023-07-23 15:24:10 UTC
Created attachment 866013 [details]
CMakeCache
Comment 11 Vasily Pupkin 2023-07-23 15:25:23 UTC
Created attachment 866014 [details]
CMakeCache.txt
Comment 12 Esteve Varela Colominas 2023-07-23 17:15:44 UTC
This might be a dev-qt/qtbase bug then? Not sure how to further this.
Comment 13 Leonardo Hernández Hernández 2023-10-08 21:38:00 UTC
FWIW, telegram-desktop-4.10.3 allows you to disable CSD Settings->Advanced->Window title bar->Use Qt window frame

I am using qt 6.5.3 if that matters
Comment 14 Esteve Varela Colominas 2023-10-08 22:06:44 UTC
Does that work in wayland now? If that's the case then I can close this issue when that version stabilizes. Thanks for pointing it out!
Comment 15 Leonardo Hernández Hernández 2023-10-08 22:25:21 UTC
(In reply to Esteve Varela Colominas from comment #14)
> Does that work in wayland now? If that's the case then I can close this
> issue when that version stabilizes. Thanks for pointing it out!

Yeah, it's a wayland-only build of telegram. You're welcome, btw please CC me  in wayland-related bugs.
Comment 16 Vasily Pupkin 2023-10-09 05:13:13 UTC
Looks fine
Comment 17 Joe Kappus 2023-10-10 21:59:11 UTC
> FWIW, telegram-desktop-4.10.3 allows you to disable CSD Settings->Advanced->Window title bar->Use Qt window frame

It's weird that checking this box makes CSD go away for me. But I can confirm it does in 4.10.3.
Comment 18 Larry the Git Cow gentoo-dev 2023-12-11 13:25:49 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7497d83f469b739fcc81775878c5e59c2000e5c8

commit 7497d83f469b739fcc81775878c5e59c2000e5c8
Author:     Esteve Varela Colominas <esteve.varela@gmail.com>
AuthorDate: 2023-12-10 22:30:20 +0000
Commit:     Yixun Lan <dlan@gentoo.org>
CommitDate: 2023-12-11 13:23:32 +0000

    net-im/telegram-desktop: Drop stable
    
    The list of bugs has become untenable, the package is essentially
    unusable, and there's no clear idea of when glibmm will be bumped.
    
    Sorry for the inconveniences...
    
    Bug: https://bugs.gentoo.org/915992
    Closes: https://bugs.gentoo.org/877067
    Closes: https://bugs.gentoo.org/910544
    Closes: https://bugs.gentoo.org/911395
    Closes: https://bugs.gentoo.org/912896
    Closes: https://bugs.gentoo.org/914419
    Closes: https://bugs.gentoo.org/914902
    Closes: https://bugs.gentoo.org/915109
    Closes: https://bugs.gentoo.org/915237
    Closes: https://bugs.gentoo.org/915982
    Signed-off-by: Esteve Varela Colominas <esteve.varela@gmail.com>
    Signed-off-by: Yixun Lan <dlan@gentoo.org>

 net-im/telegram-desktop/Manifest                   |   1 -
 .../files/tdesktop-4.4.1-fix-dupe-main-decl.patch  |  26 ---
 .../telegram-desktop-4.8.1-r3.ebuild               | 210 ---------------------
 3 files changed, 237 deletions(-)