Bug 360841 - Unable to unshow/unpresent windows using the same keyboard shortcut
Summary: Unable to unshow/unpresent windows using the same keyboard shortcut
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: effects-present-windows (show other bugs)
Version: 5.7.3
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL: https://phabricator.kde.org/D6258
Keywords:
: 373202 373306 373354 373758 380902 381021 381205 381278 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-03-22 09:15 UTC by Mateusz
Modified: 2017-06-20 08:48 UTC (History)
19 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.10.3
mgraesslin: Wayland-
mgraesslin: X11+
mgraesslin: ReviewRequest+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mateusz 2016-03-22 09:15:33 UTC
When I 
use keyboard shortcut(either custom or default) to 'Show Desktop Grid' 
or 'Present Windows' I am unable to unshow/unpresent them the same way, 
which is using keyboard shortcut.
Grid is shown and Windows are presented, but no matter how many times I 
press keys nothing happens. It feels like shortcuts are disconnected 
when action is triggered.
I am able to go back to whatever I was doing by simply clicking mouse 
anywhere.

Reproducible: Sometimes

Steps to Reproduce:
1. Toggle Show Desktop Grid or Present Windows
2. Enjoy shown desktop grid or presented windows
3. Toggle again to hide grid or windows
4. Nothing happens

Actual Results:  
Grid is shown, windows are presented.

Expected Results:  
Toggling action 'Show Desktop Grid' or 'Present Windows' should 'unshown' or 'unpresent' them when toggled second time.

Kubuntu 15.10
KDE Plasma Version 5.5.4
Qt Version 5.5.1
Kernel Version 4.2.0-34-generic
Os Type: 64-bit
Laptop model: Dell Latitude E6420, i5-2520M
Comment 1 Martin Flöser 2016-03-24 08:46:31 UTC
when in present windows: can you type to filter?
Comment 2 Mateusz 2016-04-11 10:22:54 UTC
 Martin Gräßlin
No, I am unable to do that.
Comment 3 Martin Flöser 2016-04-11 13:53:00 UTC
That's as I expected. The keyboard grab seems to fail, that's why neither the shortcut nor the filter works.

Please activate the effect, switch to a virtual terminal, log in and run:
export DISPLAY=:0
xdotool key "XF86LogGrabInfo"

switch back to the graphical environment, and look into /var/log/Xorg.0.log - it should contain information about which process has a keyboard grab.
Comment 4 Mateusz 2016-04-11 14:06:38 UTC
Thanks.
According to
[    13.208] (**) AlpsPS/2 ALPS DualPoint TouchPad: (accel) acceleration profile 1
[    13.208] (**) AlpsPS/2 ALPS DualPoint TouchPad: (accel) acceleration factor: 2.000
[    13.208] (**) AlpsPS/2 ALPS DualPoint TouchPad: (accel) acceleration threshold: 4
[    13.208] (--) synaptics: AlpsPS/2 ALPS DualPoint TouchPad: touchpad found
[    13.208] (II) config/udev: Adding input device AlpsPS/2 ALPS DualPoint TouchPad (/dev/input/mouse2)
[    13.208] (**) AlpsPS/2 ALPS DualPoint TouchPad: Ignoring device from InputClass "touchpad ignore duplicates"
[    13.210] (II) config/udev: Adding input device Dell WMI hotkeys (/dev/input/event10)
[    13.210] (**) Dell WMI hotkeys: Applying InputClass "evdev keyboard catchall"
[    13.210] (II) Using input driver 'evdev' for 'Dell WMI hotkeys'
[    13.210] (**) Dell WMI hotkeys: always reports core events
[    13.210] (**) evdev: Dell WMI hotkeys: Device: "/dev/input/event10"
[    13.210] (--) evdev: Dell WMI hotkeys: Vendor 0 Product 0
[    13.210] (--) evdev: Dell WMI hotkeys: Found keys
[    13.210] (II) evdev: Dell WMI hotkeys: Configuring as keyboard
[    13.210] (**) Option "config_info" "udev:/sys/devices/virtual/input/input11/event10"
[    13.210] (II) XINPUT: Adding extended input device "Dell WMI hotkeys" (type: KEYBOARD, id 15)
[    13.210] (**) Option "xkb_rules" "evdev"
[    13.210] (**) Option "xkb_model" "pc105"
[    13.210] (**) Option "xkb_layout" "pl"
[    13.713] (II) XKB: reuse xkmfile /var/lib/xkb/server-7C75F152E85183199599C3E0B919739C0EE668AA.xkm
[    15.073] (II) intel(0): EDID vendor "CMO", prod id 5220
[    15.073] (II) intel(0): Printing DDC gathered Modelines:
[    15.073] (II) intel(0): Modeline "1366x768"x0.0   71.00  1366 1414 1446 1498  768 769 773 790 +hsync -vsync (47.4 kHz eP)
[    15.073] (II) intel(0): Modeline "1366x768"x0.0   47.91  1366 1418 1453 1512  768 769 773 792 +hsync -vsync (31.7 kHz e)
[  8255.550] (II) Printing all currently active device grabs:
[  8255.550] (II) End list of active device grabs
[  8372.349] (II) Printing all currently active device grabs:
[  8372.349] (II) End list of active device grabs
[  8476.936] (II) AIGLX: Suspending AIGLX clients for VT switch
[  8513.527] (II) Printing all currently active device grabs:
[  8513.527] Active grab 0x2400000 (core) on device 'Virtual core keyboard' (3):
[  8513.527]       client pid 1402 kwin_x11 
[  8513.527]       at 8474615 (from active grab) (device thawed, state 1)
[  8513.527]         core event mask 0x3
[  8513.527]       owner-events false, kb 1 ptr 1, confine 0, cursor 0x0
[  8513.527] (II) End list of active device grabs
[  8543.920] (II) AIGLX: Resuming AIGLX clients after VT switch
[  8543.920] (II) intel(0): switch to mode 1920x1080@60.0 on HDMI1 using pipe 1, position (0, 0), rotation normal, reflection none
[  8543.921] (EE) intel(0): sna_mode_check: invalid state found on pipe 0, disabling CRTC:21
[  8544.302] (--) synaptics: AlpsPS/2 ALPS DualPoint TouchPad: touchpad found


'Virtual core keyboard' has active grab.
Is there something I could do to make it work?
Comment 5 Martin Flöser 2016-04-11 14:24:44 UTC
> client pid 1402 kwin_x11

interesting, kwin has the keyboard grab. Given that it should work.
Comment 6 Thomas Lübking 2016-04-11 15:41:17 UTC
please run "sleep 20; qdbus org.kde.KWin /KWin supportInformation > kwin.support.info" and trigger the dysfunctional effect (DG or PW) within the next 20 seconds, wait until the timeout hit (so you'll have gotten the debug info), maybe ensure that the effect (notably filtering) really didn't work and then attach the gathered information.

KWin might hold the grab, but some other effect (or the tabbox???) could receive it.
Comment 7 Mateusz 2016-04-12 07:09:11 UTC
Here are the informations.

KWin Support Information:
The following information should be used when requesting support on e.g. http://forum.kde.org.
It provides information about the currently running instance, which options are used,
what OpenGL driver and which effects are running.
Please post the information provided underneath this introductory text to a paste bin service
like http://paste.kde.org instead of pasting into support threads.

==========================

Version
=======
KWin version: 5.5.4
Qt Version: 5.5.1
Qt compile version: 5.5.1
XCB compile version: 1.11

Operation Mode: X11 only

Build Options
=============
KWIN_BUILD_DECORATIONS: yes
KWIN_BUILD_TABBOX: yes
KWIN_BUILD_ACTIVITIES: yes
HAVE_INPUT: yes
HAVE_DRM: yes
HAVE_GBM: yes
HAVE_X11_XCB: yes
HAVE_EPOXY_GLX: yes
HAVE_WAYLAND_EGL: yes

X11
===
Vendor: The X.Org Foundation
Vendor Release: 11702000
Protocol Version/Revision: 11/0
SHAPE: yes; Version: 0x11
RANDR: yes; Version: 0x14
DAMAGE: yes; Version: 0x11
Composite: yes; Version: 0x4
RENDER: yes; Version: 0xb
XFIXES: yes; Version: 0x50
SYNC: yes; Version: 0x31
GLX: yes; Version: 0x0

Decoration
==========
Plugin: org.kde.breeze
Theme: 
Blur: 0
onAllDesktopsAvailable: true
alphaChannelSupported: true
closeOnDoubleClickOnMenu: false
decorationButtonsLeft: 0, 2
decorationButtonsRight: 6, 3, 4, 5
borderSize: 3
gridUnit: 10
font: Noto Sans,10,-1,0,50,0,0,0,0,0
smallSpacing: 2
largeSpacing: 10

Options
=======
focusPolicy: 0
nextFocusPrefersMouse: false
clickRaise: true
autoRaise: false
autoRaiseInterval: 0
delayFocusInterval: 0
shadeHover: false
shadeHoverInterval: 250
separateScreenFocus: false
placement: 4
focusPolicyIsReasonable: true
borderSnapZone: 10
windowSnapZone: 10
centerSnapZone: 0
snapOnlyWhenOverlapping: false
rollOverDesktops: true
focusStealingPreventionLevel: 1
legacyFullscreenSupport: false
operationTitlebarDblClick: 5000
operationMaxButtonLeftClick: 5000
operationMaxButtonMiddleClick: 5015
operationMaxButtonRightClick: 5014
commandActiveTitlebar1: 0
commandActiveTitlebar2: 30
commandActiveTitlebar3: 2
commandInactiveTitlebar1: 4
commandInactiveTitlebar2: 30
commandInactiveTitlebar3: 2
commandWindow1: 7
commandWindow2: 8
commandWindow3: 8
commandWindowWheel: 31
commandAll1: 10
commandAll2: 3
commandAll3: 14
keyCmdAllModKey: 16777251
showGeometryTip: false
condensedTitle: false
electricBorderMaximize: true
electricBorderTiling: true
electricBorderCornerRatio: 0.25
borderlessMaximizedWindows: false
killPingTimeout: 5000
hideUtilityWindowsForInactive: true
inactiveTabsSkipTaskbar: false
autogroupSimilarWindows: false
autogroupInForeground: true
compositingMode: 1
useCompositing: true
compositingInitialized: true
hiddenPreviews: 1
unredirectFullscreen: false
glSmoothScale: 2
colorCorrected: false
xrenderSmoothScale: false
maxFpsInterval: 16666666
refreshRate: 0
vBlankTime: 6000000
glStrictBinding: true
glStrictBindingFollowsDriver: true
glCoreProfile: true
glPreferBufferSwap: 101
glPlatformInterface: 1

Screen Edges
============
desktopSwitching: false
desktopSwitchingMovingClients: true
cursorPushBackDistance: 1x1
timeThreshold: 150
reActivateThreshold: 350
actionTopLeft: 0
actionTop: 0
actionTopRight: 0
actionRight: 0
actionBottomRight: 0
actionBottom: 0
actionBottomLeft: 0
actionLeft: 0

Screens
=======
Multi-Head: no
Active screen follows mouse:  no
Number of Screens: 1

Screen 0:
---------
Name: HDMI1
Geometry: 0,0,1920x1080
Refresh Rate: 60


Compositing
===========
Compositing is active
Compositing Type: OpenGL
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Sandybridge Mobile 
OpenGL version string: 3.3 (Core Profile) Mesa 11.0.2
OpenGL platform interface: GLX
OpenGL shading language version string: 3.30
Driver: Intel
GPU class: SandyBridge
OpenGL version: 3.3
GLSL version: 3.30
Mesa version: 11.0.2
X server version: 1.17.2
Linux kernel version: 4.2
Direct rendering: Requires strict binding: yes
GLSL shaders:  yes
Texture NPOT support:  yes
Virtual Machine:  no
OpenGL 2 Shaders are used
Painting blocks for vertical retrace:  no

Loaded Effects:
---------------
zoom
slidingpopups
kwin4_effect_login
slide
screenshot
minimizeanimation
kwin4_effect_windowaperture
kwin4_effect_translucency
desktopgrid
kwin4_effect_maximize
kwin4_effect_fade
presentwindows
kwin4_effect_dialogparent
highlightwindow
blur
contrast
logout
startupfeedback
screenedge
kscreen

Currently Active Effects:
-------------------------
blur
contrast

Effect Settings:
----------------
zoom:
zoomFactor: 1.2
mousePointer: 0
mouseTracking: 0
enableFocusTracking: false
followFocus: true
focusDelay: 350
moveFactor: 20
targetZoom: 1

slidingpopups:
fadeInTime: 150
fadeOutTime: 250

kwin4_effect_login:

slide:

screenshot:

minimizeanimation:

kwin4_effect_windowaperture:

kwin4_effect_translucency:

desktopgrid:
zoomDuration: 300
border: 10
desktopNameAlignment: 0
layoutMode: 0
customLayoutRows: 2
usePresentWindows: true

kwin4_effect_maximize:

kwin4_effect_fade:

presentwindows:
layoutMode: 0
showCaptions: true
showIcons: true
doNotCloseWindows: false
ignoreMinimized: false
accuracy: 20
fillGaps: true
fadeDuration: 150
showPanel: false
leftButtonWindow: 1
rightButtonWindow: 2
middleButtonWindow: 0
leftButtonDesktop: 2
middleButtonDesktop: 0
rightButtonDesktop: 0

kwin4_effect_dialogparent:

highlightwindow:

blur:
blurRadius: 12
cacheTexture: true

contrast:

logout:
useBlur: true

startupfeedback:
type: 1

screenedge:

kscreen:
Comment 8 Thomas Lübking 2016-04-12 07:18:24 UTC
> Currently Active Effects:
> -------------------------
> blur
> contrast

Sorry, but neither present windows nor the desktop grid is active at this time.

You're not  saying that "sleep 20" will get you some "error, sleep not found"? ;-)
Comment 9 Mateusz 2016-04-12 07:22:15 UTC
Sorry, I must have deactivated effect before time ran out;) Fortunately sleep was found;P

==========================

Version
=======
KWin version: 5.5.4
Qt Version: 5.5.1
Qt compile version: 5.5.1
XCB compile version: 1.11

Operation Mode: X11 only

Build Options
=============
KWIN_BUILD_DECORATIONS: yes
KWIN_BUILD_TABBOX: yes
KWIN_BUILD_ACTIVITIES: yes
HAVE_INPUT: yes
HAVE_DRM: yes
HAVE_GBM: yes
HAVE_X11_XCB: yes
HAVE_EPOXY_GLX: yes
HAVE_WAYLAND_EGL: yes

X11
===
Vendor: The X.Org Foundation
Vendor Release: 11702000
Protocol Version/Revision: 11/0
SHAPE: yes; Version: 0x11
RANDR: yes; Version: 0x14
DAMAGE: yes; Version: 0x11
Composite: yes; Version: 0x4
RENDER: yes; Version: 0xb
XFIXES: yes; Version: 0x50
SYNC: yes; Version: 0x31
GLX: yes; Version: 0x0

Decoration
==========
Plugin: org.kde.breeze
Theme: 
Blur: 0
onAllDesktopsAvailable: true
alphaChannelSupported: true
closeOnDoubleClickOnMenu: false
decorationButtonsLeft: 0, 2
decorationButtonsRight: 6, 3, 4, 5
borderSize: 3
gridUnit: 10
font: Noto Sans,10,-1,0,50,0,0,0,0,0
smallSpacing: 2
largeSpacing: 10

Options
=======
focusPolicy: 0
nextFocusPrefersMouse: false
clickRaise: true
autoRaise: false
autoRaiseInterval: 0
delayFocusInterval: 0
shadeHover: false
shadeHoverInterval: 250
separateScreenFocus: false
placement: 4
focusPolicyIsReasonable: true
borderSnapZone: 10
windowSnapZone: 10
centerSnapZone: 0
snapOnlyWhenOverlapping: false
rollOverDesktops: true
focusStealingPreventionLevel: 1
legacyFullscreenSupport: false
operationTitlebarDblClick: 5000
operationMaxButtonLeftClick: 5000
operationMaxButtonMiddleClick: 5015
operationMaxButtonRightClick: 5014
commandActiveTitlebar1: 0
commandActiveTitlebar2: 30
commandActiveTitlebar3: 2
commandInactiveTitlebar1: 4
commandInactiveTitlebar2: 30
commandInactiveTitlebar3: 2
commandWindow1: 7
commandWindow2: 8
commandWindow3: 8
commandWindowWheel: 31
commandAll1: 10
commandAll2: 3
commandAll3: 14
keyCmdAllModKey: 16777251
showGeometryTip: false
condensedTitle: false
electricBorderMaximize: true
electricBorderTiling: true
electricBorderCornerRatio: 0.25
borderlessMaximizedWindows: false
killPingTimeout: 5000
hideUtilityWindowsForInactive: true
inactiveTabsSkipTaskbar: false
autogroupSimilarWindows: false
autogroupInForeground: true
compositingMode: 1
useCompositing: true
compositingInitialized: true
hiddenPreviews: 1
unredirectFullscreen: false
glSmoothScale: 2
colorCorrected: false
xrenderSmoothScale: false
maxFpsInterval: 16666666
refreshRate: 0
vBlankTime: 6000000
glStrictBinding: true
glStrictBindingFollowsDriver: true
glCoreProfile: true
glPreferBufferSwap: 101
glPlatformInterface: 1

Screen Edges
============
desktopSwitching: false
desktopSwitchingMovingClients: true
cursorPushBackDistance: 1x1
timeThreshold: 150
reActivateThreshold: 350
actionTopLeft: 0
actionTop: 0
actionTopRight: 0
actionRight: 0
actionBottomRight: 0
actionBottom: 0
actionBottomLeft: 0
actionLeft: 0

Screens
=======
Multi-Head: no
Active screen follows mouse:  no
Number of Screens: 1

Screen 0:
---------
Name: HDMI1
Geometry: 0,0,1920x1080
Refresh Rate: 60


Compositing
===========
Compositing is active
Compositing Type: OpenGL
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Sandybridge Mobile 
OpenGL version string: 3.3 (Core Profile) Mesa 11.0.2
OpenGL platform interface: GLX
OpenGL shading language version string: 3.30
Driver: Intel
GPU class: SandyBridge
OpenGL version: 3.3
GLSL version: 3.30
Mesa version: 11.0.2
X server version: 1.17.2
Linux kernel version: 4.2
Direct rendering: Requires strict binding: yes
GLSL shaders:  yes
Texture NPOT support:  yes
Virtual Machine:  no
OpenGL 2 Shaders are used
Painting blocks for vertical retrace:  no

Loaded Effects:
---------------
zoom
slidingpopups
kwin4_effect_login
slide
screenshot
minimizeanimation
kwin4_effect_windowaperture
kwin4_effect_translucency
desktopgrid
kwin4_effect_maximize
kwin4_effect_fade
presentwindows
kwin4_effect_dialogparent
highlightwindow
blur
contrast
logout
startupfeedback
screenedge
kscreen

Currently Active Effects:
-------------------------
desktopgrid
blur
contrast

Effect Settings:
----------------
zoom:
zoomFactor: 1.2
mousePointer: 0
mouseTracking: 0
enableFocusTracking: false
followFocus: true
focusDelay: 350
moveFactor: 20
targetZoom: 1

slidingpopups:
fadeInTime: 150
fadeOutTime: 250

kwin4_effect_login:

slide:

screenshot:

minimizeanimation:

kwin4_effect_windowaperture:

kwin4_effect_translucency:

desktopgrid:
zoomDuration: 300
border: 10
desktopNameAlignment: 0
layoutMode: 0
customLayoutRows: 2
usePresentWindows: true

kwin4_effect_maximize:

kwin4_effect_fade:

presentwindows:
layoutMode: 0
showCaptions: true
showIcons: true
doNotCloseWindows: false
ignoreMinimized: false
accuracy: 20
fillGaps: true
fadeDuration: 150
showPanel: false
leftButtonWindow: 1
rightButtonWindow: 2
middleButtonWindow: 0
leftButtonDesktop: 2
middleButtonDesktop: 0
rightButtonDesktop: 0

kwin4_effect_dialogparent:

highlightwindow:

blur:
blurRadius: 12
cacheTexture: true

contrast:

logout:
useBlur: true

startupfeedback:
type: 1

screenedge:

kscreen:
Comment 10 Thomas Lübking 2016-04-12 15:05:41 UTC
Nope :-(
(I speculated on several grabbing effects being activated together)
Comment 11 Mateusz 2016-04-13 09:25:55 UTC
It's strange. I think it happens more often when I have second display connected using HDMI.
Comment 12 vpiotr 2016-04-14 16:35:25 UTC
Can confirm the issue. Also, I found the direct cause (at least in my case).

I have two display connections available on my desktop PC: HDMI and onboard LVDS. I only use monitor connected to HDMI output. LVDS connection is unused so I disabled it in display configuration - this is when Present Windows stops accepting any keypresses when activated. After enabling the second display it works as expected.
Comment 13 Thomas Lübking 2016-04-15 14:39:01 UTC
Might have relation to bug #351112
The question is whether the keyboard grab fails after randr events or it is released afterwards.

Does this also happen if you trigger present windows via a screen corner (run "kcmshell5 kwinscreenedges" for configuration)?
Comment 14 vpiotr 2016-04-15 14:55:40 UTC
This also happens when "present windows" is triggered via a screen corner.
Comment 15 Mateusz 2016-05-08 09:31:17 UTC
This also happens on Kubuntu 16.04.
Comment 16 Nick Gavalas 2016-05-25 13:12:04 UTC
Hello, 

I can confirm too, in a similar setup to vpiotr. 

I have two displays as well, VGA and onboard laptop screen. When I disable laptop screen, I face this issue 70% of the time (the percentage is just a projection). 
When I enable the laptop screen, everything works as expected. 

I can't verify the same for the HDMI connector right now, since my screen doesn't have one.
Comment 17 Mateusz 2016-06-14 13:40:14 UTC
It also happens on Kubuntu 16.04 with backports.
This is really annoying bug. You can't use Plasma effects freely because of that.
Comment 18 Mateusz 2016-06-20 10:25:43 UTC
I run some tests and here are results.
Dell monitor is connected via HDMI cable.
Rebooted few times to make sure it's working or not working.
OK means that effects are working.

#Laptop Screen
    #Primary: Laptop Screen: OK
    #Primary: No Primary Screen: OK

#Laptop Screen + Dell monitor
    #Primary: Laptop Screen: OK
    #Primary: Dell Monitor: OK
    #Primary: No Primary Screen: OK

#Dell monitor
    #Primary: Dell Monitor: OK
    #Primary: No Primary Screen: OK

I found a way to replicate this bug(It's clearly a bug;))
Each time I change display settings from 2 display setup to one display, doesn't matter if it's laptop display or Dell monitor, those effects stop working. I have to reboot to make them working again. Plus sometimes I have this feeling that after some time they just stop working, because everything works fine just after reboot.
When the effects stop working, changing display settings to 2 display setup makes them working again. Again, changing back to one display makes them not working, again.
Do you have any idea how to investigate further?
Comment 19 Thomas Lübking 2016-06-20 14:08:31 UTC
Suspending/resuming the compositor (SHIFT+Alt+F12 twice) should do as well (instead of a reboot)

Since it seems related to randr events and apparently started with Qt 5.5:
has anyone encountered this with Qt 5.6?
Comment 20 Mateusz 2016-06-20 14:47:43 UTC
Suspending/resuming the compositor does not help.
Additionally, I just booted to Kubuntu and I cant undo the effects again.
This time I didn't change display configuration.
Comment 21 Thomas Lübking 2016-06-20 14:50:09 UTC
Try running "kwin_x11 --replace &"
randr events on login aren't atypical (by kscreen - technically it doesn't matter whether that causes a screen addition/removal, Qt 5.5 has *severe* defects in this area)
Comment 22 Mateusz 2016-06-20 15:04:26 UTC
Thank you very much, this made it working again.
Comment 23 Martin Flöser 2016-08-27 16:03:47 UTC
Is anyone still experiencing this problem after Qt 5.6 was released?
Comment 24 Mateusz 2016-08-27 16:13:54 UTC
Yes, I'm on Antergos.
KDE Plasma Version: 5.7.3
KDE Frameworks Version: 5.25.0
Qt Version: 5.7.0

Solution that Thomas provided is still working ;)
Comment 25 vpiotr 2016-08-27 17:21:21 UTC
Yes, I can still reproduce it (Gentoo, Plasma 5.7.3, Frameworks 5.25, Qt 5.6.1).
It seems that this doesn't work only when one of my displays is disabled in display configuration. When both displays are enabled keyboard works fine.
Comment 26 Martin Flöser 2016-12-03 09:03:24 UTC
*** Bug 373202 has been marked as a duplicate of this bug. ***
Comment 27 Mateusz 2016-12-03 09:08:27 UTC
Still exists in.
KDE Plasma Version: 5.8.4
KDE Frameworks Version: 5.28.0
Qt Version: 5.7.0
Comment 28 Martin Flöser 2016-12-05 19:13:17 UTC
*** Bug 373306 has been marked as a duplicate of this bug. ***
Comment 29 Martin Flöser 2016-12-06 18:05:21 UTC
*** Bug 373354 has been marked as a duplicate of this bug. ***
Comment 30 Martin Flöser 2016-12-17 13:36:34 UTC
*** Bug 373758 has been marked as a duplicate of this bug. ***
Comment 31 Stefano Forli 2017-03-07 06:22:24 UTC
Bumped into this because of the Escape key issue (https://bugs.kde.org/show_bug.cgi?id=373354) which doesn't seem to be mentioned here.

Still exists with the following setup:
KDE Plasma Version: 5.8.5
KDE Frameworks Version: 5.28.0
Qt Version: 5.7.0
(Kubuntu 16.04.2 with backports)
Comment 32 Mateusz 2017-03-17 14:06:22 UTC
Does anyone know what can cause this problem?
Comment 33 Martin Flöser 2017-03-17 16:00:21 UTC
(In reply to Mateusz from comment #32)
> Does anyone know what can cause this problem?

Unfortunately we do not yet know what causes the problem
Comment 34 Mateusz 2017-06-10 17:52:23 UTC
This got even worse in 5.10.1 plasma version with KDE Frameworks 5.34.0 and Qt 5.9.0.
Restarting Plasmashell and Kwin does not help;(
Comment 35 jose luis m 2017-06-10 20:23:57 UTC
With previous versions (last months), when in present windows, filtering was working. 
I had this from Frameworks, Plasmashell and Qt5 in my package cache:

plasma-workspace-5.10.0
plasma-workspace-5.9.5.1
plasma-workspace-5.9.4
frameworks 5.34 and 5.33
qt5-base-5.8.0 

Yesterday I updated my system, plasma-workspace and Qt5 got updated (Frameworks didn't),  and filtering stopped working:
plasma-workspace-5.10.1
qt5-base-5.9.0
Comment 36 Xavion 2017-06-10 21:36:41 UTC
I've just started experiencing the same problem here.  Specifically:
* I can no longer hide the Desktop Grid via its shortcut
* The arrow and Enter keys no longer have any effect

I'm using plasma-framework v5.34.0, plasma-workspace v5.10.1, and qt5-base v5.9.0 (on Arch Linux).  Only plasma-workspace and qt5-base were upgraded yesterday.  I wasn't experiencing the problem before then.
Comment 37 Xavion 2017-06-10 23:17:29 UTC
Downgrading plasma-workspace to v5.9.5.1 didn't fix the problem, so I'd say it has something to do with the qt5-base jump (excuse the pun) from v5.8.0 to v5.9.0.  I can't be bothered downgrading Qt5; there are too many packages to rebuild.
Comment 38 Xavion 2017-06-11 02:22:36 UTC
Downgrading kwin to v5.9.5 didn't fix the problem either.  I tried it with both plasma-workspace v5.9.5.1 and v5.10.1.  I'm still thinking incompatibility with Qt v5.9.0 is the likely cause.
Comment 39 Martin Flöser 2017-06-17 12:59:50 UTC
*** Bug 381205 has been marked as a duplicate of this bug. ***
Comment 40 Martin Flöser 2017-06-17 13:00:39 UTC
*** Bug 381021 has been marked as a duplicate of this bug. ***
Comment 41 Martin Flöser 2017-06-17 13:00:52 UTC
*** Bug 380902 has been marked as a duplicate of this bug. ***
Comment 42 Martin Flöser 2017-06-17 14:58:43 UTC
I'm able to reproduce the issue with Qt 5.9. From my investigation it looks like a behavioral change in Qt. KWin grabs key events on the X11 root window and passes the native events to Qt in order to have them composed as QKeyEvents. With Qt 5.9 it looks like  Qt no longer creates QKeyEvents for non-Qt windows. Due to that we are seeing the breakage.

This also makes me wonder whether the latest duplicates are truly duplicates to the original report which was reported against Qt 5.5.

It needs now further investigation to decide whether or not this is a bug which needs to be fixed in Qt or whether KWin needs to adjust the code to the new behavior.
Comment 43 Fabian Vogt 2017-06-17 16:27:10 UTC
(In reply to Martin Flöser from comment #42)
> I'm able to reproduce the issue with Qt 5.9. From my investigation it looks
> like a behavioral change in Qt. KWin grabs key events on the X11 root window
> and passes the native events to Qt in order to have them composed as
> QKeyEvents. With Qt 5.9 it looks like  Qt no longer creates QKeyEvents for
> non-Qt windows. Due to that we are seeing the breakage.

I did some more investigation, it's not quite that simple.
Qt never created QKeyEvents for windows it does not have a handle for,
but before Qt 5.9 we had a handle for the root window!
It got created in scripting/workspace_wrapper.cpp, in this line:

    connect(QApplication::desktop(), SIGNAL(resized(int)), SIGNAL(screenResized(int)));

The call to QApplication::desktop() created a foreign QXcbWindow that installed
an event listener for the root window.

Since 2b34aefcf02f09253473b096eb4faffd3e62b5f4 in qtbase
("Lazily create QPlatformWindow for Qt::Desktop windows") this is not the case
anymore, but simply calling QApplication::desktop()->winId() anywhere makes it work again.
Comment 44 Martin Flöser 2017-06-17 17:45:10 UTC
Good investigation. So it is a KWin issue by not ensuring the foreign window is created.
Comment 45 Xavion 2017-06-17 21:05:04 UTC
Good work, guys!  Thanks for looking into the nature of this problem.

Now that we know what needs to be done, can the relevant fix be applied/merged in time for KWin v5.10.3?  Also, roughly when will that be released?

If we won't be seeing this for a while, can you supply us with a patch (for the KDE package maintainers of our various distributions)?
Comment 46 Bastian Beischer 2017-06-17 22:41:16 UTC
I have tested this patch:

diff --git a/scripting/workspace_wrapper.cpp b/scripting/workspace_wrapper.cpp
index 461e0546c..269a72743 100644
--- a/scripting/workspace_wrapper.cpp
+++ b/scripting/workspace_wrapper.cpp
@@ -64,6 +64,7 @@ WorkspaceWrapper::WorkspaceWrapper(QObject* parent) : QObject(parent)
             emit numberScreensChanged(currentCount);
         }
     );
+    QApplication::desktop()->winId();
     connect(QApplication::desktop(), SIGNAL(resized(int)), SIGNAL(screenResized(int)));
     foreach (KWin::Client *client, ws->clientList()) {
         setupClientConnections(client);

and it fixes the issue indeed!

Good work!
Comment 47 Bastian Beischer 2017-06-17 22:55:39 UTC
P.S. The original bug report existed before Qt 5.9.0, so I disagree with 380902 being a duplicate of this report, although the symptoms are the same.
Comment 48 Xavion 2017-06-18 01:06:37 UTC
Yes, I agree that at least one of those other (similar) bug reports should have remained open.  This is a new iteration of the same problem.

Regardless, thanks heaps for the patch!  I can confirm that it works here.  As such, I have notified Arch Linux's "kwin" package maintainers.
Comment 49 Martin Flöser 2017-06-18 07:13:23 UTC
To any package maintainer: do not apply any patch from this bug report! The bug will be fixed in the next bug fix release but will look very different to the patch here.
Comment 50 Xavion 2017-06-18 08:04:32 UTC
It's okay, Bastian: I still love your work. :-)
Comment 51 Martin Flöser 2017-06-18 12:27:57 UTC
And up for review at: https://phabricator.kde.org/D6258
Comment 52 Martin Flöser 2017-06-19 15:15:26 UTC
*** Bug 381278 has been marked as a duplicate of this bug. ***
Comment 53 Martin Flöser 2017-06-20 05:08:28 UTC
Git commit a6dee74ee455d1da47dd5c9d55a84adbb5e1426a by Martin Flöser.
Committed on 20/06/2017 at 04:56.
Pushed by graesslin into branch 'Plasma/5.10'.

Workaround Qt regression of no longer delivering events for the root window

Summary:
With qtbase 2b34aefcf02f09253473b096eb4faffd3e62b5f4 we do no longer get
events reported for the X11 root window. Our keyboard handling in effects
like PresentWindows and DesktopGrid relied on that.

This change works around the regression by calling winId() on
qApp->desktop() as suggested in the change. This is a short term solution
for the 5.10 branch.

This needs to be addressed properly by no longer relying on Qt in this
area. KWin already does not rely on Qt for Wayland in that area and is
able to compose the QKeyEvents. This should also be done on X11. It just
needs some more hook up code for xkb, but that's needed anyway to improve
modifier only shortcuts and friends.
FIXED-IN: 5.10.3

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6258

M  +6    -0    effects.cpp

https://commits.kde.org/kwin/a6dee74ee455d1da47dd5c9d55a84adbb5e1426a