Commit graph

632 commits

Author SHA1 Message Date
Martin Flöser
36a3189863 Create a dedicated X11EventFilter for recognizing first user interaction
Summary:
Workspace monitors the X11 events to detect when the user first
interacts with the system. This is only required on X11 for activating
the same client from previous session. So far this was spread over many
parts in the long event switch statement. To make this more contained a
dedicated event filter is introduced which also gets deleted again once
the first user interaction got recognized.

Test Plan: Compiles

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7371
2017-08-19 10:14:53 +02:00
Martin Flöser
c8c15f0057 Use std::bind expression for Workspace::slotWindowtoDesktop
Summary:
This way we don't need the sender() hack to get the value set on the
QAction.

Test Plan: New autotest in master still passes

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D6811
2017-07-29 17:41:33 +02:00
Martin Flöser
7d3517060f Drop the Workspace::slotSwitchWindowFoo methods
Summary:
They were only delegating into switchWindow(Direction), so let's do the
same through std::bind in kwinbindings and delegate to it directly in
scripting's WorkspaceWrapper.

Test Plan: Not yet, want to add test case for Workspace::switchWindow

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D6791
2017-07-29 17:40:55 +02:00
Martin Flöser
64da6c8d1e Replace Workspace::slotWindowQuickTileFoo by a quickTileWindow with argument
Summary:
Thanks to std::bind we don't need that many different slots to setup the
global shortcut connections. Instead we can have one shared
implementation which takes the argument and passes it to the window.

To support std::bind arguments in kwinbindings the initShortcut method
and dependencies are adjusted as well as a new macro is added.

As I don't want to include abstract_client.h in workspace.h a new enum
is created for the quick tiling flags used in Workspace. This caused a
larger refactoring as the change to an enum class also caused quite some
changes.

Test Plan: Affected test cases still pass

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6783
2017-07-29 17:40:03 +02:00
Martin Flöser
c29d6093ba Implement support for window shortcuts for Wayland windows
Summary:
Moves most of the implementation from Client to AbstractClient, so that
it can be used for both Client and ShellClient. Only the X11 specific
code is kept in Client.

Not yet implemented is updating the window caption.

Unfortunately the testing of this feature showed that setting a window
shortcut is not working on Wayland at all (the Qt widget doesn't properly
catch the shortcut). So this feature is currently only of erm theoretical
use.

Test Plan: Added new test case. No testing in real world as explained.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6818
2017-07-25 07:12:42 +02:00
Martin Flöser
630514d52a Remove roundtrip to XServer from Workspace::xStackingOrder
Introduce a method Workspace::markXStackingOrderAsDirty

Summary:
This method replaces the calls x_stacking_dirty = true in the code base
allowing for further refactoring of that functionality.

Remove roundtrip to XServer from Workspace::xStackingOrder

The method xStackingOrder is only used during a Compositor paint pass.
If the stacking order had changed, the method updated the stacking order
from X by performing a sync XQueryTree. With other words we had a round
trip to the X server directly in the paint pass.

This change rearchitectures this area by making better use of xcb. When
we notice that the stacking order changed and an XQueryTree is needed,
we directly send out the request. When xStackingOrder is finally called,
which normally happens a few milliseconds later, the reply is retreived.
In the worst case it still blocks, but in most cases the roundtrip is
gone.

If the stacking order changed again before accessing xStackingOrder the
running request is cancelled and a new request is issued. So whenever we
get into xStackingOrder it will have the current state.

The updating of the xStackingOrder is moved into a dedicated method and
xStackingOrder invokes it through a const_cast instead of operating on
mutable variables.

Test Plan: Normal system usage, no issues

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6323
2017-07-01 08:21:51 +02:00
Martin Flöser
0d8f11405e Introduce a method Workspace::markXStackingOrderAsDirty
This method replaces the calls x_stacking_dirty = true in the code base
allowing for further refactoring of that functionality.
2017-07-01 08:21:51 +02:00
Kai Uwe Broulik
93938d60b8 Restore global menu support
This brings back global menu support in KWin.
The DBusMenu infrastructure is different that we just read the DBus service name and
menu object path from the windows rather than passing around window IDs on DBus which
won't work on Wayland.

Differential Revision: https://phabricator.kde.org/D3089
2017-01-11 10:21:03 +01:00
Martin Gräßlin
8e32dd4fdc Cycle between windows of the same desktop on switch
Summary:
When switching virtual desktops using shortcuts, the behavior is to
switch to a virtual desktop in the opposite direction if the current
one is on the edges of the layout. For example, in a one row layout with
4 virtual desktops, "Switch One Desktop to the Left" while in virtual
desktop # 1 will send the user to virtual desktop # 4. Likewise, in a 3
rows layout with 9 virtual desktops, "Switch One Desktop Down" while in
virtual desktop # 8 will lead the user to desktop # 2.

This patch uses the same behavior whilst changing windows using
"Switch to Window Above|Below|to the Right|to the Left".
For example, in a 3 display set-up (my set-up), the user would go from an
application in the rightmost position to an application in the leftmost
position using just one key combination: "Switch to Window to the Right".
Currently, the shortcuts are no-op in these cases (ie, trying "Switch to
Window to the Left" from the leftmost window has no outcome, which is
mostly accurate with the shortcut semantics but totally useless in behavior).

Reviewers: #vdg, #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: luebking, subdiff, colomar, graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3602
2016-12-22 21:27:28 +01:00
Martin Gräßlin
4c0e33a94c Add a Workspace::findToplevel(QWindow*) method
This allows finding the Toplevel for a QWindow which is on Wayland a
ShellClient and on X11 an Unmanaged. This can be used to simplify
code when a Toplevel is needed for an internal QWindow without having
to do platform specific checks.
2016-08-30 15:47:59 +02:00
Martin Gräßlin
445335ba5f Merge signal connections for AbstractClient in Workspace
Summary:
Have one dedicated method which performs the connection for both
Client and ShellClient. This fixes the desktopPresenceChanged signal
not being passed to the effects.

Note that not all signals are merged. Most signals setup for Client
don't make sense for ShellClient as ShellClient cannot block composite
or unredirect.

Test Plan:
Test case added for ShellClient to ensure that the signal
is correctly invoked on the ShellClient, Workspace and EffectsHandler.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2059
2016-07-13 10:44:34 +02:00
Martin Gräßlin
59e3b96812 Add a Toplevel *Workspace::findInternal(QWindow *w) const
This method is able to match a QWindow created by KWin to a Toplevel.
On X11 by matching winId against Unmanaged, on Wayland by matching
to internal window of ShellClient.

Finding the internal window is a commonly needed feature to e.g.
elevate the TabBox window.
2016-03-04 09:42:33 +01:00
Martin Gräßlin
6b06779a64 Port Workspace::requestDelayFocus to AbstractClient
And also call cancelDelayFocus when removing a ShellClient.
2016-02-18 11:18:50 +01:00
Martin Gräßlin
df4bb8296a Port Workspace::clientUnderMouse to AbstractClient 2016-02-18 10:28:00 +01:00
Martin Gräßlin
89be6cf4ed Add a Workspace::forEachAbstractClient 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
6dc211dfaf Workspace::adjustClientSize operates on AbstractClient
And now also during resizing clients snap to ShellClients.
2015-09-18 14:05:19 +02:00
Martin Gräßlin
47d2b4cb49 Workspace::adjustClientPosition operates on AbstractClient
With that moving clients snap also against ShellClients and not just
Clients.
2015-09-18 13:46:42 +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
Marco Martin
49e5e81970 support raise and lower windows on wayland
connect raise/lowerRequested to workspace()->raiseClientRequest
/workspace()->lowerClientRequest
REVIEWED-BY:Martin Graesslin
2015-09-16 16:36:26 +02:00
Martin Gräßlin
fc5b303c5f Workspace::raiseClientWithinApplication opertes on AbstractClient 2015-09-16 13:54:48 +02:00
Martin Gräßlin
e46bf87311 Workspace::lowerClientWithinApplication operates on AbstractClient 2015-09-16 13:54:48 +02:00
Martin Gräßlin
5f429625f0 Workspace::topClientOnDesktop returns AbstractClient 2015-09-16 13:54:48 +02:00
Martin Gräßlin
a9d8926d3c Workspace::findDesktop returns AbstractClient 2015-09-16 13:54:48 +02:00
Martin Gräßlin
4a3d0fdac6 Workspace::updateOnAllDesktopsOfTransients operates on AbstractClient 2015-09-16 13:54:47 +02:00
Martin Gräßlin
2f7597e522 Move transients from Client to AbstractClient
Unfortunately introduces a few casts to Client again.
2015-09-16 13:54:47 +02:00
Martin Gräßlin
4ad749e560 Workspace::ensureStackingOrder can operate on QList<Client*> or QList<AbstractClient*>
Preparation for getting Client::transients() to be AbstractClient as
ensureStackingOrder is called on the transients.
2015-09-16 13:54:47 +02:00
Martin Gräßlin
1e00e1597a Workspace::keepTransientAbove operates on AbstractClient 2015-09-16 13:52:25 +02:00
Martin Gräßlin
9a8f94f8fc Workspace::gotFocusIn and ::shouldGetFocusIn changed to operate on AbstractClient 2015-07-09 16:34:19 +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
597a9da77f Workspace::activateNextClient and clientHidden operate on AbstractClient
This is required to change the active_client after the active_client
closes.
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
16568804be Demands Attention handling in Workspace operates on AbstractClient
Affects:
* list attention_chain
* clientAttentionChanged
* clientDemandsAttentionChanged
2015-05-08 12:43:47 +02:00
Martin Gräßlin
b84118a51b Workspace::updateClientLayer operates on AbstractClient
Requires a virtual updateLayer in AbstractClient. Default implementation
does nothing.
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
af48d38d22 Workspace::should_get_focus becomes QList<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
b1026aa162 Workspace::allowFullClientRaising operates on AbstractCliet 2015-05-08 12:43:46 +02:00
Martin Gräßlin
1d7d1787a8 Workspace::last_active_client becomes an AbstractClient 2015-05-08 12:43:46 +02:00
Martin Gräßlin
f28d759352 Workspace::allowClientActivation operates on AbstractClient
Still requires a dynamic_cast for check on should_get_focus. To be
removed once Workspace::should_get_focus is a list of AbstractClients.
2015-05-08 12:43:46 +02:00
Martin Gräßlin
683fc0613f Workspace::packPosition* operates on 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
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