Bug 289336 - Mouse cursor disappears when switching windows while zooming
Summary: Mouse cursor disappears when switching windows while zooming
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: effects-various (show other bugs)
Version: 4.9.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: reproducible
Depends on:
Blocks:
 
Reported: 2011-12-19 08:16 UTC by Elez J. Shenhar
Modified: 2016-10-28 19:57 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
togglecursor.c test application (522 bytes, application/octet-stream)
2013-01-22 23:23 UTC, Thomas Lübking
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Elez J. Shenhar 2011-12-19 08:16:02 UTC
Version:           4.7.4 (using KDE 4.7.3) 
OS:                Linux

When zoomed in using the Zoom effect, upon switching windows, the mouse cursor would disappear.
It doesn't matter which window switching effect is used (it can also happen when hovering over an application in the task manager), but it is 100% reproducible when using, for instance, the Cover Switch effect, but only if you hold the switch shortcut (default alt-tab) long enough to actually generate the Cover Switch effect.


Reproducible: Always

Steps to Reproduce:
1. Turn on Zoom effect (don't use the "Mouse Pointer: Hide"!), and in order to ease reproduction, also turn on Cover Switch effect, and Taskbar Thumbnails effect.
2. Zoom in
3. Switch windows by either:
 a. Holding Alt-Tab (window switching shortcut) long enough for the effect to appear, or by
 b. Moving your mouse cursor to any application in the task manager long enough to trigger the Taskbar Thumbnails effect. Once you move your mouse cursor again to make the thumbnail effect disappear
4. Your mouse cursor should be gone now
5. If you completely zoom out, the cursor should become visible again

Actual Results:  
Mouse cursor gone

Expected Results:  
Mouse cursor should have stayed visible throughout the process, and beyond, like it did in KDE 4.6 and below

Using OpenGL for compositing
"Accurate" scale method
Checks marked in:
1. Suspend desktop effects for fullscreen windows
2. Enable direct rendering
3. Use OpenGL 2 Shaders
4. Use VSync

OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce 8600 GT/PCI/SSE2
OpenGL version string: 3.3.0 NVIDIA 280.13
OpenGL shading language version string: 3.30 NVIDIA via Cg compiler
Comment 1 Martin Flöser 2011-12-19 18:07:16 UTC
The issue seems to be caused by coverswitch and other effects changing the cursor. It looks to me like the zoom effect does not keep track of what is changing.

Adding Sebastian, who touched the code last.
Comment 2 Sebastian Sauer 2011-12-20 03:18:06 UTC
The comment "Mouse cursor should have stayed visible throughout the process, and beyond, like it did in KDE 4.6 and below" indicates that it's a regression introduced with >=4.7.

Now to the interesting pieces;

* If I use the "Box Switch" then it works as expected but if I use "Cover Switch" it does not.

* The same problem is visible with the "Track Mouse" effect. If I activate it it works fine (through slightly wrong but that#s another bug) if I zoom in but as soon as I used "Cover Switch" the "Track Mouse" effect does not work any longer means nothing is displayed at all if I press the shortcut to activate that effect.

Looks for me as we are dealing with a general bug that hits in when we leave 
those Window-overview that is displayed when "Cover Switch" is activated. In short: it's not related to anything done by me / it wasn't me (this time) :-)
Comment 3 Martin Flöser 2011-12-21 06:37:21 UTC
It is also not just related to CoverSwitch, but in fact to all effects using a mouse pointer grab. I guess it's somewhere caused in KWin core and will have a look at it later this week or after the holidays.
Comment 4 Thomas Lübking 2011-12-23 22:27:19 UTC
The problem is somewhere on the GLTexture which is used to paint the cursor while zoom != 1.0 (cross check present windows + zoom on OpenGL & XRender)


It's likely a shader issue, since in 4.7 (no shaders on this GPU at all) it doesn't happen on GL or XRender here while in 4.8 (correct shader invocation) it's 100% reproducable
Comment 5 Thomas Lübking 2012-03-09 20:08:14 UTC
Is this still an issue? I just tried and can't reproduce it locally anymore...
Comment 6 Elez J. Shenhar 2012-03-09 20:11:27 UTC
Still very much (100%)  reproducible over here with 4.8.1
Comment 7 Thomas Lübking 2012-03-09 20:30:42 UTC
is the vsync setting crucial?
Comment 8 Elez J. Shenhar 2012-03-09 20:40:00 UTC
No. I just tried without vsync (I'm usually with it) and it's reproducible just the same.
Comment 9 Thomas Lübking 2012-03-22 23:05:08 UTC
Have you btw. tried w/o OpenGL shader support?
Comment 10 Elez J. Shenhar 2012-04-08 12:11:31 UTC
It does NOT reproduce after I disable OpenGL 2 Shaders.
FYI, I'm using KDE 4.8.2 now.

p.s. Sorry it took me so long to reply
Comment 11 Elez J. Shenhar 2012-08-17 20:45:59 UTC
This bug still exists in KDE 4.9
Comment 12 Thomas Lübking 2012-08-18 10:35:31 UTC
Most likely same as or similar to bug #304404 but on other item

@Martin
would you accept a stack implementation of the shader "stack" for 4.9.x or prefer fixing it by explicit uniform setting until 4.10?
Comment 13 Martin Flöser 2012-08-18 10:38:02 UTC
I would prefer changes like making it a real stack go into 4.10
Comment 14 Travis Evans 2012-11-22 10:29:43 UTC
With KDE 4.9.3, I have a similar issue with the mouse cursor disappearing, but after a Plasma panel popup appears and then disappears while zoomed in. In addition, I see other cursor issues while zoomed that I mention in Bug #276391. This is with official Nvidia drivers and an GeForce GT240. Could these all be related?
Comment 15 Travis Evans 2012-11-22 10:34:16 UTC
I have found that as with the reporter's case, the cursor does not disappear when I disable shaders. However, the other issues I mentioned in the other bug report remain.
Comment 16 Elez J. Shenhar 2013-01-01 12:13:08 UTC
This issue seems to have been solved. This is no longer reproducible for me in 4.9.95
I'm using NVIDIA 310.14

Can anyone else confirm this is indeed fixed?
Comment 17 Chris Maple 2013-01-06 14:11:10 UTC
KWin 4.9.4, Nouveau, Fedora 17, dual monitor (over/under)
Zoom in, everything OK
Zoom out to 1:1, cursor disappears.
Zoom in, cursor reappears.
Zoom out to 1:1, cursor disappears.
Comment 18 Thomas Lübking 2013-01-06 14:41:43 UTC
reg. comments #16 & #17
there've been soome changes reg. the cursor / texture handling in 4.10

a) it should no longer be reproducible setting the cursor to "keep" at all
b) i can't atm. reproduce it with the scaling cursor either, however because of the invocation of the cover switch effect there might be the boxswitch effect (for the additional thumbnail list) in action

-> whenever you see this on a 4.9 installation, run "qdbus org.kde.KWin /KWin supportInformation" and attach that output.
Comment 19 Chris Maple 2013-01-16 21:55:25 UTC
[root]3999:~#>kwin --version
Qt: 4.8.4
KDE Development Platform: 4.9.5
KWin: 4.9.5
[root]4000:~#>qdbus org.kde.KWin /KWin supportinformation
Service 'org.kde.KWin' does not exist.

On Sun, Jan 6, 2013 at 9:41 AM, Thomas Lübking <thomas.luebking@gmail.com>wrote:

> https://bugs.kde.org/show_bug.cgi?id=289336
>
> --- Comment #18 from Thomas Lübking <thomas.luebking@gmail.com> ---
> reg. comments #16 & #17
> there've been soome changes reg. the cursor / texture handling in 4.10
>
> a) it should no longer be reproducible setting the cursor to "keep" at all
> b) i can't atm. reproduce it with the scaling cursor either, however
> because of
> the invocation of the cover switch effect there might be the boxswitch
> effect
> (for the additional thumbnail list) in action
>
> -> whenever you see this on a 4.9 installation, run "qdbus org.kde.KWin
> /KWin
> supportInformation" and attach that output.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
Comment 20 Thomas Lübking 2013-01-16 22:32:03 UTC
(In reply to comment #19)
> [root]3999:~#>kwin --version
> Qt: 4.8.4
> KDE Development Platform: 4.9.5
> KWin: 4.9.5
> [root]4000:~#>qdbus org.kde.KWin /KWin supportinformation
> Service 'org.kde.KWin' does not exist.


called "kwin --replace"?
This is fixed in 4.10, try "qdbus | grep -i kwin", there'll be some "org.kde.kwin-12345"
Comment 21 Silvan Calarco 2013-01-16 23:15:20 UTC
Here is the output of "qdbus org.kde.kwin /KWin supportInformation", with kde 4.9.5 and same exact problem as comment #17: http://paste.kde.org/649004/
Comment 22 Thomas Lübking 2013-01-16 23:28:56 UTC
Try setting "mouse pointer" to "keep" and whether you can reproduce the issue when deactivating "OpenGL 2.0" support (or using the XRender backend instead)

Also disable the coverswitch effect, resp. deactivate the "additional thumbnailbar" (including the dynamic mode)
Then run "kwin --replace&", ensure boxswitch does no longer show up in the supportInformation and see whether the issue remains.
Comment 23 Silvan Calarco 2013-01-16 23:54:59 UTC
"OpenGL" + "scale" does not work.
"OpenGL" + "keep" works.
"XRender" + "scale" does not work.
"XRender" + "keep" works.
Disabling "boxswitch" and/or "taskbarthumbnail" does not change the behaviour above both in OpenGL and XRender mode.
Comment 24 Thomas Lübking 2013-01-17 00:26:51 UTC
(In reply to comment #23)

> "XRender" + "scale" does not work.
It's not GLSL related then.
Can you try the behavior with the nvidia blob (or even vesa) instead of nouveau?
Comment 25 Silvan Calarco 2013-01-17 00:55:55 UTC
I have Intel (see below) non nvidia. Maybe tomorrow I can do tests on pcs with nouveau and radeon, but I'm not at all sure that the problem may be chipset dependent.

Compositing
===========
Qt Graphics System: native
Compositing is active
Compositing Type: OpenGL
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Mobile Intel GM45 Express Chipset x86/MMX/SSE2
OpenGL version string: 2.1 Mesa 9.0.1
Driver: Intel
GPU class: i965
OpenGL version: 2.1
Mesa version: 9.0.1
X server version: 1.10.6
Linux kernel version: 3.4
Direct rendering: yes
Requires strict binding: no
GLSL shaders:  yes
Texture NPOT support:  yes
OpenGL 2 Shaders are used
Comment 26 Thomas Lübking 2013-01-17 01:47:24 UTC
Sorry,  i didn't notice the user changed interim (and just skipped the GPU section, scrolling forward to settings)

There's basically three possible causes for this:
a) the function to re-show the actual cursor is not called (but the zoom effect is no longer active)
b) the X11 function does not do what it should
c) a problem in the framebuffer / driver

Most apparent difference is that the reason in the early reports were OpenGL 2.0 shaders (see comments #4 #10 and #15) while now it seems to occur for you on even XRender compositing.
Comment 27 Chris Maple 2013-01-20 04:19:38 UTC
kwin version 4.9.5

[root]4002:~#>qdbus | grep -i kwin
 org.kde.kwin
 org.kde.kwin-1376
 org.kde.kwin.Screenshot
 org.kde.kwin.Scripting

This result is unchanged whether the cursor has disappeared due to zooming
out to 1:1 or not.
Comment 28 Thomas Lübking 2013-01-20 14:29:22 UTC
(In reply to comment #27)
> kwin version 4.9.5
> 
> [root]4002:~#>qdbus | grep -i kwin
>  org.kde.kwin
>  org.kde.kwin-1376
>  org.kde.kwin.Screenshot
>  org.kde.kwin.Scripting
> 
> This result is unchanged whether the cursor has disappeared due to zooming
> out to 1:1 or not.

The idea was to get the currently registered dbus service - there's absolutely no change intended to be caused.

Try
qdbus org.kde.kwin /KWin supportinformation
or
qdbus org.kde.kwin-1376 /KWin supportinformation

for this output. Notice that esp. 
qdbus org.kde.kwin-1376 /KWin supportinformation
will fail for sure if you restarted kwin meanwhile (1376 is the PID at that time)
Comment 29 Simonas 2013-01-22 22:39:52 UTC
i confirm this bug on 4.9.5. however to workaround the issue i just go to .kde4/share/config and delete kcminputrc file. in this way, the cursor switches to default one, but when you use zoom effect, cursor wont disappear after zooming out
Comment 30 Thomas Lübking 2013-01-22 23:23:29 UTC
Created attachment 76650 [details]
togglecursor.c test application

This is interesting - the issue seems to be in the themed cursor and not that we "forget" to show it.

Can you compile and run the attached applet (it will hide your cursor, wait 5 seconds so you can see that sth. has happened, and the ... "hoepfully" ;-) reshow it) - obviously only makes sense with the critical infrastructure (themed cursor)

If this works as expected, please call back or - if you've more than no coding skills, edit kde-workspace/kwin/effects/zoom/zoom.cpp:~188 and comment 

- XcursorImageDestroy(ximg);
+ // XcursorImageDestroy(ximg);

recompile and see what happens?

My guess is that XcursorImage will return some shared object and destroying it will kill it for further usage - a quick test to verify this would be to check whether causing a differnt cursor shape - eg. the I-Beam by hovering some testedit - will re-show the lost cursor.
Comment 31 Tim Erbes 2013-02-01 22:02:30 UTC
I am having the exact same problem.  I zoomed in on accident.  I then zoomed out and my cursor disapeared.  If I zoom in again it shows up, but when I zoom out its gone again.

What information do you need from me (with instructions on how to get it).
Comment 32 Thomas Lübking 2013-02-01 22:12:19 UTC
(In reply to comment #31)

> What information do you need from me (with instructions on how to get it).

See comment #30
Download the code, compile and run it. See what happens.

Also check what happens if you attempt to alter the shape of the hidden cursor (eg. when entering a textedit, it should turn into an I-Beam). Does it re-occur in this case?
Comment 33 Tim Erbes 2013-02-01 22:48:40 UTC
I'm probably doing something really obvious wrong, I'm not used to this sort of activity.

user@computer:/usr/lib$ gcc togglecursor.c 
togglecursor.c:3:35: fatal error: X11/extensions/Xfixes.h: No such fildirectory
compilation terminated.

When I try to get the text edit cursor while zoomed out nothing chanes (hidden the whole time).  When I try it zoomed in, the cursor stays the same the entire time.
Comment 34 Thomas Lübking 2013-02-01 23:05:59 UTC
gcc -I/usr/include -L/usr/lib -lX11 -lXfixes -o togglecursor togglecursor.c

You'll eventually need libX11-dev packages (pot. libXfixes-dev, if such exists)

I can send you a 32bit binary, but it would be better compiled on your system.
Comment 35 Silvan Calarco 2013-02-02 17:12:20 UTC
I tried patching kde-workspace as suggested with no luck.
The togglecursor test application seems to behave as expected (cursor disappearing for 5 seconds and then reappearing).
Comment 36 Michael Chang 2013-08-05 13:42:59 UTC
If it's worth anything, I'm able to reproduce this in 4.10.5 using OpenGL shaders. Both Keep and Scale seem to be affected for me, but XRender appears to work fine. (I'm only testing window switching, but I also had tooltips fading out cause the cursor to disappear in 4.10.) Using Intel graphics driver.

It seems like in my case, the issue is with the Fade effect. When I disable it, everything works. When it's enabled, it looks like the cursor is fading in and out with the window. For example, if I hit Alt+Tab and hold Alt until the switcher shows, once I release Alt, the cursor will fade out partially with the switcher.
Comment 37 Thomas Lübking 2014-02-24 19:38:27 UTC
Git commit fe42ff9c57b5c975b3fed58b9c536bf05f91b8ca by Thomas Lübking.
Committed on 03/02/2014 at 20:03.
Pushed by luebking into branch 'KDE/4.11'.

be more aggressive about exiting zoom effect
REVIEW: 115453

M  +1    -1    kwin/effects/zoom/zoom.cpp

http://commits.kde.org/kde-workspace/fe42ff9c57b5c975b3fed58b9c536bf05f91b8ca
Comment 38 Martin Flöser 2016-10-28 19:57:02 UTC
Assuming the problem is fixed given that there were no further comments since the last commit comment. In case it's still an issue please reopen.