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
This commit is contained in:
parent
32d4bd6b63
commit
af14d9d2a1
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user