Merge lp:~rschroll/metacity/system-bell into lp:~vcs-imports/metacity/master

Proposed by Robert Schroll
Status: Needs review
Proposed branch: lp:~rschroll/metacity/system-bell
Merge into: lp:~vcs-imports/metacity/master
Diff against target: 80 lines (+8/-42)
1 file modified
src/core/bell.c (+8/-42)
To merge this branch: bzr merge lp:~rschroll/metacity/system-bell
Reviewer Review Type Date Requested Status
VCS imports Pending
Review via email: mp+18357@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Robert Schroll (rschroll) wrote :

Removes Metacity's capability to play sounds for system bell events. This is a partial solution to the problems described in LP bug #486154. It contains the same changes as the patch which I attached to the bug. Note that Lucid will apparently have Pulse Audio's module-x11-bell loaded by default, which will provide this capability in a more configurable manner.

Unmerged revisions

3462. By Robert Schroll

Removed audible bell capability from src/core/bell.c

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/core/bell.c'
--- src/core/bell.c 2010-01-17 18:41:59 +0000
+++ src/core/bell.c 2010-02-01 02:02:14 +0000
@@ -52,7 +52,6 @@
52#include "bell.h"52#include "bell.h"
53#include "screen-private.h"53#include "screen-private.h"
54#include "prefs.h"54#include "prefs.h"
55#include <canberra-gtk.h>
5655
57/**56/**
58 * Flashes one entire screen. This is done by making a window the size of the57 * Flashes one entire screen. This is done by making a window the size of the
@@ -281,52 +280,18 @@
281 /* flash something */280 /* flash something */
282 if (meta_prefs_get_visual_bell ()) 281 if (meta_prefs_get_visual_bell ())
283 bell_visual_notify (display, xkb_ev);282 bell_visual_notify (display, xkb_ev);
284
285 if (meta_prefs_bell_is_audible ())
286 {
287 ca_proplist *p;
288 XkbBellNotifyEvent *xkb_bell_event = (XkbBellNotifyEvent*) xkb_ev;
289 MetaWindow *window;
290 int res;
291
292 ca_proplist_create (&p);
293 ca_proplist_sets (p, CA_PROP_EVENT_ID, "bell-window-system");
294 ca_proplist_sets (p, CA_PROP_EVENT_DESCRIPTION, _("Bell event"));
295 ca_proplist_sets (p, CA_PROP_CANBERRA_CACHE_CONTROL, "permanent");
296
297 window = meta_display_lookup_x_window (display, xkb_bell_event->window);
298 if (!window && (display->focus_window) && (display->focus_window->frame))
299 window = display->focus_window;
300
301 if (window)
302 {
303 ca_proplist_sets (p, CA_PROP_WINDOW_NAME, window->title);
304 ca_proplist_setf (p, CA_PROP_WINDOW_X11_XID, "%lu", (unsigned long)window->xwindow);
305 ca_proplist_sets (p, CA_PROP_APPLICATION_NAME, window->res_name);
306 ca_proplist_setf (p, CA_PROP_APPLICATION_PROCESS_ID, "%d", window->net_wm_pid);
307 }
308
309 /* First, we try to play a real sound ... */
310 res = ca_context_play_full (ca_gtk_context_get (), 1, p, NULL, NULL);
311
312 ca_proplist_destroy (p);
313
314 if (res != CA_SUCCESS && res != CA_ERROR_DISABLED)
315 {
316 /* ...and in case that failed we use the classic X11 bell. */
317 XkbForceDeviceBell (display->xdisplay,
318 xkb_bell_event->device,
319 xkb_bell_event->bell_class,
320 xkb_bell_event->bell_id,
321 xkb_bell_event->percent);
322 }
323 }
324}283}
325#endif /* HAVE_XKB */284#endif /* HAVE_XKB */
326285
327void286void
328meta_bell_set_audible (MetaDisplay *display, gboolean audible)287meta_bell_set_audible (MetaDisplay *display, gboolean audible)
329{288{
289#ifdef HAVE_XKB
290 XkbChangeEnabledControls (display->xdisplay,
291 XkbUseCoreKbd,
292 XkbAudibleBellMask,
293 audible ? XkbAudibleBellMask : 0);
294#endif
330}295}
331296
332gboolean297gboolean
@@ -356,7 +321,8 @@
356 XkbChangeEnabledControls (display->xdisplay,321 XkbChangeEnabledControls (display->xdisplay,
357 XkbUseCoreKbd,322 XkbUseCoreKbd,
358 XkbAudibleBellMask,323 XkbAudibleBellMask,
359 0);324 meta_prefs_bell_is_audible ()
325 ? XkbAudibleBellMask : 0);
360 if (visual_bell_auto_reset) {326 if (visual_bell_auto_reset) {
361 XkbSetAutoResetControls (display->xdisplay,327 XkbSetAutoResetControls (display->xdisplay,
362 XkbAudibleBellMask,328 XkbAudibleBellMask,

Subscribers

People subscribed via source and target branches