summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* clutter: Introduce geometric pickingDaniel van Vugt2019-09-024-206/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+85
| | | | | | | | | | | | | | | | 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
* x11: Add window test before accessing reparents_pending fieldRémi Bernon2019-09-021-1/+1
| | | | https://gitlab.gnome.org/GNOME/mutter/merge_requests/768
* core: Fix multiple reparent requests handlingRémi Bernon2019-09-024-1/+11
| | | | | | | | | | | | | | | | If window decoration is modified within a short period of time, mutter sometimes starts processing the second request before the first UnmapNotify event has been received. In this situation, it considers that the window is not mapped and does not expect another UnmapNotify / MapNotify event sequence to happen. This adds a separate counter to keep track of the pending reparents. The input focus is then restored when MapNotify event is received iff all the expected pending ReparentNotify events have been received. Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> https://gitlab.gnome.org/GNOME/mutter/merge_requests/657
* cogl: Remove GLX "threaded swap wait" used on NvidiaDaniel van Vugt2019-09-022-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Threaded swap wait was added for using together with the Nvidia GLX driver due to the lack of anything equivalent to the INTEL_swap_event GLX extension. The purpose was to avoid inhibiting the invocation of idle callbacks when constantly rendering, as the combination of throttling on swap-interval 1 and glxSwapBuffers() and the frame clock source having higher priority than the default idle callback sources meant they would never be invoked. This was solved in gbz#779039 by introducing a thread that took care of the vsync waiting, pushing frame completion events to the main thread meaning the main thread could go idle while waiting to draw the next frame instead of blocking on glxSwapBuffers(). As of https://gitlab.gnome.org/GNOME/mutter/merge_requests/363, the main thread will instead use prediction to estimate when the next frame should be drawn. A side effect of this is that even without INTEL_swap_event, we would not block as much, or at all, on glxSwapBuffers(), as at the time it is called, we have likely already hit the vblank, or will hit it soon. After having introduced the swap waiting thread, it was observed that the Nvidia driver used a considerable amount of CPU waiting for the vblank, effectively wasting CPU time. The need to call glFinish() was also problematic as it would wait for the frame to finish, before continuing. Due to this, remove the threaded swap wait, and rely only on the frame clock not scheduling frames too early. Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=781835 Related: https://gitlab.gnome.org/GNOME/mutter/issues/700 [jadahl: Rewrote commit message] https://gitlab.gnome.org/GNOME/mutter/merge_requests/602
* later: Add tracingJonas Ådahl2019-08-311-1/+33
| | | | https://gitlab.gnome.org/GNOME/mutter/merge_requests/757
* compositor: Trace pre/post paint functionsJonas Ådahl2019-08-311-0/+5
| | | | https://gitlab.gnome.org/GNOME/mutter/merge_requests/757
* backends/native: Add various cogl tracesJonas Ådahl2019-08-313-0/+35
| | | | | | | Trace the time spent finishing a frame, posting KMS updates and some other things. https://gitlab.gnome.org/GNOME/mutter/merge_requests/757
* main: Add test initialization functionFlorian Müllner2019-08-273-9/+25
| | | | | | | | | | | | Since Clutter's backend relies on MetaBackend now, initialzation has to go through meta_init(), both in mutter and in gnome-shell. However the compositor enum and backend gtype used to enforce the environment used for tests are private, so instead expose a test initialization function that can be used from both mutter and gnome-shell. https://gitlab.gnome.org/GNOME/mutter/merge_requests/750
* iconcache: Avoid xrender picture formats when creating cairo surfaceRay Strode2019-08-271-25/+7
| | | | | | | | | | | | | | | | | | If an application provides its window icon via wmhints, then mutter loads the pixmap specified by the application into a cairo xlib surface. When creating the surface it specifies the visual, indirectly, via an XRender picture format. This is suboptimal, since XRender picture formats don't have a way to specify 16bpp depth, which an application may be using. In particular, applications are likely to use 16bpp depth pixmaps for their icons, if the video card offers a 16bpp framebuffer/root window. This commit drops the XRender middleman, and just tells cairo a visual to use directly. https://gitlab.gnome.org/GNOME/mutter/merge_requests/715
* Revert "iconcache: Support 16bit icons"Ray Strode2019-08-271-1/+0
| | | | | | | | | This reverts commit b95d7e8276e31a3414ec4d5ee13191c3f253fa1c. It's poisoning cairo's GC cache with a GC that has the wrong colordepth, leading to a crash in unrelated code later on. https://gitlab.gnome.org/GNOME/mutter/merge_requests/715
* window-actor: Use new get_image() API to screen casting window contentJonas Ådahl2019-08-271-3/+1
| | | | | | | This fixes screen casting of windows consisting of multiple surfaces to work. https://gitlab.gnome.org/GNOME/mutter/merge_requests/752
* window-actor: Add API to get a cairo surface of the windowJonas Ådahl2019-08-272-0/+117
| | | | | | | | | | This currently uses a hack where it pushes a CoglFramebuffer backed by a texture to the framebuffer stack, then calls clutter_actor_paint() on the window actor causing it to render into the framebuffer. This has the effect that all subsurfaces of a window will be drawn as part of the window. https://gitlab.gnome.org/GNOME/mutter/merge_requests/752
* screen-cast/window: Use window actor damaged signal instead of paintJonas Ådahl2019-08-271-34/+11
| | | | | | | | | | We are really more interested in when a window is damaged, rather than when it's painted, for screen casting windows. This also has the benefit of not listening on the "paint" signal of the actor, meaning it'll open doors for hacks currently necessary for taking a screenshot of a window consisting of multiple surfaces. https://gitlab.gnome.org/GNOME/mutter/merge_requests/752
* window-actor: Add 'damaged' signalJonas Ådahl2019-08-273-3/+49
| | | | | | | | Make it possible to listen for damage on a window actor. For X11, the signal is emitted when damage is reported; for Wayland, it is emitted when any of the surfaces associated with the window is damaged. https://gitlab.gnome.org/GNOME/mutter/merge_requests/752
* Revert "main: Add test initialization function"Florian Müllner2019-08-273-24/+9
| | | | This reverts commit 7e69d1400a540003873518b1636b22e97621a4ce.
* main: Add test initialization functionFlorian Müllner2019-08-273-9/+24
| | | | | | | | | | | | Since Clutter's backend relies on MetaBackend now, initialzation has to go through meta_init(), both in mutter and in gnome-shell. However the compositor enum and backend gtype used to enforce the environment used for tests are private, so instead expose a test initialization function that can be used from both mutter and gnome-shell. https://gitlab.gnome.org/GNOME/mutter/merge_requests/750
* surface-actor-wayland: Handle stex being disposedRobert Mader2019-08-271-3/+5
| | | | | | As the MetaShapedTexture might already got finalized, this can lead to a crash. https://gitlab.gnome.org/GNOME/mutter/merge_requests/755
* wayland: Implement subsurface.place_below() for parentsRobert Mader2019-08-2711-67/+261
| | | | | | | | | | | | | | | | Flatten the subsurface actor tree, making all surface actors children of the window actor. Save the subsurface state in a GNode tree in MetaWaylandSurface, where each surface holds two nodes, one branch, which can be the tree root or be attached to a parent surfaces branch, and a leaf, which is used to save the position relative to child branch nodes. Each time a surface is added or reordered in the tree, unparent all surface actors from the window actor, traverse all leaves of the tree and readd the corresponding surface actors back to the window actor. https://gitlab.gnome.org/GNOME/mutter/merge_requests/664
* core: Check X11 display availability before use in MetaStackTrackerCarlos Garnacho2019-08-261-4/+6
| | | | | | | | This object can be generally triggered without a X11 display, so make sure this is alright. For guard window checks, use our internal meta_stack_tracker_is_guard_window() call, which is already no-x11 aware. https://gitlab.gnome.org/GNOME/mutter/merge_requests/730
* core: Move Stack to StackTracker synchronization back to stack.cCarlos Garnacho2019-08-262-60/+86
| | | | | | | | | | We indirectly were relying on the MetaX11Stack for this. We strictly need the _NET_CLIENT_LIST* property updates there, so move our own internal synchronization to common code. Fixes stacking changes of windows while there's no MetaX11Display. https://gitlab.gnome.org/GNOME/mutter/merge_requests/730
* surface-actor: Unref shaped texture on disposeGeorges Basile Stavracas Neto2019-08-261-0/+1
| | | | | | | | | | | | | The MetaShapedTexture created by MetaSurfaceActor used to be a ClutterActor, which means destruction was taken care by Clutter. Now that it's a plain GObject, we need to manually clean it up. Cleanup the shaped texture on disposal. https://gitlab.gnome.org/GNOME/mutter/merge_requests/753
* wayland/dnd-surface: Apply surface offsetRobert Mader2019-08-261-0/+51
| | | | | | | | | | | | | The surface offset allows an application to move itself in relative coordinates to its previous position. It is rather ill defined and partly incompatible with other functionality, which is why we ignore it generally. For dnd-surfaces though, it is the de-facto standard for applications to properly position the dnd-icon below the cursor. Therefore apply the offset on actor sync by setting the feedback actor anchor. https://gitlab.gnome.org/GNOME/mutter/merge_requests/684
* wayland/feedback-actor: Use float for position and anchorRobert Mader2019-08-263-33/+33
| | | | | | | To be correct with fractional scaling. Furthermore, we currently use it only with ClutterPoint values, which are floats already. https://gitlab.gnome.org/GNOME/mutter/merge_requests/684
* wayland: pointer-confinement: Listen to "geometry-changed" on the surface, ↵Hans de Goede2019-08-261-4/+4
| | | | | | | | | | | | | | | | | | not the actor Commit b12c92e20639 ("wayland: Add MetaWaylandSurface::geometry-changed signal") Added a "geometry-changed" signal on MetaWaylandSurface, but the matching changes to src/wayland/meta-pointer-confinement-wayland.c made it listen for geometry-changed on the surface-actor instead of on the surface itself, leading to errors like these: gnome-shell[37805]: ../gobject/gsignal.c:2429: signal 'geometry-changed' is invalid for instance '0x5653aa7cfe50' of type 'MetaSurfaceActorWayland' This commit fixes this. Fixes: b12c92e20639 ("wayland: Add MetaWaylandSurface::geometry-changed signal") https://gitlab.gnome.org/GNOME/mutter/merge_requests/751
* backends: Don’t translate GLib propertiesPiotr Drąg2019-08-242-6/+6
| | | | https://gitlab.gnome.org/GNOME/mutter/merge_requests/749
* tests: Move clutter-test-utils.[ch] to src/testsCarlos Garnacho2019-08-2426-4/+700
| | | | | | | | 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 tests to src/testsCarlos Garnacho2019-08-24132-0/+22745
| | | | | | | Clutter doesn't hold anymore backend implementations, move tests where we have one that we may assign. https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
* backends: Don't use glib types in new native backend objectsCarlos Garnacho2019-08-2410-202/+202
| | | | https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
* clutter: Move evdev input to src/backends/nativeCarlos Garnacho2019-08-2428-63/+7335
| | | | | | | | | | | | | 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
* backends: Move nested stage to src/backends/x11/nestedCarlos Garnacho2019-08-244-5/+5
| | | | | | | We now have a MetaStageX11, so it's extra confusing to have both in the same directory. https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
* backends: Don't use glib types in new X11 backend objectsCarlos Garnacho2019-08-247-147/+147
| | | | https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
* clutter: Move X11 input to src/backends/x11Carlos Garnacho2019-08-2426-15/+5925
| | | | | | | | | | | | | 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 event retrieval toggleCarlos Garnacho2019-08-241-3/+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 ClutterEventTranslator interfaceCarlos Garnacho2019-08-241-6/+0
| | | | | | | 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
* keybindings: Code cleanupOlivier Fourdan2019-08-231-8/+4
| | | | | | The boolean `handled` is not needed, remove it. https://gitlab.gnome.org/GNOME/mutter/issues/734
* keybindings: Restore inhibit shortcut for overlay keyOlivier Fourdan2019-08-231-0/+9
| | | | | | | | | | | After the introduction of locate-pointer (commit 851b7d063 - “keybindings: Trigger locate-pointer on key modifier”), inhibiting shortcuts would no longer forward the overlay key to the client. Restore the code that was inadvertently removed so that inhibiting shortcuts works on the overlay key again. Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/734
* window-actor: Handle geometry scaleGeorges Basile Stavracas Neto2019-08-236-22/+78
| | | | | | | | | | | | | | | | | | | | | | Geometry scale is applied to each surface individually, using Clutter scales, and not only this breaks subsurfaces, it also pollutes the toolkit and makes the actor tree slightly too fragile. If GNOME Shell mistakenly tries to set the actor scale of any of these surfaces, for example, various artifacts might happen. Move geometry scale handling to MetaWindowActor. It is applied as a child transform operation, so that the Clutter-managed scale properties are left untouched. In the future where the entirety of the window is managed by a ClutterContent itself, the geometry scale will be applied directly into the transform matrix of MetaWindowActor. However, doing that now would break the various ClutterClones used by GNOME Shell, so the child transform is an acceptable compromise during this transition. https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
* wayland: Don't scale input and opaque regionsGeorges Basile Stavracas Neto2019-08-232-22/+28
| | | | | | | | Leave them at surface coordinates and let MetaSurfaceActor and MetaShapedTexture handle the interactions between buffer and geometry scale. https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
* wayland/tablet-tool: Use meta_wayland_surface_get_relative_coordinates()Georges Basile Stavracas Neto2019-08-231-5/+1
| | | | | | Instead of directly calling into clutter_actor_transform_stage_point(). https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
* shaped-texture: Move private function to private headerGeorges Basile Stavracas Neto2019-08-232-8/+7
| | | | | | | | | | meta_shaped_texture_update_area() is a private function that is exposed in the public headers. It is not used anywhere outside Mutter, and should really be in the private header. Move it to the private header. https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
* shaped-texture: Move MetaCullable helpers to MetaSurfaceActorGeorges Basile Stavracas Neto2019-08-234-173/+171
| | | | | | | | | | | | | Now that MetaShapedTexture is not a ClutterActor anymore, it does not make sense to make it a MetaCullable semi-implementation. This is, naturally, a responsibility of MetaSurfaceActor, since now MetaShapedTexture is a ClutterContent and as such, it only cares about what to draw. Move the MetaCullable implementation of MetaShapedTexture to MetaSurfaceActor. https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
* shaped-texture: Draw pipeline relative to allocGeorges Basile Stavracas Neto2019-08-231-8/+18
| | | | | | | | | | | | | | | | | | | | | By implementing ClutterContent, it is expected that MetaShapedTexture can draw on any actor. However, right now this is not possible, since it assumes that the drawing coordinates and sizes of the actor are synchronized with its own reported width and height. It mistakenly draws, for example, when setting an actor's content to it. There is no way to trigger this wrong behavior right now, but it will become a problem in the future where we can collect the paint nodes of MetaShapedTexture as part of other ClutterContent implementations. Use the allocation box passed by the actor to draw the pipelines of MetaShapedTexture. https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
* wayland/actor-surface: Set geometry scale in surface actorGeorges Basile Stavracas Neto2019-08-234-27/+11
| | | | | | | | | | | | Now that MetaShapedTexture is a ClutterContent implemetation that is aware of its own buffer scale, it is possible to simplify the event translation routines. Set the geometry scale in MetaSurfaceActor, and stop adjusting the surface scale when translating points. Also remove the now obsoleted meta_wayland_actor_surface_calculate_scale() function. https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
* shaped-texture: Implement ClutterContentGeorges Basile Stavracas Neto2019-08-2310-355/+276
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MetaWindowActor is the compositor-side representative of a MetaWindow. Specifically it represents the geometry of the window under Clutter scene graph. MetaWindowActors are backed by MetaSurfaceActors, that represent the windowing system's surfaces themselves. Naturally, these surfaces have textures with the pixel content of the clients associated with them. These textures are represented by MetaShapedTexture. MetaShapedTextures are currently implemented as ClutterActor subclasses that override the paint function to paint the textures it holds. Conceptually, however, Clutter has an abstraction layer for contents of actors: ClutterContent. Which MetaShapedTexture fits nicely, in fact. Make MetaShapedTexture a ClutterContent implementation. This forces a few changes in the stack: * MetaShapedTexture now handles buffer scale. * We now paint into ClutterPaintNode instead of the direct framebuffer. * Various pieces of Wayland code now use MetaSurfaceActor instead of MetaShapedTexture. * MetaSurfaceActorWayland doesn't override size negotiation vfuncs anymore https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
* wayland/xdg-output: Add xdg-output v3 supportOlivier Fourdan2019-08-212-3/+6
| | | | | | | xdg-output v3 marks `xdg_output.done` as deprecated, avoid sending that event for clients using xdg-output v3. https://gitlab.gnome.org/GNOME/mutter/merge_requests/704
* xwayland: Add local user to xhostOlivier Fourdan2019-08-191-0/+18
| | | | | | | | | | | | | | | | | With the addition of xauth support (commit a8984a81c), Xwayland would rely only on the provided cookies for authentication. As a result, running an Xclient from another VT (hence without the XAUTHORITY environment variable set) would result in an access denied. The same on X11 is granted because the local user is automatically granted access to Xserver by the startup scripts. Add the local user to xhost at startup on Xwayland so that the user can still run a client by setting the DISPLAY as long as it's the same user on the same host. https://gitlab.gnome.org/GNOME/mutter/merge_requests/735
* xwayland: Use given X11 display for DnD setupOlivier Fourdan2019-08-193-9/+9
| | | | | | | Use the provided X11 display instead of poking into GDK to get the X11 display. https://gitlab.gnome.org/GNOME/mutter/merge_requests/735
* xwayland: pass the X11 displayOlivier Fourdan2019-08-193-5/+6
| | | | | | | Pass the X11 display to `meta_xwayland_complete_init()` so that it can be used without poking into GDK. https://gitlab.gnome.org/GNOME/mutter/merge_requests/735
* compositor: Let MetaDisplay choose the correct compositor typeJonas Ådahl2019-08-197-24/+90
| | | | | | | | A base type shouldn't know about sub types, so let MetaDisplay make the correct choice of what type of MetaCompositor it should create. No other semantical changes introduced. https://gitlab.gnome.org/GNOME/mutter/merge_requests/727