Commit Graph

515 Commits (d60c3778908763397afea09524d8f4b3595feb0d)

Author SHA1 Message Date
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
Mika Allan Rauhala 3389c7569f Adapt to KDecoration API changes
Adapt to API changes introduced by b62e8888cd39301e00ad98dfe791fa66676408fb.
It adds DecoratedClient::color(group, role) for getting colors that are
not included in QPalette. Breeze used to read these colors from
kdeglobals, breaking per window color schemes. KWin now handles reading
these colors along with QPalette loading with DecorationPalette.

REVIEW: 122883
2015-03-31 15:26:55 +02: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 9ca992a329 [wayland] Drop methods on Toplevel to send input events
No longer needed as InputRedirection sends input events directly
through the SeatInterface. In addition this drops the dependency on
xtest.
2015-03-17 10:20:20 +01:00
Martin Gräßlin 659c416879 [wayland] Handle damage events from SurfaceInterface
On Wayland we get the damage from the SurfaceInterface instead of
using a damage handle. This change ensures that the damage handle
interaction is only used on platform X11, while on Wayland we get
the damage from the SurfaceInterface directly.
2015-03-17 10:20:19 +01:00
Martin Gräßlin e7019d9545 [xwayland] Add support for WL_SURFACE_ID
When XWayland associates a Wayland surface with an X window it
sends a WL_SURFACE_ID client message to the window manager.

KWin listens for this client message in Toplevel and provides it
as a member in Toplevel.

This requires KWin to actually start a Wayland server (and XWayland)
to make proper use of the information.
2015-03-17 10:03:04 +01:00
Martin Gräßlin dfa89cc050 Port reading Motif hints to XCB
A wrapper class for MotifHints is added to xcbutils. This class manages
the information about the read Motif hints, so that Client doesn't need
to have a copy of the read states.

The class is designed in a way that during Client::manage we get rid of
another roundtrip.

REVIEW: 122378
2015-02-06 13:43:57 +01:00
Martin Gräßlin 9144b03688 Remove XLib include from client.h
No longer needed in the header. Client is free of XLib data types.
2015-01-27 12:48:03 +01:00
Martin Gräßlin 2076e458d3 Use Xcb::GeometryHints instead of XGetWMNormalHints
Xcb::GeometryHints is a convenient wrapper around the size hints
as described in ICCCM combined with the sanity checks so far applied
by KWin after reading the property.

Instead of accessing the members of the property structure, we are
now using the convenience methods.

During ::manage no further actions are triggered when reading the
size hints. Only when they are read later on the previous checks
are applied. During ::manage they can be ignored as it had a dedicated
isManaged check.

The method ::resizeWithCheck got a new argument of type xcb_gravity_t
which defaults to 0. This is needed from ::configureRequest which so
far temporarily changed the xSizeHints structure. By passing as an
argument this is no longer needed.

REVIEW: 122185
2015-01-27 12:48:03 +01:00
Martin Gräßlin 14659a9907 Split Client::checkActivities into two parts
REVIEW: 122087
CCBUG: 329979
2015-01-21 09:25:18 +01:00
Martin Gräßlin 5abccbec7d Split Client::readTransient into two parts 2015-01-21 09:25:15 +01:00
Martin Gräßlin 584bdbce71 Split Client::updateFirstInTabBox into two parts 2015-01-21 09:25:15 +01:00
Martin Gräßlin 327dd406e6 Split Client::updateColorScheme into two parts 2015-01-21 09:25:15 +01:00
Martin Gräßlin a55c7ba0d5 Split Client::updateShowOnScreenEdge into two parts 2015-01-21 09:25:15 +01:00
Martin Gräßlin 24688f8dae Split Client::detectGtkFrameExtents into two parts 2015-01-21 09:25:14 +01:00
David Edmundson 9fe660ac5c Notify when the client palette changes and proxy this to kdecoration
BUG: 341921
REVIEW: 121917
2015-01-08 13:16:20 +01:00
Martin Gräßlin 4c9744fe8e Drop dependency on kdecoration.h 2014-12-02 13:50:26 +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 1747fde18b Toplevel does not inherit from KDecorationDefines any more
As an intermediate step Client inherits from KDecorationDefines.
2014-12-02 11:31:07 +01:00
Martin Gräßlin fa4332754c Move Position from KDecorationDefines to Client 2014-12-02 11:15:54 +01:00
Martin Gräßlin e38d56b0dd Move QuickTileMode from KDecorationDefines to Client 2014-12-02 10:52:16 +01:00
Martin Gräßlin d4bf3602ce Move WindowOperation enum to Options
With this Options no longer needs to inherit from KDecorationDefines.
2014-12-02 10:41:47 +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 d1bf38e92c [kdecoration2] Detect double clicks on the decoration title bar
No longer handled by the Decoration.
2014-11-28 14:50:21 +01:00
Martin Gräßlin 0f7a990316 Use Protocol support in NETWinInfo instead of fetching them ourselves
Client does no longer need to track the protocols as this is also
provided by NETWinInfo as of version 5.3.

REVIEW: 120255
2014-11-24 10:37:18 +01:00
Martin Gräßlin 21dca7ac14 Keep a QPointer<DecoratedClientImpl> in Client
This allows to remove the internal access to the DecoratedClientPrivate
in the KDecoration API.
2014-10-21 07:46:44 +02: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 9fae34f86f Remove Client::getWMHints in favor of functionality in NETWinInfo
We are only using the UrgencyHint, InputHint and GroupLeader from
WMHints. Those are provided by NETWinInfo, so we can use the
functionality provided by NETWinInfo instead of calling XGetWMHints.

REVIEW: 120162
2014-09-15 16:29:47 +02:00
Martin Gräßlin 689a3a1c5e Emit signals from Client when allowed actions change 2014-07-25 14:02:27 +02:00
Martin Gräßlin 7154cfee42 Drop size from Client::resizeDecoration
No longer used.
2014-07-25 14:02:27 +02:00
Martin Gräßlin 2b20aa8bd0 Drop CoordinateMode from Client::layoutDecorationRects
It's unused without the padding.
2014-07-25 14:02:27 +02:00
Martin Gräßlin d3a91b67d9 Emit a signal if the QuickTileMode changes 2014-07-25 14:02:27 +02:00
Martin Gräßlin 750f61fa55 React on border size changes of the Decoration
This replaces the checkBorderSizes. Maybe the most dangerous change
in the scope of introducing the new Decorations.
2014-07-25 14:02:27 +02:00
Martin Gräßlin 98a5c4e050 Allow Client to disable the rendering of DecorationShadow
For maximized and fullscreen windows we don't want the shadow to be
renderer at all.
2014-07-25 14:02:27 +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
Martin Gräßlin f0e1e3187e Add a script to enforce window decorations for GTK windows
This is going to be a controversal change. It enforces KWin decorations
on all client side decorated windows from GTK+. Unfortunately we are
caught between a rock and a hard place. Keeping the status quo means
having broken windows and a more or less broken window manager due to
GTK+ including the shadow in the windows. This is no solution.
Enforcing server side decorations visually breaks the windows. This is
also no solution. So why do it?

It's our task to provide the best possible user experience and KWin is
a window manager which has always done great efforts to fix misbehaving
windows. One can think of the focus stealing prevention, the window rules
and lately the scripts. The best possible window management experience is
our aim. This means we cannot leave the users with the broken windows
from GTK.

The issues we noticed were reported to GTK+ about 2 months ago and we are
working on improving the situation. Unfortunately several issues are not
yet addressed and others will only be addressed in the next GTK+ release.
We are working on improving the NETWM spec (see [1]) to ensure that the
client side decorated windows are not in a broken state. This means the
enforcment is a temporary solution and will be re-evaluated with the next
GTK release. I would prefer to not have to do such a change, if some of
the bugs were fixed or GTK+ would not use client-side-decos on wms not
yet supporting those all of this would be a no issue.

For a complete list of the problems caused by GTK's decos see bug [2] and
the linked bug reports from there.

The change is done in a least inversive way in KWin. We just check for
the property _GTK_FRAME_EXTENTS and create a Q_PROPERTY in Client for it.
If we add support for the frame extents in future we would also need
this. So it's not a change just for enforcing the decoration.

The actual enforcing is done through a KWin script so users can still
disable it.

REVIEW: 119062

[1] https://mail.gnome.org/archives/wm-spec-list/2014-June/msg00002.html
[2] https://bugzilla.gnome.org/show_bug.cgi?id=729721
2014-07-03 16:03:22 +02:00
Martin Gräßlin c4caf705da Fix build breakage when input module gets compiled 2014-06-03 15:24:49 +02:00
Martin Gräßlin 7910fed659 Improve updating user timestamp
Use the timestamp from the xcb event which triggers the update whenever
possible. If we don't have access to the latest event, let's at least
update our own xTime prior to using it.

Slightly unrelated change included: Group switches the userTime from
XLib datatype to xcb datatype.

BUG: 335637
REVIEW: 118456
2014-06-03 13:59:10 +02:00
Martin Gräßlin 8543033d59 Reparent decoration window by using a QWindow wrapper for the frame
Qt doesn't like that we reparent the decoration using low level xcb
calls. So let's use a QWindow wrapper for the frame and let Qt do
the reparenting itself.

BUG: 334768
REVIEW: 118159
2014-06-03 09:22:18 +02:00
Martin Gräßlin 9cce470c35 Turn Client::delayedMoveResize() into a lambda slot
Only used for the delayedMoveResizeTimer as timeout slot. Code is small
so a lambda makes more sense. At the same time the code is slightly
improved to ensure that startDelayedMoveResize is never called while
the timer is already active.

This means that mousePressEvents are now required to come from the
decoration.

REVIEW: 117843
2014-05-07 10:21:03 +02:00
Martin Gräßlin 068ee6d39c Use uint32_t instead of long in Client::sendClientMessage 2014-05-05 08:09:10 +02:00
Martin Gräßlin 75f80e88ed Port Client::manage away from XGetWindowAttributes
Replaced by Xcb::WindowAttributes and Xcb::WindowGeometry. Also arguments
of Client::embedClient are adjusted to take the required values directly.
2014-05-05 08:09:10 +02:00
Martin Gräßlin 7d302b9039 Keep timestamp of last syncRequest and update with xTime on each sync
The sync protocol with e.g. Qt 4 windows is broken if our app time is
older than the one of the last sync alarm event. Thus we keep a timestamp
in the syncRequest struct of the last sent sync request. If the timestamp
is newer than our xTime when sending the next request, we update the
xTime to ensure that we have a new timestamp again.

BUG: 333512
REVIEW: 117734
2014-04-28 07:45:53 +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 fd0fd82ad6 Use NETWM to get updates on blocking compositing
Adds NET::WM2BlockCompositing to the Client's properties which allows to
read the state from the NETWinInfo object and get updates without having
to resolve the atom ourselve.

REVIEW: 117561
2014-04-14 15:34:39 +02:00
Martin Gräßlin c390a94261 Use new connect syntax in client.cpp
Excluded are the signals to Appmenu as that's currently excluded from
build.

Private slots with only one connection are turned into lambdas.

REVIEW: 117355
2014-04-04 12:10:56 +02:00
Martin Gräßlin d0fb6b22ba [kwin] Use new connect syntax in useractions.cpp
Although there are many local slots in UserActionsMenu those are not
turned into lambdas as they are rather long.

REVIEW: 117117
2014-03-27 18:11:19 +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 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 1bc624f9f7 [kwin] Move Client specific code from utils.h to client.(h|cpp)
* Motif to client.cpp
* ClientWinMask to client.cpp
* ForceGeometry_t to Client

REVIEW: 116901
2014-03-19 18:54:00 +01:00