From 4b5e158ec247637b2b702cd516dd526da793700e Mon Sep 17 00:00:00 2001 From: Leena Gunda Date: Tue, 22 Jun 2004 09:09:19 +0000 Subject: [PATCH] set sensitivity of audible/visual bell options only if XKB enabled. 2004-06-22 Leena Gunda * sound-properties-capplet.c: (create_dialog): set sensitivity of audible/visual bell options only if XKB enabled. (CheckXKB): function to check if XKB support available. Fixes bug #144090 --- capplets/sound/ChangeLog | 8 ++++++ capplets/sound/sound-properties-capplet.c | 32 +++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/capplets/sound/ChangeLog b/capplets/sound/ChangeLog index 803588c78..d527a0151 100644 --- a/capplets/sound/ChangeLog +++ b/capplets/sound/ChangeLog @@ -1,3 +1,11 @@ +2004-06-22 Leena Gunda + + * sound-properties-capplet.c: + (create_dialog): set sensitivity of audible/visual bell + options only if XKB enabled. + (CheckXKB): function to check if XKB support available. + Fixes bug #144090 + 2004-04-15 Jody Goldberg * Release 2.6.1 diff --git a/capplets/sound/sound-properties-capplet.c b/capplets/sound/sound-properties-capplet.c index 5beaac949..ca2fe82d3 100644 --- a/capplets/sound/sound-properties-capplet.c +++ b/capplets/sound/sound-properties-capplet.c @@ -28,6 +28,12 @@ #include #include +#include +#include +#include +#include +#include + #include "capplet-util.h" #include "gconf-property-editor.h" #include "libsounds/sound-view.h" @@ -51,6 +57,24 @@ static SoundProperties *props = NULL; +static gboolean +CheckXKB (void) +{ + gboolean have_xkb = FALSE; + Display *dpy; + int opcode, errorBase, major, minor, xkbEventBase; + + gdk_error_trap_push (); + dpy = GDK_DISPLAY (); + have_xkb = XkbQueryExtension (dpy, &opcode, &xkbEventBase, + &errorBase, &major, &minor) + && XkbUseExtension (dpy, &major, &minor); + XSync (dpy, FALSE); + gdk_error_trap_pop (); + + return have_xkb; +} + static void props_changed_cb (SoundProperties *p, SoundEvent *event, gpointer data) { @@ -128,6 +152,14 @@ create_dialog (void) gtk_widget_set_size_request (widget, -1, 250); /* Can this be right? Seems broken for large fonts. */ + if (!CheckXKB()) { + GtkWidget *audible_bell_option = WID ("bell_audible_toggle"); + GtkWidget *visual_bell_option = WID ("bell_visual_toggle"); + + gtk_widget_set_sensitive (audible_bell_option, FALSE); + gtk_widget_set_sensitive (visual_bell_option, FALSE); + } + return dialog; }