Compare commits
8 Commits
3.29.3
...
gbsneto/tt
Author | SHA1 | Date | |
---|---|---|---|
![]() |
93b9bc789c | ||
![]() |
161d2540e6 | ||
![]() |
94f4009882 | ||
![]() |
ec8138773a | ||
![]() |
041be7c565 | ||
![]() |
0407a8b33d | ||
![]() |
912a6f5e3f | ||
![]() |
89162a90aa |
@@ -840,6 +840,7 @@ struct _ClutterActorPrivate
|
||||
guint needs_compute_expand : 1;
|
||||
guint needs_x_expand : 1;
|
||||
guint needs_y_expand : 1;
|
||||
guint needs_paint_volume_update : 1;
|
||||
};
|
||||
|
||||
enum
|
||||
@@ -1504,6 +1505,8 @@ clutter_actor_real_map (ClutterActor *self)
|
||||
|
||||
CLUTTER_ACTOR_SET_FLAGS (self, CLUTTER_ACTOR_MAPPED);
|
||||
|
||||
self->priv->needs_paint_volume_update = TRUE;
|
||||
|
||||
stage = _clutter_actor_get_stage_internal (self);
|
||||
priv->pick_id = _clutter_stage_acquire_pick_id (CLUTTER_STAGE (stage), self);
|
||||
|
||||
@@ -2737,6 +2740,7 @@ clutter_actor_real_queue_relayout (ClutterActor *self)
|
||||
priv->needs_width_request = TRUE;
|
||||
priv->needs_height_request = TRUE;
|
||||
priv->needs_allocation = TRUE;
|
||||
priv->needs_paint_volume_update = TRUE;
|
||||
|
||||
/* reset the cached size requests */
|
||||
memset (priv->width_requests, 0,
|
||||
@@ -8518,6 +8522,7 @@ clutter_actor_init (ClutterActor *self)
|
||||
priv->needs_width_request = TRUE;
|
||||
priv->needs_height_request = TRUE;
|
||||
priv->needs_allocation = TRUE;
|
||||
priv->needs_paint_volume_update = TRUE;
|
||||
|
||||
priv->cached_width_age = 1;
|
||||
priv->cached_height_age = 1;
|
||||
@@ -10084,6 +10089,9 @@ clutter_actor_allocate (ClutterActor *self,
|
||||
return;
|
||||
}
|
||||
|
||||
if (CLUTTER_ACTOR_IS_MAPPED (self))
|
||||
self->priv->needs_paint_volume_update = TRUE;
|
||||
|
||||
if (!stage_allocation_changed)
|
||||
{
|
||||
/* If the actor didn't move but needs_allocation is set, we just
|
||||
@@ -12972,6 +12980,9 @@ clutter_actor_add_child_internal (ClutterActor *self,
|
||||
child->priv->needs_height_request = TRUE;
|
||||
child->priv->needs_allocation = TRUE;
|
||||
|
||||
if (CLUTTER_ACTOR_IS_MAPPED (child))
|
||||
child->priv->needs_paint_volume_update = TRUE;
|
||||
|
||||
/* we only queue a relayout here, because any possible
|
||||
* redraw has already been queued either by show() or
|
||||
* by our call to queue_redraw() above
|
||||
@@ -17514,11 +17525,16 @@ _clutter_actor_get_paint_volume_mutable (ClutterActor *self)
|
||||
priv = self->priv;
|
||||
|
||||
if (priv->paint_volume_valid)
|
||||
clutter_paint_volume_free (&priv->paint_volume);
|
||||
{
|
||||
if (!priv->needs_paint_volume_update)
|
||||
return &priv->paint_volume;
|
||||
clutter_paint_volume_free (&priv->paint_volume);
|
||||
}
|
||||
|
||||
if (_clutter_actor_get_paint_volume_real (self, &priv->paint_volume))
|
||||
{
|
||||
priv->paint_volume_valid = TRUE;
|
||||
priv->needs_paint_volume_update = FALSE;
|
||||
return &priv->paint_volume;
|
||||
}
|
||||
else
|
||||
|
@@ -132,8 +132,8 @@ meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src)
|
||||
{
|
||||
MetaScreenCastStreamSrcPrivate *priv =
|
||||
meta_screen_cast_stream_src_get_instance_private (src);
|
||||
uint32_t buffer_id;
|
||||
struct spa_buffer *buffer;
|
||||
struct pw_buffer *buffer;
|
||||
struct spa_buffer *spa_buffer;
|
||||
uint8_t *map = NULL;
|
||||
uint8_t *data;
|
||||
uint64_t now_us;
|
||||
@@ -148,22 +148,24 @@ meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src)
|
||||
if (!priv->pipewire_stream)
|
||||
return;
|
||||
|
||||
buffer_id = pw_stream_get_empty_buffer (priv->pipewire_stream);
|
||||
if (buffer_id == SPA_ID_INVALID)
|
||||
return;
|
||||
|
||||
buffer = pw_stream_peek_buffer (priv->pipewire_stream, buffer_id);
|
||||
buffer = pw_stream_dequeue_buffer (priv->pipewire_stream);
|
||||
if (!buffer)
|
||||
{
|
||||
g_warning ("Failed to peek at PipeWire buffer");
|
||||
g_warning ("Failed to dequeue at PipeWire buffer");
|
||||
return;
|
||||
}
|
||||
|
||||
if (buffer->datas[0].type == priv->pipewire_type->data.MemFd)
|
||||
spa_buffer = buffer->buffer;
|
||||
|
||||
if (spa_buffer->datas[0].data)
|
||||
{
|
||||
map = mmap (NULL, buffer->datas[0].maxsize + buffer->datas[0].mapoffset,
|
||||
data = spa_buffer->datas[0].data;
|
||||
}
|
||||
else if (spa_buffer->datas[0].type == priv->pipewire_type->data.MemFd)
|
||||
{
|
||||
map = mmap (NULL, spa_buffer->datas[0].maxsize + spa_buffer->datas[0].mapoffset,
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED,
|
||||
buffer->datas[0].fd, 0);
|
||||
spa_buffer->datas[0].fd, 0);
|
||||
if (map == MAP_FAILED)
|
||||
{
|
||||
g_warning ("Failed to mmap pipewire stream buffer: %s\n",
|
||||
@@ -171,14 +173,11 @@ meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src)
|
||||
return;
|
||||
}
|
||||
|
||||
data = SPA_MEMBER (map, buffer->datas[0].mapoffset, uint8_t);
|
||||
}
|
||||
else if (buffer->datas[0].type == priv->pipewire_type->data.MemPtr)
|
||||
{
|
||||
data = buffer->datas[0].data;
|
||||
data = SPA_MEMBER (map, spa_buffer->datas[0].mapoffset, uint8_t);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Unhandled spa buffer type: %d", spa_buffer->datas[0].type);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -186,11 +185,11 @@ meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src)
|
||||
priv->last_frame_timestamp_us = now_us;
|
||||
|
||||
if (map)
|
||||
munmap (map, buffer->datas[0].maxsize + buffer->datas[0].mapoffset);
|
||||
munmap (map, spa_buffer->datas[0].maxsize + spa_buffer->datas[0].mapoffset);
|
||||
|
||||
buffer->datas[0].chunk->size = buffer->datas[0].maxsize;
|
||||
spa_buffer->datas[0].chunk->size = spa_buffer->datas[0].maxsize;
|
||||
|
||||
pw_stream_send_buffer (priv->pipewire_stream, buffer_id);
|
||||
pw_stream_queue_buffer (priv->pipewire_stream, buffer);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -266,8 +265,8 @@ on_stream_state_changed (void *data,
|
||||
}
|
||||
|
||||
static void
|
||||
on_stream_format_changed (void *data,
|
||||
struct spa_pod *format)
|
||||
on_stream_format_changed (void *data,
|
||||
const struct spa_pod *format)
|
||||
{
|
||||
MetaScreenCastStreamSrc *src = data;
|
||||
MetaScreenCastStreamSrcPrivate *priv =
|
||||
@@ -276,7 +275,7 @@ on_stream_format_changed (void *data,
|
||||
uint8_t params_buffer[1024];
|
||||
int32_t width, height, stride, size;
|
||||
struct spa_pod_builder pod_builder;
|
||||
struct spa_pod *params[1];
|
||||
const struct spa_pod *params[1];
|
||||
const int bpp = 4;
|
||||
|
||||
if (!format)
|
||||
@@ -360,9 +359,9 @@ create_pipewire_stream (MetaScreenCastStreamSrc *src,
|
||||
":", spa_type->format_video.format, "I", spa_type->video_format.BGRx,
|
||||
":", spa_type->format_video.size, "R", &SPA_RECTANGLE (width, height),
|
||||
":", spa_type->format_video.framerate, "F", &SPA_FRACTION (0, 1),
|
||||
":", spa_type->format_video.max_framerate, "Fr", &max_framerate,
|
||||
PROP_RANGE (&min_framerate,
|
||||
&max_framerate));
|
||||
":", spa_type->format_video.max_framerate, "Fru", &max_framerate,
|
||||
PROP_RANGE (&min_framerate,
|
||||
&max_framerate));
|
||||
|
||||
pw_stream_add_listener (pipewire_stream,
|
||||
&priv->pipewire_stream_listener,
|
||||
@@ -372,7 +371,8 @@ create_pipewire_stream (MetaScreenCastStreamSrc *src,
|
||||
result = pw_stream_connect (pipewire_stream,
|
||||
PW_DIRECTION_OUTPUT,
|
||||
NULL,
|
||||
PW_STREAM_FLAG_NONE,
|
||||
(PW_STREAM_FLAG_DRIVER |
|
||||
PW_STREAM_FLAG_MAP_BUFFERS),
|
||||
params, G_N_ELEMENTS (params));
|
||||
if (result != 0)
|
||||
{
|
||||
|
@@ -148,7 +148,10 @@ meta_gpu_kms_apply_crtc_mode (MetaGpuKms *gpu_kms,
|
||||
connectors, n_connectors,
|
||||
mode) != 0)
|
||||
{
|
||||
g_warning ("Failed to set CRTC mode %s: %m", crtc->current_mode->name);
|
||||
if (crtc->current_mode)
|
||||
g_warning ("Failed to set CRTC mode %s: %m", crtc->current_mode->name);
|
||||
else
|
||||
g_warning ("Failed to set CRTC mode: %m");
|
||||
g_free (connectors);
|
||||
return FALSE;
|
||||
}
|
||||
|
@@ -79,6 +79,29 @@ find_systemd_session (gchar **session_id,
|
||||
g_assert (session_id != NULL);
|
||||
g_assert (error == NULL || *error == NULL);
|
||||
|
||||
/* if we are in a logind session, we can trust that value, so use it. This
|
||||
* happens for example when you run mutter directly from a VT but when
|
||||
* systemd starts us we will not be in a logind session. */
|
||||
saved_errno = sd_pid_get_session (0, &local_session_id);
|
||||
if (saved_errno < 0)
|
||||
{
|
||||
if (saved_errno != -ENODATA)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_NOT_FOUND,
|
||||
"Failed to get session by pid for user %d (%s)",
|
||||
getuid (),
|
||||
g_strerror (-saved_errno));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*session_id = g_steal_pointer (&local_session_id);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
saved_errno = sd_uid_get_display (getuid (), &local_session_id);
|
||||
if (saved_errno < 0)
|
||||
{
|
||||
|
@@ -694,46 +694,11 @@ effective_unobscured_region (MetaShapedTexture *self)
|
||||
return priv->unobscured_region;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
get_unobscured_bounds (MetaShapedTexture *self,
|
||||
cairo_rectangle_int_t *unobscured_bounds)
|
||||
{
|
||||
cairo_region_t *unobscured_region = effective_unobscured_region (self);
|
||||
|
||||
if (unobscured_region)
|
||||
{
|
||||
cairo_region_get_extents (unobscured_region, unobscured_bounds);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_shaped_texture_get_paint_volume (ClutterActor *actor,
|
||||
ClutterPaintVolume *volume)
|
||||
{
|
||||
MetaShapedTexture *self = META_SHAPED_TEXTURE (actor);
|
||||
ClutterActorBox box;
|
||||
cairo_rectangle_int_t unobscured_bounds;
|
||||
|
||||
if (!clutter_actor_has_allocation (actor))
|
||||
return FALSE;
|
||||
|
||||
clutter_actor_get_allocation_box (actor, &box);
|
||||
|
||||
if (get_unobscured_bounds (self, &unobscured_bounds))
|
||||
{
|
||||
box.x1 = MAX (unobscured_bounds.x, box.x1);
|
||||
box.x2 = MIN (unobscured_bounds.x + unobscured_bounds.width, box.x2);
|
||||
box.y1 = MAX (unobscured_bounds.y, box.y1);
|
||||
box.y2 = MIN (unobscured_bounds.y + unobscured_bounds.height, box.y2);
|
||||
}
|
||||
box.x2 = MAX (box.x2, box.x1);
|
||||
box.y2 = MAX (box.y2, box.y1);
|
||||
|
||||
clutter_paint_volume_union_box (volume, &box);
|
||||
return TRUE;
|
||||
return clutter_paint_volume_set_from_allocation (volume, actor);
|
||||
}
|
||||
|
||||
void
|
||||
|
@@ -101,6 +101,13 @@ meta_surface_actor_pick (ClutterActor *actor,
|
||||
clutter_actor_paint (child);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_surface_actor_get_paint_volume (ClutterActor *actor,
|
||||
ClutterPaintVolume *volume)
|
||||
{
|
||||
return clutter_paint_volume_set_from_allocation (volume, actor);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_surface_actor_dispose (GObject *object)
|
||||
{
|
||||
@@ -120,6 +127,7 @@ meta_surface_actor_class_init (MetaSurfaceActorClass *klass)
|
||||
|
||||
object_class->dispose = meta_surface_actor_dispose;
|
||||
actor_class->pick = meta_surface_actor_pick;
|
||||
actor_class->get_paint_volume = meta_surface_actor_get_paint_volume;
|
||||
|
||||
signals[REPAINT_SCHEDULED] = g_signal_new ("repaint-scheduled",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
|
@@ -887,7 +887,8 @@ constrain_modal_dialog (MetaWindow *window,
|
||||
MetaRectangle child_rect, parent_rect;
|
||||
gboolean constraint_already_satisfied;
|
||||
|
||||
if (!meta_window_is_attached_dialog (window) ||
|
||||
if (!parent ||
|
||||
!meta_window_is_attached_dialog (window) ||
|
||||
meta_window_get_placement_rule (window))
|
||||
return TRUE;
|
||||
|
||||
|
Reference in New Issue
Block a user