1
0
Fork 0
Commit graph

32690 commits

Author SHA1 Message Date
Jonas Ådahl
c68d6c4958 window: Fix minor coding style issue
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3879>
2024-07-22 20:59:18 +02:00
Jonas Ådahl
5e36e5aae1 window: Clarify expression for deciding whether to auto-maximize
Calculate areas and store them in descriptively named variables, and
then compare them, instead of doing it all in one go.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3879>
2024-07-22 20:59:18 +02:00
Jonas Ådahl
d7daf50d62 window: Move required condition into main if statement in show()
No logical changes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3879>
2024-07-22 20:59:18 +02:00
Jonas Ådahl
9ebbf83e95 window: Add place flags
Replace a boolean argument and a temporary MetaWindow struct field with
a `MetaPlaceFlag` passed where relevant. This includes
`meta_window_move_resize_internal()` and `meta_window_constrain()`, as
placement may happen during constraining, and also
`meta_window_force_placement()`.

The struct field (denied_focus_and_not_transient) was only ever set in
meta_window_show(), before meta_window_force_placement(), and
immediately unset as a side effect of that. In .._show() we'll always
force placement if the window wasn't already placed, and in
meta_window_constrain(), we'd only ever call meta_window_place() if the
window wasn't already placed, meaning the variable would only ever be
relevant during `meta_window_show()`. Having it as a flag makes that
relationship and temporary state clearer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3879>
2024-07-22 20:59:18 +02:00
Jonas Ådahl
f4b79441fa tests/test-runner: Allow tweaking 'center-new-windows' pref
This will allow tests to test placement algorithms.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3879>
2024-07-22 20:59:18 +02:00
Jonas Ådahl
d8cdc56ec4 place: Remove a couple of comments about X11 roundtrips
It's not relevant in the context where the comment is, and don't need to
be reminded of X11 quirks here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3879>
2024-07-22 20:59:18 +02:00
Jonas Ådahl
22533f8454 place: Move and clean up finding relevant windows
Split up the condition a bit, use an auto pointer for a list, and use
current convention for list iteration.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3879>
2024-07-22 20:59:18 +02:00
Jonas Ådahl
463c7ab989 window: Clean up formatting and naming of stacking adjustment condition
The function checking whether a 'always-on-top' window covers the
showing window now has that in the name, to make it more obvious. That
function was also changed to use the more common way of iterating a
list, and now uses auto cleanup pointers for the list.

The condition itself was updated to follow the current coding style.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3879>
2024-07-22 20:59:18 +02:00
Jonas Ådahl
76e044c39d window: Include window title in debug description
Useful to reason about MUTTER_DEBUG=stack logs when using metatests.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3879>
2024-07-22 20:59:18 +02:00
Bilal Elmoussaoui
fe60ee8b90 cogl: Replace custom static assertions with glib one
The displayed message is kept as a comment in the codebase
which is good enough

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3895>
2024-07-22 18:08:17 +02:00
Bilal Elmoussaoui
1acfa6def3 cogl: Move Color struct definition where it belongs
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3895>
2024-07-22 18:08:17 +02:00
Bilal Elmoussaoui
028df43012 cogl: Remove duplicated *_BIT defines
They are already defined in cogl-pixel-format header

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3895>
2024-07-22 17:36:10 +02:00
Bilal Elmoussaoui
138e5d4f54 cogl: Move TextureVertex to Clutter
The type is only used in ClutterDeformEffect, so move it there

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3895>
2024-07-22 17:36:10 +02:00
Bilal Elmoussaoui
fb3f239953 cogl/debug: Remove unused ignore-help parameter
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3895>
2024-07-22 13:06:33 +02:00
Bilal Elmoussaoui
f4f6422699 cogl: Remove remaining i18n infrastructure
Not sure it makes sense to translate only parts of the debugging output
and on top of that, those files were not part of POTFILES, so they were not
translated anyways..

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3895>
2024-07-22 13:06:33 +02:00
Bilal Elmoussaoui
6da869d575 cogl: Move has_feature to Context namespace
That is where it belongs anyways..

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3895>
2024-07-22 13:06:33 +02:00
Daniel van Vugt
21bc7432dc onscreen/native: Squash adjacent switch statements
Because we can. And it's now clearer that `buffer` is only used in
`META_RENDERER_NATIVE_MODE_GBM`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3891>
2024-07-18 17:37:06 +08:00
Daniel van Vugt
c4d0e970dc onscreen/native: Move next_frame storage to later in the function
It won't be used until later when we flip, and in fact assigning
it early could have led to its own assertion failing on the next frame
in the unlikely event that we return with "Failed to ensure KMS FB ID...

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3891>
2024-07-18 17:26:38 +08:00
Jonas Ådahl
288d57f6a5 window: Propagate stickyness across modal dialog chains
While marking a parent window as sticky or non-sticky always propagates
to the children, also propagate to the parents if the dialog in question
is modal.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3870>
2024-07-17 15:25:52 +00:00
Jonas Ådahl
c079e2696d tests/test-runner: Add (un)set_modal
Ends up calling gtk_window_(un)set_modal() in the client.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3870>
2024-07-17 15:25:52 +00:00
Jonas Ådahl
9628806b37 window: Ignoring unmanaging ancestor when finding root
This avoids the following critical warning happening sometimes when a
Wayland client exits taking all its window with it in an arbitrary
order:

    CRITICAL: meta_window_set_stack_position_no_sync: assertion 'window->stack_position >= 0' failed

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3870>
2024-07-17 15:25:52 +00:00
Jonas Ådahl
d80f1944ef tests: Add tests for stickyness
The test tests how sticky windows and their transient-for dialog windows
behave together.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3870>
2024-07-17 15:25:52 +00:00
Jonas Ådahl
b206e146ea tests/test-runner: Add stick/unstick commands
These can be used to toggle the "showing on all workspaces" state.

An assertion for checking stickyness was added too.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3870>
2024-07-17 15:25:52 +00:00
Jonas Ådahl
559bdefcc7 tests:test-runner: Add 'assert_stacking_showing'
This, in contrast to 'assert_stacking' only checks showing windows. This
is useful when doing workspace tests, where one want to check what
windows are currently visible.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3870>
2024-07-17 15:25:52 +00:00
Jonas Ådahl
7b8558ef9a window: Inherit stickyness from parent when becoming transient
When a transient window becomes transient, check if the parent is
sticky, and if it is, make the transient sticky as well. This handles
situations where e.g. a utility dialog (such as search and replace) is
opened on a sticky window, also making the utility dialog sharing the
same stickyness state.

This is also more in line with the semantics of making a window sticky,
where transient would implicitly become sticky as a side effect.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3870>
2024-07-17 15:25:52 +00:00
Jonas Ådahl
2466b9accb window: Don't switch workspace on sticky transient when activating
If a transient window is sticky (visible on all workspaces) and it gets
activated, we'd call move_worskpace() which would effectively unstick
it, which is rather unexpected. It'd also effectively unstick its parent
as well, due to moving a transient window also moves its descendants and
ascendants.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3870>
2024-07-17 15:25:52 +00:00
Peter Hutterer
d9ead043c7 backends: Add support for tablet tool pressure ranges
Introduced in libinput 1.26 this feature allows restricting the
tablet tool pressure range to a subset of its physical range. The
use-case is either to require some higher-than-usual minimum pressure
before the pen reacts, or lower-than-usual pressure to reach the maximum
logical pressure.

libinput takes a [0.0, 1.0] normalized range which we expose as percent
in the gsettings. The wacom driver doesn't have an exact equivalent but
it has a Threshold setting (range [1, 2048]) that defines when a button
is generated for tip down.

See gsettings-desktop-schemas!84

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3794>
2024-07-16 12:05:13 +02:00
Peter Hutterer
d65c89d8b9 core: Add a MetaToolActionMapper for tablet tools
This mapper hooks into CLUTTER_BUTTON_PRESS/RELEASE events with a
clutter button of zero but a nonzero evcode (e.g. BTN_STYLUS).
It then looks up the available button actions and implements
switch-monitor and keybindings using the MetaTabletActionMapper parent
class.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3649>
2024-07-16 09:33:29 +00:00
Peter Hutterer
7e7a9322fa backends: Expose the tool button mapping via InputSettings
Unlike most other schemas the path for a tool requires a bit of
processing (serial number or tablet vid/pid if there's no serial number).
Let's make the tool settings available through the MetaInputSettings
instead of having to duplicate that path composition in the caller.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3649>
2024-07-16 09:33:29 +00:00
Peter Hutterer
7ab5a8cf95 backends/native: Handle new stylus actions as zero button events
Stylus actions that don't map into LMR or back/forward are now created
as a clutter button event with a button number of zero. Nothing is
actually done with those events for now, they're just discarded later.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3649>
2024-07-16 09:33:29 +00:00
Peter Hutterer
829adfcfaa backends/native: Store the stylus actions as actions
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3649>
2024-07-16 09:33:29 +00:00
Peter Hutterer
5fdf1fa892 backends/native: Apply stylus button mappings before anything else
For stylus buttons we apply a button mapping, e.g. secondary button ->
right. This mapping was previously applied to the clutter event's evdev
code only, not the actual clutter button. As a result, gnome-shell would
always treat the BTN_STYLUS as middle and BTN_STYLUS2 as right,
regardless of the mapping.

Move the mapping up so we first adjust our evcode, then proceed with
the usual mappings.

Note that this temporary breaks the stylus mapping to Back/Forward which
will be fixed in a follow-up commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3649>
2024-07-16 09:33:29 +00:00
Peter Hutterer
ae59acad76 backends/native: Use helper functions to map buttons
Use the helper function for mapping a stylus tool evdev code to a
clutter button code. This fixes a (theoretical) issue - if a tool were
to send any button other than the one we handled those would likely be
BTN_SIDE and friends and we'd likely end up with negative button
numbers. The BTN_TOOL_PEN range is not predicable enough to do any sort
of calculation conversion because things like BTN_TOOL_DOUBLETAP have
specific meanings that aren't actually buttons.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3649>
2024-07-16 09:33:29 +00:00
Peter Hutterer
dfcb160321 backends: Add helpers to convert from clutter tool button to evcode
This complements the existing clutter->evdev and evdev->clutter helpers,
but this time for buttons we expect from a stylus tool. We also need to
convert left/middle/right for the Wacom puck/lens cursor tools but that
particular conversion is lossy.

Note that these are more restrictive than the normal codes - if we
get "other" buttons from a stylus we don't really know what they could
possibly map to. So we safely map what looks like buttons from a mouse
but otherwise complain and return zero.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3649>
2024-07-16 09:33:29 +00:00
Peter Hutterer
6c77af1493 core: Add a MetaTabletActionMapper as parent of the MetaPadActionMapper
This is prep work for using the same functionality for tablet tools as
well. The new MetaTabletActionMapper takes care of the event bubbling
via the device-added/removed and input-event signals and provides the
helper functions to cycle outputs and/or emulate keybindings.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3649>
2024-07-16 09:33:29 +00:00
Peter Hutterer
94e497f630 CI: Bump the tag so we pick up libinput 1.26
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3649>
2024-07-16 09:33:29 +00:00
Sebastian Keller
31e027d1b1 edid: Ensure strings owned by MetaEdidInfo are freed
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3888>
2024-07-16 03:37:02 +02:00
Sebastian Keller
a541aa9a8c edid: Fix di_info leak after we are done parsing
This was only affecting builds using libdisplay-info.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3888>
2024-07-15 23:52:31 +02:00
Bilal Elmoussaoui
9239e8446c cogl: Remove _real suffix from Node parenting API
There is no vfunc to override anymore as it used to only chain-up

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3885>
2024-07-15 21:42:44 +02:00
Bilal Elmoussaoui
f5c376e860 cogl: Move PrimitiveTexture functions to Texture
Since the move to GObject for CoglTexture, CoglPrimitiveTexture was
removed. So drop remaining of that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3885>
2024-07-15 21:42:38 +02:00
Sebastian Keller
2ae3012fd5 clutter/paint-nodes: Don't leak CoglColor on paint node creation
The pointer returned by cogl_color_copy() was not stored anywhere and
the allocation it was pointing to got leaked. However we also don't need
to use that function here and can just copy the struct values directly.

Fixes: dc52ccc75 ("cleanup: Port from ClutterColor to CoglColor")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3884>
2024-07-15 18:50:02 +02:00
Bilal Elmoussaoui
1d465461a7 cogl: Remove default context gross hack
As nothing uses it anymore

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00
Bilal Elmoussaoui
c23bc80ba4 cogl/debug: Take a context param
This will make the usage through gdb not as useful as it was
but it is the last remaining usage of a gross hack, so let us get rid of it

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00
Bilal Elmoussaoui
c1733e8d7c cogl: Keep a backpointer to context/display
Allows to retrieve the context from the renderer, allows
to get rid of one GET_CONTEXT usages

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00
Bilal Elmoussaoui
725e826a39 cogl: Require a Renderer/Display when initializing
The whole fallbacks all over the place were only useful when Cogl was a separate
library

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00
Bilal Elmoussaoui
54748b7f1f cogl: Call init when creating a context from Clutter
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00
Bilal Elmoussaoui
9ee1a0fc34 cogl: Expose Renderer.get_proc_address
Allows to get rid of the cogl_get_proc_address

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00
Bilal Elmoussaoui
b3ae934304 cogl: Pass Context to cogl_flush
Avoids using the global variable & also move the function to
it proper context

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00
Bilal Elmoussaoui
194fa80cdd cogl: Pass a Context param to winsys_has_feature
Avoids using the global variable

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00
Bilal Elmoussaoui
3fd7cdba09 cogl: Pass Context where possible
Avoids using the macro & global variable

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00