xorg: X11rdp

ulab-original
Jay Sorg 13 years ago
parent 746f14ffdd
commit 288961c60f

@ -6,9 +6,13 @@ LIBBASE = $(X11RDPBASE)/lib
XSRCBASE = ../build_dir/xorg-server-1.9.3 XSRCBASE = ../build_dir/xorg-server-1.9.3
OBJS = rdpmain.o rdpdraw.o rdpinput.o rdpmisc.o rdpup.o miinitext.o fbcmap.o OBJS = rdpmain.o rdpdraw.o rdpinput.o rdpmisc.o rdpup.o miinitext.o \
fbcmap_mi.o
# fbcmap.o # in Xorg 7.1, fbcmap.c was used but now it looks like fbcmap_mi.c should
# be used
#fbcmap_mi.o
#fbcmap.o
LIBS = $(XSRCBASE)/dbe/.libs/libdbe.a \ LIBS = $(XSRCBASE)/dbe/.libs/libdbe.a \
$(XSRCBASE)/dix/.libs/libdix.a \ $(XSRCBASE)/dix/.libs/libdix.a \
@ -25,7 +29,7 @@ LIBS = $(XSRCBASE)/dbe/.libs/libdbe.a \
$(XSRCBASE)/glx/.libs/libglx.a \ $(XSRCBASE)/glx/.libs/libglx.a \
$(XSRCBASE)/xfixes/.libs/libxfixes.a \ $(XSRCBASE)/xfixes/.libs/libxfixes.a \
librdp.a \ librdp.a \
-lfreetype -lz -lm -lXfont -lXau -lXdmcp -lpixman-1 -lrt -ldl -lcrypto -lfreetype -lz -lm -lXfont -lXau -lXdmcp -lpixman-1 -lrt -ldl -lcrypto -lGL
CFLAGS = -g -Wall -fno-strength-reduce \ CFLAGS = -g -Wall -fno-strength-reduce \
-I../../include \ -I../../include \
@ -44,7 +48,7 @@ CFLAGS = -g -Wall -fno-strength-reduce \
-I../xfree86/os-support \ -I../xfree86/os-support \
-D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_REENTRANT \ -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_REENTRANT \
-DGLX_USE_MESA -DXRECORD -D_GNU_SOURCE -DXAPPGROUP \ -DGLX_USE_MESA -DXRECORD -D_GNU_SOURCE -DXAPPGROUP \
-DTOGCUP -DSINGLEDEPTH \ -DTOGCUP -DSINGLEDEPTH -DXFree86Server \
-DDBE -DEVI -DXVMC -DFONTCACHE -DGCCUSESGAS -DSTATIC_COLOR \ -DDBE -DEVI -DXVMC -DFONTCACHE -DGCCUSESGAS -DSTATIC_COLOR \
-DAVOID_GLYPHBLT -DFUNCPROTO=15 -DNARROWPROTO -DDDXOSFATALERROR \ -DAVOID_GLYPHBLT -DFUNCPROTO=15 -DNARROWPROTO -DDDXOSFATALERROR \
-DPART_NET -DDDXTIME -D_HAVE_XALLOC_DECLS \ -DPART_NET -DDDXTIME -D_HAVE_XALLOC_DECLS \
@ -57,7 +61,7 @@ CFLAGS = -g -Wall -fno-strength-reduce \
-DMITSHM -DPIXPRIV -DNDEBUG -DDDXOSINIT -DXKB -DXINPUT -DMITSHM -DPIXPRIV -DNDEBUG -DDDXOSINIT -DXKB -DXINPUT
# -pedantic # -pedantic
# -DXCSECURITY -DXF86BIGFONT -DXFree86Server # -DXCSECURITY -DXF86BIGFONT
# these are defined in xorg-server.h # these are defined in xorg-server.h
# -D_XOPEN_SOURCE=500L # -D_XOPEN_SOURCE=500L
@ -88,3 +92,6 @@ miinitext.o: ../build_dir/xorg-server-1.9.3/mi/miinitext.c
fbcmap.o: ../build_dir/xorg-server-1.9.3/fb/fbcmap.c fbcmap.o: ../build_dir/xorg-server-1.9.3/fb/fbcmap.c
$(CC) $(CFLAGS) -c ../build_dir/xorg-server-1.9.3/fb/fbcmap.c $(CC) $(CFLAGS) -c ../build_dir/xorg-server-1.9.3/fb/fbcmap.c
fbcmap_mi.o: ../build_dir/xorg-server-1.9.3/fb/fbcmap_mi.c
$(CC) $(CFLAGS) -c ../build_dir/xorg-server-1.9.3/fb/fbcmap_mi.c

@ -28,9 +28,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/stat.h>
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netdb.h> #include <netdb.h>
@ -65,6 +67,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "fb.h" #include "fb.h"
#include "micmap.h" #include "micmap.h"
#include "events.h" #include "events.h"
#include "exevents.h"
#include "xserver-properties.h"
#include "xkbsrv.h"
//#include "colormapst.h"
/* test to see if this is xorg source or xfree86 */ /* test to see if this is xorg source or xfree86 */
#ifdef XORGSERVER #ifdef XORGSERVER
@ -111,6 +118,9 @@ struct _rdpScreenInfoRec
//PaintWindowBackgroundProcPtr PaintWindowBackground; //PaintWindowBackgroundProcPtr PaintWindowBackground;
//PaintWindowBorderProcPtr PaintWindowBorder; //PaintWindowBorderProcPtr PaintWindowBorder;
CreateColormapProcPtr CreateColormap;
DestroyColormapProcPtr DestroyColormap;
CopyWindowProcPtr CopyWindow; CopyWindowProcPtr CopyWindow;
ClearToBackgroundProcPtr ClearToBackground; ClearToBackgroundProcPtr ClearToBackground;
ScreenWakeupHandlerProcPtr WakeupHandler; ScreenWakeupHandlerProcPtr WakeupHandler;
@ -178,6 +188,14 @@ int
g_tcp_local_bind(int sck, char* port); g_tcp_local_bind(int sck, char* port);
int int
g_tcp_listen(int sck); g_tcp_listen(int sck);
int
g_create_dir(const char* dirname);
int
g_directory_exist(const char* dirname);
int
g_chmod_hex(const char* filename, int flags);
void
hexdump(unsigned char *p, unsigned int len);
/* rdpdraw.c */ /* rdpdraw.c */
Bool Bool

@ -44,6 +44,8 @@ keyboard and mouse stuff
#define DEBUG_OUT_INPUT(arg) ErrorF arg #define DEBUG_OUT_INPUT(arg) ErrorF arg
#endif #endif
extern ScreenPtr g_pScreen; /* in rdpmain.c */
static DeviceIntPtr g_kbdDevice = 0; static DeviceIntPtr g_kbdDevice = 0;
static int g_old_button_mask = 0; static int g_old_button_mask = 0;
static int g_pause_spe = 0; static int g_pause_spe = 0;
@ -55,6 +57,9 @@ static int g_tab_down = 0;
above *_down vars */ above *_down vars */
static int g_scroll_lock_down = 0; static int g_scroll_lock_down = 0;
static DeviceIntPtr g_mouse = 0;
static DeviceIntPtr g_keyboard = 0;
#define MIN_KEY_CODE 8 #define MIN_KEY_CODE 8
#define MAX_KEY_CODE 255 #define MAX_KEY_CODE 255
#define NO_OF_KEYS ((MAX_KEY_CODE - MIN_KEY_CODE) + 1) #define NO_OF_KEYS ((MAX_KEY_CODE - MIN_KEY_CODE) + 1)
@ -234,12 +239,14 @@ static KeySym g_kbdMap[] =
NoSymbol, NoSymbol NoSymbol, NoSymbol
}; };
#if 0
/******************************************************************************/ /******************************************************************************/
static void static void
rdpSendBell(void) rdpSendBell(void)
{ {
DEBUG_OUT_INPUT(("rdpSendBell\n")); DEBUG_OUT_INPUT(("rdpSendBell\n"));
} }
#endif
/******************************************************************************/ /******************************************************************************/
void void
@ -297,6 +304,20 @@ KbdDeviceOff(void)
DEBUG_OUT_INPUT(("KbdDeviceOff\n")); DEBUG_OUT_INPUT(("KbdDeviceOff\n"));
} }
/******************************************************************************/
void
rdpBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls)
{
ErrorF("rdpBell:\n");
}
/******************************************************************************/
void
rdpChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl* ctrl)
{
ErrorF("rdpChangeKeyboardControl:\n");
}
/******************************************************************************/ /******************************************************************************/
int int
rdpKeybdProc(DeviceIntPtr pDevice, int onoff) rdpKeybdProc(DeviceIntPtr pDevice, int onoff)
@ -304,20 +325,29 @@ rdpKeybdProc(DeviceIntPtr pDevice, int onoff)
KeySymsRec keySyms; KeySymsRec keySyms;
CARD8 modMap[MAP_LENGTH]; CARD8 modMap[MAP_LENGTH];
DevicePtr pDev; DevicePtr pDev;
XkbRMLVOSet set[MAP_LENGTH]; XkbRMLVOSet set;
DEBUG_OUT_INPUT(("rdpKeybdProc\n")); DEBUG_OUT_INPUT(("rdpKeybdProc\n"));
#if 1
pDev = (DevicePtr)pDevice; pDev = (DevicePtr)pDevice;
switch (onoff) switch (onoff)
{ {
case DEVICE_INIT: case DEVICE_INIT:
KbdDeviceInit(pDevice, &keySyms, modMap); KbdDeviceInit(pDevice, &keySyms, modMap);
InitKeyboardDeviceStruct(pDevice, set, (BellProcPtr)rdpSendBell, memset(&set, 0, sizeof(set));
(KbdCtrlProcPtr)NoopDDA); set.rules = "base";
set.model = "pc104";
set.layout = "us";
set.variant = "";
set.options = "";
InitKeyboardDeviceStruct(pDevice, &set, rdpBell,
rdpChangeKeyboardControl);
//XkbDDXChangeControls(pDevice, 0, 0);
break; break;
case DEVICE_ON: case DEVICE_ON:
pDev->on = 1; pDev->on = 1;
KbdDeviceOn(); KbdDeviceOn();
g_keyboard = pDevice;
break; break;
case DEVICE_OFF: case DEVICE_OFF:
pDev->on = 0; pDev->on = 0;
@ -330,6 +360,7 @@ rdpKeybdProc(DeviceIntPtr pDevice, int onoff)
} }
break; break;
} }
#endif
return Success; return Success;
} }
@ -361,42 +392,54 @@ PtrDeviceOff(void)
DEBUG_OUT_INPUT(("PtrDeviceOff\n")); DEBUG_OUT_INPUT(("PtrDeviceOff\n"));
} }
/******************************************************************************/
static void
rdpMouseCtrl(DeviceIntPtr pDevice, PtrCtrl* pCtrl)
{
ErrorF("rdpMouseCtrl:\n");
}
/******************************************************************************/ /******************************************************************************/
int int
rdpMouseProc(DeviceIntPtr pDevice, int onoff) rdpMouseProc(DeviceIntPtr pDevice, int onoff)
{ {
BYTE map[6]; BYTE map[6];
DevicePtr pDev; DevicePtr pDev;
Atom btn_labels[6];
Atom axes_labels[2];
DEBUG_OUT_INPUT(("rdpMouseProc\n")); DEBUG_OUT_INPUT(("rdpMouseProc\n"));
pDev = (DevicePtr)pDevice; pDev = (DevicePtr)pDevice;
switch (onoff) switch (onoff)
{ {
case DEVICE_INIT: case DEVICE_INIT:
PtrDeviceInit(); PtrDeviceInit();
map[0] = 0; map[0] = 0;
map[1] = 1; map[1] = 1;
map[2] = 2; map[2] = 2;
map[3] = 3; map[3] = 3;
map[4] = 4; map[4] = 4;
map[5] = 5; map[5] = 5;
//InitPointerDeviceStruct(pDevice, map, 5, 0, miPointerGetMotionEvents,
// PtrDeviceControl, btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
// miPointerGetMotionBufferSize(), 2, 0); btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
#if 0 btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
DevicePtr /*device*/, btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
CARD8* /*map*/, btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
int /*numButtons*/,
Atom* /* btn_labels */, axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
PtrCtrlProcPtr /*controlProc*/, axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
int /*numMotionEvents*/,
int /*numAxes*/, InitPointerDeviceStruct(pDev, map, 5, btn_labels, rdpMouseCtrl,
Atom* /* axes_labels */); GetMotionHistorySize(), 2, axes_labels);
#endif
break; break;
case DEVICE_ON: case DEVICE_ON:
pDev->on = 1; pDev->on = 1;
PtrDeviceOn(pDevice); PtrDeviceOn(pDevice);
g_mouse = pDevice;
break; break;
case DEVICE_OFF: case DEVICE_OFF:
pDev->on = 0; pDev->on = 0;
@ -635,41 +678,91 @@ rdpSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr)
ErrorF("rdpSpriteDeviceCursorCleanup:\n"); ErrorF("rdpSpriteDeviceCursorCleanup:\n");
} }
/******************************************************************************/
static void
rdpEnqueueMotion(int x, int y)
{
int i;
int n;
int valuators[2];
EventListPtr rdp_events;
xEvent* pev;
miPointerSetPosition(g_mouse, &x, &y);
valuators[0] = x;
valuators[1] = y;
GetEventList(&rdp_events);
n = GetPointerEvents(rdp_events, g_mouse, 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);
}
}
/******************************************************************************/
static void
rdpEnqueueButton(int type, int buttons)
{
int i;
int n;
EventListPtr rdp_events;
xEvent* pev;
i = GetEventList(&rdp_events);
n = GetPointerEvents(rdp_events, g_mouse, type, buttons, 0, 0, 0, 0);
for (i = 0; i < n; i++)
{
pev = (rdp_events + i)->event;
mieqEnqueue(g_mouse, (InternalEvent*)pev);
}
}
/******************************************************************************/
static void
rdpEnqueueKey(int type, int scancode)
{
int i;
int n;
EventListPtr rdp_events;
xEvent* pev;
i = GetEventList(&rdp_events);
n = GetKeyboardEvents(rdp_events, g_keyboard, type, scancode);
for (i = 0; i < n; i++)
{
pev = (rdp_events + i)->event;
mieqEnqueue(g_keyboard, (InternalEvent*)pev);
}
}
/******************************************************************************/ /******************************************************************************/
void void
PtrAddEvent(int buttonMask, int x, int y) PtrAddEvent(int buttonMask, int x, int y)
{ {
//xEvent ev;
int i; int i;
unsigned long time; int type;
//InternalEvent e; int buttons;
//memset(&e, 0, sizeof(e));
time = GetTimeInMillis(); rdpEnqueueMotion(x, y);
//todo PostSyntheticMotion();
//miPointerAbsoluteCursor(x, y, time);
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
{ {
if ((buttonMask ^ g_old_button_mask) & (1 << i)) if ((buttonMask ^ g_old_button_mask) & (1 << i))
{ {
if (buttonMask & (1 << i)) if (buttonMask & (1 << i))
{ {
//e.header = ET_Internal; type = ButtonPress;
//e.type = ET_ButtonPress; buttons = i + 1;
rdpEnqueueButton(type, buttons);
//ev.u.u.type = ButtonPress;
//ev.u.u.detail = i + 1;
//ev.u.keyButtonPointer.time = time;
//mieqEnqueue(0, &ev); // todo
} }
else else
{ {
//ET_ButtonRelease type = ButtonRelease;
//ev.u.u.type = ButtonRelease; buttons = i + 1;
//ev.u.u.detail = i + 1; rdpEnqueueButton(type, buttons);
//ev.u.keyButtonPointer.time = time;
//mieqEnqueue(0, &ev); // todo
} }
} }
} }
@ -681,35 +774,19 @@ PtrAddEvent(int buttonMask, int x, int y)
void void
check_keysa(void) check_keysa(void)
{ {
xEvent ev;
unsigned long time;
time = GetTimeInMillis();
if (g_ctrl_down != 0) if (g_ctrl_down != 0)
{ {
memset(&ev, 0, sizeof(ev)); rdpEnqueueKey(KeyRelease, g_ctrl_down);
ev.u.u.type = KeyRelease;
ev.u.keyButtonPointer.time = time;
ev.u.u.detail = g_ctrl_down;
//mieqEnqueue(&ev);
g_ctrl_down = 0; g_ctrl_down = 0;
} }
if (g_alt_down != 0) if (g_alt_down != 0)
{ {
memset(&ev, 0, sizeof(ev)); rdpEnqueueKey(KeyRelease, g_alt_down);
ev.u.u.type = KeyRelease;
ev.u.keyButtonPointer.time = time;
ev.u.u.detail = g_alt_down;
//mieqEnqueue(&ev);
g_alt_down = 0; g_alt_down = 0;
} }
if (g_shift_down != 0) if (g_shift_down != 0)
{ {
memset(&ev, 0, sizeof(ev)); rdpEnqueueKey(KeyRelease, g_shift_down);
ev.u.u.type = KeyRelease;
ev.u.keyButtonPointer.time = time;
ev.u.u.detail = g_shift_down;
//mieqEnqueue(&ev);
g_shift_down = 0; g_shift_down = 0;
} }
} }
@ -718,17 +795,13 @@ check_keysa(void)
void void
KbdAddEvent(int down, int param1, int param2, int param3, int param4) KbdAddEvent(int down, int param1, int param2, int param3, int param4)
{ {
xEvent ev;
unsigned long time;
int rdp_scancode; int rdp_scancode;
int x_scancode; int x_scancode;
int is_ext; int is_ext;
int is_spe; int is_spe;
int type;
memset(&ev, 0, sizeof(ev)); type = down ? KeyPress : KeyRelease;
ev.u.u.type = down ? KeyPress : KeyRelease;
time = GetTimeInMillis();
ev.u.keyButtonPointer.time = time;
rdp_scancode = param3; rdp_scancode = param3;
is_ext = param4 & 256; /* 0x100 */ is_ext = param4 & 256; /* 0x100 */
is_spe = param4 & 512; /* 0x200 */ is_spe = param4 & 512; /* 0x200 */
@ -851,8 +924,7 @@ KbdAddEvent(int down, int param1, int param2, int param3, int param4)
} }
if (x_scancode > 0) if (x_scancode > 0)
{ {
ev.u.u.detail = x_scancode; rdpEnqueueKey(type, x_scancode);
//mieqEnqueue(&ev);
} }
} }
@ -864,32 +936,78 @@ KbdAddEvent(int down, int param1, int param2, int param3, int param4)
void void
KbdSync(int param1) KbdSync(int param1)
{ {
#if 0
KeyClassPtr keyc; KeyClassPtr keyc;
int mask;
int latches;
int status;
if (g_kbdDevice == 0) if (g_kbdDevice == 0)
{ {
return; 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; keyc = g_kbdDevice->key;
if (keyc == 0) if (keyc == 0)
{ {
return; return;
} }
#if 0
if ((!(keyc->state & 0x02)) != (!(param1 & 4))) /* caps lock */
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 */
{ {
KbdAddEvent(1, 58, 0, 58, 0); KbdAddEvent(1, 58, 0, 58, 0);
KbdAddEvent(0, 58, 49152, 58, 49152); KbdAddEvent(0, 58, 49152, 58, 49152);
} }
if ((!(keyc->state & 0x10)) != (!(param1 & 2))) /* num lock */ //if ((!(keyc->state & 0x10)) != (!(param1 & 2))) /* num lock */
if (param1 & 2) /* num lock */
{ {
KbdAddEvent(1, 69, 0, 69, 0); KbdAddEvent(1, 69, 0, 69, 0);
KbdAddEvent(0, 69, 49152, 69, 49152); KbdAddEvent(0, 69, 49152, 69, 49152);
} }
#endif
if ((!(g_scroll_lock_down)) != (!(param1 & 1))) /* scroll lock */ if ((!(g_scroll_lock_down)) != (!(param1 & 1))) /* scroll lock */
{ {
KbdAddEvent(1, 70, 0, 70, 0); KbdAddEvent(1, 70, 0, 70, 0);
KbdAddEvent(0, 70, 49152, 70, 49152); KbdAddEvent(0, 70, 49152, 70, 49152);
} }
#endif #endif
#endif
} }

@ -172,6 +172,7 @@ rdpWakeupHandler1(pointer blockData, int result, pointer pReadmask)
rdpup_check(); rdpup_check();
} }
#if 0
/******************************************************************************/ /******************************************************************************/
static Bool static Bool
rdpDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) rdpDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
@ -186,6 +187,24 @@ rdpDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
{ {
ErrorF("rdpDeviceCursorCleanupProcPtr:\n"); ErrorF("rdpDeviceCursorCleanupProcPtr:\n");
} }
#endif
#if 0
/******************************************************************************/
Bool
rdpCreateColormap(ColormapPtr pCmap)
{
ErrorF("rdpCreateColormap:\n");
return 1;
}
/******************************************************************************/
static void
rdpDestroyColormap(ColormapPtr pColormap)
{
ErrorF("rdpDestroyColormap:\n");
}
#endif
/******************************************************************************/ /******************************************************************************/
/* returns boolean, true if everything is ok */ /* returns boolean, true if everything is ok */
@ -325,6 +344,10 @@ rdpScreenInit(int index, ScreenPtr pScreen, int argc, char** argv)
/* Backing store procedures */ /* Backing store procedures */
g_rdpScreen.RestoreAreas = pScreen->RestoreAreas; g_rdpScreen.RestoreAreas = pScreen->RestoreAreas;
g_rdpScreen.WakeupHandler = pScreen->WakeupHandler; g_rdpScreen.WakeupHandler = pScreen->WakeupHandler;
g_rdpScreen.CreateColormap = pScreen->CreateColormap;
g_rdpScreen.DestroyColormap = pScreen->DestroyColormap;
ps = GetPictureScreenIfSet(pScreen); ps = GetPictureScreenIfSet(pScreen);
if (ps) if (ps)
{ {
@ -353,11 +376,18 @@ rdpScreenInit(int index, ScreenPtr pScreen, int argc, char** argv)
/* Backing store procedures */ /* Backing store procedures */
pScreen->RestoreAreas = rdpRestoreAreas; pScreen->RestoreAreas = rdpRestoreAreas;
#if 0
pScreen->CreateColormap = rdpCreateColormap;
pScreen->DestroyColormap = rdpDestroyColormap;
#endif
miPointerInitialize(pScreen, &g_rdpSpritePointerFuncs, miPointerInitialize(pScreen, &g_rdpSpritePointerFuncs,
&g_rdpPointerCursorFuncs, 1); &g_rdpPointerCursorFuncs, 1);
//pScreen->DeviceCursorInitialize = rdpDeviceCursorInitialize; #if 0
//pScreen->DeviceCursorCleanup = rdpDeviceCursorCleanup; pScreen->DeviceCursorInitialize = rdpDeviceCursorInitialize;
pScreen->DeviceCursorCleanup = rdpDeviceCursorCleanup;
#endif
vis_found = 0; vis_found = 0;
vis = g_pScreen->visuals + (g_pScreen->numVisuals - 1); vis = g_pScreen->visuals + (g_pScreen->numVisuals - 1);
@ -374,17 +404,22 @@ rdpScreenInit(int index, ScreenPtr pScreen, int argc, char** argv)
rdpLog("rdpScreenInit: couldn't find root visual\n"); rdpLog("rdpScreenInit: couldn't find root visual\n");
exit(1); exit(1);
} }
if (g_rdpScreen.bitsPerPixel == 1) ret = 1;
{ if (ret)
ret = fbCreateDefColormap(pScreen);
}
else
{ {
ret = fbCreateDefColormap(pScreen); ret = fbCreateDefColormap(pScreen);
if (!ret)
{
ErrorF("rdpScreenInit: fbCreateDefColormap failed\n");
}
} }
if (ret) if (ret)
{ {
ret = rdpup_init(); ret = rdpup_init();
if (!ret)
{
ErrorF("rdpScreenInit: rdpup_init failed\n");
}
} }
if (ret) if (ret)
{ {
@ -551,6 +586,8 @@ InitInput(int argc, char** argv)
mieqInit(k, p); mieqInit(k, p);
#endif #endif
mieqInit();
} }
/******************************************************************************/ /******************************************************************************/
@ -559,6 +596,7 @@ ddxGiveUp(void)
{ {
char unixSocketName[64]; char unixSocketName[64];
ErrorF("ddxGiveUp:\n");
g_free(g_rdpScreen.pfbMemory); g_free(g_rdpScreen.pfbMemory);
if (g_initOutputCalled) if (g_initOutputCalled)
{ {

@ -437,6 +437,96 @@ g_tcp_listen(int sck)
return listen(sck, 2); return listen(sck, 2);
} }
/*****************************************************************************/
/* returns boolean */
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
}
/*****************************************************************************/
/* returns boolean, non zero if the directory exists */
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)
{
return S_ISDIR(st.st_mode);
}
else
{
return 0;
}
#endif
}
/*****************************************************************************/
/* returns error */
int
g_chmod_hex(const char* filename, int flags)
{
int fl;
fl = 0;
fl |= (flags & 0x4000) ? S_ISUID : 0;
fl |= (flags & 0x2000) ? S_ISGID : 0;
fl |= (flags & 0x1000) ? S_ISVTX : 0;
fl |= (flags & 0x0400) ? S_IRUSR : 0;
fl |= (flags & 0x0200) ? S_IWUSR : 0;
fl |= (flags & 0x0100) ? S_IXUSR : 0;
fl |= (flags & 0x0040) ? S_IRGRP : 0;
fl |= (flags & 0x0020) ? S_IWGRP : 0;
fl |= (flags & 0x0010) ? S_IXGRP : 0;
fl |= (flags & 0x0004) ? S_IROTH : 0;
fl |= (flags & 0x0002) ? S_IWOTH : 0;
fl |= (flags & 0x0001) ? S_IXOTH : 0;
return chmod(filename, fl);
}
/* produce a hex dump */
void
hexdump(unsigned char* p, unsigned int len)
{
unsigned char* line;
int i;
int thisline;
int offset;
offset = 0;
line = p;
while (offset < len)
{
ErrorF("%04x ", offset);
thisline = len - offset;
if (thisline > 16)
thisline = 16;
for (i = 0; i < thisline; i++)
ErrorF("%02x ", line[i]);
for (; i < 16; i++)
ErrorF(" ");
for (i = 0; i < thisline; i++)
ErrorF("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.');
ErrorF("\n");
offset += thisline;
line += thisline;
}
}
/* /*
stub for XpClient* functions. stub for XpClient* functions.
*/ */

@ -282,7 +282,7 @@ rdpup_recv_msg(struct stream* s)
static int static int
process_screen_size_msg(int width, int height, int bpp) process_screen_size_msg(int width, int height, int bpp)
{ {
RRScreenSizePtr pSize; //RRScreenSizePtr pSize;
int mmwidth; int mmwidth;
int mmheight; int mmheight;
//int error; //int error;
@ -314,8 +314,8 @@ process_screen_size_msg(int width, int height, int bpp)
} }
mmwidth = PixelToMM(width); mmwidth = PixelToMM(width);
mmheight = PixelToMM(height); mmheight = PixelToMM(height);
pSize = RRRegisterSize(g_pScreen, width, height, mmwidth, mmheight); //pSize = RRRegisterSize(g_pScreen, width, height, mmwidth, mmheight);
RRSetCurrentConfig(g_pScreen, RR_Rotate_0, 0, pSize); //RRSetCurrentConfig(g_pScreen, RR_Rotate_0, 0, pSize);
if ((g_rdpScreen.width != width) || (g_rdpScreen.height != height)) if ((g_rdpScreen.width != width) || (g_rdpScreen.height != height))
{ {
//error = RRSetScreenConfig(g_pScreen, RR_Rotate_0, 0, pSize); //error = RRSetScreenConfig(g_pScreen, RR_Rotate_0, 0, pSize);
@ -445,6 +445,15 @@ rdpup_init(void)
char text[256]; char text[256];
int i; int i;
if (!g_directory_exist("/tmp/.xrdp"))
{
if (!g_create_dir("/tmp/.xrdp"))
{
ErrorF("rdpup_init: g_create_dir failed\n");
return 0;
}
g_chmod_hex("/tmp/.xrdp", 0x1777);
}
i = atoi(display); i = atoi(display);
if (i < 1) if (i < 1)
{ {

Loading…
Cancel
Save