Commit graph

15595 commits

Author SHA1 Message Date
Martin Gräßlin
c453eb696c Make WindowSwitching (Alt+Tab) the default left touch screen edge
Summary:
Based on the feedback from discussion on plasma-devel the currently only
default touch action on a screen edge should be window switching. Given
that our default window switcher is located on the left and works very
nicely for touch event it becomes the default action on the left screen.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5551
2017-05-02 20:33:21 +02:00
Martin Gräßlin
014afe1c05 [platformx/x11] Fix touch events for internal Qt windows
Summary:
To have touch events working we need to do memory layout changes on the
xcb events. This is fine for identifying the touch events which should
trigger the screen edge. But when passed on to Qt to have QtQuick windows
(e.g. Alt+Tab) handle the touch events, this results in a problem:
Qt itself does also the memory movement and then the movement is double
and touch events break.

To prevent this problem an RAII class is added which moves the memory in
the ctor and moves it back in the dtor. So during KWin's processing it
has the right memory layout and later on in Qt's processing it has the
proper "wrong" layout which Qt can fix again.

Test Plan: Touch events in Alt+Tab work

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5549
2017-05-02 20:32:58 +02:00
Martin Gräßlin
207eb167e1 [autotests/integration] Fix SceneQPainter::testWindowScaled
A code of line was missing.
2017-05-01 17:10:42 +02:00
David Edmundson
62a3b193bc Set correct KF5_MIN_VERSION 2017-05-01 13:15:17 +01:00
David Edmundson
80f21064f1 Merge branch 'scaling' 2017-04-29 14:11:13 +01:00
David Edmundson
8ef184e1cd Implement high DPI support in KWin QPA
Summary: Basically just a copy and paste from the relevant Qt Wayland
parts.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D5172
2017-04-28 10:23:14 +01:00
David Edmundson
44a6050e83 Add scaling support into BlurEffect::doBlur
Summary:
This patch caputres from the framebuffer using the framebuffer's
geometry, factoring in scale. We then keep the current normal DPI
framebuffer causing it to downsample there.

This is good because:
- it keeps the code very simple
- it's a performance optimisation. Blurring on 4k is naturally more
expensive than at regular DPI. Downsampling keeps it the same - and you
can't see a difference given it's high DPI and you're going to blur it
anwyay.
- it keeps kernel sizes somewhat resolution independent so it will look
just as blurry across multiple screens.

::doCachedBlur still needs doing.

Test Plan:
Ran an app
Ran the kwindowsystem blur test
Observed the right part of the window being blurred

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D4963
2017-04-28 10:23:14 +01:00
David Edmundson
9cb666f469 Restore the backend set viewport when popping the final render target
Summary:
The backend is responsible for setting the viewport, the GLRenderTarget
should save and restore the viewport actually set by the backend.

Test Plan:
Ran Blur effect which uses this method, under scaling the viewport "restored"
differed from the one set by the backend.

Reviewers: #plasma

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D4952
2017-04-28 10:23:14 +01:00
David Edmundson
71600d0a02 Take into account scaling in blitFromFrameBuffer
Summary:
This method already translates to s_virtualScreenGeometry as the source
co-ordinates are in compostior space we should take scaling into account here too.

This method already supports resizing if source and target sizes do not match.
Calling funcitons can either double the size of the target if they want native resolution
or leave as-is if they want the result in standard DPI.

This implements scaling in the screenshot, magnifier and simple blur effect.

Test Plan:
Tested screenshot effect using spectacle.
I hit an (unrelated, was reproducible on master) crash whilst using this, so it is not fully tested

Ran magnifier effect manually

Reviewers: #plasma

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D4951
2017-04-28 10:23:13 +01:00
David Edmundson
24c9194f4c Scaling support in ColorPicker effect
Summary:
glReadPixels needs the correct location relative to the
framebuffer so we need to factor in the scale as well as translation
when going from compositor space.

Test Plan:
Ran the plasma colour picker plasmoid in windowed mode
Clicked on multiple parts of a window
It was right every time

Reviewers: #plasma

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D4950
2017-04-28 10:23:13 +01:00
David Edmundson
f445a99a74 Support scaling in BackgroundContrast effect
Summary:
Background contrast reads pixels from the framebuffer
we need to convert from compositor to framebuffer co-ordinates
when an output is scaled

Test Plan:
Ran the manual test in kwindowsystem. Moved window over dolphin.
Visually checked output

Reviewers: #plasma

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D4949
2017-04-28 10:23:13 +01:00
David Edmundson
9ce5832e11 Store GLRenderTarget::scale
Summary:
GLRenderTarget already stores the translation from global compositor
space to the render target co-ordinates, we also need a scale factor for
the exact same reasons.

Test Plan: Used in various effects after this patch and it works there.

Reviewers: #plasma

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D4948
2017-04-28 10:23:13 +01:00
David Edmundson
86b7189b8f Implment DRM EGL scaling
Summary: We need to set the viewport so that we scale from device pixels to global compositor space.

Test Plan:
Ran kwin_wayland properly on my laptop without setting KWIN_COMPOSE.
Most things worked.

Reviewers: #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3504
2017-04-28 10:23:09 +01:00
Kai Uwe Broulik
13045bb5d7 [KWin Scripts KCM] Restore "import" option
Port it to KPackage installJob and improve usability slightly.

Differential Revision: https://phabricator.kde.org/D5318
2017-04-26 17:11:34 +02:00
Kai Uwe Broulik
eaf41cb6c5 Animate quick tiling outline
When quick tiling animate the outline from the window geometry to the position it would have afterwards.
This provides a visual hint to from where to where the window will go.

Differential Revision: https://phabricator.kde.org/D5262
2017-04-25 16:38:52 +02:00
l10n daemon script
7422c070e9 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2017-04-25 14:15:59 +02:00
Jonathan Riddell
5a0629c732 Update version number for 5.9.5
GIT_SILENT
2017-04-25 12:52:56 +01:00
l10n daemon script
dc447860be SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2017-04-25 10:05:35 +02:00
Martin Gräßlin
857d8a9c37 Add a KSharedConfigPtr for kcminputrc to KWin::Application
Summary:
There are a few places where KWin needs to read values from kcminputrc.
As I need to add yet another one it makes more sense to properly
structure it like in other cases and have only one kcminputrc hold in
the application. This also allows to better mock the config values in
the integration tests.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5540
2017-04-24 21:01:03 +02:00
Martin Gräßlin
a039c2760f Handle modifier updates in the same sequence as Wayland does
Summary:
Consider the case that capslock gets pressed and released.
In the case of Weston we have a sequence of:
 1. Key press event
 2. Modifier changed event
 3. Key release event
 4. Modifier changed event

KWin however used to send the events in the following sequence:
 1. Modifier changed event (on key press)
 2. Key press event
 3. Modifier changed event (on key release)
 4. Key release event

It looks like Xwayland is not able to properly process the sequence
sent by KWin. And in fact KWin's sequence is wrong as it sends a state
which does not match. We report that the caps lock is pressed in the
modifiers prior to the application getting informed about the key press
of caps lock.

This change aligns KWin's implementation to the behavior of Weston. The
main difference is that when modifiers change Xkb internally caches the
serialized modifier states. And KeyboardInputRedirection just forwards
the modifiers to KWayland::Server::SeatInterface once the processing has
finished. SeatInterface ignores the forwarding if no states changes, so
it is fine to do it that way.

BUG: 377155

Test Plan:
Not yet tested with an affected Xwayland as I only have 1.18 and the
problem started with 1.19. But verified the sequence of events with WAYLAND_DEBUG
and caps lock stil working in QtWayland clients and Xwayland 1.18

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5452
2017-04-24 21:00:30 +02:00
Martin Gräßlin
f3b20b482e Use end() instead of constEnd() for where we compare to an iterator 2017-04-22 20:28:12 +02:00
Martin Gräßlin
eec6afe6f5 Don't map screenedge approach window if edge is only used for touch
Summary:
Another regression from enabling touch support on X11.
The approach window for pointer input gets unmapped as soon as the mouse
enters the window. This ensures that mouse motion events are not stolen
from other applications. But with the touch events we did not even react
on the enter event if it's not activated for pointer. The result was an
area around the screenedge being blocked for pointer input.

This change only creates and maps the approach window if the edge is
activated for pointer input.

BUG: 378951

Test Plan:
Activated edges through pointer and touch, reconfigured and tested
motion events

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5528
2017-04-22 08:17:59 +02:00
Martin Gräßlin
ac08c5ac9d [plugins/qpa] Do not replace a valid FBO with an invalid one
Summary:
With the TabBox I observed the following issue:
 1: trigger TabBox through screen edge
 2: exit TabBox
 3: trigger TabBox again through screen edge

Actual behavior: in step 3 the GUI does not show. If now using Alt+Tab
to show the TabBox the gui shows, but through screen edge it stays
broken.

Investigation showed that the difference is a direct show in screen edge
case and a delayed show in Alt+Tab case. Futher investigation shows that
an invalid geometry gets requested in the broken case. While this might
indicate an issue in another area it makes sense to protect KWin
internally against it and not to break rendering.

Thus this change ensures that a valid FBO does not get replaced by an
invalid sized FBO.

Test Plan:
Tested that Alt+Tab works correctly when triggered through
edge

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5438
2017-04-22 08:17:33 +02:00
Martin Gräßlin
e9a44a275e Support blocking of screen edges on active fullscreen windows also for touch
Summary:
This change ensures that the blocking condition of screen edges is also
honored for touch screen swipe gestures.

Test Plan: Only the added test case

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5403
2017-04-22 08:16:31 +02:00
Martin Gräßlin
b132fe7c24 Add support for keyboard layout switching policy "winclass"
Summary:
This is quite similar to the policy "window" - the main difference is
that windows from the same application share the layout. So only
switching to a window from another application changes the layout.

This change is the last policy to add for support of all the policies we
have on X11.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D5365
2017-04-22 08:15:59 +02:00
Martin Gräßlin
c8274dbe57 Add support for keyboard layout switching policy "window"
Summary:
This policy stores the layout for each window which becomes active
and restores the layout once it gets activated again.

Test Plan: Added test case

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D5315
2017-04-22 08:15:45 +02:00
Martin Gräßlin
bf99d9ffdd Introduce support for keyboard layout switching policies
Summary:
This change introduces the initial support for keyboard layout switching
policies like in the X11 session. This first change only adds support for
Global and Virtual Desktop policy. This means the current layout is
stored in context to the current virtual desktop. Whenever one changes
the virtual desktop the previous layout is restored. If the user has not
yet navigated to this virtual desktop a switch to default layout is
performed.

This is the first code interacting with the new Virtual Desktop API which
is not based on integer ids. To fully support this the API is slightly
extended.

Test Plan: Added test case

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5301
2017-04-22 08:15:25 +02:00
Martin Gräßlin
a5735e19b9 [platforms/x11] Do not grab touch events
Summary:
Grabbing the touch events seems to cause issues. It seems to also grab
pointer events from touchpad and breaks touch input on other events.

Also testing shows that we don't need it and get touch ownership events
for our screenedge windows reported.

BUG: 378951

Test Plan: Triggered touch screen edge, normal system usage on X11

Reviewers: #plasma, #kwin

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5520
2017-04-20 17:03:38 +02:00
Martin Gräßlin
919b497f90 [effects/slideback] Consider windows which do have painting disabled as not usable
Summary:
On Wayland it can happen that a window is still in the stacking order
although it is not visible. This is mostly the case for Plasma windows.
So far the slideback effect did not ignore those windows and as they are
higher in the stacking order than most other windows it blocked the
effect from working once a Plasma panel element got closed.

This change considers a window which has painting disabled in the
stacking order as not usable and thus filters out all those windows.

BUG: 364483

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5462
2017-04-20 17:03:12 +02:00
Martin Gräßlin
9a13743c49 Don't update the focused pointer Surface if a button is pressed
Summary:
During pointer motion we already had the condition that an update of
focused pointer surface can only happen when no button is pressed. But
there are more conditions where we try to update the focused pointer even
if a button is pressed. E.g. if the stacking order changes.

This happens when trying to move one of Qt's dock widgets:
 1. Press inside a dock widget
 2. Qt opens another window, which is underneath the cursor
 3. KWin sends pointer leave to parent window
 4. dock widget movement breaks

This change ensures that also this sequence works as expected and the
pointer gets only updated when there are no buttons pressed, no matter
from where we go into the update code path.

BUG: 372876

Test Plan: Dock widgets in Dolphin can be moved now.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5461
2017-04-20 17:02:42 +02:00
Martin Gräßlin
c3ecf55bf8 Do not handle ScreenEdges::check for Edges which don't activate for Pointer
Summary:
On X11 the edges reserved only for pointer started to show the approach
geometry. This problem is addressed by this change.

Touch screen events do not go through this method, neither is it used on
Wayland.

Test Plan: Tested on X11, problem fixed

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5421
2017-04-20 17:02:16 +02:00
l10n daemon script
873a51cc62 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2017-04-20 04:17:52 +02:00
Luboš Luňák
1427dbad9b remove executable bit from a .cpp file 2017-04-19 12:39:42 +02:00
l10n daemon script
4a5734c3c4 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2017-04-17 04:05:09 +02:00
l10n daemon script
bca3dcf939 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2017-04-16 05:16:50 +02:00
l10n daemon script
4c3404e150 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2017-04-16 04:05:25 +02:00
Martin Gräßlin
2132b1e0c8 [effects] Use arg="true" in the kcfg files
Summary:
By changing all kcfg to have arg="true" we can pass in the same
KSharedConfigPtr into all effects. This allows to have fake config in
the tests and in the planned effect demo mode.

Also it means that we don't have to hardcode the name kwinrc into the
files. In the configs - where we cannot access the effectshandler - we
use the define KWIN_CONFIG which gets generated based on the compile
time arguments.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3571
2017-04-15 10:03:34 +02:00
Luboš Luňák
af9f81700f fix uninitialized variable
Accessed later if e.g. compositing is suspended or not possible at startup.
2017-04-14 15:03:27 +02:00
David Edmundson
440bca8b45 Merge branch 'Plasma/5.9' 2017-04-13 11:59:36 +01:00
David Edmundson
55f2e72ce7 Merge branch 'Plasma/5.8' into Plasma/5.9 2017-04-13 11:55:52 +01:00
David Edmundson
f5a43877a9 Sort the themes in decoration KCM
Summary:
Even though we're using a QSortFilterProxy model, by default it doesn't
actually sort anything until instructed to.

This patch turns sorting on.

Test Plan:
Opened the KCM
Looked at it

Reviewers: #plasma, mart

Reviewed By: mart

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5407
2017-04-13 11:54:44 +01:00
David Edmundson
3709996f8a Fix KWin decoration KCM showing correct index at startup
Summary:
The KCM has a context property of the currently set theme index. This is
set before the decorations model is populated, so it is currently always
-1.

This model is populated after the constructor but before
KCModule::load().

KCModule::load is called from KCModule::showEvent so before
QQuickGridView will start doing anything with delegates.

This fixes the problem simply and also avoid parsing the config file
multiple times.

This bug was introduced in 5.9.4:

Someone made a (tested) change to make sure the view scrolled to the
right place on startup.
I then made a (tested) commit fixing the crash on exit
The author then updated his patch to my changes, but now in a way that
didn't work.

Test Plan:
Opened system settings module with a million decorations.
The correct entry was visible and highlighted.

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5401
2017-04-13 11:54:39 +01:00
l10n daemon script
819c645863 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2017-04-13 05:26:57 +02:00
Martin Gräßlin
259e373bfc [tabbox] Expose noModifierGrab to QtQuick
Summary:
There is a special mode in TabBox which is the noModifierGrab mode. This
is Alt+Tab active without a modifier being hold. This mode is entered
when being activated through screen edges (either pointer or touch). So
far this was not exposed to QtQuick and thus one could not end the mode
using pointer or touch. It is possible to select another window, but not
to activate it. That required the press of a keyboard key.

This setup is rather unfortunate. By exposing the mode to QtQuick we can
react from QtQuick side to it and invoke already exposed functionality to
select and item and directly activate it - existing left-over from the
Plasma Active window switcher.

Test Plan:
Tested on X11 and Wayland with an adjusted lnf package. It kind
of works, but there are additional issues on both X11 and Wayland.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5414
2017-04-12 19:46:48 +02:00
David Edmundson
5cf05361ac Merge branch 'Plasma/5.9' 2017-04-12 18:23:30 +01:00
David Edmundson
944e723400 Merge branch 'Plasma/5.8' into Plasma/5.9 2017-04-12 18:18:33 +01:00
Martin Gräßlin
4ca3d0d943 [platforms/drm] Explicitly request event context version 2
Summary:
Libdrm 2.4.78 introduces a version 2 and if KWin gets built against it
our code would break. Given that this change is for Plasma/5.8 branch.

Closes T5839

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Maniphest Tasks: T5839

Differential Revision: https://phabricator.kde.org/D5380
2017-04-12 18:16:58 +01:00
Vladyslav Tronko
1bfe1164f4 Fix crash on dragging titlebar buttons in System Settings
Summary:
Currently, if user tries to move one of buttons to the left, ending up
dragging one button onto another, crash occurs.

In addition, this patch replaces verbose replacement(remove/insert) with
more elegant QVector<T>::move(int, int)

BUG: 374153
FIXED-IN: 5.8.7

Reviewers: graesslin, #kwin

Reviewed By: graesslin, #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5117
2017-04-12 18:16:52 +01:00
Anthony Fieroni
c3362fe866 [kcm_kwindecoration] Respect theme colors in buttons
https://phabricator.kde.org/D5116

Signed-off-by: Anthony Fieroni <bvbfan@abv.bg>
2017-04-12 18:16:41 +01:00
Martin Gräßlin
3259d5e113 Cancel popup if the user clicked window decoration of parent window
Summary:
So far the window decoration was not considered and e.g. right clicking
the window decoration resulted in two open popups - one by KWin and one
by the application. This change addresses the problem by ensuring the
popup gets cancelled if the decoration is clicked. It's considered not
being part of the window.

Test Plan: Added test case which fails without the change

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5388
2017-04-11 20:22:32 +02:00