Work on Qt >= 5.8
Closed, ResolvedPublic

Description

The Qt "bug":

  • for some wl_surfaces, we attach some plasma protocols
  • we need a hook to know when Qt creates a wl_surface so we can do this
  • ideally to attach before we flush events to kwin
  • Qt used to have one wl_surface for the lifespan of the window
  • Qt now creates/deletes a wl_surface when we show/hide a window.
  • This seems to be correct behaviour
  • We currently use a hook called NativeSurfaceCreatedEvent
  • This doesn't get re-emitted. Why?

Thing Qt terminology Wayland terms
What you draw in to surface buffer
the thing on screen window surface

The thing we draw into isn't recreated, so Qt is also still technically correct.

...but we still need a hook.

IMHO we shouldnt' be trying to "fix" this in a compatiable way.
We should do a bodge, then do a non-compatiable actual fix.

This is three jobs:

  • find all instances
  • bodging a hook and maybe emit a custom event on the window
  • making the plasmashell interfaces re-creatable in all event handling code

We do *always* get a QExposeEvent after a surface gets re-created
The wl_surface ID is different after it's recreated (because Qt is too lazy to re-use them.
Gives us a bodge.


Initial plan:

  • plasma integration does a hack and emits a custom QEvent
  • Dialog, Runner, etc. listen to that.

Longer plan:
signal in nativePlatformInterface?

Other notes:

  • we can repinterpret the shell surface to a QObject from the QPA. Then track the lifespan.
  • we can't do this for wl_surface though, as that qobject isn't deleted.
  • this doesn't super help as Dialog sets bypass WM, and then we don't get a shell surface...but is that actually what we want?
davidedmundson added a comment.EditedMay 7 2017, 4:02 PM

all the places this might be an issue.

We only have an issue if something is hidden and shown again.

workspace/plasma-integration/src/platformtheme/kwaylandintegration.cpp
89: case QPlatformSurfaceEvent::SurfaceCreated: {
broken

workspace/kwin/tests/screenedgeshowtest.cpp
292: if (pe->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated) {
fine

workspace/plasma-desktop/applets/kicker/plugin/dashboardwindow.cpp
143: if (pSEvent->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated) {
fine, but shoudlnt' be??

workspace/plasma-workspace/shell/desktopview.cpp
212: case QPlatformSurfaceEvent::SurfaceCreated:
fine

workspace/plasma-workspace/shell/panelview.cpp
894: case QPlatformSurfaceEvent::SurfaceCreated:
fine

workspace/plasma-workspace/shell/panelconfigview.cpp
243: case QPlatformSurfaceEvent::SurfaceCreated:
fine

workspace/plasma-workspace/ksplash/ksplashqml/splashwindow.cpp
88: case QPlatformSurfaceEvent::SurfaceCreated:
fine

workspace/plasma-workspace/krunner/view.cpp
225: setState = e->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated;

broken

workspace/plasma-workspace/ksmserver/shutdowndlg.cpp
227: case QPlatformSurfaceEvent::SurfaceCreated:

fine

workspace/plasma-workspace/ksmserver/switchuserdialog.cpp
135: case QPlatformSurfaceEvent::SurfaceCreated:

fine

plasma-framework/src/declarativeimports/core/tooltipdialog.cpp
108: if (pe->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated) {

broken

plasma-framework/src/plasmaquick/dialog.cpp
1130: if (pSEvent->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated) {

broken

leezu added a subscriber: leezu.Jul 24 2017, 1:47 PM
davidedmundson closed this task as Resolved.Sep 5 2017, 11:06 AM

Effectively done.

Anything else we'll handle on bugzilla.