Compare commits

...

11 Commits

Author SHA1 Message Date
Benjamin Berg
ac8066a743 meson: Use sysprof interface defintion from correct prefix
The sysprof interface definition may be installed to a prefix different
from where mutter is going to be installed. Fetch the prefix from
pkgconfig instead.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/993
2020-01-08 14:12:51 +01:00
Jonas Dreßler
c4fa30ac7d backends/native: Fix relative motion calculation if monitor isn't found
The method `relative_motion_across_outputs` is used to adjust the
distance/delta of a mouse movement across multiple monitors to take the
different scale factors of those monitors into account. This works by
getting the adjacent monitors that the movement-line/vector intersects
with and adjusting the final position (or end point of the
movement-line) by multiplying the parts of the line spanning across
different monitors with the scale factors of those monitors.

In the end of this calculation, we always want to set the new end
coordinates of the relative motion to the new end coordinates of the
adjusted movement-line. We currently only do that if all adjacent
monitors the line is crossing actually exist, because only then we end
up inside the "We reached the dest logical monitor" else-block and set
`x` and `y` to the correct values. Fix that and make sure the returned
values are also correct in case an adjacent monitor doesn't exist by
adding separate `target_x` and `target_y` variables which we update during
each pass of the while loop so we're always prepared for the while loop
exiting before the destination monitor was found.

Thanks to Axel Kittenberger for reporting the initial bug and tracking
the issue down to `relative_motion_across_outputs`.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/774
2020-01-07 20:18:46 +00:00
Georges Basile Stavracas Neto
84ea4ad990 clutter/brightness-contrast-effect: Compare float with G_APPROX_VALUE
Nobody should ever compare float for equality. Use G_APPROX_VALUE to
check that.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/992
2020-01-07 14:20:21 -03:00
Georges Basile Stavracas Neto
64685f4b20 clutter/offscreen-effect: Clear offscreen when pre-paint fails
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
2020-01-07 14:20:21 -03:00
Georges Basile Stavracas Neto
bf594e9fb6 clutter/offscreen-effect: Clear offscreen framebuffer when disabling
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
2020-01-07 14:19:33 -03:00
Georges Basile Stavracas Neto
3958e75ed2 clutter/offscreen-effect: Use g_clear_pointer for cleanup
It does the exact same checks, and saves us a few lines of code.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/992
2020-01-07 14:02:25 -03:00
Sebastian Keller
802309caf9 x11-selection: Plug MetaX11SelectionOutputStream leak
https://gitlab.gnome.org/GNOME/mutter/merge_requests/991
2020-01-06 19:54:00 +00:00
Sebastian Keller
468b09c01e theme: Plug GdkPixbuf leak
https://gitlab.gnome.org/GNOME/mutter/merge_requests/991
2020-01-06 19:54:00 +00:00
Sebastian Keller
c13ea4f48d theme: Plug GtkIconInfo leak
https://gitlab.gnome.org/GNOME/mutter/merge_requests/991
2020-01-06 19:54:00 +00:00
Carlos Garnacho
1e7285b2bb backends: Always enable tap-to-click/drag on opaque Wacom tablets
Touch-wise, those are essentially giant touchpads, but have no buttons
associated to the "touchpad" device (There may be pad buttons, but
those are not mouse buttons).

Without tap-to-click/drag, touch in those devices is somewhat useless
out of the box. Have them always enable these features, despite the
setting.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/968
2020-01-06 13:52:55 +00:00
Robert Mader
a8cb84c711 window-actor: Also cull out clip_region
From `meta_cullable_cull_out`:
```
Actors that may have fully opaque parts should also subtract out a region
that is fully opaque from @unobscured_region and @clip_region.
```

As we do no check for the intersection of these two elsewhere in the code,
let's substract from the clip region, too.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/985
2020-01-06 13:38:23 +00:00
8 changed files with 99 additions and 56 deletions

View File

@@ -121,12 +121,12 @@ G_DEFINE_TYPE (ClutterBrightnessContrastEffect,
static gboolean
will_have_no_effect (ClutterBrightnessContrastEffect *self)
{
return (self->brightness_red == no_change &&
self->brightness_green == no_change &&
self->brightness_blue == no_change &&
self->contrast_red == no_change &&
self->contrast_green == no_change &&
self->contrast_blue == no_change);
return (G_APPROX_VALUE (self->brightness_red, no_change, FLT_EPSILON) &&
G_APPROX_VALUE (self->brightness_green, no_change, FLT_EPSILON) &&
G_APPROX_VALUE (self->brightness_blue, no_change, FLT_EPSILON) &&
G_APPROX_VALUE (self->contrast_red, no_change, FLT_EPSILON) &&
G_APPROX_VALUE (self->contrast_green, no_change, FLT_EPSILON) &&
G_APPROX_VALUE (self->contrast_blue, no_change, FLT_EPSILON));
}
static gboolean
@@ -497,9 +497,9 @@ clutter_brightness_contrast_effect_set_brightness_full (ClutterBrightnessContras
{
g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect));
if (red == effect->brightness_red &&
green == effect->brightness_green &&
blue == effect->brightness_blue)
if (G_APPROX_VALUE (red, effect->brightness_red, FLT_EPSILON) &&
G_APPROX_VALUE (green, effect->brightness_green, FLT_EPSILON) &&
G_APPROX_VALUE (blue, effect->brightness_blue, FLT_EPSILON))
return;
effect->brightness_red = red;
@@ -587,9 +587,9 @@ clutter_brightness_contrast_effect_set_contrast_full (ClutterBrightnessContrastE
{
g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect));
if (red == effect->contrast_red &&
green == effect->contrast_green &&
blue == effect->contrast_blue)
if (G_APPROX_VALUE (red, effect->contrast_red, FLT_EPSILON) &&
G_APPROX_VALUE (green, effect->contrast_green, FLT_EPSILON) &&
G_APPROX_VALUE (blue, effect->contrast_blue, FLT_EPSILON))
return;
effect->contrast_red = red;

View File

@@ -118,11 +118,7 @@ clutter_offscreen_effect_set_actor (ClutterActorMeta *meta,
meta_class->set_actor (meta, actor);
/* clear out the previous state */
if (priv->offscreen != NULL)
{
cogl_object_unref (priv->offscreen);
priv->offscreen = NULL;
}
g_clear_pointer (&priv->offscreen, cogl_object_unref);
/* we keep a back pointer here, to avoid going through the ActorMeta */
priv->actor = clutter_actor_meta_get_actor (meta);
@@ -198,17 +194,8 @@ update_fbo (ClutterEffect *effect,
ensure_pipeline_filter_for_scale (self, resource_scale);
}
if (priv->texture != NULL)
{
cogl_object_unref (priv->texture);
priv->texture = NULL;
}
if (priv->offscreen != NULL)
{
cogl_object_unref (priv->offscreen);
priv->offscreen = NULL;
}
g_clear_pointer (&priv->texture, cogl_object_unref);
g_clear_pointer (&priv->offscreen, cogl_object_unref);
priv->texture =
clutter_offscreen_effect_create_texture (self, target_width, target_height);
@@ -487,29 +474,44 @@ clutter_offscreen_effect_paint (ClutterEffect *effect,
*/
if (priv->offscreen == NULL || (flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY))
{
/* Chain up to the parent paint method which will call the pre and
post paint functions to update the image */
CLUTTER_EFFECT_CLASS (clutter_offscreen_effect_parent_class)->
paint (effect, paint_context, flags);
ClutterEffectClass *effect_class = CLUTTER_EFFECT_GET_CLASS (effect);
gboolean pre_paint_succeeded;
pre_paint_succeeded = effect_class->pre_paint (effect, paint_context);
clutter_actor_continue_paint (priv->actor, paint_context);
if (pre_paint_succeeded)
effect_class->post_paint (effect, paint_context);
else
g_clear_pointer (&priv->offscreen, cogl_object_unref);
}
else
clutter_offscreen_effect_paint_texture (self, paint_context);
}
static void
clutter_offscreen_effect_notify (GObject *gobject,
GParamSpec *pspec)
{
ClutterOffscreenEffect *offscreen_effect = CLUTTER_OFFSCREEN_EFFECT (gobject);
ClutterOffscreenEffectPrivate *priv = offscreen_effect->priv;
if (strcmp (pspec->name, "enabled") == 0)
g_clear_pointer (&priv->offscreen, cogl_object_unref);
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->notify (gobject, pspec);
}
static void
clutter_offscreen_effect_finalize (GObject *gobject)
{
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (gobject);
ClutterOffscreenEffectPrivate *priv = self->priv;
if (priv->offscreen)
cogl_object_unref (priv->offscreen);
if (priv->target)
cogl_object_unref (priv->target);
if (priv->texture)
cogl_object_unref (priv->texture);
g_clear_pointer (&priv->offscreen, cogl_object_unref);
g_clear_pointer (&priv->texture, cogl_object_unref);
g_clear_pointer (&priv->target, cogl_object_unref);
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->finalize (gobject);
}
@@ -531,6 +533,7 @@ clutter_offscreen_effect_class_init (ClutterOffscreenEffectClass *klass)
effect_class->paint = clutter_offscreen_effect_paint;
gobject_class->finalize = clutter_offscreen_effect_finalize;
gobject_class->notify = clutter_offscreen_effect_notify;
}
static void

View File

@@ -517,6 +517,33 @@ update_touchpad_disable_while_typing (MetaInputSettings *input_settings,
}
}
static gboolean
device_is_tablet_touchpad (MetaInputSettings *input_settings,
ClutterInputDevice *device)
{
#ifdef HAVE_LIBWACOM
WacomIntegrationFlags flags = 0;
WacomDevice *wacom_device;
if (clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE)
return FALSE;
wacom_device =
meta_input_settings_get_tablet_wacom_device (input_settings,
device);
if (wacom_device)
{
flags = libwacom_get_integration_flags (wacom_device);
if ((flags & (WACOM_DEVICE_INTEGRATED_SYSTEM |
WACOM_DEVICE_INTEGRATED_DISPLAY)) == 0)
return TRUE;
}
#endif
return FALSE;
}
static void
update_touchpad_tap_enabled (MetaInputSettings *input_settings,
ClutterInputDevice *device)
@@ -531,7 +558,8 @@ update_touchpad_tap_enabled (MetaInputSettings *input_settings,
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
enabled = g_settings_get_boolean (priv->touchpad_settings, "tap-to-click");
enabled = device_is_tablet_touchpad (input_settings, device) ||
g_settings_get_boolean (priv->touchpad_settings, "tap-to-click");
if (device)
{
@@ -561,7 +589,8 @@ update_touchpad_tap_and_drag_enabled (MetaInputSettings *input_settings,
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
enabled = g_settings_get_boolean (priv->touchpad_settings, "tap-and-drag");
enabled = device_is_tablet_touchpad (input_settings, device) ||
g_settings_get_boolean (priv->touchpad_settings, "tap-and-drag");
if (device)
{

View File

@@ -227,6 +227,7 @@ relative_motion_across_outputs (MetaMonitorManager *monitor_manager,
{
MetaLogicalMonitor *cur = current;
float x = cur_x, y = cur_y;
float target_x = cur_x, target_y = cur_y;
float dx = *dx_inout, dy = *dy_inout;
MetaDisplayDirection direction = -1;
@@ -256,6 +257,9 @@ relative_motion_across_outputs (MetaMonitorManager *monitor_manager,
{ cur->rect.x + cur->rect.width, cur->rect.y + cur->rect.height }
};
target_x = motion.b.x;
target_y = motion.b.y;
if (direction != META_DISPLAY_RIGHT &&
meta_line2_intersects_with (&motion, &left, &intersection))
direction = META_DISPLAY_LEFT;
@@ -269,12 +273,8 @@ relative_motion_across_outputs (MetaMonitorManager *monitor_manager,
meta_line2_intersects_with (&motion, &bottom, &intersection))
direction = META_DISPLAY_DOWN;
else
{
/* We reached the dest logical monitor */
x = motion.b.x;
y = motion.b.y;
break;
}
/* We reached the dest logical monitor */
break;
x = intersection.x;
y = intersection.y;
@@ -285,8 +285,8 @@ relative_motion_across_outputs (MetaMonitorManager *monitor_manager,
cur, direction);
}
*dx_inout = x - cur_x;
*dy_inout = y - cur_y;
*dx_inout = target_x - cur_x;
*dy_inout = target_y - cur_y;
}
static void

View File

@@ -957,20 +957,28 @@ meta_window_actor_cull_out (MetaCullable *cullable,
meta_cullable_cull_out_children (cullable, unobscured_region, clip_region);
if (unobscured_region && meta_window_actor_is_opaque (self))
if ((unobscured_region || clip_region) && meta_window_actor_is_opaque (self))
{
cairo_region_t *region = meta_window_get_frame_bounds (priv->window);
if (region)
{
cairo_region_subtract (unobscured_region, region);
if (unobscured_region)
cairo_region_subtract (unobscured_region, region);
if (clip_region)
cairo_region_subtract (clip_region, region);
}
else
{
cairo_rectangle_int_t rect;
meta_window_get_frame_rect (priv->window, &rect);
rect.x = rect.y = 0;
cairo_region_subtract_rectangle (unobscured_region, &rect);
if (unobscured_region)
cairo_region_subtract_rectangle (unobscured_region, &rect);
if (clip_region)
cairo_region_subtract_rectangle (clip_region, &rect);
}
}
}

View File

@@ -712,7 +712,9 @@ if have_profiler
'backends/meta-profiler.h',
]
dbus_interfaces_dir = join_paths(datadir, 'dbus-1', 'interfaces')
# sysprof does not export anything more specific than the prefix
sysprof_datadir = join_paths(sysprof_dep.get_pkgconfig_variable('prefix'), get_option('datadir'))
dbus_interfaces_dir = join_paths(sysprof_datadir, 'dbus-1', 'interfaces')
sysprof3_dbus_file = join_paths(dbus_interfaces_dir, 'org.gnome.Sysprof3.Profiler.xml')
dbus_sysprof3_profiler_built_sources = gnome.gdbus_codegen('meta-dbus-sysprof3-profiler',

View File

@@ -861,8 +861,8 @@ meta_frame_layout_draw_with_style (MetaFrameLayout *layout,
if (icon_name)
{
GtkIconTheme *theme = gtk_icon_theme_get_default ();
GtkIconInfo *info;
GdkPixbuf *pixbuf;
g_autoptr (GtkIconInfo) info = NULL;
g_autoptr (GdkPixbuf) pixbuf = NULL;
info = gtk_icon_theme_lookup_icon_for_scale (theme, icon_name,
layout->icon_size, scale, 0);

View File

@@ -116,6 +116,7 @@ write_mimetypes_cb (GOutputStream *stream,
g_output_stream_write_bytes_finish (stream, res, &error);
g_output_stream_close (stream, NULL, NULL);
g_object_unref (stream);
if (error)
{