bell: add a composited flash-screen function
The old bell_flash_screen() has no effect when compositing. Add meta_compositor_flash_screen(), and use that instead. https://bugzilla.gnome.org/show_bug.cgi?id=639765
This commit is contained in:
parent
9f39a18fc5
commit
3597035f67
@ -1187,3 +1187,47 @@ meta_get_overlay_window (MetaScreen *screen)
|
||||
|
||||
return info->output;
|
||||
}
|
||||
|
||||
#define FLASH_TIME_MS 50
|
||||
|
||||
static void
|
||||
flash_out_completed (ClutterAnimation *animation,
|
||||
ClutterActor *flash)
|
||||
{
|
||||
clutter_actor_destroy (flash);
|
||||
}
|
||||
|
||||
static void
|
||||
flash_in_completed (ClutterAnimation *animation,
|
||||
ClutterActor *flash)
|
||||
{
|
||||
clutter_actor_animate (flash, CLUTTER_EASE_IN_QUAD,
|
||||
FLASH_TIME_MS,
|
||||
"opacity", 0,
|
||||
"signal-after::completed", flash_out_completed, flash,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
meta_compositor_flash_screen (MetaCompositor *compositor,
|
||||
MetaScreen *screen)
|
||||
{
|
||||
ClutterActor *stage;
|
||||
ClutterActor *flash;
|
||||
ClutterColor black = { 0, 0, 0, 255 };
|
||||
gfloat width, height;
|
||||
|
||||
stage = meta_get_stage_for_screen (screen);
|
||||
clutter_actor_get_size (stage, &width, &height);
|
||||
|
||||
flash = clutter_rectangle_new_with_color (&black);
|
||||
clutter_actor_set_size (flash, width, height);
|
||||
clutter_actor_set_opacity (flash, 0);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), flash);
|
||||
|
||||
clutter_actor_animate (flash, CLUTTER_EASE_OUT_QUAD,
|
||||
FLASH_TIME_MS,
|
||||
"opacity", 192,
|
||||
"signal-after::completed", flash_in_completed, flash,
|
||||
NULL);
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ bell_flash_screen (MetaDisplay *display,
|
||||
#ifdef HAVE_XKB
|
||||
static void
|
||||
bell_flash_fullscreen (MetaDisplay *display,
|
||||
XkbAnyEvent *xkb_ev)
|
||||
XkbAnyEvent *xkb_ev)
|
||||
{
|
||||
XkbBellNotifyEvent *xkb_bell_ev = (XkbBellNotifyEvent *) xkb_ev;
|
||||
MetaScreen *screen;
|
||||
@ -159,7 +159,12 @@ bell_flash_fullscreen (MetaDisplay *display,
|
||||
{
|
||||
screen = meta_display_screen_for_xwindow (display, xkb_bell_ev->window);
|
||||
if (screen)
|
||||
bell_flash_screen (display, screen);
|
||||
{
|
||||
if (display->compositor)
|
||||
meta_compositor_flash_screen (display->compositor, screen);
|
||||
else
|
||||
bell_flash_screen (display, screen);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -167,7 +172,10 @@ bell_flash_fullscreen (MetaDisplay *display,
|
||||
while (screen_list)
|
||||
{
|
||||
screen = (MetaScreen *) screen_list->data;
|
||||
bell_flash_screen (display, screen);
|
||||
if (display->compositor)
|
||||
meta_compositor_flash_screen (display->compositor, screen);
|
||||
else
|
||||
bell_flash_screen (display, screen);
|
||||
screen_list = screen_list->next;
|
||||
}
|
||||
}
|
||||
|
@ -160,4 +160,7 @@ void meta_compositor_sync_screen_size (MetaCompositor *compositor,
|
||||
guint width,
|
||||
guint height);
|
||||
|
||||
void meta_compositor_flash_screen (MetaCompositor *compositor,
|
||||
MetaScreen *screen);
|
||||
|
||||
#endif /* META_COMPOSITOR_H */
|
||||
|
Loading…
Reference in New Issue
Block a user