If a device (virtual or real) is removed while there are remaining
events queued for that device, the event loop may try to access the
event freed memory.
To avoid the issue, add a reference to the device when the event is
created or copied, and remove the reference once the device is freed.
Closes: https://gitlab.gnome.org/GNOME/mutter/issues/393
Mostly as expected, this port is also trivial. A small cleanup
accompanies this patch, making gen_texcoords_and_draw_cogl_rectangle()
receive the framebuffer that it should draw into.
Because ClutterText has a somewhat convoluted drawing routine,
replacing cogl_rectangle() here isn't as straightfoward as the
effects were.
A new CoglPipeline is now part of the ClutterText struct, and
is used to set the color of the background or the selection.
Another change is paint_selection() now receives a framebuffer
to draw into. The check for NULL framebuffer does not make
sense here, since there is always a draw framebuffer set
when in the drawing function. Because of that, the check is
now gone.
All those effects have the same basic pattern of setting a
color of a pipeline, then drawing a rect with cogl_rectangle().
Thus, replacing those was as easy as retrieving the draw
framebuffer and calling cogl_framebuffer_draw_rectangle() on it.
The default implementation of ClutterActor.pick() uses
cogl_rectangle() to draw the rectangle with the color
for picking.
Replace that by cogl_framebuffer_draw_rectangle(). A
static color pipeline had to be created in order to
hold the pick color.
Instead of using cogl_read_pixels(), which is deprecated and
uses the implicit framebuffer, pass the current CoglFramebuffer
and use cogl_framebuffer_read_pixels().
Another case of a simple and direct API translation. Instead of
using the deprecated cogl_clear() function, replace it by the
non-deprecated cogl_framebuffer_clear().
The events-touch test tested that clutter could properly process evdev
touch events. It used uinput to post evdev touch events, thus only ran
when runnig the test as root. Running as non-root it'd just silently
pass. As Clutter doesn't process evdev touch events anymore,
libinput does, so the test is fairly pointless, so remove it.
Pausing the master clock didn't actually pause it if there was already a
scheduled frame in progress. This is problematic if one actually expects
to see no new frame scheduling to happen after pausing, for example it
caused actor 'pre-paint' to be signalled on actors, but nothing was ever
painted.
Avoid this by destroying the master clock source when pausing, and then
recreating it when resuming.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/309
When profiling gnome-shell it was found that one of the main triggers
of `clutter_actor_queue_relayout` during animations was
`clutter_actor_set_margin_internal` continuously setting the same
zero margins. That's obviously pointless but also expensive since it
incurs full stage relayouts and reallocation. So just avoid redundant
margin changes.
Helps to further improve:
https://gitlab.gnome.org/GNOME/mutter/issues/233,
https://gitlab.gnome.org/GNOME/gnome-shell/issues/349
Almost a decade old, lets just assume it's there. This makes the button
on cally-atktext-example work again when building with meson, and
probably other things too.
If texture allocation fails (e.g. on an old GPU with size limit 2048)
then `update_fbo` would return `FALSE` but leaves `priv->offscreen`
as non-NULL. So the next paint will try to use the offscreen with a
`NULL` texture and crashes. The solution is simply to ensure that
`priv->offscreen` is NULL if there is no `priv->texture`, so the default
(non-offscreen) paint path gets used instead.
Bug reported and fix provided by Gert van de Kraats.
https://launchpad.net/bugs/1795774
This commit adds meson build support to mutter. It takes a step away
from the three separate code bases with three different autotools setups
into a single meson build system. There are still places that can be
unified better, for example by removing various "config.h" style files
from cogl and clutter, centralizing debug C flags and other configurable
macros, and similar artifacts that are there only because they were once
separate code bases.
There are some differences between the autotools setup and the new
meson. Here are a few:
The meson setup doesn't generate wrapper scripts for various cogl and
clutter test cases. What these tests did was more or less generate a
tiny script that called an executable with a test name as the argument.
To run particular tests, just run the test executable with the name of
the test as the argument.
The meson setup doesn't install test files anymore. The autotools test
suite was designed towards working with installed tests, but it didn't
really still, and now with meson, it doesn't install anything at all,
but instead makes sure that everything runs with the uninstalled input
files, binaries and libraries when running the test suite. Installable
tests may come later.
Tests from cogl, clutter and mutter are run on 'meson test'. In
autotools, only cogl and clutter tests were run on 'make check'.
Install include files in
$prefix/include/mutter-$apiversion/[clutter,cogl,...,meta]/, and
datafiles in /usr/share/mutter-$apiversion/.... We still would conflict
e.g. given that our gettext name is "mutter", and how keybindings are
installed, but it's a step in the right direction.
This allows input methods to inject key events with specific keyval/keycode,
those events will be flagged with CLUTTER_EVENT_FLAG_INPUT_METHOD so they
won't be processed by the IM again.
https://gitlab.gnome.org/GNOME/gnome-shell/issues/531
If the user maps eg. Alt+F2 to a pad button, the MetaInputSettings will
send the full Alt press, F2 press, F2 release, Alt release sequence.
However the keycode corresponding to Alt is found in level 1, so the
Shift modifier gets unintendedly latched in addition to the Alt key
press/release pair.
We could probably improve keycode lookup heuristics so level=0 (and
no modifier latching) is preferred, but we can do without it altogether
for modifier keys.