1
0
Fork 0
Commit graph

7275 commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
8b09542fd9 boxes: Crop rectangle converting to integer with grow strategy
Reuse meta_rectangle_from_clutter_rect with growing strategy to properly cast
the clutter floating rectangle to integer MetaRectangle.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 19:42:08 +01:00
Marco Trevisan (Treviño)
a8c972cd6b boxes: Add function to create a rectangle from floating clutter rect
Meta rectangles are integer based while clutter works in floating coordinates,
so when converting to integers we need a strategy.

Implement the shrink strategy by ceiling the coordinates and flooring the width,
and the grow strategy reusing clutter facility for this.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 19:42:07 +01:00
Marco Trevisan (Treviño)
ceb4fe2151 wayland-tablet-tool: Downscale the sprite texture in FB mode
When using scaled framebuffer we need to downscale the texture size in order
to get the cursor properly drawn at its real size and in good quality.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
Jonas Ådahl
ad5555bf42 clutter: Add API to get the resource scale of an actor
A clutter actor might be painted on a stage view with a view scale
other than 1. In this case, to show the content in full resolution, the
actor must use a higher resolution resource (e.g. texture), which will
be down scaled to the stage coordinate space, then scaled up again to
the stage view framebuffer scale.

Use a 'resource-scale' property to save information and notify when it
changes.

The resource scale is the ceiled value of the highest stage view scale a
actor is visible on. The value is ceiled because using a higher
resolution resource consistently results in better output quality. One
reason for this is that rendering is often not perfectly pixel aligned,
meaning even if we load a resource with a suitable size, due to us still
scaling ever so slightly, the quality is affected. Using a higher
resolution resource avoids this problem.

For situations inside clutter where the actual maximum view scale is
needed, a function _clutter_actor_get_real_resource_scale() is provided,
which returns the non-ceiled value.

Make sure we ignore resource scale computation requests during size
requests or allocation while ensure we've proper resource-scale on
pre-paint.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
Marco Trevisan (Treviño)
3512647419 background: Use monitor scale to generate the texture at real monitor size
We need to use pixel size of the monitor in order to generate a valid
texture with full quality for current monitor

In spanned case the background should cover all the differently scaled monitors
thus we scale the texture up to the maximum scaling level and then we resample
it drawing only each side in the monitor it should occupy using the proper
scaling level.

In wallpaper mode (or color mode) for example we don't need to scale the area,
also the texture size we return should be unscaled, not to confuse
MetaBackgroundActor making it use more space than needed.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2019-03-01 17:46:49 +00:00
Marco Trevisan (Treviño)
42953a50bb stage: Queue redraw previous Rect only if it has changed
No need to queue redraw the same area multiple times, so we can avoid the
computation involved with it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
Marco Trevisan (Treviño)
f4c2b69934 stage: Clamp to pixel the redraw clip taking care of the floored coords
When we floor the quad coordinates then we've also to enlarge the quad by the
difference between the floored value and the actual coordinate, otherwise
we'd end up in a smaller quad.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
Marco Trevisan (Treviño)
d7ec5d3022 stage: Add utility function to queue draw a ClutterRect
Remove duplicated code to clamp to pixel

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
Marco Trevisan (Treviño)
7442de81bb display: Add meta_display_get_monitor_scale
This will return the monitor scaling for the requested logical screen

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2019-03-01 17:46:49 +00:00
Marco Trevisan (Treviño)
f76b3edf9c monitor: Define scale_steps globally
No need to compute the scale steps multiple times, since
it's just a defined value, so let's use a define for this
avoiding to pass around.

https://bugzilla.gnome.org/show_bug.cgi?id=782742
2019-03-01 17:46:49 +00:00
Jonas Dreßler
8d9a5e3c7e wayland/touch: Remove undelivered touches earlier
When the touch_down event was not delivered to Wayland clients, there's
no point in keeping the touchpoint in our list, so remove it early
inside update() instead of removing it after the touch ended.

This fixes a crash inside touch_handle_surface_destroy() where the
assertion to make sure the surface is removed fails because the
touch_count of the surface never reached 0. This in turn happened
because a new sequence was added, while a (already ended one) wasn't
removed from the touch->touches list before. This caused the touch
counter to get incremented by 1 while no new sequence was added to the
list (because Clutter reuses sequence IDs, the old sequence is equal to
the new one, i.e. the new sequence already is present in the list).

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/200

https://gitlab.gnome.org/GNOME/mutter/merge_requests/426
2019-02-28 09:52:23 +00:00
Niels De Graef
1c6ea5d1db Use a consistent style for enum braces
https://gitlab.gnome.org/GNOME/mutter/merge_requests/361
2019-02-28 09:31:01 +01:00
Niels De Graef
b67394dcd1 clutter: StageWindow: Use G_DECLARE_INTERFACE()
It cuts away a bit of the GObject boilerplate, gives us support for
`g_autoptr`, and removes the typedef hack inside clutter-stage-window.c.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/380
2019-02-27 16:44:24 +00:00
Jonas Ådahl
9e75ce2ad7 monitor-config-store: Read system wide config files
Before introducing the new config store, the old monitor configuration
system read system wide monitor configuration files. Add back that
feature.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/253
2019-02-26 21:04:27 +00:00
Jonas Ådahl
7c807c6e2a org.gnome.Mutter.ScreenCast: Document what was added in API version 2
RecordWindow and the cursor-mode property are only available if the
advertised version is at least 2.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
Jonas Ådahl
9a20271f90 screen-cast-window-stream: Add support for cursor modes
Make the RecordWindow method also understand the 'cursor-mode' property.
For 'embedded' the cursor is drawn onto the pixel buffer using cairo,
otherwise it works similarly to how RecordMonitor deals with it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
Jonas Ådahl
1760a6e560 screen-cast: Bump API version to 2
https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
Jonas Ådahl
8c2b805d88 screen-cast-src: Add helper to draw cursor sprite into pixel buffer
It makes sure the cursor sprite is correctly scaled and positioned in
stream coordinate space.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
Jonas Ådahl
2f01418d45 screen-cast-window: Add API to check if content has damage
https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
Jonas Ådahl
a76107a19f screen-cast-window: Add API to transform cursor state
To be used to translate absolute cursor positions to relative positions,
as well as to determine whether a cursor sprite is inside the stream or
not. It also helps calculating the scale the cursor sprite needs to be
scaled with to be in stream coordinate space.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
Jonas Ådahl
c80ba819e7 screen-cast-window-src: Keep a screen cast window instead of an actor
Practically it's the same object, but ideally, we should not deal
with "actors" anywhere here.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
Jonas Ådahl
14c6a347c1 screen-cast-window-src: Rename painted callback to after_paint
We'll add a before_paint soon, so better have the names somewhat match.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
Jonas Ådahl
11bd847896 screen-cast-window-stream: Don't set the position property
It was not meant to be set for window streams, and was set to (0, 0)
anyway. This removes the corresponding MetaScreenCastWindow API, as it's
not needed anymore.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
Jonas Ådahl
870f38542d screen-cast-window-stream: Set the size property to the logical size
As the stream size is the logical monitor size multiplied with the ceil
of the logical monitor scale, the corresponding logical size, which is
what should be passed via the size property on the D-Bus object, should
be the logical monitor size.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
Jonas Ådahl
c22edeff1f screen-cast-window-stream: Use initable to initialize
Move the initialization from _new() to an initable implementation. This
will allow us to initialize fields before MetaScreenCastStream
initializes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
Jonas Ådahl
183de60d91 screen-cast-src: Move back MetaSpaType to C file
It's not needed by the monitor source anymore.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
Jonas Ådahl
176b508029 screen-cast-src: Change offscreen cursor helper to take a uint8_t *
Instead of a `uint32_t *`. Eventually we shouldn't assume pixels are
always 32 bit, and this gets rid of some casts while at it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
Jonas Ådahl
9be189daa7 screen-cast: Move cursor metadata setting to generic source
Make the monitor implementation do things strictly related to its own
source type, leaving the Spa related logic and cursor read back in the
generic layer, later to be reused by the window source type
implementation.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
Carlos Garnacho
8a9a78ec8a wayland: Check whether Xwayland window had a prior surface in generic code
Since commit 8df2a1452c (As pointed out by Robert Mader) we just happened
do this check when doing the first lookup for a Wayland surface for a
XWayland window, when we are later notifying upon surface creation we just
set the relation with no further checks.

The cases pointed out in the comment (eg. window changing decoration) might
presumably happen in a quick enough sequence that we have two scheduled
associations on the fly, so move this check to the more generic
meta_xwayland_associate_window_with_surface() which is called on both
immediate and delayed paths.

https://gitlab.gnome.org/GNOME/mutter/issues/361
2019-02-25 17:53:52 +00:00
Robert Mader
803ffc19a4 shaped-texture: Clean-up deprecated NPOT check
There are most likely no GNOME users left still using hardware that
does not support NPOT textures. Further more, they would crash much
earlier and never hit this code-path. So remove the unnecessary check
here.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/447
2019-02-25 17:51:48 +01:00
Robert Mader
ddd2ce3a88 wayland/buffer: Fall back to CoglTexture2DSliced
XWayland creates buffers of the combined size of all connected displays.
This can, especially on older but still in use hardware, exceed the limits
of the GPU.

If that is the case, use `CoglTexture2DSliced` instead of `CoglTexture2D`

https://gitlab.gnome.org/GNOME/mutter/merge_requests/447
2019-02-25 17:51:44 +01:00
Jonas Ådahl
979e689278 renderer/native: Retry page flip after one vsync if EBUSY
We might fail to page flip a new buffer, often after resuming, due to
the FIFO being full. Prior to this commit, we handled this by switching
over to plain mode setting instead of page flipping. This is bad because
we won't be synchronized to the refresh rate anymore, but just the
clock.

Instead, deal with this by trying again until the FIFO is no longer
full. Do this on a v-sync based interval, until it works.

This also changes the error handling code for drivers not supporting
page flipping to rely on them returning -EINVAL. The handling is moved
from pretending a page flip working to explicit mode setting in
meta-renderer-native.c.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/460
2019-02-25 15:48:29 +00:00
Jonas Ådahl
2c1ab8b3cc renderer/native: Remove legacy non-stage-view code
A renderer view will, under the native backend, since long ago always
have a logical monitor associated with it, so remove the code handling
the legacy non-stage view case.

https://gitlab.gnome.org/GNOME/mutter/issues/460
2019-02-25 15:48:29 +00:00
Jonas Ådahl
252e64a0ea wayland: Move surface texture ownership to MetaWaylandSurface
Prior to this commit, MetaWaylandSurface held a reference to
MetaWaylandBuffer, who owned the texture drawn by the surface. When
switching buffer, the texture change with it.

This is problematic when dealing with SHM buffer damage management, as
when having one texture per buffer, damaged regions uploaded to one,
will not follow along to the next one attached. It also wasted GPU
memory as there would be one texture per buffer, instead of one one
texture per surface.

Instead, move the texture ownership to MetaWaylandSurface, and have the
SHM buffer damage management update the surface texture. This ensures
damage is processed properly, and that we won't end up with stale
texture content when doing partial texture uploads. If the same SHM
buffer is attached to multiple surfaces, each surface will get their own
copy, and damage is tracked and uploaded separately.

Non-SHM types of buffers still has their own texture reference, as the
texture is just a representation of the GPU memory associated with the
buffer. When such a buffer is attached to a surface, instead the surface
just gets a reference to that texture, instead of a separately allocated
one.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/199
2019-02-25 15:35:38 +00:00
Jonas Ådahl
d2f1edd6c6 wayland/surface: Process damage also for non-actor surfaces
The texture still needs to be updated with damaged content.

https://gitlab.gnome.org/GNOME/mutter/issues/199
2019-02-25 15:35:38 +00:00
Jonas Ådahl
944a4763f6 cursor-renderer/native: Clear active CRTC gbm_bo when destroyed
When we freed the cursor GPU state including the gbm_bo objects attached
to it, we didn't unset the cursor renderer private of the CRTCs of the
associated GPU. This means that HW cursor invalidation could potentially
break if a new gbm_bo happened to be allocated at the same memory
address as the previous one.

To avoid this, iterate through the CRTCs of the GPU of which the cursor
data is freed, and unset the cursor renderer private if it was the one
destroyed.

https://gitlab.gnome.org/GNOME/mutter/issues/199
2019-02-25 15:35:38 +00:00
Jonas Ådahl
22a296f971 wayland/dma-buf: Don't use API meant for MetaWaylandSurface internally
What was actually done when calling meta_wayland_buffer_attach() was
that the texture was realized, so just call the function
`meta_wayland_dma_buf_realize_texture()` and call that.

This is in preparation to change how meta_wayland_buffer_attach() work.

https://gitlab.gnome.org/GNOME/mutter/issues/199
2019-02-25 15:35:38 +00:00
Benjamin Berg
ef2153739c idle-monitor: Fix duplicate return value of ResetIdletime call
The signal handler must return TRUE as the invocation is already handled
by returning an error. Also update the error message a bit to clarify
that the API exists only for testing purposes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/457
2019-02-25 14:42:03 +00:00
Emilio Pozuelo Monfort
6975c8b424 monitor-config-manager: respect other outputs' CRTC
We should not only take the old CRTC for an output whenever
possible, but we should also assign one that is 'free', i.e.
one that another monitor (to be processed after this one)
isn't using, so that that monitor can use the same CRTC.

https://gitlab.gnome.org/GNOME/mutter/issues/373
2019-02-21 17:23:38 +02:00
Emilio Pozuelo Monfort
f4f823f238 monitor-config-manager: reuse old CRTC when possible
We shouldn't change an output's CRTC if we don't have to, as
that causes the output to go black.

This patch depends on
"monitor-unit-tests: initial crtcs in custom_lid_switch".

https://gitlab.gnome.org/GNOME/mutter/issues/373
2019-02-21 17:23:38 +02:00
Pekka Paalanen
1c67260bd4 monitor-unit-tests: initial crtcs in custom_lid_switch
This test forgot to specify the existing CRTC routings in the setup. For the
first output the default 0 was ok, now it is -1 to ensure that the code will
assign it correctly. For the second output the default 0 was incorrect, because
possible_crtcs does not include 0.  Now that CRTC is initialized to off
instead, because the second output is hotplugged later and running a CRTC
without an output does not make sense.

This fix will keep this test passing when a future patch attempts to preserve
existing CRTC routings. Assuming that any existing routing is valid, such
routing will be kept. In this test case the existing routing was illegal, it
should have been impossible, which then causes that future patch to fail the
test by assigning the wrong CRTC.

https://gitlab.gnome.org/GNOME/mutter/issues/373
2019-02-21 17:22:12 +02:00
Olivier Fourdan
79f90c147c MetaPluginManager: Don't return void value
The spec for `meta_plugin_manager_confirm_display_change()` is to return
`void`, no need to return a value there.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/456
2019-02-21 09:31:15 +01:00
Andrea Azzarone
1c2e8fcf06 keybinding: Store flags in MetaKeyGrab
The external grab handler is shared across all external bindings and external
bindings have now different binding flags. For this reason, when rebuilding the
binding table there could be loss of information if we assign the bindings flags
of the external handler to all external bindings. Let's store the bindings flags
in MetaKeyGrab too and use this when rebuilding the binding table to avoid the
above issue.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/169
2019-02-20 14:36:24 +00:00
Andrea Azzarone
00ca387ec7 keybindings: Add flag param to grab_accelerator
Add a 'flags' parameters to meta_display_grab_accelerator. This will allow
e.g. gnome-settings-daemon (through the gnome-shell's GrabAccelerator API) to
create shorcuts that should descard auto-repeated key events.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/169

Closes: https://gitlab.gnome.org/GNOME/gnome-settings-daemon/issues/68
2019-02-20 14:36:24 +00:00
Olivier Fourdan
7bd668e6d0 window: Do not restore shortcuts on a NULL window
The "force restore shortcuts" being triggered by a key-combo, there is
no guarantee that the currently focused window is actually non-NULL in
which case we would crash.

Make sure there is a window currently focused before trying to restore
the shortcuts on that window.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/464
2019-02-18 11:23:59 +01:00
Olivier Fourdan
6fe46cac60 wayland/xdg-shell: Do not maximize if not possible
On X11, if a window cannot be maximized because its minimum size is
already larger than the output size, a request to maximize will be
ignored.

On Wayland, however, we would still honor the maximize request and
switch the window state to maximized, without actually moving the window
which leads to weird visual effects, as the window end up being
maximized in-place.

To avoid this, make sure the window has the maximize functionality
available prior to change its state in xdg-shell `set_maximized`
request.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/463
2019-02-15 09:40:44 +01:00
Niels De Graef
c3b9ef7bf5 gpu: Remove unimplemented ::get_kms_file_path()
https://gitlab.gnome.org/GNOME/mutter/merge_requests/444
2019-02-15 09:17:07 +01:00
Marco Trevisan (Treviño)
77fb0a0003 window-actor: Remove public declaration for get_x_window
meta_window_actor_get_x_window has been removed in commit 422648e2 but has not
been removed from the header for ages.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/439
2019-02-14 13:09:20 +00:00
Marco Trevisan (Treviño)
58d2a674c4 window: Return focusable ability looking at properties only
As per commit 43633d6b, we mark an unmanaging window as not focusable, while
this is true, it might cause not resetting the current focused window when
unmanaging it causing a crash.

Also this wouldn't allow to check if a window can be focused when unmanaging it,
so let's revert the previous behavior.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/462
2019-02-14 13:49:51 +01:00
Carlos Garnacho
9e2ed4104d wayland: Reset text-input state after commit
This was wrongly done just before enable, which is not right as
per the protocol. A side effect was that input purpose/hints were
eagerly reset before being applied, thus not properly honored,
noticed in the doing of emoji/numeric OSK panels.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/410
2019-02-14 11:23:07 +01:00