Commit graph

19458 commits

Author SHA1 Message Date
Vlad Zahorodnii
b814b3c985 kwineffects: Add client geometry property
This property can be useful for the screenshot effect.
2021-05-28 11:05:38 +03:00
Xaver Hugl
2742e5b422 Rearrange wayland startup sequence
The backend can now optionally wait for the scene to be created before
it updates its outputs, which is necessary for better atomic tests in
the DRM backend.
2021-05-27 13:41:40 +00:00
Vlad Zahorodnii
1d906169d8 Discard SurfaceItemXwayland's quads when shape changes
The SurfaceItemXwayland has to re-build quads if the shape changes.

The SurfaceItemX11 doesn't need a similar fix as it already discards
quads whenever the shape region changes.
2021-05-26 18:27:55 +00:00
Nate Graham
20b8d606e1 [kcmkwin/kwindesktop] Add explicit action to apply a rename
The rnew name is applied when the user hits the return or enter key to
finish renaming, but this is an invisible UI and the user might not
think to do that. This commit replaces the "Rename" button with a
"Confirm new name" button while the text field is editable, so that it's
visibly clear how to finish renaming.
2021-05-26 17:44:02 +00:00
Nate Graham
324480570b [kcmkwin/kwindesktop] Allow renaming desktops with double-click
Similar to the feature to allow inline renaming in file managers, you
can now trigger renaming for a desktop by double-clicking on its list
item.

BUG: 421882
FIXED-IN: 5.23
2021-05-26 17:43:30 +00:00
Aleix Pol
644dcbe173 screencasting: do not attempt to copy a null texture
It seldom happens, but it does happen.
2021-05-26 12:56:59 +00:00
Vlad Zahorodnii
870c1e5557 scenes/qpainter: Clean up includes
Wayland-specific code in the qpainter renderer was removed long time ago.
2021-05-26 09:36:20 +03:00
Vlad Zahorodnii
7cbd459caf Remove unused includes in DecoratedClient and DecorationBridge 2021-05-26 06:35:03 +00:00
Vlad Zahorodnii
f46c7bae8d Move decoration renderer to decoration item
Currently, the implementation of the DecoratedClient and the decoration
renderer are strongly coupled. This poses a problem with the item based
design as the ultimate goal is to have scene items construct paint nodes
which are then fed to the renderer. The DecorationItem has to have
control over the decoration texture. Another issue is that the scene
cannot smoothly cross-fade between two window states if the decoration
is removed, e.g. from fullscreen mode to normal and vice versa.

This change moves the decoration renderer to the decoration item. With
the introduction of a generic scene texture atlas, we hope to get rid of
the decoration renderer altogether.
2021-05-26 06:35:03 +00:00
Vlad Zahorodnii
7f32594692 Port decoration renderers to Decoration::damaged signal 2021-05-26 06:35:03 +00:00
Vlad Zahorodnii
fa66c3d238 Make Toplevel::isClient() return true for internal and wayland windows
It's needed to merge Toplevel and AbstractClient. Previously, we
couldn't do it because Toplevel::isClient() was somewhat widely used.
2021-05-25 19:06:17 +03:00
Vlad Zahorodnii
93d95ffbc4 Replace AbstractClient::doPerformInteractiveMoveResize() with a simpler solution
AbstractClient::doPerformInteractiveMoveResize() is only used by the
X11Client to reset a boolean flag when the client doesn't support sync
counters.

X11Client can call performInteractiveMoveResize() only in two cases: the
sync request timer expires or the client increments the sync counter.

This change removes the AbstractClient::doPerformInteractiveMoveResize()
function and adds a function to handle the case where the sync timer
expires explicitly. This removes a virtual function in the AbstractClient
and makes code more readable.
2021-05-25 09:32:55 +03:00
Vlad Zahorodnii
c929d977a7 Move geometry before blocking to X11Client
It's only used by X11Client. Neither InternalClient nor WaylandClient
need buffer/frame/client geometry before blocking.
2021-05-25 06:17:41 +00:00
Vlad Zahorodnii
9a7ab8a62e Rework async geometry updates
Window management features were written with synchronous geometry
updates in mind. Currently, this poses a big problem on Wayland because
geometry updates are done in asynchronous fashion there.

At the moment, geometry is updated in a so called pseudo-asynchronous
fashion, meaning that the frame geometry will be reset to the old value
once geometry updates are unblocked. The main drawback of this approach
is that it is too error prone, the data flow is hard to comprehend, etc.

It is worth noting that there is already a machinery to perform async
geometry which is used during interactive move/resize operations.

This change extends the move/resize geometry usage beyond interactive
move/resize to make asynchronous geometry updates less error prone and
easier to comprehend.

With the proposed solution, all geometry updates must be done on the
move/resize geometry first. After that, the new geometry is passed on to
the Client-specific implementation of moveResizeInternal().

To be more specific, the frameGeometry() returns the current frame
geometry, it is primarily useful only to the scene. If you want to move
or resize a window, you need to use moveResizeGeometry() because it
corresponds to the last requested frame geometry.

It is worth noting that the moveResizeGeometry() returns the desired
bounding geometry. The client may commit the xdg_toplevel surface with a
slightly smaller window geometry, for example to enforce a specific
aspect ratio. The client is not allowed to resize beyond the size as
indicated in moveResizeGeometry().

The data flow is very simple: moveResize() updates the move/resize
geometry and calls the client-specific implementation of the
moveResizeInternal() method. Based on whether a configure event is
needed, moveResizeInternal() will update the frameGeometry() either
immediately or after the client commits a new buffer.

Unfortunately, both the compositor and xdg-shell clients try to update
the window geometry. It means that it's possible to have conflicts
between the two. With this change, the compositor's move resize geometry
will be synced only if there are no pending configure events, meaning
that the user doesn't try to resize the window.
2021-05-25 06:17:41 +00:00
Aleix Pol
e4ed4e5a13 Keep lostLeader code under removeX11Client
The groups concept only applies to X11 clients
2021-05-25 02:29:19 +02:00
Aleix Pol
ae01ed219c workspace: Unify client removal code
We have 2 equivalent code paths for x11 and wayland unnecessarily, unify
them under the same method.
Rename m_clients to m_x11Clients so that it's clear what the difference
is between m_clients and m_allClients.
2021-05-24 23:16:41 +00:00
Nicolás Alvarez
975945677d Fix typo in TESTING.md
test suit -> test suite
2021-05-24 16:22:25 -03:00
David Edmundson
5484b846b3 [kcmkwin/kwindesktop] Implement valueFromText in a spinbox
If textFromValue is set, valueFromText must be.

A lot of other implemenetations were using parseInt() which fails at
reading "3,000" due to the comma. Qt's fromLocaleString handles that but
needs any text stripping.

This implementation isn't perfect, but really we need to work on a good
upstream solution.

BUG: 437472
2021-05-24 18:51:07 +00:00
Aleix Pol
27e043920a xdg_activation_v1 implementation 2021-05-24 17:19:25 +02:00
Aleix Pol
3c7290b722 Abstract startup semantics in the startupfeedback effect 2021-05-24 17:19:08 +02:00
Aleix Pol
0f8813671b Split AbstractClient::iconFromDesktopFile into a static function
This way it can be used before we have the window
2021-05-24 17:19:08 +02:00
Felipe Kinoshita
e72a555247
[kcms/virtualdesktops] Change delete icon 2021-05-24 11:40:19 -03:00
David Edmundson
8a699ef187 [xwl] Notify wayland that our data offer is accepted
kwayland-server was updated to follow the result of whether the data
offer was accepted before calling drop.

Our bridge was not updated.

We don't have enough data to know which mimeType the XWayland client
actually has accepted, as that doesn't exist at an X11 level, but it
doesn't have a big actual impact. Despite which mime type gets accepted
any mimetype can be retrieved in the drop event.

Tested against "dropsite" from QtBase widget examples forced into xcb
mode using dolphin as a source.

BUG: 437406
2021-05-24 14:06:57 +00:00
David Edmundson
600c1e0a54 platforms/drm: Make context current before EGLStreams calls
attachStreamConsumer and resetOutput are not called as part of the scene
render and as such the context might not be set.

All credit goes to Simon Spinner for his investigation.

BUG: 437573
2021-05-24 13:51:18 +00:00
Aleix Pol
1e5fae1e91 inputmethod: warn when we're committing strings to noone 2021-05-24 14:16:23 +02:00
Aleix Pol
8fad7aa4f3 inputmethod: Also update the trackingClient when there's none set
Also moves the setting code to a separate method for readability
2021-05-24 14:16:23 +02:00
Aleix Pol
f60b9176da inputmethod: Use the inputmethod's context as the isActive measure
Ensures that m_active and the input context do not get out of sync and
that the right signals are always emitted by always using setActive to
activate.
Uses the context to define InputMethod::isActive.
2021-05-24 14:16:23 +02:00
Aleix Pol
184e53e5c2 inputmethod: Make sure we send a state commit
Detach from the serials that the client send us, since they don't really
matter to the input method and track our own.
Also issue a commit state whenever we adopt a new input context. This
can happen for reasons that don't come from the client, like for example
the input method has just been enabled.
In practice, this solves an issue that we can easily see with maliit
where it would be left in a half-initialised state and would show
autocorrection fields on terminal applications when unnecessary and
possibly similar problems every now and then.
2021-05-24 14:16:14 +02:00
Nicolas Fella
b31ef46576 [kcms/virtualdesktop] Don't offer to remove the last desktop
The current UI allows to remove the last desktop, but:
- If you remove it it will reappear on the next KCM launch
- The Add button does not work then

Prevent removing the last desktop by disabling the action

BUG: 437561
2021-05-24 11:58:49 +00:00
Nicolas Fella
7f36f01247 [kcms/virtualdesktops] Properly track synchronizing state
When the user applies a change like adding a desktop
DesktopsModel::syncWithServer is called and m_synchronizing is set to
true. The server then sends some kind of response (e.g. desktopCreated)
and updateModifiedState is called which sets m_synchronizing to false
again.

However if a setting is changed that does not trigger any server change
(e.g. the show OSD setting) m_synchonizing is never set to false again,
causing problems down the line.

Instead of relying on updateModifiedState to reset m_synchronizing track
the syncronizing state by refcounting the DBus calls

BUG: 437466
2021-05-24 11:53:59 +00:00
Nicolas Fella
99b84a321a Don't show virtual keyboard SNI when no virtual keyboard is selected in the KCM
Not choosing any virtual keyboard is a valid option. In this case do not show the SNI since it isn't very useful then and takes up some space in the system tray.

BUG: 437171
2021-05-24 11:53:30 +00:00
Vlad Zahorodnii
a18cb8998e wayland: Remove direct session
Most distros use either systemd's logind or consolekit for session
management.

The main reason why there's direct session is because up to some point,
kwin had a class called VirtualTerminal which was kind of like a direct
session backend.

The VirtualTerminal was used in the fbdev backend in conjuction with the
logind session backend, which looked odd.

Since the drm backend supported only logind and consolekit for very
long time and we hadn't received any complaints about it, the fact that
direct session is unsupported should not be noticeable.

Given that, this change removes the support for direct session in order
to reduce the amount of platform-specific code and make it easier to
maintain kwin.
2021-05-24 06:23:00 +00:00
Vlad Zahorodnii
1a464530bd scenes/xrender: Remove SceneXRenderShadow::buildQuads()
It's effectively the same as Shadow::buildQuads().
2021-05-24 06:22:28 +00:00
Nicolas Fella
86ce04a7fc [kcms/virtualdesktops] Enable apply button when typing desktop name
Currently the apply button will only be enabled when you press enter or
change focus away from the text field which is somewhat inintuitive.

Instead enable the apply button as soon as the text changed.

BUG: 435014
2021-05-22 13:54:44 +02:00
Nicolas Fella
d8855cc62a [kcms/virtualdesktops] Clip ListView
ListViews in ScrollViewKCMs need to be clipped, otherwise the content
can exceed the frame
2021-05-22 10:50:26 +02:00
David Edmundson
af66f39f19 Support High DPI Aurorae decorations
With high DPI we can't use the image size as a logical size directly.

The other change is use of QPainter::drawImage(QRect target, QImage
image, QRect source)

This slightly confusing method uses logical pixels for the target, but
the source rect is in native pixels of the source.

BUG: 422342
2021-05-21 11:26:53 +00:00
Aleix Pol
22f2e3e43c No need to reset the damage for objects that we already know have none 2021-05-20 13:38:30 +00:00
Aleix Pol
848e9e2076 aurorae: Fix warning at startup
Give an opportunity to the settings to get initialized. Otherwise we set
an null object and qml scripts complain.
2021-05-20 13:36:04 +00:00
Vlad Zahorodnii
bc22b9e59e Fix build 2021-05-20 16:25:13 +03:00
Xaver Hugl
793cc5fa25 platforms/drm: replace pointer to egl backend with QPointer
If the egl backend gets deleted this leaves a dangling pointer. In
order to prevent crashes with QPainter or EglStreams also don't try
to create dmabuf textures without a EglGbmBackend.
2021-05-20 14:37:55 +02:00
Vlad Zahorodnii
39e2387f9f Rename Item::scheduleRepaint()
One can think that Item::scheduleRepaint() will trigger repaint of the
whole item, but it actually only schedules the next frame. If nothing
has changed on the screen, no real painting will be done unless maybe if
the rendering backend needs to repair the back buffer.
2021-05-19 12:50:11 +00:00
Vlad Zahorodnii
e4ec955d88 Remove shadow related bits in Scene::Window 2021-05-19 14:13:47 +03:00
Vlad Zahorodnii
6f39d79d72 Remove Scene::Window::{discard,update}Pixmap
They are used only by X11Client, so make X11Client call relevants
methods on the surface item directly instead. In hindsight, it will be a
really good idea to make SurfaceItemX11 and SurfaceItemXwayland(?)
automatically manage the window pixmap. However, it can be done once
an item freezing api is added and we fix the cross-fade animation.
2021-05-19 11:10:50 +00:00
Vlad Zahorodnii
9be862999e Remove explicit repaint in InternalClient::commitGeometry()
The associated window item will schedule a repaint if needed.
2021-05-19 09:14:02 +03:00
Vlad Zahorodnii
506214a632 Move repaint scheduling logic to Item
Currently, items depend on scene windows for creating pixmaps, repaint
scheduling, and caching quads.

This change moves repaint scheduling from scene windows to items to
make the scene items depend less on scene windows.

In hindsight, we may clean up the repaint scheduling machinery further
by introducing view objects.
2021-05-19 06:06:01 +00:00
Aleix Pol
386814176b drm: Use KScreen's json files to set up the initial output composition
So far we had a composition setup within kwinrc and kscreen. This
produces flickering sometime and makes the state a bit more flimsy.
This patch changes the kwin's behaviour to use the files produced by
kscreen which are anyways available down the line.

THis simplifies our behaviour down to just one format that we write to
and feed from. This also allows us to leverage it further by using this
format for default setups (which consist in the right file in
~/.local/share/kscreen).
2021-05-18 14:18:38 +00:00
Zhang Liang
66377359e1 Add ther layer property in debug console
Add the layer property for debugging window
2021-05-18 13:35:12 +00:00
Xaver Hugl
7de0f1f2ad platforms/drm: CPU copy for multi-gpu
Not all GPUs can scan out linear buffers, so if import with a dmabuf
fails manually copy the data into a non-linear gbm buffer instead.

BUG: 432707
2021-05-18 14:54:05 +02:00
Vlad Zahorodnii
2d9e2f0c70 effects: Fix EffectWindow::shape() for X11 windows
With the introduction of scene items, the Scene::Window::bufferShape()
method was removed as it makes no sense on wayland - a window may have
several sub-surfaces, so a single region to indicate the shape of the
window won't work.

SurfaceItem::shape() returns the shape of a surface. On Wayland, it
corresponds to the rect of the wl_surface. On X11, it corresponds to the
client window rect inside the frame window, or custom shape region if
the client has set one.

On the other hand, EffectWindow::shape() wants a completely different
thing. If the window is decorated, it needs to return the rect of the
decoration. Otherwise it has to return the shape region if there's one.

In the future, the EffectWindow::shape() function must be removed as it
doesn't fit the item based design. The main reason why we have it at
all is because the x server doesn't support translucency, setting a
shape region is a (hacky) way to work around that limitation, xeyes is
a notable example.

BUG: 437138
BUG: 435862
2021-05-18 12:28:27 +00:00
Aleix Pol
a20a4327f5 screencasting: Make sure we don't stream after we've stopped a stream
When doing some (intense) testing I've seen it crash. This will prevent
it for good.
2021-05-18 11:51:05 +00:00