summaryrefslogtreecommitdiff
path: root/clutter/clutter
Commit message (Collapse)AuthorAgeFilesLines
* clutter/brightness-contrast-effect: Compare float with G_APPROX_VALUEGeorges Basile Stavracas Neto2020-02-021-12/+12
| | | | | | | | | Nobody should ever compare float for equality. Use G_APPROX_VALUE to check that. https://gitlab.gnome.org/GNOME/mutter/merge_requests/992 (cherry picked from commit 84ea4ad9902bae6542fb657ce9e12c1038b697fc)
* clutter/offscreen-effect: Clear offscreen when pre-paint failsGeorges Basile Stavracas Neto2020-02-021-4/+11
| | | | | | | | | | | | | | | | | | Some ClutterOffscreenEffect subclasses, such as ClutterBrightnessContrastEffect, early-return FALSE in pre-paint before chaining up. It's an important optimization that avoids creating or updating the offscreen framebuffer. However, if an offscreen framebuffer already exists by the time pre-paint fails, it will be used *without* repaint the actor over it. That causes an old picture of the actor to be displayed. Fix that by always clearing the offscreen framebuffer when pre-paint fails. Fixes https://gitlab.gnome.org/GNOME/mutter/issues/810 https://gitlab.gnome.org/GNOME/mutter/merge_requests/992 (cherry picked from commit 64685f4b20162b78964a5ab6fd57a93fb3860671)
* clutter/offscreen-effect: Clear offscreen framebuffer when disablingGeorges Basile Stavracas Neto2020-02-021-0/+14
| | | | | | | | | | | | | | | | | | When changing the 'enabled' property and disabling the offscreen effect, it doesn't make sense to preserve the offscreen framebuffer. It's not drawing, after all. Furthermore, because ClutterOffscreenEffect only checks if the offscreen framebuffer exists to decide whether or not to redraw, keeping the fbo alive is a waste of resources. Clear the offscreen framebuffer when the effect is disabled or enabled. Fixes https://gitlab.gnome.org/GNOME/mutter/issues/810 https://gitlab.gnome.org/GNOME/mutter/merge_requests/992 (cherry picked from commit bf594e9fb6d973259163f73881dd91c8910dd54f)
* clutter/offscreen-effect: Use g_clear_pointer for cleanupGeorges Basile Stavracas Neto2020-02-021-24/+6
| | | | | | | | It does the exact same checks, and saves us a few lines of code. https://gitlab.gnome.org/GNOME/mutter/merge_requests/992 (cherry picked from commit 3958e75ed2a9afb5d32c59b017691e3ed2289ee2)
* clutter/stage: Fix picking of rectangles with negative positionsSebastian Keller2019-12-241-2/+2
| | | | | | | | | | | | | | | | FLT_MIN is the smallest *positive* number above 0 that can be represented as floating point number. If this is used to initialize the maximum x/y coordinates of a rectangle, this will always be used if all x/y coordinates of the rectangle are negative. This means that picking at 0,0 will always be a hit for such rectangles. Since mutter creates such a window for server side decorations on X11, this window will always be picked at 0,0 preventing clicking/hovering the activities button in gnome-shell at that coordinate. Fixes https://gitlab.gnome.org/GNOME/mutter/issues/893 (cherry picked from commit 674f52ba747b59a7e72a4a18fea763ee9e617b7c)
* clutter/cally-root: Use g_clear_signal_handler and fix a signal leakRobert Mader2019-11-211-6/+4
| | | | | | | | This commit was split out from `cleanup: Use g_clear_signal_handler() where possible` as it fixes an actual signal leak and should therefore get backported to stable releases. https://gitlab.gnome.org/GNOME/mutter/merge_requests/940
* clutter/stage-view: Separate offscreen and shadowfbOlivier Fourdan2019-11-042-40/+128
| | | | | | | | | | | | | | | Previously, we would use a single offscreen framebuffer for both transformations and when a shadow framebuffer should be used, but that can be dreadfully slow when using software rendering with a discrete GPU due to bandwidth limitations. Keep the offscreen framebuffer for transformations only and add another intermediate shadow framebuffer used as a copy of the onscreen framebuffer. https://gitlab.gnome.org/GNOME/mutter/merge_requests/917 (cherry picked from commit 2b8b450fe16c21f0f37a1779560c0e5da61a9b89)
* clutter/stage: Actually set key focus to an actor on key focusMarco Trevisan (Treviño)2019-10-151-1/+1
| | | | | | | | | | | As per commit c2d03bf73 we're using a private method to set the actors key focus and emit key-focus-in signal, but we're using inverted logic here. So flip the parameter to match the expected result. https://gitlab.gnome.org/GNOME/mutter/merge_requests/860 (cherry picked from commit 553211dd81a849f33f0aca447c8683f031fff868)
* clutter/actor: Save key-focus state and unset it before destructionMarco Trevisan (Treviño)2019-10-153-43/+48
| | | | | | | | | | | | | | | | | | | | | | | When clutter actors with key focus are destroyed we emit ::key-focus-out on them just after their destruction. This is against our assumption that no signal should be emitted after "::destroy" (see GNOME/mutter!769 [1]), and in fact could cause the shell to do actions that we won't ever stop on destroy callback. To avoid this to happen, use a private function to set its key-state (so we can avoid looking for the stage) and emit ::key-focus-in/out events and use this value in both clutter_actor_has_key_focus(), clutter_actor_grab_key_focus() and on unmap and destruction to unset the stage key focus before we emit the ::destroy signal. As result of this, we can now avoid to unset the key focus on actor destruction in the stage. [1] https://gitlab.gnome.org/GNOME/mutter/merge_requests/769 Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1704 (cherry picked from commit c2d03bf73e5a945296d22c4d95709eeebf2eb57c)
* clutter/shader-effect: Initialize shader-type properlyGeorges Basile Stavracas Neto2019-10-111-0/+1
| | | | | | | | | | | | The default value of the ClutterShaderEffect:shader-type property is CLUTTER_FRAGMENT_SHADER. However, because the struct field is not actually initialized to it, it ends up assuming the value 0, which is CLUTTER_VERTEX_SHADER. Properly initialize ClutterShaderEffect's shader_type to CLUTTER_FRAGMENT_SHADER. https://gitlab.gnome.org/GNOME/mutter/merge_requests/846
* clutter/transition: Don't split reference counting with actorJonas Ådahl2019-10-072-8/+0
| | | | | | | | | | | | | | ClutterActor took a reference in its transition 'stopped' handler, aiming to keep the transition alive during signal emission even if it was removed during. This is, however, already taken care of by ClutterTimeline, by always taking a reference during its 'stopped' signal emission, so no need to add another one. This also has the bonus of making reference ownership simpler, as well as avoidance of double free if an actor was destroyed before a transition has finished. https://gitlab.gnome.org/GNOME/mutter/merge_requests/828
* clutter/actor: Mark implicit transitions as remove-on-completeJonas Ådahl2019-10-071-16/+11
| | | | | | | | | | | | | | | Implicit transitions had a referenced taken while emitting the completion signals, but said reference would only be released if it was had remove-on-complete set to TRUE. Change this to instead remove the 'is_implicit' state and mark all implicit transitions as remove-on-complete. This fixes a ClutterPropertyTransition leak in gnome-shell triggered by e.g. showing / hiding menus. Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1740 https://gitlab.gnome.org/GNOME/mutter/merge_requests/828
* clutter/base-types: Clarify docs for point_inside_quadrilateralDaniel van Vugt2019-10-031-4/+4
| | | | | | | | | | | The final version of the function was changed to allow points that are touching the edge of a quadrilateral to be counted as "inside". Update the function documentation to refect this. Also clarify that the function is written in such a way that it is agnostic to clockwise or anticlockwise vertex ordering. https://gitlab.gnome.org/GNOME/mutter/merge_requests/783
* clutter/stage-view: Ignore clipping rectangle for offscreen blitOlivier Fourdan2019-10-031-3/+6
| | | | | | | | | | | | | In `clutter_stage_view_blit_offscreen()`, the given clipping rectangle is in “view” coordinates whereas we intend to copy the whole actual framebuffer, meaning that we cannot use the clipping rectangle. Use the actual framebuffer size, starting at (0, 0) instead. That fixes the issue with partial repainting with shadow framebuffer when fractional scaling is enabled. https://gitlab.gnome.org/GNOME/mutter/merge_requests/820
* clutter/actor: Don't emit property changes after ::destroyMarco Trevisan (Treviño)2019-10-021-0/+3
| | | | | | | | | | | | | | Clutter actors might emit property changes in dispose, while unparenting. However we assume that the ::destroy signal is the last one we emit for an actor, and that starting from this moment the object is not valid anymore, and so we don't expect any signal emission from it. To avoid this, freeze the object notifications on an actor during its disposition, just before the ::destroy signal emission. Update the actor-destroy test to verify this behavior. https://gitlab.gnome.org/GNOME/mutter/merge_requests/769
* clutter/actor: Don't emit the parent-set signal on destructionMarco Trevisan (Treviño)2019-10-021-1/+2
| | | | | | | | | | | | | | | | Clutter actors unset their parent on dispose, after emitting the ::destroy signal, however this could cause ::parent-set signal emission. Since we assume that after the destruction has been completed the actor isn't valid anymore, and that during the destroy phase we do all the signal / source disconnections, this might create unwanted behaviors, as in the signal callbacks we always assume that the actor isn't in disposed yet. To avoid this, don't emit ::parent-set signal if the actor is being destroyed. Update the actor-destroy test to verify this behavior. https://gitlab.gnome.org/GNOME/mutter/merge_requests/769
* clutter/stage-view: Use cogl_blit_framebuffer() for shadow FBOlivier Fourdan2019-09-271-0/+12
| | | | | | | | If there is no transformation, use `cogl_blit_framebuffer()` as a shortcut in `clutter_stage_view_blit_offscreen()`, that dramatically improves performance when using a shadow framebuffer. https://gitlab.gnome.org/GNOME/mutter/merge_requests/809
* clutter/actor: Cancel delayed timelines on removalMarco Trevisan (Treviño)2019-09-203-1/+5
| | | | | | | | | | | | | | | | | Delayed clutter timelines might be removed while they are still in the process of being executed, but if they are not playing yet their delay timeout won't be stopped, causing them to be executed anyway, leading to a potential crash. In fact if something else keeps a reference on the timelines (i.e. gjs), the dispose vfunc delay cancellation won't take effect, causing the timelines to be started and added to the master clock. To avoid this, expose clutter_timeline_cancel_delay() function and call it if a timeline is not playing but has a delay set. Fixes https://gitlab.gnome.org/GNOME/mutter/issues/815 https://gitlab.gnome.org/GNOME/mutter/merge_requests/805
* clutter/timeline: Don't emit ::paused signal on delayed timelinesMarco Trevisan (Treviño)2019-09-201-3/+3
| | | | | | | | | | | | | If a timeline is delayed and we request to stop or pause it, we are emitting the "::paused" signal on it, however this has never been started, and so nothing has really be paused. So, just try to cancel the delay on pause and return if not playing. No code in mutter or gnome-shell is affected by this, so it is safe to change. https://gitlab.gnome.org/GNOME/mutter/merge_requests/805
* clutter/timeline: Use a function to cancel the delay timeoutMarco Trevisan (Treviño)2019-09-201-10/+7
| | | | | | | Avoid repeating the same code for canceling the delay timeout, using a function for later uses. https://gitlab.gnome.org/GNOME/mutter/merge_requests/805
* stage: Compute view perspective when parameters changedMarco Trevisan (Treviño)2019-09-201-57/+47
| | | | | | | | | | | | | | | | | | Clutter stage used to compute the initial projection using a fixed z translation which wasn't matching the one we computed in calculate_z_translation(). This caused to have a wrong initial projection on startup which was then correctly recomputed only at the first paint. However, since this calculation doesn't depend on view, but only on viewport size, perspective's fovy and z_near we can safely do this at startup and only when any of those parameters change. Then we can move the computation out _clutter_stage_maybe_setup_viewport() since the cogl framebuffer viewport sizes aren't affecting this. Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1639 https://gitlab.gnome.org/GNOME/mutter/merge_requests/803
* clutter/stage-cogl: Use portable formatting for 64-bit integersDaniel van Vugt2019-09-201-1/+1
| | | | | | On 64-bit systems int64_t is %ld but on 32-bit systems it is %lld. https://gitlab.gnome.org/GNOME/mutter/merge_requests/778
* clutter/paint-node: Convert safely from pointer to integerDaniel van Vugt2019-09-201-2/+2
| | | | | | To support 32-bit systems without compiler warnings. https://gitlab.gnome.org/GNOME/mutter/merge_requests/778
* clutter/actor: Remove unused private functionJonas Dreßler2019-09-122-17/+0
| | | | | | | | `_clutter_actor_get_transition` is almost identical to `clutter_actor_get_transition` and isn't used anywhere in the code (we stopped using it with ee00e37b), remove it! https://gitlab.gnome.org/GNOME/mutter/merge_requests/791
* clutter/actor: Fix a wrong commentJonas Dreßler2019-09-121-1/+1
| | | | | | | | According to the definition of ClutterAnimationInfo in clutter-actor-private.h, `transitions` is the third variable of the struct, not the first one. https://gitlab.gnome.org/GNOME/mutter/merge_requests/791
* clutter/input-pointer-a11y: Restore pointer a11y on resumeOlivier Fourdan2019-09-022-0/+16
| | | | | | | | | | When suspending, the devices are removed and the virtual device associated with the corresponding core pointer is disposed. Add the pointer accessibility virtual device to the core pointer on resume to restore pointer accessibility on resume if enabled. https://gitlab.gnome.org/GNOME/mutter/merge_requests/761
* clutter: Introduce geometric pickingDaniel van Vugt2019-09-0212-576/+427
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, Clutter does picking by drawing with Cogl and reading the pixel that's beneath the given point. Since Cogl has a journal that records drawing operations, and has optimizations to read a single pixel from a list of rectangle, it would be expected that we would hit this fast path and not flush the journal while picking. However, that's not the case: dithering, clipping with scissors, etc, can all flush the journal, issuing commands to the GPU and making picking slow. On NVidia-based systems, this glReadPixels() call is extremely costly. Introduce geometric picking, and avoid using the Cogl journal entirely. Do this by introducing a stack of actors in ClutterStage. This stack is cached, but for now, don't use the cache as much as possible. The picking routines are still tied to painting. When projecting the actor vertexes, do it manually and take the modelview matrix of the framebuffer into account as well. CPU usage on an Intel i7-7700, tested with two different GPUs/drivers: | | Intel | Nvidia | | ------: | --------: | -----: | | Moving the mouse: | | Before | 10% | 10% | | After | 6% | 6% | | Moving a window: | | Before | 23% | 81% | | After | 19% | 40% | Closes: https://gitlab.gnome.org/GNOME/mutter/issues/154, https://gitlab.gnome.org/GNOME/mutter/issues/691 Helps significantly with: https://gitlab.gnome.org/GNOME/mutter/issues/283, https://gitlab.gnome.org/GNOME/mutter/issues/590, https://gitlab.gnome.org/GNOME/mutter/issues/700 v2: Fix code style issues Simplify quadrilateral checks Remove the 0.5f hack Differentiate axis-aligned rectangles https://gitlab.gnome.org/GNOME/mutter/merge_requests/189
* clutter/point: Add ClutterPoint quarilateral testing APIDaniel van Vugt2019-09-022-0/+65
| | | | | | | | | | | | | | | | Add a function to check whether a point is inside a quadrilateral by checking the cross product of vectors with the quadrilateral points, and the point being checked. If the passed quadrilateral is zero-sized, no point is ever reported to be inside it. This will be used by the next commit when comparing the transformed actor vertices. [feaneron: add a commit message and remove unecessary code] https://gitlab.gnome.org/GNOME/mutter/merge_requests/189
* Revert "clutter/stage-cogl: Remove pending_swaps counter"Jonas Ådahl2019-08-272-8/+48
| | | | | | | | | This reverts commit f57ce7254d4abd462044318bb088fccd8557ccc8. It causes crashes, https://gitlab.gnome.org/GNOME/mutter/issues/735, and changes various expectations relied upon by the renderer code, and being close to release, it's safer to revert now and reconsider how to remove the pending swap counter at a later point.
* clutter/input-pointer-a11y: Include success boolean in stop signalsJonas Dreßler2019-08-273-8/+16
| | | | | | | | | Add a boolean parameter to the signal to inform the handler whether the timeout completed successfully or not. This allows the shell to gracefully end the pie timer animation and show a success animation when the click happens. https://gitlab.gnome.org/GNOME/mutter/merge_requests/745
* clutter/main: Ignore synthetic events for accessibilityOlivier Fourdan2019-08-241-1/+2
| | | | | | | | | | When a dwell click causes the pointer to move to another surface, a synthetic event is generated which triggers another dwell click. Make sure we ignore those to avoid dwell clicking twice in a raw. Suggested-by: Carlos Garnacho <carlosg@gnome.org> https://gitlab.gnome.org/GNOME/mutter/merge_requests/747
* clutter/input-pointer-a11y: Trigger dwell detection in a timeoutOlivier Fourdan2019-08-242-1/+37
| | | | | | | | | | | Restarting the dwell click immediately would result in a contant animation showing. Start dwell detection in its own timeout handler, which has the nice effect of not constantly showing a dwell animation and also making sure that the dwell click timeout is started when pointer movement stops. https://gitlab.gnome.org/GNOME/mutter/merge_requests/747
* clutter/input-pointer-a11y: Fix dwell timeout start after moving pointerJonas Dreßler2019-08-241-1/+2
| | | | | | | | | | | | | | Sometimes the dwell timeout doesn't start again after quickly moving the pointer. That happens if `should_stop_dwell` returns TRUE for the last motion event we receive: It will stop the current timeout, but not start a new one until we receive another event where the moved distance is smaller than the threshold. To fix this, always call `should_start_dwell` and `start_dwell_timeout` instead of using an else-block, this makes sure we start a new dwell timeout still during the same motion event that stopped the old one. https://gitlab.gnome.org/GNOME/mutter/merge_requests/746
* clutter/input-pointer-a11y: Remove unneeded characterJonas Dreßler2019-08-241-1/+1
| | | | https://gitlab.gnome.org/GNOME/mutter/merge_requests/746
* tests: Move clutter-test-utils.[ch] to src/testsCarlos Garnacho2019-08-245-634/+1
| | | | | | | | And add the necessary glue so those initialize a X11 clutter backend. This should get Clutter tests that are dependent on windowing to work again, thus they were enabled back again. https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
* clutter: Move evdev input to src/backends/nativeCarlos Garnacho2019-08-2421-7398/+4
| | | | | | | | | | | | | The end goal is to have all clutter backend code in src/backends. Input is the larger chunk of it, which is now part of our specific MutterClutterBackendNative, this extends to device manager, input devices, tools and keymap. This was supposed to be nice and incremental, but there's no sane way to cut this through. As a result of the refactor, a number of private Clutter functions are now exported for external backends to be possible. https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
* clutter: Drop functions to get XVisualInfoCarlos Garnacho2019-08-243-38/+0
| | | | | | We don't need nor use visuals anymore. https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
* clutter: Drop unused function to translate to screen coordinatesCarlos Garnacho2019-08-242-55/+0
| | | | | | | We don't have anything like GdkInputMode that we'd like to honor, this can just be dropped. https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
* clutter: Move X11 input to src/backends/x11Carlos Garnacho2019-08-2429-6176/+54
| | | | | | | | | | | | | The end goal is to have all clutter backend code in src/backends. Input is the larger chunk of it, which is now part of our specific MutterClutterBackendX11, this extends to device manager, input devices, tools and keymap. This was supposed to be nice and incremental, but there's no sane way to cut this through. As a result of the refactor, a number of private Clutter functions are now exported for external backends to be possible. https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
* clutter: Remove support for foreign stagesCarlos Garnacho2019-08-243-204/+7
| | | | | | We have no use for this. https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
* clutter: Remove event retrieval toggleCarlos Garnacho2019-08-244-231/+0
| | | | | | | This is x11-specific API that was added back when clutter was out of tree. Just remove it and directly do what we want. https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
* clutter: Drop _() defineCarlos Garnacho2019-08-245-13/+12
| | | | | | It's an unused no-op, we can do without it. https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
* clutter/cally: Remove needless per-backend code in callyCarlos Garnacho2019-08-241-50/+3
| | | | | | | | We can poke the X11 stage to translate to root coordinates, or just assume the compositor will cover the root window area and avoid per-backend behavior here. https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
* clutter: Remove ClutterEventExtender interfaceCarlos Garnacho2019-08-247-91/+31
| | | | | | | Just move those methods to ClutterDeviceManager, since the two available ones want to implement it. https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
* clutter: Drop ClutterEventTranslator interfaceCarlos Garnacho2019-08-2412-279/+97
| | | | | | | We don't need that much complexity when we have a fixed set of translators, and only one of them wants a given event. https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
* clutter: Use G_DECLARE_DERIVABLE_TYPE for ClutterDeviceManagerCarlos Garnacho2019-08-243-41/+33
| | | | https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
* clutter: Move scattered x11 keymap code into ClutterKeymapX11Carlos Garnacho2019-08-243-33/+24
| | | | https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
* Drop xinput2 version checksCarlos Garnacho2019-08-243-11/+3
| | | | | | | We always request XInput >= 2.3 and fail otherwise, we don't need to check for lower versions for touch events. https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
* clutter: Remove "has_xinput" x11 APICarlos Garnacho2019-08-243-36/+0
| | | | | | We always must have xinput, this is moot now. https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
* clutter/paint-node: Expose clutter_paint_node_get_framebuffer()Georges Basile Stavracas Neto2019-08-233-2/+12
| | | | | | | | | | | Mutter needs to know which framebuffer the paint nodes will be drawn into, and using cogl_get_draw_framebuffer() directly is not an option since ClutterRootNode only pushes the draw fb at draw time. Expose clutter_paint_node_get_framebuffer(). https://gitlab.gnome.org/GNOME/mutter/merge_requests/409