bell: Let the X11 caller deal with the X11 fallback
To support invoking the system bell on Wayland we shouldn't have paths that fallback to X11. Let the X11 caller deal with the absence of libcanberra, and change API to not take any X events. https://bugzilla.gnome.org/show_bug.cgi?id=763284
This commit is contained in:
parent
9f1d1151b7
commit
417cb2b213
@ -203,33 +203,18 @@ bell_audible_notify (MetaDisplay *display,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
gboolean
|
||||
meta_bell_notify (MetaDisplay *display,
|
||||
XkbAnyEvent *xkb_ev)
|
||||
MetaWindow *window)
|
||||
{
|
||||
MetaWindow *window;
|
||||
XkbBellNotifyEvent *xkb_bell_event = (XkbBellNotifyEvent*) xkb_ev;
|
||||
|
||||
window = meta_display_lookup_x_window (display, xkb_bell_event->window);
|
||||
if (!window && display->focus_window && display->focus_window->frame)
|
||||
window = display->focus_window;
|
||||
|
||||
/* flash something */
|
||||
if (meta_prefs_get_visual_bell ())
|
||||
bell_visual_notify (display, window);
|
||||
|
||||
if (meta_prefs_bell_is_audible ())
|
||||
{
|
||||
if (!bell_audible_notify (display, window))
|
||||
{
|
||||
/* Force a classic bell if the libcanberra bell failed. */
|
||||
XkbForceDeviceBell (display->xdisplay,
|
||||
xkb_bell_event->device,
|
||||
xkb_bell_event->bell_class,
|
||||
xkb_bell_event->bell_id,
|
||||
xkb_bell_event->percent);
|
||||
}
|
||||
}
|
||||
return bell_audible_notify (display, window);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -25,15 +25,14 @@
|
||||
/**
|
||||
* meta_bell_notify:
|
||||
* @display: The display the bell event came in on
|
||||
* @xkb_ev: The bell event we just received
|
||||
* @window: The window the bell event was received on
|
||||
*
|
||||
* Gives the user some kind of visual bell; in fact, this is our response
|
||||
* to any kind of bell request, but we set it up so that we only get
|
||||
* notified about visual bells, and X deals with audible ones.
|
||||
*
|
||||
* If the configure script found we had no XKB, this does not exist.
|
||||
* Gives the user some kind of aural or visual feedback, such as a bell sound
|
||||
* or flash. What type of feedback is invoked depends on the configuration.
|
||||
* If the aural feedback could not be invoked, FALSE is returned.
|
||||
*/
|
||||
void meta_bell_notify (MetaDisplay *display, XkbAnyEvent *xkb_ev);
|
||||
gboolean meta_bell_notify (MetaDisplay *display,
|
||||
MetaWindow *window);
|
||||
|
||||
/**
|
||||
* meta_bell_set_audible:
|
||||
|
@ -1162,6 +1162,30 @@ process_selection_clear (MetaDisplay *display,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
notify_bell (MetaDisplay *display,
|
||||
XkbAnyEvent *xkb_ev)
|
||||
{
|
||||
XkbBellNotifyEvent *xkb_bell_event = (XkbBellNotifyEvent*) xkb_ev;
|
||||
MetaWindow *window;
|
||||
|
||||
window = meta_display_lookup_x_window (display, xkb_bell_event->window);
|
||||
if (!window && display->focus_window && display->focus_window->frame)
|
||||
window = display->focus_window;
|
||||
|
||||
display->last_bell_time = xkb_ev->time;
|
||||
if (!meta_bell_notify (display, window) &&
|
||||
meta_prefs_bell_is_audible ())
|
||||
{
|
||||
/* Force a classic bell if the libcanberra bell failed. */
|
||||
XkbForceDeviceBell (display->xdisplay,
|
||||
xkb_bell_event->device,
|
||||
xkb_bell_event->bell_class,
|
||||
xkb_bell_event->bell_id,
|
||||
xkb_bell_event->percent);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
handle_other_xevent (MetaDisplay *display,
|
||||
XEvent *event)
|
||||
@ -1618,8 +1642,7 @@ handle_other_xevent (MetaDisplay *display,
|
||||
if (XSERVER_TIME_IS_BEFORE(display->last_bell_time,
|
||||
xkb_ev->time - 100))
|
||||
{
|
||||
display->last_bell_time = xkb_ev->time;
|
||||
meta_bell_notify (display, xkb_ev);
|
||||
notify_bell (display, xkb_ev);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user