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
1=== modified file 'src/core/bell.c'
2--- src/core/bell.c 2010-01-17 18:41:59 +0000
3+++ src/core/bell.c 2010-02-01 02:02:14 +0000
4@@ -52,7 +52,6 @@
5 #include "bell.h"
6 #include "screen-private.h"
7 #include "prefs.h"
8-#include <canberra-gtk.h>
9
10 /**
11 * Flashes one entire screen. This is done by making a window the size of the
12@@ -281,52 +280,18 @@
13 /* flash something */
14 if (meta_prefs_get_visual_bell ())
15 bell_visual_notify (display, xkb_ev);
16-
17- if (meta_prefs_bell_is_audible ())
18- {
19- ca_proplist *p;
20- XkbBellNotifyEvent *xkb_bell_event = (XkbBellNotifyEvent*) xkb_ev;
21- MetaWindow *window;
22- int res;
23-
24- ca_proplist_create (&p);
25- ca_proplist_sets (p, CA_PROP_EVENT_ID, "bell-window-system");
26- ca_proplist_sets (p, CA_PROP_EVENT_DESCRIPTION, _("Bell event"));
27- ca_proplist_sets (p, CA_PROP_CANBERRA_CACHE_CONTROL, "permanent");
28-
29- window = meta_display_lookup_x_window (display, xkb_bell_event->window);
30- if (!window && (display->focus_window) && (display->focus_window->frame))
31- window = display->focus_window;
32-
33- if (window)
34- {
35- ca_proplist_sets (p, CA_PROP_WINDOW_NAME, window->title);
36- ca_proplist_setf (p, CA_PROP_WINDOW_X11_XID, "%lu", (unsigned long)window->xwindow);
37- ca_proplist_sets (p, CA_PROP_APPLICATION_NAME, window->res_name);
38- ca_proplist_setf (p, CA_PROP_APPLICATION_PROCESS_ID, "%d", window->net_wm_pid);
39- }
40-
41- /* First, we try to play a real sound ... */
42- res = ca_context_play_full (ca_gtk_context_get (), 1, p, NULL, NULL);
43-
44- ca_proplist_destroy (p);
45-
46- if (res != CA_SUCCESS && res != CA_ERROR_DISABLED)
47- {
48- /* ...and in case that failed we use the classic X11 bell. */
49- XkbForceDeviceBell (display->xdisplay,
50- xkb_bell_event->device,
51- xkb_bell_event->bell_class,
52- xkb_bell_event->bell_id,
53- xkb_bell_event->percent);
54- }
55- }
56 }
57 #endif /* HAVE_XKB */
58
59 void
60 meta_bell_set_audible (MetaDisplay *display, gboolean audible)
61 {
62+#ifdef HAVE_XKB
63+ XkbChangeEnabledControls (display->xdisplay,
64+ XkbUseCoreKbd,
65+ XkbAudibleBellMask,
66+ audible ? XkbAudibleBellMask : 0);
67+#endif
68 }
69
70 gboolean
71@@ -356,7 +321,8 @@
72 XkbChangeEnabledControls (display->xdisplay,
73 XkbUseCoreKbd,
74 XkbAudibleBellMask,
75- 0);
76+ meta_prefs_bell_is_audible ()
77+ ? XkbAudibleBellMask : 0);
78 if (visual_bell_auto_reset) {
79 XkbSetAutoResetControls (display->xdisplay,
80 XkbAudibleBellMask,

Subscribers

People subscribed via source and target branches