Commit Graph

41 Commits (bc1991706c66a53f970fdcd576bcb35e70c9b7f1)

Author SHA1 Message Date
Vlad Zahorodnii 76af96bcc9 [x11] Disable synchronized resizing for Xwayland < 1.21
In case Xwayland does not use multiple buffers, the currently attached
buffer is going to be destroyed if the frame window is resized. It may
render the previous and the current window pixmap invalid and thus result
in visual artifacts when an X11 client is being interactively resized.

In order to avoid the visual artifacts, this change disables support for
synchronized resizing for X11 clients if the version of Xwayland is less
than the version in which Xwayland started using multiple buffers, i.e.
1.21.

Differential Revision: https://phabricator.kde.org/D29250
2020-04-29 16:37:31 +03:00
Vlad Zahorodnii a9d2bad007 [x11] Enable synchronized resizing for Xwayland clients
Given that we now query the current X11 time stamp on Wayland, we can
enable synchronized resizing for Xwayland clients.

Differential Revision: https://phabricator.kde.org/D29250
2020-04-29 16:37:23 +03:00
Aleix Pol 6abd23ed02 Make it possible to have a separate cursor for the tablet
Summary:
As is KWin only had 1 Cursor which was a singleton. This made it impossible for
us to properly implement the tablet (as in drawing tablets) support and show where
we're drawing.
This patch makes it possible to have different Cursors in KWin, it makes all the
current code still follow the mouse but the tablet can still render a cursor.

Test Plan: Tests pass, been using it and works as well as before but with beautiful tablet cursors.

Reviewers: #kwin, cblack, davidedmundson

Reviewed By: #kwin, cblack, davidedmundson

Subscribers: davidedmundson, cblack, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28155
2020-04-03 01:16:45 +02:00
Aleix Pol 5eb84af469 Remove overloads on virtual methods
Summary:
Prefer virtual methods that take QRect and QSize rather than multi-int versions.
Makes for clearer API and reduces the amount of code that was taking all of the
components and turn it into a class.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28283
2020-03-26 16:10:10 +01:00
Vlad Zahorodnii fb114dfba3 Return early if we ignore resize increments and aspect ratio constraints
Summary:
If we know that we are going to disobey resize increment and aspect ratio
geometry hints, then there is no point for trying to constrain the client
size according to those hints. Just return early.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27031
2020-02-28 17:13:01 +02:00
Vlad Zahorodnii a75fb7f84e Refactor geometry constraints code
Summary:
Currently, there are a couple of issues with sizeForClientSize(). First
of all, we have a method called clientSizeToFrameSize() which does similar
thing except applying geometry constraints and checking window rules. The
other issue is that sizeForClientSize() is doing a bit too much, it checks
window rules, it applies a bunch of geometry constrains. Sometimes it
does not perform conversion between client sizes and frame sizes!

This change attempts to address those issues by replacing sizeForClientSize
with two similar methods and changing semantics of some methods of the
X11Client class.

The most significant difference between sizeForClientSize() and the new
methods is that neither constrainClientSize() nor constrainFrameSize()
check window rules. This is up to users of those methods. In many places,
we don't have to check window rules because we check isResizable(),
which returns false if the frame size is enforced by a window rule.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26828
2020-02-28 17:13:01 +02:00
David Edmundson 41b02f2356 [x11client] Make activity handling more consistent across windows
Summary:
Typically by default newly added toplevel windows are added only to the
current activity.

Initially windows with no borders were added to all activities. This
causes problems particularly now with the newer frame extents support
leaving window behaviour quite inconsistent.

Since the time of the original code the taskbar gained control for
controlling activities allowing at least one method of changing them.
This means we can use this as the new filter.

BUG: 274931

Test Plan:
Opened gtk3-demo
Switched activities, it wasn't on the new one
Went back, altered it through the taskmanager, it worked

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27690
2020-02-28 11:41:59 +00:00
Vlad Zahorodnii 63fa013334 Merge branch 'Plasma/5.18' 2020-02-18 11:16:56 +02:00
Vlad Zahorodnii cfa5daaad1 Fix misplaced client windows
Summary:
This regression was introduced by me, sorry. The client window may be at
location other than (0, 0), in which case we have to move it to (0, 0)
to ensure that the client contents is not covered by window frame.

BUG: 417584
FIXED-IN: 5.18.1

Reviewers: #kwin, broulik

Reviewed By: broulik

Subscribers: broulik, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27456
2020-02-18 11:16:44 +02:00
Vlad Zahorodnii 6a2fc3d8ce Merge branch 'Plasma/5.18' 2020-02-14 01:50:48 +02:00
Vlad Zahorodnii 1181af2cd1 Provide input geometry and input transformation matrix for Xwayland clients
Summary:
We need to provide the input geometry and the input transformation
matrix for Xwayland clients in order to make sure that input events
are correctly mapped from the global screen coordinates to the
screen-local coordinates.

BUG: 417444
FIXED-IN: 5.18.1

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27375
2020-02-14 01:49:27 +02:00
Vlad Zahorodnii 5af81c1cd7 Make support for the maximized mode partially optional
Summary:
Not all Client classes have support for the maximized mode. Therefore,
it can be made opt-in to reduce the amount of plumbed methods.

Unfortunately, there a few places, which don't have any connection with
the maximized mode, where AbstractClient::geometryRestore() is used, so
it cannot be made 100% optional at the moment.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27169
2020-02-12 11:28:15 +02:00
Vlad Zahorodnii 624317a78d Don't pass any arguments to AbstractClient::doSetDesktop()
Summary: We don't use them anywhere.

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27121
2020-02-12 11:00:25 +02:00
Vlad Zahorodnii f9e9f93d5b Move X11-specific bits of keep above and keep below state to X11Client
Summary:
Nothing special about this patch except of the removal of code that forces
_NET_WM_STATE_BELOW and _NET_WM_STATE_ABOVE. If the client window is
compliant with the EWMH spec, then _NET_WM_STATE_BELOW and _NET_WM_STATE_ABOVE
will be in sync with keepBelow() and keepAbove(), respectively.

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27120
2020-02-12 11:00:25 +02:00
Vlad Zahorodnii a281bece6a Introduce AbstractClient::doSetDemandsAttention()
Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27119
2020-02-12 11:00:25 +02:00
Vlad Zahorodnii f90c65f431 Move X11-specific minimize code to X11Client
Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27118
2020-02-12 11:00:25 +02:00
Vlad Zahorodnii 15af09c70a Introduce Toplevel::frameGeometryChanged signal
Summary:
Currently we have two signals that are emitted when the Toplevel's geometry
changes - geometryShapeChanged() and geometryChanged(). The former signal
is used primarily to invalidate cached window quads and the latter is
sort of emitted when the frame geometry changes. But it's not that easy. We
have a bunch of connects that link those signals together...

The worst part about all of this is that the window quads cache gets
invalidated every time a geometry update occurs, for example when user
moves a window around on the screen.

This change introduces a new signal and deprecates the existing geometryChanged
signal. frameGeometryChanged is similar to geometryChanged except that it is
emitted when an _actual_ geometry change has occurred.

We do still emit geometryShapeChanged signal. However, in long term, we
need to get rid of this signal or come up with something that makes sense
and doesn't require us to waste computational resources.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26863
2020-02-12 10:52:26 +02:00
Vlad Zahorodnii 98634e0193 Merge branch 'Plasma/5.18' 2020-02-03 14:01:53 +02:00
Vlad Zahorodnii 56d5f3a4f6 [x11] Fix visual artifacts during interactive resize
Summary:
When a window is being interactively resized, its contents may jump. The
reason why that happens is because KWin renders partially resized client
window. Composite extension spec says that a window will get a new pixmap
each time it is resized or mapped. This applies to the frame window, but
not to the client window itself. If the client window is resized,
off-screen storage for the frame window won't be reallocated. Therefore,
KWin may render partially resized client window if the client doesn't
attempt to be in sync with our rendering loop. Currently, the only way
to do that is to use extended frame counters, which are not supported by
KWin.

So, in order to fix visual artifacts during interactive resize, we need
somehow forcefully re-allocate off-screen storage for the frame window.
Unfortunately, Composite extension doesn't provide any request to do
that, so the only option we have is to resize the frame window.

BUG: 415839
FIXED-IN: 5.18.0

Reviewers: #kwin

Subscribers: davidedmundson, ngraham, alexde, fredrik, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26914
2020-02-03 13:56:35 +02:00
Vlad Zahorodnii 74e04949d7 Merge branch 'Plasma/5.18' 2020-01-29 13:11:32 +02:00
Vlad Zahorodnii 35fe3cb6c5 Drop Toplevel::decorationRect()
Summary: It's identical to Toplevel::rect().

Test Plan: Compiles.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26971
2020-01-29 12:58:54 +02:00
Vlad Zahorodnii c36a5bf423 Merge branch 'Plasma/5.18' 2020-01-28 22:01:03 +02:00
Vlad Zahorodnii 34fc962ff1 Move definition of X11Client::damageNotifyEvent() to x11client.cpp
One step closer to the bright future where one can disable X11 support
at build time.
2020-01-28 21:58:00 +02:00
Vlad Zahorodnii 68ef6bcd7a Rename X11Client::getSyncRequest() to X11Client::syncRequest()
Getter methods should not have "get" prefix.
2020-01-28 21:46:09 +02:00
Vlad Zahorodnii f57470d1fd Capitilize "mode" in Sizemode enum
Summary: Capitalize "mode" to improve readability.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26826
2020-01-22 11:53:49 +02:00
Vlad Zahorodnii 8af3eef9cd [x11] Apply "Block compositing" rule right away
Summary:
When the user changes "Block compositing" rule, apply it immediately.

BUG: 415903

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26708
2020-01-16 17:33:27 +02:00
Vlad Zahorodnii fbfd1ac705 Split geometry topic file
Test Plan: Compiles.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26644
2020-01-16 12:22:21 +02:00
Vlad Zahorodnii d394855536 Rename Toplevel::geom to Toplevel::m_frameGeometry
Summary: The new name better reflects what Toplevel::geom is.

Test Plan: Compiles, tests still pass.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25738
2019-12-04 15:47:15 +02:00
Vlad Zahorodnii d6469fb55d [x11] Resize the shape helper window to correct size
Summary:
The frame geometry doesn't necessarily correspond to the server-side
geometry of the toplevel window, we need to use the buffer geometry
instead.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25730
2019-12-04 12:18:36 +02:00
Vlad Zahorodnii f14adfe545 [x11] Make geometry updates in X11Client more comprehensible
Summary:
This change makes geometry updates in the X11Client class simpler and
also fixes a bug in the move() method.

Test Plan: All tests pass.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25710
2019-12-04 10:06:59 +02:00
Vlad Zahorodnii 297876e55e Split group.cpp topic file
Test Plan: Compiles.

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: kwin

Tags: #kwin

Maniphest Tasks: T12312

Differential Revision: https://phabricator.kde.org/D25713
2019-12-03 19:43:47 +02:00
Vlad Zahorodnii 30c14d6e43 Merge manage.cpp with x11client.cpp
Test Plan: Compiles.

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: kwin

Tags: #kwin

Maniphest Tasks: T12312

Differential Revision: https://phabricator.kde.org/D25712
2019-12-03 17:52:58 +02:00
Vlad Zahorodnii 6e000314b3 Revert the fix for the texture bleeding issue
This reverts commit 9151bb7b9e.
This reverts commit ac4dce1c20.
This reverts commit 754b72d155.

In order to make the fix work, we need to redirect the client window
instead of the frame window. However, we cannot to do that because
Xwayland expects the toplevel window(in our case, the frame window)
to be redirected.

Another solution to the texture bleeding issue must be found.

CCBUG: 257566
CCBUG: 360549
2019-12-02 19:45:15 +02:00
Vlad Zahorodnii 754b72d155 [x11] Name client pixmap instead of frame pixmap
Summary:
Since KDE 4.2 - 4.3 times, KWin doesn't paint window decorations on real
X11 windows, except when compositing is turned off. This leaves us with
a problem. The actual client contents is inside a larger texture with no
useful pixel data around it. This and decoration texture bleeding are
the main factors that contribute to 1px gap between the server-side
decoration and client contents with effects such as wobbly windows, and
zoom.

Another problem with naming frame pixmap instead of client pixmap is
that it doesn't quite go along with wayland. It only makes more difficult
to abstract window quad generation in the scene.

Since we don't actually need the frame window when compositing is on,
there is nothing that holds us from redirecting client windows instead
of frame windows. This will help us to fix the texture bleeding issue
and also help us with the ongoing redesign of the scene.

Test Plan: X11 clients are still composited.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25610
2019-12-02 15:08:38 +02:00
Vlad Zahorodnii 9d4a32596c Drop some custom list typedefs
Summary:
Qt has its own thing where a type might also have corresponding list
alias, e.g. QObject and QObjectList, QWidget and QWidgetList. I don't
know why Qt does that, maybe for some historical reasons, but what
matters is that we copy this pattern here in KWin. While this pattern
might be useful with some long list types, for example

    QList<QWeakPointer<TabBoxClient>> TabBoxClientList

in general, it causes more harm than good. For example, we've got two
new client types, do we need corresponding list typedefs for them? If
no, why do we have ClientList and so on?

Another problem with these typedefs is that you need to include utils.h
header in order to use them. A better way to handle such things is to
just forward declare a client class (if that's possible) and use it
directly with QList or QVector. This way translation units don't get
"bloated" with utils.h stuff for no apparent reason.

So, in order to make code more consistent and easier to follow, this
change drops some of our custom typedefs. Namely ConstClientList,
ClientList, DeletedList, UnmanagedList, ToplevelList, and GroupList.

Test Plan: Compiles.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24950
2019-11-27 15:54:08 +02:00
Vlad Zahorodnii 84d75cb567 [x11] Add support for _GTK_FRAME_EXTENTS
Summary:
KDE is known for having a strong view on the client-side decorations vs
server-side decorations issue. The main argument raised against CSD is
that desktop will look less consistent when clients start drawing window
decorations by themselves, which is somewhat true. It all ties to how
well each toolkit is integrated with the desktop environment.

KDE doesn't control the desktop market on Linux. Another big "player"
is GNOME. Both KDE and GNOME have very polarized views on in which
direction desktop should move forward. The KDE community is pushing more
toward server-side decorations while the GNOME community is pushing
more toward client-side decorations. Both communities have developed
great applications and it's not rare to see a GNOME application being
used in KDE Plasma. The only problem is that these different views are
not left behind the curtain and our users pay the price. Resizing GTK
clients in Plasma became practically impossible due to resize borders
having small hit area.

When a client draws its window decoration, it's more likely that it also
draws the drop-shadow around the decoration. The compositor must know
the extents of the shadow so things like snapping and so on work as
expected. And here lies the problem... While the xdg-shell protocol has
a way to specify such things, the NetWM spec doesn't have anything like
that. There's _GTK_FRAME_EXTENTS in the wild, however the problem with
it is that it's a proprietary atom, which is specific only to GTK apps.

Due to that, _GTK_FRAME_EXTENTS wasn't implemented because implementing
anything like that would require major changes in how we think about
geometry.

Recent xdg-shell window geometry patches adjusted geometry abstractions
in kwin to such a degree that it's very easy to add support for client
side decorated clients on X11. We just have to make sure that the
X11Client class provides correct buffer geometry and frame geometry when
the gtk frame extents are set.

Even though the X11 code is feature frozen, I still think it's worth
to have _GTK_FRAME_EXTENTS support in kwin because it will fix the resize
issues. Also, because KWin/Wayland is unfortunately far from becoming
default, it will help us with testing some implementation bits of the
window geometry from xdg-shell.

BUG: 390550
FIXED-IN: 5.18.0

Test Plan:
Things like quick tiling, maximizing, tiling scripts and so on work as
expected with GTK clients.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: cblack, trmdi, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24660
2019-11-27 14:12:30 +02:00
Vlad Zahorodnii fb2d4c113f Adjust scene for client-side decorated clients
Summary:
Currently our Scene is quite naive about geometry. It assumes that the
window frame wraps the attached buffer/client. While this is true for X11
clients, such geometry model is not suitable for client-side decorated
clients, in our case for xdg-shell clients that set window geometry
other than the bounding rectangle of the main surface.

In general, the proposed solution doesn't make any concrete assumptions
about the order between frame and buffer geometry, however we may still
need to reconsider the design of Scene once it starts to generate quads
for sub-surfaces.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, romangg, kwin

Tags: #kwin

Maniphest Tasks: T10867

Differential Revision: https://phabricator.kde.org/D24462
2019-11-27 14:12:30 +02:00
Vlad Zahorodnii 9f7a856d23 [wayland] Implement window geometry more properly
Summary:
So far the window geometry from xdg-shell wasn't implemented as it should
be. A toplevel must have two geometries assigned to it - frame and buffer.
The frame geometry describes bounds of the client excluding server-side
and client-side drop-shadows. The buffer geometry specifies rectangle on
the screen occupied by the main surface.

State and geometry handling in XdgShellClient is still a bit broken. This
change doesn't intend to fix that, it must be done in another patch asap.

Test Plan: New tests pass.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, romangg, kwin

Tags: #kwin

Maniphest Tasks: T10867

Differential Revision: https://phabricator.kde.org/D24455
2019-11-27 14:12:30 +02:00
Vlad Zahorodnii 7d4471eba6 Rename geometry property to frameGeometry
Summary:
In order to properly implement xdg_surface.set_window_geometry we need
two kinds of geometry - frame and buffer. The frame geometry specifies
visible bounds of the client on the screen, excluding client-side drop
shadows. The buffer geometry specifies rectangle on the screen that the
attached buffer or x11 pixmap occupies on the screen.

This change renames the geometry property to frameGeometry in order to
reflect the new meaning assigned to it as well to make it easier to
differentiate between frame geometry and buffer geometry in the future.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24334
2019-10-02 11:46:37 +03:00
Vlad Zahorodnii 99d3185949 Rename getShadow method to updateShadow
Summary: getShadow is not a getter method as it doesn't return a shadow.

Test Plan: Compiles.

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24298
2019-09-29 15:26:53 +03:00
Vlad Zahorodnii ffcbe24e2b Rename Client to X11Client
Summary:
Currently each managed X11 client is represented with an instance of
Client class, however the name of that class is very generic and the
only reason why it's called that way is because historically kwin
was created as an x11 window manager, so "Client" was a sensible choice.

With introduction of wayland support, things had changed and therefore
Client needs to be renamed to X11Client in order to better reflect what
that class stands for.

Renaming of Client to X11Client was agreed upon during the last KWin
sprint.

Test Plan: Compiles, the test suite is still green.

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24184
2019-09-25 21:11:37 +03:00