Reorganized the automatic selection of keymap: The message about autoselection is not printed if -k is not given.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@972 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
2671e69027
commit
65b28a80a4
2
proto.h
2
proto.h
@ -166,7 +166,7 @@ void ui_clip_request_data(uint32 format);
|
||||
void ui_clip_sync(void);
|
||||
void xclip_init(void);
|
||||
/* xkeymap.c */
|
||||
void xkeymap_from_locale(const char *locale);
|
||||
BOOL xkeymap_from_locale(const char *locale);
|
||||
FILE *xkeymap_open(const char *filename);
|
||||
void xkeymap_init(void);
|
||||
BOOL handle_special_keys(uint32 keysym, unsigned int state, uint32 ev_time, BOOL pressed);
|
||||
|
30
rdesktop.c
30
rdesktop.c
@ -27,7 +27,7 @@
|
||||
#include <sys/time.h> /* gettimeofday */
|
||||
#include <sys/times.h> /* times */
|
||||
#include <ctype.h> /* toupper */
|
||||
#include <limits.h> /* PATH_MAX */
|
||||
#include <limits.h> /* PATH_MAX */
|
||||
#include <errno.h>
|
||||
#include "rdesktop.h"
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
char g_title[64] = "";
|
||||
char g_username[64];
|
||||
char g_hostname[16];
|
||||
char keymapname[PATH_MAX] = "en-us";
|
||||
char keymapname[PATH_MAX] = "";
|
||||
int g_keylayout = 0x409; /* Defaults to US keyboard layout */
|
||||
int g_keyboard_type = 0x4; /* Defaults to US keyboard layout */
|
||||
int g_keyboard_subtype = 0x0; /* Defaults to US keyboard layout */
|
||||
@ -374,16 +374,23 @@ main(int argc, char *argv[])
|
||||
uint32 flags, ext_disc_reason = 0;
|
||||
char *p;
|
||||
int c;
|
||||
char *locale;
|
||||
char *locale = NULL;
|
||||
int username_option = 0;
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
/* Set locale according to environment */
|
||||
locale = setlocale(LC_ALL, "");
|
||||
if (locale)
|
||||
{
|
||||
xkeymap_from_locale(locale);
|
||||
locale = strdup(locale);
|
||||
if (locale == NULL)
|
||||
{
|
||||
perror("strdup");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
flags = RDP_LOGON_NORMAL;
|
||||
prompt_password = False;
|
||||
domain[0] = password[0] = shell[0] = directory[0] = 0;
|
||||
@ -750,6 +757,21 @@ main(int argc, char *argv[])
|
||||
STRNCPY(g_hostname, fullhostname, sizeof(g_hostname));
|
||||
}
|
||||
|
||||
if (keymapname[0] == 0)
|
||||
{
|
||||
if (locale && xkeymap_from_locale(locale))
|
||||
{
|
||||
fprintf(stderr, "Autoselected keyboard map %s\n", keymapname);
|
||||
}
|
||||
else
|
||||
{
|
||||
STRNCPY(keymapname, "en-us", sizeof(keymapname));
|
||||
}
|
||||
}
|
||||
if (locale)
|
||||
xfree(locale);
|
||||
|
||||
|
||||
if (prompt_password && read_password(password, sizeof(password)))
|
||||
flags |= RDP_LOGON_AUTO;
|
||||
|
||||
|
@ -159,7 +159,7 @@ add_sequence(char *rest, char *mapname)
|
||||
DEBUG_KBD(("\n"));
|
||||
}
|
||||
|
||||
void
|
||||
BOOL
|
||||
xkeymap_from_locale(const char *locale)
|
||||
{
|
||||
char *str, *ptr;
|
||||
@ -211,8 +211,10 @@ xkeymap_from_locale(const char *locale)
|
||||
{
|
||||
fclose(fp);
|
||||
STRNCPY(keymapname, str, sizeof(keymapname));
|
||||
fprintf(stderr, "Autoselected keyboard map %s.\n", keymapname);
|
||||
return True;
|
||||
}
|
||||
|
||||
return False;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user