summaryrefslogtreecommitdiffstats
path: root/xorg
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2012-03-13 17:18:10 -0700
committerJay Sorg <jay.sorg@gmail.com>2012-03-13 17:18:10 -0700
commit35bc7a1588a1a6c40fe1d20c07b2bc66e93b88e9 (patch)
tree316eee90522c1e36233caad309dee58aff67cba8 /xorg
parent288961c60f5e7472a61a0c4cc65d3dc568148114 (diff)
downloadxrdp-proprietary-35bc7a1588a1a6c40fe1d20c07b2bc66e93b88e9.tar.gz
xrdp-proprietary-35bc7a1588a1a6c40fe1d20c07b2bc66e93b88e9.zip
xorg: added DAMAGE, fix keyboard sync
Diffstat (limited to 'xorg')
-rw-r--r--xorg/X11R7.6/rdp/Makefile18
-rw-r--r--xorg/X11R7.6/rdp/rdpinput.c95
-rw-r--r--xorg/X11R7.6/rdp/rdpmain.c23
-rw-r--r--xorg/X11R7.6/rdp/rdpmisc.c62
4 files changed, 44 insertions, 154 deletions
diff --git a/xorg/X11R7.6/rdp/Makefile b/xorg/X11R7.6/rdp/Makefile
index f73d697f..3caf5692 100644
--- a/xorg/X11R7.6/rdp/Makefile
+++ b/xorg/X11R7.6/rdp/Makefile
@@ -28,10 +28,14 @@ LIBS = $(XSRCBASE)/dbe/.libs/libdbe.a \
$(XSRCBASE)/Xi/.libs/libXi.a \
$(XSRCBASE)/glx/.libs/libglx.a \
$(XSRCBASE)/xfixes/.libs/libxfixes.a \
- librdp.a \
- -lfreetype -lz -lm -lXfont -lXau -lXdmcp -lpixman-1 -lrt -ldl -lcrypto -lGL
+ $(XSRCBASE)/damageext/.libs/libdamageext.a \
+ $(XSRCBASE)/miext/damage/.libs/libdamage.a \
+ librdp.a
-CFLAGS = -g -Wall -fno-strength-reduce \
+LLIBS = -Wl,-rpath=$(LIBBASE) -lfreetype -lz -lm -lXfont -lXau \
+ -lXdmcp -lpixman-1 -lrt -ldl -lcrypto -lGL -lXdamage
+
+CFLAGS = -O2 -Wall -fno-strength-reduce \
-I../../include \
-I../../cfb \
-I../../mfb \
@@ -52,7 +56,7 @@ CFLAGS = -g -Wall -fno-strength-reduce \
-DDBE -DEVI -DXVMC -DFONTCACHE -DGCCUSESGAS -DSTATIC_COLOR \
-DAVOID_GLYPHBLT -DFUNCPROTO=15 -DNARROWPROTO -DDDXOSFATALERROR \
-DPART_NET -DDDXTIME -D_HAVE_XALLOC_DECLS \
- \
+ -DDAMAGE \
-DXFIXES \
-DSMART_SCHEDULE -DSERVER_LOCK -DGLXEXT -DSHAPE -DRENDER -DRANDR \
-DBIGREQS -D_POSIX_SOURCE -D_BSD_SOURCE -DSCREENSAVER \
@@ -60,6 +64,8 @@ CFLAGS = -g -Wall -fno-strength-reduce \
-DDPMSExtension -DXvExtension -DXvMCExtension -DXResExtension \
-DMITSHM -DPIXPRIV -DNDEBUG -DDDXOSINIT -DXKB -DXINPUT
+#-DDAMAGE
+
# -pedantic
# -DXCSECURITY -DXF86BIGFONT
@@ -82,12 +88,12 @@ all: X11rdp
X11rdp: $(OBJS)
$(AR) rvu librdp.a $(OBJS)
ranlib librdp.a
- $(CC) $(LDFLAGS) -o X11rdp $(LIBS) $(LIBS)
+ $(CC) $(LDFLAGS) -o X11rdp $(LIBS) $(LIBS) $(LLIBS)
clean:
rm -f $(OBJS) librdp.a
-miinitext.o: ../build_dir/xorg-server-1.9.3/mi/miinitext.c
+miinitext.o: ../build_dir/xorg-server-1.9.3/mi/miinitext.c Makefile
$(CC) $(CFLAGS) -I../build_dir/xorg-server-1.9.3/Xext -c ../build_dir/xorg-server-1.9.3/mi/miinitext.c
fbcmap.o: ../build_dir/xorg-server-1.9.3/fb/fbcmap.c
diff --git a/xorg/X11R7.6/rdp/rdpinput.c b/xorg/X11R7.6/rdp/rdpinput.c
index 0a6798d0..35dc7b70 100644
--- a/xorg/X11R7.6/rdp/rdpinput.c
+++ b/xorg/X11R7.6/rdp/rdpinput.c
@@ -45,8 +45,9 @@ keyboard and mouse stuff
#endif
extern ScreenPtr g_pScreen; /* in rdpmain.c */
+extern DeviceIntPtr g_pointer; /* in rdpmain.c */
+extern DeviceIntPtr g_keyboard; /* in rdpmain.c */
-static DeviceIntPtr g_kbdDevice = 0;
static int g_old_button_mask = 0;
static int g_pause_spe = 0;
static int g_ctrl_down = 0;
@@ -57,9 +58,6 @@ static int g_tab_down = 0;
above *_down vars */
static int g_scroll_lock_down = 0;
-static DeviceIntPtr g_mouse = 0;
-static DeviceIntPtr g_keyboard = 0;
-
#define MIN_KEY_CODE 8
#define MAX_KEY_CODE 255
#define NO_OF_KEYS ((MAX_KEY_CODE - MIN_KEY_CODE) + 1)
@@ -255,7 +253,6 @@ KbdDeviceInit(DeviceIntPtr pDevice, KeySymsPtr pKeySyms, CARD8* pModMap)
int i;
DEBUG_OUT_INPUT(("KbdDeviceInit\n"));
- g_kbdDevice = pDevice;
for (i = 0; i < MAP_LENGTH; i++)
{
pModMap[i] = NoSymbol;
@@ -328,7 +325,6 @@ rdpKeybdProc(DeviceIntPtr pDevice, int onoff)
XkbRMLVOSet set;
DEBUG_OUT_INPUT(("rdpKeybdProc\n"));
-#if 1
pDev = (DevicePtr)pDevice;
switch (onoff)
{
@@ -347,7 +343,6 @@ rdpKeybdProc(DeviceIntPtr pDevice, int onoff)
case DEVICE_ON:
pDev->on = 1;
KbdDeviceOn();
- g_keyboard = pDevice;
break;
case DEVICE_OFF:
pDev->on = 0;
@@ -360,7 +355,6 @@ rdpKeybdProc(DeviceIntPtr pDevice, int onoff)
}
break;
}
-#endif
return Success;
}
@@ -437,9 +431,6 @@ rdpMouseProc(DeviceIntPtr pDevice, int onoff)
case DEVICE_ON:
pDev->on = 1;
PtrDeviceOn(pDevice);
-
- g_mouse = pDevice;
-
break;
case DEVICE_OFF:
pDev->on = 0;
@@ -688,18 +679,18 @@ rdpEnqueueMotion(int x, int y)
EventListPtr rdp_events;
xEvent* pev;
- miPointerSetPosition(g_mouse, &x, &y);
+ miPointerSetPosition(g_pointer, &x, &y);
valuators[0] = x;
valuators[1] = y;
GetEventList(&rdp_events);
- n = GetPointerEvents(rdp_events, g_mouse, MotionNotify, 0,
+ n = GetPointerEvents(rdp_events, g_pointer, MotionNotify, 0,
POINTER_ABSOLUTE | POINTER_SCREEN,
0, 2, valuators);
for (i = 0; i < n; i++)
{
pev = (rdp_events + i)->event;
- mieqEnqueue(g_mouse, (InternalEvent*)pev);
+ mieqEnqueue(g_pointer, (InternalEvent*)pev);
}
}
@@ -713,11 +704,11 @@ rdpEnqueueButton(int type, int buttons)
xEvent* pev;
i = GetEventList(&rdp_events);
- n = GetPointerEvents(rdp_events, g_mouse, type, buttons, 0, 0, 0, 0);
+ n = GetPointerEvents(rdp_events, g_pointer, type, buttons, 0, 0, 0, 0);
for (i = 0; i < n; i++)
{
pev = (rdp_events + i)->event;
- mieqEnqueue(g_mouse, (InternalEvent*)pev);
+ mieqEnqueue(g_pointer, (InternalEvent*)pev);
}
}
@@ -769,7 +760,6 @@ PtrAddEvent(int buttonMask, int x, int y)
g_old_button_mask = buttonMask;
}
-
/******************************************************************************/
void
check_keysa(void)
@@ -930,84 +920,33 @@ KbdAddEvent(int down, int param1, int param2, int param3, int param4)
/******************************************************************************/
/* notes -
- we should use defines or something for the keyc->state below
+ we should use defines or something for the
+ g_keyboard->key->xkbInfo->state below
scroll lock doesn't seem to be a modifier in X
*/
void
KbdSync(int param1)
{
+ int xkb_state;
-#if 0
-
- KeyClassPtr keyc;
- int mask;
- int latches;
- int status;
-
- if (g_kbdDevice == 0)
- {
- return;
- }
-
- mask = 0;
- latches = 0;
-
- mask |= 1 << 1;
- if (param1 & 4)
- {
- latches |= 1 << 1;
- }
- mask |= Mod1Mask;
- if (param1 & 4)
- {
- latches |= Mod1Mask;
- }
-
- ErrorF("mask 0x%x latches 0x%x\n", mask, latches);
-
- status = XkbLatchModifiers(g_keyboard, mask, latches);
-
- ErrorF("status %d\n", status);
-
-#if 0
-
- keyc = g_kbdDevice->key;
- if (keyc == 0)
- {
- return;
- }
-
-
- ErrorF("0x%x mods 0x%x\n", param1, keyc->xkbInfo->state.mods);
-
- hexdump(keyc->down, DOWN_LENGTH);
-
- hexdump(keyc->modifierKeyCount, 32);
-
- hexdump(keyc->xkbInfo, sizeof(struct _XkbSrvInfo));
-
-#if 1
- //if ((!(keyc->xkbInfo->state & 0x02)) != (!(param1 & 4))) /* caps lock */
- if (param1 & 4) /* caps lock */
+ xkb_state = XkbStateFieldFromRec(&(g_keyboard->key->xkbInfo->state));
+ if ((!(xkb_state & 0x02)) != (!(param1 & 4))) /* caps lock */
{
+ ErrorF("KbdSync: toggling caps lock\n");
KbdAddEvent(1, 58, 0, 58, 0);
KbdAddEvent(0, 58, 49152, 58, 49152);
}
- //if ((!(keyc->state & 0x10)) != (!(param1 & 2))) /* num lock */
- if (param1 & 2) /* num lock */
+
+ if ((!(xkb_state & 0x10)) != (!(param1 & 2))) /* num lock */
{
+ ErrorF("KbdSync: toggling num lock\n");
KbdAddEvent(1, 69, 0, 69, 0);
KbdAddEvent(0, 69, 49152, 69, 49152);
}
-#endif
if ((!(g_scroll_lock_down)) != (!(param1 & 1))) /* scroll lock */
{
+ ErrorF("KbdSync: toggling scroll lock\n");
KbdAddEvent(1, 70, 0, 70, 0);
KbdAddEvent(0, 70, 49152, 70, 49152);
}
-
-#endif
-
-#endif
-
}
diff --git a/xorg/X11R7.6/rdp/rdpmain.c b/xorg/X11R7.6/rdp/rdpmain.c
index 78189038..d8c7e9d2 100644
--- a/xorg/X11R7.6/rdp/rdpmain.c
+++ b/xorg/X11R7.6/rdp/rdpmain.c
@@ -39,6 +39,9 @@ ScreenPtr g_pScreen = 0;
//int g_rdpGCIndex = -1;
DevPrivateKeyRec g_rdpGCIndex;
+DeviceIntPtr g_pointer = 0;
+DeviceIntPtr g_keyboard = 0;
+
/* set all these at once, use function set_bpp */
int g_bpp = 16;
int g_Bpp = 2;
@@ -570,21 +573,15 @@ InitOutput(ScreenInfo* screenInfo, int argc, char** argv)
void
InitInput(int argc, char** argv)
{
- DeviceIntPtr p;
- DeviceIntPtr k;
+ int rc;
ErrorF("InitInput:\n");
- k = AddInputDevice(serverClient, rdpKeybdProc, 1);
- p = AddInputDevice(serverClient, rdpMouseProc, 1);
- RegisterKeyboardDevice(k);
- RegisterPointerDevice(p);
-
-// TODO
-#if 0
- /* screenInfo must be globally defined */
- miRegisterPointerDevice(screenInfo.screens[0], p);
- mieqInit(k, p);
-#endif
+ rc = AllocDevicePair(serverClient, "X11rdp", &g_pointer, &g_keyboard,
+ rdpMouseProc, rdpKeybdProc, 0);
+ if (rc != Success)
+ {
+ FatalError("Failed to init X11rdp default devices.\n");
+ }
mieqInit();
diff --git a/xorg/X11R7.6/rdp/rdpmisc.c b/xorg/X11R7.6/rdp/rdpmisc.c
index eba5b1cb..82c5b244 100644
--- a/xorg/X11R7.6/rdp/rdpmisc.c
+++ b/xorg/X11R7.6/rdp/rdpmisc.c
@@ -39,7 +39,7 @@ rdpLog(char *format, ...)
va_start(args, format);
time(&clock);
strftime(buf, 255, "%d/%m/%y %T ", localtime(&clock));
- fprintf(stderr, buf);
+ fprintf(stderr, "%s", buf);
vfprintf(stderr, format, args);
fflush(stderr);
va_end(args);
@@ -156,11 +156,7 @@ CloseInputDevice(DeviceIntPtr d, ClientPtr client)
int
g_tcp_recv(int sck, void* ptr, int len, int flags)
{
-#if defined(_WIN32)
- return recv(sck, (char*)ptr, len, flags);
-#else
return recv(sck, ptr, len, flags);
-#endif
}
/*****************************************************************************/
@@ -172,44 +168,28 @@ g_tcp_close(int sck)
return;
}
shutdown(sck, 2);
-#if defined(_WIN32)
- closesocket(sck);
-#else
close(sck);
-#endif
}
/*****************************************************************************/
int
g_tcp_last_error_would_block(int sck)
{
-#if defined(_WIN32)
- return WSAGetLastError() == WSAEWOULDBLOCK;
-#else
return (errno == EWOULDBLOCK) || (errno == EINPROGRESS);
-#endif
}
/*****************************************************************************/
void
g_sleep(int msecs)
{
-#if defined(_WIN32)
- Sleep(msecs);
-#else
usleep(msecs * 1000);
-#endif
}
/*****************************************************************************/
int
g_tcp_send(int sck, void* ptr, int len, int flags)
{
-#if defined(_WIN32)
- return send(sck, (char*)ptr, len, flags);
-#else
return send(sck, ptr, len, flags);
-#endif
}
/*****************************************************************************/
@@ -218,7 +198,8 @@ g_malloc(int size, int zero)
{
char* rv;
-#ifdef _XSERVER64
+//#ifdef _XSERVER64
+#if 1
/* I thought xalloc whould work here but I guess not, why, todo */
rv = (char*)malloc(size);
#else
@@ -240,7 +221,8 @@ g_free(void* ptr)
{
if (ptr != 0)
{
-#ifdef _XSERVER64
+//#ifdef _XSERVER64
+#if 1
/* I thought xfree whould work here but I guess not, why, todo */
free(ptr);
#else
@@ -269,12 +251,8 @@ g_tcp_socket(void)
i = 1;
rv = socket(PF_INET, SOCK_STREAM, 0);
-#if defined(_WIN32)
- setsockopt(rv, IPPROTO_TCP, TCP_NODELAY, (char*)&i, sizeof(i));
-#else
setsockopt(rv, IPPROTO_TCP, TCP_NODELAY, (void*)&i, sizeof(i));
setsockopt(rv, SOL_SOCKET, SO_REUSEADDR, (void*)&i, sizeof(i));
-#endif
return rv;
}
@@ -282,11 +260,7 @@ g_tcp_socket(void)
int
g_tcp_local_socket_dgram(void)
{
-#if defined(_WIN32)
- return 0;
-#else
return socket(AF_UNIX, SOCK_DGRAM, 0);
-#endif
}
/*****************************************************************************/
@@ -303,11 +277,7 @@ g_tcp_set_no_delay(int sck)
int i;
i = 1;
-#if defined(_WIN32)
- setsockopt(sck, IPPROTO_TCP, TCP_NODELAY, (char*)&i, sizeof(i));
-#else
setsockopt(sck, IPPROTO_TCP, TCP_NODELAY, (void*)&i, sizeof(i));
-#endif
return 0;
}
@@ -317,14 +287,9 @@ g_tcp_set_non_blocking(int sck)
{
unsigned long i;
-#if defined(_WIN32)
- i = 1;
- ioctlsocket(sck, FIONBIO, &i);
-#else
i = fcntl(sck, F_GETFL);
i = i | O_NONBLOCK;
fcntl(sck, F_SETFL, i);
-#endif
return 0;
}
@@ -333,11 +298,7 @@ int
g_tcp_accept(int sck)
{
struct sockaddr_in s;
-#if defined(_WIN32)
- signed int i;
-#else
unsigned int i;
-#endif
i = sizeof(struct sockaddr_in);
memset(&s, 0, i);
@@ -418,16 +379,12 @@ g_tcp_bind(int sck, char* port)
int
g_tcp_local_bind(int sck, char* port)
{
-#if defined(_WIN32)
- return -1;
-#else
struct sockaddr_un s;
memset(&s, 0, sizeof(struct sockaddr_un));
s.sun_family = AF_UNIX;
strcpy(s.sun_path, port);
return bind(sck, (struct sockaddr*)&s, sizeof(struct sockaddr_un));
-#endif
}
/*****************************************************************************/
@@ -442,11 +399,7 @@ g_tcp_listen(int sck)
int
g_create_dir(const char* dirname)
{
-#if defined(_WIN32)
- return CreateDirectoryA(dirname, 0); // test this
-#else
return mkdir(dirname, (mode_t)-1) == 0;
-#endif
}
/*****************************************************************************/
@@ -454,10 +407,6 @@ g_create_dir(const char* dirname)
int
g_directory_exist(const char* dirname)
{
-#if defined(_WIN32)
- return 0; // use GetFileAttributes and check return value
- // is not -1 and FILE_ATTRIBUT_DIRECTORY bit is set
-#else
struct stat st;
if (stat(dirname, &st) == 0)
@@ -468,7 +417,6 @@ g_directory_exist(const char* dirname)
{
return 0;
}
-#endif
}
/*****************************************************************************/