source:
proiecte/PPPP/gdm/debian/patches/01_default_keyboard_layout_hal.patch
@
141
Last change on this file since 141 was 134, checked in by , 14 years ago | |
---|---|
File size: 3.9 KB |
-
configure.ac
# # Description: Get default keyboard layout from hal # Ubuntu: https://bugs.launchpad.net/bugs/395103 # Fedora: http://cvs.fedoraproject.org/viewvc//devel/gdm/gdm-system-keyboard.patch?view=markup # diff -Nur -x '*.orig' -x '*~' gdm-2.28.0/configure.ac gdm-2.28.0.new/configure.ac
old new 70 70 dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION 71 71 gobject-2.0 >= $GLIB_REQUIRED_VERSION 72 72 gio-2.0 >= $GLIB_REQUIRED_VERSION 73 hal 73 74 ) 74 75 AC_SUBST(DAEMON_CFLAGS) 75 76 AC_SUBST(DAEMON_LIBS) -
daemon/gdm-session-direct.c
diff -Nur -x '*.orig' -x '*~' gdm-2.28.0/daemon/gdm-session-direct.c gdm-2.28.0.new/daemon/gdm-session-direct.c
old new 45 45 #include <dbus/dbus-glib.h> 46 46 #include <dbus/dbus-glib-lowlevel.h> 47 47 48 #include <libhal.h> 49 48 50 #include "gdm-session-direct.h" 49 51 #include "gdm-session.h" 50 52 #include "gdm-session-private.h" … … 598 600 return setlocale (LC_MESSAGES, NULL); 599 601 } 600 602 603 static char * 604 get_system_default_layout (GdmSessionDirect *session) 605 { 606 DBusConnection *connection; 607 LibHalContext *ctx; 608 char **devices; 609 int n_devices; 610 char *layout; 611 char *variant; 612 char *result; 613 614 result = NULL; 615 616 connection = dbus_g_connection_get_connection (session->priv->connection); 617 ctx = libhal_ctx_new (); 618 libhal_ctx_set_dbus_connection (ctx, connection); 619 620 if (!libhal_ctx_init (ctx, NULL)) { 621 goto out; 622 } 623 624 devices = libhal_find_device_by_capability (ctx, 625 "input.keyboard", 626 &n_devices, 627 NULL); 628 if (n_devices > 0) { 629 layout = libhal_device_get_property_string (ctx, 630 devices[0], 631 "input.x11_options.XkbLayout", 632 NULL); 633 if (!layout) { 634 layout = libhal_device_get_property_string (ctx, 635 devices[0], 636 "input.xkb.layout", 637 NULL); 638 } 639 if (!layout) 640 goto out; 641 642 variant = libhal_device_get_property_string (ctx, 643 devices[0], 644 "input.x11_options.XkbVariant", 645 NULL); 646 if (!variant) { 647 variant = libhal_device_get_property_string (ctx, 648 devices[0], 649 "input.xkb.variant", 650 NULL); 651 } 652 653 if (variant) { 654 result = g_strdup_printf("%s\t%s", layout, variant); 655 libhal_free_string (variant); 656 } else { 657 result = g_strdup (layout); 658 } 659 libhal_free_string (layout); 660 } 661 662 libhal_free_string_array (devices); 663 664 libhal_ctx_shutdown (ctx, NULL); 665 libhal_ctx_free (ctx); 666 667 out: 668 if (!result) { 669 result = g_strdup ("us"); 670 } 671 672 g_debug ("GdmSessionDirect: System default keyboard layout: '%s'", result); 673 return result; 674 } 675 601 676 static const char * 602 677 get_default_layout_name (GdmSessionDirect *session) 603 678 { 604 if ( session->priv->saved_layout != NULL) {605 return session->priv->saved_layout;679 if (!session->priv->saved_layout) { 680 session->priv->saved_layout = get_system_default_layout (session); 606 681 } 607 682 608 return "us";683 return session->priv->saved_layout; 609 684 } 610 685 611 686 static char *
Note: See TracBrowser
for help on using the repository browser.