Commit Graph

588 Commits (4f1c98773e1eccdcc7a23aede04571d576749e50)

Author SHA1 Message Date
Martin Gräßlin 4f1c98773e Workspace::showWindowMenu operates on AbstractClient 2015-05-08 12:43:45 +02:00
Martin Gräßlin c357ac01fe Workspace::restackClientUnderActive operates on AbstractClient 2015-05-08 12:43:45 +02:00
Martin Gräßlin ddcd4dab59 Workspace::slotWindowTo(Previous|Next)Desktop operates on AbstractClient 2015-05-08 12:43:45 +02:00
Martin Gräßlin 1d4701d67e Workspace::takeActivity operates on AbstractClient 2015-05-08 12:43:45 +02:00
Martin Gräßlin 484f9b6e65 Workspace::activateClient and ::requestFocus changed to AbstractClient
requestFocus delegates to takeActivity which is not yet adjusted but
performs a nullptr check, thus we pass a casted Client.
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 519006ffa4 Workspace::performWindowOperation operates on AbstractClient
Only exception is the call to ::takeActivity which still expects a
Client.
2015-05-08 12:43:45 +02:00
Martin Gräßlin bfa4e1cec1 Workspace::cascadeOffset operates on AbstractClient 2015-05-08 12:43:45 +02:00
Martin Gräßlin 942b49e2c4 Workspace::setupWindowShortcut operates on AbstractClient 2015-05-08 12:43:45 +02:00
Martin Gräßlin aa1e9161d5 Workspace::clientArea takes AbstractClient instead of Client 2015-05-08 12:43:44 +02:00
Martin Gräßlin 7c187359a7 Workspace::sendClientToScreen operates on AbstractClient 2015-05-08 12:43:44 +02:00
Martin Gräßlin f800477be5 Use AbstractClient for raise/lowerClient
Not a 100 % port. Transient handling is still bound to Client and
does a static cast back to Client.
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 792745c963 Change Workspace::restack to operate on AbstractClient 2015-05-08 12:43:44 +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
Mika Allan Rauhala 2217c1038f Add Quick Tile Window to the Top and Bottom shortcuts
This adds "Quick Tile Window to the Top" and "Quick Title Window to the Bottom" shortcuts. These are
useful for those using displays that are in portrait orientation.

CCBUG: 310005
REVIEW: 123153
2015-03-31 11:10:13 +02:00
Martin Gräßlin 7369a2c3a5 [kwin_wayland] Support using platform wayland for the QPA
This reorders the startup sequence quite a bit:
1. Create QAbstractEventDispatcher and install it on QCoreApplication
2. Create Application
3. Start Xwayland, use thread to get when its ready
4. Create xcb connection
5. perform startup

For using the wayland QPA it needs a patch in QtWayland which will be
part of Qt 5.4.2, otherwise it blocks.
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
Thomas Lübking ea5a5f196d allow forcefull restacking
when restacking for shaded windows and uncomposited tabboxes
the group check should not be applied since we know better
eg. to restore a former order

CCBUG: 186206
REVIEW: 122469
2015-02-10 21:40:55 +01:00
Thomas Lübking ff700a8db5 fix e3768b4355
accidentally picked the patch from the wrong branch
just about comments
2015-02-06 00:27:31 +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 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 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
Fredrik Höglund 869ebdd4c0 Add an X11EventFilter class
This class provides an event filter, specific to an event type, that
can be registered with Workspace to filter events.
2014-09-18 20:21:20 +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
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 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 11d0176dc9 [kwin] Drop predicate based Workspace::forEachUnmanaged
Unused code.
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 7d48b92e2b Redirect pointer events to the Toplevel
InputRedirection keeps track of the Toplevel which is currently the one
which should get pointer events. This is determined by checking whether
there is an Unmanaged or a Client at the pointer position. At the moment
this is still slightly incorrect, e.g. pointer grabs are ignored,
unmanaged are not checked whether they are output only and input shapes
are not yet tracked.

The pointer events are delivered to the Toplevel as:
* enter
* leave
* move
* button press
* axis event

Nevertheless move events are still generated in InputRedirection through
xcb test for simplicity. They are still send to the root window, so all
windows get mouse move.

Button press and axis are generated only in the implementations of the
event handlers and delivered directly to the window, so other windows
won't see it.
2014-03-18 09:00:50 +01:00
Martin Gräßlin 7c7f137832 [kwin] Drop handling for mouse motion event compression
Not needed as Qt does it for us in the xcb plugin - see
QXcbConnection::processXcbEvents().
2014-02-01 09:34:40 +01:00
Martin Gräßlin 08a09d27f8 [kwin] Remove the KActionCollection for the client keys
Not needed as we can also find the action as a child of Workspace.
2013-12-10 10:15:23 +01:00
Martin Gräßlin a6f32bf3e8 [kwin] Do not use a KActionCollection for Workspace's global shortcut actions
The ActionCollection was only used for two features:
* setting the object name
* finding the action for retrieving it's shortcut

This can also be achieved by just setting the object name and searching
for the children of the Workspace singleton.
2013-12-10 10:01:13 +01:00
Martin Gräßlin 81a7a528bb [kwin] Block global shortcuts without KGlobalSettings
DBus call directly to kglobalacceld and don't wait for a signal to
come back.
2013-12-06 10:28:42 +01:00
Martin Gräßlin 9f6f0dd688 [kwin] Drop reaction on SETTINGS_SHORTCUTS changed
This looks mostly like dead code. The change got only emitted by the
KCMKeyboard on save. In ancient times this seems to have caused to
re-read the global shortcuts. Code got commented out during KDE4 times
and after several code refactors all that was left of it was discarding
the user actions menu.
2013-12-06 10:20:10 +01:00
Martin Gräßlin 1398f9ed04 Remove left-over from disable global shortcuts removal
There used to be an own action collection in KDE 3 times for the
block global shortcuts shortcut. But the code ws disabled and by
that I didn't see it during removing the global shortcuts blocking.
And it explains why the global shortcut blocking didn't work.
2013-09-09 09:53:39 +02:00
Martin Gräßlin 0e24f4ead4 Introduce an initShortcut method for kwinbindings
Method replaces the logic of the macros. The macros are still there
to not need to change all the code. Major difference is that the new
method uses the compile time checked connect syntax.
2013-09-09 09:41:37 +02:00
Martin Gräßlin f4a96da547 Client shortcuts ported to QKeySequence
Pretty straight forward, though not yet tested.
2013-09-09 06:03:35 +02:00
Martin Gräßlin 37334f400a Drop no longer needed XLib includes from KWin 2013-08-20 10:29:20 +02:00
Martin Gräßlin c2e0c13b7b Delay performWindowOperation to next event cycle in UserActionsMenu
In case that the window operation results in destroying the window
decoration we need to have the menu closed before the deco gets
destroyed. Otherwise Qt crashes.
2013-08-19 12:15:42 +02:00
Martin Gräßlin 3d414b908a Remove kapplication.h include from sm.h
Not needed in sm.h and pollutes the includes of most header files.
2013-08-06 11:20:28 +02:00
Martin Gräßlin 46f57221e4 Mouse motion event compression
Using a QTimer to move the resize/move related code to the end of the
event queue. In case there is another motion event in the queue it will
cancel the timer.
2013-08-06 11:20:27 +02:00
Martin Gräßlin b90c2c0e6a Modern variant of forEachClient/forEachUnmanaged
Takes a std::function as argument which allows to pass a lambda function
which gets executed for each client/unmanged:

ws->forEachClient([](Client *client) {
    client->releaseWindow();
});
2013-08-05 09:42:10 +02:00
Martin Gräßlin 075b0602e9 Get proper event window from xcb event
Find the event window and try to get a Client or Unmanaged from it
to pass it through the filter.
2013-07-29 09:00:44 +02:00