Merge branch 'devel' of https://github.com/neutrinolabs/xrdp into surface_cmds

This commit is contained in:
Speidy 2016-12-12 15:51:39 -08:00
commit a0cf6030df
8 changed files with 126 additions and 36 deletions

View File

@ -681,7 +681,7 @@ g_sck_close(int sck)
char addr[48];
struct sockaddr_in6 *sock_addr_in6 = &sock_info.sock_addr_in6;
g_snprintf(sockname, sizeof(sockname), "AF_INET6 %s:%d",
g_snprintf(sockname, sizeof(sockname), "AF_INET6 %s port %d",
inet_ntop(sock_addr_in6->sin6_family,
&sock_addr_in6->sin6_addr, addr, sizeof(addr)),
ntohs(sock_addr_in6->sin6_port));

View File

@ -160,6 +160,7 @@
#define RDP_INPUT_CODEPOINT 1
#define RDP_INPUT_VIRTKEY 2
#define RDP_INPUT_SCANCODE 4
#define RDP_INPUT_UNICODE 5
#define RDP_INPUT_MOUSE 0x8001
#define RDP_INPUT_MOUSEX 0x8002
@ -626,4 +627,10 @@
#define XRDP_MAX_BITMAP_CACHE_IDX 2000
#define XRDP_BITMAP_CACHE_ENTRIES 2048
#define XR_MIN_KEY_CODE 8
#define XR_MAX_KEY_CODE 256
#define XR_RDP_SCAN_LSHIFT 42
#define XR_RDP_SCAN_ALT 56
#endif

View File

@ -846,6 +846,7 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self)
out_uint8(s, 0x01); /* fAllowDynamicFidelity */
out_uint8(s, 0x01); /* fAllowSubsampling */
out_uint8(s, 0x03); /* colorLossLevel */
#if defined(XRDP_RFXCODEC) || defined(XRDP_NEUTRINORDP)
/* remotefx */
codec_caps_count++;
out_uint8a(s, XR_CODEC_GUID_REMOTEFX, 16);
@ -858,6 +859,7 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self)
out_uint8(s, 0); /* codec id, client sets */
out_uint16_le(s, 4); /* codecPropertiesLength */
out_uint32_le(s, 0); /* reserved */
#endif
/* jpeg */
codec_caps_count++;
out_uint8a(s, XR_CODEC_GUID_JPEG, 16);
@ -891,16 +893,10 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self)
out_uint16_le(s, RDP_CAPSET_INPUT); /* 13(0xd) */
out_uint16_le(s, RDP_CAPLEN_INPUT); /* 88(0x58) */
/* INPUT_FLAG_SCANCODES 0x0001
INPUT_FLAG_MOUSEX 0x0004
INPUT_FLAG_FASTPATH_INPUT 0x0008
INPUT_FLAG_FASTPATH_INPUT2 0x0020 */
flags = 0x0001 | 0x0004;
flags = INPUT_FLAG_SCANCODES | INPUT_FLAG_MOUSEX | INPUT_FLAG_UNICODE;
if (self->client_info.use_fast_path & 2)
{
/* 0x0008 INPUT_FLAG_FASTPATH_INPUT */
/* 0x0020 INPUT_FLAG_FASTPATH_INPUT2 */
flags |= 0x0008 | 0x0020;
flags |= INPUT_FLAG_FASTPATH_INPUT | INPUT_FLAG_FASTPATH_INPUT2;
}
out_uint16_le(s, flags);
out_uint8s(s, 82);

View File

@ -265,12 +265,30 @@ static int APP_CC
xrdp_fastpath_process_EVENT_UNICODE(struct xrdp_fastpath *self,
int eventFlags, struct stream *s)
{
if (!s_check_rem(s, 2))
{
return 1;
}
in_uint8s(s, 2);
return 0;
int flags;
int code;
flags = 0;
if (!s_check_rem(s, 2))
{
return 1;
}
in_uint16_le(s, code); /* unicode (2 byte) */
if (eventFlags & FASTPATH_INPUT_KBDFLAGS_RELEASE)
{
flags |= KBD_FLAG_UP;
}
else
{
flags |= KBD_FLAG_DOWN;
}
if (eventFlags & FASTPATH_INPUT_KBDFLAGS_EXTENDED)
{
flags |= KBD_FLAG_EXT;
}
xrdp_fastpath_session_callback(self, RDP_INPUT_UNICODE,
code, 0, flags, 0);
return 0;
}
/*****************************************************************************/

View File

@ -528,10 +528,10 @@ session_start_fork(tbus data, tui8 type, struct SCP_SESSION *s)
"setsid failed - pid %d", g_getpid());
}
if (g_setlogin(username) < 0)
if (g_setlogin(s->username) < 0)
{
log_message(LOG_LEVEL_ERROR,
"setlogin failed for user %s - pid %d", username,
"setlogin failed for user %s - pid %d", s->username,
g_getpid());
}
}

View File

@ -1288,7 +1288,7 @@ lib_mod_connect(struct vnc *v)
out_uint8(pixel_format, 0); /* blue shift */
out_uint8s(pixel_format, 3); /* pad */
}
else if (v->mod_bpp == 24)
else if (v->mod_bpp == 24 || v->mod_bpp == 32)
{
out_uint8(pixel_format, 32); /* bits per pixel */
out_uint8(pixel_format, 24); /* depth */

View File

@ -42,8 +42,10 @@
/*****************************************************************************/
static int
process_enc_jpg(struct xrdp_encoder *self, XRDP_ENC_DATA *enc);
#ifdef XRDP_RFXCODEC
static int
process_enc_rfx(struct xrdp_encoder *self, XRDP_ENC_DATA *enc);
#endif
static int
process_enc_h264(struct xrdp_encoder *self, XRDP_ENC_DATA *enc);
@ -82,6 +84,7 @@ xrdp_encoder_create(struct xrdp_mm *mm)
(32 << 24) | (3 << 16) | (8 << 12) | (8 << 8) | (8 << 4) | 8;
self->process_enc = process_enc_jpg;
}
#ifdef XRDP_RFXCODEC
else if (client_info->rfx_codec_id != 0)
{
LLOGLN(0, ("xrdp_encoder_create: starting rfx codec session"));
@ -89,13 +92,11 @@ xrdp_encoder_create(struct xrdp_mm *mm)
self->in_codec_mode = 1;
client_info->capture_code = 2;
self->process_enc = process_enc_rfx;
#ifdef XRDP_RFXCODEC
self->codec_handle =
rfxcodec_encode_create(mm->wm->screen->width,
mm->wm->screen->height,
RFX_FORMAT_YUV, 0);
#endif
self->codec_handle = rfxcodec_encode_create(mm->wm->screen->width,
mm->wm->screen->height,
RFX_FORMAT_YUV, 0);
}
#endif
else if (client_info->h264_codec_id != 0)
{
LLOGLN(0, ("xrdp_encoder_create: starting h264 codec session"));
@ -291,7 +292,6 @@ process_enc_jpg(struct xrdp_encoder *self, XRDP_ENC_DATA *enc)
}
#ifdef XRDP_RFXCODEC
/*****************************************************************************/
/* called from encoder thread */
static int
@ -394,17 +394,6 @@ process_enc_rfx(struct xrdp_encoder *self, XRDP_ENC_DATA *enc)
return 0;
}
#else
/*****************************************************************************/
/* called from encoder thread */
static int
process_enc_rfx(struct xrdp_encoder *self, XRDP_ENC_DATA *enc)
{
return 0;
}
#endif
/*****************************************************************************/

View File

@ -1525,6 +1525,83 @@ xrdp_wm_key_sync(struct xrdp_wm *self, int device_flags, int key_flags)
return 0;
}
/*****************************************************************************/
int APP_CC
xrdp_wm_key_unicode(struct xrdp_wm *self, int device_flags, int unicode)
{
int index;
for (index = XR_MIN_KEY_CODE; index < XR_MAX_KEY_CODE; index++)
{
if (unicode == self->keymap.keys_noshift[index].chr)
{
xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
return 0;
}
}
for (index = XR_MIN_KEY_CODE; index < XR_MAX_KEY_CODE; index++)
{
if (unicode == self->keymap.keys_shift[index].chr)
{
if (device_flags & KBD_FLAG_UP)
{
xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
xrdp_wm_key(self, KBD_FLAG_UP, XR_RDP_SCAN_LSHIFT);
}
else
{
xrdp_wm_key(self, KBD_FLAG_DOWN, XR_RDP_SCAN_LSHIFT);
xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
}
return 0;
}
}
for (index = XR_MIN_KEY_CODE; index < XR_MAX_KEY_CODE; index++)
{
if (unicode == self->keymap.keys_altgr[index].chr)
{
if (device_flags & KBD_FLAG_UP)
{
xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
xrdp_wm_key(self, KBD_FLAG_UP | KBD_FLAG_EXT,
XR_RDP_SCAN_ALT);
}
else
{
xrdp_wm_key(self, KBD_FLAG_DOWN | KBD_FLAG_EXT,
XR_RDP_SCAN_ALT);
xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
}
return 0;
}
}
for (index = XR_MIN_KEY_CODE; index < XR_MAX_KEY_CODE; index++)
{
if (unicode == self->keymap.keys_shiftaltgr[index].chr)
{
if (device_flags & KBD_FLAG_UP)
{
xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
xrdp_wm_key(self, KBD_FLAG_UP | KBD_FLAG_EXT, XR_RDP_SCAN_ALT);
xrdp_wm_key(self, KBD_FLAG_UP, XR_RDP_SCAN_LSHIFT);
}
else
{
xrdp_wm_key(self, KBD_FLAG_DOWN, XR_RDP_SCAN_LSHIFT);
xrdp_wm_key(self, KBD_FLAG_DOWN | KBD_FLAG_EXT,
XR_RDP_SCAN_ALT);
xrdp_wm_key(self, device_flags, index - XR_MIN_KEY_CODE);
}
return 0;
}
}
return 0;
}
/*****************************************************************************/
int APP_CC
xrdp_wm_pu(struct xrdp_wm *self, struct xrdp_bitmap *control)
@ -1721,6 +1798,9 @@ callback(long id, int msg, long param1, long param2, long param3, long param4)
case 4: /* RDP_INPUT_SCANCODE */
rv = xrdp_wm_key(wm, param3, param1);
break;
case 5: /* RDP_INPUT_UNICODE */
rv = xrdp_wm_key_unicode(wm, param3, param1);
break;
case 0x8001: /* RDP_INPUT_MOUSE */
rv = xrdp_wm_process_input_mouse(wm, param3, param1, param2);
break;