1
0
Fork 0

bell: Flash whole window if the window had no frame

CSD X11 clients and Wayland clients don't have a window frame drawn by
the compositor to flash. So instead of flashing the whole screen when
configured to just flash the window, flash just the window region.

https://bugzilla.gnome.org/show_bug.cgi?id=763284
This commit is contained in:
Jonas Ådahl 2016-03-08 12:10:21 +08:00
parent 4af908a970
commit 99bba9e56c
3 changed files with 53 additions and 1 deletions

View file

@ -60,4 +60,7 @@ void meta_end_modal_for_plugin (MetaCompositor *compositor,
gint64 meta_compositor_monotonic_time_to_server_time (MetaDisplay *display, gint64 meta_compositor_monotonic_time_to_server_time (MetaDisplay *display,
gint64 monotonic_time); gint64 monotonic_time);
void meta_compositor_flash_window (MetaCompositor *compositor,
MetaWindow *window);
#endif /* META_COMPOSITOR_PRIVATE_H */ #endif /* META_COMPOSITOR_PRIVATE_H */

View file

@ -1249,6 +1249,48 @@ meta_compositor_flash_screen (MetaCompositor *compositor,
clutter_actor_restore_easing_state (flash); clutter_actor_restore_easing_state (flash);
} }
static void
window_flash_out_completed (ClutterTimeline *timeline,
gboolean is_finished,
gpointer user_data)
{
ClutterActor *flash = CLUTTER_ACTOR (user_data);
clutter_actor_destroy (flash);
}
void
meta_compositor_flash_window (MetaCompositor *compositor,
MetaWindow *window)
{
ClutterActor *window_actor =
CLUTTER_ACTOR (meta_window_get_compositor_private (window));
ClutterActor *flash;
ClutterTransition *transition;
flash = clutter_actor_new ();
clutter_actor_set_background_color (flash, CLUTTER_COLOR_Black);
clutter_actor_set_size (flash, window->rect.width, window->rect.height);
clutter_actor_set_position (flash,
window->custom_frame_extents.left,
window->custom_frame_extents.top);
clutter_actor_set_opacity (flash, 0);
clutter_actor_add_child (window_actor, flash);
clutter_actor_save_easing_state (flash);
clutter_actor_set_easing_mode (flash, CLUTTER_EASE_IN_QUAD);
clutter_actor_set_easing_duration (flash, FLASH_TIME_MS);
clutter_actor_set_opacity (flash, 192);
transition = clutter_actor_get_transition (flash, "opacity");
clutter_timeline_set_auto_reverse (CLUTTER_TIMELINE (transition), TRUE);
clutter_timeline_set_repeat_count (CLUTTER_TIMELINE (transition), 2);
g_signal_connect (transition, "stopped",
G_CALLBACK (window_flash_out_completed), flash);
clutter_actor_restore_easing_state (flash);
}
/** /**
* meta_compositor_monotonic_time_to_server_time: * meta_compositor_monotonic_time_to_server_time:
* @display: a #MetaDisplay * @display: a #MetaDisplay

View file

@ -52,6 +52,7 @@
#include "screen-private.h" #include "screen-private.h"
#include "window-private.h" #include "window-private.h"
#include "util-private.h" #include "util-private.h"
#include "compositor/compositor-private.h"
#include <meta/prefs.h> #include <meta/prefs.h>
#include <meta/compositor.h> #include <meta/compositor.h>
#ifdef HAVE_LIBCANBERRA #ifdef HAVE_LIBCANBERRA
@ -131,6 +132,12 @@ bell_flash_window_frame (MetaWindow *window)
g_source_set_name_by_id (id, "[mutter] bell_unflash_frame"); g_source_set_name_by_id (id, "[mutter] bell_unflash_frame");
} }
static void
bell_flash_window (MetaWindow *window)
{
meta_compositor_flash_window (window->display->compositor, window);
}
/** /**
* bell_flash_frame: * bell_flash_frame:
* @display: The display the bell event came in on * @display: The display the bell event came in on
@ -146,7 +153,7 @@ bell_flash_frame (MetaDisplay *display,
if (window && window->frame) if (window && window->frame)
bell_flash_window_frame (window); bell_flash_window_frame (window);
else else
bell_flash_fullscreen (display); bell_flash_window (window);
} }
/** /**