https://bugs.kde.org/show_bug.cgi?id=453539

            Bug ID: 453539
           Summary: KWin scripts can set an arbitrary/invalid window
                    geometry
           Product: kwin
           Version: 5.24.5
          Platform: Archlinux Packages
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: scripting
          Assignee: kwin-bugs-n...@kde.org
          Reporter: bugs.kde....@derflupp.e4ward.com
  Target Milestone: ---

KWin scripts can set arbitrary window geometries, e.g., a geometry completely
outside of the visible screen area, but also invalid ones, e.g., negative width
or height. The latter can lead to two kinds of problems:

1. The title bar gets still rendered, however, KWin’s repainting gets confused
leaving behind artifacts of the window when it is moved.
2. The application owning the window might crash.

For 1., start a single instance of KWrite, position it in a way so you can
remember the position of the title bar, and execute the following snippet in
`plasma-interactiveconsole --kwin`:

        var clients = workspace.clientList();
        var found = false;
        for (var i = 0; i < clients.length; i++) {
                var c = clients[i];
                print(c.caption);
                if (c.caption == 'Untitled — KWrite') {
                        c.geometry = {x: 100, y: 100, width: 500, height:
-100};
                        found = true;
                        break;
                }
        }
        if (!found) print ("not found")

The title bar will now be rendered at `geometry.x`, `geometry.y`. You can move
it by starting dragging at the old (and hopefully remembered) position of the
title bar. (Hence, you might have to click outside of the rendered title bar.
You might trigger an invisible menu or tool bar entry if you do not hit the old
title bar position precisely.) When it is moved, moving upwards leaves behind a
trail of old title bar artifacts. Activating the “Show Paint” KWin effect
raises the suspicion that KWin interprets the negative height literally and
repaints the area *above* `geometry.y`.

For 2., change the geometry in the above snippet to

                        c.geometry = {x: 100, y: 100, width: -100, height:
-100};

This crashes KWrite. This happens similarly for Kate but also non-Qt
applications like Evolution (after adapting the matched caption in the
snippet). It is not clear to me if these are bugs in the applications or used
libraries or if KWin violates an API invariant the applications/libraries rely
on.

Bug 315855 might be related.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to