~ubuntu-branches/ubuntu/oneiric/gnome-settings-daemon/oneiric-proposed

« back to all changes in this revision

Viewing changes to plugins/keyboard/gsd-keyboard-manager.c

  • Committer: Package Import Robot
  • Author(s): Rodrigo Moya
  • Date: 2011-09-19 17:05:48 UTC
  • mfrom: (1.1.51 upstream)
  • Revision ID: package-import@ubuntu.com-20110919170548-gegm8ewt6qf7v7lp
Tags: 3.1.92-0ubuntu1
* New upstream release
* debian/control:
  - Bump libcolord-dev build dependency
* debian/patches/00git_guard_against_division_by_0.patch:
* debian/patches/00git_dont_crash_if_session_not_ready.patch:
* debian/patches/00git_numlock_status.patch:
* debian/patches/00git_disconnect_callbacks.patch:
  - Remove upstream patches
* debian/patches/06_use_application_indicator.patch:
* debian/patches/16_use_synchronous_notifications.patch:
  - Rebased

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
#include <gdk/gdkx.h>
38
38
#include <gtk/gtk.h>
39
39
 
40
 
#ifdef HAVE_X11_EXTENSIONS_XKB_H
41
40
#include <X11/XKBlib.h>
42
41
#include <X11/keysym.h>
43
 
#endif
44
42
 
45
43
#include "gnome-settings-profile.h"
46
44
#include "gsd-keyboard-manager.h"
84
82
 
85
83
static gpointer manager_object = NULL;
86
84
 
87
 
#ifdef HAVE_X11_EXTENSIONS_XKB_H
88
85
static gboolean
89
86
xkb_set_keyboard_autorepeat_rate (guint delay, guint interval)
90
87
{
93
90
                                     delay,
94
91
                                     interval);
95
92
}
96
 
#endif
97
 
 
98
 
#ifdef HAVE_X11_EXTENSIONS_XKB_H
99
93
 
100
94
static void
101
95
numlock_xkb_init (GsdKeyboardManager *manager)
175
169
                               manager);
176
170
}
177
171
 
178
 
#endif /* HAVE_X11_EXTENSIONS_XKB_H */
179
 
 
180
172
static guint
181
173
_gsd_settings_get_uint (GSettings  *settings,
182
174
                        const char *key)
202
194
        int              bell_pitch;
203
195
        int              bell_duration;
204
196
        GsdBellMode      bell_mode;
205
 
#ifdef HAVE_X11_EXTENSIONS_XKB_H
206
197
        gboolean         rnumlock;
207
 
#endif /* HAVE_X11_EXTENSIONS_XKB_H */
208
198
 
209
199
        repeat        = g_settings_get_boolean  (settings, KEY_REPEAT);
210
200
        click         = g_settings_get_boolean  (settings, KEY_CLICK);
217
207
        bell_mode = g_settings_get_enum (settings, KEY_BELL_MODE);
218
208
        bell_volume   = (bell_mode == GSD_BELL_MODE_ON) ? 50 : 0;
219
209
 
220
 
#ifdef HAVE_X11_EXTENSIONS_XKB_H
221
210
        rnumlock      = g_settings_get_boolean  (settings, "remember-numlock-state");
222
 
#endif /* HAVE_X11_EXTENSIONS_XKB_H */
223
211
 
224
212
        gdk_error_trap_push ();
225
213
        if (repeat) {
227
215
 
228
216
                XAutoRepeatOn (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
229
217
                /* Use XKB in preference */
230
 
#ifdef HAVE_X11_EXTENSIONS_XKB_H
231
218
                rate_set = xkb_set_keyboard_autorepeat_rate (delay, interval);
232
 
#endif
 
219
 
233
220
                if (!rate_set)
234
221
                        g_warning ("Neither XKeyboard not Xfree86's keyboard extensions are available,\n"
235
222
                                   "no way to support keyboard autorepeat rate settings");
251
238
                                KBKeyClickPercent | KBBellPercent | KBBellPitch | KBBellDuration,
252
239
                                &kbdcontrol);
253
240
 
254
 
#ifdef HAVE_X11_EXTENSIONS_XKB_H
255
241
        if (manager->priv->have_xkb && rnumlock) {
256
242
                numlock_set_xkb_state (g_settings_get_enum (manager->priv->settings, KEY_NUMLOCK_STATE));
257
243
        }
258
 
#endif /* HAVE_X11_EXTENSIONS_XKB_H */
259
244
 
260
245
        XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE);
261
246
        gdk_error_trap_pop_ignored ();
280
265
        /* Essential - xkb initialization should happen before */
281
266
        gsd_keyboard_xkb_init (manager);
282
267
 
283
 
#ifdef HAVE_X11_EXTENSIONS_XKB_H
284
268
        numlock_xkb_init (manager);
285
 
#endif /* HAVE_X11_EXTENSIONS_XKB_H */
286
269
 
287
270
        /* apply current settings before we install the callback */
288
271
        gsd_keyboard_manager_apply_settings (manager);
290
273
        g_signal_connect (G_OBJECT (manager->priv->settings), "changed",
291
274
                          G_CALLBACK (apply_settings), manager);
292
275
 
293
 
#ifdef HAVE_X11_EXTENSIONS_XKB_H
294
276
        numlock_install_xkb_callback (manager);
295
 
#endif /* HAVE_X11_EXTENSIONS_XKB_H */
296
277
 
297
278
        gnome_settings_profile_end (NULL);
298
279
 
326
307
                p->settings = NULL;
327
308
        }
328
309
 
329
 
#if HAVE_X11_EXTENSIONS_XKB_H
330
310
        if (p->have_xkb) {
331
311
                gdk_window_remove_filter (NULL,
332
312
                                          numlock_xkb_callback,
333
313
                                          manager);
334
314
        }
335
 
#endif /* HAVE_X11_EXTENSIONS_XKB_H */
336
315
 
337
316
        gsd_keyboard_xkb_shutdown ();
338
317
}