Commit Graph

73 Commits (4c9c0c51433d8fea6cd3fc8bd6a4e51031863a3d)

Author SHA1 Message Date
Martin Gräßlin e73a86d420 Create screen edge through the Platform
Removes a diversion between X11 and Wayland. The base class Platform
creates an instance of class Edge with plugin implementations being
able to create a different type.

The X11StandalonePlugin does that and creates a WindowBasedEdge. For
this the implementation of WindowBasedEdge is moved from screenedges
into the plugin.

Unfortunately an ifdef is needed to make the screenedge test still
work as expected. This should be improved in future, e.g. have a good
way to load the platform plugin from the tests.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1419
2016-04-19 13:29:55 +02:00
Martin Gräßlin 736ad55e37 Add ::window() and ::approachWindow as virtual methods to Edge
This allows to no longer needing to dynamic cast the Edge to
WindowBasedEdge for the X11 specific event handling.
2016-04-19 13:29:55 +02:00
Martin Gräßlin 80995fc205 Remove the AreaBasedEdge class
No difference to Edge.
2016-04-19 13:29:55 +02:00
Martin Gräßlin 9b917a20fe ScreenEdgeInputFilter for checking whether a screenedge gets activated
So far the area based edges connected directly to global pointer pos
changed in InputRedirection. This didn't allow proper checking whether
the edge was triggered (e.g. missing timestamp).

This change merges the functionality into the new input filter mechanism.
There is now a dedicated input filter for screen edges, installed after
lock screen and before effects. It always passes events on, but also passes
all events through ScreenEdges to handle the activation. As it's installed
after the lock screen filter we don't need to check for screen locked any
more.

The code is now similar strucutured to the existing X11 based variants
and maybe will allow to also merge the X11 variant with the new one.
2016-02-11 15:56:40 +01:00
Martin Gräßlin 4d883a9cda Ensure pointer position is updated before screen locker enforcement
We need to update the pointer position, also if the screen is locked.
Otherwise the pointer doesn't move on the locked screen with libinput.

In addition we need to use the m_globalPointer for finding the correct
lock screen window as updatePointerWindow also does sanity checking on
the coordinates.

Also we need to introduce security checks where we use the signal.

REVIEW: 126103
2015-11-18 14:42:23 +01:00
David Edmundson cd9f43af7d don't activate clients (autohide) if we're dragging a window
BUG: 352267
REVIEW: 125867
2015-10-31 13:25:53 +00:00
Martin Gräßlin 5d37ccfce0 Drop PreventScreenLocking electric border
It was broken on so many ways, it's unbelievable:
* action was read but did nothing
* config was saved into a different file than read from

REVIEW: 125701
CCBUG: 331841
2015-10-21 08:14:50 +02:00
Martin Gräßlin c408e9ccec Drop remaning code for ShowDashboard
Removes the ElectricAction for ShowDashboard and the relevant code
in screenedges and the KCM.

Also a leftover in the glide effect.

REVIEW: 125700
BUG: 353928
2015-10-21 08:12:01 +02:00
David Edmundson 04ab8554aa Add hint similar to autohide to raise/lower a window
Add action type to screen edge show to allow raise/lower as well as
autohide

Add an action type to screen edge show to allow raise/lower as well as
autohide. This uses the same atom, using a mask to separate type and
location.

The logic for handling geometry changes is moved from the screenedge to
the client so that we can handle both types without screenedge needing
to know what the raise is for.

REVIEW: 124272
2015-10-12 10:37:16 +01:00
Martin Gräßlin 8073d851c4 [screenedges] Add a missing context to connect
Lambda capturing this should get disconnected when this gets destroyed.
2015-09-30 10:48:11 +02:00
Thomas Lübking 1d3a1aa061 restore linked screenedges times
commit c6bd68d78a2e00ce094a4087c106aaf4067f9f57 fixed a bug
that allowed early invocation when pushback was forced down.
However, it also turned activation and re-activation time
additive again (ie. invocation could only happen after
r+a ms instead of after r ms)

see also REVIEW 124888
REVIEW: 125143
2015-09-29 22:59:13 +02:00
Thomas Lübking 9139cca72c never trigger edges during the cooldown
regardless of whether the pushback is forced down or the user
has deactivated it or whatever. The edge is waiting from previous
activation and we need to prevent immediate reactivation since that
may cause duplicate action and unwanted state toggles

BUG: 351627
CCBUG: 351869
FIXED-IN: 5.4.1
REVIEW: 124888
2015-08-27 22:21:14 +02:00
Thomas Lübking b7bb7222f4 do not call showOnScreenEdge for *all* clients
when managing them or they change their geometry
what will (aside the overehad) randomly show them
on screen

REVIEW: 124814
2015-08-19 12:31:49 +02:00
Thomas Lübking f887c7d4ee Merge branch 'Plasma/5.3' 2015-06-03 21:40:08 +02:00
Thomas Lübking c4140d6f4e Show autohiding panels instantly
this probably makes sense since it won't
have major impact on the workspace like
switching the VD or entering
presentwindows/desktopgrid would

REVIEW: 123904
2015-06-03 21:17:54 +02:00
Thomas Lübking 0508528461 # This is a combination of 2 commits.
# The first commit's message is:

do not switch desktop on resizing windows

REVIEW: 123599

# The 2nd commit message will be skipped:

#	fix screenedge flipping merge
2015-05-15 23:55:26 +02:00
Thomas Lübking 5d09eaae1f do not switch desktop on resizing windows
REVIEW: 123599
2015-05-15 21:58:37 +02:00
Martin Gräßlin f55c086007 Change Workspace::clientRemoved to carry an AbstractClient
At the same time emit it when a ShellClient get's removed. This ensures
it gets removed from e.g. the FocusChain.
2015-05-08 12:43:47 +02:00
Martin Gräßlin 3ad117ac28 Workspace::activeClient returns an AbstractClient
Still a few casts in some areas as setting activeClient still takes
a Client.
2015-05-08 12:43:45 +02:00
Martin Gräßlin 4b41c33268 Workspace::movingClient changed to AbstractClient
In events.cpp it's casted to Client as it's X11 specific.
In InputRedirections it's kind of broken, but window movement is
anyway broken.
2015-05-08 12:43:45 +02:00
Thomas Lübking ec8f7e1fac ensure disjunct screenedges on overlapping screens
If two or more screens overlap (partially or fully)
we must not create double edges since kwin would
trigger both - since they've the same actions bound
(for sure) the action will called twice (so either
eg. toggle or skip one VD etc.)

BUG: 338381
REVIEW: 120060
2014-11-27 20:01:10 +01:00
Martin Gräßlin 883445d5e8 Add an auto-test for ScreenEdges
The new test does not cover ScreenEdges completely, so far the
following areas are handled:
* creating of the edges
* reserving of edges
* trigger callback
* cursor pushback
* blocking of edges for fullscreen active clients
2014-09-26 14:01:44 +02:00
Martin Gräßlin 2d19afd3fc Drop unused include from screenedge.cpp 2014-09-25 09:29:28 +02:00
Thomas Lübking 32dbb57618 block warps after warping for VD switch
until the event cycle finished - xcb_flush nor
even XSync around the cursor setting does not
help and the pushback operates on a false position,
purging the VD switch warp

BUG: 338593
REVIEW: 119960
2014-08-28 20:30:00 +02:00
Thomas Lübking 35bfec1511 warp cursor per virtual desktop wrap direction
if there's no desktop toLeft/Right above/below it's wrong
to warp the cursor, branch opens on corner edges

CCBUG: 333341

Forward port of eea4bb81105f2c289831cf1f682c3927a24fd831 from kde-workspace
2014-06-04 16:30:29 +02:00
Martin Gräßlin c7cd886bd6 [screenedges] Use generated interface to lock the screen
We have the interface for the effects, so it's better to use the
generated code instead of custom written code.
2014-05-15 09:01:51 +02:00
Martin Gräßlin 876f8c67fa [screenedges] Fix dbus invocation for Dashboard action
It's now:
* Service: org.kde.plasmashell
* Object Path: /PlasmaShell
2014-05-15 08:55:33 +02:00
Martin Gräßlin 940d9fb513 ScreenEdges which do not need X windows
A new AreaBasedEdge is introduced which supports the Edge functionality
by just connecting to the globalPointerChanged signal of
InputRedirection.

The AreaBasedEdges are used if KWin's operation mode is not X11 only.
This unfortunately required to change the datatype of the list of edges
in ScreenEdges. It used to be specific on the inheriting class.
2014-03-18 09:00:49 +01:00
Martin Gräßlin ed4a0d0319 Screenedge show support for Clients
This provides a new protocol intended to be used by auto-hiding panels
to make use of the centralized screen edges. To use it a Client can
set an X11 property of type _KDE_NET_WM_SCREEN_EDGE_SHOW to KWin.
As value it takes:
* 0: top edge
* 1: right edge
* 2: bottom edge
* 3: left edge

KWin will hide the Client (hide because unmap or minimize would break
it) and create an Edge. If that Edge gets triggered the Client is shown
again and the property gets deleted. If the Client doesn't border the
specified screen edge the Client gets shown immediately so that we
never end in a situation that we cannot unhide the auto-hidden panel
again. The exact process is described in the documentation of
ScreenEdges. The Client can request to be shown again by deleting the
property.

If KWin gets restarted the state is read from the property and it is
tried to create the edge as described.

As this is a KWin specific extension we need to discuss what it means
for Clients using this feature with other WMs: it does nothing. As
the Client gets hidden by KWin and not by the Client, it just doesn't
get hidden if the WM doesn't provide the feature. In case of an
auto-hiding panel this seems like a good solution given that we don't
want to hide it if we cannot unhide it. Of course there's the option
for the Client to provide that feature itself and if that's wanted we
would need to announce the feature in the _NET_SUPPORTED atom. At the
moment that doesn't sound like being needed as Plasma doesn't want to
provide an own implementation.

The implementation comes with a small test application showing how
the feature is intended to be used.

REVIEW: 115910
2014-02-26 12:54:00 +01:00
Martin Gräßlin 0b32e5e57d [kwin] Listen to mouse motion events in the screenedge windows
Problem description: if a window decoration is in the screenedge
(not really unlikely for maximized windows) we either did not get
mouse events to the decoration or the screenedge window. E.g. the
enter event didn't reach the approach window which means it doesn't
get unmapped and thus the motion events in that area are not passed
to the decoration below. The same happened for the screenedge window,
the enter event was just not delivered if there is a window decoration
in the edge.

To solve this problem we listen for motion events in the approach and
the edge window and pass them from the event filter to the screen edges.
If one of our windows contains that the position of the motion event
we trigger the edge just in the same way as we do with the enter event.
2014-02-01 10:03:49 +01:00
Martin Gräßlin 255140291f Only compare to last screenedge trigger time when triggered at least once
Greetings from the "wtf, how could that have ever worked" department.
This fixes the screenedge activation on Qt 5. The last trigger time is
only set after an activation so before activation it is invalid thus the
comparison to any value doesn't make sense.
2013-09-25 09:44:48 +02:00
Martin Gräßlin 969e6b85e7 Merge branch 'master' into frameworks-scratch
Conflicts:
	CMakeLists.txt
	kwin/client.cpp
	kwin/effects/highlightwindow/highlightwindow.cpp
	kwin/libkwineffects/kwingltexture.cpp
	kwin/libkwineffects/kwinxrenderutils.cpp
	kwin/scene_opengl.cpp
	kwin/workspace.cpp
	plasma/desktop/applets/kickoff/CMakeLists.txt
	plasma/desktop/applets/taskmanager/package/contents/code/tools.js
	plasma/desktop/applets/taskmanager/package/contents/ui/Task.qml
	plasma/desktop/applets/taskmanager/package/contents/ui/main.qml
	plasma/desktop/applets/taskmanager/package/metadata.desktop
	plasma/desktop/applets/taskmanager/plugin/textlabel.h
	plasma/desktop/applets/tasks/CMakeLists.txt
	plasma/desktop/applets/tasks/package/metadata.desktop
	plasma/desktop/applets/tasks/tasks.cpp
	plasma/desktop/toolboxes/plasma-toolbox-desktoptoolbox.desktop
	plasma/generic/applets/activitybar/activitybar.cpp
	plasma/generic/wallpapers/color/plasma-wallpaper-color.desktop
	plasma/generic/wallpapers/image/plasma-wallpaper-image.desktop
2013-09-24 11:28:38 +02:00
Thomas Lübking 29e230dca3 enforce reactivation threshold to be 50ms bigger
than actication threshold.
Things don't work otherwise.

BUG: 323588
FIXED-IN: 4.11.1
REVIEW: 112125
2013-08-27 07:53:02 +02:00
Martin Gräßlin 9291b18cee Merge branch 'master' into frameworks-scratch
Conflicts:
	CMakeLists.txt
	kwin/effects.cpp
	kwin/effects/logout/logout.cpp
	kwin/effects/presentwindows/main.qml
	kwin/effects/presentwindows/presentwindows.cpp
	kwin/effects/presentwindows/presentwindows.h
	kwin/effects/zoom/zoom_config.cpp
	kwin/libkwineffects/kwinglutils_funcs.cpp
	kwin/libkwineffects/kwinxrenderutils.cpp
	kwin/nvidiahack.cpp
	kwin/xcbutils.h
	plasma/desktop/containments/desktop/plasma-containment-desktop.desktop
	plasma/generic/wallpapers/image/image.cpp
	plasma/generic/wallpapers/image/plasma-wallpaper-image.desktop
2013-08-07 10:10:06 +02:00
Martin Gräßlin d90d0f5c8e Improve event handling for screen edge activation on XCB
It still doesn't trigger properly - might be fixed if KDE/4.11 gets
merged into this branch again.
2013-08-01 11:36:38 +02:00
Martin Gräßlin 330d40f425 Fix no cast to/from ASCII intrduced issues
* "" needs to be wrapped in QStringLiteral
* QString::fromUtf8 needed for const char* and QByteArray
* QByteArray::constData() needed to get to the const char*
2013-07-24 09:58:33 +02:00
Thomas Lübking 55daad4d68 sanitize screenedge activation timer logics
The logics relied on a static timout to arm the timer:
when last successfull activation had been longer ago than 250ms.

We now cap the configured reactivation timeout at min 250m
guessing that this was somehow supposed as well by this.

BUG: 322057
FIXED-IN: 4.11
REVIEW: 111549
2013-07-19 21:17:33 +02:00
Thomas Lübking 2cc6712564 keep electric edges 1/3" away from the corners
BUG: 318294
FIXED: 4.11
REVIEW: 110013
2013-04-28 17:39:16 +02:00
Martin Gräßlin edb074cbc2 Split out screen handling from Workspace into own class Screens
Following the approaches of other split out functionality Screens is a
singleton class created by Workspace.

The class takes over the responsibility for:
* screenChanged signal delayed by timer
* number of screens
* geometry of given screen
* active screen
* config option for active screen follows mouse

The class contains a small abstraction layer and has a concrete subclass
wrapping around QDesktopWidget, but the idea is to go more low level and
interact with XRandR directly to get more detailed information.

All over KWin the usage from QDesktopWidget is ported over to the new
Screens class.

REVIEW: 109839
2013-04-15 10:25:10 +02:00
Martin Gräßlin 0fb27fd12e Defines to create the boilerplate code for KWin's singleton classes
The define KWIN_SINGLETON adds to a class definition:

public:
    static Foo *create(QObject *parent = 0);
    static Foo *self() { return s_self; }
protected:
    explicit Foo(QObject *parent = 0);
private:
    static Foo *s_self;

There is an additional define KWIN_SINGLETON_VARIABLE to set a different
name than s_self.

The define KWIN_SINGLETON_FACTORY can be used to generate the create
method. It expands to:

Foo *Foo::s_self = 0;
Foo *Foo::create(QObject *parent)
{
    Q_ASSERT(!s_self);
    s_self = new Foo(parent);
    return s_self;
}

In addition there are defines to again set a different variable name and
to create an object of another inheriting class.

All the classes currently using this pattern are adjusted to use these
new defines. In a few places the name was adjusted. E.g. in Compositor
the factory method was called createCompositor instead of create.

REVIEW: 109865
2013-04-15 09:57:25 +02:00
Martin Gräßlin 32b6ef42b9 Strip module path from all Qt #include <>
Done with:
fixqt4headers.pl --strip-modules

REVIEW: 109176
2013-03-06 10:26:56 +01:00
Martin Gräßlin f12cf0efba Replacement class for QCursor
With Qt5 QCursor does no longer provide ::handle() which was used to
set a cursor on a native XWindow for which we do not have a QWidget.

Also KWin has had for quite some time an optimized version to get the
cursor position without doing XQueryPointer each time ::pos() is called.

These two features are merged into a new class Cursor providing more or
less the same API as QCursor.

In addition the new class provides a facility to perform mouse polling
replacing the implementations in Compositor and ScreenEdges.

For more information about the new class see the documentation for the
new class in cursor.h.
2013-02-25 13:35:14 +01:00
Martin Gräßlin 05541740ac Don't activate screen edge actions when moving a Client
This only results in problems if e.g. Desktop Grid is activated when
trying to quick tile a window.

REVIEW: 108940
2013-02-14 08:14:01 +01:00
Thomas Lübking 004bdee7a2 do not try to raise possible panel proxies
but drop screenedges below the supportWindow instead
that's why it exists, that's deterministic, that's faster

includes adaption to new screenedge and xcb invocation (compared to 4.10)

BUG: 314625
FIXED-IN: 4.10.1
REVIEW: 108867
2013-02-12 21:58:46 +01:00
Martin Gräßlin 97943019db Use Xcb::Window in WindowBasedEdge
REVIEW: 108513
2013-02-07 10:00:32 +01:00
Martin Gräßlin 90eb2dbf05 Screen Edges may belong to fullscreen windows
Corners are still ours (it's a valid use case to still be able to switch
window through e.g. Present Windows even when running a fullscreen app).

How is it done? An Edge can be blocked and does no longer trigger if it
is blocked. For WindowBasedEdges the edge windows get unmapped in the
blocking case and mapped again when the blocking condition is no longer
valid.

The blocking is so far connected to:
* changes of active window
* changes of fullscreen windows

Whenever one of the events occurs it is checked whether there is:
1. an active client
2. it is fullscreen
3. on the same screen as the edge

If this is the case the edge will be blocked, otherwise unblocked.

BUG: 271607
FIXED-IN: 4.11
2013-02-07 09:48:09 +01:00
Martin Gräßlin bed85baf6c Split out event handling in ScreenEdges in separate methods
Allows to also support xcb_generic_event_t in addition to XEvent.
2013-02-07 09:48:09 +01:00
Martin Gräßlin 9bab40d995 Notifications when approaching a screen edge
For each edge an additional "approach" area window is created. When the
mouse enters this approach window, it gets unmapped and a mouse polling
interval is started. If the mouse leaves the approach area again, the
window gets mapped again and the mouse polling is stopped.

During the approaching a signal is emitted with a factor in [0.0,1.0] to
describe how close the mouse is to the edge. 0.0 means far away, 1.0
means triggering the edge. This signal is passed to the effects to allow
using this information. E.g. to provide a glow corner effect or to make
use of it in the cube animation effect to start the animation on desktop
switch.
2013-02-07 09:48:09 +01:00
Martin Gräßlin a8539ff54e Turn ScreenEdges into a Singleton
In fact it already used to be a Singleton as there is just one object
hold by the Singleton Workspace. So let's make it a proper Singleton
following our kind of standard approach of having a ::create factory
method called from Workspace ctor and a ::self to get to the singleton
instance.
2013-02-07 09:46:52 +01:00
Martin Gräßlin 7a7f9d1a34 Change the way how screen edges interact with Effects/Scripts
The main difference is that the activation of an edge is no longer
broadcasted to all effects and scripts, but instead a passed in slot of
the Effect/Script is invoked.

For this the EffectsHandler API is changed to take the Effect as an
argument to (un)reserveElectricBorder. As callback slot the existing
borderActivated is used.

In addition the ScreenEdge monitors the object for beeing destroyed and
unregisters the the edge automatically. This removes the need from the
Effect to call unregister in the dtor.

BUG: 309695
FIXED-IN: 4.11
2013-02-07 09:46:52 +01:00