Commit Graph

656 Commits (c99d329125ac745d4c764c5262a8010e9b565fde)

Author SHA1 Message Date
Martin Flöser e1afef3d45 Sanity check WindowQuad before trying to create a grid out of it
Summary:
When one uses:
 * breeze as of 5.12
 * wobbly windows
 * shaded window
 * a distribution building with assert enabled

and starts to move a shaded window, KWin asserts. The root cause for
this is that WindowQuad::makeSubQuad has an assert for y1 being smaller
than y2. With the combination listed above this is not guaranteed. For
the left shadow quad the y1 and y2 are identical and thus trying to
split it, results in the assert condition.

The problem of the shadow quad having an invalid size might be addressed
as well with D10811. Due to that the generation of the quads is not
touched. Instead a sanity check is introduced to not try to split
already invalid sized quads.

BUG: 390953
FIXED-IN: 5.12.3

Test Plan: Added unit test hit the assert, now doesn't hit it any more

Reviewers: #kwin, #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D11015
2018-03-05 19:31:51 +01:00
Martin Flöser 2ea5153e1c Don't crash if the cursor theme fails to create
Summary:
If the cursor theme failed to create KWin crashed due to an endless
recursion. There are two reasons for this fault:
1) When the physical size does not exist we perform a division by 0
which results in an invalid size going into wl_cursor_theme_load
2) We emit the signal that the cursor theme changed even if it didn't
change thus creating an endless recursion

This change addresses both problems: it checks that the size is not 0
and changes the handling for theme update to only destroy the previous
theme if the new theme could be created and only emits the signal if
things change.

BUG: 390314
FIXED-IN: 5.12.3

Test Plan: Added a new test case which crashed with old code

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10549
2018-03-04 09:42:27 +01:00
Martin Flöser b554e54e87 Support modifier mouse/scroll action on internal decorated windows
Summary:
This fixes the problem that alt+lmb did not start unrestricted move
resize for the Debug Console.

BUG: 374880
FIXED-IN: 5.12.3

Test Plan: New test case and manual testing whether alt+lmb/rmb works

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10440
2018-03-04 09:41:38 +01:00
Martin Flöser e9c72e4e62 [autotests] Set breeze icon theme name in integration tests
This is an attempt to get some tests failing on the CI due to not
finding icons fixed. See T8082
2018-02-27 18:17:53 +01:00
Martin Flöser 911176a887 Send hoverLeave or hoverMotion after touch up on decoration
Summary:
On touch down a first hover motion is sent to the decoration. Thus e.g. a
button enters the hovered state. On touch release so far the decoration
did not get a leave event resulting in the button still being hovered.

This change ensures the leave event is sent or if the pointer is also on
the decoration a motion to the pointer position is sent.

BUG: 386231
FIXED-IN: 5.12.3

Test Plan:
New test case and manual testing to verify that the maximize
button is no longer hovered after touch down/up on it

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10308
2018-02-25 13:54:02 +01:00
Martin Flöser 5795fc8cc0 Init the icon in ShellClient::init
Summary:
If the window never provides the appId, we would not get an icon for
the window. This happens for example for KWin's internal windows which
don't set the app id as KWin also doesn't have a desktop file. With this
change the DebugConsole has a window icon in the decoration.

Test Plan: Extended tests and manual verification of DebugConsole

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10294
2018-02-25 13:15:17 +01:00
Martin Flöser 338c7362c9 Properly handle move during touch events
Summary:
When a window was being moved the touch handling performed the wrong
interaction. Due to that it was possible to move the window, but KWin
did not enter the correct code paths, thus quick tiling was for example
not functional.

BUG: 390113
FIXED-IN: 5.12.3

Test Plan: New test case added and manual test in nested KWin

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10431
2018-02-21 18:06:00 +01:00
Martin Flöser aefa11f11a Block geometry updates on move resize finish and don't configure xdg shell surfaces while blocked
Summary:
We send out too many configure requests when finishing move resize which
also triggers quick tiling. This change addresses the problem of the too
many configure requests by making the configure method check whether
geometry updates are blocked. And to make this work properly for the end
of finish move resize the complete method is wrapped in a geometry
update blocker.

BUG: 388072
FIXED-IN: 5.12.1

Test Plan:
Quick tiling test passes, both Wayland and X11 windows are
quick tiled correctly.

Reviewers: #kwin, #plasma, jgrulich

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10156
2018-02-04 14:59:56 +01:00
Martin Flöser 0d2a341723 [autotests/integration] Add test for broken quick tiling for xdg_shell
See also D9980.

CCBUG: 388072
2018-01-21 11:13:28 +01:00
Martin Flöser 42b099355c Add support for initial apply rules for skip (taskbar|pager|switcher)
Summary: This adds support for those set rules in ShellClient.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D9866
2018-01-14 11:19:47 +01:00
Fabian Vogt e302f87598 Properly detect Gallium drivers with newer Mesa
Summary:
The renderer string does not contain "Gallium 0.4 on" anymore,
instead it directly contains the gallium driver's name.
So assume that every unknown renderer is a gallium driver.

Test Plan: Added a testcase, it succeeds only with this patch.

Reviewers: #plasma, graesslin

Subscribers: kwin, plasma-devel, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D9495
2018-01-12 09:05:03 +01:00
Martin Flöser b7ad4bcf88 Keep fullscreen windows in active layer based on transients not the group
Summary:
So far a not-active fullscreen X11 window was kept in the active layer if
the newly activated window is in the same group (that is same client
leader). For example a fullscreen X11 kwrite window is in the active layer
if another kwrite window is active. The two kwrite windows obviously
don't have anything to do with each other, but are in the same group.

This creates problems as it's not possible to raise other windows above
the active not-fullscreen kwrite window. E.g. the panel is stacked below.

The idea behind the check makes sense: if a fullscreen window opens
another window (e.g. a configuration dialog) it should not be put back
to normal layer. Thus the check is adjusted whether the new active
window is a transient to the fullscreen window. Thus the intention is
still the same, but does not cause the problems.

As the code now does not need to differentiate between X11 and Wayland
windows (group only on X11) the Client specific implementation is
removed and the method unvirtual'ed.

BUG: 388310
FIXED-IN: 5.12.0

Test Plan: Test passes

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D9699
2018-01-10 17:44:00 +01:00
Martin Flöser d2a9232ad3 Pass SwitchEvent from LibInput through KWin and add to DebugConsole
Summary:
This change introduces a new SwitchEvent and passes it through the
InputEventSpy and InputEventFilter. The DebugConsoleFilter implements it
so that the events can be monitored in the debug console.

Test Plan: Untested as my only device with such switches has too old libinput

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D9521
2018-01-09 19:32:58 +01:00
Martin Flöser 87ebfd1517 [autotests] Add test case for fullscreen window with groups
When an X11 window is raised to fullscreen it gets set to active layer.
When another window gets activated then it goes back to normal layer.
But when a window of the same group gets activated the fullscreen window
stays in the active layer. Due to that it is not possible to raise other
windows above the fullscreen window.

This just adds a test case exposing the problematic area.

CCBUG: 388310
2018-01-06 10:45:44 +01:00
Martin Flöser ac2f41c86d [libinput] Add support for switch devices and events
Summary:
This change adds support for the switch devices introduces with libinput
1.7 (lid) and 1.9 (tablet mode). So far it's not yet used internally in
KWin, but only exposed through the Device and Events.

As KWin currently only requires libinput 1.5 and we are rather late in
the release cycle the new functionality is ifdef'ed. The requirement
will be raised once master is 5.13. It is already available on
build.kde.org, but e.g. Neon only has 1.6.

The switch events are interesting as they report whether the lid is
closed (might be interesting for e.g. powerdevil) and whether a
convertible is in tablet mode (supported for e.g. Lenovo Yogas with
recent kernel). This can be used by KWin internally to enable/disable
the virtual keyboard. And can be exposed globally to switch to Plasma
Mobile shell in future.

Test Plan:
Only through test case as my Lenovo Yoga uses Neon which has a
too old libinput

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D9516
2018-01-04 18:05:44 +01:00
Martin Flöser e0b1a5715b Add DBus interface to OrientationSensor and a persistent configuration
Summary:
The initial state for user enabled is now read from config. In addition
a DBus interface is provided exporting this property. This allows
KScreen to determine whether automatic screen rotation is available and
whether the user has it enabled or not.

Furthermore KScreen can change the property and this gets stored into
the configuration. Thus KScreen can offer a user interface to
enable/disable automatic screen rotation as well as enabling/disabling
the manual rotation based on the current user settings.

Test Plan:
Not yet tested, coded on the system which doesn't have an
orientation sensor

Reviewers: #kwin, #plasma, sebas, davidedmundson

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8738
2017-12-26 22:02:47 +01:00
Martin Flöser 68698b4201 [libinput] Find screen for touch screen devices and calibrate accordingly
Summary:
This change finds the screen for a touch screen device based on:
 * number available screens
 * output name defined on the touch screen device
 * internal screen
 * and physical size

The id of the screen is stored in the Device allowing to adjust the
touch points accordingly. This means instead of transferring to the
combined display size the touch points are transferred into the output
space and the position of the output is added. Thus in a multi screen
system the touch points are properly mapped to the output.

Furthermore the screen orientation is passed to the Device and a
calibration matrix is set accordingly. Thus a transformed screen has the
touch screen transformed accordingly.

Please note that this only affects libinput on Wayland and not on X11!
The x11 standalone platform needs to gain similar code.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8748
2017-12-23 10:18:55 +01:00
David Edmundson 965c30f4d4 Register a fake appmenu UI for the appmenu test 2017-12-22 17:23:44 +00:00
David Edmundson 2f9d0bd626 Expliit QString use with QCOMPARE.
Fix builds on older Qt.
2017-12-22 15:47:43 +00:00
David Edmundson ee28104c7a Port to new AppMenu iface
Plus test

Test Plan:
Ran kwin with menus and patched QPT
Ran test

Reviewers: graesslin

Reviewed By: graesslin

Subscribers: graesslin, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D9262
2017-12-22 14:38:31 +00:00
Roman Gilg 82d2860469 [colorcorrection] Night Color - blue light filter at nighttime
With Wayland KWin needs to provide certain services, which were provided
before that by the Xserver. One of these is gamma correction, which includes
the - by many people beloved - functionality to reduce the blue light at
nighttime. This patch provides the KWin part of that. It is self contained,
but in the end will work in tandem with a lib in Plasma Workspace and a KCM
in Plasma Desktop, which can be used to configure Night Color.

* Three modi:
** Automatic: The location and sun timings are determined automatically
   (location data updates will be provided by the workspace)
** Location: The sun timings are determined by fixed location data
** Timings: The sun timings are set manually by the user
* Color temperature value changes are smoothly applied:
** Configuration changes, which lead to other current values are changed
   in a quick way over a few seconds
** Changes on sunrise and sunset are applied slowly over the course of few
   minutes till several hours depending on the configuration
* The current color value is set immediately at startup or after suspend
  phases and VT switches. There is no flickering.
* All configuration is done via a DBus interface, changed values are tested
  on correctness and applied atomically
* Self contained mechanism, speaks directly to the hardware by setting the
  gamma ramps on the CRTC
* Currently working on DRM backend, extensible to other platform backends in
  the future
* The code is written in a way to make the classes later easily extendable to
  also provide normal color correction, as it's currently done by KGamma on X

Test Plan:
Manually with the workspace parts and added integration tests in KWin using
the virtual backend.

BUG:371494

Reviewers: #kwin, graesslin

Subscribers: kwin, plasma-devel, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5928
2017-12-11 10:58:40 +01:00
Martin Flöser 8a2796d280 Fix regression from KWin 5.9 regarding quick tiling
Summary:
The regression got introduced with 9934f5b575.
The order when setMaximize(false, false) was called changed in regard to
when the quick tiling mode was adjusted. But just changing the ordering
back was no solution as that would cause regressions in other areas
(unit tests fail).

This change builds up on the support for geometry update blocker on
Wayland to be able to better support this situation without causing
further regressions.

Also this change rethinks the code area. There is an idea behind
temporarily setting the quick tile mode to none and that is even
documented in a comment: it should not confuse maximize. So let's do
exactly that: call the maximize in the block where the quick tile
mode is temporarily wrong. As that is only one branch the else branch
performs the same steps.

BUG: 376104
FIXED-IN: 5.12.0

Test Plan: Confirmation in bug report that patch fixes issue

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D9178
2017-12-04 17:25:40 +01:00
Martin Flöser ff2e883469 Add support for new IdleInhibition protocol
Summary:
A small helper class is added which manages inhibiting idle for the
ShellClients. So far only very basic functionality is added. That is
only the inhibition on the Surface is followed. It is not yet checked
whether the ShellClient is visible at all. That needs some changes in
ShellClient.

BUG: 385956
FIXED-IN: 5.12

Test Plan: New test case passes

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8856
2017-11-30 21:51:36 +01:00
Martin Flöser 1c61e61119 [autotests] Support new way to run the tests without need to install
Summary:
KWin was quite good in ensuring that you don't need to install by
passing paths to the tests. The new way is much nicer, so code is
adjusted for the new way. Also if we require a newer ECM in future we
need to support the new way.

No guarantee that the tests don't pick something up from the system env,
that needs more testing.

References: https://community.kde.org/Guidelines_and_HOWTOs/Making_apps_run_uninstalled

Test Plan: The tests which loaded helpers pass

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7543
2017-11-21 20:34:52 +01:00
Martin Flöser f8be3f746b [effects] Delay creation of EffectFrames in WindowGeometryEffect
Summary:
Without Xwayland KWin starts so fast that the creation of the EffectFrame
triggers a crash in the Wayland integration as the KWin internal
connection isn't fully setup.

To workaround this crash the creation of the EffectFrame is delayed till
the first usage. It doesn't make sense to try to fix the actual crash as
it would require to defer the creation of all Effects.

Test Plan: New test case added which crashes without this fix.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8821
2017-11-21 19:28:00 +01:00
Martin Flöser d4ba05a22f [autotests] Add tests for DRM platform plugin
Summary:
The addition of the test infrastructure is motivated by the regressions
caused by adding mode switching and transformation support.
A contributing factor to these regression is the fact that the DRM
platform does not have any tests. It is difficult to test this code as
it needs to work with hardware, thus we cannot use the real DRM library.
Instead we need to use mocking.

This change sets up some first basic tests with the help of a mockDrm
library. In order to better test the code as units the Drm classes are
slightly refactored. Most importantly the dependency to DrmBackend is
removed wherever possible and replaced by a simple int fd which is mostly
the only element used by the classes.

This first test introduces basic testing of a DrmObject. It is intended
to extend this to at least also test DrmPlane as a central piece of our
Drm platform plugin. This will also extend the tests of DrmObject.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D8776
2017-11-21 19:27:33 +01:00
Aleix Pol af85ca6fe5 Merge branch 'Plasma/5.11' 2017-11-17 17:31:46 +01:00
Aleix Pol db6c7e17e6 Fix build with a KWindowSystem framework that doesn't pull QWidget
Summary: Fixes the build with D8705

Test Plan: Just adds includes, I wonder if it should go into Plasma/5.8 and /5.11 too

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: graesslin, plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8706
2017-11-17 17:30:58 +01:00
Martin Flöser f0f4e494fe Merge branch 'Plasma/5.11' 2017-11-16 20:34:52 +01:00
David Edmundson 68e4deb490 Don't use XDGv6 in stable 2017-11-15 11:27:25 +00:00
Martin Flöser 48f7331c4c Merge branch 'Plasma/5.11' 2017-11-14 18:04:29 +01:00
Martin Flöser 5313b85646 Support modifier+mouse button on window decoration
Summary:
On X11 modifier+mouse button on the window decoration triggers the
"special" handling thus as unrestricted move instead of passing the click
to the decoration. Of course on Wayland we want to have the same
functionality.

BUG: 386708
FIXED-IN: 5.11.4

Test Plan: New test case added. PointerInputTest still passes.

Reviewers: #kwin, #plasma, broulik

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8758
2017-11-14 18:03:36 +01:00
Martin Flöser 188491d392 Support user fullscreen for XdgShellSurfaces
Summary:
So far ShellClient did not support that the user can set a window to
fullscreen. This was omitted in the initial implementation as WlShell
doesn't support passing the state back to the surface.

With XdgShell this problem doesn't exist any more and we can implement
it. The implementation is mostly based on the one for Client and
adjusted for the Wayland world.

Test Plan:
New test cases and manual testing (send kate and kwrite to
fullscreen through alt+f3 menu)

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8169
2017-11-14 18:00:47 +01:00
Martin Flöser 9df1744830 Support automatic screen rotation based on orientation sensor
Summary:
This change introduces an OrientationSensor class which wraps a
QOrientationSensor. The OrientationSensor is hold by Screens and gets
enabled if Screens knows about an internal (e.g. LVDS) display which
supports rotation. In addition the OrientationSensor holds an KSni to
enable/disable the automatic rotation support.

The drm platform plugin is adjusted to make use of the OrientationSensor.
The API is defined in a way that this can also be implemented on other
platforms supporting rotation. Most important are hwcomposer and X11
standalone. The latter should be straight forward as rotation is provided
through XRandR. The former needs addition for rotation support first.

Test Plan: Rotated my Yoga 12

Reviewers: #kwin, #plasma, sebas

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D8699
2017-11-08 17:44:38 +01:00
Martin Flöser abedb464d5 [QPA] Implement Screen on top of internal Screens API
Summary:
The test DontCrashUseractionsMenu (Waylandonly) found an issue in our
screen handling implementation in the QPA. The code exposed a short time
frame between the dummy screen getting destroyed and the first screen
being added. This could result in a crash of KWin.

There is actually no need to implement Screen on top of Wayland screen.
KWin has all the knowledge, so we can also base this on top of the
Screens API.

Advantages:
 * no delays due to Wayland roundtrips
 * handle screen getting removed (was a TODO)
 * handle resolution changes (was a TODO)

The new implementation has a disadvantage that it destroys and readds
all screens whenever something around the screen changes. This shouldn't
be an issue in practice as it's only for the internal QPA and thus only
affects KWin internal windows which is placed in global coordinates
anyway. If it turns out to be a problem we need to track better the
screen changes - so far those were not tracked at all.

Test Plan: Run a few unit tests which change screens

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8345
2017-10-19 18:03:10 +02:00
Martin Flöser c2d4cb8846 Support initial minimize rule in ShellClient
Summary: Honors the rules for minimizing a window on initial show.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8182
2017-10-19 18:00:42 +02:00
Martin Flöser d3eccada62 Implement Apply desktop rule for ShellClient
Summary:
This change sets up ShellClient for supporting window rules by reading
in the rules once it gets created. As a first rule the Apply initially
rule for desktop is implemented.

Currently it is not yet possible to set window rules through the
configuration menu. So far only injecting rules through the test
framework (temporary rules) is implemented. The idea is to first
implement all rules then to expose them to the UI.

Test Plan: New test case

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8177
2017-10-19 18:00:06 +02:00
Martin Flöser 8c2b2faf9d Add DBus protocol to virtual keyboard
Summary:
This change adds a DBus API to query whether the virtual keyboard is
currently enabled and provides DBus methods to request that the virtual
keyboard gets enabled/disabled. This is useful for e.g. providing a
Plasmoid or for convertables where the tablet mode needs to be enabled.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8166
2017-10-19 17:59:19 +02:00
Martin Flöser afe0a5c041 Fix placement of KSplash
Summary:
In a bug report there was a reference that on multi-screen KSplash is
not placed correctly. I investigated and noticed that it is an OSD which
sets an own position. In KWin the events were processed correctly but
the position was off.

The problem is that KWin has code to correct the position of an OSD when
it's size changes. This happens also on first damage and then the window
gets incorrectly placed when the position is set. So honor that the
position is set.

Test Plan: Restarted the session, ksplash positioned correctly now.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8268
2017-10-15 16:41:31 +02:00
David Edmundson 5bca058826 Fix DRM EGL crash regression
Summary:
In 47343fb we made GBM buffer shared.

What we wanted to do was:
Unbox the shared_pointer<GBMSurface> to give us a GBMSurface* object
Call the gbm_surface*() on that operator
Then cast that to a void* for eglCreatePlatformWindowSurfaceEXT

What we did:
Cast the std::shared_ptr<GBMSurface> to a gbm_surface*  then cast that
to void*.
This is just a garbage value and it crashes in Mesa when we do our first
paint.

I've replaced that with an explicit method then we can use shared_ptr's
-> operator rather than get() which does the right thing in a readable
way.

Test Plan:
It crashed after rebasing to master (for Aleix too)
No longer crashes

Reviewers: #plasma

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8251
2017-10-12 10:12:24 +02:00
David Edmundson 3d619c995b Fix DRM EGL crash regression
Summary:
In 47343fb we made GBM buffer shared.

What we wanted to do was:
Unbox the shared_pointer<GBMSurface> to give us a GBMSurface* object
Call the gbm_surface*() on that operator
Then cast that to a void* for eglCreatePlatformWindowSurfaceEXT

What we did:
Cast the std::shared_ptr<GBMSurface> to a gbm_surface*  then cast that
to void*.
This is just a garbage value and it crashes in Mesa when we do our first
paint.

I've replaced that with an explicit method then we can use shared_ptr's
-> operator rather than get() which does the right thing in a readable
way.

Test Plan:
It crashed after rebasing to master (for Aleix too)
No longer crashes

Reviewers: #plasma

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8251
2017-10-11 20:04:13 +02:00
Martin Flöser 031e1f323f Merge branch 'Plasma/5.11' 2017-10-11 18:32:32 +02:00
Martin Flöser d6a906da92 [autotests] Fix typo 2017-10-11 18:31:43 +02:00
Martin Flöser c2f5b3e5b1 Merge branch 'Plasma/5.11' 2017-10-09 21:04:41 +02:00
Martin Flöser 47343fb8f7 [platforms/drm] Use a shared pointer for gbm_surface
Summary:
The gbm_surface is owned by the EglGbmBackend, but it's not the only one
using it. The DrmSurfaceBuffer is also using it and needs it to destroy
the gbm_bo. Now this can become a problem in the following situation:

* a page flip is still pending
* the EglGbmBackend destroys the gbm_surface

-> when the page flip happens the DrmSurfaceBuffer will try to destroy
the gbm_bo and crash as the gbm_surface is no longer valid. This
situation can happen when switching screens or when switching compositing
backend (OpenGL 2 -> OpenGL 3).

To address this problem a class GbmSurface is added which wrapps the
gbm_surface pointer. The EglGbmBackend creates and holds a shared pointer
to the GbmSurface and passes that one to the DrmSurfaceBuffer. So when
cleaning up the gbm_surface only the shared pointer is reset and in case
the DrmSurfaceBuffer still needs it, it can access it without problems.

BUG: 385372
FIXED-IN: 5.11.0

Test Plan: Not yet

Reviewers: #kwin, #plasma, subdiff

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8152
2017-10-05 21:32:46 +02:00
David Edmundson 269ec5bbce Merge branch 'Plasma/5.11' 2017-10-04 10:13:37 +01:00
Hartmut Goebel 5e7b3c6c73 Fix: Missing dependencies for kwin autotests
guix (like nix) used a separate prefix for each package. Thus the header
files for
qtdeclarative are in /gnu/store/…-qtdeclarative-5.9.1/include/qt5/ while
the ones for
qtbase are in /gnu/store/…-base-5.9.1/include/qt5/. This means that
*each* dependency's include directory must be specified. This is in
contrast to a "normal" Unix-system, where all includes end up in
/usr/include/qt5 and missing to defined some include-dependencies does
often not raise an error.

Differential Revision: https://phabricator.kde.org/D8112
2017-10-04 10:12:06 +01:00
David Edmundson 7c538207f4 remove xdgv6 use from 5.11 branch 2017-10-02 08:49:37 +01:00
Martin Flöser 252980390d Merge branch 'Plasma/5.11' 2017-10-01 15:26:40 +02:00
Martin Flöser 0d96e60b79 Also send Wayland clients to a new desktop if their desktop was removed
Summary:
So far the method only operated on X11 clients. So when the last desktop
got removed Wayland clients were still on it. As the auto test showed:
this results in a crash.

Credits go to code coverage as it showed that area as red, which made me
look on it and realize this must be broken.

Test Plan: New test case added

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8082
2017-10-01 11:04:05 +02:00