Commit Graph

37 Commits (4b41c33268a1c155c606293d1d39ba2f61a478ea)

Author SHA1 Message Date
Martin Gräßlin 6d64113ed4 Do not include utils.h in xcbutils.h
Only needed for ScopedCPointer which can be defined in both utils and
xcbutils.h.

Not having utils.h in xcbutils.h makes it easier to have unit tests use
xcbutils.h as it removes the dependencies.
2014-11-27 09:00:19 +01: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
Aleix Pol e5bffd744b Stop using deprecated headers
Most things were already ported away, only that nobody realized they
weren't used.
2014-03-18 18:02:02 +01:00
Martin Gräßlin 704e42163d [kwin] Add missing includes
Were missing if built stand-alone.
2014-03-18 14:37:01 +01: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
Aleix Pol c72e519d9c Remove KDE/ prefix in include directories
It's unneeded and deprecated since KF5.
2014-03-17 16:24:10 +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 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
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 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
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
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
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