diff options
author | Perberos <[email protected]> | 2011-12-08 14:09:44 -0300 |
---|---|---|
committer | Perberos <[email protected]> | 2011-12-08 14:09:44 -0300 |
commit | 283de05cf3b8bed9dcde9e80875b860520de392a (patch) | |
tree | 0447d2c7e271ed05493794670fac0d6f05d0d475 /plugins/keyboard | |
parent | 81ea15d1ce166e69e7fff11c88e16c42d8db190d (diff) | |
download | mate-settings-daemon-283de05cf3b8bed9dcde9e80875b860520de392a.tar.bz2 mate-settings-daemon-283de05cf3b8bed9dcde9e80875b860520de392a.tar.xz |
GDK_DISPLAY() is deprecated
Diffstat (limited to 'plugins/keyboard')
-rw-r--r-- | plugins/keyboard/gsd-keyboard-manager.c | 73 | ||||
-rw-r--r-- | plugins/keyboard/gsd-keyboard-xkb.c | 46 | ||||
-rw-r--r-- | plugins/keyboard/gsd-keyboard-xkb.h | 10 |
3 files changed, 60 insertions, 69 deletions
diff --git a/plugins/keyboard/gsd-keyboard-manager.c b/plugins/keyboard/gsd-keyboard-manager.c index 343706d..24d6729 100644 --- a/plugins/keyboard/gsd-keyboard-manager.c +++ b/plugins/keyboard/gsd-keyboard-manager.c @@ -38,11 +38,12 @@ #include <gtk/gtk.h> #ifdef HAVE_X11_EXTENSIONS_XF86MISC_H -# include <X11/extensions/xf86misc.h> + #include <X11/extensions/xf86misc.h> #endif + #ifdef HAVE_X11_EXTENSIONS_XKB_H -#include <X11/XKBlib.h> -#include <X11/keysym.h> + #include <X11/XKBlib.h> + #include <X11/keysym.h> #endif #include "mate-settings-profile.h" @@ -51,10 +52,11 @@ #include "gsd-keyboard-xkb.h" #include "gsd-xmodmap.h" -#define GSD_KEYBOARD_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_KEYBOARD_MANAGER, GsdKeyboardManagerPrivate)) +#define GSD_KEYBOARD_MANAGER_GET_PRIVATE(o) \ + (G_TYPE_INSTANCE_GET_PRIVATE((o), GSD_TYPE_KEYBOARD_MANAGER, GsdKeyboardManagerPrivate)) #ifndef HOST_NAME_MAX -# define HOST_NAME_MAX 255 + #define HOST_NAME_MAX 255 #endif #define GSD_KEYBOARD_KEY "/desktop/mate/peripherals/keyboard" @@ -70,16 +72,15 @@ #define KEY_BELL_DURATION GSD_KEYBOARD_KEY "/bell_duration" #define KEY_BELL_MODE GSD_KEYBOARD_KEY "/bell_mode" -struct GsdKeyboardManagerPrivate -{ - gboolean have_xkb; - gint xkb_event_base; - guint notify; +struct GsdKeyboardManagerPrivate { + gboolean have_xkb; + gint xkb_event_base; + guint notify; }; -static void gsd_keyboard_manager_class_init (GsdKeyboardManagerClass *klass); -static void gsd_keyboard_manager_init (GsdKeyboardManager *keyboard_manager); -static void gsd_keyboard_manager_finalize (GObject *object); +static void gsd_keyboard_manager_class_init (GsdKeyboardManagerClass* klass); +static void gsd_keyboard_manager_init (GsdKeyboardManager* keyboard_manager); +static void gsd_keyboard_manager_finalize (GObject* object); G_DEFINE_TYPE (GsdKeyboardManager, gsd_keyboard_manager, G_TYPE_OBJECT) @@ -87,24 +88,23 @@ static gpointer manager_object = NULL; #ifdef HAVE_X11_EXTENSIONS_XF86MISC_H -static gboolean -xfree86_set_keyboard_autorepeat_rate (int delay, int rate) +static gboolean xfree86_set_keyboard_autorepeat_rate(int delay, int rate) { gboolean res = FALSE; int event_base_return; int error_base_return; - if (XF86MiscQueryExtension (GDK_DISPLAY (), + if (XF86MiscQueryExtension (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), &event_base_return, &error_base_return) == True) { /* load the current settings */ XF86MiscKbdSettings kbdsettings; - XF86MiscGetKbdSettings (GDK_DISPLAY (), &kbdsettings); + XF86MiscGetKbdSettings (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), &kbdsettings); /* assign the new values */ kbdsettings.delay = delay; kbdsettings.rate = rate; - XF86MiscSetKbdSettings (GDK_DISPLAY (), &kbdsettings); + XF86MiscSetKbdSettings (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), &kbdsettings); res = TRUE; } @@ -113,21 +113,20 @@ xfree86_set_keyboard_autorepeat_rate (int delay, int rate) #endif /* HAVE_X11_EXTENSIONS_XF86MISC_H */ #ifdef HAVE_X11_EXTENSIONS_XKB_H -static gboolean -xkb_set_keyboard_autorepeat_rate (int delay, int rate) +static gboolean xkb_set_keyboard_autorepeat_rate(int delay, int rate) { - int interval = (rate <= 0) ? 1000000 : 1000/rate; - if (delay <= 0) - delay = 1; - return XkbSetAutoRepeatRate (GDK_DISPLAY (), - XkbUseCoreKbd, - delay, - interval); + int interval = (rate <= 0) ? 1000000 : 1000/rate; + + if (delay <= 0) + { + delay = 1; + } + + return XkbSetAutoRepeatRate(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), XkbUseCoreKbd, delay, interval); } #endif -static char * -gsd_keyboard_get_hostname_key (const char *subkey) +static char* gsd_keyboard_get_hostname_key (const char *subkey) { char hostname[HOST_NAME_MAX + 1]; @@ -235,17 +234,17 @@ numlock_get_mateconf_state (MateConfClient *client) return curr_state; } -static void -numlock_set_mateconf_state (MateConfClient *client, - NumLockState new_state) +static void numlock_set_mateconf_state(MateConfClient *client, NumLockState new_state) { - char *key; + //printf("numlock_set_mateconf_state\n"); + char* key; if (new_state != NUMLOCK_STATE_ON && new_state != NUMLOCK_STATE_OFF) { return; } key = numlock_mateconf_state_key (); + if (key) { mateconf_client_set_bool (client, key, new_state, NULL); g_free (key); @@ -330,7 +329,7 @@ apply_settings (MateConfClient *client, if (repeat) { gboolean rate_set = FALSE; - XAutoRepeatOn (GDK_DISPLAY ()); + XAutoRepeatOn (GDK_DISPLAY_XDISPLAY(gdk_display_get_default())); /* Use XKB in preference */ #ifdef HAVE_X11_EXTENSIONS_XKB_H rate_set = xkb_set_keyboard_autorepeat_rate (delay, rate); @@ -343,7 +342,7 @@ apply_settings (MateConfClient *client, g_warning ("Neither XKeyboard not Xfree86's keyboard extensions are available,\n" "no way to support keyboard autorepeat rate settings"); } else { - XAutoRepeatOff (GDK_DISPLAY ()); + XAutoRepeatOff (GDK_DISPLAY_XDISPLAY(gdk_display_get_default())); } /* as percentage from 0..100 inclusive */ @@ -356,7 +355,7 @@ apply_settings (MateConfClient *client, kbdcontrol.bell_percent = bell_volume; kbdcontrol.bell_pitch = bell_pitch; kbdcontrol.bell_duration = bell_duration; - XChangeKeyboardControl (GDK_DISPLAY (), + XChangeKeyboardControl (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), KBKeyClickPercent | KBBellPercent | KBBellPitch | KBBellDuration, &kbdcontrol); @@ -366,7 +365,7 @@ apply_settings (MateConfClient *client, } #endif /* HAVE_X11_EXTENSIONS_XKB_H */ - XSync (GDK_DISPLAY (), FALSE); + XSync (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), FALSE); gdk_error_trap_pop (); } diff --git a/plugins/keyboard/gsd-keyboard-xkb.c b/plugins/keyboard/gsd-keyboard-xkb.c index 681c665..0808272 100644 --- a/plugins/keyboard/gsd-keyboard-xkb.c +++ b/plugins/keyboard/gsd-keyboard-xkb.c @@ -44,10 +44,10 @@ #define GTK_RESPONSE_PRINT 2 -static GsdKeyboardManager *manager = NULL; +static GsdKeyboardManager* manager = NULL; -static XklEngine *xkl_engine; -static XklConfigRegistry *xkl_registry = NULL; +static XklEngine* xkl_engine; +static XklConfigRegistry* xkl_registry = NULL; static MatekbdDesktopConfig current_config; static MatekbdKeyboardConfig current_kbd_config; @@ -63,47 +63,41 @@ static guint notify_keyboard = 0; static PostActivationCallback pa_callback = NULL; static void *pa_callback_user_data = NULL; -static const char KNOWN_FILES_KEY[] = - "/desktop/mate/peripherals/keyboard/general/known_file_list"; +static const char KNOWN_FILES_KEY[] = "/desktop/mate/peripherals/keyboard/general/known_file_list"; -static const char DISABLE_INDICATOR_KEY[] = - "/desktop/mate/peripherals/keyboard/general/disable_indicator"; +static const char DISABLE_INDICATOR_KEY[] = "/desktop/mate/peripherals/keyboard/general/disable_indicator"; -static const char DUPLICATE_LEDS_KEY[] = - "/desktop/mate/peripherals/keyboard/general/duplicate_leds"; +static const char DUPLICATE_LEDS_KEY[] = "/desktop/mate/peripherals/keyboard/general/duplicate_leds"; -static const char *mdm_keyboard_layout = NULL; +static const char* mdm_keyboard_layout = NULL; -static GtkStatusIcon *icon = NULL; +static GtkStatusIcon* icon = NULL; -static GHashTable *preview_dialogs = NULL; +static GHashTable* preview_dialogs = NULL; static Atom caps_lock; static Atom num_lock; static Atom scroll_lock; -static GtkStatusIcon *indicator_icons[3]; -static const gchar *indicator_on_icon_names[] = { +static GtkStatusIcon* indicator_icons[3]; +static const gchar* indicator_on_icon_names[] = { "kbd-scrolllock-on", "kbd-numlock-on", "kbd-capslock-on" }; -static const gchar *indicator_off_icon_names[] = { +static const gchar* indicator_off_icon_names[] = { "kbd-scrolllock-off", "kbd-numlock-off", "kbd-capslock-off" }; -#define noGSDKX +//#define noGSDKX #ifdef GSDKX static FILE *logfile; -static void -gsd_keyboard_log_appender (const char file[], - const char function[], - int level, const char format[], va_list args) +static void gsd_keyboard_log_appender(const char file[], const char function[], int level, const char format[], va_list args) { time_t now = time (NULL); fprintf (logfile, "[%08ld,%03d,%s:%s/] \t", now, @@ -116,8 +110,8 @@ gsd_keyboard_log_appender (const char file[], static void activation_error (void) { - char const *vendor = ServerVendor (GDK_DISPLAY ()); - int release = VendorRelease (GDK_DISPLAY ()); + char const *vendor = ServerVendor (GDK_DISPLAY_XDISPLAY(gdk_display_get_default())); + int release = VendorRelease (GDK_DISPLAY_XDISPLAY(gdk_display_get_default())); GtkWidget *dialog; gboolean badXFree430Release; @@ -212,7 +206,7 @@ static void popup_menu_show_layout () { GtkWidget *dialog; - XklEngine *engine = xkl_engine_get_instance (GDK_DISPLAY ()); + XklEngine *engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY(gdk_display_get_default())); XklState *xkl_state = xkl_engine_get_current_state (engine); gpointer p = g_hash_table_lookup (preview_dialogs, GINT_TO_POINTER @@ -258,7 +252,7 @@ popup_menu_set_group (GtkMenuItem * item, gpointer param) xkl_engine_save_state (engine, xkl_engine_get_current_window (engine), &st); -/* XSetInputFocus( GDK_DISPLAY(), cur, RevertToNone, CurrentTime );*/ +/* XSetInputFocus(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), cur, RevertToNone, CurrentTime );*/ } else { xkl_debug (150, "??? Enforcing the state %d for unknown window\n", @@ -737,7 +731,7 @@ gsd_keyboard_update_indicator_icons () { Bool state; int new_state, i; - Display *display = GDK_DISPLAY (); + Display *display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default()); XkbGetNamedIndicator (display, caps_lock, NULL, &state, NULL, NULL); new_state = state ? 1 : 0; @@ -780,7 +774,7 @@ gsd_keyboard_xkb_init (MateConfClient * client, GsdKeyboardManager * kbd_manager) { int i; - Display *display = GDK_DISPLAY (); + Display *display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default()); mate_settings_profile_start (NULL); gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), diff --git a/plugins/keyboard/gsd-keyboard-xkb.h b/plugins/keyboard/gsd-keyboard-xkb.h index 12b2846..41a50c6 100644 --- a/plugins/keyboard/gsd-keyboard-xkb.h +++ b/plugins/keyboard/gsd-keyboard-xkb.h @@ -30,13 +30,11 @@ #include <libxklavier/xklavier.h> #include "gsd-keyboard-manager.h" -void gsd_keyboard_xkb_init (MateConfClient *client, GsdKeyboardManager *manager); -void gsd_keyboard_xkb_shutdown (void); +void gsd_keyboard_xkb_init(MateConfClient* client, GsdKeyboardManager* manager); +void gsd_keyboard_xkb_shutdown(void); -typedef void (*PostActivationCallback) (void *userData); +typedef void (*PostActivationCallback) (void* userData); -void -gsd_keyboard_xkb_set_post_activation_callback (PostActivationCallback fun, - void *userData); +void gsd_keyboard_xkb_set_post_activation_callback(PostActivationCallback fun, void* userData); #endif |