From: Dietmar Maurer Date: Wed, 11 Sep 2013 11:15:53 +0000 (+0200) Subject: use gunichar2 X-Git-Url: https://git.proxmox.com/?p=spiceterm.git;a=commitdiff_plain;h=b052e9c7dc3a8fcef287a2a6ebb92811f05509de use gunichar2 --- diff --git a/screen.c b/screen.c index 1dbbedb..b0b4444 100644 --- a/screen.c +++ b/screen.c @@ -672,7 +672,7 @@ spice_screen_add_agent_interface(SpiceServer *server) } void -spice_screen_draw_char(SpiceScreen *spice_screen, int x, int y, gunichar ch, TextAttributes attrib) +spice_screen_draw_char(SpiceScreen *spice_screen, int x, int y, gunichar2 ch, TextAttributes attrib) { int fg, bg; diff --git a/spiceterm.c b/spiceterm.c index 6695837..6a09e40 100644 --- a/spiceterm.c +++ b/spiceterm.c @@ -89,7 +89,7 @@ print_usage (const char *msg) /* Convert UCS2 to UTF8 sequence, trailing zero */ /* static int -ucs2_to_utf8 (unicode c, char *out) +ucs2_to_utf8 (gunichar2 c, char *out) { if (c < 0x80) { out[0] = c; // 0******* @@ -113,7 +113,7 @@ ucs2_to_utf8 (unicode c, char *out) */ static void -draw_char_at (spiceTerm *vt, int x, int y, unicode ch, TextAttributes attrib) +draw_char_at (spiceTerm *vt, int x, int y, gunichar2 ch, TextAttributes attrib) { if (x < 0 || y < 0 || x >= vt->width || y >= vt->height) { return; @@ -617,7 +617,7 @@ enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey, ESpalette, ESidquery, ESosc1, ESosc2}; static void -spiceterm_putchar (spiceTerm *vt, unicode ch) +spiceterm_putchar (spiceTerm *vt, gunichar2 ch) { int x, y, i, c; @@ -1179,7 +1179,7 @@ spiceterm_putchar (spiceTerm *vt, unicode ch) static int spiceterm_puts (spiceTerm *vt, const char *buf, int len) { - unicode tc; + gunichar2 tc; spiceterm_show_cursor (vt, 0); @@ -1257,7 +1257,7 @@ spiceterm_set_xcut_text (char* str, int len, struct _rfbClientRec* cl) // seems str is Latin-1 encoded if (vt->selection) free (vt->selection); - vt->selection = (unicode *)malloc (len*sizeof (unicode)); + vt->selection = (gunichar2 *)malloc (len*sizeof (gunichar2)); int i; for (i = 0; i < len; i++) { vt->selection[i] = str[i] & 0xff; @@ -1407,7 +1407,7 @@ spiceterm_pointer_event (int buttonMask, int x, int y, rfbClientPtr cl) int len = sel_end_pos - sel_start_pos + 1; if (vt->selection) free (vt->selection); - vt->selection = (unicode *)malloc (len*sizeof (unicode)); + vt->selection = (gunichar2 *)malloc (len*sizeof (gunichar2)); vt->selection_len = len; char *sel_latin1 = (char *)malloc (len + 1); diff --git a/spiceterm.h b/spiceterm.h index 679267d..0f01653 100644 --- a/spiceterm.h +++ b/spiceterm.h @@ -7,7 +7,7 @@ #define IBUFSIZE 1024 #define MAX_ESC_PARAMS 16 -typedef unsigned short unicode; // fixme +//typedef unsigned short unicode; // fixme typedef struct TextAttributes { unsigned int fgcol:4; @@ -20,7 +20,7 @@ typedef struct TextAttributes { } TextAttributes; typedef struct TextCell { - unicode ch; + gunichar2 ch; TextAttributes attrib; } TextCell; @@ -70,7 +70,7 @@ SpiceScreen* spice_screen_new(SpiceCoreInterface* core); void spice_screen_add_display_interface(SpiceScreen *spice_screen); void spice_screen_add_agent_interface(SpiceServer *server); -void spice_screen_draw_char(SpiceScreen *spice_screen, int x, int y, gunichar ch, TextAttributes attrib); +void spice_screen_draw_char(SpiceScreen *spice_screen, int x, int y, gunichar2 ch, TextAttributes attrib); void spice_screen_scroll(SpiceScreen *spice_screen, int x1, int y1, int x2, int y2, int src_x, int src_y); void spice_screen_clear(SpiceScreen *spice_screen, int x1, int y1, int x2, int y2); @@ -134,7 +134,7 @@ typedef struct spiceTerm { char ibuf[IBUFSIZE]; int ibuf_count; - unicode *selection; + gunichar2 *selection; int selection_len; unsigned int mark_active:1;