Commit Graph

575 Commits (c46c92e20460f8450aa291b35710da8c7010899b)

Author SHA1 Message Date
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
Martin Gräßlin f11e3283d7 Introduce an XcbEventFilter and install it in the Application
Forwards all xcb events to Workspace::workspaceEvent() which got changed
to process xcb events instead of XEvents. So far all handling is
disabled. Will be re-enabled step by step in the following patches.
2013-07-29 08:58:05 +02:00
Martin Gräßlin 1d2c2d5982 Use Q_SLOTS and Q_SIGNALS instead of slots and signals
Fixes compilation with Qt5/KF5 setup.
2013-07-24 09:46:54 +02:00
Martin Gräßlin 17e38f3357 Remove "Block global shortcuts" global shortcut
This shortcut did not make any sense to me, because you could block the
global shortcuts for KWin, but not re-enable them again. So once blocked,
it was blocked for ever till kwin --replace &.

This is in opposite to the commit message which introduced it
(see BUG 108961).

REVIEW: 110364
2013-05-28 08:02:12 +02:00
Thomas Lübking f2dd6d02b1 add previous screen shortcuts
REVIEW: 110521
BUG: 303083
FIXED-IN: 4.11
2013-05-22 22:25:15 +02:00
Martin Gräßlin d305185247 Remove Workspace pointer from Toplevel
Instead have a simple workspace() method returning the pointer.
2013-05-13 08:28:16 +02:00
Martin Gräßlin c4c3eb90fb Remove outdated showWindowMenu(At) functions
Instead of wrapping for exactly one case let's just use the proper
function calls and get rid of all those methods marked as "remove KDE4"
and "backwards compatibility".

REVIEW: 110292
2013-05-04 09:58:44 +02:00
Martin Gräßlin 0811d17329 Encapsulate colormap related functionality in own class
Split out the default and installed colormap from Workspace and put them
into an own class Colormaps.

The method updateColormaps is replaced by a slot update in Colormaps and
activeClientChanged signal is connected to this slot.

At the same time the colormap related code is straight forward ported to
xcb.

REVIEW: 110248
2013-05-02 13:47:02 +02:00
Martin Gräßlin b6681ddc3a Turn RootInfo into a KWIN_SINGLETON
It's not a typical singleton as the ctor is not taking a Workspace* and
needs addtional data to be passed to NETRootInfo.

All the initialization code is moved to RootInfo::create() and the tear-
down code is moved to RootInfo::destroyed(). This includes the support
window which used to be a member of Workspace. It's only needed by
RootInfo, so there is no need to have the ownership inside Workspace.

Instead of using a QWidget we just create a normal window through xcb.
It gets destroyed again in the tear-down code after the RootInfo got
destroyed.

REVIEW: 110238
2013-05-01 19:14:38 +02:00
Martin Gräßlin 2320b71cb7 Port Workspace's null focus window to xcb
Adding wrappers to Xcb::Window for setInputFocus.

REVIEW: 110246
2013-05-01 19:10:06 +02:00
Martin Gräßlin 23b395059f s/Time/xcb_timestamp_t/g in workspace.h
REVIEW: 110249
2013-05-01 19:08:00 +02:00
Martin Gräßlin 28d7b3c563 s/Window/xcb_window_t/g in workspace.h 2013-05-01 19:07:56 +02:00
Martin Gräßlin db18c08dd0 Move RootInfo and WinInfo into an own header and impl file
Main motivation for this change is that it's unhandy to have the class
definition in workspace.h and client.h while the implementation is in
events.cpp although nothing in events.cpp uses it directly.

By getting it out of workspace.h we get the header a little bit smaller
which should improve compile time given that it's included almost
everywhere.

In events.cpp the enum usage is changed to NETWinInfo as that's the class
where they are defined.

RootInfo does no longer hold a workspace pointer. Where it's needed it
uses the singleton accessor of Workspace.

REVIEW: 110199
2013-04-30 08:06:12 +02:00
Martin Gräßlin 65ec86113a Split out Rules related code from Workspace into class RuleBook
Workspace is hardly interacting with Rules and all the Rules related code
is already in rules.cpp. This highly qualifies to move all the code out
of Workspace and improve the names.

REVIEW: 110207
2013-04-30 07:52:08 +02:00