summaryrefslogtreecommitdiff
path: root/clutter
Commit message (Collapse)AuthorAgeFilesLines
* clutter/stage: Assign frames to paint contextGeorges Basile Stavracas Neto2023-04-071-2/+6
| | | | | | | | When rendering through the 'paint-view' handler, assign the frame to the paint context. Otherwise, when rendering outside of the frame clock schedule, don't. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2804>
* clutter/paint-context: Allow assigning a ClutterFrameGeorges Basile Stavracas Neto2023-04-073-0/+37
| | | | | | | | | | This is not yet used, but next commits will need to assign a frame to the paint context whenever painting onscreens. Assigning a frame to the paint context is a one-way operation, and treats multiple assignments strictly as a programming error. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2804>
* cursor-tracker: Enhance the documentation and increase annotation coverageCorentin Noël2023-04-071-0/+11
| | | | | | | Add the (optional) parameters when they are actually supported and at least add the minimal documentation on functions. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2951>
* build: Don't disable checks in release buildsSebastian Keller2023-03-241-1/+0
| | | | | | | | | | | Both Clutter and Cogl use g_return(_val)_if_fail() to safeguard introspected API. Release builds were dropping these checks, which could result in a much more crashy experience, especially when considering extensions, but also due to bugs in the shell code itself. This won't affect any major distro, because they all use "plain" builds. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2930>
* clutter: Safely transform paths to strings and vice versaEmmanuele Bassi2023-03-211-5/+12
| | | | | | | | | GValues containing objects and strings can be set to NULL, which means the transformation functions from ClutterPath to string and vice versa must be NULL-safe. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2625 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2929>
* clutter/frame-clock: Warn if frame clock is disposed while dispatchingJonas Ådahl2023-03-181-0/+2
| | | | | | | This shouldn't happen, but warn anyway to be a bit more helpful if things go bad. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2901>
* cally: Use g_string_free() return valueFlorian Müllner2023-03-041-2/+1
| | | | | | | | glib now warns if the return value is not used, so use the API as intended instead of assigning the character data separately before freeing the GString. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2889>
* clutter/frame-clock: Debug log frame drops per second if there were anyJonas Ådahl2023-03-023-0/+37
| | | | Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
* clutter/frame: Allow setting a backend release functionJonas Ådahl2023-03-023-6/+16
| | | | | | The one set by the native backend is empty, but it will be used later. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
* renderer-view/native: Allocate backend specific ClutterFrameJonas Ådahl2023-03-024-5/+11
| | | | | | This will carry an on-demand created MetaKmsUpdate. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
* clutter/stage-view: Allow stage view to allocate frameJonas Ådahl2023-03-022-0/+16
| | | | | | | This will be used to allow the native backend to allocate a KMS update that'll be used for one frame. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
* clutter/frame-clock: Allow frame clock listener iface allocate frameJonas Ådahl2023-03-022-1/+7
| | | | | | | This will allow the frame clock listener to allocate larger structs where it can keep e.g. backend specific frame state. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
* stage-view: Add short cut to clutter_frame_clock_update_now()Jonas Ådahl2023-03-012-0/+12
| | | | | | | | | Stage view users can schedule updates at ease with clutter_stage_view_schedule_update(), but couldn't schedule update "now". Make that easy too by adding clutter_stage_view_schedule_update_now(). Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2854>
* frame-clock: Don't delay schedule_now() if already scheduledJonas Ådahl2023-03-011-2/+1
| | | | | | | | If we call schedule(), which will schedule an update some time in the future, and then schedule_now(), we should reschedule the frame clock to update immediately, and not some time in the future. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2854>
* cogl: Remove legacy OpenGL driver supportJonas Ådahl2023-02-211-1/+0
| | | | | | This means the two Cogl drivers left are OpenGL >= 3.1 and GLES >= 2.0. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2672>
* clutter: Remove some unused macrosJonas Ådahl2023-02-211-46/+0
| | | | Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2672>
* clutter: Pass source device onto crossing event generation machineryCarlos Garnacho2023-02-094-3/+18
| | | | | | | | For motion-induced crossing events, this will be the device that generated the motion. For code-induced crossing events (e.g. grabs or actors disappearing) this will be none. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2828>
* tests/clutter/event-delivery: Add tests for implicit grabbingJonas Dreßler2023-02-031-0/+1
| | | | | | | Add a few tests to make sure all the hairy details of crossing behavior etc don't fall apart again. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
* clutter: Add CLUTTER_EXPORT_TEST defineJonas Dreßler2023-02-031-0/+5
| | | | | | | Just like in mutter, add a define for exporting functions so that they can be used in tests. This will be useful in the next commit. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
* clutter/text: Use implicit grab instead of grabbing all eventsJonas Dreßler2023-02-031-12/+0
| | | | | | | Clutter has implicit grabbing now, so no need for grabbing all events using clutter_stage_grab() anymore. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
* clutter/gesture-action: Let lower layers cancel gesture on stage grabJonas Dreßler2023-02-031-10/+0
| | | | | | | | | | | | Since the last commit, ClutterStage automatically cancels an implicit grab (including all its ClutterActions) when a conflicting ClutterGrab appears. This means we no longer have to look out for GRAB_NOTIFY crossings in ClutterGestureAction and can instead depend on the sequence_cancelled() vfunc for this. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
* clutter/stage: Cancel parts of implicit grabs when ClutterGrabs happenJonas Dreßler2023-02-031-10/+86
| | | | | | | | | | | | | | | | | | | | | | | | A ClutterGrab takes precedence over implicit grabs, so when one happens, let's check which part of the implicit grab tree is inside the new ClutterGrab. Cancel and remove the parts which aren't, and if nothing is in there anymore, cancel the whole implicit grab. Emitting crossing events correctly here is getting quite tricky: - When the implicit grab didn't get cancelled by the ClutterGrab, we simply want to emit all GRAB_NOTIFY crossings to the implicit grab, as we do with all other crossings. - When the implicit grab did get cancelled and the new ClutterGrab wants to emit ENTER crossings, we want those to be emitted to the actual targets, so cancel the implicit grab before emission. - In the last case where the implicit grab did get cancelled and the new ClutterGrab wants to emit LEAVE crossings, those should be emitted to the implicit grab again, so we cancel the grab only after the emission of those. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
* clutter: Add a GRABS debug flagJonas Dreßler2023-02-033-0/+47
| | | | | | | | | Now that we have two kinds of grabs, the intricacies of event delivery got slightly more complicated. So this seems like a good point to introduce a new GRABS debug flag that gives an overview of which grabs are currently in effect. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
* clutter/actions: Implement new sequence_cancelled vfuncJonas Dreßler2023-02-032-0/+47
| | | | | | | | Now that we have more robust API to get notified about points that got cancelled, make use of it to cancel ClutterGestureActions and ClutterClickActions. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
* clutter: Notify ClutterActions about sequences that were cancelledJonas Dreßler2023-02-034-2/+41
| | | | | | | | | | We're almost there, everything is in place to notify ClutterActions about a sequence getting pulled away under its feet. The only thing that's missing is the actual notification to actions now, so let's do that. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
* clutter/stage: Allow claiming sequence outside of event handling contextJonas Dreßler2023-02-032-0/+37
| | | | | | | | | | | | Another baby step just like the last commit: This commit takes care of the opposite case: An action handling a sequence event stops further emission of events to actors. Since sequences remain around for longer than the context of just a single event, it makes sense to provide a way to "claim" those sequences even when outside of event handling context, so introduce API for that. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
* clutter/stage: Make sequences exclusive to actors vs actionsJonas Dreßler2023-02-031-1/+21
| | | | | | | | | | | | | | | As soon as any event of a sequence is handles/stopped during emission, all actors and actions that would have gotten to see it afterwards have a big problem: If that event was a TOUCH_END event, the actor/action is forever going to think that this touch is still active. For ClutterActions, we're going to handle this by introducing a way to send them a notification when stuff like this happens. As a baby step towards all that, make event emission exclusive to actors as soon as any actor stopped an event. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
* clutter: Implicitly grab on button and touch event sequencesJonas Dreßler2023-02-035-56/+407
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We'll soon introduce a new gesture tracking framework which heavily depends on ClutterActions seeing all events of a sequence. For this to work, a larger change to event delivery is needed: Implicit grabbing of all events for button and touch press->motion->release sequences to ensure ClutterActions continue receiving events for the whole sequence. This commit takes care of that: At the start of an event sequence we collect all the event-handling actors and actions to a GArray that lives in the PointerDeviceEntry, and then deliver all events belonging to that sequence to the same actors/actions until the sequence ends. To avoid events getting pulled from under our feet when mutters event filter returns CLUTTER_EVENT_STOP, this also introduces private API (maybe_lost_implicit_grab()) on ClutterStage so that we can't end up with stale sequences. Note that this also slightly changes behavior when it comes to event delivery to actions: Because we now store actions separated from their actors, any action returning CLUTTER_EVENT_STOP now stops event propagation immediately. That was different before, where we'd emit events to all actions of the actor and only then stop propagation. Note that this isn't handling ClutterGrabs correctly right now, this will be a little tricky, so we'll take care of that in a future commit. To handle actors getting destroyed or unmapped during a grab, listen to notify::grab on the deepmost actor in the implicit grab tree. This gives us a notification when any actor inside the tree goes unmapped. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
* clutter: Move emitting events to ClutterActions to the stageJonas Dreßler2023-02-032-40/+32
| | | | | | | | | | A fairly small refactor, move the emission of events to actions from clutter_actor_event() to stage level. We do this because in the future we'll need to know on stage level whether events were handled by an actor or by an action. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
* clutter/actor: Introduce private function to peek actionsJonas Dreßler2023-02-032-0/+13
| | | | | | | | We'll need to take a look at the actions of actors twice for every single event emission once we move emission to the stage, let's not copy around lists for that. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
* clutter: Reuse GPtrArray for event emissionJonas Dreßler2023-02-033-71/+120
| | | | | | | | | | | | _clutter_actor_handle_event() currently allocates a new GPtrArray on the heap for every single event emission, let's avoid this by keeping an array around in ClutterStage and reusing that. This is moving the last few bits of event emission into ClutterStage, which will be useful when we introduce implicit grabbing in subsequent commits. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
* clutter: Propagate PROXIMITY events up and down the treeJonas Dreßler2023-02-031-7/+2
| | | | | | | | There's no real reason to keep those events exclusive to the stage, some actors or actions might want to get notified about proximity events too, so propagate them like any other event. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
* clutter: Make the stage the central instance emitting eventsJonas Dreßler2023-02-033-79/+119
| | | | | | | | | | | | | | | | | | | Right now and due to loads of refactorings lately, the event emission paths are a bit cluttered (ha ha ha) around in Clutter. For example the event target actor gets set in clutter-main.c, but event emission is actually managed by ClutterStage these days. Since we'll introduce implicit grabbing of touch/button-press sequences soon, let's shuffle things around a bit to make that easier: Move event emission to the stage, it now gets a ClutterEvent without any extra context like the target actor from clutter-main. The stage then looks up the target actor itself and emits the event to the appropriate actors in the scenegraph. A special path is introduced for emitting crossing events, because here the event-receiving actors don't follow the "capture+bubble from pointer actor to grab actor" rule. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
* clutter/actions: Never stop crossing eventsJonas Dreßler2023-02-032-11/+13
| | | | | | | | | | | | Crossing events should never be stopped during event emission. We already have a check that enforces this in clutter_actor_event(), but ClutterActions still sometimes try to stop crossing events from propagating. Improve that situation and return CLUTTER_EVENT_PROPAGATE when handling crossings in ClutterActions, too. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
* clutter: Fix ClutterMainContext leaking eventsNiels De Graef2023-02-011-1/+2
| | | | | | | | | | There's still a possibility that some events remain within the `ClutterMainContext` when it's being unref-ed for the last time (as seen on asan logs). Make sure they get freed by using `g_async_queue_new_full()` and specifying the appropriate destroy function. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2817>
* clutter/frame-clock: Clamp next_update_time to the current timeRobert Mader2023-02-011-0/+2
| | | | | | | | | | Calculating a timestamp from the past distorts the dispatch lateness calculation, leading to an inflated max_render_time, which again increases the likelyhood of next_update_time being in the past. Fixes 99850f46459 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2819>
* clutter/text: Don't call clutter_text_set_buffer() on finalizeSebastian Keller2023-01-251-1/+0
| | | | | | | | | | clutter_text_set_buffer() tries to freeze/thaw notify, which is not allowed during finalize and recent glib versions started warning about this. This call can simply be removed, because the buffer is already set to NULL on dispose, making the call in finalize redundant. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2566 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2790>
* clutter: Pass 'ClutterFrame' in all stage update signalsJonas Ådahl2023-01-234-39/+67
| | | | | | | | | That means before-update, prepare-paint, before-paint, paint-view, after-paint, after-update. While yet to be used, it will be used as a transient frame book keeping object, to maintain object and state that is only valid during a frame dispatch. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2795>
* clutter/frame: Turn into boxed typeJonas Ådahl2023-01-234-2/+47
| | | | | | | This will allow us to pass a ClutterFrame in interfaces, including ones that end up being introspected. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2795>
* clutter/frame: Carry target presentation timeJonas Ådahl2023-01-234-0/+24
| | | | | | | This will be used, when available, to both check whether frames missed a vsync cycle, or to calculate when page flips should be queued. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2795>
* clutter/frame-clock: Pass ClutterFrame via the frame clock interfaceJonas Ådahl2023-01-236-21/+28
| | | | | | | Let the ClutterFrame live for the whole frame, and be carried as an argument to the frame clock listener interface functions. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2795>
* frame-clock: Store interface pointer in variableJonas Ådahl2023-01-231-7/+8
| | | | | | It's accessed a few times, so keep it around. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2795>
* clutter/stage-view: Properly chain up finalizeNiels De Graef2023-01-221-1/+1
| | | | | | | | Fix a silly copy-paste mistake. Since `GObject` is the parent class, chaining up to `dispose()` from within your `finalize()` implementation just leads to a little memory leak and nothing worse. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2799>
* clutter: Avoid string translation to find text directionCarlos Garnacho2023-01-132-14/+24
| | | | | | | | | Use Pango and Harfbuzz for the task, getting the default language, then its scripts, then their directions. We pick the first valid horizontal direction, resorting to LTR as a fallback. Related: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/5385 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2780>
* clutter/frame-clock: Remove extraneous whitespaceDaniel van Vugt2023-01-061-1/+0
| | | | | | | It's causing code review warnings whenever another MR tries to change the same source file. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2784>
* clutter: Add keyval helpersBilal Elmoussaoui2022-12-224-0/+262
| | | | | | Infrastructure for adding meta_accelerator_name Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
* clutter: Generate keynames tableBilal Elmoussaoui2022-12-223-0/+9197
| | | | | | | Infrastructure to provide a meta_accelerator_name and avoid libmutter clients from depending on GTK for that. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
* core: Replace gtk_get_default_locale usageBilal Elmoussaoui2022-12-224-3/+16
| | | | | | | | | Clutter has an API to get the text direction but used to depend on gtk3's translation domain. In order to avoid broken i18n in case gtk3 is not installed, move the transtalable string to clutter itself. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
* clutter: Reduce default clutter_max_render_time_constant_us to 1000Michel Dänzer2022-12-171-1/+1
| | | | | | | | | | | | | Now that dynamic max render time uses a new algorithm and takes dispatch lateness into account, this seems worth a shot. We'll see how it works out in the wild. The net result compared to before these changes is still slightly higher (by ~0.5 ms) minimum latency for me, as measured by weston-presentation-shm. It should be less vulnerable to frame drops though. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2500>
* frame-clock: Simplify dynamic max render time calculationMichel Dänzer2022-12-171-76/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | Store only two values per kind of duration: The short term and long term maximum. The short term maximum is updated in each frame clock dispatch. The long term maximum is updated at most once per second: If the short term maximum is higher, the long term maximum is updated to match it. Otherwise, a fraction of the delta between the two maxima is subtracted from the long term maximum. Compared to the previous algorithm: * The calculcations are simpler. * The calculated max render time has a slow exponential drop-off (by at most a few milliseconds every second) instead of potentially abruptly dropping after as few as 16 frames. This should fix https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4830 since the short term maximum should always include a sample from the clock's second tick. v2: * Use divisor 2 instead of 4. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2500>