Commit Graph

106 Commits (master)

Author SHA1 Message Date
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
Martin Gräßlin d9aedf620b Rewrite of KWin's Screen Edge Handling
This rewrite is mostly motivated by the need to handle multi screen
setups correctly. That is have edges per screen and not for the combined
geometry. Also porting from XLib to XCB has been a motivation for the
rewrite.

The design of the new ScreenEdge handling is described in the
documentation of ScreenEdges in screenedge.h.

In addition the following changes have been performed:
* move configuration from Options to ScreenEdge
* add screen edge information to Workspace::supportInformation (obviously
  replaces what had been read from Options)
* have Workspace hold a pointer to ScreenEdges instead of an object
* forward declaration of ScreenEdges in workspaces.h, this explains the
  seemingly unrelated changes of just another include in some files

BUG: 290887
FIXED-IN: 4.11
2013-02-07 09:46:52 +01:00
Martin Gräßlin 3ee9869ba0 Move ScreenEdge configuration from Workspace to ScreenEdge
Main motivation for this change except the fact that it doesn't belong
into Workspace is that the screen edges got updated from within setting
the desktop layout which got removed with the introduction of the
VirtualDesktopManager.

The ScreenEdge now keeps some state to be able to correctly unreserve the
electric borders when changes in the configuration are performed. There
is still room for improvement as there are still some deep function calls
from within reconfiguring in Workspace.

REVIEW: 107493
2013-01-07 09:47:59 +01:00
Martin Gräßlin 334b4bf622 Move handling of Virtual Desktops into a VirtualDesktopManager
The ownership for virtual desktops is moved from Workspace into a new
VirtualDesktopManager. The manager is responsible for providing the count
of virtual desktops and keeping track of the currently used virtual
desktop.

All methods related to moving between desktops are also moved from
Workspace to the new manager, though all methods related to Clients on
Virtual Desktops remain in Workspace for the time being. This is to have
the new manager as independent from KWin core as possible.

An rather important change for the handling of virtual desktops is that
the count and the id of a desktop is now an unsinged integer instead of
an integer. The reason for that is that we cannot have a negative count
of desktops as well as it is not possible to be on a desktop with a
negative identifier.

In that regard it is important to remember that a Client can be on a
desktop with a negative identifier. The special value for a Client being
on all desktops is handled by using -1 as a desktop. For the time being
this is not adjusted but instead of comparing the virtual desktop ids one
should prefer to use the convenient methods like isOnDesktop and
isOnAllDesktops. This would allow in future to internally change the
representation for on all desktops.
2013-01-07 09:47:51 +01:00
Thomas Lübking 8cae5fc073 force instant reaction for dnd border events
BUG: 136856
FIXED-IN: 4.9
REVIEW: 105254
2012-06-24 19:26:43 +02:00
Thomas Lübking b6c84775ab HACK around bug 288791 - search for likely panel proxies and raise them after destroying an effect input window
BUG: 288791
REVIEW: 105245
FIXED-IN: 4.9
2012-06-18 22:11:06 +02:00
Martin Gräßlin c9c4e020e2 Screen Edge bindings for Scripts and Scripted Effects
ScreenEdge is changed to emit a signal whenever a screen edge
got activated without an action or effect taking care of it.

A Script can reserve one to many callbacks for an edge and the
callback get's triggered whenever the signal is emitted. On
deconstruction of the Script the edge is unreserved again.

FEATURE: 299275
FIXED-IN: 4.9.0
REVIEW: 104904
2012-05-15 17:54:31 +02:00
Thomas Lübking 3a6095726e Only reserve required electric borders for ElectricAlways
CCBUG: 293011
REVIEW: 104073
2012-05-03 19:48:20 +02:00
Martin Gräßlin 27643f5a9e Drop kephal dependency from KWin
Kephal has turned into not being more than a wrapper around
QDesktopWidget and does not even provide syntax sugar.

REVIEW: 104427
2012-04-01 08:11:57 +02:00
Thomas Lübking df32d86d84 fix some value inits for the no pushback case
CCBUG: 296762
REVIEW: 104420
2012-03-30 15:26:22 +02:00
Martin Gräßlin 212908ee88 Refactoring of KWin::Options: getter methods instead of public variables 2012-02-27 19:31:58 +01:00
Thomas Lübking 2ff74f83be Obey forced desktop id on electricborder change
BUG: 95627
REVIEW: 103376
2011-12-10 21:26:22 +01:00
Arthur Arlt aa14d53b71 Rename raiseWindows() to ensureOnTop()
REVIEW: 101789
2011-07-04 13:24:51 +02:00
Arthur Arlt c8cf1e4c7e Removed method destroy()
Since the method destroy() was called only from one location in the code
followed by update(), the funtionality has been moved to the method update()
which now takes an boolean argument 'force'. This argument is false by default
and set to true only at that location where destroy() was called formerly.
2011-07-04 13:24:51 +02:00
Arthur Arlt baf6de3a2f Use QVector<int> for m_screenEdgeReserved istead of int array
for cosmetic reasons only; to get rid of the initialization for loop
2011-07-04 13:24:51 +02:00
Arthur Arlt cc43928a97 Use QVector<Window> for screen edge windows instead of Window array
The code was updated to use a QVector for the screen edge windows instead of
an ordinary Window array. The getter method windows() was updated to return
now this QVector.
In the method propagateClients() in layers.cpp the newWindowStack QVector is
filled by iteration through the screen edge windows and only adding Windows that
are not None.
2011-07-04 13:24:51 +02:00
Arthur Arlt f73fb783ca Document new class ScreenEdge
Documentation for each function in the class ScreenEdge was added.
2011-07-04 13:24:51 +02:00
Arthur Arlt 6e7a249cd0 Rename functions in class ScreenEdge
Since the functions were moved from Workspace to its own class ScreenEdge
and the functionality was formerly called ElectricWindows, the functions still
had the old names. They are now consistenly renamed without redundand naming.
The function calls were updated as well in all classes where ScreenEdge is used.
2011-07-04 13:24:51 +02:00
Arthur Arlt 7aecca019f Rename member variables
Renaming member variables to consistent naming scheme and using phrase
"screenEdge" instead of electric window.
2011-07-04 13:24:51 +02:00
Arthur Arlt bf419c256d Introduced init() method to class ScreenEdge
The initialization was done in class Workspace before but is now
moved to class ScreenEdge in its own init() method. Is is called from
Workspace at the same position where the initialization took place before.
2011-07-04 13:24:51 +02:00
Arthur Arlt 83e8f65679 Use new getter method screenEdgeWindows() in propagateClients()
Since the functionality of screen edge handling was moved to its own class,
the screen edge windows are now provided by the getter method screenEdgeWindows().
The new getter method screenEdgeWindows() returns a reference to a QVector,
which includes the screen edge windows.
The Workspace method propagateClients() implemented in layers.cpp needs these
screen edge windows to restack the windows. The code was also modified to use
QVector instead of a Window array.
2011-07-04 13:24:51 +02:00
Arthur Arlt 76e5f0e08b Introduce new getter method screenEdgeWindows() to class ScreenEdge
A new getter method screenEdgeWindows() is provided by class ScreenEdge
since the screen edge windows are needed in class Workspace in the function
propagateClients() which is implemented in layers.cpp
2011-07-04 13:24:51 +02:00
Arthur Arlt 2f11337d98 Refactoring Screen Edge handling
This commit change the screen edge function calls to be called in the
new class ScreenEdge. The old methods are still in Workspace and will
be removed in a further commit.
2011-07-04 13:24:51 +02:00
Arthur Arlt 55cbff052f Refactor Screen Edge Handling
This initial commit introduces a two new files screenedge.h and screenedge.cpp which cover a new
class ScreenEdge. The code for screen edge handling was copied from Workspace to this class.
Workspace had to be extended by a getter for movingWindow. CMakeList was updated to build the
new class.
2011-07-04 13:24:51 +02:00