Merge branch 'master' of github.com:VincentWei/minigui

This commit is contained in:
VincentWei
2018-02-02 15:30:36 +08:00
19 changed files with 251 additions and 125 deletions
+19 -5
View File
@@ -61,15 +61,16 @@ pointer precision.
#### Integer macros
`MAKEWPARAM`: this new macro makes a WPARAM value by using four bytes.
On the contrary, `FIRSTBYTE`, `SECONDBYTE`, `THIRDBYTE`, and `FOURTH`
macros get the four bytes from a `WPARAM` or a `Uint32` value.
`MAKEWORD16`: this new macro makes a 16-bit word by using two bytes.
Meanwhile, `MAKEWORD` makes a 16-bit word on 32-bit platform, and a 32-bit
word on 64-bit platform.
`LOBYTE_WORD16` and `HIBYTE_WORD16`: these two new macros get the low byte
and the high byte in a 16-bit word respectively.
Note that `MAKELONG` macro always makes a `DWORD` integer, which has pointer
precision.
precision. Meanwhile, `MAKELONG32` macro makes a `Uint32` integer.
Note that `MakeRGB` and `MakeRGBA` macros always make `DWORD32` integers.
In contract, `GetRValue`, `GetRValue`, `GetBValue`, `GetAValue` always
@@ -104,7 +105,7 @@ The main changes in structure and functions:
##### Message
As a result, the strcuture `MSG` and all message-related functions changed.
The strcuture `MSG` and all message-related functions changed.
For example, the prototype of `SendMessage` changed from
int SendMessage (HWND hWnd, int nMsg, WPARAM wParam, LPARAM lParam)
@@ -113,6 +114,19 @@ to
LRESULT SendMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
_IMPORTANT NOTE_
For best portability, you should use `FIRSTBYTE` to `FOURTHBYTE` macros
to get the bytes of a character when you extract the bytes from `WPARAM`
parameter of a `MSG_CHAR` message:
MSG_CHAR
unsigned char ch_buff [4];
unsigned char ch_buff [0] = FIRSTBYTE(wParam);
unsigned char ch_buff [1] = SECONDBYTE(wParam);
unsigned char ch_buff [2] = THIRDBYTE(wParam);
unsigned char ch_buff [3] = FOURTHBYTE(wParam);
##### Window callback procedure
Furthermore, the structure and functions to register window class,
+13 -2
View File
@@ -83,6 +83,7 @@ dnl User selectable options
dnl System wide options
devel_mode="no"
detail_debug="no"
trace_message="no"
message_string="no"
@@ -285,6 +286,10 @@ AC_ARG_ENABLE(develmode,
[ --enable-develmode developer mode <default=no>],
devel_mode=$enableval)
AC_ARG_ENABLE(detaildebug,
[ --enable-detaildebug detailed debug info <default=no>],
detail_debug=$enableval)
AC_ARG_ENABLE(tracemsg,
[ --enable-tracemsg trace messages of MiniGUI <default=no>],
trace_message=$enableval)
@@ -1638,7 +1643,9 @@ fi
if test "x$devel_mode" = "xyes"; then
message_string="yes"
trace_message="no"
if test "x$detail_debug" = "xyes"; then
trace_message="yes"
fi
build_auto_ial_engine="yes"
build_random_ial_engine="yes"
@@ -2426,7 +2433,11 @@ dnl define _GNU_SOURCE for pthread_rwlock_t
CFLAGS="$CFLAGS -D_GNU_SOURCE"
if test "x$devel_mode" = "xyes"; then
CPPFLAGS="$CPPFLAGS -DDEBUG -D_DEBUG"
CPPFLAGS="$CPPFLAGS -D_DEBUG"
if test "x$detail_debug" = "xyes"; then
CPPFLAGS="$CPPFLAGS -DDEBUG"
fi
if test "$ac_cv_prog_gcc" = "yes"; then
CPPFLAGS="$CPPFLAGS -Wall -Werror"
fi
+78 -36
View File
@@ -436,11 +436,11 @@ typedef signed char SBYTE;
#endif
#if SIZEOF_PTR == 8
# define NR_BITS_BYTE (16)
# define NR_BITS_BYTE (8)
# define NR_BITS_WORD (32)
# define NR_BITS_DWORD (64)
# define BITMASK_BYTE (0xFFFF)
# define BITMASK_BYTE (0xFF)
# define BITMASK_WORD (0xFFFFFFFF)
# define BITMASK_DWORD (0xFFFFFFFFFFFFFFFF)
@@ -661,34 +661,64 @@ typedef UINT_PTR LPARAM;
* \def MAKEWORD(low, high)
* \brief Makes a word from \a low byte and \a high byte.
*
* \sa MAKEWORD16
* \sa LOBYTE, HIBYTE
*/
#define MAKEWORD(low, high) ((WORD)(((BYTE)(low)) | (((WORD)((BYTE)(high))) << NR_BITS_BYTE)))
/**
* \def LOBYTE_WORD16(w)
* \brief Returns the low byte of the 16-bit word \a w.
*
* \sa MAKEWORD16
*/
#define LOBYTE_WORD16(w) ((BYTE)(w))
/**
* \def HIBYTE_WORD16(w)
* \brief Returns the high byte of the 16-bit word \a w.
*
* \sa MAKEWORD16
*/
#define HIBYTE_WORD16(w) ((BYTE)(((WORD16)(w) >> 8) & 0xFF))
/**
* \def MAKEWORD16(low, high)
* \brief Makes a 16-bit word from \a low byte and \a high byte.
*
* \sa MAKEWORD
* \sa LOBYTE, HIBYTE
*/
#define MAKEWORD16(low, high) ((WORD16)(((BYTE)(low)) | (((WORD16)((BYTE)(high))) << 8)))
/**
* \def MAKEWPARAM(first, second, third, fourth)
* \brief Makes a WPARAM value with four bytes.
*
* \sa MAKEWORD, FIRSTBYTE, SECONDBYTE, THIRDBYTE, FOURTHBYTE
*/
#define MAKEWPARAM(first, second, third, fourth) \
((WPARAM)( \
((BYTE)(first)) | \
(((WPARAM)((BYTE)(second))) << 8) | \
(((WPARAM)((BYTE)(third))) << 16) | \
(((WPARAM)((BYTE)(fourth))) << 24) \
))
/**
* \def FIRSTBYTE(w)
* \brief Returns the first byte of the WPARAM \a w.
*
* \sa MAKEWPARAM
*/
#define FIRSTBYTE(w) ((BYTE)(w))
/**
* \def SECONDBYTE(w)
* \brief Returns the second byte of the WPARAM \a w.
*
* \sa MAKEWPARAM
*/
#define SECONDBYTE(w) ((BYTE)(((DWORD32)(w)) >> 8))
/**
* \def THIRDBYTE(w)
* \brief Returns the third byte of the WPARAM \a w.
*
* \sa MAKEWPARAM
*/
#define THIRDBYTE(w) ((BYTE)(((DWORD32)(w)) >> 16))
/**
* \def FOURTHBYTE(w)
* \brief Returns the fourth byte of the WPARAM \a w.
*
* \sa MAKEWPARAM
*/
#define FOURTHBYTE(w) ((BYTE)(((DWORD32)(w)) >> 24))
/**
* \def LOWORD(l)
* \brief Returns the low word of the double word \a l
@@ -719,9 +749,17 @@ typedef UINT_PTR LPARAM;
*/
#define HISWORD(l) ((SWORD)((((DWORD)(l)) >> NR_BITS_WORD) & BITMASK_WORD))
/**
* \def MAKELONG32(low, high)
* \brief Makes a 32-bit double word from \a low word and \a high word which are both in 16-bit.
* \sa MAKELONG
*/
#define MAKELONG32(low, high) ((DWORD32)(((WORD16)(low)) | (((DWORD32)((WORD16)(high))) << 16)))
/**
* \def MAKELONG(low, high)
* \brief Makes a double word from \a low word and \a high word.
* \brief Makes a double word with pointer precision from \a low word and \a high word.
* \sa MAKELONG32
*/
#define MAKELONG(low, high) ((DWORD)(((WORD)(low)) | (((DWORD)((WORD)(high))) << NR_BITS_WORD)))
@@ -1934,8 +1972,12 @@ int init_minigui_printf (int (*output_char) (int ch),
#if defined(__GNUC__)
# define _ERR_PRINTF(fmt...) fprintf (stderr, fmt)
# ifdef _DEBUG
# define _MG_PRINTF(fmt...) fprintf (stderr, fmt)
# define _DBG_PRINTF(fmt...) fprintf (stdout, fmt)
# define _MG_PRINTF(fmt...) fprintf (stdout, fmt)
# ifdef DEBUG
# define _DBG_PRINTF(fmt...) fprintf (stdout, fmt)
# else
# define _DBG_PRINTF(fmt...)
# endif
# else
# define _MG_PRINTF(fmt...)
# define _DBG_PRINTF(fmt...)
@@ -1952,7 +1994,18 @@ static inline void _ERR_PRINTF(const char* fmt, ...)
}
static inline void _MG_PRINTF(const char* fmt, ...)
{
#ifdef _DEBUG
#ifdef DEBUG
va_list ap;
va_start (ap, fmt);
vfprintf (stdout, fmt, ap);
fprintf (stdout, "\n");
va_end (ap);
#endif
}
static inline void _DBG_PRINTF(const char* fmt, ...)
{
#if defined(DEBUG) && defined(_DEBUG)
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
@@ -1960,18 +2013,7 @@ static inline void _MG_PRINTF(const char* fmt, ...)
va_end(ap);
#endif
}
static inline void _DBG_PRINTF(const char* fmt, ...)
{
#ifdef _DEBUG
va_list ap;
va_start(ap, fmt);
vfprintf(stdout, fmt, ap);
fprintf(stdout, "\n");
va_end(ap);
#endif
}
#endif /* __GNUC__ */
#endif /* !__GNUC__ */
#ifdef _MGRM_THREADS
+35 -3
View File
@@ -420,13 +420,21 @@ extern "C" {
*
* \code
* MSG_CHAR
* int ch = (int)wParam;
* unsigned char ch_buff [4];
* unsigned char ch_buff [0] = FIRSTBYTE(wParam);
* unsigned char ch_buff [1] = SECONDBYTE(wParam);
* unsigned char ch_buff [2] = THIRDBYTE(wParam);
* unsigned char ch_buff [3] = FOURTHBYTE(wParam);
* DWORD key_flags = (DWORD)lParam;
* \endcode
*
* \param ch The ASCII code of the pressed key.
* \param ch_buff The buffer to store the bytes of the character.
* \param key_flags The shift key status when this message occurred.
*
* \note Please use \a FIRSTBYTE ~ \a FOURTHBYTE to get the bytes
* if the character is a multi-byte character. Use MSG_UTF8CHAR
* to handle the characters encoded in UTF-8.
*
* \sa MSG_SYSCHAR, TranslateMessage, key_defs
*/
#define MSG_CHAR 0x0011
@@ -557,7 +565,31 @@ extern "C" {
*
* \sa MSG_SYSCHAR, TranslateMessage, key_defs
*/
#define MSG_KEYSYM 0x0018
#define MSG_KEYSYM 0x0018
/**
* \def MSG_UTF8CHAR
* \brief A character translated from MSG_KEYDOWN message.
*
* This message generally sent by a IME window to the current active window.
* The chararcter will be encoded in UTF-8.
*
* \code
* MSG_UTF8CHAR
* unsigned char ch_utf8 [6];
* unsigned char ch_utf8 [0] = FIRSTBYTE(wParam);
* unsigned char ch_utf8 [1] = SECONDBYTE(wParam);
* unsigned char ch_utf8 [2] = THIRDBYTE(wParam);
* unsigned char ch_utf8 [3] = FOURTHBYTE(wParam);
* unsigned char ch_utf8 [4] = FIRSTBYTE(lParam);
* unsigned char ch_utf8 [5] = SECONDBYTE(lParam);
* \endcode
*
* \param ch_utf8 The buffer to save the character in UTF-8.
*
* \sa MSG_CHAR, key_defs
*/
#define MSG_UTF8CHAR 0x0019
/**
* \def DEF_LPRESS_TIME
+14 -10
View File
@@ -2463,30 +2463,34 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case MSG_CHAR:
{
unsigned char charBuffer [3];
unsigned char charBuffer [4];
int chars;
_MG_PRINTF("get char-----------------char----%p\n", (PVOID)wParam);
if (wParam == 127) // BS
wParam = '\b';
if (dwStyle & ES_READONLY)
return 0;
charBuffer [0] = LOBYTE (wParam);
charBuffer [1] = HIBYTE (wParam);
charBuffer [2] = (0x00ff0000 & wParam) >> 16;
if (charBuffer [2]) {
charBuffer [0] = FIRSTBYTE (wParam);
charBuffer [1] = SECONDBYTE (wParam);
charBuffer [2] = THIRDBYTE (wParam);
charBuffer [3] = FOURTHBYTE (wParam);
if (charBuffer [3]) {
chars = 4;
}
else if (charBuffer [2]) {
chars = 3;
}
else if (HIBYTE (wParam)) {
else if (charBuffer [1]) {
chars = 2;
}
else {
chars = 1;
if (charBuffer [0] == 127) // BS
charBuffer [0] = '\b';
if (dwStyle & ES_UPPERCASE) {
charBuffer [0] = toupper (charBuffer[0]);
}
+17 -9
View File
@@ -2070,30 +2070,38 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
return sleKeyDown (hWnd, wParam, lParam);
}
case MSG_UTF8CHAR:
_ERR_PRINTF ("CONTROL>EDIT: MSG_UTF8CHAR is not implemented.\n");
break;
case MSG_CHAR:
{
unsigned char charBuffer [3];
unsigned char charBuffer [4];
int chars;
if (wParam == 127) // BS
wParam = '\b';
if (dwStyle & ES_READONLY)
return 0;
charBuffer [0] = LOBYTE (wParam);
charBuffer [1] = HIBYTE (wParam);
charBuffer [2] = (0x00ff0000 & wParam) >> 16;
charBuffer [0] = FIRSTBYTE (wParam);
charBuffer [1] = SECONDBYTE (wParam);
charBuffer [2] = THIRDBYTE (wParam);
charBuffer [3] = FOURTHBYTE (wParam);
if (charBuffer [2]) {
if (charBuffer [3]) {
chars = 4;
}
else if (charBuffer [2]) {
chars = 3;
}
else if (HIBYTE (wParam)) {
else if (charBuffer [1]) {
chars = 2;
}
else {
chars = 1;
if (charBuffer [0] == 127) // BS
charBuffer [0] = '\b';
if (dwStyle & ES_UPPERCASE) {
charBuffer [0] = toupper (charBuffer[0]);
}
+13 -5
View File
@@ -1990,7 +1990,7 @@ static void teSetCaretPosOnChar (HWND hWnd, PTEDATA ptedata, int old_caret_pos)
static void teOnChar (HWND hWnd, PTEDATA ptedata, WPARAM wParam)
{
int chlen;
unsigned char ch[3];
unsigned char ch[4];
TextNode *node;
TextMark *mark;
TextDoc *txtdoc;
@@ -2004,11 +2004,15 @@ static void teOnChar (HWND hWnd, PTEDATA ptedata, WPARAM wParam)
return;
}
ch [0] = LOBYTE (wParam);
ch [1] = HIBYTE (wParam);
ch [2] = (0x0ff0000 & wParam) >> 16;
ch [0] = FIRSTBYTE (wParam);
ch [1] = SECONDBYTE (wParam);
ch [2] = THIRDBYTE (wParam);
ch [3] = FOURTHBYTE (wParam);
if (ch[2]) {
if (ch[3]) {
chlen = 4;
}
else if (ch[2]) {
chlen = 3;
}
else if (ch[1]) {
@@ -3214,6 +3218,10 @@ static LRESULT TextEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM
break;
}
case MSG_UTF8CHAR:
_ERR_PRINTF ("CONTROL>EDIT: MSG_UTF8CHAR is not implemented.\n");
break;
case MSG_CHAR:
if (wParam == 127) /* BS */
wParam = '\b';
+8 -8
View File
@@ -3525,7 +3525,7 @@ static int utf16le_len_first_char (const unsigned char* mstr, int len)
if (len < 2)
return 0;
w1 = MAKEWORD (mstr[0], mstr[1]);
w1 = MAKEWORD16 (mstr[0], mstr[1]);
if (w1 < 0xD800 || w1 > 0xDFFF)
return 2;
@@ -3533,7 +3533,7 @@ static int utf16le_len_first_char (const unsigned char* mstr, int len)
if (w1 >= 0xD800 && w1 <= 0xDBFF) {
if (len < 4)
return 0;
w2 = MAKEWORD (mstr[2], mstr[3]);
w2 = MAKEWORD16 (mstr[2], mstr[3]);
if (w2 < 0xDC00 || w2 > 0xDFFF)
return 0;
}
@@ -3547,12 +3547,12 @@ static Glyph32 utf16le_char_glyph_value (const unsigned char* pre_mchar,
UChar16 w1, w2;
UChar32 wc;
w1 = MAKEWORD (cur_mchar[0], cur_mchar[1]);
w1 = MAKEWORD16 (cur_mchar[0], cur_mchar[1]);
if (w1 < 0xD800 || w1 > 0xDFFF)
return w1;
w2 = MAKEWORD (cur_mchar[2], cur_mchar[3]);
w2 = MAKEWORD16 (cur_mchar[2], cur_mchar[3]);
wc = w1;
wc <<= 10;
@@ -3765,7 +3765,7 @@ static int utf16be_len_first_char (const unsigned char* mstr, int len)
if (len < 2)
return 0;
w1 = MAKEWORD (mstr[1], mstr[0]);
w1 = MAKEWORD16 (mstr[1], mstr[0]);
if (w1 < 0xD800 || w1 > 0xDFFF)
return 2;
@@ -3773,7 +3773,7 @@ static int utf16be_len_first_char (const unsigned char* mstr, int len)
if (w1 >= 0xD800 && w1 <= 0xDBFF) {
if (len < 4)
return 0;
w2 = MAKEWORD (mstr[3], mstr[2]);
w2 = MAKEWORD16 (mstr[3], mstr[2]);
if (w2 < 0xDC00 || w2 > 0xDFFF)
return 0;
}
@@ -3787,12 +3787,12 @@ static Glyph32 utf16be_char_glyph_value (const unsigned char* pre_mchar,
UChar16 w1, w2;
UChar32 wc;
w1 = MAKEWORD (cur_mchar[1], cur_mchar[0]);
w1 = MAKEWORD16 (cur_mchar[1], cur_mchar[0]);
if (w1 < 0xD800 || w1 > 0xDFFF)
return w1;
w2 = MAKEWORD (cur_mchar[3], cur_mchar[2]);
w2 = MAKEWORD16 (cur_mchar[3], cur_mchar[2]);
wc = w1;
wc <<= 10;
+2 -2
View File
@@ -62,7 +62,7 @@ static void output_gbhz_py_tab (void)
int j;
GBHZ_PINYIN* p = gbhz_py_tab + i;
printf ("\t{0x%04X /* %c%c */, 0, {", p->encoding, HIBYTE (p->encoding), LOBYTE (p->encoding));
printf ("\t{0x%04X /* %c%c */, 0, {", p->encoding, HIBYTE_WORD16 (p->encoding), LOBYTE_WORD16 (p->encoding));
for (j = 0; j < MAX_NR_PINYIN; j++) {
int no_py, tone;
if (p->pinyin [j] == 0)
@@ -113,7 +113,7 @@ static int set_gbhz_pinyin (unsigned char ch1, unsigned char ch2, unsigned short
p = gbhz_py_tab + index;
p->encoding = MAKEWORD (ch2, ch1);
p->encoding = MAKEWORD16 (ch2, ch1);
for (i = 0; i < MAX_NR_PINYIN; i++) {
if (p->pinyin [i] == 0) {
p->pinyin [i] = no_py;
+10 -10
View File
@@ -406,7 +406,7 @@ static void handle_scancode_on_keydown (int scancode, key_info* kinfo)
if (key_map)
keysym = key_map [scancode];
kinfo->type =HIBYTE(keysym);
kinfo->type = HIBYTE (keysym);
/*Now, the kinfo->type maybe changed to KT_ARABIC_COMPOSE.
* So we have to deal with this situation */
if(kinfo->type >= 0xf0){
@@ -423,7 +423,7 @@ static void handle_scancode_on_keydown (int scancode, key_info* kinfo)
key_map = __mg_key_maps[shift_final ^(1<<KG_SHIFT)];
if (key_map)
keysym = key_map [scancode];
kinfo->type =HIBYTE(keysym);
kinfo->type = HIBYTE (keysym);
if(kinfo->type >= 0xf0){
kinfo->type -= 0xf0;
@@ -559,13 +559,13 @@ BOOL GUIAPI TranslateMessage (PMSG pMsg)
SendNotifyMessage (pMsg->hwnd, MSG_CHAR, __mg_kinfo.buff[0], pMsg->lParam);
}
else if (__mg_kinfo.pos == 2 && arabic_compose_flag) {
/*
#if 0
SendNotifyMessage (pMsg->hwnd, MSG_CHAR,
MAKEWORD (__mg_kinfo.buff[0], __mg_kinfo.buff[1]),
pMsg->lParam);
*/
MAKEWPARAM (__mg_kinfo.buff[0], __mg_kinfo.buff[1], 0, 0), pMsg->lParam);
#else
SendNotifyMessage (pMsg->hwnd, MSG_CHAR, __mg_kinfo.buff[0], pMsg->lParam);
SendNotifyMessage (pMsg->hwnd, MSG_CHAR, __mg_kinfo.buff[1], pMsg->lParam);
#endif
arabic_compose_flag =0;
}
else {
@@ -610,13 +610,13 @@ BOOL GUIAPI TranslateMessage (PMSG pMsg)
SendNotifyMessage (pMsg->hwnd, MSG_CHAR, kinfo.buff[0], pMsg->lParam);
}
else if (kinfo.pos == 2 && arabic_compose_flag) {
/*
#if 0
SendNotifyMessage (pMsg->hwnd, MSG_CHAR,
MAKEWORD (__mg_kinfo.buff[0], __mg_kinfo.buff[1]),
pMsg->lParam);
*/
MAKEWPARAM (__mg_kinfo.buff[0], __mg_kinfo.buff[1], 0, 0), pMsg->lParam);
#else
SendNotifyMessage (pMsg->hwnd, MSG_CHAR, kinfo.buff[0], pMsg->lParam);
SendNotifyMessage (pMsg->hwnd, MSG_CHAR, kinfo.buff[1], pMsg->lParam);
#endif
arabic_compose_flag =0;
}
else {
+7 -6
View File
@@ -138,7 +138,7 @@ void VFBSetCaption(const char* caption)
/*one XVFBCaptionEventData struct costs 8 bytes,
* change that '8' below if the struct is changed*/
if (mg_writesocket(__mg_pcxvfb_client_sockfd, ced, 8+len) < (8+len)) {
_MG_PRINTF ("IAL>PCXVFB: error occurred when calling VFBSetCaption.\n");
_ERR_PRINTF ("IAL>PCXVFB: error occurred when calling VFBSetCaption.\n");
}
}
@@ -153,7 +153,7 @@ void VFBOpenIME(int bOpen)
return;
if (mg_writesocket(__mg_pcxvfb_client_sockfd, &ime, sizeof(ime)) < sizeof(ime)) {
_MG_PRINTF ("IAL>PCXVFB: error occurred when calling VFBOpenIME.\n");
_ERR_PRINTF ("IAL>PCXVFB: error occurred when calling VFBOpenIME.\n");
}
}
@@ -167,7 +167,7 @@ void VFBShowWindow(int show)
return;
if (mg_writesocket(__mg_pcxvfb_client_sockfd, info, sizeof(info)) < sizeof(info)) {
_MG_PRINTF ("IAL>PCXVFB: error occurred when calling VFBShowWindow.\n");
_ERR_PRINTF ("IAL>PCXVFB: error occurred when calling VFBShowWindow.\n");
}
}
@@ -267,7 +267,7 @@ static void write_rec (const void* buf, size_t n)
/* TODO: */
#else
if (write(record_fd, buf, n) < n) {
_MG_PRINTF ("IAL>PCXVFB: error occurred when calling write_rec.\n");
_ERR_PRINTF ("IAL>PCXVFB: error occurred when calling write_rec.\n");
}
#endif
}
@@ -346,7 +346,7 @@ static void mouse_setxy (int x, int y)
return;
if (mg_writesocket (__mg_pcxvfb_client_sockfd, &mouse_event, sizeof(XVFBEVENT)) < sizeof(XVFBEVENT)) {
_MG_PRINTF ("IAL>PCXVFB: error occurred when setting mouse position.\n");
_ERR_PRINTF ("IAL>PCXVFB: error occurred when setting mouse position.\n");
}
}
@@ -423,7 +423,8 @@ static int keyboard_update (void)
}
else {
scancode = unicode;
//printf ("scancode = %d\n", scancode);
_DBG_PRINTF ("IAL>PCXVFB: get a key state change (%s): scancode = %d\n",
press?"pressed":"released", scancode);
kbd_state [scancode] = press;
if (press)
last = scancode;
+1 -1
View File
@@ -1348,7 +1348,7 @@ void __mg_ime_writemsg (BYTE *buffer, int len, LPARAM lParam, BOOL bDByte)
if (bDByte) {
for (i=0; i<len; i+=2) {
wDByte = MAKEWORD (buffer[i], buffer[i+1]);
wDByte = MAKEWORD16 (buffer[i], buffer[i+1]);
if (sg_hTargetWnd)
PostMessage (sg_hTargetWnd, MSG_CHAR, wDByte, 0);
#if defined(_LITE_VERSION) && !defined(_STAND_ALONE)
+1 -1
View File
@@ -38,7 +38,7 @@ const char *__mg_msgstr1 [] =
"MSG_KEYLONGPRESS ", // 0x0016
"MSG_KEYALWAYSPRESS ", // 0x0017
"MSG_KEYSYM ", // 0x0018
"", // 0x0019
"MSG_UTF8CHAR ", // 0x0019
"", // 0x001A
"", // 0x001B
"", // 0x001C
+2 -2
View File
@@ -70,14 +70,14 @@ void* win_PCXVFbInit (char* execl_file, char* etc_param, const char *skin)
char caption[64] = "wvfb";
char cmdline[512];
STARTUPINFO si;
WORD wVersionRequested;
WORD16 wVersionRequested;
WSADATA wsaData;
struct sockaddr_in ser_addr;
struct sockaddr_in c_addr;
int client_len;
// Initial for the socket ......
wVersionRequested = MAKEWORD(2, 2);
wVersionRequested = MAKEWORD16 (2, 2);
if (0 != WSAStartup(wVersionRequested, &wsaData))
{
return NULL;
+6 -6
View File
@@ -360,12 +360,12 @@ Uint32 GAL_MapRGB(GAL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b)
| (b >> format->Bloss) << format->Bshift
| format->Amask;
#ifdef _NEWGAL_SWAP16
pixv = (pixv & 0xFFFF0000) | ArchSwap16((unsigned short)pixv);
pixv = (pixv & 0xFFFF0000) | ArchSwap16((unsigned short)pixv);
#endif
#if defined(_EM86_IAL) || defined (_EM85_IAL)
if (pixv == 0) pixv ++;
if (pixv == 0) pixv ++;
#endif
return pixv;
return pixv;
} else {
if (format->DitheredPalette)
return GAL_FindDitheredColor (format->BitsPerPixel, r, g, b);
@@ -378,14 +378,14 @@ Uint32 GAL_MapRGB(GAL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b)
Uint32 GAL_MapRGBA(GAL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
if ( format->palette == NULL ) {
Uint32 pixv = (r >> format->Rloss) << format->Rshift
Uint32 pixv = (r >> format->Rloss) << format->Rshift
| (g >> format->Gloss) << format->Gshift
| (b >> format->Bloss) << format->Bshift
| ((a >> format->Aloss) << format->Ashift & format->Amask);
#ifdef _NEWGAL_SWAP16
pixv = (pixv & 0xFFFF0000) | ArchSwap16((unsigned short)pixv);
pixv = (pixv & 0xFFFF0000) | ArchSwap16((unsigned short)pixv);
#endif
return pixv;
return pixv;
} else {
if (format->DitheredPalette)
return GAL_FindDitheredColor (format->BitsPerPixel, r, g, b);
+6 -6
View File
@@ -677,8 +677,8 @@ static void _dc_draw_pixel_span_and_1 (COMP_CTXT* comp_ctxt, int w)
#ifdef ASM_memandset4
if (comp_ctxt->step == 1 && !((Uint32)row & 3)
&& !(w & 3) && (w > 3)) {
Uint16 _w = MAKEWORD (comp_ctxt->cur_pixel, comp_ctxt->cur_pixel);
Uint32 _u = MAKELONG (_w, _w);
Uint16 _w = MAKEWORD16 (comp_ctxt->cur_pixel, comp_ctxt->cur_pixel);
Uint32 _u = MAKELONG32 (_w, _w);
ASM_memandset4 (row, _u, w >> 2);
return;
}
@@ -751,8 +751,8 @@ static void _dc_draw_pixel_span_or_1 (COMP_CTXT* comp_ctxt, int w)
#ifdef ASM_memorset4
if (comp_ctxt->step == 1 && !((Uint32)row & 3)
&& !(w & 3) && (w > 3)) {
Uint16 _w = MAKEWORD (comp_ctxt->cur_pixel, comp_ctxt->cur_pixel);
Uint32 _u = MAKELONG (_w, _w);
Uint16 _w = MAKEWORD16 (comp_ctxt->cur_pixel, comp_ctxt->cur_pixel);
Uint32 _u = MAKELONG32 (_w, _w);
ASM_memorset4 (row, _u, w >> 2);
return;
}
@@ -826,8 +826,8 @@ static void _dc_draw_pixel_span_xor_1 (COMP_CTXT* comp_ctxt, int w)
#ifdef ASM_memxorset4
if (comp_ctxt->step == 1 && !((Uint32)comp_ctxt->cur_dst & 3)
&& !(w & 3) && (w > 3)) {
Uint16 _w = MAKEWORD (comp_ctxt->cur_pixel, comp_ctxt->cur_pixel);
Uint32 _u = MAKELONG (_w, _w);
Uint16 _w = MAKEWORD16 (comp_ctxt->cur_pixel, comp_ctxt->cur_pixel);
Uint32 _u = MAKELONG32 (_w, _w);
ASM_memxorset4 (comp_ctxt->cur_dst, _u, w >> 2);
return;
}
+1 -1
View File
@@ -830,7 +830,7 @@ RES_KEY Str2Key (const char* str)
l = (strlen(str)+1) / 2;
for (i=0; i<l; i++) {
unsigned short w = MAKEWORD(str[i<<1], str[(i<<1)+1]);
Uint16 w = MAKEWORD(str[i<<1], str[(i<<1)+1]);
ret ^= (w<<(i&0x0f));
}
-1
View File
@@ -1,4 +1,3 @@
/*
** $Id: resource.c 12916 2010-05-14 03:51:46Z wanzheng $
**
+18 -11
View File
@@ -4312,25 +4312,28 @@ static int texteditor_get_text_char_size(mTextEditor* self, int begin)
return char_size;
}
static int mTextEditor_onChar(mTextEditor *self, int asciiCode, DWORD keyFlags)
static int mTextEditor_onChar(mTextEditor *self, WPARAM eucCode, DWORD keyFlags)
{
int selBegin, selEnd, chlen;
unsigned char ch[3];
unsigned char ch[4];
int replace_char_size = 0;
if (!TE_VALID_OBJ(self) || _read_only(self) || (keyFlags & KS_CTRL))
return 0;
if(asciiCode == 127 || asciiCode == '\b')
{
if(eucCode == 127 || eucCode == '\b') {
_remove_chars(self, TRUE);
return 0;
}
ch [0] = LOBYTE (asciiCode);
ch [1] = HIBYTE (asciiCode);
ch [2] = (0x0ff0000 & asciiCode) >> 16;
if (ch[2]) {
ch [0] = FIRSTBYTE (eucCode);
ch [1] = SECONDBYTE (eucCode);
ch [2] = THIRDBYTE (eucCode);
ch [3] = FOURTHBYTE (eucCode);
if (ch[3]) {
chlen = 4;
}
else if (ch[2]) {
chlen = 3;
}
else if (ch[1]) {
@@ -4369,10 +4372,10 @@ static int mTextEditor_onChar(mTextEditor *self, int asciiCode, DWORD keyFlags)
if (chlen == 1) {
if (GetWindowStyle(self->hwnd) & NCSS_TE_UPPERCASE) {
asciiCode = toupper(asciiCode);
eucCode = toupper(eucCode);
}
else if (GetWindowStyle(self->hwnd) & NCSS_TE_LOWERCASE) {
asciiCode = tolower(asciiCode);
eucCode = tolower(eucCode);
}
}
@@ -4386,7 +4389,7 @@ static int mTextEditor_onChar(mTextEditor *self, int asciiCode, DWORD keyFlags)
_c(self->textBuffer)->replace(self->textBuffer,
selBegin, selEnd - selBegin, (char*)&asciiCode, -1);
selBegin, selEnd - selBegin, (char*)&eucCode, -1);
ncsNotifyParent (self, NCSN_TE_CHANGE);
_set_cont_changed(self, TRUE);
@@ -6380,6 +6383,10 @@ static int mTextEditor_wndProc(mTextEditor *self, int message, WPARAM wParam, LP
case MSG_CHAR:
return _c(self)->onChar(self, wParam, lParam);
case MSG_UTF8CHAR:
_ERR_PRINTF ("CONTROL>EDIT: MSG_UTF8CHAR is not implemented.\n");
break;
case MSG_FONTCHANGED:
_c(self)->onFontChanged(self);
return 0;