Commit graph

65 commits

Author SHA1 Message Date
Martin Gräßlin
29b2082daa [wayland] Honor ShellSurfaceInterface::acceptsKeyboardFocus in ::wantsInput
If the surface indicates that it doesn't want keyboard focus we shouldn't
give it keyboard focus.

This was a problem with Kate's autocompletion tool tip windows.

REVIEW: 125553
2015-10-08 12:51:49 +02:00
Martin Gräßlin
3cb8438399 [wayland] Keep transient state directly in ShellClient
So far we delegated to ShellSurfaceInterface, but it's possible that
we call into isTransient when the ShellSurfaceInterface is already
destroyed.
2015-10-08 11:04:06 +02:00
Martin Gräßlin
b35c3e8501 [wayland] Keep fullscreen state directly in ShellClient
So far we delegated to ShellSurfaceInterface, but it's possible that
we call into isFullscreen when the ShellSurfaceInterface is already
destroyed.

Note: the functionality needs to be slightly reworked. The fullscreen
state should change once we get a buffer for fullscreen, not when the
client requests it. This is a general pattern which is wrong also for
maximized, etc.
2015-10-08 10:05:40 +02:00
Marco Martin
0bf64446cd remove unwanted debug and change in 9912d84 2015-10-01 16:03:02 +02:00
Martin Gräßlin
242e2806ca [wayland] Properly support add/remove transient on ShellClient
Whenever we set a transient we must register it with the parent and
remove it again. Also if a parent gets destroyed we must inform the
transients.

This fixes a crash in Deleted::copyToDeleted when connecting the main
clients. The crash condition was hit if the parent got destroyed
before the transient.

Reviewed-By: Marco Martin
2015-10-01 14:12:46 +02:00
Marco Martin
9912d84f74 supports kwayland skipsTaskbar
read the skipTaskbar property from plasmashellsurface
and set it accordingly in the corresponding PlasmaWindow
for the model
REVIEW:125454
2015-09-30 16:55:32 +02:00
Martin Gräßlin
9f054bd8ad Fix connects with QPointer
We need to call data() on the QPointer in a connect, otherwise
compilation fails on some compilers.
2015-09-28 14:09:10 +02:00
Martin Gräßlin
d25c465211 Move layer functionality to AbstractClient
Merges together the code from ShellClient and Client and removes the
starting differences. Long term it's better to have only one
implementation to prevent diversions in the implementation.

As it doesn't match exactly protected virtual methods are called
which allow more specific implementations for a certain aspect of the
layer resolving.
2015-09-17 11:06:59 +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
fda5a5feea [wayland] A popup shell surface doesn't want input 2015-09-16 13:52:25 +02:00
Martin Gräßlin
a86a7e7b3c Add a placement strategy for transient ShellClients
A transient ShellClient has an offset position to the parent surface.
Use this to position the ShellClient properly.

This fixes the random placement of menus.
2015-09-16 13:52:25 +02:00
Martin Gräßlin
0935a60b38 Implement transientFor in ShellClient 2015-09-16 13:52:25 +02:00
Martin Gräßlin
16e9c8375c [wayland] Don't delete Surface we got fromWindow
KWayland changed to cache created Surfaces and not create a new one
each time. If we delete it, we run in double deleted situations.
2015-09-15 12:18:36 +02:00
Marco Martin
658a28a257 support OnScreenDisplay from wayland 2015-09-03 18:19:38 +02:00
Martin Gräßlin
28b48e69fb [wayland] Add repaints on geometry changes 2015-08-25 14:33:51 +02:00
Martin Gräßlin
e0103b15b7 [wayland] Remove the specific socket pair for QtWayland
Our own QPA plugin shares the internal connection, so we don't need the
dedicated connection for the QPA any more.
2015-08-25 14:33:50 +02:00
Martin Gräßlin
c56bbc0ddf Composite windows from a QOpenGLFramebufferObject
This change introduces a mechanism for internal windows to be rendered
to a QOpenGLFramebufferObject to be composited using the texture bound
to the FBO. This is useful for in-process rendering (e.g. QtQuick) and
at the same time bypassing the windowing system.

The OpenGL context of the QOpenGLFramebufferObject needs to be sharing
with the compositing OpenGL context.
2015-08-25 14:33:50 +02:00
Martin Gräßlin
a5185f924d Fix naming 2015-07-22 08:38:00 +02:00
Martin Gräßlin
01d805f193 [wayland] Pass appId to PlasmaWindow interface
For the appId we use:
* wl_shell windowClass for Wayland clients
* resourceName from window class for X11 clients

This is implemented by sharing the window class implementation in
Toplevel.

CCMAIL: hein@kde.org
2015-07-20 09:37:36 +02:00
Martin Gräßlin
a3db04f66e [wayland] Improve mapping of windowClass to desktop file
QtWayland might also pass a name like "app.desktop". In that case
we should not append .desktop to it.
2015-07-15 17:18:39 +02:00
Martin Gräßlin
df1146bfa6 [wayland] Shadow gains support for a Wayland protocol
For Wayland clients we now are able to get shadows.

Internally this reuses large parts of the X11 implementation. This
could be improved to make the Scene's better aware of the Wayland
shadow, so that less memory is needed.
2015-07-15 11:25:16 +02:00
Martin Gräßlin
f304a49a58 [wayland] Only activate ShellClient in takeFocus if it wantsInput
This ensures that e.g. virtual keyboards don't get activated.
2015-07-09 20:43:41 +02:00
Martin Gräßlin
8d407157c4 Provide a base implementation for performMouseCommand in AbstractClient
Most commands can be operated directly in AbstractClient already which
means less code duplication to make the commands work for wayland
clients.
2015-07-09 16:34:19 +02:00
Martin Gräßlin
72635101f0 [wayland] Improve creation of KWayland::Server::PlasmaWindowInterface
The creation of PlasmaWindowInterface is moved from WaylandServer into
AbstractClient. This allows the sub classes to better control when to
create/destroy the Client.

For creation it's bound to becoming visible - that is Windows which are
only created but never shown are not announced at all.

For Client it's destroyed with the normal tear-down of a Client, for
ShellClient it's destroyed on unmapped (which also means a new one
will be created again in case of another mapping of the surface).

As a side effect, this works around the problem that ShellClients do not
yet get destroyed for QtWayland's menus (needs further investigation).
2015-07-09 09:10:33 +02:00
Martin Gräßlin
da4305c2fa [wayland] Focus to null X11 window when activating a Wayland client
Improves interaction with Xwayland clients.
2015-07-07 16:15:58 +02:00
Martin Gräßlin
48bf38e830 [wayland] Trigger update of client area when the panel behavior changes 2015-06-25 09:04:51 +02:00
Martin Gräßlin
7e1e044948 [wayland] Break showing desktop from ShellClient::takeFocus
Logic similar to Client::takeFocus: if window is keep above or on
screen display do not break. Also if window belongs to the same
ClientConnection as a desktop window don't break.
2015-06-23 11:08:28 +02:00
Martin Gräßlin
31e599a63d [wayland] Provide icon from ShellSurface's windowClass
We can use the window class to locate a desktop file and from this
we can load a themed icon.
2015-06-20 01:11:42 +02:00
Martin Gräßlin
2192bd69e0 [wayland] Add support for PanelBehavior in ShellClient
The PanelBehavior determines the stacking of panel surfaces and whether
they "have a strut".
2015-06-20 00:14:49 +02:00
Thomas Lübking
39c35f8f48 fix sendToScreen/checkWorkspaceGeometry
Prime target is to preserve the in-screen
condition of client AND window.i[1]
Atm. when the client is fully in sight
(but the window is not) - regardless of snapping
or screen change - a workspace update (screen change,
resolution change, adding/removing a strutting panel)
would allow the client to partiall escape screen bounds.

This is changed so that if the client is fully in sight,
it's kept fully in sight (but not the decoration)
If the entire window was fully in sight, it's also kept
(as is right now)
The code handles inner screen edges (if the client was in sight,
the entire window will be if we'd bleed to the other screen)

[1] I'd say that handling the client is more relevant,
but foresee more complaints if the window wasn't handled anymore ;-)

During that, i stumbled across some other issues.
- when a window centered on one screen is moved to a screen smaller
  than the window, the window is shrinked to the dimensions of that
  screen and now randomly touches eg. left AND right edge. When
  moved back, the right and bottom edge were preferred
  (to the window was "moved" into the lower right corner).
  It's now kept centered.
- geom_restore was saved before keeping the window in the new
  screen area (causing accidental drops on screen changes)

BUG: 330968
REVIEW: 122517
FIXED-IN: 5.4

Prime target is to preserve the in-screen condition
of client AND window.[1]
Atm. when the client is fully in sight (but the window is not) -
regardless of snapping or screen change - a workspace update
(screen change, resolution change, adding/removing a strutting
panel) would allow the client to partiall escape screen bounds.

This is changed so that if the client is fully in sight,
it's kept fully in sight (but not the decoration)
If the entire window was fully in sight, it's also kept
(as is right now)
The code handles inner screen edges (if the client was in sight,
the entire window will be if we'd bleed to the other screen)

[1] I'd say that handling the client is more relevant,
but foresee more complaints if the window wasn't handled anymore ;-)

During that, i stumbled across some other issues.
- when a window centered on one screen is moved to a screen
smaller than the window, the window is shrinked to the dimensions
of that screen and now randomly touches eg. left AND right edge.
When moved back, the right and bottom edge were preferred
(to the window was "moved" into the lower right corner).
It's now kept centered.
- geom_restore was saved before keeping the window in the new
screen area (causing accidental drops on screen changes)

BUG: 330968
REVIEW: 116029
FIXED-IN: 5.3
2015-06-19 19:48:39 +02:00
Boudewijn Rempt
98bcdbe70a [wayland] Add a command-line option to start an input method server
Input-method servers, like maliit, need to be known to KWin since KWin
needs to know about virtual keyboards. Virtual keyboards should be shown
as OSD layers, and they are one of the types of windows that actually
should be showable when the lock screen is active.

kwin_wayland --inputmethod /path/to/your/input-server

tries to start the input server. The input-server's window never gets
keyboard focus and is shown on top of all windows except for KWin's
internal clients.
2015-06-13 04:06:12 +02:00
Boudewijn Rempt
1d78430acc A shell client's layer is OSD if it's OSD 2015-06-13 04:05:15 +02:00
Boudewijn Rempt
955b0bb8e8 warnings--: unused parameter 2015-06-12 17:51:02 +02:00
Marco Martin
9744625253 don't close desktop windows and docks
reviewed-by:Martin Gräßlin <mgraesslin@kde.org
2015-06-11 16:21:44 -07:00
Martin Gräßlin
ad80e31e6a [wayland] Reset ShellClient::m_unmapped before calling setReadyForPainting
m_unmapped determines whether the ShellClient wantsInput. This is used by
the ScriptingModel to check whether a ShellClient should be included. It
gets triggered by windowShonw signal called from setReadyFromPainting. If
m_unmapped is still true at that point the ScriptingModel doesn't include
it.
2015-06-10 20:31:41 +02:00
Martin Gräßlin
93c88aa446 [wayland] While a ShellClient is not shown, it won't take input 2015-06-10 17:46:55 +02:00
Martin Gräßlin
11e0e75fb3 Add a signal Toplevel::windowHidden
Signal is connected in ScriptingModel together with windowShown.
2015-06-10 17:45:59 +02:00
Thomas Lübking
41be18e317 Robust modal activation; ensure showing activated
...window

REVIEW: 123875
BUG: 348083
2015-06-10 08:50:16 +02:00
Martin Gräßlin
f696b578cc [wayland] Add support for QtSurfaceExtension for closing ShellClients
If the ShellClient has a QtExtendedSurface it's closeable.
2015-06-10 00:59:53 +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
280075b7cd [wayland] Support windowType for internal windows
Our internal windows (e.g. a declarative script) can specify their own
window type which then can get honored by KWin.
2015-06-08 21:27:55 +02:00
Martin Gräßlin
e46ad2091b [wayland] Internal ShellClient is on all desktops 2015-06-08 20:18:40 +02:00
Martin Gräßlin
7cded49145 [wayland] Implement maximizing of ShellClient 2015-06-07 03:28:38 +02:00
Martin Gräßlin
239104b4f4 [wayland] Trigger layerRepaint on old geometry when changing geometry
Applies for the case that we have a positionAfterResize.
2015-06-07 02:38:53 +02:00
Martin Gräßlin
35abacabc4 [wayland] Handle unmap in ShellClient
Do not destroy the ShellClient when the Surface gets unmapped. Instead
just hide the ShellClient and show it again on the next damage.
2015-06-03 21:19:00 +02:00
Martin Gräßlin
5a98d8bbbd [wayland] Set depth in ShellClient depending on whether the Buffer has alpha
We need to set the depth in order to properly determine whether the
Surface has an alpha channel and whether blending needs to be enabled
for rendering.

For this a new method is introduced in Toplevel to set the depth. If
the depth changed in a way that the Toplevel gained or lost the alpha
channel a signal is emitted which implies that the hasAlpha property of
Toplevel is no longer constant.
2015-06-01 16:25:21 +02:00
David Edmundson
9791978d53 enable wayland clients to go fullscreen
REVIEW: 123853
2015-05-28 10:58:40 +01:00
Martin Gräßlin
988ce28943 [wayland] Ensure size is updated before marking window as ready for painting
Fixes regression introduced with 90a6814: we may not queue a signal
taking a pointer to a ShellClient as the ShellClient might be destroyed
before the queued signal is delivered.

The idea for the queued signal was to ensure that the size is set when
windowShown is emitted - this can also be achieved by first updating the
size.
2015-05-28 08:27:34 +02:00
Martin Gräßlin
007e1253c6 Add resizeWithChecks to AbstractClient
The virtual method does not take the xcb_gravity_t - that's only added
in a variant in Client.
2015-05-27 14:20:11 +02:00
Martin Gräßlin
da2731be51 Move Client::move to AbstractClient and add implementation in ShellClient 2015-05-27 10:16:46 +02:00