Compare commits

...

5 Commits

Author SHA1 Message Date
Carlos Garnacho
44029116fc backends: Allow integrated tablet devices to cycle outputs
The work at https://gitlab.gnome.org/GNOME/gnome-control-center/issues/239
intended to make integrated devices optionally mappable to other outputs
(in order to allow fix mishandling from our heuristics, or to quickly reach
things in other monitor without changing devices).

This was missed in that plan, we do allow cycling outputs, but we still did
prevent it from doing anything for integrated devices. Fix that, and change
output cycling so we don't allow a "NULL" EDID for integrated devices, this
makes those go through the MetaInputMapper (resulting in one output listed
twice), instead of mapping to the full stage.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1186

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1201
2020-04-16 13:07:45 +02:00
Thomas Hindoe Paaboel Andersen
d0ef660ff6 clutter: fix memleak in test error path
If clutter_init fails then we will not free state.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1195
2020-04-12 21:40:20 +00:00
Marco Trevisan (Treviño)
506e06589b test-utils: Only initialize client when we're returning it
test_client_new might return early if conditions are not met, leaving some
allocated data around without freeing it.

Since we're not using the client before, there's no need to initialize it early
and just initialize it when it's going to be returned.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1195
2020-04-12 21:40:20 +00:00
Marco Trevisan (Treviño)
1d75d5aa2f group: Free group if returning early
If we get an error when fetching the window attributes, the group isn't ever
free'd, so use an autopointer instead, releasing the stolen one.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1195
2020-04-12 21:40:20 +00:00
Marco Trevisan (Treviño)
645d596f9d cogl: Use autopointers to free structs on return
This is a potential leak discovered by static analysis, in fact if
_COGL_GET_CONTEXT returns, the newly allocated struct isn't released.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1195
2020-04-12 21:40:20 +00:00
7 changed files with 21 additions and 14 deletions

View File

@@ -74,7 +74,7 @@ PangoFontMap *
cogl_pango_font_map_new (void)
{
PangoFontMap *fm = pango_cairo_font_map_new ();
CoglPangoFontMapPriv *priv = g_new0 (CoglPangoFontMapPriv, 1);
g_autofree CoglPangoFontMapPriv *priv = g_new0 (CoglPangoFontMapPriv, 1);
_COGL_GET_CONTEXT (context, NULL);
@@ -85,7 +85,7 @@ cogl_pango_font_map_new (void)
* for now. */
g_object_set_qdata_full (G_OBJECT (fm),
cogl_pango_font_map_get_priv_key (),
priv,
g_steal_pointer (&priv),
free_priv);
return fm;

View File

@@ -93,10 +93,12 @@ _cogl_onscreen_init_from_template (CoglOnscreen *onscreen,
CoglOnscreen *
_cogl_onscreen_new (void)
{
CoglOnscreen *onscreen = g_new0 (CoglOnscreen, 1);
g_autofree CoglOnscreen *onscreen_ptr = g_new0 (CoglOnscreen, 1);
CoglOnscreen *onscreen;
_COGL_GET_CONTEXT (ctx, NULL);
onscreen = g_steal_pointer (&onscreen_ptr);
_cogl_framebuffer_init (COGL_FRAMEBUFFER (onscreen),
ctx,
COGL_FRAMEBUFFER_TYPE_ONSCREEN,

View File

@@ -50,7 +50,7 @@ struct _CoglPipelineCache
CoglPipelineCache *
_cogl_pipeline_cache_new (void)
{
CoglPipelineCache *cache = g_new (CoglPipelineCache, 1);
g_autofree CoglPipelineCache *cache = g_new (CoglPipelineCache, 1);
unsigned long vertex_state;
unsigned long layer_vertex_state;
unsigned int fragment_state;
@@ -80,7 +80,7 @@ _cogl_pipeline_cache_new (void)
layer_vertex_state | layer_fragment_state,
"programs");
return cache;
return g_steal_pointer (&cache);
}
void

View File

@@ -2179,6 +2179,7 @@ meta_input_settings_get_pad_button_action (MetaInputSettings *input_settings,
static gboolean
cycle_logical_monitors (MetaInputSettings *settings,
gboolean skip_all_monitors,
MetaLogicalMonitor *current_logical_monitor,
MetaLogicalMonitor **next_logical_monitor)
{
@@ -2188,7 +2189,8 @@ cycle_logical_monitors (MetaInputSettings *settings,
GList *logical_monitors;
/* We cycle between:
* - the span of all monitors (current_output = NULL)
* - the span of all monitors (current_output = NULL), only for
* non-integrated devices.
* - each monitor individually.
*/
@@ -2206,6 +2208,8 @@ cycle_logical_monitors (MetaInputSettings *settings,
l = g_list_find (logical_monitors, current_logical_monitor);
if (l->next)
*next_logical_monitor = l->next->data;
else if (skip_all_monitors)
*next_logical_monitor = logical_monitors->data;
else
*next_logical_monitor = NULL;
}
@@ -2221,6 +2225,7 @@ meta_input_settings_cycle_tablet_output (MetaInputSettings *input_settings,
DeviceMappingInfo *info;
MetaLogicalMonitor *logical_monitor = NULL;
const gchar *edid[4] = { 0 }, *pretty_name = NULL;
gboolean is_integrated_device = FALSE;
#ifdef HAVE_LIBWACOM
WacomDevice *wacom_device;
#endif
@@ -2239,11 +2244,9 @@ meta_input_settings_cycle_tablet_output (MetaInputSettings *input_settings,
if (wacom_device)
{
/* Output rotation only makes sense on external tablets */
if (libwacom_get_integration_flags (wacom_device) != WACOM_DEVICE_INTEGRATED_NONE)
return;
pretty_name = libwacom_get_name (wacom_device);
is_integrated_device =
libwacom_get_integration_flags (wacom_device) != WACOM_DEVICE_INTEGRATED_NONE;
}
#endif
@@ -2251,6 +2254,7 @@ meta_input_settings_cycle_tablet_output (MetaInputSettings *input_settings,
NULL, &logical_monitor);
if (!cycle_logical_monitors (input_settings,
is_integrated_device,
logical_monitor,
&logical_monitor))
return;

View File

@@ -112,7 +112,7 @@ test_cogl_multitexture_main (int argc, char *argv[])
GError *error = NULL;
ClutterActor *stage;
ClutterColor stage_color = { 0x61, 0x56, 0x56, 0xff };
TestMultiLayerMaterialState *state = g_new0 (TestMultiLayerMaterialState, 1);
g_autofree TestMultiLayerMaterialState *state = g_new0 (TestMultiLayerMaterialState, 1);
gfloat stage_w, stage_h;
gchar **files;
gfloat tex_coords[] =

View File

@@ -427,7 +427,7 @@ test_client_new (const char *id,
MetaWindowClientType type,
GError **error)
{
TestClient *client = g_new0 (TestClient, 1);
TestClient *client;
GSubprocessLauncher *launcher;
GSubprocess *subprocess;
MetaWaylandCompositor *compositor;
@@ -462,6 +462,7 @@ test_client_new (const char *id,
if (!subprocess)
return NULL;
client = g_new0 (TestClient, 1);
client->type = type;
client->id = g_strdup (id);
client->cancellable = g_cancellable_new ();

View File

@@ -41,7 +41,7 @@ static MetaGroup*
meta_group_new (MetaX11Display *x11_display,
Window group_leader)
{
MetaGroup *group;
g_autofree MetaGroup *group = NULL;
#define N_INITIAL_PROPS 3
Atom initial_props[N_INITIAL_PROPS];
int i;
@@ -91,7 +91,7 @@ meta_group_new (MetaX11Display *x11_display,
"Created new group with leader 0x%lx\n",
group->group_leader);
return group;
return g_steal_pointer (&group);
}
static void