Commit af14d9d2 authored by Elijah Newren's avatar Elijah Newren Committed by Elijah Newren
Browse files

Prevent rapidly repeated visual bells from hanging metacity. Fixes

2006-01-20  Elijah Newren  <newren gmail com>

	Prevent rapidly repeated visual bells from hanging metacity.
	Fixes #322032.

	* src/display.h (struct MetaDisplay): add a last_bell_time field,
	(XSERVER_TIME_IS_BEFORE_ASSUMING_REAL_TIMESTAMPS macro,
	XERVER_TIME_IS_BEFORE macro): add parentheses around usage of
	macro parameter

	* src/display.c (meta_display_open): initialize last_bell_time,
	(event_callback): don't allow more than one bell per second
parent 32d4bd6b
2006-01-20 Elijah Newren <newren gmail com>
Prevent rapidly repeated visual bells from hanging metacity.
Fixes #322032.
* src/display.h (struct MetaDisplay): add a last_bell_time field,
(XSERVER_TIME_IS_BEFORE_ASSUMING_REAL_TIMESTAMPS macro,
XERVER_TIME_IS_BEFORE macro): add parentheses around usage of
macro parameter
* src/display.c (meta_display_open): initialize last_bell_time,
(event_callback): don't allow more than one bell per second
2006-01-20 Elijah Newren <newren gmail com>
* src/async-getprop.c:
......
......@@ -514,6 +514,8 @@ meta_display_open (const char *name)
display->grab_resize_timeout_id = 0;
display->grab_have_keyboard = FALSE;
display->last_bell_time = 0;
display->grab_op = META_GRAB_OP_NONE;
display->grab_wireframe_active = FALSE;
display->grab_window = NULL;
......@@ -2366,7 +2368,12 @@ event_callback (XEvent *event,
switch (xkb_ev->xkb_type)
{
case XkbBellNotify:
meta_bell_notify (display, xkb_ev);
if (XSERVER_TIME_IS_BEFORE(display->last_bell_time,
xkb_ev->time - 1000))
{
display->last_bell_time = xkb_ev->time;
meta_bell_notify (display, xkb_ev);
}
break;
}
}
......
......@@ -286,6 +286,7 @@ struct _MetaDisplay
#ifdef HAVE_XKB
int xkb_base_event_type;
Time last_bell_time;
#endif
#ifdef HAVE_XSYNC
/* alarm monitoring client's _NET_WM_SYNC_REQUEST_COUNTER */
......@@ -381,13 +382,13 @@ struct _MetaDisplay
* the result.
*/
#define XSERVER_TIME_IS_BEFORE_ASSUMING_REAL_TIMESTAMPS(time1, time2) \
( (( time1 < time2 ) && ( time2 - time1 < ((guint32)-1)/2 )) || \
(( time1 > time2 ) && ( time1 - time2 > ((guint32)-1)/2 )) \
( (( (time1) < (time2) ) && ( (time2) - (time1) < ((guint32)-1)/2 )) || \
(( (time1) > (time2) ) && ( (time1) - (time2) > ((guint32)-1)/2 )) \
)
#define XSERVER_TIME_IS_BEFORE(time1, time2) \
( time1 == 0 || \
( (time1) == 0 || \
(XSERVER_TIME_IS_BEFORE_ASSUMING_REAL_TIMESTAMPS(time1, time2) && \
time2 != 0) \
(time2) != 0) \
)
gboolean meta_display_open (const char *name);
......
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