<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>462574</bug_id>
          
          <creation_ts>2022-12-03 08:43:11 +0000</creation_ts>
          <short_desc>On Wayland, window&apos;s doesn&apos;t become active when calling QWidget::activateWindow and QWidget::raise</short_desc>
          <delta_ts>2022-12-04 16:16:15 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Plasma</classification>
          <product>kwin</product>
          <component>wayland-generic</component>
          <version>5.26.3</version>
          <rep_platform>Debian testing</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>UPSTREAM</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Michael Weghorn">m.weghorn</reporter>
          <assigned_to name="KWin default assignee">kwin-bugs-null</assigned_to>
          <cc>m.weghorn</cc>
    
    <cc>nicolas.fella</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2180781</commentid>
    <comment_count>0</comment_count>
      <attachid>154260</attachid>
    <who name="Michael Weghorn">m.weghorn</who>
    <bug_when>2022-12-03 08:43:11 +0000</bug_when>
    <thetext>Created attachment 154260
Sample app to reproduce

SUMMARY

On X11, raising a window can be done by calling QWidget::activateWindow and QWidget::raise. However, that does not have the desired effect in a Plasma Wayland session.

STEPS TO REPRODUCE

0. run a KDE Plasma Wayland session
1. compile attached sample program against Qt 6
2. run sample program
3. click the &quot;raise other window button&quot; in window &quot;two&quot;

OBSERVED RESULT

The window &quot;one&quot; is highlighted in the taskbar, but does not become the active window instead of window &quot;two&quot;

EXPECTED RESULT

Window &quot;one&quot; should become the active window, as is the case when run on X11.

SOFTWARE/OS VERSIONS
Debian testing with Qt 6.3.1

Linux/KDE Plasma: 
Operating System: Debian GNU/Linux
KDE Plasma Version: 5.26.3
KDE Frameworks Version: 5.100.0
Qt Version: 5.15.6
Kernel Version: 6.0.0-5-amd64 (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i5-5300U CPU @ 2.30GHz
Memory: 15.3 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 5500
Manufacturer: LENOVO
Product Name: 20CJS11C00
System Version: ThinkPad T550

ADDITIONAL INFORMATION

It works as expected when run with QT_QPA_PLATFORM=xcb, i.e. forcing use of Qt&apos;s xcb platform plugin.

For Qt 5, this is not expected to work since QWindow::requestActivate isn&apos;t handled there on Qt side and I don&apos;t know whether the underlying problem(s) is in Qt or KWin or elsewhere.
This issue was originally reported against LibreOffice, https://bugs.documentfoundation.org/show_bug.cgi?id=152205#c7 contains some more information on 2 scenarios that fail in different ways and might haver different root causes. (A LibreOffice scenario with gtk3 integration works on GNOME, but not KDE Plasma. The sample Qt app doesn&apos;t work in any of them, so there might be different issues.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2181237</commentid>
    <comment_count>1</comment_count>
    <who name="Nicolas Fella">nicolas.fella</who>
    <bug_when>2022-12-04 16:16:15 +0000</bug_when>
    <thetext>In general for QWindow::requestActivate to work an activation token needs to be set. It can&apos;t just work in all cases.

For the case where a window activates another window of the same app Qt can do that automatically since https://codereview.qt-project.org/c/qt/qtwayland/+/418094. That was added after Qt 6.3.1 though</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>154260</attachid>
            <date>2022-12-03 08:43:11 +0000</date>
            <delta_ts>2022-12-03 08:43:11 +0000</delta_ts>
            <desc>Sample app to reproduce</desc>
            <filename>main.cpp</filename>
            <type>text/x-c++src</type>
            <size>726</size>
            <attacher name="Michael Weghorn">m.weghorn</attacher>
            
              <data encoding="base64">I2luY2x1ZGUgPFFBcHBsaWNhdGlvbj4KI2luY2x1ZGUgPFFQdXNoQnV0dG9uPgojaW5jbHVkZSA8
UU1haW5XaW5kb3c+CgpjbGFzcyBNeUJ1dHRvbiA6IHB1YmxpYyBRUHVzaEJ1dHRvbgp7CnB1Ymxp
YzoKICAgIE15QnV0dG9uKFFNYWluV2luZG93KiB3aW4sIFFXaWRnZXQqIHBhcmVudCkKICAgICAg
ICA6UVB1c2hCdXR0b24ocGFyZW50KSwKICAgICAgICB3aW5kb3cod2luKQogICAgewogICAgICAg
IGNvbm5lY3QodGhpcywgJk15QnV0dG9uOjpwcmVzc2VkLCB0aGlzLCAmTXlCdXR0b246OnJhaXNl
V2luZG93KTsKICAgIH0KCiAgICB2b2lkIHJhaXNlV2luZG93KCkgewogICAgICAgIHdpbmRvdy0+
YWN0aXZhdGVXaW5kb3coKTsKICAgICAgICB3aW5kb3ctPnJhaXNlKCk7CiAgICB9Cgpwcml2YXRl
OgogICAgUU1haW5XaW5kb3cqIHdpbmRvdzsKfTsKCgppbnQgbWFpbihpbnQgYXJnYywgY2hhciAq
YXJndltdKQp7CiAgICBRQXBwbGljYXRpb24gYShhcmdjLCBhcmd2KTsKICAgIFFNYWluV2luZG93
IHc7CiAgICB3LnNldFdpbmRvd1RpdGxlKCJvbmUiKTsKICAgIHcuc2hvdygpOwoKICAgIFFNYWlu
V2luZG93IHcyKCZ3KTsKICAgIHcyLnNldFdpbmRvd1RpdGxlKCJ0d28iKTsKICAgIE15QnV0dG9u
IGJ1dHRvbigmdywgJncyKTsKICAgIGJ1dHRvbi5zZXRUZXh0KCJSYWlzZSBvdGhlciB3aW5kb3ci
KTsKICAgIHcyLnNob3coKTsKCiAgICByZXR1cm4gYS5leGVjKCk7Cn0K
</data>

          </attachment>
      

    </bug>

</bugzilla>