Bug 387775 - KWin touch screen edge creates a 1 pixel dead zone on that edge that doesn't accept mouse clicks or scrolls outside of full-screen mode
Summary: KWin touch screen edge creates a 1 pixel dead zone on that edge that doesn't ...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: input (show other bugs)
Version: 5.14.4
Platform: Neon Linux
: VHI normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: usability
: 386735 391084 394819 397160 407748 407840 408646 415534 416017 421487 421866 422674 422791 422806 422813 424096 425338 443202 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-12-10 13:56 UTC by darktori
Modified: 2021-10-04 22:15 UTC (History)
35 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.21
nate: Wayland-
nate: X11+


Attachments
Cursor moved to the far left, right click and scroll not working (19.84 KB, image/png)
2017-12-10 15:21 UTC, darktori
Details
Cursor moved slightly to the right from the edge, right click and scroll now working (47.76 KB, image/png)
2017-12-10 15:22 UTC, darktori
Details

Note You need to log in before you can comment on or make changes to this bug.
Description darktori 2017-12-10 13:56:07 UTC
When I put the panel on the left side there seems to be a gap between the panel and the edge of the screen.

Reproduction:
put panel on the left side
move mouse as far to the left as possible
try right click -> instead of panel context menu, nothing appears
try mouse wheel scroll -> instead of switching between open windows, nothing happens

To be clear, when the panel is on the right side, and I move the mouse to the right edge of the screen, both right click and mouse scroll interact as normal.

I remember this worked before on the same setup around plasma 5.8, sorry I don't  have a better estimate when was this introduced.
Comment 1 David Edmundson 2017-12-10 15:16:54 UTC
screenshot please
Comment 2 darktori 2017-12-10 15:21:49 UTC
Created attachment 109298 [details]
Cursor moved to the far left, right click and scroll not working
Comment 3 darktori 2017-12-10 15:22:52 UTC
Created attachment 109299 [details]
Cursor moved slightly to the right from the edge, right click and scroll now working
Comment 4 darktori 2017-12-10 17:18:17 UTC
Did the screenshots clarify the issue David?
Comment 5 Nate Graham 2017-12-11 06:00:38 UTC
I hit this before in Bug 386735. The issue is a KWin left screen edge action or top hot corner; they create the one-pixel dead zone. Turning them off will work around the issue. If we don't have another bug tracking that already, perhaps this will do.
Comment 6 darktori 2017-12-12 21:14:25 UTC
Nate, you were correct. It was the left screen edge for touch screen option (even though I don't have a touch screen).
Comment 7 Nate Graham 2017-12-12 21:17:33 UTC
David, do you know if this is a bug in Plasmashell or KWin?
Comment 8 David Edmundson 2017-12-12 22:51:13 UTC
Like most bugs, both. 

Independently they do the right thing, together they fail.
Comment 9 Kai Uwe Broulik 2017-12-12 22:53:01 UTC
The dead edge would be a KWin bug, though. There used to be a bug in here where it would reserve a corner erroneously which was fixed but apparently there's still something wonky.
Comment 10 Nate Graham 2017-12-13 17:35:17 UTC
Related: https://bugs.kde.org/show_bug.cgi?id=380476

The issue is only present in X11, not Wayland. I'm almost positive it's the same thing. 380476 fixed the issue for fullscreen windows. But the the Panel isn't a full-screen window, so the the issue persists there.

We now have another significant use case that the invisible 1-px window breaks: panels aligned to the left screen edge (usually holding an Icons-Only Task Manager). The invisible 1px window makes task manager buttons not accept input on the screen edges.
Comment 11 Nate Graham 2017-12-13 17:38:07 UTC
*** Bug 386735 has been marked as a duplicate of this bug. ***
Comment 12 delshole 2017-12-21 12:56:04 UTC
I've just upgraded to Kubuntu 17.10 which has kwin 5.10.5, and I think I have an issue which duplicates this.

I have a panel across the bottom of the screen. In the bottom left corner I have a konsole icon and in the bottom right corner I have a dolphin icon. These are my most frequently used applications, and I can access them very quickly by sending the mouse bottom right then click, or bottom left then click.

Only after the upgrade this no longer works. The very corner pixels, where the mouse pointer moves to, are dead zones. It works if I move the mouse up one pixel or sideways one pixel, but the very corner pixel is dead.
Comment 13 Nate Graham 2018-02-26 21:51:05 UTC
*** Bug 391084 has been marked as a duplicate of this bug. ***
Comment 14 Patrick Silva 2018-06-14 18:07:49 UTC
*** Bug 394819 has been marked as a duplicate of this bug. ***
Comment 15 Ahmed Hamdy 2018-08-19 16:11:45 UTC
I have the same problem on arch linux with the latest version of kwin 5.13.4-1
Comment 16 taocrismon 2018-12-26 07:40:02 UTC
Can confirm this bug on Plasma/Kwin 5.14.4, on both Neon and Fedora 29.
Comment 17 Vlad Zahorodnii 2019-05-20 08:30:45 UTC
*** Bug 407748 has been marked as a duplicate of this bug. ***
Comment 18 Ralf Jung 2019-05-20 09:11:49 UTC
> I hit this before in Bug 386735. The issue is a KWin left screen edge action or top hot corner; they create the one-pixel dead zone. Turning them off will work around the issue.

Thanks a lot, I can confirm that this works. However, KWin has to be restarted after turning off the edge action.
Comment 19 Nate Graham 2019-05-25 14:45:44 UTC
*** Bug 407840 has been marked as a duplicate of this bug. ***
Comment 20 Nate Graham 2019-05-26 19:10:22 UTC
*** Bug 397160 has been marked as a duplicate of this bug. ***
Comment 21 Nate Graham 2019-06-13 20:45:31 UTC
*** Bug 408646 has been marked as a duplicate of this bug. ***
Comment 22 Lazarus Marhenke 2019-07-30 00:40:35 UTC
(In reply to Ralf Jung from comment #18)
> > I hit this before in Bug 386735. The issue is a KWin left screen edge action or top hot corner; they create the one-pixel dead zone. Turning them off will work around the issue.
> 
> Thanks a lot, I can confirm that this works. However, KWin has to be
> restarted after turning off the edge action.

In my case restarting kwin wasn't enough. I had to restart the session (log out and log back in).
Comment 23 Nate Graham 2020-01-12 17:03:29 UTC
*** Bug 416017 has been marked as a duplicate of this bug. ***
Comment 24 Matthew Sheffield 2020-01-27 21:33:57 UTC
*** Bug 415534 has been marked as a duplicate of this bug. ***
Comment 25 Patrick Silva 2020-05-21 18:18:42 UTC
*** Bug 421866 has been marked as a duplicate of this bug. ***
Comment 26 Matej Mrenica 2020-05-21 18:21:32 UTC
Would it be possible to hide the touch screen gesture settings page when there isn't a touch screen present?
Comment 27 Patrick Silva 2020-05-21 18:28:37 UTC
I think not. There is a bug about it: bug 397870
Comment 28 Patrick Silva 2020-06-09 23:25:33 UTC
*** Bug 422674 has been marked as a duplicate of this bug. ***
Comment 29 Maciej Stanczew 2020-06-10 02:07:44 UTC
Regarding bug 422674: until Plasma 5.19, mouse clicks at X = 0 worked at least on title bars and bottom panels. Starting from 5.19 it seems that all mouse clicks at X = 0 do nothing.
Comment 30 Nate Graham 2020-06-11 13:13:06 UTC
*** Bug 422791 has been marked as a duplicate of this bug. ***
Comment 31 Nate Graham 2020-06-11 13:13:39 UTC
*** Bug 422806 has been marked as a duplicate of this bug. ***
Comment 32 Nate Graham 2020-06-11 13:14:14 UTC
Yes, it appears that this has regressed in Plasma 5.19 and now eats all clicks. Fixing it or disabling it on X11 has become urgent.
Comment 33 Patrick Silva 2020-06-11 20:38:08 UTC
*** Bug 422813 has been marked as a duplicate of this bug. ***
Comment 34 Patrick Silva 2020-06-20 11:19:06 UTC
*** Bug 421487 has been marked as a duplicate of this bug. ***
Comment 35 Chris Holland 2020-06-21 18:50:16 UTC
I tried using `xprop` and `xwininfo` then clicking the bottom left corner to find out it's properties.

    $ xprop
    XdndAware(ATOM) = ATOM
    
    $ xwininfo
    xwininfo: Window id: 0xbfaa2f8 (has no name)
      Absolute upper-left X:  0
      Absolute upper-left Y:  -16255
      Relative upper-left X:  0
      Relative upper-left Y:  -16255
      Width: 1
      Height: 33590
      Depth: 0
      Visual: 0x21
      Visual Class: TrueColor
      Border width: 0
      Class: InputOnly
      Colormap: 0x0 (not installed)
      Bit Gravity State: ForgetGravity
      Window Gravity State: NorthWestGravity
      Backing Store State: NotUseful
      Save Under State: no
      Map State: IsViewable
      Override Redirect State: yes
      Corners:  +0+-16255  -1919+-16255  -1919--16255  +0--16255
      -geometry 1x33590+0+-16255

A 1x33590 window? Oh: 33590-16255-16255=1080

    $ xwininfo -root -tree | grep 33590 -B10 -A10
         0x1800004 "Qt Selection Owner for xembedsniproxy": ()  3x3+0+0  +0+0
         0x1a00004 "Qt Selection Owner for kaccess": ()  3x3+0+0  +0+0
         0xa00004 "Qt Selection Owner for kwalletd5": ()  3x3+0+0  +0+0
         0x1600005 (has no name): ()  1x1+0+0  +0+0
         0x1600004 "Qt Selection Owner for ksmserver": ()  3x3+0+0  +0+0
         0x1200004 "Qt Selection Owner for kglobalaccel5": ()  3x3+0+0  +0+0
         0xe00005 (has no name): ()  1x1+0+0  +0+0
         0xe00004 "Qt Selection Owner for kactivitymanagerd": ()  3x3+0+0  +0+0
         0xc00004 "Qt Selection Owner for kded5": ()  3x3+0+0  +0+0
         0xbe00007 "KWin": ()  1x1+0+0  +0+0
         0xbfaa2f8 (has no name): ()  1x33590+0+-16255  +0+-16255
         0xbfaaf6e (has no name): ()  1920x525+0+0  +0+0
            1 child:
            0xbfaaf6f (has no name): ()  1920x525+0+0  +0+0
               1 child:
               0x2600007 "kwin : bash — Yakuake": ("yakuake" "yakuake")  1920x525+0+0  +0+0
         0xbe00036 (has no name): ()  1920x30+0+1050  +0+1050
            1 child:
            0xbe00037 (has no name): ()  1920x30+0+0  +0+1050
               1 child:
               0x1e00034 "Plasma": ("plasmashell" "plasmashell")  1920x30+0+0  +0+1050

Testing an old neon-testing-20200512-1045.iso (Plasma 5.18.5?), the bug doesn't exist. The Bottom Left corner works. Also, by hiding the titlebar in breeze deco, I confirmed that kwin isn't treating titlebars special, the dead zone just doesn't cover the top corners.

Here's `xwininfo` from clicking the middle-left of the screen from the ISO:

    $ xwininfo
    xwininfo: Window id: 0x2600024 (has no name)
      Absolute upper-left X:  0
      Absolute upper-left Y:  32
      Relative upper-left X:  0
      Relative upper-left Y:  32
      Width: 1
      Height: 1016
      Depth: 0
      Visual: 0x21
      Visual Class: TrueColor
      Border width: 0
      Class: InputOnly
      Colormap: 0x0 (not installed)
      Bit Gravity State: ForgetGravity
      Window Gravity State: NorthWestGravity
      Backing Store State: NotUseful
      Save Under State: no
      Map State: IsViewable
      Override Redirect State: yes
      Corners:  +0+32  -1919+32  -1919-32  +0-32
      -geometry 1x1016+0+32

So calculating 1080-1016 = 64. 64/2 = 32.

    $ xwininfo -root -tree | grep 0x2600024 -B10 -A10
         ...
         0x2600007 "KWin": ()  1x1+0+0  +0+0
         0x260002f (has no name): ()  1x1+0+0  +0+0
         0x2600030 (has no name): ()  32x32+0+0  +0+0
         0x2600024 (has no name): ()  1x1016+0+32  +0+32

The 1x1 is probably the "screen edge" click hotspot.

32x32+0+0 could be the default top-left "screen edge" hover effect, as it disappears when disable screenedge in system settings. It only appears for the "Toggle Window Switching" option. The 32x32 window isn't created for the "Show Desktop" option, even though the hover/glow effect is still drawn. So it's **not** the glow.

So lets git clone kwin, then checkout the `Plasma/5.19` branch.

* https://invent.kde.org/plasma/kwin/-/blob/master/screenedge.cpp
* https://invent.kde.org/plasma/kwin/-/blob/master/screens.cpp
* https://invent.kde.org/plasma/kwin/-/blob/master/outputscreens.cpp

Looking at the logic of `m_cornerOffset`, this is what is intended assuming dpi is the default `96`:

    ScreenEdges::ScreenEdges(...)
      m_cornerOffset = (Screens::self()->physicalDpiX(0) + Screens::self()->physicalDpiX(0) + 5) / 6
      m_cornerOffset = (96 + 96 + 5) / 6
      m_cornerOffset = (int)32.83333333333333
      m_cornerOffset = 32

Adding some logging to `screenedge.cpp` and `screens.cpp` and `outputscreens.cpp`, we get:

    kwin.screens: size(screen) QSize(1920, 1080)
    kwin.outputscreens: OutputScreens::physicalSize output KWin::X11Output(0x5645237ce1a0)
    kwin.outputscreens: OutputScreens::physicalSize return output->physicalSize() QSize(-1, -1)
    kwin.screens: physicalSize(screen) QSizeF(-1, -1)
    kwin.screenedge: Screens::self()->physicalDpiX(0) -48768
    kwin.screenedge: Screens::self()->physicalDpiY(0) -27432
    kwin.screenedge: ScreenEdge::m_cornerOffset -16255


TLDR:
So `X11Output::physicalSize()` is returning `(-1,-1)`. This calculates a `m_cornerOffset` of `-16255`. So the 1px Left ScreenEdge "dead zone" is scaled into where the top-left and bottom-left corners should be.
Comment 36 Chris Holland 2020-06-21 19:57:39 UTC
Ooops. I wasn't testing kwin's Plasma/5.19 branch properly. `m_cornerOffset` is fixed in Plasma 5.19.2:

* https://invent.kde.org/plasma/kwin/commit/bc2df9f84be7ff12ab7e67ee7931eae1f5aeacce
* https://bugs.kde.org/show_bug.cgi?id=422816

Now that I think of it, this bug is titled "1px dead zone", not "bottom-left fitt's law is broken". The 1px dead zone still exists on the left-center edge of the screen, so I guess that's why this bug is still open.

I was testing by running `./build/bin/kwin_x11`. However to properly test `X11Output` and `X11StandalonePlatform` we need to install it to `org.kde.kwin.platforms/KWinX11Platform.so`. Doing so will crash kwin, but it should auto-restart.

    cd /usr/lib/qt/plugins/org.kde.kwin.platforms
    sudo cp ./KWinX11Platform.so ./KWinX11Platform.so.bak
    sudo cp ~/Code/kde/kwin/build/org.kde.kwin.platforms/KWinX11Platform.so ./

When testing it shows:

    kwin.test: X11StandalonePlatform::doUpdateOutputs()
    kwin.test:     new X11Output KWin::X11Output(0x562e35e96600)
    kwin.test:     outputInfo[ 0 ] KWin::X11Output(0x562e35e96600)
    kwin.test:         name "DVI-I-0"
    kwin.test:         mm_width 477
    kwin.test:         mm_height 268
    kwin.test:         physicalSize QSize(477, 268)

    kwin.test: Screens::physicalDpiX size(screen) QSize(1920, 1080)

    kwin.test: OutputScreens::physicalSize output KWin::X11Output(0x562e35e96600)
    kwin.test: OutputScreens::physicalSize return output->physicalSize() QSize(477, 268)
    kwin.test: X11Output::physicalSize QSize(477, 268)

    kwin.test: ScreenEdges Screens::self()->physicalDpiX(0) 102
    kwin.test: ScreenEdges Screens::self()->physicalDpiY(0) 102
    kwin.test: ScreenEdges m_cornerOffset 34
Comment 37 Nate Graham 2020-06-27 22:45:40 UTC
@davidedmundson @vlad

I would like to propose hiding this KCM and disabling the functionality on X11, since we don't seem to be able to fix this bug and it already works fine on Wayland.

Are you okay with that?
Comment 38 Nate Graham 2020-06-27 23:35:05 UTC
Or alternatively, is it actually possible to fix this but on X11? That would obviously be preferred.
Comment 39 Nate Graham 2020-07-12 14:22:17 UTC
*** Bug 424096 has been marked as a duplicate of this bug. ***
Comment 40 Vlad Zahorodnii 2020-09-24 13:14:20 UTC
*** Bug 425338 has been marked as a duplicate of this bug. ***
Comment 41 Bug Janitor Service 2020-10-20 17:15:21 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/369
Comment 42 vyacheslav 2020-10-20 21:07:02 UTC
Following c++ code removes this stupid 1 pixel area. It can be compiled and placed to autostart or executed manually. After changing some system settings (for example after changing system font) it is need to run it again.
It is fix this bug for me.


#include <QApplication>
#include <QtX11Extras/QX11Info>
#include <qe/Debug.h>
#include <xcb/xcb.h>

int main(int argc, char* argv[])
{
   QApplication app(argc, argv);

   xcb_connection_t* conn = QX11Info::connection();
   xcb_query_tree_cookie_t cookie = xcb_query_tree(conn, QX11Info::appRootWindow());
   if (xcb_query_tree_reply_t* reply = xcb_query_tree_reply(conn, cookie, NULL))
   {
      xcb_window_t* children = xcb_query_tree_children(reply);
      for(int i = 0, size = xcb_query_tree_children_length(reply); i < size; i++)
      {
         xcb_get_geometry_cookie_t cookie = xcb_get_geometry(conn, children[i]);
         if (xcb_get_geometry_reply_t* geomReply = xcb_get_geometry_reply(conn, cookie, NULL))
         {
            if (geomReply->x == 0 && geomReply->width == 1)
            {
               if (geomReply->height > 500)
               {
                  const static uint32_t values[] = { 1, 1 };
                  xcb_configure_window(conn, children[i], XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, values);
               }
            }
            free(geomReply);
         }
      }
      free(reply);
   }
   return 0;
}
Comment 43 Nate Graham 2020-11-20 14:25:27 UTC
Git commit 3df7985570c748cc47362de9bbae0eb580f8f839 by Nate Graham.
Committed on 20/11/2020 at 14:25.
Pushed by ngraham into branch 'master'.

[kcmkwin/kwinscreenedges] Disable left touch edge by default

On X11, it creates a dead pixel on the left edge which interferes with
left panels, the left-nost widget on bottom and top panels, and scroll
events on the left-most pixel in various apps.

It works properly on Wayland, but unfortunately turning it off by
default only on X11 but not Wayland is not easily doable. So let's turn
it off by default everywhere.
FIXED-IN: 5.21

M  +1    -1    kcmkwin/kwinscreenedges/kwintouchscreensettings.kcfg
M  +1    -1    tabbox/tabbox.cpp

https://invent.kde.org/plasma/kwin/commit/3df7985570c748cc47362de9bbae0eb580f8f839
Comment 44 Nate Graham 2021-10-04 22:15:37 UTC
*** Bug 443202 has been marked as a duplicate of this bug. ***