Skip to content

Commit

Permalink
Merge pull request #2 from matt335672/seflerz_unicode
Browse files Browse the repository at this point in the history
Seflerz unicode
  • Loading branch information
seflerZ authored May 1, 2024
2 parents d87724e + 2d21566 commit 0982221
Show file tree
Hide file tree
Showing 12 changed files with 165 additions and 66 deletions.
4 changes: 2 additions & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ FreeBSD_task:
freebsd_instance:
image_family: freebsd-13-2
prepare_script:
- pkg install -y $SSL git autoconf automake libtool pkgconf opus jpeg-turbo fdk-aac pixman libX11 libXfixes libXrandr nasm fusefs-libs check imlib2 freetype2 cmocka
- pkg install -y $SSL git autoconf automake libtool pkgconf opus jpeg-turbo fdk-aac pixman libX11 libXfixes libXrandr nasm fusefs-libs check imlib2 freetype2 cmocka ibus
- git submodule update --init --recursive
configure_script:
- ./bootstrap
- env CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./configure --localstatedir=/var --enable-strict-locations --with-pkgconfigdir=/usr/local/libdata/pkgconfig --enable-strict-locations --enable-ipv6 --enable-opus --enable-jpeg --enable-fdkaac --enable-painter --enable-pixman --enable-fuse --with-imlib2 --with-freetype2
- env CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./configure --localstatedir=/var --enable-strict-locations --with-pkgconfigdir=/usr/local/libdata/pkgconfig --enable-strict-locations --enable-ibus --enable-ipv6 --enable-opus --enable-jpeg --enable-fdkaac --enable-painter --enable-pixman --enable-fuse --with-imlib2 --with-freetype2
build_script:
- make -j $(sysctl -n hw.ncpu || echo 4)
check_script:
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ jobs:
CONF_FLAGS_amd64_min: "--disable-ipv6 --disable-jpeg --disable-fuse --disable-mp3lame
--disable-fdkaac --disable-opus --disable-rfxcodec --disable-painter
--disable-pixman --disable-utmp"
CONF_FLAGS_amd64_max: "--enable-ipv6 --enable-jpeg --enable-fuse --enable-mp3lame
--enable-fdkaac --enable-opus --enable-rfxcodec --enable-painter
--enable-pixman --enable-utmp
CONF_FLAGS_amd64_max: "--enable-ibus --enable-ipv6 --enable-jpeg --enable-fuse
--enable-mp3lame --enable-fdkaac --enable-opus --enable-rfxcodec
--enable-painter --enable-pixman --enable-utmp
--with-imlib2 --with-freetype2 --enable-tests"
CONF_FLAGS_i386_max: "--enable-ipv6 --enable-jpeg --enable-mp3lame
--enable-opus --enable-rfxcodec --enable-painter
--disable-pixman --with-imlib2 --with-freetype2
--host=i686-linux --enable-tests"
CONF_FLAGS_i386_max: "--enable-ibus --enable-ipv6 --enable-jpeg
--enable-mp3lame --enable-opus --enable-rfxcodec
--enable-painter --disable-pixman --with-imlib2
--with-freetype2 --host=i686-linux --enable-tests"

PKG_CONFIG_PATH_i386: "/usr/lib/i386-linux-gnu/pkgconfig"
CFLAGS_i386: "-m32"
Expand Down
11 changes: 11 additions & 0 deletions common/xrdp_client_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ enum client_resize_mode
CRMODE_MULTI_SCREEN
};

/**
* Type describing Unicode input state
*/
enum unicode_input_state
{
UIS_UNSUPPORTED = 0, ///< Client does not support Unicode
UIS_SUPPORTED, ///< Client supports Unicode, but it's not active
UIS_ACTIVE ///< Unicode input is active
};
/**
* Information about the xrdp client
*
Expand Down Expand Up @@ -228,6 +237,8 @@ struct xrdp_client_info

// Can we resize the desktop by using a Deactivation-Reactivation Sequence?
enum client_resize_mode client_resize_mode;

enum unicode_input_state unicode_input_support;
};

enum xrdp_encoder_flags
Expand Down
14 changes: 14 additions & 0 deletions libxrdp/xrdp_caps.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,20 @@ xrdp_caps_process_input(struct xrdp_rdp *self, struct stream *s,
{
self->client_info.use_fast_path &= ~2;
}

// We always advertise Unicode support, so if the client supports it too,
// we can use it
if ((inputFlags & INPUT_FLAG_UNICODE) != 0)
{
self->client_info.unicode_input_support = UIS_SUPPORTED;
LOG(LOG_LEVEL_INFO, "Client supports Unicode input");
}
else
{
self->client_info.unicode_input_support = UIS_UNSUPPORTED;
LOG(LOG_LEVEL_INFO, "Client does not support Unicode input");
}

return 0;
}

Expand Down
2 changes: 2 additions & 0 deletions scripts/install_xrdp_build_dependencies_with_apt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ in
libjpeg-dev \
libmp3lame-dev \
libfdk-aac-dev \
libibus-1.0-dev \
libimlib2-dev \
libopus-dev \
libpixman-1-dev"
Expand All @@ -118,6 +119,7 @@ in
$LIBFREETYPE_DEV:i386 \
libgl1-mesa-dev:i386 \
libglu1-mesa-dev:i386 \
libibus-1.0-dev:i386 \
libjpeg-dev:i386 \
libimlib2-dev:i386 \
libmp3lame-dev:i386 \
Expand Down
14 changes: 8 additions & 6 deletions sesman/chansrv/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ if XRDP_RDPSNDAUDIN
AM_CPPFLAGS += -DXRDP_RDPSNDAUDIN
endif

if XRDP_IBUS
AM_CPPFLAGS += -DXRDP_IBUS $(IBUS_CFLAGS) $(GLIB2_CFLAGS)
CHANSRV_EXTRA_LIBS += $(IBUS_LIBS) $(GLIB2_LIBS)
endif

AM_CFLAGS = $(X_CFLAGS)

sbin_PROGRAMS = \
Expand Down Expand Up @@ -78,11 +73,18 @@ xrdp_chansrv_SOURCES = \
sound.h \
xcommon.c \
xcommon.h \
input_ibus.c \
input.h \
audin.c \
audin.h

if XRDP_IBUS
AM_CPPFLAGS += -DXRDP_IBUS $(IBUS_CFLAGS) $(GLIB2_CFLAGS)
CHANSRV_EXTRA_LIBS += $(IBUS_LIBS) $(GLIB2_LIBS)
xrdp_chansrv_SOURCES += \
input_ibus.c
endif


xrdp_chansrv_LDFLAGS = \
$(X_LIBS)

Expand Down
45 changes: 42 additions & 3 deletions sesman/chansrv/chansrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,26 @@ chansrv_drdynvc_open(const char *name, int flags,
return error;
}


/*****************************************************************************/
/* tell xrdp we can do Unicode input */
static int
chansrv_advertise_unicode_input(int status)
{
struct stream *s = trans_get_out_s(g_con_trans, 8192);
if (s == NULL)
{
return 1;
}
out_uint32_le(s, 0); /* version */
out_uint32_le(s, 8 + 8 + 4);
out_uint32_le(s, 20); /* msg id */
out_uint32_le(s, 8 + 4);
out_uint32_le(s, status);
s_mark_end(s);
return trans_write_copy(g_con_trans);
}

/*****************************************************************************/
/* close call from chansrv */
int
Expand Down Expand Up @@ -861,7 +881,18 @@ process_message_unicode_data(struct stream *s)
static int
process_message_unicode_setup(struct stream *s)
{
return xrdp_input_unicode_init();
int rv = xrdp_input_unicode_init();
if (rv == 0)
{
// Tell xrdp we can support Unicode input
rv = chansrv_advertise_unicode_input(0);
}
else
{
// Tell xrdp there's a problem starting the framework
chansrv_advertise_unicode_input(2);
}
return rv;
}

/*****************************************************************************/
Expand Down Expand Up @@ -924,17 +955,25 @@ process_message(void)
case 19: /* drdynvc data */
rv = process_message_drdynvc_data(s);
break;
#ifdef XRDP_IBUS
case 21: /* unicode setup */
#ifdef XRDP_IBUS
rv = process_message_unicode_setup(s);
#else
// We don't support this.
rv = chansrv_advertise_unicode_input(1);
#endif
break;
case 23: /* unicode key event */
#ifdef XRDP_IBUS
rv = process_message_unicode_data(s);
#endif
break;
case 25: /* unicode shut down */
#ifdef XRDP_IBUS
rv = process_message_unicode_shutdown(s);
break;
#endif
break;

default:
LOG_DEVEL(LOG_LEVEL_ERROR, "process_message: unknown msg %d", id);
break;
Expand Down
4 changes: 2 additions & 2 deletions sesman/chansrv/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
#include "parse.h"

int
xrdp_input_send_unicode(uint32_t unicode);
xrdp_input_send_unicode(char32_t unicode);

int
xrdp_input_unicode_init();

int
xrdp_input_unicode_destory();

#endif
#endif
4 changes: 2 additions & 2 deletions sesman/chansrv/input_ibus.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ xrdp_input_ibus_create_engine(IBusFactory *factory,

/*****************************************************************************/
THREAD_RV THREAD_CC
xrdp_input_main_loop()
xrdp_input_main_loop(void *in_val)
{
IBusFactory *factory;
IBusComponent *component;
Expand Down Expand Up @@ -244,4 +244,4 @@ xrdp_input_unicode_init()
}

return 1;
}
}
7 changes: 1 addition & 6 deletions xrdp/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/libipm \
-I$(top_srcdir)/libxrdp \
-I$(top_srcdir)/third_party \
-I$(top_srcdir)/third_party/tomlc99 \
$(IBUS_CFLAGS)
-I$(top_srcdir)/third_party/tomlc99

XRDP_EXTRA_LIBS =

Expand All @@ -38,10 +37,6 @@ AM_CPPFLAGS += -I$(top_srcdir)/libpainter/include
XRDP_EXTRA_LIBS += $(top_builddir)/libpainter/src/.libs/libpainter.a
endif

if XRDP_IBUS
AM_CPPFLAGS += -DXRDP_IBUS
endif

sbin_PROGRAMS = \
xrdp

Expand Down
Loading

0 comments on commit 0982221

Please sign in to comment.