diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c | 20 | ||||
-rw-r--r-- | plugins/background/gsd-background-manager.c | 8 | ||||
-rw-r--r-- | plugins/common/gsd-keygrab.c | 4 | ||||
-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 | ||||
-rw-r--r-- | plugins/media-keys/gsd-media-keys-manager.c | 93 | ||||
-rw-r--r-- | plugins/mouse/gsd-mouse-manager.c | 90 | ||||
-rw-r--r-- | plugins/xrdb/gsd-xrdb-manager.c | 7 |
9 files changed, 174 insertions, 177 deletions
diff --git a/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c index ac75491..668fddc 100644 --- a/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c +++ b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c @@ -125,7 +125,7 @@ supports_xinput_devices (void) { gint op_code, event, error; - return XQueryExtension (GDK_DISPLAY (), + return XQueryExtension (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), "XInputExtension", &op_code, &event, @@ -166,13 +166,13 @@ xkb_enabled (GsdA11yKeyboardManager *manager) gboolean have_xkb; int opcode, errorBase, major, minor; - have_xkb = XkbQueryExtension (GDK_DISPLAY (), + have_xkb = XkbQueryExtension (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), &opcode, &manager->priv->xkbEventBase, &errorBase, &major, &minor) - && XkbUseExtension (GDK_DISPLAY (), &major, &minor); + && XkbUseExtension (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), &major, &minor); return have_xkb; } @@ -184,10 +184,10 @@ get_xkb_desc_rec (GsdA11yKeyboardManager *manager) Status status = Success; gdk_error_trap_push (); - desc = XkbGetMap (GDK_DISPLAY (), XkbAllMapComponentsMask, XkbUseCoreKbd); + desc = XkbGetMap (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), XkbAllMapComponentsMask, XkbUseCoreKbd); if (desc != NULL) { desc->ctrls = NULL; - status = XkbGetControls (GDK_DISPLAY (), XkbAllControlsMask, desc); + status = XkbGetControls (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), XkbAllControlsMask, desc); } gdk_error_trap_pop (); @@ -383,7 +383,7 @@ set_server_from_mateconf (GsdA11yKeyboardManager *manager, */ gdk_error_trap_push (); - XkbSetControls (GDK_DISPLAY (), + XkbSetControls (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), XkbSlowKeysMask | XkbBounceKeysMask | XkbStickyKeysMask | @@ -397,7 +397,7 @@ set_server_from_mateconf (GsdA11yKeyboardManager *manager, XkbFreeKeyboard (desc, XkbAllComponentsMask, True); - XSync (GDK_DISPLAY (), FALSE); + XSync (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), FALSE); gdk_error_trap_pop (); mate_settings_profile_end (NULL); @@ -1085,7 +1085,7 @@ start_a11y_keyboard_idle_cb (GsdA11yKeyboardManager *manager) set_server_from_mateconf (manager, client); g_object_unref (client); - XkbSelectEvents (GDK_DISPLAY (), + XkbSelectEvents (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), XkbUseCoreKbd, event_mask, event_mask); @@ -1120,7 +1120,7 @@ static void restore_server_xkb_config (GsdA11yKeyboardManager *manager) { gdk_error_trap_push (); - XkbSetControls (GDK_DISPLAY (), + XkbSetControls (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), XkbSlowKeysMask | XkbBounceKeysMask | XkbStickyKeysMask | @@ -1135,7 +1135,7 @@ restore_server_xkb_config (GsdA11yKeyboardManager *manager) XkbFreeKeyboard (manager->priv->original_xkb_desc, XkbAllComponentsMask, True); - XSync (GDK_DISPLAY (), FALSE); + XSync (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), FALSE); gdk_error_trap_pop (); manager->priv->original_xkb_desc = NULL; diff --git a/plugins/background/gsd-background-manager.c b/plugins/background/gsd-background-manager.c index 8c42445..c05ec3f 100644 --- a/plugins/background/gsd-background-manager.c +++ b/plugins/background/gsd-background-manager.c @@ -84,14 +84,14 @@ caja_is_running (void) gboolean running; gint error; - window_id_atom = XInternAtom (GDK_DISPLAY (), + window_id_atom = XInternAtom (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), "CAJA_DESKTOP_WINDOW_ID", True); if (window_id_atom == None) { return FALSE; } - retval = XGetWindowProperty (GDK_DISPLAY (), + retval = XGetWindowProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), GDK_ROOT_WINDOW (), window_id_atom, 0, @@ -118,11 +118,11 @@ caja_is_running (void) return FALSE; } - wmclass_atom = XInternAtom (GDK_DISPLAY (), "WM_CLASS", False); + wmclass_atom = XInternAtom (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), "WM_CLASS", False); gdk_error_trap_push (); - retval = XGetWindowProperty (GDK_DISPLAY (), + retval = XGetWindowProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), caja_xid, wmclass_atom, 0, diff --git a/plugins/common/gsd-keygrab.c b/plugins/common/gsd-keygrab.c index 7d70665..d94fd29 100644 --- a/plugins/common/gsd-keygrab.c +++ b/plugins/common/gsd-keygrab.c @@ -74,7 +74,7 @@ grab_key_real (guint keycode, int mask) { if (grab) { - XGrabKey (GDK_DISPLAY (), + XGrabKey (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), keycode, mask, GDK_WINDOW_XID (root), @@ -82,7 +82,7 @@ grab_key_real (guint keycode, GrabModeAsync, GrabModeAsync); } else { - XUngrabKey (GDK_DISPLAY (), + XUngrabKey (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), keycode, mask, GDK_WINDOW_XID (root)); 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 diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c index ae6383a..ae7d3e2 100644 --- a/plugins/media-keys/gsd-media-keys-manager.c +++ b/plugins/media-keys/gsd-media-keys-manager.c @@ -327,60 +327,67 @@ update_kbd_cb (MateConfClient *client, g_warning ("Grab failed for some keys, another application may already have access the them."); } -static void -init_kbd (GsdMediaKeysManager *manager) +static void init_kbd(GsdMediaKeysManager* manager) { - int i; - gboolean need_flush = FALSE; + int i; + gboolean need_flush = FALSE; - mate_settings_profile_start (NULL); + mate_settings_profile_start(NULL); - gdk_error_trap_push (); + gdk_error_trap_push(); - for (i = 0; i < HANDLED_KEYS; i++) { - char *tmp; - Key *key; - - manager->priv->notify[i] = - mateconf_client_notify_add (manager->priv->conf_client, - keys[i].mateconf_key, - (MateConfClientNotifyFunc) update_kbd_cb, - manager, - NULL, - NULL); - - tmp = mateconf_client_get_string (manager->priv->conf_client, - keys[i].mateconf_key, - NULL); + for (i = 0; i < HANDLED_KEYS; i++) + { + char* tmp; + Key* key; - if (!is_valid_shortcut (tmp)) { - g_debug ("Not a valid shortcut: '%s'", tmp); - g_free (tmp); - continue; - } + manager->priv->notify[i] = mateconf_client_notify_add(manager->priv->conf_client, + keys[i].mateconf_key, + (MateConfClientNotifyFunc) update_kbd_cb, + manager, + NULL, + NULL); - key = g_new0 (Key, 1); - if (!egg_accelerator_parse_virtual (tmp, &key->keysym, &key->keycodes, &key->state)) { - g_debug ("Unable to parse: '%s'", tmp); - g_free (tmp); - g_free (key); - continue; - } + tmp = mateconf_client_get_string(manager->priv->conf_client, + keys[i].mateconf_key, + NULL); - g_free (tmp); + if (!is_valid_shortcut(tmp)) + { + g_debug("Not a valid shortcut: '%s'", tmp); + g_free(tmp); + continue; + } - keys[i].key = key; + key = g_new0(Key, 1); - need_flush = TRUE; - grab_key_unsafe (key, TRUE, manager->priv->screens); - } + if (!egg_accelerator_parse_virtual(tmp, &key->keysym, &key->keycodes, &key->state)) + { + g_debug("Unable to parse: '%s'", tmp); + g_free(tmp); + g_free(key); + continue; + } - if (need_flush) - gdk_flush (); - if (gdk_error_trap_pop ()) - g_warning ("Grab failed for some keys, another application may already have access the them."); + g_free(tmp); - mate_settings_profile_end (NULL); + keys[i].key = key; + + need_flush = TRUE; + grab_key_unsafe(key, TRUE, manager->priv->screens); + } + + if (need_flush) + { + gdk_flush(); + } + + if (gdk_error_trap_pop ()) + { + g_warning("Grab failed for some keys, another application may already have access the them."); + } + + mate_settings_profile_end(NULL); } static void diff --git a/plugins/mouse/gsd-mouse-manager.c b/plugins/mouse/gsd-mouse-manager.c index 124653a..d843314 100644 --- a/plugins/mouse/gsd-mouse-manager.c +++ b/plugins/mouse/gsd-mouse-manager.c @@ -178,7 +178,7 @@ supports_xinput_devices (void) { gint op_code, event, error; - return XQueryExtension (GDK_DISPLAY (), + return XQueryExtension (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), "XInputExtension", &op_code, &event, @@ -276,12 +276,12 @@ touchpad_has_single_button (XDevice *device) gboolean is_single_button = FALSE; int rc; - prop = XInternAtom (GDK_DISPLAY (), "Synaptics Capabilities", False); + prop = XInternAtom (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), "Synaptics Capabilities", False); if (!prop) return FALSE; gdk_error_trap_push (); - rc = XGetDeviceProperty (GDK_DISPLAY (), device, prop, 0, 1, False, + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device, prop, 0, 1, False, XA_INTEGER, &type, &format, &nitems, &bytes_after, &data); if (rc == Success && type == XA_INTEGER && format == 8 && nitems >= 3) @@ -306,7 +306,7 @@ set_xinput_devices_left_handed (gboolean left_handed) gint n_buttons; gint i; - device_info = XListInputDevices (GDK_DISPLAY (), &n_devices); + device_info = XListInputDevices (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), &n_devices); if (n_devices > 0) buttons = g_new (guchar, buttons_capacity); @@ -331,7 +331,7 @@ set_xinput_devices_left_handed (gboolean left_handed) if (tap && !single_button) set_tap_to_click (tap, left_handed); - XCloseDevice (GDK_DISPLAY (), device); + XCloseDevice (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device); g_object_unref (client); if (single_button) @@ -340,13 +340,13 @@ set_xinput_devices_left_handed (gboolean left_handed) gdk_error_trap_push (); - device = XOpenDevice (GDK_DISPLAY (), device_info[i].id); + device = XOpenDevice (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device_info[i].id); if ((gdk_error_trap_pop () != 0) || (device == NULL)) continue; - n_buttons = XGetDeviceButtonMapping (GDK_DISPLAY (), device, + n_buttons = XGetDeviceButtonMapping (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device, buttons, buttons_capacity); @@ -355,15 +355,15 @@ set_xinput_devices_left_handed (gboolean left_handed) buttons = (guchar *) g_realloc (buttons, buttons_capacity * sizeof (guchar)); - n_buttons = XGetDeviceButtonMapping (GDK_DISPLAY (), device, + n_buttons = XGetDeviceButtonMapping (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device, buttons, buttons_capacity); } configure_button_layout (buttons, n_buttons, left_handed); - XSetDeviceButtonMapping (GDK_DISPLAY (), device, buttons, n_buttons); - XCloseDevice (GDK_DISPLAY (), device); + XSetDeviceButtonMapping (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device, buttons, n_buttons); + XCloseDevice (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device); } g_free (buttons); @@ -434,7 +434,7 @@ set_left_handed (GsdMouseManager *manager, #endif buttons = g_new (guchar, buttons_capacity); - n_buttons = XGetPointerMapping (GDK_DISPLAY (), + n_buttons = XGetPointerMapping (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), buttons, (gint) buttons_capacity); while (n_buttons > buttons_capacity) { @@ -442,7 +442,7 @@ set_left_handed (GsdMouseManager *manager, buttons = (guchar *) g_realloc (buttons, buttons_capacity * sizeof (guchar)); - n_buttons = XGetPointerMapping (GDK_DISPLAY (), + n_buttons = XGetPointerMapping (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), buttons, (gint) buttons_capacity); } @@ -453,7 +453,7 @@ set_left_handed (GsdMouseManager *manager, * so if this is the case we'll retry a few times */ for (i = 0; - i < 20 && XSetPointerMapping (GDK_DISPLAY (), buttons, n_buttons) == MappingBusy; + i < 20 && XSetPointerMapping (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), buttons, n_buttons) == MappingBusy; ++i) { g_usleep (300); } @@ -492,7 +492,7 @@ set_motion_acceleration (GsdMouseManager *manager, denominator = -1; } - XChangePointerControl (GDK_DISPLAY (), True, False, + XChangePointerControl (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), True, False, numerator, denominator, 0); } @@ -501,7 +501,7 @@ static void set_motion_threshold (GsdMouseManager *manager, int motion_threshold) { - XChangePointerControl (GDK_DISPLAY (), False, True, + XChangePointerControl (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), False, True, 0, 0, motion_threshold); } @@ -515,20 +515,20 @@ device_is_touchpad (XDeviceInfo deviceinfo) unsigned long nitems, bytes_after; unsigned char *data; - if (deviceinfo.type != XInternAtom (GDK_DISPLAY (), XI_TOUCHPAD, False)) + if (deviceinfo.type != XInternAtom (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), XI_TOUCHPAD, False)) return NULL; - prop = XInternAtom (GDK_DISPLAY (), "Synaptics Off", False); + prop = XInternAtom (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), "Synaptics Off", False); if (!prop) return NULL; gdk_error_trap_push (); - device = XOpenDevice (GDK_DISPLAY (), deviceinfo.id); + device = XOpenDevice (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), deviceinfo.id); if (gdk_error_trap_pop () || (device == NULL)) return NULL; gdk_error_trap_push (); - if ((XGetDeviceProperty (GDK_DISPLAY (), device, prop, 0, 1, False, + if ((XGetDeviceProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device, prop, 0, 1, False, XA_INTEGER, &realtype, &realformat, &nitems, &bytes_after, &data) == Success) && (realtype != None)) { gdk_error_trap_pop (); @@ -537,7 +537,7 @@ device_is_touchpad (XDeviceInfo deviceinfo) } gdk_error_trap_pop (); - XCloseDevice (GDK_DISPLAY (), device); + XCloseDevice (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device); return NULL; } #endif @@ -592,7 +592,7 @@ set_tap_to_click (gboolean state, gboolean left_handed) { int numdevices, i, format, rc; unsigned long nitems, bytes_after; - XDeviceInfo *devicelist = XListInputDevices (GDK_DISPLAY (), &numdevices); + XDeviceInfo *devicelist = XListInputDevices (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), &numdevices); XDevice * device; unsigned char* data; Atom prop, type; @@ -600,7 +600,7 @@ set_tap_to_click (gboolean state, gboolean left_handed) if (devicelist == NULL) return 0; - prop = XInternAtom (GDK_DISPLAY (), "Synaptics Tap Action", False); + prop = XInternAtom (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), "Synaptics Tap Action", False); if (!prop) return 0; @@ -608,7 +608,7 @@ set_tap_to_click (gboolean state, gboolean left_handed) for (i = 0; i < numdevices; i++) { if ((device = device_is_touchpad (devicelist[i]))) { gdk_error_trap_push (); - rc = XGetDeviceProperty (GDK_DISPLAY (), device, prop, 0, 2, + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device, prop, 0, 2, False, XA_INTEGER, &type, &format, &nitems, &bytes_after, &data); @@ -618,13 +618,13 @@ set_tap_to_click (gboolean state, gboolean left_handed) data[4] = (state) ? ((left_handed) ? 3 : 1) : 0; data[5] = (state) ? ((left_handed) ? 1 : 3) : 0; data[6] = (state) ? 2 : 0; - XChangeDeviceProperty (GDK_DISPLAY (), device, prop, XA_INTEGER, 8, + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device, prop, XA_INTEGER, 8, PropModeReplace, data, nitems); } if (rc == Success) XFree (data); - XCloseDevice (GDK_DISPLAY (), device); + XCloseDevice (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device); if (gdk_error_trap_pop ()) { g_warning ("Error in setting tap to click on \"%s\"", devicelist[i].name); continue; @@ -640,7 +640,7 @@ static int set_horiz_scroll (gboolean state) { int numdevices, i, rc; - XDeviceInfo *devicelist = XListInputDevices (GDK_DISPLAY (), &numdevices); + XDeviceInfo *devicelist = XListInputDevices (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), &numdevices); XDevice *device; Atom act_type, prop_edge, prop_twofinger; int act_format; @@ -650,8 +650,8 @@ set_horiz_scroll (gboolean state) if (devicelist == NULL) return 0; - prop_edge = XInternAtom (GDK_DISPLAY (), "Synaptics Edge Scrolling", False); - prop_twofinger = XInternAtom (GDK_DISPLAY (), "Synaptics Two-Finger Scrolling", False); + prop_edge = XInternAtom (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), "Synaptics Edge Scrolling", False); + prop_twofinger = XInternAtom (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), "Synaptics Two-Finger Scrolling", False); if (!prop_edge || !prop_twofinger) return 0; @@ -659,34 +659,34 @@ set_horiz_scroll (gboolean state) for (i = 0; i < numdevices; i++) { if ((device = device_is_touchpad (devicelist[i]))) { gdk_error_trap_push (); - rc = XGetDeviceProperty (GDK_DISPLAY (), device, + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device, prop_edge, 0, 1, False, XA_INTEGER, &act_type, &act_format, &nitems, &bytes_after, &data); if (rc == Success && act_type == XA_INTEGER && act_format == 8 && nitems >= 2) { data[1] = (state && data[0]); - XChangeDeviceProperty (GDK_DISPLAY (), device, + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device, prop_edge, XA_INTEGER, 8, PropModeReplace, data, nitems); } XFree (data); - rc = XGetDeviceProperty (GDK_DISPLAY (), device, + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device, prop_twofinger, 0, 1, False, XA_INTEGER, &act_type, &act_format, &nitems, &bytes_after, &data); if (rc == Success && act_type == XA_INTEGER && act_format == 8 && nitems >= 2) { data[1] = (state && data[0]); - XChangeDeviceProperty (GDK_DISPLAY (), device, + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device, prop_twofinger, XA_INTEGER, 8, PropModeReplace, data, nitems); } XFree (data); - XCloseDevice (GDK_DISPLAY (), device); + XCloseDevice (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device); if (gdk_error_trap_pop ()) { g_warning ("Error in setting horiz scroll on \"%s\"", devicelist[i].name); continue; @@ -707,7 +707,7 @@ static int set_edge_scroll (int method) { int numdevices, i, rc; - XDeviceInfo *devicelist = XListInputDevices (GDK_DISPLAY (), &numdevices); + XDeviceInfo *devicelist = XListInputDevices (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), &numdevices); XDevice *device; Atom act_type, prop_edge, prop_twofinger; int act_format; @@ -717,8 +717,8 @@ set_edge_scroll (int method) if (devicelist == NULL) return 0; - prop_edge = XInternAtom (GDK_DISPLAY (), "Synaptics Edge Scrolling", False); - prop_twofinger = XInternAtom (GDK_DISPLAY (), "Synaptics Two-Finger Scrolling", False); + prop_edge = XInternAtom (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), "Synaptics Edge Scrolling", False); + prop_twofinger = XInternAtom (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), "Synaptics Two-Finger Scrolling", False); if (!prop_edge || !prop_twofinger) return 0; @@ -726,34 +726,34 @@ set_edge_scroll (int method) for (i = 0; i < numdevices; i++) { if ((device = device_is_touchpad (devicelist[i]))) { gdk_error_trap_push (); - rc = XGetDeviceProperty (GDK_DISPLAY (), device, + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device, prop_edge, 0, 1, False, XA_INTEGER, &act_type, &act_format, &nitems, &bytes_after, &data); if (rc == Success && act_type == XA_INTEGER && act_format == 8 && nitems >= 2) { data[0] = (method == 1) ? 1 : 0; - XChangeDeviceProperty (GDK_DISPLAY (), device, + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device, prop_edge, XA_INTEGER, 8, PropModeReplace, data, nitems); } XFree (data); - rc = XGetDeviceProperty (GDK_DISPLAY (), device, + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device, prop_twofinger, 0, 1, False, XA_INTEGER, &act_type, &act_format, &nitems, &bytes_after, &data); if (rc == Success && act_type == XA_INTEGER && act_format == 8 && nitems >= 2) { data[0] = (method == 2) ? 1 : 0; - XChangeDeviceProperty (GDK_DISPLAY (), device, + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device, prop_twofinger, XA_INTEGER, 8, PropModeReplace, data, nitems); } XFree (data); - XCloseDevice (GDK_DISPLAY (), device); + XCloseDevice (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device); if (gdk_error_trap_pop ()) { g_warning ("Error in setting edge scroll on \"%s\"", devicelist[i].name); continue; @@ -769,14 +769,14 @@ static int set_touchpad_enabled (gboolean state) { int numdevices, i; - XDeviceInfo *devicelist = XListInputDevices (GDK_DISPLAY (), &numdevices); + XDeviceInfo *devicelist = XListInputDevices (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), &numdevices); XDevice *device; Atom prop_enabled; if (devicelist == NULL) return 0; - prop_enabled = XInternAtom (GDK_DISPLAY (), "Device Enabled", False); + prop_enabled = XInternAtom (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), "Device Enabled", False); if (!prop_enabled) return 0; @@ -785,10 +785,10 @@ set_touchpad_enabled (gboolean state) if ((device = device_is_touchpad (devicelist[i]))) { unsigned char data = state; gdk_error_trap_push (); - XChangeDeviceProperty (GDK_DISPLAY (), device, + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device, prop_enabled, XA_INTEGER, 8, PropModeReplace, &data, 1); - XCloseDevice (GDK_DISPLAY (), device); + XCloseDevice (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device); gdk_flush (); if (gdk_error_trap_pop ()) { g_warning ("Error %s device \"%s\"", diff --git a/plugins/xrdb/gsd-xrdb-manager.c b/plugins/xrdb/gsd-xrdb-manager.c index 47eed1d..5a53842 100644 --- a/plugins/xrdb/gsd-xrdb-manager.c +++ b/plugins/xrdb/gsd-xrdb-manager.c @@ -44,15 +44,14 @@ #define SYSTEM_AD_DIR DATADIR "/xrdb" #define GENERAL_AD SYSTEM_AD_DIR "/General.ad" -#define USER_AD_DIR ".mate2/xrdb" +#define USER_AD_DIR ".config/mate/xrdb" #define USER_X_RESOURCES ".Xresources" #define USER_X_DEFAULTS ".Xdefaults" #define GTK_THEME_KEY "/desktop/mate/interface/gtk_theme" -struct GsdXrdbManagerPrivate -{ - GtkWidget *widget; +struct GsdXrdbManagerPrivate { + GtkWidget* widget; }; static void gsd_xrdb_manager_class_init (GsdXrdbManagerClass *klass); |