<?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>505202</bug_id>
          
          <creation_ts>2025-06-04 11:34:36 +0000</creation_ts>
          <short_desc>Cannot screenshot Wine windows with Spectacle&apos;s &quot;Active Window&quot; mode</short_desc>
          <delta_ts>2025-11-23 14:47:00 +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>general</component>
          <version>6.3.5</version>
          <rep_platform>Other</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jared Adams">jaxad0127</reporter>
          <assigned_to name="KWin default assignee">kwin-bugs-null</assigned_to>
          <cc>4wy78uwh</cc>
    
    <cc>kde</cc>
    
    <cc>kdedev</cc>
    
    <cc>nate</cc>
    
    <cc>serdarthtux</cc>
    
    <cc>xaver.hugl</cc>
          
          <cf_commitlink>https://invent.kde.org/plasma/kwin/-/commit/7ddb462c1aa1f73b468d59cd9b131b43882c1b22</cf_commitlink>
          <cf_versionfixedin>6.5.3</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2430207</commentid>
    <comment_count>0</comment_count>
    <who name="Jared Adams">jaxad0127</who>
    <bug_when>2025-06-04 11:34:36 +0000</bug_when>
    <thetext>SUMMARY
Attempting to capture Active Window for Wine fails.

STEPS TO REPRODUCE
1. Open a Wine application (winecfg will trigger the bug)
2. Open Spectacle
3. Try to use Active Window option on Wine window
4. Failure

OBSERVED RESULT
An error occurred while taking a screenshot.
KWin screenshot request failed:
Invalid window requested
Potentially relevant information:
- Method: CaptureActiveWindow
- Method specific arguments: QMap((&quot;include-decoration&quot;, QVariant(bool, true))(&quot;include-shadow&quot;, QVariant(bool, true))(&quot;native-resolution&quot;, QVariant(bool, true)))

EXPECTED RESULT
Successful capture.

SOFTWARE/OS VERSIONS
Operating System: CachyOS Linux 
KDE Plasma Version: 6.3.5
KDE Frameworks Version: 6.14.0
Qt Version: 6.9.0
Kernel Version: 6.15.0-2-cachyos (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION
Original Reddit post: https://www.reddit.com/r/kde/comments/1l2w6m1/unable_to_screenshot_wine_windows_in_spectacle/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2430357</commentid>
    <comment_count>1</comment_count>
    <who name="TraceyC">kdedev</who>
    <bug_when>2025-06-04 18:34:28 +0000</bug_when>
    <thetext>I&apos;m not able to reproduce this on git-master Solus, Neon Testing or Fedora 42 in a Wayland session

Can you check something? In System Settings -&gt; Window Behavior - on the Focus tab, what setting do you have for &quot;Window activation policy&quot;?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2430404</commentid>
    <comment_count>2</comment_count>
    <who name="Jared Adams">jaxad0127</who>
    <bug_when>2025-06-04 20:13:13 +0000</bug_when>
    <thetext>I am using Focus follows mouse (mouse precedence). Playing around with them:
- Click to focus works fine for all windows
- Focus follows mouse works for most, fails Wine
- Focus under mouse fails all
- Focus strictly under mouse fails all
(mouse precedence doesn&apos;t change anything)

A 1 second delay doesn&apos;t have the problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2431463</commentid>
    <comment_count>3</comment_count>
    <who name="TraceyC">kdedev</who>
    <bug_when>2025-06-09 20:23:15 +0000</bug_when>
    <thetext>Thanks for the details. I&apos;m able to reproduce this on git-master using the settings that triggered the bug for you:

- Focus under mouse
- Zero second delay

I&apos;ll let the KWin developers take it from here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2468519</commentid>
    <comment_count>4</comment_count>
    <who name="Zamundaaa">xaver.hugl</who>
    <bug_when>2025-11-06 22:46:49 +0000</bug_when>
    <thetext>I looked at the problem, and the issue is that X11 focus stuff is stupid. When the Spectacle window goes away, KWin sends a message to Wine that it should get focus, and then Wine will eventually respond that it actually takes focus. Until it does, the active window is nullptr.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2468522</commentid>
    <comment_count>5</comment_count>
    <who name="Bug Janitor Service">bug-janitor</who>
    <bug_when>2025-11-06 22:55:05 +0000</bug_when>
    <thetext>A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/8381</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2470947</commentid>
    <comment_count>6</comment_count>
    <who name="Zamundaaa">xaver.hugl</who>
    <bug_when>2025-11-17 17:52:46 +0000</bug_when>
    <thetext>Git commit bc6deccf95e3d64cfc84953335767b28d94cdd4d by Xaver Hugl.
Committed on 17/11/2025 at 17:31.
Pushed by zamundaaa into branch &apos;master&apos;.

plugins/screenshot: also take pending focus requests into account

When selecting &quot;active window&quot; in Spectacle, Spectacle closes its window and
the active window gets switched to the next window. If that next window is an
X11 window, it doesn&apos;t become the active window immediately though, it takes
until the application responds for that to happen.

To still make the screenshot work, use mostRecentlyActivatedWindow instead.

M  +1    -1    src/plugins/screenshot/screenshotdbusinterface2.cpp

https://invent.kde.org/plasma/kwin/-/commit/bc6deccf95e3d64cfc84953335767b28d94cdd4d</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2471004</commentid>
    <comment_count>7</comment_count>
    <who name="Zamundaaa">xaver.hugl</who>
    <bug_when>2025-11-17 20:32:06 +0000</bug_when>
    <thetext>Git commit 7ddb462c1aa1f73b468d59cd9b131b43882c1b22 by Xaver Hugl.
Committed on 17/11/2025 at 20:11.
Pushed by zamundaaa into branch &apos;Plasma/6.5&apos;.

plugins/screenshot: also take pending focus requests into account

When selecting &quot;active window&quot; in Spectacle, Spectacle closes its window and
the active window gets switched to the next window. If that next window is an
X11 window, it doesn&apos;t become the active window immediately though, it takes
until the application responds for that to happen.

To still make the screenshot work, use mostRecentlyActivatedWindow instead.


(cherry picked from commit bc6deccf95e3d64cfc84953335767b28d94cdd4d)

Co-authored-by: Xaver Hugl &lt;xaver.hugl@kde.org&gt;

M  +1    -1    src/plugins/screenshot/screenshotdbusinterface2.cpp

https://invent.kde.org/plasma/kwin/-/commit/7ddb462c1aa1f73b468d59cd9b131b43882c1b22</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>