Commit Graph

13091 Commits (4f1c98773e1eccdcc7a23aede04571d576749e50)

Author SHA1 Message Date
Martin Gräßlin 405e366815 Add safety check to InputRedirection::findToplevel
InputRedirection might be invoked to process input events prior to
Workspace being started.
2015-03-20 14:43:47 +01:00
Martin Gräßlin 9a0fd94013 Introduce AbstractBackend as base class for Wayland and X11Windowed backend
The AbstractBackend registers itself in the WaylandServer allowing
external users to easily get to the backend and not needing to test
manually which backend is used.
2015-03-20 14:41:03 +01:00
Martin Gräßlin dae8eed3a8 Introduce a shared base class for the EGL backends
There's quite some overlap and duplicated code. This AbstractEglBackend
tries to merge the two backends a little bit again.

This also introduces an AbstractEglTexture which supports both X11 and
Wayland "pixmaps" so that EglOnXBackend can support Wayland buffers.
2015-03-20 14:08:54 +01:00
Martin Gräßlin a1642a85d3 Allow using EGLOnXBackend with X11WindowedBackend
Mostly refactoring to not take the global X11 information (connection,
display, etc.). Adds a dedicated ctor overload which takes the
X11WindowedBackend.

SceneOpenGL is adjusted to create an EGLOnXBackend instead of Wayland one
if the X11WindowedBackend is used.
2015-03-20 14:08:54 +01:00
Martin Gräßlin 3cc1032839 [wayland] Create xcb_connection through XLib in windowed mode
Adds optional dependency to X11_XCB and gets used in X11WindowedBackend
to create an XLib Display if dependency is present.

This allows to create an EGL backend for the X11WindowedBackend.
2015-03-20 14:08:54 +01:00
Martin Gräßlin 6bf44b7db4 [wayland] Add an X11 output backend
This new backend allows to start a kwin_wayland server nested on an
X-Server by using a normal X11 window as output. This allows testing
kwin_wayland without needing to start another Wayland server first.

The behavior is triggered by using new command line arguments:
--windowed
--x11-display=<:0>

With optional --width and --height arguments.

In this mode the WaylandBackend is not created at all.

So far the backend is not fully integrated yet and only the QPainter
backend supports this mode.
2015-03-20 14:08:53 +01:00
Martin Gräßlin c1ab92d8b4 Make it possible to use XCB::Atom with non-default xcb_connection_t
Preparation step for having an X11 backend in kwin_wayland which has
connection() point to Xwayland and another connection to the parent
X server.
2015-03-20 14:08:53 +01:00
Martin Gräßlin e886bd7c78 Adjust to newer libinput and require at least 0.10
There was API changes regarding axis event handling.
CCBUG: 342893
2015-03-20 12:42:57 +01:00
Martin Gräßlin 7d797387d7 Add safety check for QueryTree
xcb_qeuery_tree should fail and we should not just assume that the
call succeeds.

Crash reported by Harald Sitter.
2015-03-20 12:39:33 +01:00
Martin Gräßlin e2c422dcb5 Woraround possible broken cursor when creating mouse interception window
The xcb_cursor_t returned by xcb-cursor library might be broken. If we
set such a broken cursor directly in the create window call it will fail
with a BadCursor value causing effects to break.

This change works around this problem by creating just the window and
moving the possible breaking call into a change window call. That will
still fail, but the window is working.

In addition it performs a safety check by only installing the cursor
if it's not XCB_CURSOR_NONE.

BUG: 344006
REVIEW: 123025
2015-03-20 10:39:11 +01:00
Martin Gräßlin 3aa4c8d635 Add cursor resolving alternatives
The alternative names are taken from the xcursortheme kcm in
plasma-desktop. An example theme where they are needed is "dmz".
2015-03-20 10:39:11 +01:00
Martin Gräßlin 305387ec3a [kcmkwin/rules] Set dynamic property for x11Connection and x11RootWindow
Needed by kwinglobals which gets used internally through DetectWidget.

BUG: 345339
2015-03-20 08:19:45 +01:00
Michael Pyne 85d87297b0 Return false for a bool instead of nullptr.
Fixes compiler warning (error by default in gcc 5).

REVIEW:123077
2015-03-19 23:22:46 -04:00
Jonathan Riddell ff321a62e3 Update version number for 5.2.2 2015-03-19 11:38:17 +01:00
Aleix Pol f6db54618b Merge branch 'Plasma/5.2' 2015-03-19 01:15:41 +01:00
Aleix Pol 25f71d1a12 Fix build 2015-03-19 01:15:22 +01:00
Martin Gräßlin 862bb95ffb [wayland] Do not start composite timer if Workspace is not ready yet
Could cause a race during startup resulting in crash.
2015-03-18 16:27:22 +01:00
Martin Gräßlin 8b8167b565 Do not init XRenderUtils on Wayland
If something calls into XRender it would be a bug.
2015-03-18 16:24:25 +01:00
Martin Gräßlin cd293220bb EGLImage -> EGLImageKHR
CI system didn't like EGLImage, but always liked EGLImageKHR. So let's
try whether using EGLImageKHR fixes build.
2015-03-17 10:46:50 +01:00
Martin Gräßlin f73da18f2e [wayland] Enforce the wayland QPA
This requires a change present in Qt 5.4.2, without the startup will
freeze. A warning message is shown if the compiled Qt version is not
at least 5.4.2. It's only a warning and an ifdef as distros might
backport the required change.
2015-03-17 10:31:18 +01:00
Martin Gräßlin 371bd4c24f [wayland] Use Surface::setCursor and ::hideCursor in WaylandBackend
Replaces the low level wayland calls and also means that we no longer
need the Wayland client library. Everything wrapped in KWayland.
2015-03-17 10:20:20 +01:00
Martin Gräßlin f600e2f6f4 [wayland] Properly handle Cursor set on focused PointerInterface
This replaces getting the Cursor through the X11CursorTracker which
is now completely dropped. The Cursor data is now passed through from
the Wayland server and forwared to the WaylandBackend.
2015-03-17 10:20:20 +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 7bb107ba6d [wayland] Pass keyboard key press/released events to SeatInterface
Improves handling by no longer sending events with xtest.
2015-03-17 10:20:19 +01:00
Martin Gräßlin c29f96665d [wayland] Pass pointer input events to SeatInterface
Pointer events are no longer sent through the methods on Toplevel,
but properly sent through the SeatInterface. This has the advantage
that SeatInterface properly tracks which is the focused pointer surface
and does not need to use the xtest extension.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 79c49e84a4 [kwin_wayland] Pass socket file descriptor to QtWayland
WaylandServer allows to create a ClientConnection which is intended for
QtWayland. This allows us to easily identify our "own" surfaces. The
created file descriptor is set as env variable WAYLAND_SOCKET prior to
creating the Application. Wayland will unset it after connecting, so we
don't need to unset it. This removes the hack of setting and resetting
the WAYLAND_DISPLAY environment variable.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 69a13a779d [kwin_wayland] Start Xwayland through socket file descriptor
Creates a socketpair in WaylandServer and creates a ClientConnection for
Xwayland. The created file descriptor is passed to Xwayland through the
WAYLAND_SOCKET env variable.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 9dcd123438 [kwin_waylnad] Fix support for QtWayland's client buffer integration
QtWayland performs an eglInitialize in the main thread when for the first
time an OpenGL context/window is needed. In KWin's startup this happens
during initializing Scripting which creates a QDesktopWidget and triggers
the creation of a QWindow with a RasterGLSurface.

Calling eglInitialize in the main thread blocks as it calls wl_roundtrip.
We cannot just disable OpenGL as that would mean that we cannot use
QtQuick.

The workaround in this change is to create a QWindow with a
RasterGLSurface in a thread and call create on it. This ensures that
OpenGL gets initialized in the thread and doesn't block.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 54c2c5db2d [wayland] Create SeatInterface and sync with WaylandBackend's seat
If not using libinput we get the seat information from the lower
level Wayland server: let's forward the information to our own
SeatInterface.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 5b7b0f91c1 [wayland] Fix wayland cursor theme size
If our size is 0, we need to pass -1 to get the proper default size.
2015-03-17 10:20:19 +01:00
Martin Gräßlin fafa22d0c6 [wayland] Invoke frame rendered callback on damaged windows
Introduces a new time counter on Compositor to indicate the elapsed
time sine the compositor started.
2015-03-17 10:20:19 +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 70a9c580fc [wayland] Add support for binding buffer as texture
Adds proper support for binding Wayland buffers to EGLImage.
The loading is split into a shm part and a Wayland buffer part,
so that both is supported.

Wayland buffer support is limited to format EGL_TEXTURE_RGB and
EGL_TEXTURE_RGBA. Other formats and multiple texture are not supported.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 50ef02fa1b [wayland] Start Compositor and Scene before Workspace
For Xwayland we need to have the Scene (and EglDisplay) created prior
to starting Xwayland and having X11. This requires creating the
Compositor before creating Workspace and starting Xwayland.

To support this the startup of Compositor is split into two parts:
prior and after Workspace creation.

The change might also be interesting for the kwin_x11 case as it could
result in the compositor being up in a quicker way.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 659ff1c732 [wayland] Don't check whether GLX is available
We won't use it, so let's not check for it.
2015-03-17 10:20:19 +01:00
Martin Gräßlin f39c3c8cbb Emit signal from Application once Workspace is created
Allows interesting parties to delay initialization till Workspace is
ready.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 58d79e2da4 Compositor: connect to configChanged emitted by Options instead of Workspace
Removes dependency to Workspace in ctor.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 147af71f8a Drop Workspace dependency from Scene
Only used for one connect which can also be done outside of Scene.
Subclasses got the singleton pointer and just passed to the parent.
2015-03-17 10:20:19 +01:00
Martin Gräßlin f1f87c7a7d Guard access to Display in GLPlatform::getXServerVersion
On wayland OpenGL might get initialized before we have a connection
to the XServer and we might only have an xcb connection. So let's
guard the access.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 820af0ce4a Guard X11 usage in InputRedirectionCursor
In kwin_wayland the InputRedirectionCursor is created before the X11
connection is established. Because of that possible usage needs to
be guarded. This is only in cursorTracking so far. The parent class
exposes whether the cursor is tracked and the doStartCursorTracking
gets invoked again when the x11Connection becomes available.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 40c52035a8 [wayland] Better track if WaylandBackend is ready
The WaylandBackend emits a signal when the backend is ready. If a user
connects to it after it became ready, it will never get notified.
Therefore the WaylandBackend tracks also whether it is ready and
implements connectNotify to emit the signal again if a user connects and
the backend is already ready.

Users of the signal need to disconnect if they cannot handle it being
invoked multiple times. So far the only user does handle this properly.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 7e0fcc5f1a [kwin_wayland] Create screens prior to Xwayland
Gives us the correct outputs in Xwayland direct from start.
2015-03-17 10:20:19 +01:00
Martin Gräßlin dc0f040185 [kwin_wayland] Init Outputs from screen information
Removes the hack for startup. Still needs proper physical size.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 0f945f53fe Move creation of InputRedirection, Cursor and Screens out of Workspace
Do not depend on Workspace and do not depend on X11 thus can be started
earlier allowing to get more things started prior to depending on
Workspace.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 00739867b4 [kwin_wayland] Move starting Xwayland into performStartup 2015-03-17 10:20:19 +01:00
Martin Gräßlin 7c3197b1eb Use new ctors for KXMessages and KSelectionOwner
Allows to pass the connection and rootWindow and doesn't depend on
QX11Info.
2015-03-17 10:20:19 +01: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 2c169e4bca [egl/wayland] Bind Wayland Display to EGL display 2015-03-17 10:11:13 +01:00
Martin Gräßlin a0b2a938aa [wayland] Support creating Texture from Wayland shm buffer
EglWaylandBackend gains support for creating textures from a
BufferInterface. At the same time it loses the possibility to use
the Xcb shm extension to load the texture. That is Xwayland is
required.

In order to support it in a better way the WindowPixmap is passed
to the Texture for loading and updating. Which is then passed to the
backend specific implementation.
2015-03-17 10:08:27 +01:00
Martin Gräßlin 19d90e4e0e [scene] Add basic support for Wayland Buffer in WindowPixmap
The concept of Buffers do not match WindowPixmap perfectly. With X11
we had a pixmap as long as the size was the sime, then it got discarded.
With Wayland we get a new Buffer whenever the window gets damaged.
Furthermore the Buffer might get destroyed any time (especially if the
client disconnects) or the data becomes invalid (it's a shm section after
all).

This adds some constraints on how the Buffer can be used. It's suggested
that the implementing sub-classes do a deep copy of the Buffer's data
when accessing it. For OpenGL that's rather obvious, for QPainter it
needs a dedicated QImage::copy.

WindowPixmap holds a pointer to the currently used Buffer, but doesn't
guarantee that it stays valid. Every time the window gets damaged, the
pointer needs to be updated.

The QPainter based scene is the first to implement support for Buffers:
on creation a deep copy is performed, on damage the changed parts are
painted into the deep copy.
2015-03-17 10:08:27 +01:00