Bug 301777 - left/top screen edge event not working with touchpad
Summary: left/top screen edge event not working with touchpad
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 4.8.3
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 301997 311558 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-06-12 20:29 UTC by jetorkelson
Modified: 2012-12-12 16:22 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
patch that prints enter events alongside position and time (686 bytes, patch)
2012-06-16 19:12 UTC, Thomas Lübking
Details
Cursor warping test app (1015 bytes, text/plain)
2012-07-30 20:04 UTC, Thomas Lübking
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jetorkelson 2012-06-12 20:29:35 UTC
When using my touchpad, I can't get the screen edge actions (ex. show desktop, show dashboard, lock screen) to work for the top edge, left edge or top-left corner.  The same actions work on the right edge, bottom edge or bottom right corner.  This only happens with the touchpad; if I use an external mouse, the mouse can activate the screen edge actions without any issues.  Also, I can still move a window to another desktop by dragging it off the top edge even with the touchpad.
My roommate's laptop, using the same touchpad driver (SynPS/2 Synaptics TouchPad), does not have this problem.

Reproducible: Always

Steps to Reproduce:
1.See above
Actual Results:  
nothing happens

Expected Results:  
something happens

** My Laptop (bug does happen) **
OS: Kubuntu 12.04 amd64 w/ KDE SC 4.8.3
PC: HP Pavilion g6 Notebook PC (A6Z72UA#ABA)
CPU: AMD A4-3320M APU with Radeon(tm) HD Graphics
RAM: 4GB DDR3 @ 1333 MHz
Video: AMD Radeon HD 6000 Series
Sound: BeaverCreek HDMI Audio [Radeon HD 6500D and 6400G-6600G series]
Linux Kernel: 3.2.0-24-generic
Screen Resolution: 1366x768

** Roommate's laptop (bug doesn't happen) **
OS: Kubuntu 12.04 i386 w/ KDE SC 4.8.3
PC: HP Pavilion dv1550se laptop
CPU: Intel(R) Pentium(R) M processor 1.60GHz
RAM: 1.5GB DDR400
Video: Mobile 915GM/GMS/910GML Express Graphics Controller
Sound: 82801FB/FBM/FR/FW/FRW (ICH6 Family) AC'97 Audio Controller
Linux Kernel: 3.2.0-24-generic
Screen Resolution: 1280 x 768
Comment 1 Thomas Lübking 2012-06-12 20:58:46 UTC
It's certainly no "regression" since you and your roommate run the same version.

I suppose this is
http://forum.kde.org/viewtopic.php?f=111&t=102161

If your and your roommates setups are exactly equal (notably including plasma -autohiding- panel positions and configured screen edges) the bad news is that your touchpad is broken. (simple ratio, if the same SW and drivers cause different results on differen HW, it's a HW problem)

If not
a) this will likely fall into the "conflictive electric borders" category
b) please elaborate on the differences between yours and your roommates setups in detail
Comment 2 S. Christian Collins 2012-06-12 22:50:57 UTC
Hi Thomas, this is the roommate here :)

Whoops, Jared forgot to mention: the reason it was marked as a regression is that the top-left corner activation worked just fine for Jared in Kubuntu 11.10 (KDE 4.7 series), and it wasn't until the upgrade to Kubuntu 12.04 that the problem appeared.  Neither of us have any additional KDE panels--only the one on the bottom, and none of us are using multiple screens.  We both use GLX-Dock and experienced this possibly-related bug: https://bugs.launchpad.net/cairo-dock-core/+bug/993612

I will check out your link with Jared when he gets back later.
Comment 3 S. Christian Collins 2012-06-13 14:17:37 UTC
I am pasting Thomas Lübking's e-mail message to me here for easier tracking of this bug:
---------------------------------------------
Hi Christian.

bugs.kde.org will have a short downtime

Meanwhile, does the issue remain if glx-dock is on another edge (or simply shut down)?

However, there's been a GSoC re-organization of the electric screen edges¹, so i'll better have a look what might have went wrong.

Regarding the touchpad, i guess it causes an enter event for every move, or sends a dnd client messsage (because the touch area is also used as mouse button, it *should* be possible to turn that behavior off (but frankly i just turn off the touchpad - that things drive me nuts ;)
Comment 4 jetorkelson 2012-06-13 14:33:51 UTC
The link in comment #1 seems to be the same problem I'm experiencing.  I tried the following to no avail:
 . Disabling GLX Dock
 . Switching from open source Radeon driver to fglrx driver
 . Booting a different kernel (3.4.0-4-generic)
 . touchpad tapping disabled

I can get the top-left corner to activate if I swipe at the touchpad like a madman, but it is very difficult to do (much harder than it used to be and much harder than the other corners).
Comment 5 S. Christian Collins 2012-06-13 14:41:22 UTC
(continued from comment #3) - I forgot to post the rest of Thomas' e-mail message.  Here it is:
--------------------------------------
Am 13.06.2012, 00:50 Uhr, schrieb S. Christian Collins <s_chriscollins@hotmail.com>:
> that the top-left corner activation worked just fine for Jared in Kubuntu 11.10
> (KDE 4.7 series), and it wasn't until the upgrade to Kubuntu 12.04 that the problem appeared.

Ah, ok - but that included updates of X11, the kernel, drivers, glx-dock ... =)
It might nevertheless be the refactoring mentioned above.

Cheers,
Thomas

[1] https://git.reviewboard.kde.org/r/101789/diff
Comment 6 Thomas Lübking 2012-06-16 08:54:50 UTC
*** Bug 301997 has been marked as a duplicate of this bug. ***
Comment 7 Thomas Lübking 2012-06-16 12:35:48 UTC
There seems to be an issue with either the generated timestamps or events of this device/driver combo - can any of you apply patches for testing?
Comment 8 S. Christian Collins 2012-06-16 16:24:21 UTC
I have limited experience, but I have applied patches to application sources before, but never anything to core KDE libs.  How would one go about doing this?  Is there a resource somewhere I could read?

Usually when I've applied patches in the past (for example, to Audacity), I simply remove the audacity package and then compile the source + make install.  I'm not sure how I would do the same with a patched KDE lib, due to the dependencies involved in removing the library package.
Comment 9 Thomas Lübking 2012-06-16 16:33:04 UTC
You'd actually not even have to remove sth. but install the kdelibs/kde-workspace-dev packages, fetch kde-workspace sources from git or a tarball and compile and install kwin (overriding your actual installation) after applying the patch.

re-installing the distro kde-workspace/kwin package will then simply revert the custom changes (at least for 4.8 there should be no issue but for 4.9 sources you might get dpkg errors later on because the "file is already in filesystem"
Comment 10 S. Christian Collins 2012-06-16 16:39:28 UTC
Great!  When there is a patch available, I will be happy to test it.
Comment 11 Thomas Lübking 2012-06-16 19:12:32 UTC
Created attachment 71873 [details]
patch that prints enter events alongside position and time

it's not the kind of "this fixes it" patch, but just a debug out so we can see whether the device produces an enter event and along what time stamp (while i'm really puzzled why it should hit the top/left edge - sounds as if the input device is off by one and stops at pixel 1 instead of 0)

also apply these patches:
https://git.reviewboard.kde.org/r/104420/
https://git.reviewboard.kde.org/r/105254/

(esp. the first one will allow us to check the no-pushback variant)
Comment 12 Thomas Lübking 2012-06-25 11:07:15 UTC
Does anybody encountering this issue NOT use ubuntu 12.04

See
https://answers.launchpad.net/ubuntu/+source/xserver-xorg-input-evdev/+question/201072
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-evdev/+bug/1015183
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-evdev/+bug/1015183
and Xorg thread
http://lists.x.org/archives/xorg/2012-June/054739.html

Do we have an xev log for this and/or meawhile knowledge about the events on the electric borders (see attached patches)
Comment 13 Michele Corazza 2012-06-25 11:31:35 UTC
I do encounter the bug and I am using debian sid/unstable with kde 4.8.3...
Comment 14 S. Christian Collins 2012-06-25 14:09:35 UTC
Hi Thomas.  Sorry I haven't had time to test the patch yet.  I'll try to get to it this week.
Comment 15 S. Christian Collins 2012-06-29 01:15:48 UTC
Thomas, I have successfully patched the KDE 4.8.4 sources, but I'm a bit lost trying to follow the build environment instructions.  Since the instructions at http://techbase.kde.org/Development/Tutorials/Building_An_Existing_Application didn't seem to match exactly what I was trying to do, I tried the following instead:
1) Created a "build" directory in ~/kde/src/kde-workspace-4.8.4/kwin/
2) From the build directory, ran the command "cmake -DCMAKE_INSTALL_PREFIX=/usr ..", which generates the following output:
--------------
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Warning at CMakeLists.txt:12 (if):
  given arguments:

    "STREQUAL" "Desktop"

  Unknown arguments specified


CMake Error at libkdecorations/CMakeLists.txt:10 (kde4_add_library):
  Unknown CMake command "kde4_add_library".


CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 2.8)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!
--------------------
I'm not sure what I'm supposed to do :\
Comment 16 Thomas Lübking 2012-07-02 16:53:08 UTC
Sorry for the delay.

a) stupid question ahead: are plasma autohiding panels affected by this as well?

b) this
CMake Error at libkdecorations/CMakeLists.txt:10 (kde4_add_library):
  Unknown CMake command "kde4_add_library".

is the error and this
> in ~/kde/src/kde-workspace-4.8.4/kwin/
is the reason.

While it's sufficient to only build kwin, it's required to run CMake on the entire kde-workspace (it adds macros such as the one which triggered the error)

So make a build dir in kde-workspace, run "cmake -DCMAKE_INSTALL_PREFIX=/usr .." there and "cd build/kwin; make && sudo make install"

That should do.
Comment 17 S. Christian Collins 2012-07-03 22:25:19 UTC
Plasma autohiding panels are not affected.  I have no trouble recalling them along the top or left edges.  Once I get this patched kwin installed (still trying to hunt down all of the dependencies), what do I do to get you the information you need from kwin?
Comment 18 S. Christian Collins 2012-07-18 00:50:56 UTC
Everything seems to build fine, but I need to know how to get you the logging info that you need from this patch.
Comment 19 Thomas Lübking 2012-07-18 12:01:38 UTC
If you have applied attached patch, just start kwin from konsole ("kwin --replace &", attempt to approach a non working screen edge and watch the output.

If you get no output there's no crossing event, ie. the cursor does not enter the border window (which triggers the actions)

In that case, xrun xwininfo, move the cursor to a screen edge and click to see what window is there beneath the cursor.

Otherwise please run "xev | grep state" and move the cursor into the detection field to watch the cursor state - anything that is NOT 0x10 is a bug  - esp. 0x110 means that the left mouse button is pressed.
Comment 20 S. Christian Collins 2012-07-24 16:26:36 UTC
After installing the patched kwin, I no longer have any window decorations or compositing, and I am unable to type anything.  I was able to reinstall the following packages from a virtual terminal to get my system working again:
kde-window-manager, kde-window-manager-common, libkwinactiveglesutils1 libkwinactiveglutils1 libkwinglesutils1 libkwinglutils1
Are there any other packages I should reinstall as well?  Unfortunately, I was unable to get any test results for you.
Comment 21 Thomas Lübking 2012-07-24 16:59:34 UTC
Means kwin didn't start / crashed.
Did you get a backtrace?

Wild guess: decoration.
In case you're using oxygen you'll probably also have to update kde-workspace/libs/oxygen (and with it the oxygen UI style in kde-workspace/kstyles/oxygen

Sorry, didn't think of that :-(

Alternatively you can use another deco for testing (laptop, skulpture, bespin should all be safe - QtCurve is binary incompatible and will not be loaded - falling back to oxygen then ...)
Comment 22 S. Christian Collins 2012-07-25 18:40:43 UTC
The error when running "kwin --replace &" is:
kwin: error while loading shared libraries: libkworkspace.so.4: cannot open shared object file: No such file or directory

Trying with the "Laptop" theme doesn't make any difference.  I've never tried compiling something this complex before, so I'm sorry if I'm missing something obvious.
Comment 23 Thomas Lübking 2012-07-25 18:49:45 UTC
That build "failed", no deco will do because library dependencies cannot be resolved (ie. libkworkspace and likely others are not in a known library path)

You can "strace kwin" to see what libs are attempted to be accessed. (but that's gonna generate *masses* of output)

If you want, build "make 2>&1 | tee my_make.log" and attach or mail me the log file (could be huge, better compress it then) because otherwise i can't possibly tell what failed here

Did you somehow compile kwin, then removed kde-workspace and then installed kwin? (that's not gonna work, it will still need the workspace libraries - you just don't have to compile them)

In very doubt, just compile and install entire workspace.
Comment 24 S. Christian Collins 2012-07-26 16:40:03 UTC
I found the problem.  I just had to create a symlink from /usr/lib/libkworkspace.so.4abi1 to /usr/lib/libkworkspace.so.4 and now I can get the kwin QPoint output.  Now I just need to wait for my roommate to get home from work so I can test it on his laptop (the one with the bug).
Comment 25 S. Christian Collins 2012-07-27 19:16:38 UTC
I have been able to run the tests on my roommate's laptop, and here is what I have discovered:

1) When an action is assigned to a screen corner, there seems to be an invisible pixel at that corner that triggers a QPoint event when hit by the cursor and then immediately pushes the cursor away from that pixel.  Using the top-left corner as an example, moving the cursor to position 0,0 will trigger a QPoint event, and then the cursor will be immediately forced to 1,1.  Therefore, "pushing" the cursor into the corner will continuously trigger QPoint events as the cursor is constantly moving to 0,0 and being forced back to 1,1.

2) When using the trackpad on Jared's laptop, when the cursor moves to 0,0, a QPoint event is triggered, but the cursor is *not* forced out to 1,1 and instead remains at 0,0.  Therefore, continuing the push the cursor into the corner does nothing.  By jiggling the cursor long enough in the corner, enough QPoint events can be generated to trigger the assigned screen edge event, which is why a "furious swiping" sometimes works.  This problem does not exist in the bottom-right corner.  Using a mouse, the cursor is properly kicked out to 1,1 in the top-left corner.
Comment 26 S. Christian Collins 2012-07-27 19:47:38 UTC
Here's a video I made showing the bug on Jared's laptop:
http://youtu.be/ctilD4DedkE
Comment 27 Thomas Lübking 2012-07-27 20:35:44 UTC
(In reply to comment #25)
> 1) When an action is assigned to a screen corner, there seems to be an
> invisible pixel at that corner that triggers a QPoint event when hit by the
> cursor
That is the input window used to trigger screenborder actions.

> and then immediately pushes the cursor away from that pixel.
PushBack* is (afaik and reasonably) used to detect the users will, ie. that s/he *wants* to enter that corner (ie. triggers events until the delay times out)

> 1,1.  Therefore, "pushing" the cursor into the corner will continuously
> trigger QPoint events as the cursor is constantly moving to 0,0 and being
> forced back to 1,1.
yes - until the BorderDelay times out.
 
> 2) When using the trackpad on Jared's laptop, when the cursor moves to 0,0,
> a QPoint event is triggered, but the cursor is *not* forced out to 1,1 and
> instead remains at 0,0.
That either means the pushback is disabled (unlikely) or we can't warp the cursor.

$ kreadconfig --file kwinrc --group Windows --key ElectricBorderPushbackPixels
If it prints nothing, it's default, ie. "1"
Try 
$ kwriteconfig --file kwinrc --group Windows --key ElectricBorderPushbackPixels 0
$ qdbus org.kde.kwin /KWin reconfigure

NOTICE: that this will cause ignorance of the activation delay setting and trigger actions immediately. 
(WARNING to others: It was also *vastly* broken in older versions of KWIn, but 4.8.x should be fine)

> Using a mouse, the cursor is properly kicked out to 1,1 in the top-left corner.
What suggests "driver issue" - it will likely either do some extra smart magic on the screen border or just be broken (about warping from 0,0 to 1,1) - you can also try to
$ kwriteconfig --file kwinrc --group Windows --key ElectricBorderPushbackPixels 3

"3" is a magic number (aka random guess) and if it works that means the touchpad driver for some reason prevent warping /to/ 1,1 - otherwise it means it prevents warping /from/ 0,0
Comment 28 S. Christian Collins 2012-07-27 20:45:55 UTC
Okay, I will test this when Jared gets back from his weekend trip.
Comment 29 long.lvnh 2012-07-29 17:08:19 UTC
Setting "ElectricBorderPushbackPixels" to 2 as in comment 27 fixed the issue for me:

kwriteconfig --file kwinrc --group Windows --key ElectricBorderPushbackPixels 2
qdbus org.kde.kwin /KWin reconfigure

Which is equivalent to adding the option:
ElectricBorderPushbackPixels=2
In the section [Windows]

Now I can use again the switch to left desktop on edje !!
Thanks to everyone !!
Comment 30 S. Christian Collins 2012-07-30 00:24:00 UTC
Using ElectricBorderPushbackPixels=2 fixed the issue on Jared's laptop as well.

Previously the top-left corner behavior was this:
    Mouse: cursor kicked out to 1,1
    Trackpad: cursor remains at 0,0

After setting ElectricBorderPushbackPixels to 2, the behavior is now:
    Mouse: cursor kicked out to 2,2
    Trackpad: cursor kicked out to 1,1

This works, but I wonder what could be causing the 1 pixel offset in the trackpad's cursor.  Again, the bottom-right corner responds correctly with either mouse or trackpad.
Comment 31 Thomas Lübking 2012-07-30 20:04:16 UTC
Created attachment 72836 [details]
Cursor warping test app

Ok, many thanks everyone for investigating so far.

Attached is a simple app that warps the cursor to different locations and checks for success.
Could somebody please check how it behaves with the synaptics touchpad (maybe try moving the pointer around while running it)?
Comment 32 Stuart Hickinbottom 2012-07-30 21:20:40 UTC
I have the Synaptics touchpad ("SynPS/2 Synaptics TouchPad" according to Xorg.log, on a ThinkPad T520); the output of test test app shows a couple of mismatched lines:
cursor is now at QPoint(200,199) should be QPoint(200,200) 
cursor is now at QPoint(0,0) should be QPoint(0,0) 
cursor is now at QPoint(0,0) should be QPoint(1,1) 
cursor is now at QPoint(0,0) should NOT be QPoint(-1,-1) 
cursor is now at QPoint(0,0) should be QPoint(0,0) 
cursor is now at QPoint(1,1) should be QPoint(2,2) 

This is with ElectricBorderPushbackPixels=0, and without touching the touchpad while the test is running.
Comment 33 Thomas Lübking 2012-07-31 06:29:11 UTC
Thanks for testing - esp. the 200,199 are "strange"
Nevertheless, could you ensure there's no active screenborder in the upper left corner when running the test?

"kcmshell4 kwinscreenedges", also turn quick tiling and maximiziation off and set desktop switching to NO always enabled (ie. disabled or when dragging a window - doesn't matter)
Don't forget to "apply"
Comment 34 Michele Corazza 2012-07-31 14:30:24 UTC
I have a SynPS/2 Synaptics TouchPad (got that from Xorg.log as stuart did).
This is what I get with no active screenborders, ElectricborderPushbackPixels=0, no tiling, no maximization, no desktop switching:

cursor is now at QPoint(199,200) should be QPoint(200,200) 
cursor is now at QPoint(0,0) should be QPoint(0,0) 
cursor is now at QPoint(0,0) should be QPoint(1,1) 
cursor is now at QPoint(0,0) should NOT be QPoint(-1,-1) 
cursor is now at QPoint(0,0) should be QPoint(0,0) 
cursor is now at QPoint(2,2) should be QPoint(2,2)
Comment 35 Thomas Lübking 2012-07-31 15:32:25 UTC
Oh, great - so (at least the version of) the synaptics driver takes XWarpPointer as "suggestion"....

Please file a bugreport against synaptics or ubuntu (anyone here using another distro?)
Comment 36 Michele Corazza 2012-07-31 20:41:09 UTC
I am using arch at the moment, and I used it for the test above. I also experienced the same issue with debian sid. So probably the issue is not distro related.
Comment 37 Thomas Lübking 2012-07-31 20:52:22 UTC
(In reply to comment #36)
> I am using arch at the moment, and I used it for the test above. I also
> experienced the same issue with debian sid. So probably the issue is not
> distro related.

What version?
Ubuntu ships 1.5.99.902-0ubuntu5 while arch is currently at xf86-input-synaptics 1.6.2
Comment 38 Stuart Hickinbottom 2012-07-31 21:38:06 UTC
(In reply to comment #35)
> Oh, great - so (at least the version of) the synaptics driver takes
> XWarpPointer as "suggestion"....
> 
> Please file a bugreport against synaptics or ubuntu (anyone here using
> another distro?)

I get the same result having disabled screen edge actions and also with desktop-edge switching disabled.

I'm using Fedora 17, with  xorg-x11-drv-synaptics 1.6.2 (64 bit).
Comment 39 Michele Corazza 2012-08-01 09:25:13 UTC
(In reply to comment #37)
> (In reply to comment #36)
> > I am using arch at the moment, and I used it for the test above. I also
> > experienced the same issue with debian sid. So probably the issue is not
> > distro related.
> 
> What version?
> Ubuntu ships 1.5.99.902-0ubuntu5 while arch is currently at
> xf86-input-synaptics 1.6.2

Both arch and sid are x86_64 and they ship version 1.6.2-1 of the synaptics driver. So should we report directly to freedesktop bugzilla? And what can we report?
Comment 40 Thomas Lübking 2012-08-01 11:31:29 UTC
(In reply to comment #39)
> So should we report directly to freedesktop bugzilla?
Yes, unlikely a broken distro patch or backport in all distros.

> And what can we report?
Driver (xf86-input-synaptics), version (yours), on Hardware (yours) reacts incorrectly on XWarpPointer requests (ie. the pointer warps to a different than the requested position, 1,1 seems to be avoided)

Link this bug and the attached testcase and please make /one/ bugreport and everybody affected just sign it with "me to: hardware/driver version"
Comment 41 Michele Corazza 2012-08-01 12:35:39 UTC
Filled a bug on freedesktop, i hope it is decent: https://bugs.freedesktop.org/post_bug.cgi
Comment 42 Michele Corazza 2012-08-01 13:07:50 UTC
Wrong link... This is the correct one https://bugs.freedesktop.org/show_bug.cgi?id=53037
Comment 43 Thomas Lübking 2012-12-12 16:22:18 UTC
*** Bug 311558 has been marked as a duplicate of this bug. ***