Bug 379279

Summary: NetworkManager "Ask For Password" Popup Focus
Product: [Plasma] plasma-nm Reporter: Nick Cross <kde>
Component: generalAssignee: Jan Grulich <jgrulich>
Status: RESOLVED FIXED    
Severity: normal CC: jgrulich, lamarque, mgraesslin, rcorreia31
Priority: NOR    
Version: 5.9.4   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.9.6
Sentry Crash Report:

Description Nick Cross 2017-04-27 08:33:07 UTC
When I click on my configured OpenVPN connection in NetworkManager it pops up a dialog to enter the password ( as I have "Ask For Password Every Time" configured ; however it doesn't get focus.

I am running Plasma 5.9.4 on Fedora 25.

p.s. not sure of the correct component re focusing versus networkmanager ; apologies if this is the wrong one.
Comment 1 Martin Flöser 2017-04-27 14:45:26 UTC
The dialog which opens need to have proper hints and timestamps to ensure that KWin grants focus.
Comment 2 Nick Cross 2017-04-27 15:20:15 UTC
I ran xwininfo on the popup and got:

xwininfo: Please select the window about which you
          would like information by clicking the
          mouse in that window.

xwininfo: Window id: 0x800019 "VPN secrets (openvpn) — KDE Daemon"

  Root window id: 0xd7 (the root window) (has no name)
  Parent window id: 0x26ad73f (has no name)
     0 children.

  Absolute upper-left X:  2523
  Absolute upper-left Y:  434
  Relative upper-left X:  0
  Relative upper-left Y:  0
  Width: 214
  Height: 102
  Depth: 24
  Visual: 0xb4
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x800018 (not installed)
  Bit Gravity State: NorthWestGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +2523+434  -863+434  -863-544  +2523-544
  -geometry 214x102+2523+434

  Bit gravity: NorthWestGravity
  Window gravity: NorthWestGravity
  Backing-store hint: NotUseful
  Backing-planes to be preserved: 0xffffffff
  Backing pixel: 0
  Save-unders: No

  Someone wants these events:
      KeyPress
      KeyRelease
      ButtonPress
      ButtonRelease
      EnterWindow
      LeaveWindow
      PointerMotion
      ButtonMotion
      Exposure
      StructureNotify
      FocusChange
      PropertyChange
      ColormapChange
  Do not propagate these events:
  Override redirection?: No

  Window manager hints:
      Client accepts input or input focus: Yes
      Initial state is Normal State
      Displayed on desktop 0
      Window type:
          Dialog
          Normal
      Window state:
          Above
          Stays On Top
      Process id: 1877
      Frame extents: 4, 4, 29, 4

  Normal window size hints:
      User supplied location: 2523, 434
      User supplied size: 214 by 102
      Program supplied minimum size: 194 by 102
      Program supplied window gravity: StaticGravity
  No zoom window size hints defined

  No window shape defined
  No border shape defined
Comment 3 Nick Cross 2017-04-27 15:27:00 UTC
Running kdialog -password foo (which does pop up a window with the correct focus) gives xwininfo of

xwininfo: Please select the window about which you
          would like information by clicking the
          mouse in that window.

xwininfo: Window id: 0x5200012 "KDialog"

  Root window id: 0xd7 (the root window) (has no name)
  Parent window id: 0x26af28f (has no name)
     0 children.

  Absolute upper-left X:  2430
  Absolute upper-left Y:  439
  Relative upper-left X:  0
  Relative upper-left Y:  0
  Width: 420
  Height: 196
  Depth: 24
  Visual: 0x20
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x22 (installed)
  Bit Gravity State: NorthWestGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +2430+439  -750+439  -750-445  +2430-445
  -geometry 420x196+2426+410

  Bit gravity: NorthWestGravity
  Window gravity: NorthWestGravity
  Backing-store hint: NotUseful
  Backing-planes to be preserved: 0xffffffff
  Backing pixel: 0
  Save-unders: No

  Someone wants these events:
      KeyPress
      KeyRelease
      ButtonPress
      ButtonRelease
      EnterWindow
      LeaveWindow
      PointerMotion
      ButtonMotion
      KeymapState
      Exposure
      StructureNotify
      FocusChange
      PropertyChange
      ColormapChange
  Do not propagate these events:
  Override redirection?: No

  Window manager hints:
      Client accepts input or input focus: Yes
      Initial state is Normal State
      Displayed on desktop 0
      Window type:
          Dialog
          Normal
      Window state:
          Modal
      Process id: 9831 on host atlantis
      Frame extents: 4, 4, 29, 4

  Normal window size hints:
      Program supplied minimum size: 420 by 196
      Program supplied window gravity: NorthWestGravity
  No zoom window size hints defined

  No window shape defined
  No border shape defined




The only difference appears to be in the window state?
Comment 4 Lamarque V. Souza 2017-04-29 15:52:33 UTC
Can you test this patch https://git.reviewboard.kde.org/r/130109/ and check if it works for you?
Comment 5 Nick Cross 2017-04-29 17:50:57 UTC
Am I right in thinking I would need to recompile https://github.com/KDE/plasma-nm/tree/v5.9.4 ?
Comment 6 Lamarque V. Souza 2017-04-29 20:43:44 UTC
Yes, recompiling that plasma-nm is enough to test the patch.
Comment 7 Nick Cross 2017-05-03 08:10:10 UTC
Ok after checking out that code and installing an awful lot of build dependencies :-) I first tried without the diff (to see if the Fedora build was doing something strange) but could still reproduce the problem. I have just now tried with the diff and it seems to be working! Thanks.
Comment 8 Nick Cross 2017-05-03 08:42:53 UTC
Could this patch be applied to the 5.9.x series? I can enter an issue into Fedora upstream.
Comment 9 Jan Grulich 2017-05-03 08:46:46 UTC
I can backport that patch to Fedora, I just wasn't able to verify that it fixes this problem, let me test it again.
Comment 10 Lamarque V. Souza 2017-05-04 12:39:51 UTC
Git commit 2c6b059626dedd1ae82fb06f0d6f8737dae8e5b5 by Lamarque V. Souza.
Committed on 04/05/2017 at 12:36.
Pushed by lvsouza into branch 'master'.

Workaround to fix PasswordDialog's focus.

REVIEW: 130109
FIXED-IN: 5.9.6

M  +7    -1    kded/passworddialog.cpp

https://commits.kde.org/plasma-nm/2c6b059626dedd1ae82fb06f0d6f8737dae8e5b5
Comment 11 Jan Grulich 2017-09-11 13:00:11 UTC
*** Bug 381148 has been marked as a duplicate of this bug. ***