summaryrefslogtreecommitdiffstats
path: root/xorg/X11R7.6
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2013-11-29 15:20:50 -0800
committerJay Sorg <jay.sorg@gmail.com>2013-11-29 15:20:50 -0800
commit7dfc25002e52c4d944b39dcc52516af842dc2b11 (patch)
treed3dac9e17d169b00ea032599f29170a9dbfb7ec1 /xorg/X11R7.6
parent6777c4e38e742f0f6162ed43762354b377f38fa4 (diff)
downloadxrdp-proprietary-7dfc25002e52c4d944b39dcc52516af842dc2b11.tar.gz
xrdp-proprietary-7dfc25002e52c4d944b39dcc52516af842dc2b11.zip
X11rdp: wait for setxkbmap to finish
Diffstat (limited to 'xorg/X11R7.6')
-rw-r--r--xorg/X11R7.6/rdp/rdp.h2
-rw-r--r--xorg/X11R7.6/rdp/rdpinput.c55
-rw-r--r--xorg/X11R7.6/rdp/rdpmisc.c10
3 files changed, 65 insertions, 2 deletions
diff --git a/xorg/X11R7.6/rdp/rdp.h b/xorg/X11R7.6/rdp/rdp.h
index e493b281..7bc2eb6c 100644
--- a/xorg/X11R7.6/rdp/rdp.h
+++ b/xorg/X11R7.6/rdp/rdp.h
@@ -368,6 +368,8 @@ void
RegionAroundSegs(RegionPtr reg, xSegment* segs, int nseg);
int
get_crc(char* data, int data_bytes);
+int
+get_mstime(void);
/* rdpdraw.c */
Bool
diff --git a/xorg/X11R7.6/rdp/rdpinput.c b/xorg/X11R7.6/rdp/rdpinput.c
index 6f09ebe5..a2d7eac3 100644
--- a/xorg/X11R7.6/rdp/rdpinput.c
+++ b/xorg/X11R7.6/rdp/rdpinput.c
@@ -37,6 +37,8 @@ keyboard and mouse stuff
/* this should be fixed in rdesktop */
#include "rdp.h"
+#include <sys/types.h>
+#include <sys/wait.h>
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
@@ -546,6 +548,11 @@ rdpLoadLayout(int keylayout)
char a7[16];
char a8[16];
int pid;
+ int rv;
+ int rv_pid;
+ int status;
+ int start_time;
+ int now_time;
LLOGLN(10, ("rdpLoadLayout: keylayout 0x%8.8x display %s",
keylayout, display));
@@ -585,13 +592,57 @@ rdpLoadLayout(int keylayout)
LLOGLN(0, ("rdpLoadLayout: unknown keylayout 0x%8.8x", keylayout));
return 1;
}
+ rv = 1;
pid = fork();
- if (pid == 0)
+ if (pid == -1)
{
+ LLOGLN(0, ("rdpLoadLayout: fork failed"));
+ return rv;
+ }
+ else if (pid == 0)
+ {
+ /* child */
execlp(a1, a2, a3, a4, a5, a6, a7, a8, (void *)0);
exit(0);
}
- return 0;
+ else
+ {
+ /* parent */
+ start_time = get_mstime();
+ while (1)
+ {
+ usleep(1000);
+ rv_pid = waitpid(pid, &status, WNOHANG);
+ if (rv_pid == -1)
+ {
+ if (errno == EINTR) /* signal occurred */
+ {
+ }
+ else
+ {
+ LLOGLN(0, ("rdpLoadLayout: waitpid failed"));
+ break;
+ }
+ }
+ else if (rv_pid == pid)
+ {
+ rv = 0;
+ LLOGLN(0, ("rdpLoadLayout: setxkbmap result %d", status));
+ break;
+ }
+ else
+ {
+ LLOGLN(0, ("rdpLoadLayout: waitpid unknown pid return %d", rv));
+ }
+ now_time = get_mstime();
+ if (now_time - start_time > 1000 * 1000)
+ {
+ LLOGLN(0, ("rdpLoadLayout: waitpid timeout"));
+ break;
+ }
+ }
+ }
+ return rv;
}
/******************************************************************************/
diff --git a/xorg/X11R7.6/rdp/rdpmisc.c b/xorg/X11R7.6/rdp/rdpmisc.c
index eb5bedad..1d57d1fa 100644
--- a/xorg/X11R7.6/rdp/rdpmisc.c
+++ b/xorg/X11R7.6/rdp/rdpmisc.c
@@ -668,3 +668,13 @@ get_crc(char* data, int data_bytes)
CRC_END(crc);
return crc;
}
+
+/*****************************************************************************/
+int
+get_mstime(void)
+{
+ struct timeval tp;
+
+ gettimeofday(&tp, 0);
+ return (tp.tv_sec * 1000) + (tp.tv_usec / 1000);
+}