<?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>482058</bug_id>
          
          <creation_ts>2024-02-29 16:31:56 +0000</creation_ts>
          <short_desc>Keyboard Layout widget steals focus</short_desc>
          <delta_ts>2024-03-19 18:50:51 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Plasma</classification>
          <product>plasmashell</product>
          <component>Keyboard Layout widget</component>
          <version>6.0.0</version>
          <rep_platform>Arch Linux</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>479084</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>qt6</keywords>
          <priority>NOR</priority>
          <bug_severity>minor</bug_severity>
          <target_milestone>1.0</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Hanabishi">i.r.e.c.c.a.k.u.n+bugs.kde.org</reporter>
          <assigned_to name="Plasma Bugs List">plasma-bugs-null</assigned_to>
          <cc>butirsky</cc>
    
    <cc>monkeber</cc>
    
    <cc>nate</cc>
    
    <cc>nicolas.fella</cc>
    
    <cc>notmart</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>2292920</commentid>
    <comment_count>0</comment_count>
      <attachid>166205</attachid>
    <who name="Hanabishi">i.r.e.c.c.a.k.u.n+bugs.kde.org</who>
    <bug_when>2024-02-29 16:31:56 +0000</bug_when>
    <thetext>Created attachment 166205
keyboardlayout-focus.patch

SUMMARY
When Keyboard Layout widget is on the panel, it steals focus from the current app on layout change. Both by hotkey or mouse click.

STEPS TO REPRODUCE
1. Add &quot;Keyboard Layout&quot; widget on the panel.
2. Focus a text field in any app.
3. Switch layout.

OBSERVED RESULT
Widget (panel) steals focus from the app.

EXPECTED RESULT
Focues should remain in the current app / text field.

SOFTWARE/OS VERSIONS
Linux: Arch Linux
KDE Plasma Version: 6.0.0
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2

ADDITIONAL INFORMATION
I actually managed to workaround it by editing &apos;main.qml&apos; file of the applet. Removing &apos;onLayoutChanged&apos; function fixes the issue. The patch is attached.
I don&apos;t know why this function exists and why such widget ever need to &quot;activate&quot; itself on layout change, but for me it works just fine without it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2292932</commentid>
    <comment_count>1</comment_count>
    <who name="Andrey">butirsky</who>
    <bug_when>2024-02-29 17:01:55 +0000</bug_when>
    <thetext>Thanks, is it regression since Plasma 5?

About the onLayoutChanged(), it&apos;s used for &quot;push in&quot; effect for the applet to make the layout change more noticeable.
Either way, we need to find out if it&apos;s a regression or not.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2292938</commentid>
    <comment_count>2</comment_count>
    <who name="Hanabishi">i.r.e.c.c.a.k.u.n+bugs.kde.org</who>
    <bug_when>2024-02-29 17:09:29 +0000</bug_when>
    <thetext>(In reply to Andrey from comment #1)
&gt; Thanks, is it regression since Plasma 5?

Yeah, it was fine in Plasma 5. So it is kind of a regression.

Although, as I see from the commit history, the function was there for years. So it is not a direct regression in the applet.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2292944</commentid>
    <comment_count>3</comment_count>
    <who name="Andrey">butirsky</who>
    <bug_when>2024-02-29 17:18:52 +0000</bug_when>
    <thetext>OK, so it&apos;s more fundamental problem then which can explode in many places.
Not sure if it&apos;s KWin or some Qt/Framework guilty.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2292951</commentid>
    <comment_count>4</comment_count>
    <who name="Andrey">butirsky</who>
    <bug_when>2024-02-29 17:27:37 +0000</bug_when>
    <thetext>I recall someone reported about OSD steal focus, it might be the same problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2292971</commentid>
    <comment_count>5</comment_count>
    <who name="Hanabishi">i.r.e.c.c.a.k.u.n+bugs.kde.org</who>
    <bug_when>2024-02-29 17:39:27 +0000</bug_when>
    <thetext>I also suspected OSD initially, but disabling it changed nothing. And focus visibly appears on the panel, so I narrowed it down to the applet itself.
Btw, the problem only appears on a standalone widget. It does not do that as a System Tray built-in.

Forgot to mention, I reproduce it in Wayland session, not tested in X.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2292972</commentid>
    <comment_count>6</comment_count>
    <who name="Andrey">butirsky</who>
    <bug_when>2024-02-29 17:43:17 +0000</bug_when>
    <thetext>Could you check if volume OSD produces the same effect?
Maybe test with standalone widget too, if possible.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2292985</commentid>
    <comment_count>7</comment_count>
    <who name="Hanabishi">i.r.e.c.c.a.k.u.n+bugs.kde.org</who>
    <bug_when>2024-02-29 17:58:44 +0000</bug_when>
    <thetext>I don&apos;t see any issues with the volume widget or volume OSD.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2293641</commentid>
    <comment_count>8</comment_count>
    <who name="Nate Graham">nate</who>
    <bug_when>2024-03-01 20:41:42 +0000</bug_when>
    <thetext>Can trivially reproduce the issue. It&apos;s a regression in Plasma 6 caused by Panel focus changes. I suspect it&apos;ll end being a similar issue to Bug 479084.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2295896</commentid>
    <comment_count>9</comment_count>
    <who name="Yehor">monkeber</who>
    <bug_when>2024-03-06 23:02:53 +0000</bug_when>
    <thetext>Can confirm this issue, I tried to disable OSD but it still happens. The attached patch with removing onLayoutChanged did help in resolving it. 

Although Wayland and X11 seem to behave differently with this function present. On Wayland I clearly see that focus gets taken away on layout switch, but on X11 everything works fine at first but after some time I can&apos;t focus in any window anymore and focus disappears right after I click on a window, maybe it happens after I switch layout several times or open several windows at once, couldn&apos;t pinpoint the exact moment.

SOFTWARE/OS VERSIONS
Linux: Endeavour OS
KDE Plasma Version: 6.0.1
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel: 6.7.8-arch1-1 (64-bit)
Graphics Platform: Wayland and X11</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2297521</commentid>
    <comment_count>10</comment_count>
    <who name="Nate Graham">nate</who>
    <bug_when>2024-03-08 22:46:55 +0000</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 482653 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2297609</commentid>
    <comment_count>11</comment_count>
    <who name="Hanabishi">i.r.e.c.c.a.k.u.n+bugs.kde.org</who>
    <bug_when>2024-03-09 02:04:32 +0000</bug_when>
    <thetext>Why closed as duplicate? This report was created way earlier. Shouldn&apos;t it be vice versa?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2298087</commentid>
    <comment_count>12</comment_count>
    <who name="Nate Graham">nate</who>
    <bug_when>2024-03-10 03:03:28 +0000</bug_when>
    <thetext>Probably should be, yeah, but what&apos;s done is done, sorry.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2303114</commentid>
    <comment_count>13</comment_count>
    <who name="Nate Graham">nate</who>
    <bug_when>2024-03-19 18:50:51 +0000</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 479084 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>166205</attachid>
            <date>2024-02-29 16:31:56 +0000</date>
            <delta_ts>2024-02-29 16:31:56 +0000</delta_ts>
            <desc>keyboardlayout-focus.patch</desc>
            <filename>keyboardlayout-focus.patch</filename>
            <type>text/plain</type>
            <size>473</size>
            <attacher name="Hanabishi">i.r.e.c.c.a.k.u.n+bugs.kde.org</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL2FwcGxldHMva2V5Ym9hcmRsYXlvdXQvY29udGVudHMvdWkvbWFpbi5xbWwg
Yi9hcHBsZXRzL2tleWJvYXJkbGF5b3V0L2NvbnRlbnRzL3VpL21haW4ucW1sCmluZGV4IDQ0ZTc2
ZWEuLmVkYTBjZWYgMTAwNjQ0Ci0tLSBhL2FwcGxldHMva2V5Ym9hcmRsYXlvdXQvY29udGVudHMv
dWkvbWFpbi5xbWwKKysrIGIvYXBwbGV0cy9rZXlib2FyZGxheW91dC9jb250ZW50cy91aS9tYWlu
LnFtbApAQCAtNTQsOSArNTQsNiBAQCBQbGFzbW9pZEl0ZW0gewogICAgICAgICBDb25uZWN0aW9u
cyB7CiAgICAgICAgICAgICB0YXJnZXQ6IHN3aXRjaGVyLmtleWJvYXJkTGF5b3V0CiAKLSAgICAg
ICAgICAgIGZ1bmN0aW9uIG9uTGF5b3V0Q2hhbmdlZCgpIHsKLSAgICAgICAgICAgICAgICByb290
LlBsYXNtb2lkLmFjdGl2YXRlZCgpOwotICAgICAgICAgICAgfQogICAgICAgICB9CiAKICAgICAg
ICAgQ29ubmVjdGlvbnMgewo=
</data>

          </attachment>
      

    </bug>

</bugzilla>