summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* backends: Replace MetaCursorSprite::prepare-at with in-place functionCarlos Garnacho2021-08-276-17/+48
| | | | | | | | | | | | Since this signal is in a hot path during input handling, it makes sense not to have this be a signal at all, currently most of the time spent in it is in GLib signal machinery itself. Replace it with a function/user data pair that are set on the sprite itself. Only the places that create an sprite are interested in hooking one ::prepare-at behavior per sprite, so we can do with a single pair. This makes meta_cursor_sprite_prepare_at() inexpensive enough.
* backends: Upload xcursor texture only after invalidations and theme changesCarlos Garnacho2021-08-271-2/+19
| | | | | Make realize_texture() return FALSE for the situations that we do not need to push again the cursor texture.
* wayland: Mark sprite as invalid after cursor changesCarlos Garnacho2021-08-272-1/+28
| | | | | This will be used to hint the backend that the cursor surface might need uploading again.
* backends: Only reload sprite cursor on changesCarlos Garnacho2021-08-277-9/+38
| | | | | | | | | Let the meta_cursor_sprite_realize() function return a boolean value telling whether there was an actual change in the sprite cursor. E.g. the surface/icon for it changed in between. This is used in the native backend to avoid converting/uploading again the cursor surface.
* backends: Remove superfluous intermediate variableCarlos Garnacho2021-08-271-4/+1
| | | | | Having this intermediate variable is not of much use anymore, remove it.
* backends/x11: Use clutter_do_event() for event deliveryCarlos Garnacho2021-08-271-1/+1
| | | | | It'll do some things that will be no longer optional here. So don't avoid this step towards event emission.
* onscreen/native: Remove a tab characterDaniel van Vugt2021-08-241-1/+1
| | | | | | To resolve CI warnings. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1972>
* build: Stop using source_root()/build_root()Florian Müllner2021-08-222-3/+3
| | | | | | They were deprecated in meson 0.56. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1957>
* tests/stage-view: Added test for incorrect frame clock schedulingJonas Ådahl2021-08-222-1/+133
| | | | | | | The test attempts to reproduce gnome-shell#4486, and is fixed by "window-actor/x11: Don't cache the frame-drawn frame clock". Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1947>
* window-actor/x11: Don't cache the frame-drawn frame clockJonas Ådahl2021-08-221-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | We fetch a frame clock that we schedule update on when queuing _NET_WM_FRAME_DRAWN events. In some situations this frame clock is the one from the stage, and if there are multiple hotplugs in a row, we failed to update it as there were no stage views changes on the window actor itself. As an actor updates the stage views list on layout, When a queue_frame_drawn() call was done (typically from an X11 event) after a second hotplug, it'd attempt to schedule an update on the frame clock from the previous hotplug, as it didn't get notified about any stage-views changes since for itself there was none. Fix this by not caching the frame clock at all and just fetch it every time. In the majority of cases, this fetching means iterating over a very short list (most often a single entry, rarely more), so it's very unlikely to be of any relevance. The only situations where it might be a heavier operation is the short time between a hotplug and a layout, as it will attempt to traverse up to the stage to find a clock, but that's likely only a few levels, so even that is unlikely to be an issue. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4486 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1947>
* wayland/output: Fly-by coding style fixJonas Ådahl2021-08-221-9/+11
| | | | | | Change 'GList *iter' to 'GList *l' in a few places. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1712>
* wayland/output: Make each wl_output correspond to one monitorJonas Ådahl2021-08-222-114/+76
| | | | | | | | | This is more in line with the protocol, and allows us to remove some awkward code that tries to "combine" different metadata from different monitors into one, which sometimes meant picking an arbitrary "main" monitor, or "and" metadata together to find a common ground. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1712>
* monitor: Add hash functionJonas Ådahl2021-08-222-0/+13
| | | | | | Will be used to keep a monitor spec as a hash table key. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1712>
* wayland/output: Move struct to C fileJonas Ådahl2021-08-223-20/+20
| | | | | | Avoids leaking implementation details outside. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1712>
* wayland: Fetch wl_output logical monitor via helperJonas Ådahl2021-08-225-8/+28
| | | | | | | Will be useful when wl_output gets tied to a MetaMonitor, instead of a MetaLogicalMonitor. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1712>
* wayland/surface: Get wl_output resource list via helperJonas Ådahl2021-08-223-8/+14
| | | | Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1712>
* cursor-tracker: Add meta_cursor_tracker_get_scale ()Ivan Molodetskikh2021-08-222-0/+22
| | | | | | | Used in the screenshot UI (and arguably should be used in the existing gnome-shell screenshot drawing code). Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1967>
* window: Make default focus window on each workspace appear focusedAlexander Mikhaylenko2021-08-123-10/+70
| | | | | | | | | | | | | Makes workspace transitions in gnome-shell look more seamless, since both outgoing and incoming workspace have focused windows. This is only done for click focus mode, since it's not known which window would be focused for the other modes. Track the state and recompute it when it changes, to avoid redrawing the windows needlessly. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/850>
* workspace: Add meta_workspace_get_default_focus_window()Alexander Mikhaylenko2021-08-122-0/+15
| | | | | | | | | | | | | Each workspace has a window that will be focused when switching to that workspace. Add a function to retrieve that window. This is only relevant for click-to-focus focus mode, since with the two other modes no window will be focused upon switching, and will only gain focus when hovered. This will be used in the next commit to make this window appear focused. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/850>
* stack: Check workspace in get_default_focus_window()Alexander Mikhaylenko2021-08-121-4/+9
| | | | | | Check against the window argument, instead of active workspace. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/850>
* plugins/default: Switch to g_spawn_check_wait_status()Jonas Ådahl2021-08-121-1/+1
| | | | | | The old one is deprecated and equivalent. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1941>
* xwayland-grab-keyboard: Switch to g_pattern_spec_match_string()Jonas Ådahl2021-08-121-2/+2
| | | | | | | The g_pattern_match_string() variant is deprecated, switch to the properly namespaced one. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1941>
* wayland-dma-buf: Fix 'kms-modifiers' experimental settingRobert Mader2021-08-061-2/+5
| | | | | | | The setting was ignored in favor of whatever the backend returned. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1953>
* shaped-texture: Do not apply y-inverts to shape masksRobert Mader2021-08-041-2/+2
| | | | | | | | | | | | | | | | | This was introduced by accident in commit 1467b6b02a73bca76 y-inverted textures in combination with shape masks appear to be only commonly used with EGLstreams. However, as we draw the shape mask ourselves, we don't want to apply the y-invert to it as testified by the left over `cogl_pipeline_set_layer_matrix()`. Note that we still allow to apply viemports and buffer transforms, as the Xwayland mode setting emulation may use it (in fact only the former, but it probably does not hurt to leave the later as well). Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1792 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1937>
* wayland/gtk-shell: Add titlebar_gesture requestFlorian Müllner2021-08-043-4/+112
| | | | | | | | | | | | | This allows client to delegate titlebar gestures to the compositor, which allows for better consistency with server-side decorations, and a wider range of actions (including lower-on-middle-click). The protocol addition is based on a suggestion from Carlos Garnacho and Jonas Ådahl. https://gitlab.gnome.org/GNOME/mutter/-/issues/602 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1944>
* window: Add meta_window_lower_with_transients()Florian Müllner2021-08-043-49/+61
| | | | | | | | | | | | The only thing x11-specific about the existing code is that it is only used to implement titlebar actions on server-side decorations. We are about to bring that functionality to wayland, so move the code into MetaWayland. https://gitlab.gnome.org/GNOME/mutter/-/issues/602 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1944>
* monitor-test-utils: Add debug friendly statements during testsMarco Trevisan (Treviño)2021-08-044-64/+143
| | | | | | | | | | | | | Monitor configuration check tests can be very complex and in case of failures we can't easily catch where a failure happened without entering in debug mode, something that isn't always an option in CI or external builders. So add more debug statements in configuration check functions and use macros to ensure that we print the caller function and location on more complex check functions. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
* monitor-config-manager: Use match rule to check laptop panel visibilityMarco Trevisan (Treviño)2021-08-041-2/+2
| | | | | | | Use the MONITOR_MATCH_VISIBLE match rule instead of doing the same check when initializing the list of disabled monitor specs. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
* monitor-conifig-manager: Generate primary monitor config with othersMarco Trevisan (Treviño)2021-08-041-31/+15
| | | | | | | | | | | | Primary monitor is just the same of the other monitors, but it has a primary monitor flag. Since the computation of the scaling isn't dependent anymore on the computed configuration we can now generate the primary monitor config together with the others. However, we've to ensure that the primary monitor is the first of the configs list in order to properly compute the positioning. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
* monitor-config-manager: Computer monitor scale in callerMarco Trevisan (Treviño)2021-08-041-16/+30
| | | | | | | | | Compute the monitor scaling in a separated function using the primary monitor (not its config) and pass it to the creation function instead. This will allow removing the special logic for the primary monitor. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
* monitor-config-manager: Use monitor match filters to create configMarco Trevisan (Treviño)2021-08-041-204/+137
| | | | | | | | | Factorize the creation of a configuration inside one function that looks for the primary monitor and the other monitors using the matching rules and dispose them according to the chosen policy (checking if the result is valid when using the suggested positioning). Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
* monitor-config-manager: Define cleanup functions for structsMarco Trevisan (Treviño)2021-08-041-0/+7
| | | | | | | Monitor configuration structures can be used inside containers such as GList and in order to have smart cleanups we need to define the relative free function Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
* monitor-config-manager: Use single filter function to build configsMarco Trevisan (Treviño)2021-08-041-55/+91
| | | | | | | | | | | | Add a find_monitors function that allows to search for monitors that match the MonitorMatchRule filter and use this to look for the primary monitor and the other monitors that need to match the requested filter in order to be configured. Having just one function doing this kind of checks reduces the possibility of unexpected results. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
* monitor: Only assign suggested positions to valid pointersMarco Trevisan (Treviño)2021-08-041-2/+5
| | | | Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
* monitor-unit-tests: Check suggested configuration has adjacent outputsMarco Trevisan (Treviño)2021-08-041-0/+315
| | | | | | | | | Verify that the suggested monitor configuration contains only adjacent monitors, and that if this is not the case we fallback to the linear configuration. This can happen in case of multi-DPI setup, so add a test checking this too. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
* monitor-config-manager: Reject a suggested config with gapsMarco Trevisan (Treviño)2021-08-041-0/+15
| | | | | | | | | | | | It could happen that monitors suggest to use coordinates that don't take in consideration the scaling applied to one monitor, and such the generated configuration is not valid because not all the monitors are adjacent. So enforce this check before accepting a suggested configuration as it is. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
* boxes: Add function to check if rectangle is adjacent to regionMarco Trevisan (Treviño)2021-08-042-0/+23
| | | | | | | | | | We may need to check if rectangles region has adjacent neighbors and so if there are no gaps in between monitors. This can be done by checking if each monitor is adjacent to any other in the same region. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
* monitor-unit-tests: Add test for overlapping monitor configMarco Trevisan (Treviño)2021-08-041-0/+159
| | | | | | | Verify that when we've monitors with overlapping preferred configuration, we fallback to the default linear configuration. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
* x11: Add COGL_HAS_TRACING checks around tracing codeCarlos Garnacho2021-08-021-0/+2
| | | | | | | | This code sneaked unconditionally, even though we can disable tracing code with -Dprofiler=false. Add some COGL_HAS_TRACING checks so that this code is also optionally built. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1951>
* compositor: Add COGL_HAS_TRACING checks around tracing codeCarlos Garnacho2021-08-021-0/+4
| | | | | | | | This code sneaked unconditionally, even though we can disable tracing code with -Dprofiler=false. Add some COGL_HAS_TRACING checks so that this code is also optionally built. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1951>
* x11/window: Add tracing for X11 synchronization eventsJonas Ådahl2021-07-292-0/+49
| | | | | | | | Add tracing and data gathering for processing related to _NET_WM_FRAME_DRAWN and _NET_WM_FRAME_TIMINGS, used by some X11 clients for synchronized rendering. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1700>
* x11/events: Trace X11 event handlingJonas Ådahl2021-07-291-2/+32
| | | | | | Traces the type of event, and how much time was spent processing it. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1700>
* x11/events: Fly-by coding style cleanupJonas Ådahl2021-07-291-23/+22
| | | | | | A large else block didn't have {}, so added them. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1700>
* x11/events: Clean up event name gettingJonas Ådahl2021-07-291-65/+134
| | | | | | Preparation for adding a generic "get event name" getter. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1700>
* core/selection: Cancel selection transfer requests after a timeoutPascal Nowack2021-07-281-4/+72
| | | | | | | | | | When a selection owner advertises a mime type, but does not provide the content upon a request for the mime type content, the requesting side might wait indefinitely on the content. To avoid this situation, add a timeout source, which will cancel the selection transfer request after a certain timeout (15 seconds) passed. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1874>
* remote-desktop: Check pipe fd before assuming existing read() operationPascal Nowack2021-07-281-1/+42
| | | | | | | | | | | | | | | | | | | | | Currently, if g-r-d closes the read end of the pipe for a SelectionRead() operation, due to realizing that the application, that should provide the mime type content, does not provide any content, mutter won't notice that and still assumes that the read() operation on the pipe in g-r-d is still happening, as mutter never writes to the pipe in that situation and therefore cannot realize that the pipe is already closed. The effect of this is, that if g-r-d aborts a read() operation and requests a new read() operation via SelectionRead(), mutter will deny the request since it assumes that the previous read() operation is still ongoing. Fix this behaviour by also checking the pipe fd in mutter before denying a SelectionRead() request. https://gitlab.gnome.org/GNOME/gnome-remote-desktop/-/issues/60 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1874>
* background-content: Shrink and optimize the rounded-clip shaderDaniel van Vugt2021-07-261-91/+38
| | | | | | | | | | The main benefit being it now fits within the hardware limits for the i915 Mesa driver, and runs on the GPU instead of software fallback. Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4251, https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4425 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1860>
* monitor: Do not overlap when checking for applicable scaling valuesMarco Trevisan (Treviño)2021-07-223-7/+23
| | | | | | | | | | | | | | | | | | | | | | With some resolutions (such as 4096x2160) we may compute duplicated scale factors because we used a too wide threshold to check for an applicable value. In fact, while when we're at the first and last values it's fine to search applicable values up to SCALE_FACTORS_STEP, on intermediate ones we should stop in the middle of it, or we're end up overlapping the previous scaling value domain. In the said example in fact we were returning 2.666667 both when looking to a scaling value close to 2.75 and 3.00 as the upper bound of 2.75 (3.0) was overlapping with the lower bound of 3.0 (2.75). With the current code, the lower and upper bounds will be instead 2.875. Adapt test to this, and this allows to also ensure that we're always returning a sorted and unique list of scales (which is useful as also g-c-c can ensure that this is true). Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1878>
* monitor-unit-tests: Check integer scaling values are matching expectationsMarco Trevisan (Treviño)2021-07-221-0/+283
| | | | | | | A per previous commit we can now ensure that all the scaling values when using non-fractional scaling have the value we expect. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1878>
* monitor: Never return fractional scale values when NO_FRAC is usedMarco Trevisan (Treviño)2021-07-221-16/+15
| | | | | | | | | | | | | | | | | | | | We introduced META_MONITOR_SCALES_CONSTRAINT_NO_FRAC to get global scale values however, this didn't work properly for some resolutions. In fact it may happen that for some resolutions (such as 3200x1800) that we did not compute some odd scaling levels (such as 3.0) but instead its closest fractional value that allowed to get an integer resolution (2.98507452 in this case). Now this is something relevant when using fractional scaling because we want to ensure that the returned value, when multiplied to the scaled sizes, will produce an integer resolution, but it's not in global scale mode where we don't use a scaled framebuffer. So, take a short path when using no fractional mode and just return all the applicable values without waste iterations on fractional values. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1878>