Commit Graph

1164 Commits (f8be3f746ba9e8a868c74414a40c2e41b14b61d1)

Author SHA1 Message Date
Kevin Funk 8ea4f4dae7 Port to CMake AUTOMOC
Summary: Run convert-to-cmake-automoc.pl over all .cpp files

Differential Revision: https://phabricator.kde.org/D882
2016-02-01 21:05:36 +01:00
Martin Gräßlin fbf14306d7 Set Workspace::m_compositor to null when Compositor gets destroyed
Fixes regression from 1998d5ac1a.

BUG: 358722
REVIEW: 126925
2016-02-01 08:31:13 +01:00
Martin Gräßlin 757523a324 Use kwinApp()->config() instead of KSharedConfig::openConfig()
That way all over kwin we can inject a custom config in the autotests.
2016-01-29 11:24:18 +01:00
Martin Gräßlin 89be6cf4ed Add a Workspace::forEachAbstractClient 2015-12-18 16:41:49 +01:00
Martin Gräßlin 5e96f65224 Add window decoration to ShellClient
If a ShellClient supports the ServerSideDecoration interface we can
create a server decoration for it. For that updateDecoration is added
as a pure virtual method in AbstractClient and a more-or-less code copy
from Client is added to ShellClient.

Geometry handling is adjusted to consider the window decoration offsets.
2015-12-18 16:41:49 +01:00
Martin Gräßlin 0bf2b1de0f Add a Workspace::findAbstractClient
Like Workspace::findClient just that it operates on AbstractClient
and the m_allClients instead of clients.
2015-12-18 16:41:49 +01:00
Martin Gräßlin 20a9a2a247 Introduce a --no-kactivities command line option
This change enables kactivities integration by default again on both
X11 and Wayland (as kactivities no longer blocks). As we have an
infrastructure to disable kactivities we can also make use of it and
offer a command line switch to disable kactivities. This might be
useful for using KWin outside of Plasma.

REVIEW: 126153
2015-12-16 10:42:14 +01:00
Martin Gräßlin d89777bcac Make Wayland::EGL optional again
This is needed to make KWin build-able on non-Linux, but is actually
only a workaround. The dependency should also be available on non-Linux.

This disables the EGL integration in the Wayland backend (QPainter still
available) and the EGL fallback in the qpa plugin (preferred context
sharing still available, but requires a working OpenGL Scene).

REVIEW: 126202
2015-12-01 07:58:47 +01:00
Martin Gräßlin 1998d5ac1a [wayland] Improve tear-down to not crash if X11 applications are still around
We need to destroy the compositor after Xwayland terminated and after
the internal Wayland connection is destroyed. This means when destroying
the Workspace we may no longer destroy the Compositor at the same time.
Also we need to ensure that other tear down functionality doesn't call
into the no longer existing internal client connection.

With this change kwin doesn't crash when exiting with Wayland and/or
X11 windows still open.
2015-11-10 08:56:32 +01:00
Martin Gräßlin 004b928c8d Core uses runtime checks for whether we are on OpenGLES 2015-11-03 09:29:31 +01:00
Martin Gräßlin 03231942bb Bind building of glx support on whether epoxy has a glx header
So far it was bound to whether we build for GLES. But this is
semantically wrong. It might be possible that even on desktop gl
epoxy is built without GLX support, thus we need to reflect this.

This change ensures that epoxy/glx.h is only included if available,
that relevant code is bound to it and that checks are in place to
enforce EGL if not build with glx support.

In addtion the glxbackend.cpp is now only included in the build set
if available.
2015-11-03 09:29:31 +01:00
Martin Gräßlin 8ffca66d94 [wayland] Trigger an update of client layer when managing a ShellClient
Let's ensure it's in the correct layer before we do something with the
new window.
2015-10-01 17:24:03 +02:00
Martin Gräßlin b587926803 [wayland] Introduce better placement checks for ShellClient
Similar to what we have in Client::manage we should not always
invoke the Placement algorithm. E.g. an initially fullscreened window
should not get placed.

This needs to be extended for more checks similar to Client::manage
and might indicate that we also need a ShellClient::manage.

REVIEW: 125469
2015-10-01 16:47:28 +02:00
Martin Gräßlin 51888e8abd Introduce an allClientList in Workspace
Holds AbstractClients that is both X11 and Wayland clients. Allows
to easily change code which needs to operate on all clients to get
to them without needing special handling for Wayland clients. At the
same time we are still able to get to the windowing system specific
clients through the old clientList() and waylandServer()->clients().
2015-09-18 13:44:54 +02:00
Martin Gräßlin a9d8926d3c Workspace::findDesktop returns AbstractClient 2015-09-16 13:54:48 +02:00
Martin Gräßlin 2da04aa26b Use auto where we call ensureStackingOrder(client->transients())
Preparation step for switching transients from Client to AbstractClient.
2015-09-16 13:54:47 +02:00
Martin Gräßlin 1d242d9daf Move mainClients() and allMainClients from Client to AbstractClient
AbstractClient::mainClients is virtual and overriden in Client,
allMainClients has only a common implementation in AbstractClient.

In activation.cpp we still need one case where a temporary ClientList
needs to be constructed. Once transients are fully migrated that should
be removable again.
2015-09-16 13:54:47 +02:00
Martin Gräßlin c4c3dfc73f Move transientFor from Client to AbstractClient
Right now this caused a few dynamic_casts. On the other hand existing
dynamic_casts from AbstractClient to Client can be removed again.
2015-09-16 13:52:25 +02:00
Martin Gräßlin 06aacf4f65 Drop cmakedefine HAVE_WAYLAND_EGL
Now a required build dependency.
2015-08-12 11:39:20 +02:00
Martin Gräßlin 3139dcd3b9 Drop cmakedefine HAVE_WAYLAND
Now a required build dependency.
2015-08-12 11:39:20 +02:00
Martin Gräßlin a6c6408f54 Drop cmakedefine HAVE_WAYLAND_CURSOR
Now a required build-dep.
2015-08-12 11:39:20 +02:00
Martin Gräßlin da1e063a37 Drop cmakedefine HAVE_XKB
No longer needed, we always depend on xkbcommon now.
2015-08-12 11:39:19 +02:00
Martin Gräßlin a1a89d3d1e Disable Activities support on Wayland
This is a temporary workaround for bug 349992 which causes freezes
during startup as kwin and kamd dead lock each other on DBus.

To workaround we don't call Activities::create and check in every
usage of Activities::self() whether the pointer is valid.

As a result kwin_wayland now starts pretty fast.

CCBUG: 349992
2015-07-07 11:48:42 +02:00
Thomas Lübking 3442664609 port session management to KF5
REVIEW: 123580
BUG: 341930
2015-06-18 00:18:53 +02:00
Martin Gräßlin 65665b052b [wayland] Let's try to activate a ShellClient after it's created
This might cause breakage on kwin_wayland, let's see how it works.
2015-06-11 03:22:50 +02:00
Martin Gräßlin 6bdf120b3f Workspace::setShowingDesktop operates on AbstractClient 2015-06-09 23:28:48 +02:00
Martin Gräßlin 124bd8aaed [wayland] Add support for the PlasmaShell interface
The PlasmaShell interface allows to create a PlasmaShellSurface for a
given Surface. Through this interface the Surface can request:
* a specific position
* a window type

So far only the window types Normal, Panel and Desktop are supported
which is a sufficient subset for getting plasmashell to work.

In future there should be security checks so that only the dedicated
desktop shell can bind these interfaces.
2015-06-09 19:10:56 +02:00
Martin Gräßlin 2bdabe62aa [wayland] Check for docks in ShellClient in Workspace::updateClientArea
A ShellClient can have window type dock. In that case it's considered to
have a strut. That is currently every panel restricts the area. On the
other hand only internal clients can be docks at the moment. For Plasma's
panels a dedicated interface will be needed.
2015-06-08 21:29:07 +02:00
Martin Gräßlin 6c0c513874 Require XCB 1.10
We need XCB 1.10 for sync to work. Sync was optional with a version check
to make it work on build.kde.org. The CI system supports XCB 1.10 now, so
it's better to have it as a mandatory requirement.
2015-06-04 18:39:04 +02:00
Martin Gräßlin 8a9bbf7ca3 XCB::CURSOR becomes a required dependency
It was only optional because build.kde.org did not provide it when the
dependency got introduced.
2015-06-04 17:50:29 +02:00
Martin Gräßlin 90a6814513 [wayland] Place ShellClients
When a ShellClient is added and it's not internal, it get placed just
like any other Client. This needs to happen after the initial size is
determined.

Please note: this breaks the positioning of popup windows (e.g. menus)
as they are placed like any other Client. This needs proper popup support
which right now does not yet exist and thus is not much difference to
before.
2015-05-27 14:20:12 +02:00
Martin Gräßlin 36fa88893e [wayland] Track the internal ShellClients in WaylandServer
Adds all internal ShellClients into a dedicated list. This ensures that
we don't perform "normal" window management on them.

In addition we add them to the top of the stacking order. This restores
behavior as it is on X11: internal windows are using BypassWindowManagerHint
and thus on top of everything.
2015-05-21 13:34:26 +02:00
Thomas Lübking 75bd798ad9 Merge branch 'Plasma/5.3' 2015-05-19 22:52:52 +02:00
Thomas Lübking a16a489a43 Show Desktop: keep desktop group visible
Windows that "belong" to the desktop are
kept visible and do no break the state on
activation/mapping

REVIEW: 123783
CCBUG: 346837
CCBUG: 346933
CCBUG: 347212
2015-05-19 22:06:48 +02:00
Thomas Lübking f3b69b0ed0 Showing Desktop: keep docks visible
REVIEW: 123783
BUG: 346933
BUG: 347212
CCBUG: 346837
FIXED-IN: 5.3.1
2015-05-19 22:01:02 +02:00
Martin Gräßlin 3129f7d698 Add more information about Screens to supportInformation
Now that we have also a name and the refresh rate it makes sense to
add a grouping by screen and print out that information.
2015-05-19 09:19:45 +02:00
Martin Gräßlin 30e6ae34d7 Delay desktopPresenceChanged in EffectsHandlerImpl instead of Workspace
The signal might be emited by Workspace just before a Client gets
destroyed. In that case the argument carried by the queued event is no
longer valid and causes problems. In EffectsHandlerImpl we can queue
it without problems as the EffectWindow also stays valid if the Client
gets destroyed. The referenced Deleted gets destroyed with a deleteLater,
thus will be after the signal is emitted.

BUG: 347490
REVIEW: 123729
2015-05-18 08:01:33 +02:00
Martin Gräßlin e9e055dcca Call Workspace::clientHidden when ShellClient gets destroyed
Ensures that active_client gets changed if it was a ShellClient.
2015-05-08 12:43:47 +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 1bfba1765c Signal desktopPresenceChanged carries AbstractClient as argument 2015-05-08 12:43:47 +02:00
Martin Gräßlin 7d51838efc Implement AbstractClient::isActive and ::setActive
Moves the implmentation to AbstractClient. Methods are no longer virtual,
setActive calls a virtual protected method which is implemented in Client
for Client specific activation code.
2015-05-08 12:43:46 +02:00
Martin Gräßlin 41cd927bce Move Workspace::activeClient and ::mostRecentlyActivatedClient back to header
Now all is moved they can be inlined again.
2015-05-08 12:43:46 +02:00
Martin Gräßlin fdcaf2b86f Make Workspace::active_client an AbstractClient 2015-05-08 12:43:46 +02:00
Martin Gräßlin 94ce47ef7b Workspace::mostRecentlyActivatedClient returns an AbstractClient
Implementation temporarily moved to cpp. Needs to be moved back once
should_get_focus and active_client are AbstractClient.
2015-05-08 12:43:46 +02:00
Martin Gräßlin 138c1b2ff0 Workspace::sendClientToDesktop operates on AbstractClient
Unfortunately transient handling is still on Client, thus it's
still in a cast-if block.
2015-05-08 12:43:45 +02:00
Martin Gräßlin 8cfe0a9316 Workspace::clientActivated signal changed to AbstractClient
connections changed to new connect syntax to ensure they are correct.
2015-05-08 12:43:45 +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
Martin Gräßlin 7c187359a7 Workspace::sendClientToScreen operates on AbstractClient 2015-05-08 12:43:44 +02:00
Martin Gräßlin 1b02837d0b Add overload Workspace::hasClient(const AbstractClient*)
Delegates to hasClient(const Client*) if the AbstractClient is a
Client. Needs to be extended for other AbstractClient subclasses.
2015-05-08 12:43:44 +02:00
Martin Gräßlin fe7a6834b2 FocusChain operates on AbstractClient instead of Client
As external interface it still returns Client* to not force the casts
to be done at usages. This will be changed once the users are migrated
to AbstractClient*.
2015-05-08 12:43:44 +02:00
Martin Gräßlin d60c377890 [wayland] Introduce a ShellClient
The ShellClient is a Toplevel subclass for a
KWayland::Server::ShellSurfaceInterface. It gets created when a new
ShellSurfaceInterface is created and destoryed when it gets unmapped.

So far the usage is still rather limited. The ShellClient is opened
at position (0/0). While it's possible to pass pointer events to it,
it's not yet possible to activate it, so no keyboard focus.
2015-05-08 12:43:44 +02:00
Martin Gräßlin 72db1e63a3 [wayland] Move backend implementations into a backends/<name> directory
The aim is to be able to create a plugin for each of the backends.
The following directories are created:
* backends/drm
* backends/fbdev
* backends/wayland
* backends/x11
2015-05-05 13:05:37 +02:00
Martin Gräßlin 877c33fe7d Initial implementation of EglGbmBackend
Uses EGL_MESA_platform_gbm to get an EglDisplay from a gbm_device.
The DrmBackend can provide a DrmBuffer for a gbm_surface and present
it.

Unfortunately buffer age seems to be slightly broken and we still have
artefacts.
2015-04-24 12:03:19 +02:00
Martin Gräßlin c759551340 [wayland] Add a basic drm/kms backend
Introduces a new (optional) dependency: libdrm.

The DrmBackend currently supports finding the first connected output.
It can create shared memory buffers which are used by SceneQPainter to
do double buffered rendering.

There is still lots to do, the following things are not yet working:
* multiple outputs
* page flip
* OpenGL (through gbm)
* restoring mode setting to start value
2015-04-24 12:03:19 +02:00
Weng Xuetian 740be3e8d3 make sure connect to screen changed signal after screen is created
REVIEW: 123461
BUG: 346453
FIXED-IN: 5.3
2015-04-21 23:25:37 -07:00
Thomas Lübking 70a2b327b1 fix showing desktop for multiple desktop windows
BUG: 346268
FIXED-IN: 5.3
REVIEW: 123409
2015-04-20 22:24:54 +02:00
Thomas Lübking c2a120019b emit signal when showingDesktop changes 2015-04-07 23:59:17 +02:00
Thomas Lübking cbfcd3b096 implement showingDesktop by raising desktop window
This is an alternative approach suggested by the
NETWM spec.
The advantage is, that windows are not minimized
at all what apparently lead to some confusion
about the nature of the mode (which was abused
to tidy up) and a secret config key to allow for
that unrelated behavior.
Instead the ShowDesktopIsMinimizeAll key is removed
and replaced by a dedicated script + shortcut.

Bonus: less code to remember "minimized" windows =)
2015-04-07 23:59:17 +02:00
Martin Gräßlin 289ec53350 Add basic information about the X server to supportInformation
* Vendor name
* Vendor release
* Protocol version
* All Extensions used by KWin (name, present and version)

Need for this recognized due to a bug related to no xrandr present.

CCBUG: 345448
2015-03-24 08:54:03 +01:00
Martin Gräßlin b3145f294f Print out all build options in supportInformation
Based on experience that builds might not have optional features
(packagers running automated builds, devs using kdesrc-build).
2015-03-23 16:02:12 +01:00
Martin Gräßlin b405fda213 Drop support for KAppmenu
We released three versions with it being disabled and it doesn't look
like it will come back any time soon. Also the build was broken at least
since the repo splitting due to incorrect path to dbus xml.

In addition the connection to decorations got dropped already with the
change to kdecoration2. Which means it anyway needs large adjustements
to get the code working again.

Overall it doesn't look like it makes lots of sense to keep the code
around for someone working on it in future. If that happens this change
can be reverted.
2015-03-23 15:56:50 +01:00
Martin Gräßlin 8b8167b565 Do not init XRenderUtils on Wayland
If something calls into XRender it would be a bug.
2015-03-18 16:24:25 +01:00
Martin Gräßlin 50ef02fa1b [wayland] Start Compositor and Scene before Workspace
For Xwayland we need to have the Scene (and EglDisplay) created prior
to starting Xwayland and having X11. This requires creating the
Compositor before creating Workspace and starting Xwayland.

To support this the startup of Compositor is split into two parts:
prior and after Workspace creation.

The change might also be interesting for the kwin_x11 case as it could
result in the compositor being up in a quicker way.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 0f945f53fe Move creation of InputRedirection, Cursor and Screens out of Workspace
Do not depend on Workspace and do not depend on X11 thus can be started
earlier allowing to get more things started prior to depending on
Workspace.
2015-03-17 10:20:19 +01:00
Martin Gräßlin e463905f04 Add Workspace::findToplevel
Like findClient and findUnmanaged, just a little bit more generic.
Toplevel::findInList got adjusted to support it.
2015-03-17 10:08:27 +01:00
Martin Gräßlin 65007cd104 [xwayland] Add a dedicated --xwayland option to kwin_wayland
The --xwayland option starts a rootles Xwayland server. If a
rootless Xwayland server is used OperationModeXwayland is used
which is introduced with this change as well.
2015-03-17 10:03:05 +01:00
Martin Gräßlin caf99f83d5 Require Qt 5.4
REVIEW: 122617
2015-02-19 10:56:50 +01:00
Martin Gräßlin 859553b129 Drop needless creation of KWindowInfo instance in Workspace::addClient
Completely unused and got (probably accidentally) introduced with the
merge of the kwin scripting GSOC project.
2015-02-17 13:53:52 +01:00
Martin Gräßlin e96c86e045 Remove unused #include <KWindowSystem> 2015-02-17 13:35:30 +01:00
Martin Gräßlin 6bb339ff90 Add Qt and XCB compile version to supportInformation
Add QT_VERSION_STR in addition to qVersion(). This could be useful
to see whether the runtime version is different to the Qt version
used at compile time.

Also adds the XCB_VERSION_STRING which is used at compile time.
This is useful as for example XCB::SYNC was broken prior to 1.10.

REVIEW: 122375
2015-02-02 09:31:08 +01:00
Martin Gräßlin d319a286e7 Improving printing of supportInformation
Custom conversion to QString for a few property types.
2014-12-08 16:46:54 +01:00
Martin Gräßlin 468b5a32ff Add supportInformation for new Decorations
Following information is included:
* selected plugin
* selected theme
* all properties from KDecoration2::DecorationSettings
2014-12-08 16:14:05 +01:00
Daniel Pastushchak 0d997b1093 Introduce categorized logging for kwin core
Done by Daniel Pastushchak for KDE during GCI-2014.
2014-12-05 14:27:15 +01:00
Martin Gräßlin 63695e6fc3 Remove unused imports 2014-12-02 15:26:42 +01:00
Martin Gräßlin 3d9a035312 Move MaximizeMode from KDecorationDefines to utils.h
Unfortunately it cannot be a enum defined in Client as client.h
depends on rules.h and with it in Client rules.h would depend on
client.h.
2014-12-02 13:49:08 +01:00
Martin Gräßlin d4e2f19ef0 Workspace does not need to inherit from KDecorationDefines 2014-12-02 11:17:43 +01:00
Martin Gräßlin c2e53b9a2f Merge branch 'kdecorations2'
Conflicts:
	effects.cpp
	paintredirector.cpp
2014-12-02 08:38:10 +01:00
Martin Gräßlin b7a8bb4f52 Drop build option KWIN_BUILD_SCREENEDGES
The build option got introduced for Plasma Active back in a time
when we did not properly aim for convergence. In a Plasma 5 world
we want to have only one shell and one window manager which adjust
itself. This means we don't want a differently compiled kwin for
plasma active, but the same one. Thus the build option doesn't
make much sense any more. A KWin for touch interface needs to support
screenedges for the case that mouse is plugged in.

CCBUG: 340960
REVIEW: 121200
2014-11-24 10:48:49 +01:00
Martin Gräßlin fcec334b3c [kdecoration] Adjust to change that DecorationBridge is no longer a singleton
* Aurorae needs to pass QVariantList args to parent Decoration
* DecorationBridge implementation needs to be a KWIN_SINGLETON
* DecorationBridge needs to be passed with args to created Decoration
2014-10-30 09:01:06 +01:00
Martin Gräßlin 8f87e18b79 [decorations] Add support for runtime switching of decoration plugins 2014-10-28 11:53:56 +01:00
Martin Gräßlin e32da9d9e0 Merge branch 'master' into kdecorations2
Conflicts:
	CMakeLists.txt
	paintredirector.cpp
	scene_opengl.h
	scene_qpainter.h
	scene_xrender.h
2014-10-20 16:04:52 +02:00
Martin Gräßlin a918591fef Use Logind to open/close devices needed by libinput
With libinput we have the problem that we need to have privileges to
open the device files. In order to not need wrappers or suid bits, we
use logind. This means that kwin_wayland has to be the session controler.

A LogindIntegration is added to connect to logind and wrap the dbus
calls. This is based on the logind integration done for ksld in
ksmserver. The LogindIntegration is started by Workspace and the
InputRedirection tries to become the session controller and starts the
libinput integration only after this succeeded.
2014-10-20 14:51:24 +02:00
Martin Gräßlin 670973efdb Move creating WaylandBackend into ApplicationWayland
Early creation to ensure that we can abort if there is no Wayland
display to connect to.
2014-08-18 08:50:44 +02:00
Martin Gräßlin 0030eb7f84 Initial import of support for new KDecoration2 based decorations
NOTE: this is not working completely yet, lots of code is still ifdefed
other parts are still broken.

The main difference for the new decoration API is that it is neither
QWidget nor QWindow based. It's just a QObject which processes input
events and has a paint method to render the decoration. This means all
the workarounds for the QWidget interception are removed. Also the paint
redirector is removed. Instead each compositor has now its own renderer
which can be optimized for the specific case. E.g. the OpenGL compositor
renders to a scratch image which gets copied into the combined texture,
the XRender compositor copies into the XPixmaps.

Input events are also changed. The events are composed into QMouseEvents
and passed through the decoration, which might accept them. If they are
not accpted we assume that it's a press on the decoration area allowing
us to resize/move the window. Input events are not completely working
yet, e.g. wheel events are not yet processed and double click on deco
is not yet working.

Overall KDecoration2 is way more stateful and KWin core needs more
adjustments for it. E.g. borders are allowed to be disabled at any time.
2014-07-25 14:02:26 +02:00
Thomas Lübking c654dd4ff1 WORKAROUND bug #335926
QXcbScreen overrides the input eventmask when
adding a screen, so we claim our stuff back

BUG: 335926
REVIEW: 118765
2014-07-03 18:39:38 +02:00
Thomas Lübking c455087248 add selectWmInputEventMask function
It sets the mask required for a WM and in addition
preserves the eventmask present on the root window for
this client (as set by any lib etc.)
2014-07-03 18:39:38 +02:00
Ivan Čukić b995c9da23 KWin activities usage ported to the new library paradigm
Since the KActivities library now keeps an internal cache (and is
non-blocking), there is no point in thread-based information
fetching.

BUG: 335396
REVIEW: 118443
2014-06-01 18:58:36 +02:00
Martin Gräßlin 97726a4b1f [TabBox] Fix forcedGlobalMouseGrab
Was incompletely moved to TabBox after splitting out from Workspace.

REVIEW: 118259
2014-05-23 07:31:00 +02:00
Martin Gräßlin fbb62aed40 [supportInformation] Add missing line break 2014-05-15 09:14:46 +02:00
Martin Gräßlin 83ad1386dc Add used OpenGLPlatformInterface to supportInformation
Useful information when the platform interface becomes runtime
switchable.
2014-05-13 09:23:03 +02:00
Martin Gräßlin 160093a359 Port ObscuringWindows to xcb 2014-05-05 08:09:10 +02:00
Martin Gräßlin 93e5ebac63 Try to wait for DESTROY_NOTIFY before releasing an Unmanaged
So far the Unmanaged got released after an XCB_UNMAP_NOTIFY. This event
gets created after xcb_unmap_window or after xcb_destroy_window. In the
latter case the window is already distroyed and any of KWin's cleanup
calls will cause a BadWindow (or similar) error.

The idea to circumvent these errors is to try to wait for the
DESTROY_NOTIFY event. To do so the processing of the release is slightly
delayed. If KWin gets the destroy notify before the delay times out the
Unamanged gets released immediately but with a Destroy flag. For this a
new enum ReleaseToplevel is introduced and Unmanage::release takes this
as an argument instead of the bool which indicated OnShutdown. Also this
enum is added to Toplevel::finishCompositing so that it can ignore the
destroyed case and not generate an error.

REVIEW: 117422
2014-04-16 13:32:11 +02:00
Martin Gräßlin 1c0d0211ca Add const method variants to Xcb::Wrapper
Adding a const variant for ::data() to remove an unexpected copy.
To complete also the bool cast operator and isNull get a const
variant.

REVIEW: 117469
2014-04-11 07:36:18 +02:00
Martin Gräßlin 6c1bad551b [kwin] Remove dependency on kwinglobals in kwinxrenderutils
XRenderUtils used connection() and rootWindow() provided by kwinglobals.
Those are now kept as static variables in the implementation set through
an init() method from Workspace prior to the first possible usage of any
functionality provided by XRenderUtils.

In order to make the xcb_connection_t* and the root window completely
internal the inline methods which used those are moved to the
implementation.
2014-03-26 14:01:08 +01:00
Martin Gräßlin bc0a9cb53a [kwin] Use std::find_if and lambda functions for Workspace::findClient
Instead of passing the macro based Predicate to findClient it now
expects a function which can be passed to std::find_if.

Existing code like:
xcb_window_t window; // our test window
Client *c = findClient(WindowMatchPredicated(window));

becomes:
Client *c = findClient([window](const Client *c) {
    return c->window() == window;
});

The advantage is that it is way more flexible and has the logic what
to check for directly with the code and not hidden in the macro
definition.

In addition there is a simplified overload for the very common case of
matching a window id against one of Client's windows. This overloaded
method takes a Predicate and the window id.

Above example becomes:
Client *c = findClient(Predicate::WindowMatch, w);

Existing code is migrated to use the simplified method taking
MatchPredicate and window id. The very few cases where a more complex
condition is tested the lambda function is used. As these are very
local tests only used in one function it's not worthwhile to add further
overloads to the findClient method in Workspace.

With this change all the Predicate macro definitions are removed from
utils.h as they are now completely unused.

REVIEW: 116916
2014-03-25 15:17:11 +01:00
Martin Gräßlin fe5f7fb2f6 [kwin] Drop Predicate based Workspace::forEachClient
Migrates the last usage to the lambda based variant.
2014-03-25 15:17:11 +01:00
Martin Gräßlin 12a4923959 [kwin] Use std::find_if and lambda functions for Workspace::findUnmanaged
Instead of passing the macro based Predicate to findUnmanaged it now
expects a function which can be passed to std::find_if.

Existing code like:
xcb_window_t window; // our test window
Unmanaged *u = findUnmanaged(WindowMatchPredicated(window));

becomes:
Unmanaged *u = findUnmanaged([window](const Unmanaged *u) {
    return u->window() == window;
});

In addition an overload is added which takes the window id to cover
the common case to search for an Unmanaged by its ID. The above example
becomes:
Unmanaged *u = findUnmanaged(window);

The advantage is that it is way more flexible and has the logic what
to check for directly with the code and not hidden in the macro
definition.
2014-03-25 15:17:10 +01:00
Martin Gräßlin 970e8765f0 [kwin] Remove support for _NET_WM_TAKE_ACTIVITY protocol
As can be seen in [1] the patches to KWin were in CVS HEAD before the
protocol got standardized and it never got any adoption. It's neither in
the NETWM spec, nor implemented in Qt4 nor in Qt5. KWin did not even add
the protocol to the NET::Supported property.

Thus it doesn't make much sense to keep a protocol which nobody speaks.

Still the code around the protocol is kept and also the names are kept.
Only difference is that Client::takeActivity got removed and the code
moved to the only calling place in Workspace. Motivated by that change
the enum defined in utils.h is moved into Workspace, it's turned into
a proper QFlags class and used as a type in the method argument instead
of a generic long.

[1] https://mail.gnome.org/archives/wm-spec-list/2004-April/msg00013.html

REVIEW: 116922
2014-03-25 15:03:21 +01:00
Martin Gräßlin ca5f8cfe03 [kwin] Remove unused config-workspace.h includes 2014-03-18 09:23:25 +01:00