Commit Graph

8768 Commits

Author SHA1 Message Date
Christian Rauch
7e0d80be39 backend/dummy: Do not enforce minimum screen size
https://gitlab.gnome.org/GNOME/mutter/-/issues/1481
2020-10-23 12:12:15 +01:00
Christian Rauch
4862e4cb39 backend/dummy: Warn about missing dummy mode specs
When malformed modes are provided and no valid mode spec is found, mutter
will eventually try to access the last element of an empty list. Warn about
this and exit properly.

https://gitlab.gnome.org/GNOME/mutter/-/issues/1481
2020-10-23 12:12:08 +01:00
Christian Rauch
a51ad8f932 core/window: Store/load window dimensions before/after fullscreen
We will use a dedicated variable when transitioning to/from fullscreen state
and leave the previously used 'saved_rect' exclusively for transitioning
between floating and maximized state.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/801
2020-10-22 16:29:09 +00:00
Christian Rauch
3faea8532c core/window: Move size hints to dedicated function
https://gitlab.gnome.org/GNOME/mutter/merge_requests/801#note_676932
2020-10-22 16:29:09 +00:00
Christian Rauch
20519a1486 core/window: Do not apply limits if no previous size has been stored
A previously stored width and height of 0 signifies that no previous window
size has been stored. This might be the case if an application starts in
maximized or fullscreen mode. If no previous window size has been stored,
the client needs to determine its own size.

https://bugzilla.gnome.org/show_bug.cgi?id=783901
https://gitlab.gnome.org/GNOME/mutter/merge_requests/801#note_607607
2020-10-22 16:29:09 +00:00
Christian Rauch
a93ef84d57 wayland/window: Provide prior floating window dimensions
Implements the "prior window window geometry dimensions" as described in
the documentation of 'xdg_toplevel' request 'unset_maximized':
"If available and applicable, the compositor will include the window
geometry dimensions the window had prior to being maximized in the
configure event."
and 'unset_fullscreen':
"The compositor may include the previous window geometry dimensions in
the configure event, if applicable."

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/792.
2020-10-22 16:29:09 +00:00
Carlos Garnacho
f4a1dcfc93 wayland: Set IO error exit handler
If this call is available, we can turn libX11 IO errors (fatal by definition)
into something we can recover from. Try to dispose all X11 resources and close
the display instead, so the compositor can survive the event.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1447
2020-10-21 18:57:13 +02:00
Carlos Garnacho
1b39b92fa5 xwayland: Protect against MetaX11Display abruptly closing
If the MetaX11Display abruptly closed when X11 windows were present,
we would still try to deal with them while freezing/thawing for the
"fade out" animation.

At the bottom of that, the X server may be gone, just try to cope
with it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1447
2020-10-21 18:57:12 +02:00
Uday Kiran Pichika
9d0bac0754 output: Move edid parse function to the right file
Move the edid parsing function from MetaMonitorManager to MetaOutput
to read the monitor manufacturer,serial,vendor,etc.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1516/
2020-10-21 17:04:44 +05:30
Jonas Ådahl
cd52288ddc wayland: Allow specifying Wayland display name from command line
Useful to avoid warnings when starting when there is already an active
Wayland compositor in the session.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1515
2020-10-20 21:16:30 +00:00
Jonas Dreßler
650efb6445 tests/conform/actor-pivot-point: Show stage before allocating
We're going to enforce some invariants a bit stricter and will only
allow allocating if an actor is mapped, not only visible.

Since actors are only mapped if their parent is mapped and stages are
hidden by default, we need to show the stage to ensure the actors are
mapped before we allocate them. So do that and call clutter_actor_show()
on the stage before fake-allocating the test actors.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1366
2020-10-20 15:27:43 +00:00
Daniel van Vugt
345976192d wayland-buffer: Add debug logging of pixel format in use
Enable it with environment `MUTTER_DEBUG=wayland`.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1387
2020-10-20 09:53:53 +00:00
Daniel van Vugt
e480d0c71e wayland-dma-buf: Add debug logging of pixel format in use
Enable it with environment `MUTTER_DEBUG=wayland`.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1387
2020-10-20 09:53:52 +00:00
Daniel van Vugt
716ecf6cdf util: Add META_DEBUG_WAYLAND debug topic
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1387
2020-10-20 09:53:52 +00:00
Olivier Fourdan
7ab3eac0e2 constraints: Use "orig" rectangle for interactive resize
Bug 448183 fixed an issue with _NET_WM_MOVERESIZE_WINDOW not moving a
window by basing the resize on the current (new) rectangle instead of
the original rectangle.

While this fixes the issue with _NET_WM_MOVERESIZE_WINDOW, this also
causes windows with a size increment to move when the resize also
implies a move, such windows might drift while resizing.

Make sure to use the current rectangle for non-interactive resizes only.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/543
2020-10-19 11:16:12 +02:00
Olivier Fourdan
deaa9480a8 window-props: Check for actual size hints changes
The XSizeHints set by X11 clients give a hint to the window manager
about size increment, aspect ratio, base, minimum and maximum size, etc.

When an X11 client changes those values, there is a good chance that it
will affect the actual window size in some way, and mutter rightfully
queue a window resize in that case.

However, mutter does not check if any of the hints have actually changed
and unconditionally queue a window resize whenever a client changes its
WM_NORMAL_HINTS property.

That can be a problem when a zealous client such as xterm decides to
update its WM_NORMAL_HINTS property on resize, because in return mutter
will queue a non-user driven resize in the middle of user-driven events,
hence defeating the purpose of the META_MOVE_RESIZE_USER_ACTION flag.

To avoid that issue, make mutter a bit smarter and avoid queuing a
window resize if the XSizeHints haven't actually changed.

https://gitlab.gnome.org/GNOME/mutter/-/issues/543
2020-10-19 11:16:12 +02:00
Olivier Fourdan
03c69ed8cf window: Do not go past size hints on resize
On interactive resize, mutter calculates the difference in size based on
the pointer location and relies on window constraints to ensure the
minimum size is honored.

Wayland however does asynchronous window configuration, meaning that not
checking for size hints early enough may lead to the window moving as
the locations was initially computed on a size which will be invalidate
by the client eventually.

Make sure to respect the client size hint on update_resize() so that we
don't end up with a window moving unexpectedly when the client
eventually acked the configuration.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1495
2020-10-19 11:16:12 +02:00
Robert Mader
554f7984e9 window/wayland: Offset position with size mismatch when finishing a resize
Analogous to commit 8bdd2aa7db, calculate the size missmatch offset
also when finishing a resize.

Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/396
2020-10-19 11:16:12 +02:00
Hans de Goede
ec18a559c6 monitor-manager: Ignore tablet-mode-switch on initial config of native portrait mode panels
Many tablets have a native portrait mode panel, yet come with a keyboard dock,
where the device gets docked in landscape mode. To avoid the display being
on its side when mutter starts while the tablet is docked, we need to take
the accelerometer reported orientation into account even if there is a
tablet-mode-switch which indicates that the device is NOT in tablet-mode
(because it is docked).

Add special handling for the first time the "orientation-changed"
signal gets signalled by the orientation-manager, which happens after it
has successfully claimed the accelerometer with iio-sensor-proxy.

The added special handling of the initial "orientation-changed" signal
does a number of checks:

1. panel_orientation_managed is false because of the tablet-mode-switch and not
   because of other reasons.

2. The device has a native portrait mode panel (and thus likely needs rotation
   to display the image the right way up when docked).

If all these checks succeed then it continues with creating a new
monitors-config based on the orientation ignoring the panel_orientation_managed
value (for the initial/first "orientation-changed" signal only).

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1506
2020-10-18 21:35:10 +00:00
Hans de Goede
1b13f50582 monitor-manager: Update orientation based config when panel_orientation_managed changes
The orientation reported by the orientation_manager may have changed while
panel_orientation_managed was false. So when panel_orientation_managed
changes to true we should re-check the orientation.

This fixes the orientation not being correct when e.g. taking a 360 degree
hinges 2-in-1 in clamshell mode (so landscape orientation) and then folding
it into tablet mode while holding it in portrait orientation.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1506
2020-10-18 21:35:09 +00:00
Hans de Goede
4c12208363 monitor-manager: Add a handle_orientation_change helper function
Move the bulk of orientation_changed to a new handle_orientation_change
helper function. This is a preparation patch for further orientation
handling related changes.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1506
2020-10-18 21:35:09 +00:00
Hans de Goede
21c714a0f2 seat-native: Add support for tablet-mode-switch being hot-unplugged
Add support for the (mostly theoretical) case of an input-device
offering tablet-mode-switch functionality being unplugged.

This makes the has_tablet_switch handling identical to the has_touchscreen
handling, leading to more consistent code.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1506
2020-10-18 21:35:09 +00:00
Hans de Goede
88cabf8039 seat-native: Check for tablet-switch devices from meta_seat_native_constructed
Detect if a tablet-mode-switch device is already present when mutter
starts by checking for this from meta_seat_native_constructed. This
mirrors how we also set has_touchscreen from meta_seat_native_constructed.

This fixes tablet-mode-switches only being recognized when they are added
at runtime.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1506
2020-10-18 21:35:09 +00:00
Hans de Goede
6c240dc83b seat-native: Fix has_touchscreen becoming FALSE when a non touchscreen device gets added
Unconditionally setting has_touchscreen to check_touch_mode
when a new device gets added leads to has_touchscreen becoming
false when during runtime e.g. an USB keyboard gets plugged in.

Fix this by setting has_touchscreen to TRUE when check_touch_mode
is TRUE and leaving it alone otherwise.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1506
2020-10-18 21:35:09 +00:00
Hans de Goede
b5d21f00f8 backend: Use new clutter_seat_has_touchscreen helper
Replace the meta-backend.c private check_has_physical_touchscreen
function with a call to the new clutter_seat_has_touchscreen helper.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1506
2020-10-18 21:35:08 +00:00
Robert Mader
b2f2050b95 renderer-native: Fix GObjectify oversight
This was forgotten in eb14da3874, triggering crashes.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1510
2020-10-18 11:25:27 +02:00
Jonas Ådahl
5a58ccbece texture-tower: Use memory management helpers more
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:38 +00:00
Jonas Ådahl
1cc82cf759 background: Use memory management helpers more
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:38 +00:00
Jonas Ådahl
eb14da3874 cogl: Turn CoglFramebuffer, CoglOffscreen and CoglOnscreen into GObjects
A first step towards abandoning the CoglObject type system: convert
CoglFramebuffer, CoglOffscreen and CoglOnscreen into GObjects.
CoglFramebuffer is turned into an abstract GObject, while the two others
are currently final. The "winsys" and "platform" are still sprinkled
'void *' in the the non-abstract type instances however.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:38 +00:00
Jonas Ådahl
de4e59a39b clutter: Don't use CoglHandle to store framebuffers
Better just not lose type informatoin.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:38 +00:00
Jonas Ådahl
4b939439ac tests/clutter: Stop using cogl_offscreen_new_to_texture()
Use the non-deprecated variant.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:38 +00:00
Jonas Ådahl
aa99e505ad cogl/framebuffer: Move public struct fields to private struct
This will limit accidental manipulation of the framebuffer struct
fields, while also paving the way to change to GObject type hierarchy.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
2020-10-16 16:17:38 +00:00
Daniel van Vugt
df76d3deec renderer-native: Get the GBM buffer format from EGL to match the framebuffer
This eliminates two locations where the format was hardcoded.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1491
2020-10-15 07:45:06 +00:00
Robert Mader
ae0d48b6fd wayland/subsurface: Only show subsurface if parent is mapped
The spec states:
```
A sub-surface becomes mapped, when a non-NULL wl_buffer is applied
and the parent surface is mapped. The order of which one happens
first is irrelevant. A sub-surface is hidden if the parent becomes hidden,
or if a NULL wl_buffer is applied. These rules apply recursively
through the tree of surfaces.
```

In the past we relied on Clutter actor behaviour to realize the recursive
part - which then broke in
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/664
when we changed the actor hierachy in regards to subsurfaces.

Explicitly encode the desired behaviour in `MetaWaylandSubsurface`, fixing
the issue and making it future proof.

Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1384
2020-10-14 18:55:21 +02:00
Daniel van Vugt
df65f05e27 cogl: Remove unused swap-related COGL_FEATURE_ID_ flags
What we actually use is `COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT`, which
is also set in the same locations.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1297
2020-10-14 16:27:23 +00:00
Peter Hutterer
e078a007d6 backends: add support for scroll button locking
Where enabled, the first click of the scroll button sets the button logically
down, the second click sets the button logically up.

This is an accessibility feature, it doesn't require users to keep holding the
button down while scrolling which is hard or impossible for some users.

gsettings-desktop-schemas merge request:
https://gitlab.gnome.org/GNOME/gsettings-desktop-schemas/-/merge_requests/39

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1432
2020-10-14 16:02:29 +00:00
Robert Mader
1c1c8b25ed window-actor: Freeze subsurfaces as well
In order to prevent glitches in animations, make sure we freeze all
surfaces of a window actor.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1339
2020-10-14 15:53:53 +00:00
Florian Müllner
22902a5e2c window: "Hide" edge resistance behind modifier key
Aligning windows manually with other windows has become less important
since the advent of tiling. This decreases the usefulness of edge
resistance, which in fact many users perceive as lag nowadays.

Account for that by limiting resistance to screen and monitor edges by
default, and only include windows when the control key is pressed.

https://bugzilla.gnome.org/show_bug.cgi?id=679609
2020-10-14 15:45:24 +00:00
Florian Müllner
f9edb6bad3 edge-resistance: Replace booleans with flags parameter
Multiple boolean parameters don't make for great API, so before we
add another one, replace them with a single flag parameter.

https://bugzilla.gnome.org/show_bug.cgi?id=679609
2020-10-14 15:45:23 +00:00
Florian Müllner
64ced1632e window: Don't override tile monitor
Commit 033f0d11bf added a fallback in case the tile monitor wasn't
set before, but didn't actually check for a previously set value.
As a result, the "fallback" is not set unconditionally, which may
differ from the expected monitor: The tile monitor is determined
by the pointer position, while the window's monitor is the one
where the biggest part of the window resides on.

https://gitlab.gnome.org/GNOME/mutter/-/issues/1389
2020-10-14 15:30:05 +00:00
Jonas Ådahl
43c6f70605 util: Don't expand meta_*() debug log arguments if topic not enabled
It's pointless to call into functions that produce information that will
end up nowhere, so lets not. This will generate less angst when doing
more intense data gathering and string generation in debug log calls.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1467
2020-10-14 14:29:36 +00:00
Jonas Ådahl
bf6dde87f8 compositor: Make sure _NET_WM_FRAME_DRAWN timestamp has the right scope
The timestamp sent with _NET_WM_FRAME_DRAWN should be in "high
resolution X server timestamps", meaning they should have the same scope
as the built in X11 32 bit unsigned integer timestamps, i.e. overflow at
the same time.

This was not done correctly when mutter had determined the X server used
the monotonic clock, where it'd just forward the monotonic clock,
confusing any client using _NET_WM_FRAME_DRAWN and friends.

Fix this by 1) splitting the timestamp conversiot into an X11 case and a
display server case, where the display server case simply clamps the
monotonic clock, as it is assumed Xwayland is always usign the monotonic
clock, and 2) if we're a X11 compositing manager, if the X server is
using the monotonic clock, apply the same semantics as the display
server case and always just clamp, or if not, calculate the offset every
10 seconds, and offset the monotonic clock timestamp with the calculated
X server timestamp offset.

This fixes an issue that would occur if mutter (or rather GNOME Shell)
would have been started before a X11 timestamp overflow, after the
overflow happened. In this case, GTK3 clients would get unclamped
timestamps, and get very confused, resulting in frames queued several
weeks into the future.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1494
2020-10-12 14:48:21 +00:00
Julius Lehmann
433b59f74a wayland: Don't send proximity_in for new resources
Mutter sends a proximity-in event before the required tablet tool
resource is properly allocated on the client. This is violating the
Wayland protocol. Because libwayland ignores events for objects it
doesn't know yet, this is not noticeable in most applications. However,
if https://gitlab.freedesktop.org/wayland/wayland/-/issues/176 gets
fixed, these applications would likely crash immediately. Therefore this
PR removes the responsible code which, again, shouldn't have any effect
on client applications as they ignore this event anyway.

Relevant part of the spec:

    This event can be received when the tool has moved from one surface to
    another, or when the tool has come back into proximity above the
    surface.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1427
2020-10-12 09:37:19 +00:00
Jonas Ådahl
2c95e08998 Remove misplaced line break in g_* logging functions
They resulted in empty lines in the log.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1466
2020-10-08 16:38:41 +02:00
Jonas Ådahl
7266e516a1 wayland: Don't include newline in client error events
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1466
2020-10-08 16:38:41 +02:00
Jonas Ådahl
313e3e771c Make meta_* logging utilities not require line break
Unlike g_* logging utilities, the meta_* counterparts behave like odd
printf() functions. Lets change that so they fit better into how logging
is done everywhere else.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1466
2020-10-08 16:38:41 +02:00
Jonas Ådahl
8bdd2aa7db window/wayland: Offset position with size mismatch when resizing
When we resize a window we send it configure requests with size
suggestion. Some clients, e.g. gnome-terminal will limit its size to a
discrete set given the font size resulting in the size often not being
respected completely, but used as a hint to find a size as large as
possible but not larger than the configured size.

When doing an interactive resize dragging the right or top side of a
window, this caused issues with the configured window size not matching
the one used by the client, as the configured position wouldn't be
correct for the actual size. Fix this by offsetting the position given
the size mismatch offset, making the position again in sync with the
size.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1447

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1477
2020-10-07 16:49:35 +02:00
Carlos Garnacho
bbc4116f10 backends: Use graphene_point_t on meta_cursor_tracker_get_pointer()
It's nicer to propagate along.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1475
2020-10-06 21:33:10 +02:00
Carlos Garnacho
e0944b6097 backend: Don't pull generated headers (indirectly)
Use a typedef for MetaRemoteDesktop, so tests poking MetaBackend don't
indirectly depend upon generated headers. This is arguably a code fix
for a build system bug.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1470

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1449
(or something...)
2020-10-06 16:16:21 +00:00
Jonas Ådahl
498248586a util: Remove now unused debug functions
They have been replaced with using debug string parsing and topics.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1465
2020-10-06 15:52:54 +00:00