|
|
79df40 |
From a6d6b14306727692bffdadd09bca239aebc867c4 Mon Sep 17 00:00:00 2001
|
|
|
79df40 |
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
|
|
79df40 |
Date: Thu, 25 Jul 2019 02:02:21 +0200
|
|
|
79df40 |
Subject: [PATCH 25/28] compositor: Use meta_window_actor_from_window to get
|
|
|
79df40 |
the actor
|
|
|
79df40 |
|
|
|
79df40 |
Use this utility function instead of repeating the cast all the time.
|
|
|
79df40 |
|
|
|
79df40 |
Also in some case, warn if the returned value isn't valid.
|
|
|
79df40 |
|
|
|
79df40 |
https://gitlab.gnome.org/GNOME/mutter/merge_requests/682
|
|
|
79df40 |
---
|
|
|
79df40 |
src/compositor/compositor.c | 58 +++++++++++++++++++++++++++----------
|
|
|
79df40 |
1 file changed, 42 insertions(+), 16 deletions(-)
|
|
|
79df40 |
|
|
|
79df40 |
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
|
|
|
79df40 |
index 799bcddf5..d02926171 100644
|
|
|
79df40 |
--- a/src/compositor/compositor.c
|
|
|
79df40 |
+++ b/src/compositor/compositor.c
|
|
|
79df40 |
@@ -116,61 +116,64 @@ meta_finish_workspace_switch (MetaCompositor *compositor)
|
|
|
79df40 |
void
|
|
|
79df40 |
meta_switch_workspace_completed (MetaCompositor *compositor)
|
|
|
79df40 |
{
|
|
|
79df40 |
/* FIXME -- must redo stacking order */
|
|
|
79df40 |
compositor->switch_workspace_in_progress--;
|
|
|
79df40 |
if (compositor->switch_workspace_in_progress < 0)
|
|
|
79df40 |
{
|
|
|
79df40 |
g_warning ("Error in workspace_switch accounting!");
|
|
|
79df40 |
compositor->switch_workspace_in_progress = 0;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
if (!compositor->switch_workspace_in_progress)
|
|
|
79df40 |
meta_finish_workspace_switch (compositor);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
void
|
|
|
79df40 |
meta_compositor_destroy (MetaCompositor *compositor)
|
|
|
79df40 |
{
|
|
|
79df40 |
clutter_threads_remove_repaint_func (compositor->pre_paint_func_id);
|
|
|
79df40 |
clutter_threads_remove_repaint_func (compositor->post_paint_func_id);
|
|
|
79df40 |
|
|
|
79df40 |
if (compositor->have_x11_sync_object)
|
|
|
79df40 |
meta_sync_ring_destroy ();
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
static void
|
|
|
79df40 |
process_damage (MetaCompositor *compositor,
|
|
|
79df40 |
XDamageNotifyEvent *event,
|
|
|
79df40 |
MetaWindow *window)
|
|
|
79df40 |
{
|
|
|
79df40 |
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
|
|
|
79df40 |
+ MetaWindowActor *window_actor = meta_window_actor_from_window (window);
|
|
|
79df40 |
+
|
|
|
79df40 |
+ g_return_if_fail (window_actor);
|
|
|
79df40 |
+
|
|
|
79df40 |
meta_window_actor_process_x11_damage (window_actor, event);
|
|
|
79df40 |
|
|
|
79df40 |
compositor->frame_has_updated_xsurfaces = TRUE;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
/* compat helper */
|
|
|
79df40 |
static MetaCompositor *
|
|
|
79df40 |
get_compositor_for_screen (MetaScreen *screen)
|
|
|
79df40 |
{
|
|
|
79df40 |
return screen->display->compositor;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
/**
|
|
|
79df40 |
* meta_get_stage_for_screen:
|
|
|
79df40 |
* @screen: a #MetaScreen
|
|
|
79df40 |
*
|
|
|
79df40 |
* Returns: (transfer none): The #ClutterStage for the screen
|
|
|
79df40 |
*/
|
|
|
79df40 |
ClutterActor *
|
|
|
79df40 |
meta_get_stage_for_screen (MetaScreen *screen)
|
|
|
79df40 |
{
|
|
|
79df40 |
MetaCompositor *compositor = get_compositor_for_screen (screen);
|
|
|
79df40 |
return compositor->stage;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
/**
|
|
|
79df40 |
* meta_get_window_group_for_screen:
|
|
|
79df40 |
* @screen: a #MetaScreen
|
|
|
79df40 |
*
|
|
|
79df40 |
* Returns: (transfer none): The window group corresponding to @screen
|
|
|
79df40 |
@@ -707,135 +710,146 @@ meta_shape_cow_for_window (MetaCompositor *compositor,
|
|
|
79df40 |
meta_window_get_frame_rect (window, &rect);
|
|
|
79df40 |
|
|
|
79df40 |
window_bounds.x = rect.x;
|
|
|
79df40 |
window_bounds.y = rect.y;
|
|
|
79df40 |
window_bounds.width = rect.width;
|
|
|
79df40 |
window_bounds.height = rect.height;
|
|
|
79df40 |
|
|
|
79df40 |
meta_screen_get_size (display->screen, &width, &height);
|
|
|
79df40 |
screen_rect.x = 0;
|
|
|
79df40 |
screen_rect.y = 0;
|
|
|
79df40 |
screen_rect.width = width;
|
|
|
79df40 |
screen_rect.height = height;
|
|
|
79df40 |
|
|
|
79df40 |
output_region = XFixesCreateRegion (xdisplay, &window_bounds, 1);
|
|
|
79df40 |
|
|
|
79df40 |
XFixesInvertRegion (xdisplay, output_region, &screen_rect, output_region);
|
|
|
79df40 |
XFixesSetWindowShapeRegion (xdisplay, compositor->output, ShapeBounding, 0, 0, output_region);
|
|
|
79df40 |
XFixesDestroyRegion (xdisplay, output_region);
|
|
|
79df40 |
}
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
static void
|
|
|
79df40 |
set_unredirected_window (MetaCompositor *compositor,
|
|
|
79df40 |
MetaWindow *window)
|
|
|
79df40 |
{
|
|
|
79df40 |
if (compositor->unredirected_window == window)
|
|
|
79df40 |
return;
|
|
|
79df40 |
|
|
|
79df40 |
if (compositor->unredirected_window != NULL)
|
|
|
79df40 |
{
|
|
|
79df40 |
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (compositor->unredirected_window));
|
|
|
79df40 |
+ MetaWindowActor *window_actor =
|
|
|
79df40 |
+ meta_window_actor_from_window (compositor->unredirected_window);
|
|
|
79df40 |
meta_window_actor_set_unredirected (window_actor, FALSE);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
meta_shape_cow_for_window (compositor, window);
|
|
|
79df40 |
compositor->unredirected_window = window;
|
|
|
79df40 |
|
|
|
79df40 |
if (compositor->unredirected_window != NULL)
|
|
|
79df40 |
{
|
|
|
79df40 |
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (compositor->unredirected_window));
|
|
|
79df40 |
+ MetaWindowActor *window_actor =
|
|
|
79df40 |
+ meta_window_actor_from_window (compositor->unredirected_window);
|
|
|
79df40 |
meta_window_actor_set_unredirected (window_actor, TRUE);
|
|
|
79df40 |
}
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
void
|
|
|
79df40 |
meta_compositor_add_window (MetaCompositor *compositor,
|
|
|
79df40 |
MetaWindow *window)
|
|
|
79df40 |
{
|
|
|
79df40 |
MetaDisplay *display = compositor->display;
|
|
|
79df40 |
|
|
|
79df40 |
meta_error_trap_push (display);
|
|
|
79df40 |
|
|
|
79df40 |
meta_window_actor_new (window);
|
|
|
79df40 |
sync_actor_stacking (compositor);
|
|
|
79df40 |
|
|
|
79df40 |
meta_error_trap_pop (display);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
void
|
|
|
79df40 |
meta_compositor_remove_window (MetaCompositor *compositor,
|
|
|
79df40 |
MetaWindow *window)
|
|
|
79df40 |
{
|
|
|
79df40 |
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
|
|
|
79df40 |
+ MetaWindowActor *window_actor = meta_window_actor_from_window (window);
|
|
|
79df40 |
+
|
|
|
79df40 |
+ if (!window_actor)
|
|
|
79df40 |
+ return;
|
|
|
79df40 |
|
|
|
79df40 |
if (compositor->unredirected_window == window)
|
|
|
79df40 |
set_unredirected_window (compositor, NULL);
|
|
|
79df40 |
|
|
|
79df40 |
meta_window_actor_queue_destroy (window_actor);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
void
|
|
|
79df40 |
meta_compositor_sync_updates_frozen (MetaCompositor *compositor,
|
|
|
79df40 |
MetaWindow *window)
|
|
|
79df40 |
{
|
|
|
79df40 |
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
|
|
|
79df40 |
+ MetaWindowActor *window_actor = meta_window_actor_from_window (window);
|
|
|
79df40 |
+
|
|
|
79df40 |
+ g_return_if_fail (window_actor);
|
|
|
79df40 |
+
|
|
|
79df40 |
meta_window_actor_sync_updates_frozen (window_actor);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
void
|
|
|
79df40 |
meta_compositor_queue_frame_drawn (MetaCompositor *compositor,
|
|
|
79df40 |
MetaWindow *window,
|
|
|
79df40 |
gboolean no_delay_frame)
|
|
|
79df40 |
{
|
|
|
79df40 |
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
|
|
|
79df40 |
+ MetaWindowActor *window_actor = meta_window_actor_from_window (window);
|
|
|
79df40 |
+
|
|
|
79df40 |
+ g_return_if_fail (window_actor);
|
|
|
79df40 |
+
|
|
|
79df40 |
meta_window_actor_queue_frame_drawn (window_actor, no_delay_frame);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
void
|
|
|
79df40 |
meta_compositor_window_shape_changed (MetaCompositor *compositor,
|
|
|
79df40 |
MetaWindow *window)
|
|
|
79df40 |
{
|
|
|
79df40 |
- MetaWindowActor *window_actor;
|
|
|
79df40 |
- window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
|
|
|
79df40 |
+ MetaWindowActor *window_actor = meta_window_actor_from_window (window);
|
|
|
79df40 |
+
|
|
|
79df40 |
if (!window_actor)
|
|
|
79df40 |
return;
|
|
|
79df40 |
|
|
|
79df40 |
meta_window_actor_update_shape (window_actor);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
void
|
|
|
79df40 |
meta_compositor_window_opacity_changed (MetaCompositor *compositor,
|
|
|
79df40 |
MetaWindow *window)
|
|
|
79df40 |
{
|
|
|
79df40 |
- MetaWindowActor *window_actor;
|
|
|
79df40 |
- window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
|
|
|
79df40 |
+ MetaWindowActor *window_actor = meta_window_actor_from_window (window);
|
|
|
79df40 |
+
|
|
|
79df40 |
if (!window_actor)
|
|
|
79df40 |
return;
|
|
|
79df40 |
|
|
|
79df40 |
meta_window_actor_update_opacity (window_actor);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
void
|
|
|
79df40 |
meta_compositor_window_surface_changed (MetaCompositor *compositor,
|
|
|
79df40 |
MetaWindow *window)
|
|
|
79df40 |
{
|
|
|
79df40 |
MetaWindowActor *window_actor;
|
|
|
79df40 |
window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
|
|
|
79df40 |
if (!window_actor)
|
|
|
79df40 |
return;
|
|
|
79df40 |
|
|
|
79df40 |
meta_window_actor_update_surface (window_actor);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
/**
|
|
|
79df40 |
* meta_compositor_process_event: (skip)
|
|
|
79df40 |
* @compositor:
|
|
|
79df40 |
* @event:
|
|
|
79df40 |
* @window:
|
|
|
79df40 |
*
|
|
|
79df40 |
*/
|
|
|
79df40 |
gboolean
|
|
|
79df40 |
meta_compositor_process_event (MetaCompositor *compositor,
|
|
|
79df40 |
XEvent *event,
|
|
|
79df40 |
MetaWindow *window)
|
|
|
79df40 |
{
|
|
|
79df40 |
@@ -872,81 +886,91 @@ meta_compositor_process_event (MetaCompositor *compositor,
|
|
|
79df40 |
}
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
if (compositor->have_x11_sync_object)
|
|
|
79df40 |
meta_sync_ring_handle_event (event);
|
|
|
79df40 |
|
|
|
79df40 |
/* Clutter needs to know about MapNotify events otherwise it will
|
|
|
79df40 |
think the stage is invisible */
|
|
|
79df40 |
if (!meta_is_wayland_compositor () && event->type == MapNotify)
|
|
|
79df40 |
clutter_x11_handle_event (event);
|
|
|
79df40 |
|
|
|
79df40 |
/* The above handling is basically just "observing" the events, so we return
|
|
|
79df40 |
* FALSE to indicate that the event should not be filtered out; if we have
|
|
|
79df40 |
* GTK+ windows in the same process, GTK+ needs the ConfigureNotify event, for example.
|
|
|
79df40 |
*/
|
|
|
79df40 |
return FALSE;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
gboolean
|
|
|
79df40 |
meta_compositor_filter_keybinding (MetaCompositor *compositor,
|
|
|
79df40 |
MetaKeyBinding *binding)
|
|
|
79df40 |
{
|
|
|
79df40 |
return meta_plugin_manager_filter_keybinding (compositor->plugin_mgr, binding);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
void
|
|
|
79df40 |
meta_compositor_show_window (MetaCompositor *compositor,
|
|
|
79df40 |
MetaWindow *window,
|
|
|
79df40 |
MetaCompEffect effect)
|
|
|
79df40 |
{
|
|
|
79df40 |
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
|
|
|
79df40 |
+ MetaWindowActor *window_actor = meta_window_actor_from_window (window);
|
|
|
79df40 |
+
|
|
|
79df40 |
+ g_return_if_fail (window_actor);
|
|
|
79df40 |
+
|
|
|
79df40 |
meta_window_actor_show (window_actor, effect);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
void
|
|
|
79df40 |
meta_compositor_hide_window (MetaCompositor *compositor,
|
|
|
79df40 |
MetaWindow *window,
|
|
|
79df40 |
MetaCompEffect effect)
|
|
|
79df40 |
{
|
|
|
79df40 |
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
|
|
|
79df40 |
+ MetaWindowActor *window_actor = meta_window_actor_from_window (window);
|
|
|
79df40 |
+
|
|
|
79df40 |
+ if (!window_actor)
|
|
|
79df40 |
+ return;
|
|
|
79df40 |
+
|
|
|
79df40 |
meta_window_actor_hide (window_actor, effect);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
void
|
|
|
79df40 |
meta_compositor_size_change_window (MetaCompositor *compositor,
|
|
|
79df40 |
MetaWindow *window,
|
|
|
79df40 |
MetaSizeChange which_change,
|
|
|
79df40 |
MetaRectangle *old_frame_rect,
|
|
|
79df40 |
MetaRectangle *old_buffer_rect)
|
|
|
79df40 |
{
|
|
|
79df40 |
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
|
|
|
79df40 |
+ MetaWindowActor *window_actor = meta_window_actor_from_window (window);
|
|
|
79df40 |
+
|
|
|
79df40 |
+ g_return_if_fail (window_actor);
|
|
|
79df40 |
+
|
|
|
79df40 |
meta_window_actor_size_change (window_actor, which_change, old_frame_rect, old_buffer_rect);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
void
|
|
|
79df40 |
meta_compositor_switch_workspace (MetaCompositor *compositor,
|
|
|
79df40 |
MetaWorkspace *from,
|
|
|
79df40 |
MetaWorkspace *to,
|
|
|
79df40 |
MetaMotionDirection direction)
|
|
|
79df40 |
{
|
|
|
79df40 |
gint to_indx, from_indx;
|
|
|
79df40 |
|
|
|
79df40 |
to_indx = meta_workspace_index (to);
|
|
|
79df40 |
from_indx = meta_workspace_index (from);
|
|
|
79df40 |
|
|
|
79df40 |
compositor->switch_workspace_in_progress++;
|
|
|
79df40 |
|
|
|
79df40 |
if (!meta_plugin_manager_switch_workspace (compositor->plugin_mgr,
|
|
|
79df40 |
from_indx,
|
|
|
79df40 |
to_indx,
|
|
|
79df40 |
direction))
|
|
|
79df40 |
{
|
|
|
79df40 |
compositor->switch_workspace_in_progress--;
|
|
|
79df40 |
|
|
|
79df40 |
/* We have to explicitely call this to fix up stacking order of the
|
|
|
79df40 |
* actors; this is because the abs stacking position of actors does not
|
|
|
79df40 |
* necessarily change during the window hiding/unhiding, only their
|
|
|
79df40 |
* relative position toward the destkop window.
|
|
|
79df40 |
*/
|
|
|
79df40 |
meta_finish_workspace_switch (compositor);
|
|
|
79df40 |
}
|
|
|
79df40 |
@@ -1093,61 +1117,61 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
|
|
|
79df40 |
stack = g_list_copy (stack); /* The new stack of MetaWindow */
|
|
|
79df40 |
old_stack = g_list_reverse (compositor->windows); /* The old stack of MetaWindowActor */
|
|
|
79df40 |
compositor->windows = NULL;
|
|
|
79df40 |
|
|
|
79df40 |
while (TRUE)
|
|
|
79df40 |
{
|
|
|
79df40 |
MetaWindowActor *old_actor = NULL, *stack_actor = NULL, *actor;
|
|
|
79df40 |
MetaWindow *old_window = NULL, *stack_window = NULL, *window;
|
|
|
79df40 |
|
|
|
79df40 |
/* Find the remaining top actor in our existing stack (ignoring
|
|
|
79df40 |
* windows that have been hidden and are no longer animating) */
|
|
|
79df40 |
while (old_stack)
|
|
|
79df40 |
{
|
|
|
79df40 |
old_actor = old_stack->data;
|
|
|
79df40 |
old_window = meta_window_actor_get_meta_window (old_actor);
|
|
|
79df40 |
|
|
|
79df40 |
if ((old_window->hidden || old_window->unmanaging) &&
|
|
|
79df40 |
!meta_window_actor_effect_in_progress (old_actor))
|
|
|
79df40 |
{
|
|
|
79df40 |
old_stack = g_list_delete_link (old_stack, old_stack);
|
|
|
79df40 |
old_actor = NULL;
|
|
|
79df40 |
}
|
|
|
79df40 |
else
|
|
|
79df40 |
break;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
/* And the remaining top actor in the new stack */
|
|
|
79df40 |
while (stack)
|
|
|
79df40 |
{
|
|
|
79df40 |
stack_window = stack->data;
|
|
|
79df40 |
- stack_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (stack_window));
|
|
|
79df40 |
+ stack_actor = meta_window_actor_from_window (stack_window);
|
|
|
79df40 |
if (!stack_actor)
|
|
|
79df40 |
{
|
|
|
79df40 |
meta_verbose ("Failed to find corresponding MetaWindowActor "
|
|
|
79df40 |
"for window %s\n", meta_window_get_description (stack_window));
|
|
|
79df40 |
stack = g_list_delete_link (stack, stack);
|
|
|
79df40 |
}
|
|
|
79df40 |
else
|
|
|
79df40 |
break;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
if (!old_actor && !stack_actor) /* Nothing more to stack */
|
|
|
79df40 |
break;
|
|
|
79df40 |
|
|
|
79df40 |
/* We usually prefer the window in the new stack, but if if we
|
|
|
79df40 |
* found a hidden window in the process of being animated out
|
|
|
79df40 |
* of existence in the old stack we use that instead. We've
|
|
|
79df40 |
* filtered out non-animating hidden windows above.
|
|
|
79df40 |
*/
|
|
|
79df40 |
if (old_actor &&
|
|
|
79df40 |
(!stack_actor || old_window->hidden || old_window->unmanaging))
|
|
|
79df40 |
{
|
|
|
79df40 |
actor = old_actor;
|
|
|
79df40 |
window = old_window;
|
|
|
79df40 |
}
|
|
|
79df40 |
else
|
|
|
79df40 |
{
|
|
|
79df40 |
actor = stack_actor;
|
|
|
79df40 |
window = stack_window;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
@@ -1159,63 +1183,65 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
|
|
|
79df40 |
compositor->windows = g_list_prepend (compositor->windows, actor);
|
|
|
79df40 |
if (meta_window_actor_is_stereo (actor))
|
|
|
79df40 |
stereo_window_count++;
|
|
|
79df40 |
|
|
|
79df40 |
stack = g_list_remove (stack, window);
|
|
|
79df40 |
old_stack = g_list_remove (old_stack, actor);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
sync_actor_stacking (compositor);
|
|
|
79df40 |
|
|
|
79df40 |
meta_stereo_set_have_stereo_windows (stereo_window_count > 0);
|
|
|
79df40 |
|
|
|
79df40 |
if (compositor->top_window_actor)
|
|
|
79df40 |
g_signal_handlers_disconnect_by_func (compositor->top_window_actor,
|
|
|
79df40 |
on_top_window_actor_destroyed,
|
|
|
79df40 |
compositor);
|
|
|
79df40 |
|
|
|
79df40 |
compositor->top_window_actor = get_top_visible_window_actor (compositor);
|
|
|
79df40 |
|
|
|
79df40 |
if (compositor->top_window_actor)
|
|
|
79df40 |
g_signal_connect (compositor->top_window_actor, "destroy",
|
|
|
79df40 |
G_CALLBACK (on_top_window_actor_destroyed),
|
|
|
79df40 |
compositor);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
void
|
|
|
79df40 |
meta_compositor_sync_window_geometry (MetaCompositor *compositor,
|
|
|
79df40 |
MetaWindow *window,
|
|
|
79df40 |
gboolean did_placement)
|
|
|
79df40 |
{
|
|
|
79df40 |
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
|
|
|
79df40 |
+ MetaWindowActor *window_actor = meta_window_actor_from_window (window);
|
|
|
79df40 |
MetaWindowActorChanges changes;
|
|
|
79df40 |
|
|
|
79df40 |
+ g_return_if_fail (window_actor);
|
|
|
79df40 |
+
|
|
|
79df40 |
changes = meta_window_actor_sync_actor_geometry (window_actor, did_placement);
|
|
|
79df40 |
|
|
|
79df40 |
if (changes & META_WINDOW_ACTOR_CHANGE_SIZE)
|
|
|
79df40 |
meta_plugin_manager_event_size_changed (compositor->plugin_mgr, window_actor);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
static void
|
|
|
79df40 |
on_presented (ClutterStage *stage,
|
|
|
79df40 |
CoglFrameEvent event,
|
|
|
79df40 |
ClutterFrameInfo *frame_info,
|
|
|
79df40 |
MetaCompositor *compositor)
|
|
|
79df40 |
{
|
|
|
79df40 |
GList *l;
|
|
|
79df40 |
|
|
|
79df40 |
if (event == COGL_FRAME_EVENT_COMPLETE)
|
|
|
79df40 |
{
|
|
|
79df40 |
gint64 presentation_time_cogl = frame_info->presentation_time;
|
|
|
79df40 |
gint64 presentation_time;
|
|
|
79df40 |
|
|
|
79df40 |
if (presentation_time_cogl != 0)
|
|
|
79df40 |
{
|
|
|
79df40 |
/* Cogl reports presentation in terms of its own clock, which is
|
|
|
79df40 |
* guaranteed to be in nanoseconds but with no specified base. The
|
|
|
79df40 |
* normal case with the open source GPU drivers on Linux 3.8 and
|
|
|
79df40 |
* newer is that the base of cogl_get_clock_time() is that of
|
|
|
79df40 |
* clock_gettime(CLOCK_MONOTONIC), so the same as g_get_monotonic_time),
|
|
|
79df40 |
* but there's no exposure of that through the API. clock_gettime()
|
|
|
79df40 |
* is fairly fast, so calling it twice and subtracting to get a
|
|
|
79df40 |
* nearly-zero number is acceptable, if a litle ugly.
|
|
|
79df40 |
*/
|
|
|
79df40 |
@@ -1469,61 +1495,61 @@ meta_compositor_flash_screen (MetaCompositor *compositor,
|
|
|
79df40 |
|
|
|
79df40 |
clutter_actor_save_easing_state (flash);
|
|
|
79df40 |
clutter_actor_set_easing_mode (flash, CLUTTER_EASE_IN_QUAD);
|
|
|
79df40 |
clutter_actor_set_easing_duration (flash, FLASH_TIME_MS);
|
|
|
79df40 |
clutter_actor_set_opacity (flash, 192);
|
|
|
79df40 |
|
|
|
79df40 |
transition = clutter_actor_get_transition (flash, "opacity");
|
|
|
79df40 |
clutter_timeline_set_auto_reverse (CLUTTER_TIMELINE (transition), TRUE);
|
|
|
79df40 |
clutter_timeline_set_repeat_count (CLUTTER_TIMELINE (transition), 2);
|
|
|
79df40 |
|
|
|
79df40 |
g_signal_connect (transition, "stopped",
|
|
|
79df40 |
G_CALLBACK (flash_out_completed), flash);
|
|
|
79df40 |
|
|
|
79df40 |
clutter_actor_restore_easing_state (flash);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
static void
|
|
|
79df40 |
window_flash_out_completed (ClutterTimeline *timeline,
|
|
|
79df40 |
gboolean is_finished,
|
|
|
79df40 |
gpointer user_data)
|
|
|
79df40 |
{
|
|
|
79df40 |
ClutterActor *flash = CLUTTER_ACTOR (user_data);
|
|
|
79df40 |
clutter_actor_destroy (flash);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
void
|
|
|
79df40 |
meta_compositor_flash_window (MetaCompositor *compositor,
|
|
|
79df40 |
MetaWindow *window)
|
|
|
79df40 |
{
|
|
|
79df40 |
ClutterActor *window_actor =
|
|
|
79df40 |
- CLUTTER_ACTOR (meta_window_get_compositor_private (window));
|
|
|
79df40 |
+ CLUTTER_ACTOR (meta_window_actor_from_window (window));
|
|
|
79df40 |
ClutterActor *flash;
|
|
|
79df40 |
ClutterTransition *transition;
|
|
|
79df40 |
|
|
|
79df40 |
flash = clutter_actor_new ();
|
|
|
79df40 |
clutter_actor_set_background_color (flash, CLUTTER_COLOR_Black);
|
|
|
79df40 |
clutter_actor_set_size (flash, window->rect.width, window->rect.height);
|
|
|
79df40 |
clutter_actor_set_position (flash,
|
|
|
79df40 |
window->custom_frame_extents.left,
|
|
|
79df40 |
window->custom_frame_extents.top);
|
|
|
79df40 |
clutter_actor_set_opacity (flash, 0);
|
|
|
79df40 |
clutter_actor_add_child (window_actor, flash);
|
|
|
79df40 |
|
|
|
79df40 |
clutter_actor_save_easing_state (flash);
|
|
|
79df40 |
clutter_actor_set_easing_mode (flash, CLUTTER_EASE_IN_QUAD);
|
|
|
79df40 |
clutter_actor_set_easing_duration (flash, FLASH_TIME_MS);
|
|
|
79df40 |
clutter_actor_set_opacity (flash, 192);
|
|
|
79df40 |
|
|
|
79df40 |
transition = clutter_actor_get_transition (flash, "opacity");
|
|
|
79df40 |
clutter_timeline_set_auto_reverse (CLUTTER_TIMELINE (transition), TRUE);
|
|
|
79df40 |
clutter_timeline_set_repeat_count (CLUTTER_TIMELINE (transition), 2);
|
|
|
79df40 |
|
|
|
79df40 |
g_signal_connect (transition, "stopped",
|
|
|
79df40 |
G_CALLBACK (window_flash_out_completed), flash);
|
|
|
79df40 |
|
|
|
79df40 |
clutter_actor_restore_easing_state (flash);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
/**
|
|
|
79df40 |
* meta_compositor_monotonic_time_to_server_time:
|
|
|
79df40 |
* @display: a #MetaDisplay
|
|
|
79df40 |
--
|
|
|
79df40 |
2.26.2
|
|
|
79df40 |
|