Commit f8d62da2 authored by Florian Müllner's avatar Florian Müllner Committed by Marco Trevisan

bell: Always flash window instead of frame

Traditionally visual alerts were implemented by flashing the focus
window's frame. As that only works for windows that we decorate,
flashing the whole window was added as a fallback for client-decorated
windows.

However that introduces some confusing inconsistency, better to just
always flash the entire window.

#491
parent 303e02bd
......@@ -34,10 +34,8 @@
* function then checks what kind of visual flash you like, and calls either
* bell_flash_fullscreen()-- which calls bell_flash_screen() to do
* its work-- or bell_flash_frame(), which flashes the focussed window
* using bell_flash_window_frame(), unless there is no such window, in
* which case it flashes the screen instead. bell_flash_window_frame()
* flashes the frame and calls bell_unflash_frame() as a timeout to
* remove the flash.
* using bell_flash_window(), unless there is no such window, in
* which case it flashes the screen instead.
*
* The visual bell was the result of a discussion in Bugzilla here:
* <http://bugzilla.gnome.org/show_bug.cgi?id=99886>.
......@@ -135,62 +133,6 @@ bell_flash_fullscreen (MetaDisplay *display)
meta_compositor_flash_display (display->compositor, display);
}
/**
* bell_unflash_frame:
* @data: The frame to unflash, cast to a gpointer so it can go into
* a callback function.
*
* Makes a frame be not flashed; this is the timeout half of
* bell_flash_window_frame(). This is done simply by clearing the
* flash flag and queuing a redraw of the frame.
*
* If the configure script found we had no XKB, this does not exist.
*
* Returns: Always FALSE, so we don't get called again.
*/
/*
* Bug: This is the parallel to bell_flash_window_frame(), so it should
* really be called meta_bell_unflash_window_frame().
*/
static gboolean
bell_unflash_frame (gpointer data)
{
MetaFrame *frame = (MetaFrame *) data;
frame->is_flashing = 0;
meta_frame_queue_draw (frame);
return FALSE;
}
/**
* bell_flash_window_frame:
* @window: The window to flash
*
* Makes a frame flash and then return to normal shortly afterwards.
* This is done by setting a flag so that the theme
* code will temporarily draw the frame as focussed if it's unfocussed and
* vice versa, and then queueing a redraw. Lastly, we create a timeout so
* that the flag can be unset and the frame re-redrawn.
*
* If the configure script found we had no XKB, this does not exist.
*/
static void
bell_flash_window_frame (MetaWindow *window)
{
guint id;
g_assert (window->frame != NULL);
window->frame->is_flashing = 1;
meta_frame_queue_draw (window->frame);
/* Since this idle is added after the Clutter clock source, with
* the same priority, it will be executed after it as well, so
* we are guaranteed to get at least one frame drawn in the
* flashed state, no matter how loaded we are.
*/
id = g_timeout_add_full (META_PRIORITY_REDRAW, 100,
bell_unflash_frame, window->frame, NULL);
g_source_set_name_by_id (id, "[mutter] bell_unflash_frame");
}
static void
bell_flash_window (MetaWindow *window)
{
......@@ -209,9 +151,7 @@ static void
bell_flash_frame (MetaDisplay *display,
MetaWindow *window)
{
if (window && window->frame)
bell_flash_window_frame (window);
else if (window)
if (window)
bell_flash_window (window);
else
bell_flash_fullscreen (display);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment