From 73ace78078eec898e0fbebcbe70c0fe3dd9d913b Mon Sep 17 00:00:00 2001 From: VincentWei Date: Tue, 16 Jan 2018 18:24:57 +0800 Subject: [PATCH 01/26] add devel-mode option --- configure.ac | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/configure.ac b/configure.ac index d8147bc9..b27f90bb 100644 --- a/configure.ac +++ b/configure.ac @@ -82,6 +82,7 @@ dnl ======================================================================== dnl User selectable options dnl System wide options +devel_mode="no" use_debug="no" trace_message="no" message_string="no" @@ -278,6 +279,10 @@ build_productid="no" build_splash="yes" build_screensaver="yes" +AC_ARG_ENABLE(develmode, +[ --enable-develmode developer mode ], +devel_mode=$enableval) + AC_ARG_ENABLE(debug, [ --enable-debug build with debugging messages ], use_debug=$enableval) @@ -1679,6 +1684,12 @@ if test "x$fixed_math" = "xyes"; then [Define if include fixed math routines]) fi +if test "x$devel_mode" = "xyes"; then + use_debug="yes" + trace_message="yes" + CFLAGS="$CFLAGS -Werror" +fi + if test "x$use_debug" = "xyes"; then AC_DEFINE(_DEBUG, 1, [Define if build with debugging messages]) From 2fbff87cb466eba826f59f2017bf241952d309da Mon Sep 17 00:00:00 2001 From: VincentWei Date: Tue, 16 Jan 2018 19:07:41 +0800 Subject: [PATCH 02/26] tune for 64 bits --- include/common.h | 204 ++++++++++++++++++++++++++++++---------- include/gdi.h | 6 +- include/win32_pthread.h | 4 +- include/window.h | 12 +-- src/font/devfont.c | 2 +- src/font/logfont.c | 4 +- src/include/ctrlclass.h | 2 +- src/misc/endianrw.c | 22 +++-- src/misc/misc.c | 119 +++++++++++------------ src/misc/rwops.c | 8 +- 10 files changed, 247 insertions(+), 136 deletions(-) diff --git a/include/common.h b/include/common.h index 4c0ec176..6e24d9bd 100644 --- a/include/common.h +++ b/include/common.h @@ -256,6 +256,20 @@ MGUI_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); * @{ */ + +#if defined(_WIN64) +# define SIZEOF_PTR 8 +#elif defined(__LP64__) +# define SIZEOF_PTR 8 +#else +# define SIZEOF_PTR 4 +#endif +/** + * \var PVOID + * \brief A type definition for a pointer to any type. + */ +typedef void *PVOID; + /** * \var typedef int BOOL * \brief A type definition for boolean value. @@ -265,6 +279,7 @@ MGUI_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); typedef int BOOL; #endif #endif + /** * \def FALSE * \brief FALSE value, defined as 0 by MiniGUI. @@ -318,55 +333,55 @@ typedef int BOOL; */ /** - * \var typedef unsigned int GHANDLE + * \var GHANDLE * \brief General handle. */ -typedef unsigned int GHANDLE; +typedef PVOID GHANDLE; /** - * \var typedef unsigned int HWND + * \var HWND * \brief Handle to main window or control. */ -typedef unsigned int HWND; +typedef GHANDLE HWND; /** - * \var typedef unsigned int HDC + * \var HDC * \brief Handle to device context. */ -typedef unsigned int HDC; +typedef GHANDLE HDC; /** - * \var typedef unsigned int HPALETTE + * \var HPALETTE * \brief Handle to a logical palette. */ -typedef unsigned int HPALETTE; +typedef GHANDLE HPALETTE; /** - * \var typedef unsigned int HCURSOR + * \var HCURSOR * \brief Handle to cursor. */ -typedef unsigned int HCURSOR; +typedef GHANDLE HCURSOR; /** - * \var typedef unsigned int HICON + * \var HICON * \brief Handle to icon. */ -typedef unsigned int HICON; +typedef GHANDLE HICON; /** - * \var typedef unsigned int HMENU + * \var HMENU * \brief Handle to menu. */ -typedef unsigned int HMENU; +typedef GHANDLE HMENU; /** - * \var typedef unsigned int HACCEL + * \var HACCEL * \brief Handle to accelarator. */ -typedef unsigned int HACCEL; +typedef GHANDLE HACCEL; /** - * \var typedef unsigned int HDLG + * \var HDLG * \brief Handle to dialog box, same as HWND. */ -typedef unsigned int HDLG; +typedef GHANDLE HDLG; /** - * \var typedef unsigned int HHOOK + * \var HHOOK * \brief Handle to keyboard or mouse event hook. */ -typedef unsigned int HHOOK; +typedef GHANDLE HHOOK; /** @} end of handles */ @@ -376,73 +391,158 @@ typedef unsigned int HHOOK; */ /** - * \var typedef unsigned char BYTE - * \brief A type definition for unsigned character (byte). + * \var BYTE + * \brief A type definition for an 8-bit unsigned character (byte). */ -#ifndef _HAVE_TYPE_BYTE typedef unsigned char BYTE; -#endif + /** - * \var typedef signed char SBYTE - * \brief A type definition for signed character. + * \var SBYTE + * \brief A type definition for an 8-bit signed character. */ typedef signed char SBYTE; /** - * \var typedef unsigned short WORD - * \brief A type definition for unsigned short integer (word). + * \var WORD_HPTR + * \brief An unsigned int (word) type in half pointer precision. */ -#ifndef _HAVE_TYPE_WORD -typedef unsigned short WORD; +#if defined(_WIN64) +typedef unsigned int WORD_HPTR; +#elif defined(__LP64__) +typedef unsigned int WORD_HPTR; +#else +typedef unsigned short WORD_HPTR; #endif /** - * \var typedef signed short SWORD - * \brief A type definition for signed short integer. + * \var SWORD_HPTR + * \brief An signed int type in half pointer precision. */ -typedef signed short SWORD; - -/** - * \var typedef unsigned long DWORD - * \brief A type definition for unsigned long integer (double word). - */ -#ifndef _HAVE_TYPE_DWORD -typedef unsigned long DWORD; +#if defined(_WIN64) +typedef signed int SWORD_HPTR; +#elif defined(__LP64__) +typedef signed int SWORD_HPTR; +#else +typedef signed short SWORD_HPTR; #endif /** - * \var typedef signed long SDWORD - * \brief A type definition for signed long integer. + * \var WORD + * \brief A type definition for an unsigned integer (word). */ -typedef signed long SDWORD; +typedef WORD_HPTR WORD; /** - * \var typedef unsigned int UINT + * \var SWORD + * \brief A type definition for a signed integer. + */ +typedef SWORD_HPTR SWORD; + +/** + * \var WORD16 + * \brief A type definition for a 16-bit unsigned integer (word). + */ +typedef unsigned short WORD16; + +/** + * \var SWORD16 + * \brief A type definition for a 16-bit signed integer. + */ +typedef signed short SWORD16; + +/** + * \var DWORD_PTR + * \brief An unsigned long type for pointer precision. + * + * Commonly used for general 32-bit parameters that have been extended + * to 64 bits in 64-bit platform. + */ +#if defined(_WIN64) +typedef unsigned __int64 DWORD_PTR; +#elif defined(__LP64__) +typedef unsigned long DWORD_PTR; +#else +typedef unsigned int DWORD_PTR; +#endif + +/** + * \var DWORD + * \brief A unsigned long type definition for pointer precision. + */ +typedef DWORD_PTR DWORD; + +/** + * \var DWORD32 + * \brief A type definition for a 32-bit unsigned integer. + */ +typedef unsigned short DWORD32; + +/** + * \var SDWORD32 + * \brief A type definition for a 32-bit signed integer. + */ +typedef signed short SDWORD32; + +/** + * \var UINT * \brief A type definition for unsigned integer. */ -#ifndef _HAVE_TYPE_UINT -typedef unsigned int UINT; +typedef unsigned int UINT; + +/** + * \var INT_PTR + * \brief A signed integer type for pointer precision. + */ +#if defined(_WIN64) +typedef __int64 INT_PTR; +#elif defined(__LP64__) +typedef long INT_PTR; +#else +typedef int INT_PTR; #endif /** - * \var typedef long LONG + * \var UINT_PTR + * \brief A unsigned integer type for pointer precision. + */ +#if defined(_WIN64) +typedef unsigned __int64 UINT_PTR; +#elif defined(__LP64__) +typedef unsigned long UINT_PTR; +#else +typedef unsigned int UINT_PTR; +#endif + +#if SIZEOF_PTR == 8 +# define INT_PTR_MIN (-9223372036854775807L-1) +# define INT_PTR_MAX (9223372036854775807L) +# define UINT_PTR_MAX (18446744073709551615UL) +#else +# error 64bit arrives 32bit. +# define INT_PTR_MIN (-2147483647-1) +# define INT_PTR_MAX (2147483647) +# define UINT_PTR_MAX (4294967295U) +#endif + +/** + * \var typedef LONG * \brief A type definition for long integer. */ #ifndef _HAVE_TYPE_LONG -typedef long LONG; +typedef long LONG; #endif /** - * \var typedef unsigned int WPARAM + * \var WPARAM * \brief A type definition for the first message paramter. */ -typedef unsigned int WPARAM; +typedef UINT_PTR WPARAM; /** - * \var typedef unsigned long LPARAM + * \var LPARAM * \brief A type definition for the second message paramter. */ -typedef unsigned long LPARAM; +typedef UINT_PTR LPARAM; /** * \def LOBYTE(w) diff --git a/include/gdi.h b/include/gdi.h index d640fe23..a6a4cbf5 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -1090,19 +1090,19 @@ MG_EXPORT BOOL GUIAPI InitPolygonRegion (PCLIPRGN dst, * \note MiniGUI does not do any clipping operation for this DC, * so use this DC may make a mess of other windows. */ -#define HDC_SCREEN 0 +#define HDC_SCREEN (HDC)0 /* * This is a system screen DC create for MiniGUI internal usage, for example, * menu and z-order operations */ -#define HDC_SCREEN_SYS 1 +#define HDC_SCREEN_SYS (HDC)1 /** * \def HDC_INVALID * \brief Indicates an invalid handle to device context. */ -#define HDC_INVALID 0xFFFFFFFF +#define HDC_INVALID (HDC)UINT_PTR_MAX #define GDCAP_COLORNUM 0 #define GDCAP_HPIXEL 1 diff --git a/include/win32_pthread.h b/include/win32_pthread.h index 663ebc6f..c3de978c 100644 --- a/include/win32_pthread.h +++ b/include/win32_pthread.h @@ -209,9 +209,9 @@ #if defined(_MSC_VER) && _MSC_VER < 1300 || defined(__DMC__) /* - * VC++6.0 or early compiler's header has no DWORD_PTR type. + * VC++6.0 or early compiler's header has no DWORD type. */ -typedef unsigned long DWORD_PTR; +typedef unsigned long DWORD; #endif /* * ----------------- diff --git a/include/window.h b/include/window.h index bc831a5c..98a8b4aa 100644 --- a/include/window.h +++ b/include/window.h @@ -4893,15 +4893,15 @@ extern MG_EXPORT HWND __mg_hwnd_desktop; * \def HWND_NULL * \brief Null window handle. */ -#define HWND_NULL 0 +#define HWND_NULL (HWND)0 /** * \def HWND_INVALID * \brief Invalid window handle. */ -#define HWND_INVALID 0xFFFFFFFF +#define HWND_INVALID (HWND)UINT_PTR_MAX -#define HWND_OTHERPROC 0xFFFFFFFE +#define HWND_OTHERPROC (HWND)UINT_PTR_MAX /** * Structure defines a main window. @@ -8426,10 +8426,10 @@ typedef struct _MENUITEMINFO { PBITMAP checkedbmp; /** The private data attached to the menu item */ - DWORD itemdata; + DWORD itemdata; /** The data of this menu item, used to pass the string or the pointer to the BITMAP object of the menu item */ - DWORD typedata; + DWORD typedata; /** * Used by \a GetMenuItemInfo function to indicate the maximal length @@ -9056,7 +9056,7 @@ typedef struct _CTRLDATA /** Control caption */ const char* caption; /** Additional data */ - DWORD dwAddData; + DWORD dwAddData; /** Control extended style */ DWORD dwExStyle; diff --git a/src/font/devfont.c b/src/font/devfont.c index 8d570919..150c31a0 100644 --- a/src/font/devfont.c +++ b/src/font/devfont.c @@ -271,7 +271,7 @@ unsigned short font_GetBestScaleFactor (int height, int expect) { \ devfont = head; \ while (devfont) { \ - fprintf (stderr, " %d: %s, charsetname: %s, style: %#lx\n", \ + fprintf (stderr, " %d: %s, charsetname: %s, style: %#x\n", \ count, \ devfont->name, devfont->charset_ops->name, devfont->style); \ devfont = devfont->next; \ diff --git a/src/font/logfont.c b/src/font/logfont.c index 60364bb7..e9f0a27a 100644 --- a/src/font/logfont.c +++ b/src/font/logfont.c @@ -102,7 +102,7 @@ static PLOGFONT gdiCreateLogFont (const char* type, const char* family, log_font->sbc_scale = 1; log_font->mbc_scale = 1; - _MG_PRINTF ("FONT>LogFont: requested info: type: %s, family: %s, style: %lx, charset: %s, size: %d.\n", + _MG_PRINTF ("FONT>LogFont: requested info: type: %s, family: %s, style: %x, charset: %s, size: %d.\n", log_font->type, log_font->family, log_font->style, log_font->charset, log_font->size); @@ -223,7 +223,7 @@ static PLOGFONT gdiCreateLogFont (const char* type, const char* family, log_font->style &= ~FS_FLIP_HORZVERT; } - _MG_PRINTF ("FONT>LogFont: created info: type: %s, family: %s, style: %lx, charset: %s, size: %d.\n", + _MG_PRINTF ("FONT>LogFont: created info: type: %s, family: %s, style: %x, charset: %s, size: %d.\n", log_font->type, log_font->family, log_font->style, log_font->charset, log_font->size); diff --git a/src/include/ctrlclass.h b/src/include/ctrlclass.h index a343ec49..d666a1a1 100644 --- a/src/include/ctrlclass.h +++ b/src/include/ctrlclass.h @@ -29,7 +29,7 @@ typedef struct _CTRLCLASSINFO int (*ControlProc)(HWND, int, WPARAM, LPARAM); // control procedure. - DWORD dwAddData; // the additional data. + DWORD dwAddData; // the additional data. int nUseCount; // use count. struct _CTRLCLASSINFO* next; diff --git a/src/misc/endianrw.c b/src/misc/endianrw.c index e72e4694..54092028 100644 --- a/src/misc/endianrw.c +++ b/src/misc/endianrw.c @@ -102,34 +102,42 @@ int MGUI_WriteLE64 (MG_RWops *dst, Uint64 value) int MGUI_WriteBE64 (MG_RWops *dst, Uint64 value) { value = ArchSwapBE64(value); - return(MGUI_RWwrite(dst, &value, (sizeof value), 1)); + return (MGUI_RWwrite(dst, &value, (sizeof value), 1)); } Uint16 MGUI_ReadLE16FP (FILE *src) { Uint16 value; + size_t size; - fread (&value, (sizeof value), 1, src); - return(ArchSwapLE16(value)); + size = fread (&value, (sizeof value), 1, src); + if (size < sizeof (value)) + return -1; + + return (ArchSwapLE16(value)); } Uint32 MGUI_ReadLE32FP (FILE *src) { Uint32 value; + size_t size; - fread(&value, (sizeof value), 1, src); - return(ArchSwapLE32(value)); + size = fread(&value, (sizeof value), 1, src); + if (size < sizeof (value)) + return -1; + + return (ArchSwapLE32(value)); } int MGUI_WriteLE16FP (FILE *dst, Uint16 value) { value = ArchSwapLE16(value); - return(fwrite (&value, (sizeof value), 1, dst)); + return (fwrite (&value, (sizeof value), 1, dst)); } int MGUI_WriteLE32FP (FILE *dst, Uint32 value) { value = ArchSwapLE32(value); - return(fwrite (&value, (sizeof value), 1, dst)); + return (fwrite (&value, (sizeof value), 1, dst)); } diff --git a/src/misc/misc.c b/src/misc/misc.c index 82f3a02f..a619a23b 100644 --- a/src/misc/misc.c +++ b/src/misc/misc.c @@ -54,46 +54,46 @@ void __mg_rewind (FILE *fp); int my_fputs (const char *s, FILE *stream) { - int len = strlen (s); - int ret = 0; - - ret = fwrite (s, 1, len, stream); - if (ret != len) - return EOF; - else - return ret; + int len = strlen (s); + int ret = 0; + + ret = fwrite (s, 1, len, stream); + if (ret != len) + return EOF; + else + return ret; } char * my_fgets (char *s, int size, FILE *stream) { - int c; - int count = 0; + int c; + int count = 0; - while (!feof (stream)) { - if (fread (&c, 1, 1, stream) != 1) { - if (count == 0) - return NULL; - else { - s[count] = '\0'; - return s; - } - } - - if (c == EOF || (char)c == '\r' ||(char)c == '\n') { - s [count++] = (char)c; - s [count++] = '\0'; - return s; - } - else - s[count++] = (char)c; - } - if (!count) - return NULL; - else - { - s[count] = '\0'; - return s; - } + while (!feof (stream)) { + if (fread (&c, 1, 1, stream) != 1) { + if (count == 0) + return NULL; + else { + s[count] = '\0'; + return s; + } + } + + if (c == EOF || (char)c == '\r' ||(char)c == '\n') { + s [count++] = (char)c; + s [count++] = '\0'; + return s; + } + else + s[count++] = (char)c; + } + if (!count) + return NULL; + else + { + s[count] = '\0'; + return s; + } } #endif /////////////////////////////// @@ -127,7 +127,10 @@ static BOOL LookForEtcFile (void) } - getcwd (etcfile, MAX_PATH); + if (getcwd (etcfile, MAX_PATH) == NULL) { + return FALSE; + } + strcat (etcfile, "/"); strcat (etcfile, ETCFILENAME); if (GetValueFromEtcFile (etcfile, "system", "gal_engine", buff, 8) @@ -151,41 +154,41 @@ static BOOL LookForEtcFile (void) } } - strcpy (etcfile, "/usr/local/etc/" ETCFILENAME); - if (GetValueFromEtcFile (etcfile, "system", "gal_engine", buff, 8) - == ETC_OK) { - strcpy (ETCFILEPATH, etcfile); - return TRUE; - } + strcpy (etcfile, "/usr/local/etc/" ETCFILENAME); + if (GetValueFromEtcFile (etcfile, "system", "gal_engine", buff, 8) + == ETC_OK) { + strcpy (ETCFILEPATH, etcfile); + return TRUE; + } - strcpy (etcfile, "/etc/" ETCFILENAME); - if (GetValueFromEtcFile (etcfile, "system", "gal_engine", buff, 8) - == ETC_OK) { - strcpy (ETCFILEPATH, etcfile); - return TRUE; - } + strcpy (etcfile, "/etc/" ETCFILENAME); + if (GetValueFromEtcFile (etcfile, "system", "gal_engine", buff, 8) + == ETC_OK) { + strcpy (ETCFILEPATH, etcfile); + return TRUE; + } - return FALSE; + return FALSE; #elif defined(WIN32) - sprintf(etcfile, "c:\\windows\\%s", ETCFILENAME); + sprintf(etcfile, "c:\\windows\\%s", ETCFILENAME); if (GetValueFromEtcFile (etcfile, "system", "gal_engine", buff, 8) == ETC_OK) { strcpy (ETCFILEPATH, etcfile); return TRUE; } - sprintf(etcfile, "c:\\%s", ETCFILENAME); + sprintf(etcfile, "c:\\%s", ETCFILENAME); if (GetValueFromEtcFile (etcfile, "system", "gal_engine", buff, 8) == ETC_OK) { strcpy (ETCFILEPATH, etcfile); return TRUE; } - return FALSE; + return FALSE; #elif defined(__THREADX__) - char etcpath[MAX_PATH]= "/flash/fhas2-cfg/"; - strcpy (etcfile, etcpath); - strcat (etcfile, ETCFILENAME); + char etcpath[MAX_PATH]= "/flash/fhas2-cfg/"; + strcpy (etcfile, etcpath); + strcat (etcfile, ETCFILENAME); #endif if (GetValueFromEtcFile (etcfile, "system", "gal_engine", buff, 8) @@ -207,7 +210,7 @@ BOOL mg_InitMgEtc (void) return FALSE; } - if (hMgEtc) + if (hMgEtc) return TRUE; if ( !(hMgEtc = LoadEtcFile (ETCFILEPATH)) ) @@ -1070,7 +1073,7 @@ GHANDLE GUIAPI FindSectionInEtc (GHANDLE hEtc, /* not found */ if (bCreateNew) { if (petc->sect_nr_alloc <= 0) - return ETC_READONLYOBJ; + return (GHANDLE) ETC_READONLYOBJ; if (empty_section >= 0) { psect = petc->sections + empty_section; @@ -1314,7 +1317,7 @@ void mswin_ping(void); void GUIAPI Ping(void) { #ifdef WIN32 - mswin_ping(); + mswin_ping(); #else putchar ('\a'); fflush (stdout); diff --git a/src/misc/rwops.c b/src/misc/rwops.c index ef19c3c2..e0976fda 100644 --- a/src/misc/rwops.c +++ b/src/misc/rwops.c @@ -277,8 +277,8 @@ MG_RWops *MGUI_RWFromMem(void *mem, int size) rwops->eof = mem_eof; rwops->hidden.mem.base = (Uint8 *)mem; rwops->hidden.mem.here = rwops->hidden.mem.base; - if ((0xFFFFFFFF - (Uint32)mem) < size) - rwops->hidden.mem.stop = (void*)0xFFFFFFFF; + if ((UINT_PTR_MAX - (UINT_PTR)mem) < size) + rwops->hidden.mem.stop = (void*)UINT_PTR_MAX; else rwops->hidden.mem.stop = rwops->hidden.mem.base+size; @@ -299,8 +299,8 @@ void MGUI_InitMemRW (MG_RWops* area, void *mem, int size) area->eof = mem_eof; area->hidden.mem.base = (Uint8 *)mem; area->hidden.mem.here = area->hidden.mem.base; - if ((0xFFFFFFFF - (Uint32)mem) < size) - area->hidden.mem.stop = (void*)0xFFFFFFFF; + if ((UINT_PTR_MAX - (UINT_PTR)mem) < size) + area->hidden.mem.stop = (void*)UINT_PTR_MAX; else area->hidden.mem.stop = area->hidden.mem.base+size; From b59f0b6a933d5709880e171af34b8cab178b7a65 Mon Sep 17 00:00:00 2001 From: VincentWei Date: Wed, 17 Jan 2018 18:51:41 +0800 Subject: [PATCH 03/26] tune code for 64-bit --- include/common.h | 328 ++++++++++++++++++++++-------------- include/gdi.h | 6 +- include/window.h | 156 ++++++++--------- src/control/bidiedit.c | 6 +- src/control/button.c | 4 +- src/control/combobox.c | 6 +- src/control/ctrlmisc.c | 4 +- src/control/edit.c | 6 +- src/control/listbox.c | 4 +- src/control/menubutton.c | 4 +- src/control/newtoolbar.c | 24 +-- src/control/progressbar.c | 4 +- src/control/propsheet.c | 24 ++- src/control/scrollbar.c | 2 +- src/control/scrollview.c | 2 +- src/control/scrollwnd.c | 2 +- src/control/static.c | 4 +- src/control/text.h | 4 +- src/control/textedit.c | 2 +- src/control/trackbar.c | 2 +- src/ex_ctrl/animation.c | 12 +- src/ex_ctrl/coolbar.c | 4 +- src/ex_ctrl/gridview.c | 2 +- src/ex_ctrl/iconview.c | 3 +- src/ex_ctrl/listview.c | 2 +- src/ex_ctrl/monthcalendar.c | 4 +- src/ex_ctrl/spinbox.c | 4 +- src/ex_ctrl/treeview.c | 4 +- src/ex_ctrl/treeview_rdr.c | 4 +- src/font/devfont.c | 2 +- src/font/logfont.c | 4 +- src/gui/ctrlclass.c | 2 +- src/gui/dialog.c | 16 +- src/gui/lf_classic.c | 32 ++-- src/gui/lf_fashion.c | 244 +++++++++++++-------------- src/gui/lf_flat.c | 22 +-- src/gui/lf_manager.c | 10 +- src/gui/lf_skin.c | 16 +- src/gui/lf_tiny.c | 30 ++-- src/gui/menu.c | 26 +-- src/gui/window.c | 36 ++-- src/ial/native/kbd_event.c | 4 + src/ial/native/mou_imps2.c | 4 +- src/ial/native/mou_ps2.c | 4 +- src/ial/pcxvfbial.c | 31 +++- src/include/ctrlclass.h | 6 +- src/include/element.h | 4 +- src/include/internals.h | 12 +- src/kernel/cursor-procs.c | 32 ++-- src/kernel/cursor-sa.c | 32 ++-- src/kernel/cursor.c | 58 +++++-- src/kernel/desktop-comm.c | 50 +++--- src/kernel/desktop-ths.c | 2 +- src/kernel/desktop.c | 17 +- src/kernel/message.c | 64 +++---- src/kernel/zorder.c | 2 +- src/misc/about.c | 2 +- src/mybmp/mybmp.c | 2 +- src/mybmp/winbmp.c | 106 ++++++------ src/sysres/resmgr.c | 109 ++++++++---- src/sysres/resource.c | 4 +- 61 files changed, 897 insertions(+), 721 deletions(-) diff --git a/include/common.h b/include/common.h index 6e24d9bd..ac1ccbc8 100644 --- a/include/common.h +++ b/include/common.h @@ -36,42 +36,43 @@ */ #ifndef _MGUI_COMMON_H + #define _MGUI_COMMON_H #ifndef MINIGUI_MAJOR_VERSION -# ifdef __MINIGUI_LIB__ -# ifdef _FOR_DATANG -# ifdef WIN32 -# include -# elif defined (__THREADX__) -# include "config-threadx/mgconfig.h" -# elif defined (__NUCLEUS__) -# include "config-nucleus/mgconfig.h" -# endif -# else -# if defined(__CMAKE_PROJECT__) || defined(WIN32) -# include "mgconfig.h" -# else -# include "../mgconfig.h" -# endif -# endif -# else -# undef PACKAGE -# undef VERSION -# undef PACKAGE_BUGREPORT -# undef PACKAGE_NAME -# undef PACKAGE_STRING -# undef PACKAGE_TARNAME -# undef PACKAGE_VERSION -# include "mgconfig.h" -# undef PACKAGE -# undef VERSION -# undef PACKAGE_BUGREPORT -# undef PACKAGE_NAME -# undef PACKAGE_STRING -# undef PACKAGE_TARNAME -# undef PACKAGE_VERSION -# endif +# ifdef __MINIGUI_LIB__ +# ifdef _FOR_DATANG +# ifdef WIN32 +# include +# elif defined (__THREADX__) +# include "config-threadx/mgconfig.h" +# elif defined (__NUCLEUS__) +# include "config-nucleus/mgconfig.h" +# endif +# else +# if defined(__CMAKE_PROJECT__) || defined(WIN32) +# include "mgconfig.h" +# else +# include "../mgconfig.h" +# endif +# endif +# else +# undef PACKAGE +# undef VERSION +# undef PACKAGE_BUGREPORT +# undef PACKAGE_NAME +# undef PACKAGE_STRING +# undef PACKAGE_TARNAME +# undef PACKAGE_VERSION +# include "mgconfig.h" +# undef PACKAGE +# undef VERSION +# undef PACKAGE_BUGREPORT +# undef PACKAGE_NAME +# undef PACKAGE_STRING +# undef PACKAGE_TARNAME +# undef PACKAGE_VERSION +# endif #endif /** @@ -145,15 +146,15 @@ typedef signed int Sint32; /* Figure out how to support 64-bit datatypes */ #if !defined(__STRICT_ANSI__) -#if defined(__GNUC__) -#define MGUI_HAS_64BIT_TYPE long long -#endif -#if defined(__CC_ARM) -#define MGUI_HAS_64BIT_TYPE long long -#endif -#if defined(_MSC_VER) -#define MGUI_HAS_64BIT_TYPE __int64 -#endif +# if defined(__GNUC__) +# define MGUI_HAS_64BIT_TYPE long long +# endif +# if defined(__CC_ARM) +# define MGUI_HAS_64BIT_TYPE long long +# endif +# if defined(_MSC_VER) +# define MGUI_HAS_64BIT_TYPE __int64 +# endif #endif /* !__STRICT_ANSI__ */ /* The 64-bit datatype isn't supported on all platforms */ @@ -237,16 +238,16 @@ MGUI_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); * * to write endianness independent code. */ -#if defined(__i386__) || defined(__ia64__) || \ - (defined(__alpha__) || defined(__alpha)) || \ - defined(__arm__) || \ - (defined(__CC_ARM) && !defined(__BIG_ENDIAN)) || \ - (defined(__mips__) && defined(__MIPSEL__)) || \ - defined(__LITTLE_ENDIAN__) || \ - defined(WIN32) -#define MGUI_BYTEORDER MGUI_LIL_ENDIAN +#if defined(__i386__) || defined(__ia64__) || defined(__x86_64__) || defined(__amd64) || \ + (defined(__alpha__) || defined(__alpha)) || \ + defined(__arm__) || \ + (defined(__CC_ARM) && !defined(__BIG_ENDIAN)) || \ + (defined(__mips__) && defined(__MIPSEL__)) || \ + defined(__LITTLE_ENDIAN__) || \ + defined(WIN32) +# define MGUI_BYTEORDER MGUI_LIL_ENDIAN #else -#define MGUI_BYTEORDER MGUI_BIG_ENDIAN +# define MGUI_BYTEORDER MGUI_BIG_ENDIAN #endif /** @} end of endian_info */ @@ -257,13 +258,6 @@ MGUI_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); */ -#if defined(_WIN64) -# define SIZEOF_PTR 8 -#elif defined(__LP64__) -# define SIZEOF_PTR 8 -#else -# define SIZEOF_PTR 4 -#endif /** * \var PVOID * \brief A type definition for a pointer to any type. @@ -274,11 +268,9 @@ typedef void *PVOID; * \var typedef int BOOL * \brief A type definition for boolean value. */ -#ifndef _HAVE_TYPE_BOOL #ifndef BOOL typedef int BOOL; #endif -#endif /** * \def FALSE @@ -402,6 +394,51 @@ typedef unsigned char BYTE; */ typedef signed char SBYTE; +/** + * \var SIZEOF_PTR + * \brief The size of a pointer. 4 for 32-bit and 8 for 64-bit. + */ +/** + * \var SIZEOF_HPTR + * \brief The size of a half or pointer. 2 for 32-bit and 4 for 64-bit. + */ +#if defined(_WIN64) +# define SIZEOF_PTR 8 +# define SIZEOF_HPTR 4 +#elif defined(__LP64__) +# define SIZEOF_PTR 8 +# define SIZEOF_HPTR 4 +#else +# define SIZEOF_PTR 4 +# define SIZEOF_HPTR 2 +#endif + +#if SIZEOF_PTR == 8 +# define NR_BITS_BYTE (16) +# define NR_BITS_WORD (32) +# define NR_BITS_DWORD (64) + +# define BITMASK_BYTE (0xFFFF) +# define BITMASK_WORD (0xFFFFFFFF) +# define BITMASK_DWORD (0xFFFFFFFFFFFFFFFF) + +# define INT_PTR_MIN (-9223372036854775807L-1) +# define INT_PTR_MAX (9223372036854775807L) +# define UINT_PTR_MAX (18446744073709551615UL) +#else +# define NR_BITS_BYTE (8) +# define NR_BITS_WORD (16) +# define NR_BITS_DWORD (32) + +# define BITMASK_BYTE (0xFF) +# define BITMASK_WORD (0xFFFF) +# define BITMASK_DWORD (0xFFFFFFFF) + +# define INT_PTR_MIN (-2147483647-1) +# define INT_PTR_MAX (2147483647) +# define UINT_PTR_MAX (4294967295U) +#endif + /** * \var WORD_HPTR * \brief An unsigned int (word) type in half pointer precision. @@ -450,6 +487,24 @@ typedef unsigned short WORD16; */ typedef signed short SWORD16; +/** + * \var LONG_PTR + * \brief A signed long type for pointer precision. + */ +#if defined(_WIN64) +typedef __int64 LONG_PTR; +#elif defined(__LP64__) +typedef long LONG_PTR; +#else +typedef int LONG_PTR; +#endif + +/** + * \var LRESULT + * \brief Signed result of message processing. + */ +typedef LONG_PTR LRESULT; + /** * \var DWORD_PTR * \brief An unsigned long type for pointer precision. @@ -475,13 +530,13 @@ typedef DWORD_PTR DWORD; * \var DWORD32 * \brief A type definition for a 32-bit unsigned integer. */ -typedef unsigned short DWORD32; +typedef unsigned int DWORD32; /** * \var SDWORD32 * \brief A type definition for a 32-bit signed integer. */ -typedef signed short SDWORD32; +typedef signed int SDWORD32; /** * \var UINT @@ -513,24 +568,17 @@ typedef unsigned long UINT_PTR; typedef unsigned int UINT_PTR; #endif -#if SIZEOF_PTR == 8 -# define INT_PTR_MIN (-9223372036854775807L-1) -# define INT_PTR_MAX (9223372036854775807L) -# define UINT_PTR_MAX (18446744073709551615UL) -#else -# error 64bit arrives 32bit. -# define INT_PTR_MIN (-2147483647-1) -# define INT_PTR_MAX (2147483647) -# define UINT_PTR_MAX (4294967295U) -#endif - /** * \var typedef LONG * \brief A type definition for long integer. */ -#ifndef _HAVE_TYPE_LONG typedef long LONG; -#endif + +/** + * \var ULONG + * \brief A type definition for unsigned long integer. + */ +typedef unsigned long ULONG; /** * \var WPARAM @@ -551,19 +599,46 @@ typedef UINT_PTR LPARAM; * \sa MAKEWORD */ #define LOBYTE(w) ((BYTE)(w)) + /** * \def HIBYTE(w) * \brief Returns the high byte of the word \a w. * * \sa MAKEWORD */ -#define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF)) +#define HIBYTE(w) ((BYTE)(((WORD)(w) >> NR_BITS_BYTE) & BITMASK_BYTE)) /** * \def MAKEWORD(low, high) * \brief Makes a word from \a low byte and \a high byte. + * + * \sa MAKEWORD16 */ -#define MAKEWORD(low, high) ((WORD)(((BYTE)(low)) | (((WORD)((BYTE)(high))) << 8))) +#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 + */ +#define MAKEWORD16(low, high) ((WORD16)(((BYTE)(low)) | (((WORD16)((BYTE)(high))) << 8))) /** * \def LOWORD(l) @@ -578,7 +653,7 @@ typedef UINT_PTR LPARAM; * * \sa MAKELONG */ -#define HIWORD(l) ((WORD)((((DWORD)(l)) >> 16) & 0xFFFF)) +#define HIWORD(l) ((WORD)((((DWORD)(l)) >> NR_BITS_WORD) & BITMASK_WORD)) /** * \def LOSWORD(l) @@ -593,13 +668,19 @@ typedef UINT_PTR LPARAM; * * \sa MAKELONG */ -#define HISWORD(l) ((SWORD)((((DWORD)(l)) >> 16) & 0xFFFF)) +#define HISWORD(l) ((SWORD)((((DWORD)(l)) >> NR_BITS_WORD) & BITMASK_WORD)) /** * \def MAKELONG(low, high) * \brief Makes a double word from \a low word and \a high word. */ -#define MAKELONG(low, high) ((DWORD)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16))) +#define MAKELONG(low, high) ((DWORD)(((WORD)(low)) | (((DWORD)((WORD)(high))) << NR_BITS_WORD))) + +/** + * \var typedef DWORD RGBCOLOR + * \brief A type definition for a RGB color. + */ +typedef DWORD32 RGBCOLOR; /** * \def GetRValue(rgba) @@ -618,7 +699,7 @@ typedef UINT_PTR LPARAM; * * \sa MakeRGBA, MakeRGB */ -#define GetGValue(rgba) ((BYTE)(((DWORD)(rgba)) >> 8)) +#define GetGValue(rgba) ((BYTE)(((DWORD32)(rgba)) >> 8)) /** * \def GetBValue(rgba) * \brief Gets the blue component from a RGBA triple value \a rgba. @@ -627,7 +708,7 @@ typedef UINT_PTR LPARAM; * * \sa MakeRGBA, MakeRGB */ -#define GetBValue(rgba) ((BYTE)((DWORD)(rgba) >> 16)) +#define GetBValue(rgba) ((BYTE)((DWORD32)(rgba) >> 16)) /** * \def GetAValue(rgba) * \brief Gets the alpha component from a RGBA triple value \a rgba. @@ -636,7 +717,7 @@ typedef UINT_PTR LPARAM; * * \sa MakeRGBA, MakeRGB */ -#define GetAValue(rgba) ((BYTE)((DWORD)(rgba) >> 24)) +#define GetAValue(rgba) ((BYTE)((DWORD32)(rgba) >> 24)) /** * \def MakeRGBA(r, g, b, a) @@ -648,8 +729,8 @@ typedef UINT_PTR LPARAM; * * \sa GetRValue, GetGValue, GetBValue, GetAValue */ -#define MakeRGBA(r, g, b, a) (((DWORD)((BYTE)(r))) | ((DWORD)((BYTE)(g)) << 8) \ - | ((DWORD)((BYTE)(b)) << 16) | ((DWORD)((BYTE)(a)) << 24)) +#define MakeRGBA(r, g, b, a) (((DWORD32)((BYTE)(r))) | ((DWORD32)((BYTE)(g)) << 8) \ + | ((DWORD32)((BYTE)(b)) << 16) | ((DWORD32)((BYTE)(a)) << 24)) /** * \def MakeRGB(r, g, b) @@ -660,14 +741,8 @@ typedef UINT_PTR LPARAM; * * \sa GetRValue, GetGValue, GetBValue */ -#define MakeRGB(r, g, b) (((DWORD)((BYTE)(r))) | ((DWORD)((BYTE)(g)) << 8) \ - | ((DWORD)((BYTE)(b)) << 16)) - -/** - * \var typedef DWORD RGBCOLOR - * \brief A type definition for a RGB color. - */ -typedef DWORD RGBCOLOR; +#define MakeRGB(r, g, b) (((DWORD32)((BYTE)(r))) | ((DWORD32)((BYTE)(g)) << 8) \ + | ((DWORD32)((BYTE)(b)) << 16)) /** * A rectangle defined by coordinates of corners. @@ -1523,11 +1598,11 @@ typedef struct _GAL_Rect { #endif #ifndef PATH_MAX - #define PATH_MAX 256 +# define PATH_MAX 256 #endif #ifndef NAME_MAX - #define NAME_MAX 64 +# define NAME_MAX 64 #endif @@ -1546,7 +1621,7 @@ typedef struct _GAL_Rect { * \note This definition is an alias of NAME_MAX */ #ifndef MAX_NAME -#define MAX_NAME NAME_MAX +# define MAX_NAME NAME_MAX #endif /** @} end of misc_macros */ @@ -1866,35 +1941,35 @@ int start_minigui_pthread (int (* pth_entry) (int argc, const char* argv []), #include #ifndef ESRCH -# define ESRCH 3 +# define ESRCH 3 #endif #ifndef EAGAIN -# define EAGAIN 11 +# define EAGAIN 11 #endif #ifndef ENOMEM -# define ENOMEM 12 +# define ENOMEM 12 #endif #ifndef EBUSY -# define EBUSY 16 +# define EBUSY 16 #endif #ifndef EINVAL -# define EINVAL 22 +# define EINVAL 22 #endif #ifndef EDEADLK -# define EDEADLK 35 +# define EDEADLK 35 #endif #ifndef ENOSYS -# define ENOSYS 38 +# define ENOSYS 38 #endif #ifndef ENOTSUP -# define ENOTSUP 95 +# define ENOTSUP 95 #endif #ifdef __VXWORKS__ @@ -1962,36 +2037,39 @@ int start_minigui_pthread (int (* pth_entry) (int argc, const char* argv []), #ifdef __MINIGUI_LIB__ #ifdef __UCOSII__ - #include "ucos2_pthread.h" - #include "ucos2_semaphore.h" +# include "ucos2_pthread.h" +# include "ucos2_semaphore.h" #elif defined (__THREADX__) - #include "threadx_pthread.h" - #include "threadx_semaphore.h" +# include "threadx_pthread.h" +# include "threadx_semaphore.h" #elif defined (__NUCLEUS__) - #include "nucleus_pthread.h" - #include "nucleus_semaphore.h" +# include "nucleus_pthread.h" +# include "nucleus_semaphore.h" #elif defined (__VXWORKS__) - #include "vxworks_pthread.h" - #ifdef _MGUSE_OWN_SEMAPHORE - #include "vxworks_semaphore.h" - #else - #include "semaphore.h" - #endif +# include "vxworks_pthread.h" +# ifdef _MGUSE_OWN_SEMAPHORE +# include "vxworks_semaphore.h" +# else +# include "semaphore.h" +# endif #elif defined (__OSE__) - #include "pthread.h" - #include "ose_semaphore.h" +# include "pthread.h" +# include "ose_semaphore.h" #elif defined (__PSOS__) - #include "psos_pthread.h" - #include "psos_semaphore.h" +# include "psos_pthread.h" +# include "psos_semaphore.h" #elif defined (WIN32) - #include "win32_pthread.h" - #include "win32_semaphore.h" +# include "win32_pthread.h" +# include "win32_semaphore.h" #else -#error No own pthread implementation for this OS! +# error No own pthread implementation for this OS! #endif + #else -#include -#include + +# include +# include + #endif /* __MINIGUI_LIB__ */ #else /* _MGUSE_OWN_PTHREAD */ diff --git a/include/gdi.h b/include/gdi.h index a6a4cbf5..962a1d3e 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -1102,7 +1102,7 @@ MG_EXPORT BOOL GUIAPI InitPolygonRegion (PCLIPRGN dst, * \def HDC_INVALID * \brief Indicates an invalid handle to device context. */ -#define HDC_INVALID (HDC)UINT_PTR_MAX +#define HDC_INVALID (HDC)-1 #define GDCAP_COLORNUM 0 #define GDCAP_HPIXEL 1 @@ -2853,7 +2853,7 @@ static inline DWORD Pixel2DWORD (HDC hdc, gal_pixel pixel) #define PIXEL2DWORD(hdc, pixel) Pixel2DWORD(hdc, pixel) /** - * \fn gal_pixel DWORD2PIXEL (HDC hdc, DWORD dword) + * \fn gal_pixel DWORD2Pixel (HDC hdc, DWORD dword) * \brief An inline function to convert DWORD color to gal_pixel. * * This function converts a color in DWORD to pixel value. @@ -2862,7 +2862,7 @@ static inline DWORD Pixel2DWORD (HDC hdc, gal_pixel pixel) * \param dword The color value in DWORD. * \return The converted pixel value. */ -static inline gal_pixel DWORD2PIXEL (HDC hdc, DWORD dword) +static inline gal_pixel DWORD2Pixel (HDC hdc, DWORD dword) { return RGBA2Pixel (hdc, GetRValue(dword), GetGValue(dword), diff --git a/include/window.h b/include/window.h index 98a8b4aa..6eda525f 100644 --- a/include/window.h +++ b/include/window.h @@ -2165,15 +2165,15 @@ typedef struct _DRAGINFO { typedef struct _MSG { /** The handle to the window which receives this message. */ - HWND hwnd; + HWND hwnd; /** The message identifier. */ - int message; + UINT message; /** The first parameter of the message (32-bit integer). */ - WPARAM wParam; + WPARAM wParam; /** The second parameter of the message (32-bit integer). */ - LPARAM lParam; - /** Time*/ - unsigned int time; + LPARAM lParam; + /** Time */ + ULONG time; #ifdef _MGRM_THREADS /** Addtional data*/ void* pAdd; @@ -2217,7 +2217,7 @@ typedef MSG* PMSG; /** * \fn BOOL PeekMessageEx (PMSG pMsg, HWND hWnd, \ - * int iMsgFilterMin, int iMsgFilterMax, \ + * UINT nMsgFilterMin, UINT nMsgFilterMax, \ * BOOL bWait, UINT uRemoveMsg) * \brief Peeks a message from the message queue of a main window. * @@ -2226,8 +2226,8 @@ typedef MSG* PMSG; * * \param pMsg Pointer to the result message. * \param hWnd The handle to the window. - * \param iMsgFilterMin The min identifier of the message that should be peeked. - * \param iMsgFilterMax The max identifier of the message that should be peeked. + * \param nMsgFilterMin The min identifier of the message that should be peeked. + * \param nMsgFilterMax The max identifier of the message that should be peeked. * \param bWait Whether to wait for a message. * \param uRemoveMsg Whether remove the message from the message queue. * Should be the following values: @@ -2243,7 +2243,7 @@ typedef MSG* PMSG; * \sa GetMessage, PeekPostMessage, HavePendingMessage, PostMessage */ MG_EXPORT BOOL GUIAPI PeekMessageEx (PMSG pMsg, HWND hWnd, - int iMsgFilterMin, int iMsgFilterMax, + UINT nMsgFilterMin, UINT nMsgFilterMax, BOOL bWait, UINT uRemoveMsg); /** @@ -2305,7 +2305,7 @@ MG_EXPORT BOOL GUIAPI HavePendingMessage (HWND hMainWnd); /** * \fn BOOL PeekMessage (PMSG pMsg, HWND hWnd, \ - * int iMsgFilterMin, int iMsgFilterMax, UINT uRemoveMsg) + * UINT nMsgFilterMin, UINT nMsgFilterMax, UINT uRemoveMsg) * \brief Peeks a message from the message queue of a main window * * This functions peek a message from the message queue of the window \a hWnd @@ -2314,8 +2314,8 @@ MG_EXPORT BOOL GUIAPI HavePendingMessage (HWND hMainWnd); * * \param pMsg Pointer to the result message. * \param hWnd The handle to the window. - * \param iMsgFilterMin The min identifier of the message that should be peeked. - * \param iMsgFilterMax The max identifier of the message that should be peeked. + * \param nMsgFilterMin The min identifier of the message that should be peeked. + * \param nMsgFilterMax The max identifier of the message that should be peeked. * \param uRemoveMsg Whether remove the message from the message queue. * Should be the following values: * - PM_NOREMOVE\n @@ -2329,16 +2329,16 @@ MG_EXPORT BOOL GUIAPI HavePendingMessage (HWND hMainWnd); * * \sa GetMessage, PeekPostMessage, HavePendingMessage, PostMessage */ -static inline BOOL GUIAPI PeekMessage (PMSG pMsg, HWND hWnd, int iMsgFilterMin, - int iMsgFilterMax, UINT uRemoveMsg) +static inline BOOL GUIAPI PeekMessage (PMSG pMsg, HWND hWnd, UINT nMsgFilterMin, + UINT nMsgFilterMax, UINT uRemoveMsg) { - return PeekMessageEx (pMsg, hWnd, iMsgFilterMin, iMsgFilterMax, + return PeekMessageEx (pMsg, hWnd, nMsgFilterMin, nMsgFilterMax, FALSE, uRemoveMsg); } /** * \fn BOOL PeekPostMessage (PMSG pMsg, HWND hWnd, \ - int iMsgFilterMin, int iMsgFilterMax, UINT uRemoveMsg) + UINT nMsgFilterMin, UINT nMsgFilterMax, UINT uRemoveMsg) * \brief Peeks a post message from the message queue of a main window * * This functions peek a message from the message queue of the window \a hWnd @@ -2347,8 +2347,8 @@ static inline BOOL GUIAPI PeekMessage (PMSG pMsg, HWND hWnd, int iMsgFilterMin, * * \param pMsg Pointer to the result message. * \param hWnd The handle to the window. - * \param iMsgFilterMin The min identifier of the message that should be peeked. - * \param iMsgFilterMax The max identifier of the message that should be peeked. + * \param nMsgFilterMin The min identifier of the message that should be peeked. + * \param nMsgFilterMax The max identifier of the message that should be peeked. * \param uRemoveMsg Whether remove the message from the message queue. * Should be the following values: * - PM_NOREMOVE\n @@ -2362,11 +2362,11 @@ static inline BOOL GUIAPI PeekMessage (PMSG pMsg, HWND hWnd, int iMsgFilterMin, * * \sa GetMessage, PeekMessage, HavePendingMessage, PostMessage */ -MG_EXPORT BOOL GUIAPI PeekPostMessage (PMSG pMsg, HWND hWnd, int iMsgFilterMin, - int iMsgFilterMax, UINT uRemoveMsg); +MG_EXPORT BOOL GUIAPI PeekPostMessage (PMSG pMsg, HWND hWnd, UINT nMsgFilterMin, + UINT nMsgFilterMax, UINT uRemoveMsg); /** - * \fn int PostMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam) + * \fn int PostMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) * \brief Posts a message into the message queue of a window and returns * immediatly. * @@ -2374,7 +2374,7 @@ MG_EXPORT BOOL GUIAPI PeekPostMessage (PMSG pMsg, HWND hWnd, int iMsgFilterMin, * and returns immediately. * * \param hWnd The handle to the window. - * \param iMsg The identifier of the message. + * \param nMsg The identifier of the message. * \param wParam The first parameter of the message. * \param lParam The second parameter of the message. * @@ -2386,29 +2386,29 @@ MG_EXPORT BOOL GUIAPI PeekPostMessage (PMSG pMsg, HWND hWnd, int iMsgFilterMin, * * \sa SendMessage */ -MG_EXPORT int GUIAPI PostMessage (HWND hWnd, int iMsg, +MG_EXPORT int GUIAPI PostMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam); /** - * \fn int SendMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam) + * \fn LRESULT SendMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) * \brief Sends a message to a window. * * This function sends a message to the window \a hWnd, and will return * until the message-handling process returns. * * \param hWnd The handle to the window. - * \param iMsg The identifier of the message. + * \param nMsg The identifier of the message. * \param wParam The first parameter of the message. * \param lParam The second parameter of the message. * \return The return value of the message handler. * * \sa PostMessage */ -MG_EXPORT int GUIAPI SendMessage (HWND hWnd, int iMsg, +MG_EXPORT LRESULT GUIAPI SendMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam); /** - * \fn void GUIAPI SetAutoRepeatMessage (HWND hwnd, int msg, \ + * \fn void GUIAPI SetAutoRepeatMessage (HWND hwnd, UINT msg, \ WPARAM wParam, LPARAM lParam) * \brief Sets the auto-repeat message. * @@ -2422,7 +2422,7 @@ MG_EXPORT int GUIAPI SendMessage (HWND hWnd, int iMsg, * \param wParam The first parameter of the auto-repeat message. * \param lParam The second parameter of the auto-repeat message. */ -MG_EXPORT void GUIAPI SetAutoRepeatMessage (HWND hwnd, int msg, +MG_EXPORT void GUIAPI SetAutoRepeatMessage (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); #ifndef _MGRM_THREADS @@ -2475,13 +2475,13 @@ MG_EXPORT void GUIAPI SetAutoRepeatMessage (HWND hwnd, int msg, int GUIAPI Send2Client (MSG* msg, int cli); /** - * \fn BOOL Send2TopMostClients (int iMsg, WPARAM wParam, LPARAM lParam) + * \fn BOOL Send2TopMostClients (UINT nMsg, WPARAM wParam, LPARAM lParam) * \brief Sends a message to all clients in the topmost layer. * - * This function sends the message specified by (\a iMsg, \a wParam, \a lParam) + * This function sends the message specified by (\a nMsg, \a wParam, \a lParam) * to all clients in the topmost layer. * - * \param iMsg The message identifier. + * \param nMsg The message identifier. * \param wParam The first parameter of the message. * \param lParam The second parameter of the message. * \return TRUE on success, FALSE on error. @@ -2493,18 +2493,18 @@ int GUIAPI Send2Client (MSG* msg, int cli); * * \sa Send2Client, Send2ActiveWindow */ -BOOL GUIAPI Send2TopMostClients (int iMsg, WPARAM wParam, LPARAM lParam); +BOOL GUIAPI Send2TopMostClients (UINT nMsg, WPARAM wParam, LPARAM lParam); /** * \fn BOOL Send2ActiveWindow (const MG_Layer* layer, \ - int iMsg, WPARAM wParam, LPARAM lParam); + UINT nMsg, WPARAM wParam, LPARAM lParam); * \brief Sends a message to the active window in layer. * - * This function sends the message specified by (\a iMsg, \a wParam, \a lParam) + * This function sends the message specified by (\a nMsg, \a wParam, \a lParam) * to the current active window in the specific layer (\a layer). * * \param layer The pointer to the layer. - * \param iMsg The message identifier. + * \param nMsg The message identifier. * \param wParam The first parameter of the message. * \param lParam The second parameter of the message. * @@ -2516,25 +2516,25 @@ BOOL GUIAPI Send2TopMostClients (int iMsg, WPARAM wParam, LPARAM lParam); * \sa Send2Client */ BOOL GUIAPI Send2ActiveWindow (const MG_Layer* layer, - int iMsg, WPARAM wParam, LPARAM lParam); + UINT nMsg, WPARAM wParam, LPARAM lParam); #endif /* _MGRM_PROCESSES */ #else /* !_MGRM_THREADS */ /** - * \fn int PostSyncMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam) + * \fn LRESULT PostSyncMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) * \brief Posts a synchronical message to a window which is in different thread. * * This function posts the synchronical message specified by - * (\a iMsg, \a wParam, \a lParam) to the window \a hWnd which + * (\a nMsg, \a wParam, \a lParam) to the window \a hWnd which * is in different thread. This function will return until * the message is handled by the window procedure. * * \note The destination window must belong to other thread. * * \param hWnd The handle to the window. - * \param iMsg The message identifier. + * \param nMsg The message identifier. * \param wParam The first parameter of the message. * \param lParam The second parameter of the message. * @@ -2542,19 +2542,19 @@ BOOL GUIAPI Send2ActiveWindow (const MG_Layer* layer, * * \sa SendMessage */ -MG_EXPORT int GUIAPI PostSyncMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam); +MG_EXPORT LRESULT GUIAPI PostSyncMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam); /** - * \fn int SendAsyncMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam) + * \fn LRESULT SendAsyncMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) * \brief Sends an asynchronical message to a window. * * This function sends the asynchronical message specified by - * (\a iMsg, \a wParam, \a lParam) to the window \a hWnd + * (\a nMsg, \a wParam, \a lParam) to the window \a hWnd * which is in different thread. This function calls * the window procedure immediately, so it is very dangerous. * * \param hWnd The handle to the window. - * \param iMsg The message identifier. + * \param nMsg The message identifier. * \param wParam The first parameter of the message. * \param lParam The second parameter of the message. * @@ -2564,20 +2564,20 @@ MG_EXPORT int GUIAPI PostSyncMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM * * \sa PostSyncMessage */ -MG_EXPORT int GUIAPI SendAsyncMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam); +MG_EXPORT int GUIAPI SendAsyncMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam); #endif /** - * \fn int SendNotifyMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam) + * \fn int SendNotifyMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) * \brief Sends a notification message to a window. * * This function sends the notification message specified by - * (\a iMsg, \a wParam, \a lParam) to the window \a hWnd. This function + * (\a nMsg, \a wParam, \a lParam) to the window \a hWnd. This function * puts the notication message in the message queue and then returns * immediately. * * \param hWnd The handle to the window. - * \param iMsg The message identifier. + * \param nMsg The message identifier. * \param wParam The first parameter of the message. * \param lParam The second parameter of the message. * @@ -2585,23 +2585,23 @@ MG_EXPORT int GUIAPI SendAsyncMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARA * * \sa SendMessage, PostMessage */ -MG_EXPORT int GUIAPI SendNotifyMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam); +MG_EXPORT int GUIAPI SendNotifyMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam); /** - * \fn int BroadcastMessage (int iMsg, WPARAM wParam, LPARAM lParam) + * \fn int BroadcastMessage (UINT nMsg, WPARAM wParam, LPARAM lParam) * \brief Broadcasts a message to all main window on the desktop. * - * This function posts the message specified by (\a iMsg, \a wParam, \a lParam) + * This function posts the message specified by (\a nMsg, \a wParam, \a lParam) * to all the main windows on the desktop. * - * \param iMsg The message identifier. + * \param nMsg The message identifier. * \param wParam The first parameter of the message. * \param lParam The second parameter of the message. * \return 0 if all OK, < 0 on error. * * \sa PostMessage */ -MG_EXPORT int GUIAPI BroadcastMessage (int iMsg, WPARAM wParam, LPARAM lParam); +MG_EXPORT int GUIAPI BroadcastMessage (UINT nMsg, WPARAM wParam, LPARAM lParam); /** * \fn int PostQuitMessage (HWND hWnd) @@ -2799,22 +2799,22 @@ MG_EXPORT const char* GUIAPI Message2Str (int message); /** * \fn void GUIAPI PrintMessage (FILE* fp, HWND hWnd, \ - int iMsg, WPARAM wParam, LPARAM lParam) + UINT nMsg, WPARAM wParam, LPARAM lParam) * \brief Prints a message in readable string form to a stdio stream. * - * This function prints the message specified by (\a iMsg, \a wParam, \a lParam) + * This function prints the message specified by (\a nMsg, \a wParam, \a lParam) * in readable string form to the stdio stream \a fp. * * \param fp The pointer to the FILE object. * \param hWnd The target window of the message. - * \param iMsg The message identifier. + * \param nMsg The message identifier. * \param wParam The first parameter of the message. * \param lParam The second parameter of the message. * * \sa Message2Str */ MG_EXPORT void GUIAPI PrintMessage (FILE* fp, HWND hWnd, - int iMsg, WPARAM wParam, LPARAM lParam); + UINT nMsg, WPARAM wParam, LPARAM lParam); #endif @@ -4879,7 +4879,7 @@ MG_EXPORT int GUIAPI SetWindowZOrder(HWND hWnd, int zorder); * \var typedef int (* WNDPROC)(HWND, int, WPARAM, LPARAM) * \brief Type of the window callback procedure. */ -typedef int (* WNDPROC)(HWND, int, WPARAM, LPARAM); +typedef LRESULT (* WNDPROC)(HWND, UINT, WPARAM, LPARAM); extern MG_EXPORT HWND __mg_hwnd_desktop; @@ -4899,9 +4899,9 @@ extern MG_EXPORT HWND __mg_hwnd_desktop; * \def HWND_INVALID * \brief Invalid window handle. */ -#define HWND_INVALID (HWND)UINT_PTR_MAX +#define HWND_INVALID (HWND)-1 -#define HWND_OTHERPROC (HWND)UINT_PTR_MAX +#define HWND_OTHERPROC (HWND)-1 /** * Structure defines a main window. @@ -4930,7 +4930,7 @@ typedef struct _MAINWINCREATE HWND hHosting; /** The window callback procedure */ - int (*MainWindowProc)(HWND, int, WPARAM, LPARAM); + LRESULT (*MainWindowProc)(HWND, UINT, WPARAM, LPARAM); /** The position of the main window in the screen coordinates */ int lx, ty, rx, by; @@ -5139,17 +5139,17 @@ BOOL GUIAPI SetWindowRegion (HWND hWnd, const CLIPRGN* region); */ BOOL GUIAPI GetWindowRegion (HWND hWnd, CLIPRGN* region); -int GUIAPI PreDefMainWinProc (HWND hWnd, int message, +LRESULT GUIAPI PreDefMainWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); -int GUIAPI PreDefDialogProc (HWND hWnd, - int message, WPARAM wParam, LPARAM lParam); +LRESULT GUIAPI PreDefDialogProc (HWND hWnd, + UINT message, WPARAM wParam, LPARAM lParam); -int GUIAPI PreDefControlProc (HWND hWnd, int message, +LRESULT GUIAPI PreDefControlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); /** - * \fn int DefaultWindowProc (HWND hWnd, int message, \ + * \fn LRESULT DefaultWindowProc (HWND hWnd, UINT message, \ WPARAM wParam, LPARAM lParam) * \brief The default window callback procedure. * @@ -5165,7 +5165,7 @@ int GUIAPI PreDefControlProc (HWND hWnd, int message, * \param wParam The first parameter of the message. * \param lParam The second parameter of the message. */ -MG_EXPORT int GUIAPI DefaultWindowProc (HWND hWnd, int message, +MG_EXPORT LRESULT GUIAPI DefaultWindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); /** @@ -6734,13 +6734,13 @@ static inline void GUIAPI ScrollWindow (HWND hWnd, int dx, int dy, * \brief Get window element color. */ #define GetWindowElementColor(iItem) \ - GetWindowElementPixelEx(HWND_NULL, -1, iItem) + GetWindowElementPixelEx(HWND_NULL, (HDC)-1, iItem) #define GetWindowElementColorEx(hWnd, iItem) \ - GetWindowElementPixelEx(hWnd, -1, iItem) + GetWindowElementPixelEx(hWnd, (HDC)-1, iItem) #define GetWindowElementPixel(hWnd, iItem) \ - GetWindowElementPixelEx(hWnd, -1, iItem) + GetWindowElementPixelEx(hWnd, (HDC)-1, iItem) /** @} end of window_general_fns */ @@ -7289,7 +7289,7 @@ typedef struct _WNDCLASS int iBkColor; /** Window callback procedure of all instances of this window class */ - int (*WinProc) (HWND, int, WPARAM, LPARAM); + LRESULT (*WinProc) (HWND, UINT, WPARAM, LPARAM); /** The private additional data associated with this window class */ DWORD dwAddData; @@ -8426,10 +8426,10 @@ typedef struct _MENUITEMINFO { PBITMAP checkedbmp; /** The private data attached to the menu item */ - DWORD itemdata; + DWORD itemdata; /** The data of this menu item, used to pass the string or the pointer to the BITMAP object of the menu item */ - DWORD typedata; + DWORD typedata; /** * Used by \a GetMenuItemInfo function to indicate the maximal length @@ -9056,7 +9056,7 @@ typedef struct _CTRLDATA /** Control caption */ const char* caption; /** Additional data */ - DWORD dwAddData; + DWORD dwAddData; /** Control extended style */ DWORD dwExStyle; @@ -9431,8 +9431,8 @@ MG_EXPORT HWND GUIAPI GetNextDlgGroupItem (HWND hDlg, MG_EXPORT HWND GUIAPI GetNextDlgTabItem (HWND hDlg, HWND hCtl, BOOL bPrevious); /** - * \fn int GUIAPI SendDlgItemMessage (HWND hDlg, int nIDDlgItem, \ - * int message, WPARAM wParam, LPARAM lParam) + * \fn LRESULT GUIAPI SendDlgItemMessage (HWND hDlg, int nIDDlgItem, \ + * UINT message, WPARAM wParam, LPARAM lParam) * \brief Sends a message to the specified control in a dialog box. * * This function sends a message specified by (\a message, \a wParam, \a lParam) @@ -9449,8 +9449,8 @@ MG_EXPORT HWND GUIAPI GetNextDlgTabItem (HWND hDlg, HWND hCtl, BOOL bPrevious); * * \sa SendMessage, GetDlgItem */ -MG_EXPORT int GUIAPI SendDlgItemMessage ( HWND hDlg, int nIDDlgItem, - int message, WPARAM wParam, LPARAM lParam); +MG_EXPORT LRESULT GUIAPI SendDlgItemMessage (HWND hDlg, int nIDDlgItem, + UINT message, WPARAM wParam, LPARAM lParam); /** * \fn BOOL GUIAPI SetDlgItemInt (HWND hDlg, int nIDDlgItem, \ diff --git a/src/control/bidiedit.c b/src/control/bidiedit.c index 05fec871..20dbf41a 100644 --- a/src/control/bidiedit.c +++ b/src/control/bidiedit.c @@ -43,7 +43,7 @@ static void set_line_width (HWND hWnd, PBIDISLEDITDATA sled); static void mySetCaretPos (HWND hWnd, PBIDISLEDITDATA sled, int x); -static int SLEditCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam); +static LRESULT SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); static void sledit_refresh_caret (HWND hWnd, PBIDISLEDITDATA sled, BOOL bInited); #define check_caret() \ @@ -2316,8 +2316,8 @@ static int sledit_reset_text (HWND hWnd, PBIDISLEDITDATA sled, char* str) return 0; } -static int -SLEditCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT +SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { DWORD dwStyle; HDC hdc; diff --git a/src/control/button.c b/src/control/button.c index 58bfd7d8..77df4f44 100644 --- a/src/control/button.c +++ b/src/control/button.c @@ -83,7 +83,7 @@ #define BUTTON_OFFSET 1 -static int ButtonCtrlProc (HWND hWnd, int uMsg, WPARAM wParam, LPARAM lParam); +static LRESULT ButtonCtrlProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); static void btnGetRects (PCONTROL pctrl, RECT* prcClient, RECT* prcContent, RECT* prcBitmap); @@ -652,7 +652,7 @@ static inline BOOL mouse_in_client(LPARAM lParam, PCONTROL pctrl) return (PtInRect ((PRECT) &(pctrl->cl), x, y)); } -static int ButtonCtrlProc (HWND hWnd, int uMsg, WPARAM wParam, LPARAM lParam) +static LRESULT ButtonCtrlProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { HDC hdc; PCONTROL pctrl; diff --git a/src/control/combobox.c b/src/control/combobox.c index f7290f72..e34d0392 100644 --- a/src/control/combobox.c +++ b/src/control/combobox.c @@ -47,7 +47,7 @@ #define DEC_BOX 2 static int mouse_old = 0; -static int ComboBoxCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam); +static LRESULT ComboBoxCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); BOOL RegisterComboBoxControl (void) { @@ -64,7 +64,7 @@ BOOL RegisterComboBoxControl (void) return AddNewControlClass (&WndClass) == ERR_OK; } -static int AutoSpinEditBoxProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT AutoSpinEditBoxProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { WNDPROC old_edit_proc; @@ -315,7 +315,7 @@ static void OnSizeChanged (PCONTROL pCtrl, DWORD dwStyle, const RECT* rcClient) } } -static int ComboBoxCtrlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT ComboBoxCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { PCONTROL pCtrl = gui_Control (hwnd); PCOMBOBOXDATA pData = (PCOMBOBOXDATA)pCtrl->dwAddData2; diff --git a/src/control/ctrlmisc.c b/src/control/ctrlmisc.c index 3656824e..a8747d58 100644 --- a/src/control/ctrlmisc.c +++ b/src/control/ctrlmisc.c @@ -28,7 +28,7 @@ #define _ID_TIMER 100 -static int ToolTipWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT ToolTipWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static int iBorder; switch (message) { @@ -253,7 +253,7 @@ DefaultPageProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) IncludeWindowStyle (hNewDef, BS_DEFPUSHBUTTON); InvalidateRect (hNewDef, NULL, TRUE); - return (int)hOldDef; + return (LRESULT)hOldDef; } break; } diff --git a/src/control/edit.c b/src/control/edit.c index 52b0e465..60310a3d 100644 --- a/src/control/edit.c +++ b/src/control/edit.c @@ -43,7 +43,7 @@ static void set_line_width (HWND hWnd, PSLEDITDATA sled); static void mySetCaretPos (HWND hWnd, PSLEDITDATA sled, int x); -static int SLEditCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam); +static LRESULT SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); static void sledit_refresh_caret (HWND hWnd, PSLEDITDATA sled, BOOL bInited); static BOOL make_charpos_visible (HWND hWnd, PSLEDITDATA sled, int charPos, int *cx); @@ -1897,8 +1897,8 @@ sledit_insert_text (HWND hWnd, PSLEDITDATA sled, const char* newtext, int len) return 0; } -static int -SLEditCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT +SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { DWORD dwStyle; HDC hdc; diff --git a/src/control/listbox.c b/src/control/listbox.c index b6c65e60..e8f44d73 100644 --- a/src/control/listbox.c +++ b/src/control/listbox.c @@ -47,7 +47,7 @@ /** minimum height of checkmark */ #define LFRDR_LB_CHECKBMP_MIN 6 -static int ListboxCtrlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lParam); +static LRESULT ListboxCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); BOOL RegisterListboxControl (void) { @@ -850,7 +850,7 @@ static void lstSetScrollInfo (HWND hwnd, PLISTBOXDATA pData, BOOL fRedraw) lstSetHScrollInfo (hwnd, pData, fRedraw); } -static int ListboxCtrlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT ListboxCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; PCONTROL pCtrl; diff --git a/src/control/menubutton.c b/src/control/menubutton.c index 0b8804cf..b0dfbc41 100644 --- a/src/control/menubutton.c +++ b/src/control/menubutton.c @@ -40,7 +40,7 @@ #define _INTER_BARTEXT 4 -static int MenuButtonCtrlProc (HWND hWnd, int message, WPARAM wParam, +static LRESULT MenuButtonCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); BOOL RegisterMenuButtonControl (void) @@ -453,7 +453,7 @@ error: return 0; } -static int MenuButtonCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT MenuButtonCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PMENUBTNDATA mb_data; WINDOWINFO *wnd_info; diff --git a/src/control/newtoolbar.c b/src/control/newtoolbar.c index 07a95eae..713c12d8 100644 --- a/src/control/newtoolbar.c +++ b/src/control/newtoolbar.c @@ -40,7 +40,7 @@ #define MARGIN_HORZ 5 #define MARGIN_V_VERT 5 #endif -static int NewToolbarCtrlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lParam); +static LRESULT NewToolbarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); BOOL RegisterNewToolbarControl (void) { @@ -87,8 +87,8 @@ static void draw_left_right_line_vert (HWND hwnd, HDC hdc, RECT *rc) lighter_dword = pWin->we_rdr->calc_3dbox_color (bgc_dword, LFRDR_3DBOX_COLOR_LIGHTEST); - darker_pixel = DWORD2PIXEL (hdc, darker_dword); - lighter_pixel = DWORD2PIXEL (hdc, lighter_dword); + darker_pixel = DWORD2Pixel (hdc, darker_dword); + lighter_pixel = DWORD2Pixel (hdc, lighter_dword); rc->bottom -= 1; rc->right -= 1; @@ -182,8 +182,8 @@ static void draw_separator_vert (HWND hwnd, HDC hdc, int l, int t, NTBCTRLDATA * lighter_dword = pWin->we_rdr->calc_3dbox_color (bgc_dword, LFRDR_3DBOX_COLOR_LIGHTEST); - darker_pixel = DWORD2PIXEL (hdc, darker_dword); - lighter_pixel = DWORD2PIXEL (hdc, lighter_dword); + darker_pixel = DWORD2Pixel (hdc, darker_dword); + lighter_pixel = DWORD2Pixel (hdc, lighter_dword); pta.x = l; pta.y = t + 1; @@ -230,7 +230,7 @@ static void draw_checked_item_vert (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data, bgc_dword = pWin->we_rdr->calc_3dbox_color (bgc_dword, LFRDR_3DBOX_COLOR_DARKEST); - bgc_pixel = DWORD2PIXEL (hdc, bgc_dword); + bgc_pixel = DWORD2Pixel (hdc, bgc_dword); pta.x = l; pta.y = t; ptb.x = l; ptb.y = b; @@ -446,8 +446,8 @@ static void draw_top_bottom_line_horz (HWND hwnd, HDC hdc, RECT *rc) lighter_dword = pWin->we_rdr->calc_3dbox_color (bgc_dword, LFRDR_3DBOX_COLOR_LIGHTEST); - darker_pixel = DWORD2PIXEL (hdc, darker_dword); - lighter_pixel = DWORD2PIXEL (hdc, lighter_dword); + darker_pixel = DWORD2Pixel (hdc, darker_dword); + lighter_pixel = DWORD2Pixel (hdc, lighter_dword); rc->bottom -= 1; rc->right -= 1; @@ -506,8 +506,8 @@ static void draw_separator_horz (HWND hwnd, HDC hdc, int l, int t, NTBITEM *it) lighter_dword = pWin->we_rdr->calc_3dbox_color (bgc_dword, LFRDR_3DBOX_COLOR_LIGHTEST); - darker_pixel = DWORD2PIXEL (hdc, darker_dword); - lighter_pixel = DWORD2PIXEL (hdc, lighter_dword); + darker_pixel = DWORD2Pixel (hdc, darker_dword); + lighter_pixel = DWORD2Pixel (hdc, lighter_dword); pta.x = l + 1; pta.y = t; @@ -568,7 +568,7 @@ static void draw_checked_item_horz (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data, bgc_dword = pWin->we_rdr->calc_3dbox_color (bgc_dword, LFRDR_3DBOX_COLOR_DARKEST); - bgc_pixel = DWORD2PIXEL (hdc, bgc_dword); + bgc_pixel = DWORD2Pixel (hdc, bgc_dword); pta.x = l; pta.y = t; ptb.x = l; ptb.y = b; @@ -1255,7 +1255,7 @@ static void ShowCurItemHintText (HWND hWnd, NTBCTRLDATA *ntb_data , NTBITEM * pi } } -static int NewToolbarCtrlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT NewToolbarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { PCONTROL myself; PNTBCTRLDATA ntb_data; diff --git a/src/control/progressbar.c b/src/control/progressbar.c index 9063a5a7..ff7332bb 100644 --- a/src/control/progressbar.c +++ b/src/control/progressbar.c @@ -67,8 +67,8 @@ pbarOnNewPos (const CONTROL* pCtrl, InvalidateRect ((HWND)pCtrl, NULL, FALSE); } -static int -ProgressBarCtrlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT +ProgressBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; PCONTROL pCtrl; diff --git a/src/control/propsheet.c b/src/control/propsheet.c index 1a38797e..b8830ab6 100644 --- a/src/control/propsheet.c +++ b/src/control/propsheet.c @@ -43,9 +43,8 @@ #define WEC_TAB_LIGHT 32 #define TAB_MARGIN 8 -static int -PropSheetCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam); - +static LRESULT +PropSheetCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); BOOL RegisterPropSheetControl (void) { @@ -112,7 +111,7 @@ static void show_hide_page (PPROPPAGE page, int show_cmd) ShowWindow (page->hwnd, show_cmd); focus = GetNextDlgTabItem (page->hwnd, (HWND)0, 0); - if (SendMessage (page->hwnd, MSG_SHOWPAGE, focus, show_cmd) && + if (SendMessage (page->hwnd, MSG_SHOWPAGE, (WPARAM)focus, show_cmd) && show_cmd == SW_SHOW) { if (focus) { SetFocus (focus); @@ -628,7 +627,7 @@ static void draw_propsheet (HWND hwnd, HDC hdc, PCONTROL ctrl, scrollbtn_left = propsheet->head_rc.right - get_metrics (MWM_SB_WIDTH); } - old_brush_c = SetBrushColor (hdc, DWORD2PIXEL (hdc, main_c)); + old_brush_c = SetBrushColor (hdc, DWORD2Pixel (hdc, main_c)); while (page) { if (((ctrl->dwStyle & 0x0fL) == PSS_SCROLLABLE) && propsheet->overload == TRUE) if (((title_rc.right + page->width > scrollbtn_left) || (page->width == 0)) @@ -674,7 +673,7 @@ static void draw_propsheet (HWND hwnd, HDC hdc, PCONTROL ctrl, propsheet->overload == TRUE) draw_scroll_button (hwnd, hdc, &title_rc, propsheet, ctrl->dwStyle); - SetBrushColor (hdc, DWORD2PIXEL(hdc, old_brush_c)); + SetBrushColor (hdc, DWORD2Pixel(hdc, old_brush_c)); } static int insert_new_page_normal_style (HWND hwnd, PPROPSHEETDATA propsheet, @@ -919,8 +918,8 @@ static BOOL delete_page (HWND hwnd, PCONTROL ctrl, PPROPSHEETDATA propsheet, /* window procedure of the property sheet. */ -static int -PropSheetCtrlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT +PropSheetCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { PCONTROL ctrl; PPROPSHEETDATA propsheet; @@ -1046,8 +1045,7 @@ PropSheetCtrlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lParam) } case PSM_GETACTIVEPAGE: { - return (propsheet->active) ? - propsheet->active->hwnd : HWND_INVALID; + return (LRESULT)((propsheet->active) ? propsheet->active->hwnd : HWND_INVALID); } case PSM_GETPAGE: { @@ -1055,19 +1053,19 @@ PropSheetCtrlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lParam) PPROPPAGE page = propsheet->head; while (page) { if (index == wParam) { - return page->hwnd; + return (LRESULT)page->hwnd; } index ++; page = page->next; } - return HWND_INVALID; + return (LRESULT)HWND_INVALID; } case PSM_GETPAGEINDEX: { int index = 0; PPROPPAGE page = propsheet->head; while (page) { - if (page->hwnd == wParam) { + if (page->hwnd == (HWND)wParam) { return index; } index ++; diff --git a/src/control/scrollbar.c b/src/control/scrollbar.c index 9e81bf1d..08714890 100644 --- a/src/control/scrollbar.c +++ b/src/control/scrollbar.c @@ -325,7 +325,7 @@ int track_thumb (HWND hwnd, PSCROLLBARDATA data, int x, int y) return 0; } -static int ScrollBarCtrlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { PSCROLLBARDATA data; PCONTROL pCtrl; diff --git a/src/control/scrollview.c b/src/control/scrollview.c index 295e5f33..0097ae16 100644 --- a/src/control/scrollview.c +++ b/src/control/scrollview.c @@ -430,7 +430,7 @@ void scrollview_destroy (PSVDATA psvdata) } /* --------------------------------------------------------------------------------- */ -int ScrollViewCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT ScrollViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PSVDATA psvdata = NULL; diff --git a/src/control/scrollwnd.c b/src/control/scrollwnd.c index 9c7e78d0..85ffcaba 100644 --- a/src/control/scrollwnd.c +++ b/src/control/scrollwnd.c @@ -185,7 +185,7 @@ void scrollwnd_reset_content (HWND hWnd, PSWDATA pswdata) /* --------------------------------------------------------------------------------- */ -int ScrollWndCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT ScrollWndCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PSWDATA pswdata = NULL; diff --git a/src/control/static.c b/src/control/static.c index dbf22dfe..cdd63a11 100644 --- a/src/control/static.c +++ b/src/control/static.c @@ -31,8 +31,8 @@ #include "static_impl.h" -static int -StaticControlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT +StaticControlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { RECT rcClient; HDC hdc; diff --git a/src/control/text.h b/src/control/text.h index 60e98a71..3573d156 100644 --- a/src/control/text.h +++ b/src/control/text.h @@ -31,7 +31,9 @@ typedef struct strbuffer_s #if 1 #define te_alloc malloc #define te_free free - #define te_realloc(ptr, size, cpysize) realloc(ptr, size) +static inline void* te_realloc (void* ptr, size_t size, size_t cpysize) { + return realloc (ptr, size); +} #else #define te_alloc FixStrAlloc #define te_free FixStrFree diff --git a/src/control/textedit.c b/src/control/textedit.c index 80f6c836..c870ccbe 100644 --- a/src/control/textedit.c +++ b/src/control/textedit.c @@ -3025,7 +3025,7 @@ static void init_bufdc (HWND hWnd, PTEDATA ptedata) ReleaseDC(hdc); } -static int TextEditCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT TextEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PTEDATA ptedata = NULL; diff --git a/src/control/trackbar.c b/src/control/trackbar.c index 90e365e1..047ee3b0 100644 --- a/src/control/trackbar.c +++ b/src/control/trackbar.c @@ -185,7 +185,7 @@ static int NormalizeMousePos (HWND hwnd, TRACKBARDATA* pData, int mousepos) return (int)((pData->nMax - pData->nMin) * pos / (float)len + 0.5) + pData->nMin; } -static int TrackBarCtrlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT TrackBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { PCONTROL pCtrl; TRACKBARDATA* pData; diff --git a/src/ex_ctrl/animation.c b/src/ex_ctrl/animation.c index 602c9ec5..66a5d2ea 100644 --- a/src/ex_ctrl/animation.c +++ b/src/ex_ctrl/animation.c @@ -25,7 +25,7 @@ #include "ctrlclass.h" #include "ctrl/animation.h" -static int AnimationCtrlProc (HWND hwnd, int uMsg, WPARAM wParam, LPARAM lParam); +static LRESULT AnimationCtrlProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); BOOL RegisterAnimationControl (void) { @@ -266,7 +266,7 @@ static void setup_anim_mem_dc (HWND hwnd, ANIMATIONINFO* anim_info) ReleaseDC (hdc); } -static int AnimationCtrlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT AnimationCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { ANIMATIONINFO* anim_info = (ANIMATIONINFO*)GetWindowAdditionalData2 (hwnd); @@ -362,11 +362,11 @@ static int AnimationCtrlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lPar //SetTimer (hwnd, ID_TIMER, anim_info->anim->time_unit); SetTimer (hwnd, ID_TIMER, 1); } - return (int)old; + return (LRESULT)old; } case ANM_GETANIMATION: - return (int)anim_info->anim; + return (LRESULT)anim_info->anim; case ANM_STARTPLAY: { @@ -407,8 +407,8 @@ static int AnimationCtrlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lPar NotifyParent (hwnd, GetDlgCtrlID (hwnd), ANNC_CLICKED); break; - default: - break; + default: + break; } return DefaultControlProc (hwnd, message, wParam, lParam); diff --git a/src/ex_ctrl/coolbar.c b/src/ex_ctrl/coolbar.c index 77c5095b..614e063d 100644 --- a/src/ex_ctrl/coolbar.c +++ b/src/ex_ctrl/coolbar.c @@ -31,7 +31,7 @@ #define ITEMBARWIDTH 8 -static int CoolBarCtrlProc (HWND hWnd, int uMsg, WPARAM wParam, LPARAM lParam); +static LRESULT CoolBarCtrlProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); BOOL RegisterCoolBarControl (void) { @@ -317,7 +317,7 @@ static void set_item_rect (HWND hwnd, PCOOLBARCTRL TbarData, COOLBARITEMDATA* pt ptemp->hinty = ptemp->RcTitle.bottom; } -static int CoolBarCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT CoolBarCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; PCOOLBARCTRL TbarData; diff --git a/src/ex_ctrl/gridview.c b/src/ex_ctrl/gridview.c index dfa97014..b61b96af 100644 --- a/src/ex_ctrl/gridview.c +++ b/src/ex_ctrl/gridview.c @@ -1583,7 +1583,7 @@ void GridDataModalArray_delete_modal(gvGridDataModal* modal) // }}} -static int GridViewCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT GridViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { gvGridViewData* view = NULL; if (message != MSG_CREATE) diff --git a/src/ex_ctrl/iconview.c b/src/ex_ctrl/iconview.c index a87afd59..38ecec7f 100644 --- a/src/ex_ctrl/iconview.c +++ b/src/ex_ctrl/iconview.c @@ -466,8 +466,7 @@ void iconview_destroy (IconviewData* pivdata) ivlist_reset_content (hivwnd, &pivdata->ivlist); } -static int -IconViewCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT IconViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { IconviewData* pivdata = NULL; IconviewList* pivlist = NULL; diff --git a/src/ex_ctrl/listview.c b/src/ex_ctrl/listview.c index fa053f03..8db35a2a 100644 --- a/src/ex_ctrl/listview.c +++ b/src/ex_ctrl/listview.c @@ -1314,7 +1314,7 @@ static void listview_destroy (HWND hWnd, PLVDATA plvdata) #define RETURN_DIRECT return DefaultControlProc(hWnd, message, wParam, lParam) -static int ListViewCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT ListViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PLVDATA plvdata = NULL; diff --git a/src/ex_ctrl/monthcalendar.c b/src/ex_ctrl/monthcalendar.c index ca5df2d0..601cd2ab 100644 --- a/src/ex_ctrl/monthcalendar.c +++ b/src/ex_ctrl/monthcalendar.c @@ -72,7 +72,7 @@ #define MCCLR_DF_WEEKCAPTBK GetWindowElementPixel(hWnd, WE_BGC_HIGHLIGHT_ITEM) #define MCCLR_DF_WEEKCAPTTEXT GetWindowElementPixel(hWnd, WE_FGC_HIGHLIGHT_ITEM) -static int MonthCalendarCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam); +static LRESULT MonthCalendarCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); BOOL RegisterMonthCalendarControl (void) { @@ -866,7 +866,7 @@ static void mcKeyOperations (HWND hWnd, PMONCALDDATA mc_data, WPARAM wParam) /********************************************************************************/ -static int MonthCalendarCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT MonthCalendarCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; PMONCALDDATA mc_data = NULL; diff --git a/src/ex_ctrl/spinbox.c b/src/ex_ctrl/spinbox.c index 6dbe27e1..bc69ed0b 100644 --- a/src/ex_ctrl/spinbox.c +++ b/src/ex_ctrl/spinbox.c @@ -185,8 +185,8 @@ OnDownArrow (HWND hWnd, PSPINDATA pData, int id, DWORD dwStyle, DWORD wParam) } } -static int -SpinCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT +SpinCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PSPINDATA pData = (PSPINDATA) GetWindowAdditionalData2 (hWnd); diff --git a/src/ex_ctrl/treeview.c b/src/ex_ctrl/treeview.c index 5c190f57..84bb1ef6 100644 --- a/src/ex_ctrl/treeview.c +++ b/src/ex_ctrl/treeview.c @@ -46,7 +46,7 @@ static HICON icon_fold, icon_unfold; #define FGC_HILIGHT_NORMAL WE_FGC_HIGHLIGHT_ITEM #define FGC_CONTROL_NORMAL WE_FGC_WINDOW -static int TreeViewCtrlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lParam); +static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); BOOL RegisterTreeViewControl (void) { @@ -803,7 +803,7 @@ static int set_item_text (HWND hwnd, PTVDATA pData, PTVITEM item, const char* te return 0; } -static int TreeViewCtrlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { PTVDATA pData = NULL; DWORD dwStyle; diff --git a/src/ex_ctrl/treeview_rdr.c b/src/ex_ctrl/treeview_rdr.c index 75e347ee..1168a803 100644 --- a/src/ex_ctrl/treeview_rdr.c +++ b/src/ex_ctrl/treeview_rdr.c @@ -36,7 +36,7 @@ #define TV_ICONGAP 3 #define TV_IDENT 4 -static int TreeViewCtrlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lParam); +static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); BOOL RegisterTreeViewRdrControl (void) { @@ -785,7 +785,7 @@ static int set_item_text (HWND hwnd, PTVDATA pData, PTVITEM item, const char* te return 0; } -static int TreeViewCtrlProc (HWND hwnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { PTVDATA pData = NULL; DWORD dwStyle; diff --git a/src/font/devfont.c b/src/font/devfont.c index 150c31a0..da65a747 100644 --- a/src/font/devfont.c +++ b/src/font/devfont.c @@ -271,7 +271,7 @@ unsigned short font_GetBestScaleFactor (int height, int expect) { \ devfont = head; \ while (devfont) { \ - fprintf (stderr, " %d: %s, charsetname: %s, style: %#x\n", \ + fprintf (stderr, " %d: %s, charsetname: %s, style: %lx\n", \ count, \ devfont->name, devfont->charset_ops->name, devfont->style); \ devfont = devfont->next; \ diff --git a/src/font/logfont.c b/src/font/logfont.c index e9f0a27a..60364bb7 100644 --- a/src/font/logfont.c +++ b/src/font/logfont.c @@ -102,7 +102,7 @@ static PLOGFONT gdiCreateLogFont (const char* type, const char* family, log_font->sbc_scale = 1; log_font->mbc_scale = 1; - _MG_PRINTF ("FONT>LogFont: requested info: type: %s, family: %s, style: %x, charset: %s, size: %d.\n", + _MG_PRINTF ("FONT>LogFont: requested info: type: %s, family: %s, style: %lx, charset: %s, size: %d.\n", log_font->type, log_font->family, log_font->style, log_font->charset, log_font->size); @@ -223,7 +223,7 @@ static PLOGFONT gdiCreateLogFont (const char* type, const char* family, log_font->style &= ~FS_FLIP_HORZVERT; } - _MG_PRINTF ("FONT>LogFont: created info: type: %s, family: %s, style: %x, charset: %s, size: %d.\n", + _MG_PRINTF ("FONT>LogFont: created info: type: %s, family: %s, style: %lx, charset: %s, size: %d.\n", log_font->type, log_font->family, log_font->style, log_font->charset, log_font->size); diff --git a/src/gui/ctrlclass.c b/src/gui/ctrlclass.c index 0576eb39..7656926d 100644 --- a/src/gui/ctrlclass.c +++ b/src/gui/ctrlclass.c @@ -527,7 +527,7 @@ BOOL SetWindowExStyle (HWND hWnd, DWORD dwExStyle) void mnuDumpCtrlClassInfo (PCTRLCLASSINFO cci) { printf ("\tClass Name: %s\n", cci->name); - printf ("\tClass Cursor: %x\n", cci->hCursor); + printf ("\tClass Cursor: %p\n", cci->hCursor); printf ("\tClass Background color: %d\n", cci->iBkColor); printf ("\tClass Control Proc: %p\n", cci->ControlProc); printf ("\tClass Use Count: %d\n", cci->nUseCount); diff --git a/src/gui/dialog.c b/src/gui/dialog.c index 335e25d9..891cebaf 100644 --- a/src/gui/dialog.c +++ b/src/gui/dialog.c @@ -120,7 +120,7 @@ HWND GUIAPI CreateMainWindowIndirectParamEx (PDLGTEMPLATE pDlgTemplate, hFocus = (HWND)pCtrl; } #endif - if (SendMessage (hMainWin, MSG_INITDIALOG, hFocus, lParam)) { + if (SendMessage (hMainWin, MSG_INITDIALOG, (WPARAM)hFocus, lParam)) { if (hFocus) SetFocus (hFocus); } @@ -215,7 +215,7 @@ BOOL GUIAPI EndDialog (HWND hDlg, int endCode) return TRUE; } -int GUIAPI PreDefDialogProc (HWND hWnd, int message, +LRESULT GUIAPI PreDefDialogProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { HWND hCurFocus; @@ -285,7 +285,7 @@ int GUIAPI PreDefDialogProc (HWND hWnd, int message, IncludeWindowStyle (hNewDef, BS_DEFPUSHBUTTON); InvalidateRect (hNewDef, NULL, TRUE); - return (int)hOldDef; + return (LRESULT)hOldDef; } break; } @@ -628,8 +628,8 @@ HWND GUIAPI GetNextDlgTabItem (HWND hDlg, HWND hCtl, BOOL bPrevious) return hCtl; } -int GUIAPI SendDlgItemMessage (HWND hDlg, int nIDDlgItem, - int message, WPARAM wParam, LPARAM lParam) +LRESULT GUIAPI SendDlgItemMessage (HWND hDlg, int nIDDlgItem, + UINT message, WPARAM wParam, LPARAM lParam) { HWND hCtrl; @@ -772,7 +772,7 @@ int GUIAPI IsDlgButtonChecked (HWND hDlg, int idButton) } #ifdef _MGCTRL_STATIC -static int MsgBoxProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT MsgBoxProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_INITDIALOG: @@ -1077,14 +1077,14 @@ int GUIAPI MessageBox (HWND hParentWnd, const char* pszText, if (IsTiny) { if (id_icon != -1) { - CtrlData [i].dwAddData = GetSmallSystemIcon (id_icon); + CtrlData [i].dwAddData = (DWORD)GetSmallSystemIcon (id_icon); } rcIcon.right = 16; rcIcon.bottom = 16; } else { if (id_icon != -1) { - CtrlData [i].dwAddData = GetLargeSystemIcon (id_icon); + CtrlData [i].dwAddData = (DWORD)GetLargeSystemIcon (id_icon); MsgBoxData.hIcon = GetSmallSystemIcon (id_icon); } rcIcon.right = 32; diff --git a/src/gui/lf_classic.c b/src/gui/lf_classic.c index 92b6a32e..2e8e519b 100644 --- a/src/gui/lf_classic.c +++ b/src/gui/lf_classic.c @@ -1034,7 +1034,7 @@ static void draw_normal_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1043,7 +1043,7 @@ static void draw_hilite_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1052,7 +1052,7 @@ static void draw_disabled_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1061,7 +1061,7 @@ static void draw_significant_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1070,7 +1070,7 @@ static void draw_normal_menu_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1079,7 +1079,7 @@ static void draw_hilite_menu_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1088,7 +1088,7 @@ static void draw_disabled_menu_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1125,7 +1125,7 @@ static void draw_push_button (HWND hWnd, HDC hdc, const RECT* pRect, if (STATUS_GET_CHECK (status) != BST_UNCHECKED) { dark_color = calc_3dbox_color (color1, LFRDR_3DBOX_COLOR_DARKER); - dark_pixel = DWORD2PIXEL(hdc, dark_color); + dark_pixel = DWORD2Pixel(hdc, dark_color); if (STATUS_GET_CHECK (status) == BST_CHECKED) { @@ -3216,10 +3216,10 @@ draw_tab (HWND hWnd, HDC hdc, RECT *rect, char *title, DWORD color, int flag, HI /* draw the title's edge */ /* pc3d style & flat & grap */ if (flag & LFRDR_TAB_BOTTOM) { - SetPenColor(hdc, DWORD2PIXEL (hdc, light_c)); + SetPenColor(hdc, DWORD2Pixel (hdc, light_c)); MoveTo (hdc, rect->left, ty); LineTo (hdc, rect->left, by - 3 ); - SetPenColor(hdc, DWORD2PIXEL (hdc, darker_c)); + SetPenColor(hdc, DWORD2Pixel (hdc, darker_c)); MoveTo (hdc, rect->left + 2, by - 1); LineTo (hdc, rect->right - 4, by - 1); @@ -3227,7 +3227,7 @@ draw_tab (HWND hWnd, HDC hdc, RECT *rect, char *title, DWORD color, int flag, HI LineTo (hdc, rect->left + 1, by - 2); } else { - SetPenColor(hdc, DWORD2PIXEL (hdc, light_c)); + SetPenColor(hdc, DWORD2Pixel (hdc, light_c)); MoveTo (hdc, rect->left, by - 1); LineTo (hdc, rect->left, ty + 2); MoveTo (hdc, rect->left + 2, ty); @@ -3238,26 +3238,26 @@ draw_tab (HWND hWnd, HDC hdc, RECT *rect, char *title, DWORD color, int flag, HI } if (flag & LFRDR_TAB_BOTTOM) { - SetPenColor(hdc, DWORD2PIXEL (hdc, darkest_c)); + SetPenColor(hdc, DWORD2Pixel (hdc, darkest_c)); MoveTo (hdc, rect->right - 2, by - 3); LineTo (hdc, rect->right - 2, ty); MoveTo (hdc, rect->right - 3, by - 2 ); LineTo (hdc, rect->right - 3, by - 2); - SetPenColor(hdc, DWORD2PIXEL (hdc, darker_c)); + SetPenColor(hdc, DWORD2Pixel (hdc, darker_c)); MoveTo (hdc, rect->right - 3, by -3); LineTo (hdc, rect->right - 3, ty); }else { - SetPenColor(hdc, DWORD2PIXEL (hdc, darkest_c)); + SetPenColor(hdc, DWORD2Pixel (hdc, darkest_c)); MoveTo (hdc, rect->right - 2, ty + 2 ); LineTo (hdc, rect->right - 2, by - 2); MoveTo (hdc, rect->right - 3, ty + 1 ); LineTo (hdc, rect->right - 3, ty + 1); - SetPenColor(hdc, DWORD2PIXEL (hdc, darker_c)); + SetPenColor(hdc, DWORD2Pixel (hdc, darker_c)); MoveTo (hdc, rect->right - 3, ty + 2 ); LineTo (hdc, rect->right - 3, by - 2); @@ -3278,7 +3278,7 @@ draw_tab (HWND hWnd, HDC hdc, RECT *rect, char *title, DWORD color, int flag, HI } /* draw the TEXT */ - SetBkColor (hdc, DWORD2PIXEL (hdc, color)); + SetBkColor (hdc, DWORD2Pixel (hdc, color)); text_extent -= 4; eff_len = GetTextExtentPoint (hdc, title, strlen(title), text_extent, &eff_chars, NULL, NULL, &size); diff --git a/src/gui/lf_fashion.c b/src/gui/lf_fashion.c index 036bb8e9..2f69696c 100644 --- a/src/gui/lf_fashion.c +++ b/src/gui/lf_fashion.c @@ -650,14 +650,14 @@ draw_arrow (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color, int status) pixel2[1] = (pixel & 0xFF000000) | ((pixel & 0x000000FF) << 16) | (pixel & 0x0000FF00) | ((pixel & 0x00FF0000) >> 16); #if 0 - pixel[0] = DWORD2PIXEL (hdc, gradient_color + pixel[0] = DWORD2Pixel (hdc, gradient_color (c2, LFRDR_3DBOX_COLOR_LIGHTER, 220)); - pixel[1] = DWORD2PIXEL (hdc, gradient_color + pixel[1] = DWORD2Pixel (hdc, gradient_color (c1, LFRDR_3DBOX_COLOR_LIGHTER, 100)); - pixel2[0] = DWORD2PIXEL (hdc, gradient_color + pixel2[0] = DWORD2Pixel (hdc, gradient_color (c1, LFRDR_3DBOX_COLOR_LIGHTER, 100)); - pixel2[1] = DWORD2PIXEL (hdc, gradient_color + pixel2[1] = DWORD2Pixel (hdc, gradient_color (c1, LFRDR_3DBOX_COLOR_LIGHTER, 200)); #endif break; @@ -676,14 +676,14 @@ draw_arrow (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color, int status) pixel2[1] = (pixel & 0xFF000000) | ((pixel & 0x000000FF) << 16) | (pixel & 0x0000FF00) | ((pixel & 0x00FF0000) >> 16); #if 0 - pixel[0] = DWORD2PIXEL (hdc, gradient_color + pixel[0] = DWORD2Pixel (hdc, gradient_color (c2, LFRDR_3DBOX_COLOR_LIGHTER, 200)); - pixel[1] = DWORD2PIXEL (hdc, gradient_color + pixel[1] = DWORD2Pixel (hdc, gradient_color (c1, LFRDR_3DBOX_COLOR_DARKER, 100)); - pixel2[0] = DWORD2PIXEL (hdc, gradient_color + pixel2[0] = DWORD2Pixel (hdc, gradient_color (c1, LFRDR_3DBOX_COLOR_DARKER, 100)); - pixel2[1] = DWORD2PIXEL (hdc, gradient_color + pixel2[1] = DWORD2Pixel (hdc, gradient_color (c1, LFRDR_3DBOX_COLOR_LIGHTER, 100)); #endif break; @@ -702,14 +702,14 @@ draw_arrow (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color, int status) pixel2[1] = (pixel & 0xFF000000) | ((pixel & 0x000000FF) << 16) | (pixel & 0x0000FF00) | ((pixel & 0x00FF0000) >> 16); #if 0 - pixel[0] = DWORD2PIXEL (hdc, gradient_color + pixel[0] = DWORD2Pixel (hdc, gradient_color (c2, LFRDR_3DBOX_COLOR_LIGHTER, 250)); - pixel[1] = DWORD2PIXEL (hdc, gradient_color + pixel[1] = DWORD2Pixel (hdc, gradient_color (c2, LFRDR_3DBOX_COLOR_LIGHTER, 10)); - pixel2[0] = DWORD2PIXEL (hdc, gradient_color + pixel2[0] = DWORD2Pixel (hdc, gradient_color (c2, LFRDR_3DBOX_COLOR_LIGHTER, 10)); - pixel2[1] = DWORD2PIXEL (hdc, gradient_color + pixel2[1] = DWORD2Pixel (hdc, gradient_color (c1, LFRDR_3DBOX_COLOR_LIGHTER, 150)); #endif break; @@ -907,7 +907,7 @@ static void draw_normal_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -932,8 +932,8 @@ static void draw_hilite_item (conver_pixel & 0x0000FF00) | ((conver_pixel & 0x00FF0000) >> 16); pixels[2] = pixels[0]; #if 0 - pixels[0] = DWORD2PIXEL (hdc, color); - pixels[1] = DWORD2PIXEL (hdc, gradient_color + pixels[0] = DWORD2Pixel (hdc, color); + pixels[1] = DWORD2Pixel (hdc, gradient_color (color, LFRDR_3DBOX_COLOR_LIGHTER, 120)); pixels[2] = pixels[0]; #endif @@ -981,7 +981,7 @@ static void draw_disabled_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -990,7 +990,7 @@ static void draw_significant_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -999,7 +999,7 @@ static void draw_normal_menu_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1028,10 +1028,10 @@ static void draw_hilite_menu_item pixels[2] = (conver_pixel & 0xFF000000) | ((conver_pixel & 0x000000FF) << 16) | (conver_pixel & 0x0000FF00) | ((conver_pixel & 0x00FF0000) >> 16); #if 0 - pixels[1] = DWORD2PIXEL (hdc, color); - pixels[0] = DWORD2PIXEL (hdc, gradient_color + pixels[1] = DWORD2Pixel (hdc, color); + pixels[0] = DWORD2Pixel (hdc, gradient_color (color, LFRDR_3DBOX_COLOR_LIGHTER, 240)); - pixels[2] = DWORD2PIXEL (hdc, gradient_color + pixels[2] = DWORD2Pixel (hdc, gradient_color (color, LFRDR_3DBOX_COLOR_LIGHTER, 100)); #endif ptn = mGPlusCreateLinearPattern (*pRect, @@ -1062,7 +1062,7 @@ static void draw_hilite_menu_item r = pRect->right; b = pRect->bottom; - pixels[0] = DWORD2PIXEL (hdc, gradient_color + pixels[0] = DWORD2Pixel (hdc, gradient_color (color, LFRDR_3DBOX_COLOR_DARKER, 140)); SetPenColor(hdc, pixels[0]); --r; @@ -1079,7 +1079,7 @@ static void draw_disabled_menu_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1140,13 +1140,13 @@ draw_push_button (HWND hWnd, HDC hdc, const RECT* pRect, downpixel[1] = (pixel & 0xFF000000) | ((pixel & 0x000000FF) << 16) | (pixel & 0x0000FF00) | ((pixel & 0x00FF0000) >> 16); #if 0 - uppixel[0] = DWORD2PIXEL (hdc, gradient_color (tmpcolor, + uppixel[0] = DWORD2Pixel (hdc, gradient_color (tmpcolor, LFRDR_3DBOX_COLOR_LIGHTER, 250)); - uppixel[1] = DWORD2PIXEL (hdc, gradient_color (tmpcolor, + uppixel[1] = DWORD2Pixel (hdc, gradient_color (tmpcolor, LFRDR_3DBOX_COLOR_LIGHTER, 70)); - downpixel[0] = DWORD2PIXEL (hdc, gradient_color (c1, + downpixel[0] = DWORD2Pixel (hdc, gradient_color (c1, LFRDR_3DBOX_COLOR_LIGHTER, 50)); - downpixel[1] = DWORD2PIXEL (hdc, gradient_color (c1, + downpixel[1] = DWORD2Pixel (hdc, gradient_color (c1, LFRDR_3DBOX_COLOR_LIGHTER, 150)); #endif } @@ -1159,8 +1159,8 @@ draw_push_button (HWND hWnd, HDC hdc, const RECT* pRect, uppixel[0] = uppixel[1]; downpixel[0] = downpixel[1] = uppixel[0]; #if 0 - uppixel[0] = uppixel[1] = DWORD2PIXEL (hdc, tmpcolor); - downpixel[0] = downpixel[1] = DWORD2PIXEL (hdc, tmpcolor); + uppixel[0] = uppixel[1] = DWORD2Pixel (hdc, tmpcolor); + downpixel[0] = downpixel[1] = DWORD2Pixel (hdc, tmpcolor); #endif } else { @@ -1183,13 +1183,13 @@ draw_push_button (HWND hWnd, HDC hdc, const RECT* pRect, downpixel[1] = (pixel & 0xFF000000) | ((pixel & 0x000000FF) << 16) | (pixel & 0x0000FF00) | ((pixel & 0x00FF0000) >> 16); #if 0 - uppixel[0] = DWORD2PIXEL (hdc, gradient_color (tmpcolor, + uppixel[0] = DWORD2Pixel (hdc, gradient_color (tmpcolor, LFRDR_3DBOX_COLOR_LIGHTER, 200)); - uppixel[1] = DWORD2PIXEL (hdc, gradient_color (tmpcolor, + uppixel[1] = DWORD2Pixel (hdc, gradient_color (tmpcolor, LFRDR_3DBOX_COLOR_LIGHTER, 70)); - downpixel[0] = DWORD2PIXEL (hdc, gradient_color (c1, + downpixel[0] = DWORD2Pixel (hdc, gradient_color (c1, LFRDR_3DBOX_COLOR_LIGHTER, 50)); - downpixel[1] = DWORD2PIXEL (hdc, gradient_color (c1, + downpixel[1] = DWORD2Pixel (hdc, gradient_color (c1, LFRDR_3DBOX_COLOR_LIGHTER, 150)); #endif } @@ -1208,13 +1208,13 @@ draw_push_button (HWND hWnd, HDC hdc, const RECT* pRect, downpixel[1] = (pixel & 0xFF000000) | ((pixel & 0x000000FF) << 16) | (pixel & 0x0000FF00) | ((pixel & 0x00FF0000) >> 16); #if 0 - uppixel[0] = DWORD2PIXEL (hdc, gradient_color (tmpcolor, + uppixel[0] = DWORD2Pixel (hdc, gradient_color (tmpcolor, LFRDR_3DBOX_COLOR_LIGHTER, 250)); - uppixel[1] = DWORD2PIXEL (hdc, gradient_color (tmpcolor, + uppixel[1] = DWORD2Pixel (hdc, gradient_color (tmpcolor, LFRDR_3DBOX_COLOR_LIGHTER, 70)); - downpixel[0] = DWORD2PIXEL (hdc, gradient_color (c1, + downpixel[0] = DWORD2Pixel (hdc, gradient_color (c1, LFRDR_3DBOX_COLOR_LIGHTER, 90)); - downpixel[1] = DWORD2PIXEL (hdc, gradient_color (c1, + downpixel[1] = DWORD2Pixel (hdc, gradient_color (c1, LFRDR_3DBOX_COLOR_LIGHTER, 180)); #endif } @@ -1225,8 +1225,8 @@ draw_push_button (HWND hWnd, HDC hdc, const RECT* pRect, uppixel[0] = uppixel[1]; downpixel[0] = downpixel[1] = uppixel[0]; #if 0 - uppixel[0] = uppixel[1] = DWORD2PIXEL (hdc, tmpcolor); - downpixel[0] = downpixel[1] = DWORD2PIXEL (hdc, tmpcolor); + uppixel[0] = uppixel[1] = DWORD2Pixel (hdc, tmpcolor); + downpixel[0] = downpixel[1] = DWORD2Pixel (hdc, tmpcolor); #endif } else @@ -1248,13 +1248,13 @@ draw_push_button (HWND hWnd, HDC hdc, const RECT* pRect, downpixel[1] = (pixel & 0xFF000000) | ((pixel & 0x000000FF) << 16) | (pixel & 0x0000FF00) | ((pixel & 0x00FF0000) >> 16); #if 0 - uppixel[0] = DWORD2PIXEL (hdc, gradient_color (tmpcolor, + uppixel[0] = DWORD2Pixel (hdc, gradient_color (tmpcolor, LFRDR_3DBOX_COLOR_LIGHTER, 250)); - uppixel[1] = DWORD2PIXEL (hdc, gradient_color (tmpcolor, + uppixel[1] = DWORD2Pixel (hdc, gradient_color (tmpcolor, LFRDR_3DBOX_COLOR_LIGHTER, 70)); - downpixel[0] = DWORD2PIXEL (hdc, gradient_color (c1, + downpixel[0] = DWORD2Pixel (hdc, gradient_color (c1, LFRDR_3DBOX_COLOR_LIGHTER, 50)); - downpixel[1] = DWORD2PIXEL (hdc, gradient_color (c1, + downpixel[1] = DWORD2Pixel (hdc, gradient_color (c1, LFRDR_3DBOX_COLOR_LIGHTER, 150)); #endif } @@ -1315,7 +1315,7 @@ draw_push_button (HWND hWnd, HDC hdc, const RECT* pRect, mGPlusFreeColorPattern (ptn); //draw border top - SetPenColor(hdc, DWORD2PIXEL(hdc, c1)); + SetPenColor(hdc, DWORD2Pixel(hdc, c1)); MoveTo(hdc, frRect.left + corner, frRect.top); LineTo(hdc, frRect.right - corner, frRect.top); LineTo(hdc, frRect.right, frRect.top+corner); @@ -1407,7 +1407,7 @@ _draw_radio_button (HWND hWnd, HDC hdc, box_r = box_l + bmp_w; box_b = box_t + bmp_h; - bgc = DWORD2PIXEL (hdc, GetWindowElementAttr (hWnd, WE_BGC_WINDOW)); + bgc = DWORD2Pixel (hdc, GetWindowElementAttr (hWnd, WE_BGC_WINDOW)); //bgc = PIXEL_red; /** left-top corner */ @@ -2355,21 +2355,21 @@ static void draw_border (HWND hWnd, HDC hdc, BOOL is_active) || win_info->dwStyle & WS_THICKFRAME) { /** left and top border */ - SetPenColor(hdc, DWORD2PIXEL (hdc, c1)); + SetPenColor(hdc, DWORD2Pixel (hdc, c1)); MoveTo(hdc, l, b); LineTo(hdc, l, t); LineTo(hdc, r - 1, t); for(i = 1; i < 4 && i < border + 3; i++) { c2 = gradient_color (c2, LFRDR_3DBOX_COLOR_LIGHTER, 30); - SetPenColor(hdc, DWORD2PIXEL (hdc, c2)); + SetPenColor(hdc, DWORD2Pixel (hdc, c2)); MoveTo(hdc, l+i, b-i); LineTo(hdc, l+i, t+i); LineTo(hdc, r+i - 1, t+i); } c2 = gradient_color (c2, LFRDR_3DBOX_COLOR_LIGHTER, 30); - SetPenColor(hdc, DWORD2PIXEL (hdc, c2)); + SetPenColor(hdc, DWORD2Pixel (hdc, c2)); for(;i < border+3; i++) { MoveTo(hdc, l+i, b-i); @@ -2382,14 +2382,14 @@ static void draw_border (HWND hWnd, HDC hdc, BOOL is_active) for(i = 0; i < 3 && i < border + 3; i++) { c2 = gradient_color (c2, LFRDR_3DBOX_COLOR_LIGHTER, 80); - SetPenColor(hdc, DWORD2PIXEL (hdc, c2)); + SetPenColor(hdc, DWORD2Pixel (hdc, c2)); MoveTo(hdc, l+i + 1, b-i); LineTo(hdc, r-i, b-i); LineTo(hdc, r-i, t+i); } c2 = gradient_color (c2, LFRDR_3DBOX_COLOR_LIGHTER, 80); - SetPenColor(hdc, DWORD2PIXEL (hdc, c2)); + SetPenColor(hdc, DWORD2Pixel (hdc, c2)); for(;i < border+3; i++) { MoveTo(hdc, l+i + 1, b-i); @@ -2399,7 +2399,7 @@ static void draw_border (HWND hWnd, HDC hdc, BOOL is_active) } else if(win_info->dwStyle & WS_THINFRAME) { - SetPenColor(hdc, DWORD2PIXEL (hdc, c1)); + SetPenColor(hdc, DWORD2Pixel (hdc, c1)); for(i = 0; i < border; i++) { Rectangle(hdc, rect.left+i, rect.top+i, @@ -2413,7 +2413,7 @@ static void draw_border (HWND hWnd, HDC hdc, BOOL is_active) || win_info->dwStyle & WS_THICKFRAME || win_info->dwStyle & WS_THINFRAME) { - SetPenColor(hdc, DWORD2PIXEL (hdc, c2)); + SetPenColor(hdc, DWORD2Pixel (hdc, c2)); Rectangle(hdc, rect.left, rect.top, rect.right-1, rect.bottom-1); } @@ -2485,8 +2485,8 @@ static void draw_caption (HWND hWnd, HDC hdc, BOOL is_active) pixels[0] = (pixel & 0xFF000000) | ((pixel & 0x000000FF) << 16) | (pixel & 0x0000FF00) | ((pixel & 0x00FF0000) >> 16); #if 0 - pixels[1] = DWORD2PIXEL (hdc, ca); - pixels[0] = DWORD2PIXEL (hdc, gradient_color + pixels[1] = DWORD2Pixel (hdc, ca); + pixels[0] = DWORD2Pixel (hdc, gradient_color (ca, LFRDR_3DBOX_COLOR_LIGHTER, 180)); #endif ptn = mGPlusCreateLinearPattern (rect, @@ -2522,9 +2522,9 @@ static void draw_caption (HWND hWnd, HDC hdc, BOOL is_active) } #if 0 - pixels[1] = DWORD2PIXEL (hdc, + pixels[1] = DWORD2Pixel (hdc, gradient_color (cb, LFRDR_3DBOX_COLOR_DARKER, 60)); - pixels[0] = DWORD2PIXEL (hdc, + pixels[0] = DWORD2Pixel (hdc, gradient_color (cb, LFRDR_3DBOX_COLOR_LIGHTER, 80)); #endif pixel = gradient_color (cb, LFRDR_3DBOX_COLOR_LIGHTER, 80); @@ -2558,9 +2558,9 @@ static void draw_caption (HWND hWnd, HDC hdc, BOOL is_active) /** draw the first dark line */ #if 0 - pixels[0] = DWORD2PIXEL (hdc, gradient_color + pixels[0] = DWORD2Pixel (hdc, gradient_color (cb, LFRDR_3DBOX_COLOR_LIGHTER, 40)); - pixels[1] = DWORD2PIXEL (hdc, gradient_color + pixels[1] = DWORD2Pixel (hdc, gradient_color (cb, LFRDR_3DBOX_COLOR_LIGHTER, 65)); #endif @@ -2576,7 +2576,7 @@ static void draw_caption (HWND hWnd, HDC hdc, BOOL is_active) rect_line.right = rect_line.left + rcTmp.left - 10 - (rect.bottom - rect.top) - 10; rect_line.bottom = rect_line.top + 1; - SetPenColor (hdc, DWORD2PIXEL (hdc, gradient_color (cb, LFRDR_3DBOX_COLOR_LIGHTER, 40))); + SetPenColor (hdc, DWORD2Pixel (hdc, gradient_color (cb, LFRDR_3DBOX_COLOR_LIGHTER, 40))); MoveTo (hdc, rect_line.left, rect_line.top); LineTo (hdc, rect_line.right - 10, rect_line.top); @@ -2606,9 +2606,9 @@ static void draw_caption (HWND hWnd, HDC hdc, BOOL is_active) rect_line.bottom = rect_line.top + 1; rect_line.right = rect_line.left + rcTmp.left - 10 - 20; #if 0 - pixels[0] = DWORD2PIXEL (hdc, gradient_color + pixels[0] = DWORD2Pixel (hdc, gradient_color (cb, LFRDR_3DBOX_COLOR_DARKER, 100)); - pixels[1] = DWORD2PIXEL (hdc, gradient_color + pixels[1] = DWORD2Pixel (hdc, gradient_color (cb, LFRDR_3DBOX_COLOR_DARKER, 50)); #endif @@ -2619,7 +2619,7 @@ static void draw_caption (HWND hWnd, HDC hdc, BOOL is_active) pixels[1] = (pixel & 0xFF000000) | ((pixel & 0x000000FF) << 16) | (pixel & 0x0000FF00) | ((pixel & 0x00FF0000) >> 16); - SetPenColor (hdc, DWORD2PIXEL (hdc, gradient_color (cb, LFRDR_3DBOX_COLOR_DARKER, 100))); + SetPenColor (hdc, DWORD2Pixel (hdc, gradient_color (cb, LFRDR_3DBOX_COLOR_DARKER, 100))); MoveTo (hdc, rect_line.left, rect_line.top); LineTo (hdc, rect_line.right - 10, rect_line.top); @@ -2643,9 +2643,9 @@ static void draw_caption (HWND hWnd, HDC hdc, BOOL is_active) /** draw the third light line */ #if 0 - pixels[0] = DWORD2PIXEL (hdc, gradient_color + pixels[0] = DWORD2Pixel (hdc, gradient_color (cb, LFRDR_3DBOX_COLOR_LIGHTER, 100)); - pixels[1] = DWORD2PIXEL (hdc, gradient_color + pixels[1] = DWORD2Pixel (hdc, gradient_color (cb, LFRDR_3DBOX_COLOR_LIGHTER, 70)); #endif @@ -2662,7 +2662,7 @@ static void draw_caption (HWND hWnd, HDC hdc, BOOL is_active) rect_line.right = rect_line.left + rcTmp.left - 10 - (rect.bottom - rect.top) - 10; rect_line.bottom = rect_line.top + 1; - SetPenColor (hdc, DWORD2PIXEL (hdc, gradient_color (cb, LFRDR_3DBOX_COLOR_LIGHTER, 100))); + SetPenColor (hdc, DWORD2Pixel (hdc, gradient_color (cb, LFRDR_3DBOX_COLOR_LIGHTER, 100))); MoveTo (hdc, rect_line.left, rect_line.top); LineTo (hdc, rect_line.right - 10, rect_line.top); @@ -2693,9 +2693,9 @@ static void draw_caption (HWND hWnd, HDC hdc, BOOL is_active) rect_line.right = rect_line.left + rcTmp.left - 10 - 20; /** FIXE ME */ #if 0 - pixels[0] = DWORD2PIXEL (hdc, gradient_color + pixels[0] = DWORD2Pixel (hdc, gradient_color (cb, LFRDR_3DBOX_COLOR_LIGHTER, 40)); - pixels[1] = DWORD2PIXEL (hdc, gradient_color + pixels[1] = DWORD2Pixel (hdc, gradient_color (cb, LFRDR_3DBOX_COLOR_DARKER, 55)); #else pixel = gradient_color (cb, LFRDR_3DBOX_COLOR_LIGHTER, 40); @@ -2704,16 +2704,16 @@ static void draw_caption (HWND hWnd, HDC hdc, BOOL is_active) pixel = gradient_color (cb, LFRDR_3DBOX_COLOR_DARKER, 55); pixels[1] = (pixel & 0xFF000000) | ((pixel & 0x000000FF) << 16) | (pixel & 0x0000FF00) | ((pixel & 0x00FF0000) >> 16); -// pixel = DWORD2PIXEL (hdc, gradient_color +// pixel = DWORD2Pixel (hdc, gradient_color // (cb, LFRDR_3DBOX_COLOR_LIGHTER, 40)); #endif - SetPenColor (hdc, DWORD2PIXEL (hdc, gradient_color (cb, LFRDR_3DBOX_COLOR_LIGHTER, 40))); + SetPenColor (hdc, DWORD2Pixel (hdc, gradient_color (cb, LFRDR_3DBOX_COLOR_LIGHTER, 40))); MoveTo (hdc, rect_line.left, rect_line.top); LineTo (hdc, rect_line.right - 10, rect_line.top); rect_line.left = rect_line.right - 10; - //pixels[1] = DWORD2PIXEL (hdc, cb); + //pixels[1] = DWORD2Pixel (hdc, cb); ptn = mGPlusCreateLinearPattern (rect_line, MGPLUS_GRADIENT_LINEAR_HORIZONTAL, pixels, 2, MGPLUS_GRADIENT_BIT_16); @@ -2915,7 +2915,7 @@ draw_caption_button (HWND hWnd, HDC hdc, int ht_code, int status) return; if(status & LFRDR_BTN_STATUS_PRESSED){ #if 0 - pixels[1] = DWORD2PIXEL (hdc, gradient_color + pixels[1] = DWORD2Pixel (hdc, gradient_color (cap_c, LFRDR_3DBOX_COLOR_LIGHTER, 50)); #endif pixel = gradient_color (cap_c, LFRDR_3DBOX_COLOR_LIGHTER, 50); @@ -2924,7 +2924,7 @@ draw_caption_button (HWND hWnd, HDC hdc, int ht_code, int status) } else if(status & LFRDR_BTN_STATUS_HILITE){ #if 0 - pixels[1] = DWORD2PIXEL (hdc, gradient_color + pixels[1] = DWORD2Pixel (hdc, gradient_color (cap_c, LFRDR_3DBOX_COLOR_LIGHTER, 80)); #endif pixel = gradient_color (cap_c, LFRDR_3DBOX_COLOR_LIGHTER, 80); @@ -2933,7 +2933,7 @@ draw_caption_button (HWND hWnd, HDC hdc, int ht_code, int status) } else { #if 0 - pixels[1] = DWORD2PIXEL (hdc, gradient_color + pixels[1] = DWORD2Pixel (hdc, gradient_color (cap_c, LFRDR_3DBOX_COLOR_LIGHTER, 10)); #endif pixel = gradient_color (cap_c, LFRDR_3DBOX_COLOR_LIGHTER, 10); @@ -2941,7 +2941,7 @@ draw_caption_button (HWND hWnd, HDC hdc, int ht_code, int status) (pixel & 0x0000FF00) | ((pixel & 0x00FF0000) >> 16); } #if 0 - pixels[0] = DWORD2PIXEL (hdc, gradient_color + pixels[0] = DWORD2Pixel (hdc, gradient_color (cap_c, LFRDR_3DBOX_COLOR_LIGHTER, 250)); #endif @@ -3022,7 +3022,7 @@ draw_caption_button (HWND hWnd, HDC hdc, int ht_code, int status) return; if(status & LFRDR_BTN_STATUS_PRESSED){ #if 0 - pixels[1] = DWORD2PIXEL (hdc, gradient_color + pixels[1] = DWORD2Pixel (hdc, gradient_color //(cap_c, LFRDR_3DBOX_COLOR_DARKER, 90)); (cap_c, LFRDR_3DBOX_COLOR_LIGHTER, 50)); #else @@ -3033,7 +3033,7 @@ draw_caption_button (HWND hWnd, HDC hdc, int ht_code, int status) } else if(status & LFRDR_BTN_STATUS_HILITE){ #if 0 - pixels[1] = DWORD2PIXEL (hdc, gradient_color + pixels[1] = DWORD2Pixel (hdc, gradient_color //(cap_c, LFRDR_3DBOX_COLOR_LIGHTER, 30)); (cap_c, LFRDR_3DBOX_COLOR_LIGHTER, 80)); #else @@ -3044,7 +3044,7 @@ draw_caption_button (HWND hWnd, HDC hdc, int ht_code, int status) } else { #if 0 - pixels[1] = DWORD2PIXEL (hdc, gradient_color + pixels[1] = DWORD2Pixel (hdc, gradient_color //(cap_c, LFRDR_3DBOX_COLOR_DARKER, 30)); (cap_c, LFRDR_3DBOX_COLOR_LIGHTER, 10)); #else @@ -3055,7 +3055,7 @@ draw_caption_button (HWND hWnd, HDC hdc, int ht_code, int status) } #if 0 - pixels[0] = DWORD2PIXEL (hdc, gradient_color + pixels[0] = DWORD2Pixel (hdc, gradient_color (cap_c, LFRDR_3DBOX_COLOR_LIGHTER, 250)); #else @@ -3131,7 +3131,7 @@ draw_caption_button (HWND hWnd, HDC hdc, int ht_code, int status) if(status & LFRDR_BTN_STATUS_PRESSED){ #if 0 - pixels[1] = DWORD2PIXEL (hdc, gradient_color + pixels[1] = DWORD2Pixel (hdc, gradient_color (cap_c, LFRDR_3DBOX_COLOR_LIGHTER, 50)); #else pixel = gradient_color (cap_c, LFRDR_3DBOX_COLOR_LIGHTER, 50); @@ -3141,7 +3141,7 @@ draw_caption_button (HWND hWnd, HDC hdc, int ht_code, int status) } else if(status & LFRDR_BTN_STATUS_HILITE){ #if 0 - pixels[1] = DWORD2PIXEL (hdc, gradient_color + pixels[1] = DWORD2Pixel (hdc, gradient_color (cap_c, LFRDR_3DBOX_COLOR_LIGHTER, 80)); #else pixel = gradient_color (cap_c, LFRDR_3DBOX_COLOR_LIGHTER, 80); @@ -3151,7 +3151,7 @@ draw_caption_button (HWND hWnd, HDC hdc, int ht_code, int status) } else { #if 0 - pixels[1] = DWORD2PIXEL (hdc, gradient_color + pixels[1] = DWORD2Pixel (hdc, gradient_color (cap_c, LFRDR_3DBOX_COLOR_LIGHTER, 10)); #else pixel = gradient_color (cap_c, LFRDR_3DBOX_COLOR_LIGHTER, 10); @@ -3160,7 +3160,7 @@ draw_caption_button (HWND hWnd, HDC hdc, int ht_code, int status) #endif } #if 0 - pixels[0] = DWORD2PIXEL (hdc, gradient_color + pixels[0] = DWORD2Pixel (hdc, gradient_color (cap_c, LFRDR_3DBOX_COLOR_LIGHTER, 250)); #else pixel = gradient_color (cap_c, LFRDR_3DBOX_COLOR_LIGHTER, 250); @@ -3391,14 +3391,14 @@ static void draw_scrollbar (HWND hWnd, HDC hdc, int sb_pos) { if (!isCtrl || !(info->dwStyle & SBS_NOSHAFT)) { - SetPenColor(hdc, DWORD2PIXEL (hdc, gradient_color (fgc_dis, + SetPenColor(hdc, DWORD2Pixel (hdc, gradient_color (fgc_dis, LFRDR_3DBOX_COLOR_DARKER, 10))); Rectangle(hdc, rect.left, rect.top, rect.right-1, rect.bottom-1); #if 0 - pixel[0] = DWORD2PIXEL (hdc, gradient_color (bgc, + pixel[0] = DWORD2Pixel (hdc, gradient_color (bgc, LFRDR_3DBOX_COLOR_LIGHTER, 20)); - pixel[1] = DWORD2PIXEL (hdc, gradient_color (bgc, + pixel[1] = DWORD2Pixel (hdc, gradient_color (bgc, LFRDR_3DBOX_COLOR_LIGHTER, 220)); #endif conver_pixel = gradient_color (bgc, LFRDR_3DBOX_COLOR_LIGHTER, 20); @@ -3434,7 +3434,7 @@ static void draw_scrollbar (HWND hWnd, HDC hdc, int sb_pos) { if (!isCtrl || !(info->dwStyle & SBS_NOSHAFT)) { - SetPenColor(hdc, DWORD2PIXEL (hdc, gradient_color (fgc_dis, + SetPenColor(hdc, DWORD2Pixel (hdc, gradient_color (fgc_dis, LFRDR_3DBOX_COLOR_DARKER, 10))); Rectangle(hdc, rect.left, rect.top, rect.right-1, rect.bottom-1); conver_pixel = gradient_color (bgc, LFRDR_3DBOX_COLOR_LIGHTER, 20); @@ -3444,9 +3444,9 @@ static void draw_scrollbar (HWND hWnd, HDC hdc, int sb_pos) pixel[1] = (conver_pixel & 0xFF000000) | ((conver_pixel & 0x000000FF) << 16) | (conver_pixel & 0x0000FF00) | ((conver_pixel & 0x00FF0000) >> 16); #if 0 - pixel[1] = DWORD2PIXEL (hdc, gradient_color (bgc, + pixel[1] = DWORD2Pixel (hdc, gradient_color (bgc, LFRDR_3DBOX_COLOR_LIGHTER, 20)); - pixel[0] = DWORD2PIXEL (hdc, gradient_color (bgc, + pixel[0] = DWORD2Pixel (hdc, gradient_color (bgc, LFRDR_3DBOX_COLOR_LIGHTER, 200)); #endif rect.top++; rect.left++; @@ -3516,7 +3516,7 @@ static void draw_scrollbar (HWND hWnd, HDC hdc, int sb_pos) case HT_SB_HTHUMB: { //draw left and right sides - SetPenColor (hdc, DWORD2PIXEL (hdc, gradient_color (fgc_dis, + SetPenColor (hdc, DWORD2Pixel (hdc, gradient_color (fgc_dis, LFRDR_3DBOX_COLOR_DARKER, 10))); MoveTo (hdc, rect.left, rect.top+1); LineTo (hdc, rect.left, rect.bottom-2); @@ -3537,14 +3537,14 @@ static void draw_scrollbar (HWND hWnd, HDC hdc, int sb_pos) pixel2[1] = (conver_pixel & 0xFF000000) | ((conver_pixel & 0x000000FF) << 16) | (conver_pixel & 0x0000FF00) | ((conver_pixel & 0x00FF0000) >> 16); #if 0 - pixel[0] = DWORD2PIXEL (hdc, gradient_color + pixel[0] = DWORD2Pixel (hdc, gradient_color (fgc_3d, LFRDR_3DBOX_COLOR_LIGHTER, 250)); - pixel[1] = DWORD2PIXEL (hdc, gradient_color + pixel[1] = DWORD2Pixel (hdc, gradient_color (fgc_dis, LFRDR_3DBOX_COLOR_LIGHTER, 70)); - pixel2[0] = DWORD2PIXEL (hdc, gradient_color + pixel2[0] = DWORD2Pixel (hdc, gradient_color (fgc_dis, LFRDR_3DBOX_COLOR_LIGHTER, 70)); - pixel2[1] = DWORD2PIXEL (hdc, gradient_color + pixel2[1] = DWORD2Pixel (hdc, gradient_color (fgc_dis, LFRDR_3DBOX_COLOR_LIGHTER, 100)); #endif rect1.top = rect.top + 1; @@ -3630,7 +3630,7 @@ static void draw_scrollbar (HWND hWnd, HDC hdc, int sb_pos) case HT_SB_VTHUMB: { //draw top and bottom sides - SetPenColor(hdc, DWORD2PIXEL (hdc, gradient_color + SetPenColor(hdc, DWORD2Pixel (hdc, gradient_color (fgc_3d, LFRDR_3DBOX_COLOR_DARKER, 10))); MoveTo (hdc, rect.left+1, rect.top); LineTo (hdc, rect.right-2, rect.top); @@ -3651,16 +3651,16 @@ static void draw_scrollbar (HWND hWnd, HDC hdc, int sb_pos) pixel2[1] = (conver_pixel & 0xFF000000) | ((conver_pixel & 0x000000FF) << 16) | (conver_pixel & 0x0000FF00) | ((conver_pixel & 0x00FF0000) >> 16); #if 0 - pixel[0] = DWORD2PIXEL (hdc, gradient_color + pixel[0] = DWORD2Pixel (hdc, gradient_color (fgc_3d, LFRDR_3DBOX_COLOR_LIGHTER, 250)); - pixel[1] = DWORD2PIXEL (hdc, gradient_color + pixel[1] = DWORD2Pixel (hdc, gradient_color (fgc_dis, LFRDR_3DBOX_COLOR_LIGHTER, 70)); //(fgc_dis, LFRDR_3DBOX_COLOR_DARKER, 20)); - pixel2[0] = DWORD2PIXEL (hdc, gradient_color + pixel2[0] = DWORD2Pixel (hdc, gradient_color (fgc_dis, LFRDR_3DBOX_COLOR_LIGHTER, 70)); //(fgc_dis, LFRDR_3DBOX_COLOR_DARKER, 20)); - pixel2[1] = DWORD2PIXEL (hdc, gradient_color + pixel2[1] = DWORD2Pixel (hdc, gradient_color (fgc_dis, LFRDR_3DBOX_COLOR_LIGHTER, 100)); #endif rect1.top = rect.top + 1; @@ -3740,7 +3740,7 @@ static void draw_trackbar_thumb (HWND hWnd, HDC hdc, } bgc = GetWindowElementAttr (hWnd, WE_MAINC_THREED_BODY); - //pixels[0] = DWORD2PIXEL (hdc, bgc); + //pixels[0] = DWORD2Pixel (hdc, bgc); conver_pixel = bgc; pixels[0] = (conver_pixel & 0xFF000000) | ((conver_pixel & 0x000000FF) << 16) | (conver_pixel & 0x0000FF00) | ((conver_pixel & 0x00FF0000) >> 16); @@ -3751,7 +3751,7 @@ static void draw_trackbar_thumb (HWND hWnd, HDC hdc, (conver_pixel & 0x0000FF00) | ((conver_pixel & 0x00FF0000) >> 16); pixels[2] = pixels[0]; #if 0 - pixels[1] = DWORD2PIXEL (hdc, gradient_color + pixels[1] = DWORD2Pixel (hdc, gradient_color (bgc, LFRDR_3DBOX_COLOR_LIGHTER, 20)); pixels[2] = pixels[0]; #endif @@ -3938,9 +3938,9 @@ draw_trackbar (HWND hWnd, HDC hdc, LFRDR_TRACKBARINFO *info) gal_pixel pixel_dst; gal_pixel pixel_org; #if 0 - pixels[0] = DWORD2PIXEL (hdc, gradient_color + pixels[0] = DWORD2Pixel (hdc, gradient_color (bgc, LFRDR_3DBOX_COLOR_DARKER, 60)); - pixels[1] = DWORD2PIXEL (hdc, gradient_color + pixels[1] = DWORD2Pixel (hdc, gradient_color (bgc, LFRDR_3DBOX_COLOR_LIGHTER, 90)); #endif @@ -4005,9 +4005,9 @@ draw_trackbar (HWND hWnd, HDC hdc, LFRDR_TRACKBARINFO *info) --rect.right; --rect.bottom; #if 0 - pixels[0] = DWORD2PIXEL (hdc, gradient_color + pixels[0] = DWORD2Pixel (hdc, gradient_color (bgc, LFRDR_3DBOX_COLOR_DARKER, 40)); - pixels[1] = DWORD2PIXEL (hdc, gradient_color + pixels[1] = DWORD2Pixel (hdc, gradient_color (bgc, LFRDR_3DBOX_COLOR_LIGHTER, 100)); #endif @@ -4185,8 +4185,8 @@ draw_tab (HWND hWnd, HDC hdc, RECT *rect, char *title, DWORD color, int flag, HI POINT point; gal_pixel pixel_dst; gal_pixel pixel_org; - pixels[1] = DWORD2PIXEL (hdc, color); - pixels[0] = DWORD2PIXEL (hdc, gradient_color + pixels[1] = DWORD2Pixel (hdc, color); + pixels[0] = DWORD2Pixel (hdc, gradient_color (color, LFRDR_3DBOX_COLOR_LIGHTER, 200)); ptn = mGPlusCreateLinearPattern (*rect, MGPLUS_GRADIENT_LINEAR_VERTICAL, @@ -4236,11 +4236,11 @@ draw_tab (HWND hWnd, HDC hdc, RECT *rect, char *title, DWORD color, int flag, HI /* pc3d style & flat & grap */ if (flag & LFRDR_TAB_BOTTOM) { /* left and bottom */ - SetPenColor(hdc, DWORD2PIXEL (hdc, light_c)); + SetPenColor(hdc, DWORD2Pixel (hdc, light_c)); MoveTo (hdc, rect->left, ty); LineTo (hdc, rect->left, by - 3 ); if (flag & LFRDR_TAB_ACTIVE) { - SetPenColor(hdc, DWORD2PIXEL (hdc, c1)); + SetPenColor(hdc, DWORD2Pixel (hdc, c1)); MoveTo (hdc, rect->left + 2, by - 1); LineTo (hdc, rect->right - 4, by - 1); MoveTo (hdc, rect->left + 1, by - 2); @@ -4248,28 +4248,28 @@ draw_tab (HWND hWnd, HDC hdc, RECT *rect, char *title, DWORD color, int flag, HI MoveTo (hdc, rect->left , by - 3); LineTo (hdc, rect->right - 2, by - 3); } else { - SetPenColor(hdc, DWORD2PIXEL (hdc, darker_c)); + SetPenColor(hdc, DWORD2Pixel (hdc, darker_c)); MoveTo (hdc, rect->left + 2, by - 1); LineTo (hdc, rect->right - 4, by - 1); MoveTo (hdc, rect->left + 1, by - 2); LineTo (hdc, rect->left + 1, by - 2); } /*right*/ - SetPenColor(hdc, DWORD2PIXEL (hdc, darkest_c)); + SetPenColor(hdc, DWORD2Pixel (hdc, darkest_c)); MoveTo (hdc, rect->right - 2, by - 3); LineTo (hdc, rect->right - 2, ty); MoveTo (hdc, rect->right - 3, by - 2 ); LineTo (hdc, rect->right - 3, by - 2); - SetPenColor(hdc, DWORD2PIXEL (hdc, darker_c)); + SetPenColor(hdc, DWORD2Pixel (hdc, darker_c)); MoveTo (hdc, rect->right - 3, by -3); LineTo (hdc, rect->right - 3, ty); } else { /*left and top */ - SetPenColor(hdc, DWORD2PIXEL (hdc, light_c)); + SetPenColor(hdc, DWORD2Pixel (hdc, light_c)); MoveTo (hdc, rect->left, by - 1); LineTo (hdc, rect->left, ty + 2); if (flag & LFRDR_TAB_ACTIVE) { - SetPenColor(hdc, DWORD2PIXEL (hdc, c1)); + SetPenColor(hdc, DWORD2Pixel (hdc, c1)); MoveTo (hdc, rect->left , ty+2); LineTo (hdc, rect->right - 2, ty+2); MoveTo (hdc, rect->left + 1, ty+1); @@ -4283,12 +4283,12 @@ draw_tab (HWND hWnd, HDC hdc, RECT *rect, char *title, DWORD color, int flag, HI LineTo (hdc, rect->left + 1, ty + 1); } /*right*/ - SetPenColor(hdc, DWORD2PIXEL (hdc, darkest_c)); + SetPenColor(hdc, DWORD2Pixel (hdc, darkest_c)); MoveTo (hdc, rect->right - 2, ty + 2 ); LineTo (hdc, rect->right - 2, by - 2); MoveTo (hdc, rect->right - 3, ty + 1 ); LineTo (hdc, rect->right - 3, ty + 1); - SetPenColor(hdc, DWORD2PIXEL (hdc, darker_c)); + SetPenColor(hdc, DWORD2Pixel (hdc, darker_c)); MoveTo (hdc, rect->right - 3, ty + 2 ); LineTo (hdc, rect->right - 3, by - 2); } @@ -4308,7 +4308,7 @@ draw_tab (HWND hWnd, HDC hdc, RECT *rect, char *title, DWORD color, int flag, HI } /* draw the TEXT */ - SetBkColor (hdc, DWORD2PIXEL (hdc, color)); + SetBkColor (hdc, DWORD2Pixel (hdc, color)); text_extent -= 4; eff_len = GetTextExtentPoint (hdc, title, strlen(title), text_extent, &eff_chars, NULL, NULL, &size); @@ -4348,8 +4348,8 @@ draw_progress (HWND hWnd, HDC hdc, c2 = GetWindowElementAttr (hWnd, WE_BGCB_ACTIVE_CAPTION); #if 0 - bkpixel[0] = DWORD2PIXEL (hdc, c1); - bkpixel[1] = DWORD2PIXEL (hdc, gradient_color (bkpixel[0], + bkpixel[0] = DWORD2Pixel (hdc, c1); + bkpixel[1] = DWORD2Pixel (hdc, gradient_color (bkpixel[0], LFRDR_3DBOX_COLOR_LIGHTER, 120)); #endif @@ -4391,9 +4391,9 @@ draw_progress (HWND hWnd, HDC hdc, nNowPart = ndiv_progress.quot; #if 0 - pixel[1] = DWORD2PIXEL (hdc, gradient_color (c2, LFRDR_3DBOX_COLOR_LIGHTER, + pixel[1] = DWORD2Pixel (hdc, gradient_color (c2, LFRDR_3DBOX_COLOR_LIGHTER, 50)); - pixel[0] = DWORD2PIXEL (hdc, gradient_color (gradient_color + pixel[0] = DWORD2Pixel (hdc, gradient_color (gradient_color (c2, LFRDR_3DBOX_COLOR_LIGHTER, 80), LFRDR_3DBOX_COLOR_LIGHTER, 250)); #endif @@ -4475,9 +4475,9 @@ static void draw_header (HWND hWnd, HDC hdc, const RECT *pRect, DWORD color) pixels[0] = (conver_pixel & 0xFF000000) | ((conver_pixel & 0x000000FF) << 16) | (conver_pixel & 0x0000FF00) | ((conver_pixel & 0x00FF0000) >> 16); #if 0 - pixels[1] = DWORD2PIXEL (hdc, gradient_color + pixels[1] = DWORD2Pixel (hdc, gradient_color (color, LFRDR_3DBOX_COLOR_DARKER, 60)); - pixels[0] = DWORD2PIXEL (hdc, gradient_color + pixels[0] = DWORD2Pixel (hdc, gradient_color (color, LFRDR_3DBOX_COLOR_LIGHTER, 120)); #endif ptn = mGPlusCreateLinearPattern (*pRect, diff --git a/src/gui/lf_flat.c b/src/gui/lf_flat.c index 1ba18e05..dc3f0664 100644 --- a/src/gui/lf_flat.c +++ b/src/gui/lf_flat.c @@ -540,7 +540,7 @@ static void draw_3dbox (HDC hdc, const RECT* pRect, DWORD color, DWORD flag) pRect->right - 1, pRect->bottom - 1); if (flag & LFRDR_3DBOX_FILLED) { - SetBrushColor(hdc, DWORD2PIXEL (hdc, color)); + SetBrushColor(hdc, DWORD2Pixel (hdc, color)); FillBox(hdc, pRect->left + 1, pRect->top + 1, RECTWP(pRect) - 2, @@ -567,7 +567,7 @@ static void draw_radio (HDC hdc, const RECT* pRect, DWORD color, int status) if (w < 6 || h < 6) return; - color_pixel = DWORD2PIXEL (hdc, color); + color_pixel = DWORD2Pixel (hdc, color); radius = w>h ? (h>>1)-1 : (w>>1)-1; center_x = pRect->left + (w>>1); @@ -1101,7 +1101,7 @@ static void draw_normal_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1110,7 +1110,7 @@ static void draw_hilite_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1119,7 +1119,7 @@ static void draw_disabled_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1128,7 +1128,7 @@ static void draw_significant_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1137,7 +1137,7 @@ static void draw_normal_menu_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1146,7 +1146,7 @@ static void draw_hilite_menu_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1155,7 +1155,7 @@ static void draw_disabled_menu_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -3164,7 +3164,7 @@ draw_tab (HWND hWnd, HDC hdc, RECT *rect, char *title, DWORD color, int flag, HI //fill background if (!(flag & LFRDR_TAB_ACTIVE)) { bkColor = GetWindowElementAttr(hWnd, WE_LFFLAT_TAB_NRMLCLR); - oldColor = SetBrushColor(hdc, DWORD2PIXEL(hdc, bkColor)); + oldColor = SetBrushColor(hdc, DWORD2Pixel(hdc, bkColor)); } else { //for active @@ -3243,7 +3243,7 @@ draw_tab (HWND hWnd, HDC hdc, RECT *rect, char *title, DWORD color, int flag, HI if (title) { /* draw the TEXT */ - SetBkColor (hdc, DWORD2PIXEL (hdc, color)); + SetBkColor (hdc, DWORD2Pixel (hdc, color)); SetBkMode (hdc, BM_TRANSPARENT); SetRect(&rc, x+offset, ty, rect->right - offset, by); DrawText(hdc, title, -1, &rc, DT_SINGLELINE | DT_VCENTER); diff --git a/src/gui/lf_manager.c b/src/gui/lf_manager.c index 30ab0745..abb19e1b 100644 --- a/src/gui/lf_manager.c +++ b/src/gui/lf_manager.c @@ -600,7 +600,7 @@ void dump_window_element_data (HWND hwnd) break; case WE_ATTR_TYPE_COLOR: - _MG_PRINTF ("\tcolor in list: %x.\n", wed->data); + _MG_PRINTF ("\tcolor in list: %lx.\n", wed->data); } } _MG_PRINTF ("GUI>DumpWED: Done\n"); @@ -636,7 +636,7 @@ DWORD GUIAPI SetWindowElementAttr (HWND hwnd, int we_attr_id, DWORD we_attr) case WE_ATTR_TYPE_COLOR: { int color_index = (we_attr_id & WE_ATTR_TYPE_COLOR_MASK) >> 8; - old_data = __mg_def_renderer->we_colors[index][color_index]; + old_data = (DWORD)__mg_def_renderer->we_colors[index][color_index]; __mg_def_renderer->we_colors[index][color_index] = we_attr; return old_data; } @@ -644,8 +644,8 @@ DWORD GUIAPI SetWindowElementAttr (HWND hwnd, int we_attr_id, DWORD we_attr) case WE_ATTR_TYPE_ICON: { int icon_idx = (we_attr_id & WE_ATTR_TYPE_ICON_MASK) >> 8; - old_data = __mg_def_renderer->we_icon [icon_idx][index]; - __mg_def_renderer->we_icon [icon_idx][index] = we_attr; + old_data = (DWORD)__mg_def_renderer->we_icon [icon_idx][index]; + __mg_def_renderer->we_icon [icon_idx][index] = (HICON)we_attr; return old_data; } @@ -711,7 +711,7 @@ GetWindowElementPixelEx (HWND hwnd, HDC hdc, int we_attr_id) b = GetBValue (data); a = GetAValue (data); - if (hdc == -1) { + if (hdc == HDC_INVALID) { if (hwnd == HWND_NULL || hwnd == HWND_DESKTOP) pixel = RGBA2Pixel (HDC_SCREEN, r, g, b, a); else { diff --git a/src/gui/lf_skin.c b/src/gui/lf_skin.c index 6bab07a1..e2dce9c7 100644 --- a/src/gui/lf_skin.c +++ b/src/gui/lf_skin.c @@ -1164,7 +1164,7 @@ draw_focus_frame (HDC hdc, const RECT *pRect, DWORD color) (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1173,7 +1173,7 @@ draw_focus_frame (HDC hdc, const RECT *pRect, DWORD color) (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1182,7 +1182,7 @@ draw_focus_frame (HDC hdc, const RECT *pRect, DWORD color) (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1191,7 +1191,7 @@ draw_focus_frame (HDC hdc, const RECT *pRect, DWORD color) (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1200,7 +1200,7 @@ draw_focus_frame (HDC hdc, const RECT *pRect, DWORD color) (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1209,7 +1209,7 @@ draw_focus_frame (HDC hdc, const RECT *pRect, DWORD color) (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1218,7 +1218,7 @@ draw_focus_frame (HDC hdc, const RECT *pRect, DWORD color) (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -3233,7 +3233,7 @@ draw_tab (HWND hWnd, HDC hdc, RECT *pRect, char *title, DWORD color, int flag, H } /* draw the TEXT */ - //SetBkColor (hdc, DWORD2PIXEL (hdc, color)); + //SetBkColor (hdc, DWORD2Pixel (hdc, color)); SetBkMode (hdc, BM_TRANSPARENT); text_extent -= 4; eff_len = GetTextExtentPoint (hdc, title, strlen(title), diff --git a/src/gui/lf_tiny.c b/src/gui/lf_tiny.c index bdb7fe65..d329d0e7 100644 --- a/src/gui/lf_tiny.c +++ b/src/gui/lf_tiny.c @@ -460,7 +460,7 @@ static void draw_3dbox (HDC hdc, const RECT* pRect, DWORD color, DWORD flag) pRect->right - 1, pRect->bottom - 1); if (flag & LFRDR_3DBOX_FILLED) { - SetBrushColor(hdc, DWORD2PIXEL (hdc, color)); + SetBrushColor(hdc, DWORD2Pixel (hdc, color)); FillBox(hdc, pRect->left + 1, pRect->top + 1, RECTW((*pRect)) - 2, @@ -487,7 +487,7 @@ static void draw_radio (HDC hdc, const RECT* pRect, DWORD color, int status) if (w < 6 || h < 6) return; - color_pixel = DWORD2PIXEL (hdc, color); + color_pixel = DWORD2Pixel (hdc, color); radius = w>h ? (h>>1)-1 : (w>>1)-1; center_x = pRect->left + (w>>1); @@ -1007,7 +1007,7 @@ static void draw_normal_item if (bg_bmp == NULL) { - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); return; @@ -1033,7 +1033,7 @@ static void draw_hilite_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1042,7 +1042,7 @@ static void draw_disabled_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1051,7 +1051,7 @@ static void draw_significant_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1060,7 +1060,7 @@ static void draw_normal_menu_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1069,7 +1069,7 @@ static void draw_hilite_menu_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -1078,7 +1078,7 @@ static void draw_disabled_menu_item (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color) { gal_pixel old_bc; - old_bc = SetBrushColor (hdc, DWORD2PIXEL (hdc, color)); + old_bc = SetBrushColor (hdc, DWORD2Pixel (hdc, color)); FillBox (hdc, pRect->left, pRect->top, RECTWP (pRect), RECTHP (pRect)); SetBrushColor (hdc, old_bc); } @@ -3800,7 +3800,7 @@ draw_tab (HWND hWnd, HDC hdc, RECT *rect, char *title, DWORD color, int flag, HI /* draw the title's edge */ /* pc3d style & tiny & grap */ - SetPenColor(hdc, DWORD2PIXEL (hdc, light_c)); + SetPenColor(hdc, DWORD2Pixel (hdc, light_c)); if (flag & LFRDR_TAB_BOTTOM) { MoveTo (hdc, rect->left, ty); LineTo (hdc, rect->left, by - 3 ); @@ -3819,26 +3819,26 @@ draw_tab (HWND hWnd, HDC hdc, RECT *rect, char *title, DWORD color, int flag, HI } if (flag & LFRDR_TAB_BOTTOM) { - SetPenColor(hdc, DWORD2PIXEL (hdc, darkest_c)); + SetPenColor(hdc, DWORD2Pixel (hdc, darkest_c)); MoveTo (hdc, rect->right - 2, by - 3); LineTo (hdc, rect->right - 2, ty); MoveTo (hdc, rect->right - 3, by - 2 ); LineTo (hdc, rect->right - 3, by - 2); - SetPenColor(hdc, DWORD2PIXEL (hdc, darker_c)); + SetPenColor(hdc, DWORD2Pixel (hdc, darker_c)); MoveTo (hdc, rect->right - 3, by -3); LineTo (hdc, rect->right - 3, ty); }else { - SetPenColor(hdc, DWORD2PIXEL (hdc, darkest_c)); + SetPenColor(hdc, DWORD2Pixel (hdc, darkest_c)); MoveTo (hdc, rect->right - 2, ty + 2 ); LineTo (hdc, rect->right - 2, by - 2); MoveTo (hdc, rect->right - 3, ty + 1 ); LineTo (hdc, rect->right - 3, ty + 1); - SetPenColor(hdc, DWORD2PIXEL (hdc, darker_c)); + SetPenColor(hdc, DWORD2Pixel (hdc, darker_c)); MoveTo (hdc, rect->right - 3, ty + 2 ); LineTo (hdc, rect->right - 3, by - 2); @@ -3859,7 +3859,7 @@ draw_tab (HWND hWnd, HDC hdc, RECT *rect, char *title, DWORD color, int flag, HI } /* draw the TEXT */ - SetBkColor (hdc, DWORD2PIXEL (hdc, color)); + SetBkColor (hdc, DWORD2Pixel (hdc, color)); text_extent -= 4; eff_len = GetTextExtentPoint (hdc, title, strlen(title), text_extent, &eff_chars, NULL, NULL, &size); diff --git a/src/gui/menu.c b/src/gui/menu.c index 63df8320..f892b8e2 100644 --- a/src/gui/menu.c +++ b/src/gui/menu.c @@ -1344,7 +1344,7 @@ static void mnuDrawMenuBarItem (HWND hwnd, HDC hdc, PMENUITEM pmi, return; if (!pWin->we_rdr) { - _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %x\n", (int)pWin); + _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); return; } @@ -1408,8 +1408,8 @@ static void mnuDrawMenuBarItem (HWND hwnd, HDC hdc, PMENUITEM pmi, lighter_dword = pWin->we_rdr->calc_3dbox_color (bgc_dword, LFRDR_3DBOX_COLOR_LIGHTEST); - darker_pixel = DWORD2PIXEL (hdc, darker_dword); - lighter_pixel = DWORD2PIXEL (hdc, lighter_dword); + darker_pixel = DWORD2Pixel (hdc, darker_dword); + lighter_pixel = DWORD2Pixel (hdc, lighter_dword); if (rect.top < rect.bottom - 2) { @@ -1991,7 +1991,7 @@ static int mnuDrawMenuPic (HWND hwnd, HDC hdc, RECT* rect, if (!pWin->we_rdr) { - _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %x\n", (int)pWin); + _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); return -1; } @@ -2242,7 +2242,7 @@ static void draw_bottom_scroll_button(PTRACKMENUINFO ptmi) if (!pWin->we_rdr) { - _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %x\n", (int)pWin); + _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); return; } @@ -2283,7 +2283,7 @@ static int mnuShowPopupMenu (PTRACKMENUINFO ptmi) if (!pWin->we_rdr) { - _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %x\n", (int)pWin); + _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); return -1; } @@ -2331,8 +2331,8 @@ static int mnuShowPopupMenu (PTRACKMENUINFO ptmi) lighter_dword = pWin->we_rdr->calc_3dbox_color (bgc_dword, LFRDR_3DBOX_COLOR_LIGHTEST); - darker_pixel = DWORD2PIXEL (HDC_SCREEN_SYS, darker_dword); - lighter_pixel = DWORD2PIXEL (HDC_SCREEN_SYS, lighter_dword); + darker_pixel = DWORD2Pixel (HDC_SCREEN_SYS, darker_dword); + lighter_pixel = DWORD2Pixel (HDC_SCREEN_SYS, lighter_dword); if ((ptmi->rc.bottom > g_rcScr.bottom) && ((ptmi->rc.bottom - ptmi->rc.top) > g_rcScr.bottom)){ @@ -2604,7 +2604,7 @@ static void draw_top_scroll_button(PTRACKMENUINFO ptmi) if (!pWin->we_rdr) { - _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %x\n", (int)pWin); + _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); return; } @@ -2648,7 +2648,7 @@ static int show_scroll_popup_menu (PTRACKMENUINFO ptmi) if (!pWin->we_rdr) { - _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %x\n", (int)pWin); + _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); return -1; } @@ -2668,8 +2668,8 @@ static int show_scroll_popup_menu (PTRACKMENUINFO ptmi) lighter_dword = pWin->we_rdr->calc_3dbox_color (bgc_dword, LFRDR_3DBOX_COLOR_LIGHTEST); - darker_pixel = DWORD2PIXEL (HDC_SCREEN_SYS, darker_dword); - lighter_pixel = DWORD2PIXEL (HDC_SCREEN_SYS, lighter_dword); + darker_pixel = DWORD2Pixel (HDC_SCREEN_SYS, darker_dword); + lighter_pixel = DWORD2Pixel (HDC_SCREEN_SYS, lighter_dword); h = get_start_to_end_height(ptmi); if ( (h + ptmi->top_scroll_rc.bottom) <= ptmi->bottom_scroll_rc.bottom){ @@ -3079,7 +3079,7 @@ static void mnuHiliteMenuItem (PTRACKMENUINFO ptmi, PMENUITEM pmi, BOOL bHilite) if (!pWin->we_rdr) { - _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %x\n", (int)pWin); + _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); return; } diff --git a/src/gui/window.c b/src/gui/window.c index 5b75b4b4..d3270320 100644 --- a/src/gui/window.c +++ b/src/gui/window.c @@ -52,7 +52,7 @@ static void RecalcScrollInfo (PMAINWIN pWin, BOOL bIsHBar); /* this message will auto-repeat when MSG_IDLE received */ static MSG sg_repeat_msg = {0, 0, 0, 0}; -void GUIAPI SetAutoRepeatMessage (HWND hwnd, int msg, +void GUIAPI SetAutoRepeatMessage (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { PMAINWIN pWin = (PMAINWIN)hwnd; @@ -345,7 +345,7 @@ void __mg_reset_mainwin_capture_info (PCONTROL ctrl) } } -static int DefaultDTMouseMsgHandler (PMAINWIN pWin, int message, +static LRESULT DefaultDTMouseMsgHandler (PMAINWIN pWin, UINT message, WPARAM flags, int x, int y) { int hc_mainwin = HT_UNKNOWN; @@ -440,7 +440,7 @@ static int DefaultDTMouseMsgHandler (PMAINWIN pWin, int message, return 0; } -static int DefaultMouseMsgHandler (PMAINWIN pWin, int message, +static LRESULT DefaultMouseMsgHandler (PMAINWIN pWin, UINT message, WPARAM flags, int x, int y) { static PMAINWIN __mgs_captured_win = NULL; @@ -1550,7 +1550,7 @@ static void wndHandleCustomHotspot (PMAINWIN pWin, } /* this function is CONTROL safe. */ -static int DefaultNCMouseMsgHandler(PMAINWIN pWin, int message, +static LRESULT DefaultNCMouseMsgHandler(PMAINWIN pWin, UINT message, int location, int x, int y) { static int downCode = HT_UNKNOWN; @@ -1726,7 +1726,7 @@ static int DefaultNCMouseMsgHandler(PMAINWIN pWin, int message, return 0; } -static int DefaultKeyMsgHandler (PMAINWIN pWin, int message, +static LRESULT DefaultKeyMsgHandler (PMAINWIN pWin, UINT message, WPARAM wParam, LPARAM lParam) { /* @@ -1764,7 +1764,7 @@ static int DefaultKeyMsgHandler (PMAINWIN pWin, int message, return 0; } -static int DefaultCreateMsgHandler(PMAINWIN pWin, int message, +static LRESULT DefaultCreateMsgHandler(PMAINWIN pWin, UINT message, WPARAM wParam, LPARAM lParam) { @@ -2099,7 +2099,7 @@ void gui_open_ime_window (PMAINWIN pWin, BOOL open_close, HWND rev_hwnd) #endif } -static int DefaultPostMsgHandler(PMAINWIN pWin, int message, +static LRESULT DefaultPostMsgHandler(PMAINWIN pWin, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) @@ -2392,7 +2392,7 @@ static void wndActiveMainWindow (PMAINWIN pWin, BOOL fActive) release_valid_dc (pWin, hdc); } -static int DefaultPaintMsgHandler(PMAINWIN pWin, int message, +static LRESULT DefaultPaintMsgHandler(PMAINWIN pWin, UINT message, WPARAM wParam, LPARAM lParam) { switch( message ) @@ -2430,7 +2430,7 @@ static int DefaultPaintMsgHandler(PMAINWIN pWin, int message, return 0; } -static int DefaultControlMsgHandler(PMAINWIN pWin, int message, +static LRESULT DefaultControlMsgHandler(PMAINWIN pWin, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; @@ -2543,7 +2543,7 @@ static int DefaultControlMsgHandler(PMAINWIN pWin, int message, return 0; } -static int DefaultSessionMsgHandler(PMAINWIN pWin, int message, +static LRESULT DefaultSessionMsgHandler(PMAINWIN pWin, UINT message, WPARAM wParam, LPARAM lParam) { @@ -2558,7 +2558,7 @@ static int DefaultSessionMsgHandler(PMAINWIN pWin, int message, return 0; } -static int DefaultSystemMsgHandler(PMAINWIN pWin, int message, +static LRESULT DefaultSystemMsgHandler(PMAINWIN pWin, UINT message, WPARAM wParam, LPARAM lParam) { @@ -2595,7 +2595,7 @@ static int DefaultSystemMsgHandler(PMAINWIN pWin, int message, ** This default main window call-back procedure ** also implemented for control. */ -int PreDefMainWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +LRESULT PreDefMainWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PMAINWIN pWin = (PMAINWIN)hWnd; @@ -2632,7 +2632,7 @@ int PreDefMainWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) return 0; } -int PreDefControlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +LRESULT PreDefControlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { if (message == MSG_SETTEXT) return 0; @@ -2651,7 +2651,7 @@ int PreDefControlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) return DefaultMainWinProc (hWnd, message, wParam, lParam); } -int DefaultWindowProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +LRESULT DefaultWindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { if (IsMainWindow(hWnd)) { return DefaultMainWinProc (hWnd, message, wParam, lParam); @@ -2735,7 +2735,7 @@ HWND GUIAPI SetActiveWindow (HWND hMainWnd) if (!MG_IS_NORMAL_WINDOW(hMainWnd) || !IsMainWindow (hMainWnd)) return HWND_INVALID; - return SendMessage (HWND_DESKTOP, + return (HWND)SendMessage (HWND_DESKTOP, MSG_SETACTIVEMAIN, (WPARAM)hMainWnd, 0); } @@ -3494,7 +3494,7 @@ void GUIAPI MainWindowThreadCleanup (HWND hMainWnd) if (!MG_IS_DESTROYED_WINDOW (hMainWnd)) { #ifdef _DEBUG fprintf (stderr, "GUI>Window: Unexpected calling of " - "(MainWindowThreadCleanup); Window (%x) " + "(MainWindowThreadCleanup); Window (%p) " "not destroyed yet!\n", hMainWnd); #endif @@ -4268,7 +4268,7 @@ HCURSOR GUIAPI SetWindowCursor (HWND hWnd, HCURSOR hNewCursor) pWin = MG_GET_WINDOW_PTR (hWnd); if (pWin->WinType == TYPE_MAINWIN) - return SendMessage (HWND_DESKTOP, + return (HCURSOR)SendMessage (HWND_DESKTOP, MSG_SETWINCURSOR, (WPARAM)hWnd, (LPARAM)hNewCursor); else if (pWin->WinType == TYPE_CONTROL) { HCURSOR old = pWin->hCursor; @@ -5838,9 +5838,11 @@ static RECT4MASK* CalcXYBannedRects (HDC hdc, const void* mask, int * rect_size, int pitch = bmp->bmAlphaPitch; sA = bmp->bmAlphaMask[y * pitch + x/bmp->bmBytesPerPixel]; DISEMBLE_RGB (p, bpp, pixfmt, pixel, sR, sG, sB); + sR += sG + sB; /* suspend the warning */ } else { DISEMBLE_RGBA (p, bpp, pixfmt, pixel, sR, sG, sB, sA); + sR += sG + sB; /* suspend the warning */ } } else { diff --git a/src/ial/native/kbd_event.c b/src/ial/native/kbd_event.c index aa79448b..6bbe9de1 100644 --- a/src/ial/native/kbd_event.c +++ b/src/ial/native/kbd_event.c @@ -99,12 +99,16 @@ static int EVENT_Open (const char *device) *s++ = *p++; } *s = 0; + + mknod (guess_device, S_IFCHR | 0x660, makedev (13, 64+id)); +#if 0 { char cmd[1024]; sprintf(cmd, "mknod %s c 13 %d > /dev/null 2>&1", guess_device, 64+id); fprintf(stderr, "%s\n", cmd); system(cmd); } +#endif break; } fclose(fp); diff --git a/src/ial/native/mou_imps2.c b/src/ial/native/mou_imps2.c index 62385b02..17425068 100644 --- a/src/ial/native/mou_imps2.c +++ b/src/ial/native/mou_imps2.c @@ -78,7 +78,9 @@ static int IMPS2_Open (const char* mdev) return -1; } else { - write (mouse_fd, IMPS2_Param, sizeof (IMPS2_Param)); + if (write (mouse_fd, IMPS2_Param, sizeof (IMPS2_Param)) < sizeof (IMPS2_Param)) { + return -1; + } } return mouse_fd; diff --git a/src/ial/native/mou_ps2.c b/src/ial/native/mou_ps2.c index 49772a27..bd55985d 100644 --- a/src/ial/native/mou_ps2.c +++ b/src/ial/native/mou_ps2.c @@ -94,7 +94,9 @@ static int PS2_Open(const char* mdev) return -1; } else { - write (mouse_fd, initdata_ps2, sizeof(initdata_ps2)); + if (write (mouse_fd, initdata_ps2, sizeof(initdata_ps2)) < sizeof(initdata_ps2)) { + return -1; + } } return mouse_fd; diff --git a/src/ial/pcxvfbial.c b/src/ial/pcxvfbial.c index e1089e17..1bcfcdcb 100644 --- a/src/ial/pcxvfbial.c +++ b/src/ial/pcxvfbial.c @@ -134,10 +134,12 @@ void VFBSetCaption(const char* caption) strcpy(ced->buff,caption); if(__mg_pcxvfb_client_sockfd == -1) - return ; + return; /*one XVFBCaptionEventData struct costs 8 bytes, * change that '8' below if the struct is changed*/ - mg_writesocket(__mg_pcxvfb_client_sockfd, ced, 8+len); + if (mg_writesocket(__mg_pcxvfb_client_sockfd, ced, 8+len) < (8+len)) { + _MG_PRINTF ("IAL>PCXVFB: error occurred when calling VFBSetCaption.\n"); + } } void VFBOpenIME(int bOpen) @@ -148,8 +150,11 @@ void VFBOpenIME(int bOpen) }; if(__mg_pcxvfb_client_sockfd == -1) - return ; - mg_writesocket(__mg_pcxvfb_client_sockfd, &ime, sizeof(ime)); + return; + + if (mg_writesocket(__mg_pcxvfb_client_sockfd, &ime, sizeof(ime)) < sizeof(ime)) { + _MG_PRINTF ("IAL>PCXVFB: error occurred when calling VFBOpenIME.\n"); + } } void VFBShowWindow(int show) @@ -159,8 +164,11 @@ void VFBShowWindow(int show) show }; if(__mg_pcxvfb_client_sockfd == -1) - return ; - mg_writesocket(__mg_pcxvfb_client_sockfd, info, sizeof(info)); + return; + + if (mg_writesocket(__mg_pcxvfb_client_sockfd, info, sizeof(info)) < sizeof(info)) { + _MG_PRINTF ("IAL>PCXVFB: error occurred when calling VFBShowWindow.\n"); + } } void VFBAtExit(void (*callback)(void)) @@ -258,7 +266,9 @@ static void write_rec (const void* buf, size_t n) #ifdef WIN32 /* TODO: */ #else - write(record_fd, buf, n); + if (write(record_fd, buf, n) < n) { + _MG_PRINTF ("IAL>PCXVFB: error occurred when calling write_rec.\n"); + } #endif } @@ -333,8 +343,11 @@ static void mouse_setxy (int x, int y) int mouse_event[3] = {MOUSE_TYPE, x, y}; if(__mg_pcxvfb_client_sockfd == -1) - return ; - mg_writesocket(__mg_pcxvfb_client_sockfd, &mouse_event, sizeof(XVFBEVENT)); + 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"); + } } static int mouse_getbutton (void) diff --git a/src/include/ctrlclass.h b/src/include/ctrlclass.h index d666a1a1..89b242b0 100644 --- a/src/include/ctrlclass.h +++ b/src/include/ctrlclass.h @@ -26,10 +26,10 @@ typedef struct _CTRLCLASSINFO HCURSOR hCursor; // control cursor int iBkColor; // control background color. - int (*ControlProc)(HWND, int, WPARAM, LPARAM); + LRESULT (*ControlProc)(HWND, UINT, WPARAM, LPARAM); // control procedure. - DWORD dwAddData; // the additional data. + DWORD dwAddData; // the additional data. int nUseCount; // use count. struct _CTRLCLASSINFO* next; @@ -85,7 +85,7 @@ typedef struct tagCONTROL DWORD dwAddData; // the additional data. DWORD dwAddData2; // the second addtional data. - int (*ControlProc) (HWND, int, WPARAM, LPARAM); + LRESULT (*ControlProc) (HWND, UINT, WPARAM, LPARAM); PMAINWIN pMainWin; // the main window that contains this control. diff --git a/src/include/element.h b/src/include/element.h index 385bbb53..07de5dfc 100644 --- a/src/include/element.h +++ b/src/include/element.h @@ -21,8 +21,8 @@ extern "C" { typedef struct _wnd_element_data { list_t list; /* list pointer */ - Uint32 id; /* the item type */ - Uint32 data; /* the data of the item */ + UINT id; /* the item type */ + DWORD data; /* the data of the item */ } WND_ELEMENT_DATA; #define WED_OK 0 diff --git a/src/include/internals.h b/src/include/internals.h index fdb3f63a..ed4e679a 100644 --- a/src/include/internals.h +++ b/src/include/internals.h @@ -162,7 +162,7 @@ typedef MSGQUEUE* PMSGQUEUE; typedef struct _SYNCMSG { MSG Msg; - int retval; + LRESULT retval; sem_t* sem_handle; struct _SYNCMSG* pNext; }SYNCMSG; @@ -338,7 +338,7 @@ typedef struct _MAINWIN DWORD dwAddData; // the additional data. DWORD dwAddData2; // the second addtional data. - int (*MainWindowProc)(HWND, int, WPARAM, LPARAM); + LRESULT (*MainWindowProc)(HWND, UINT, WPARAM, LPARAM); // the address of main window procedure. struct _MAINWIN* pMainWin; @@ -482,10 +482,10 @@ extern PTRACKMENUINFO __mg_ptmi; extern PMAINWIN __mg_dsk_win; extern HWND __mg_hwnd_desktop; -extern int DesktopWinProc (HWND hWnd, - int message, WPARAM wParam, LPARAM lParam); -extern int SendSyncMessage (HWND hWnd, int msg, WPARAM wParam, LPARAM lParam); - +extern LRESULT DesktopWinProc (HWND hWnd, + UINT message, WPARAM wParam, LPARAM lParam); +extern LRESULT SendSyncMessage (HWND hWnd, + UINT msg, WPARAM wParam, LPARAM lParam); #ifndef _MGRM_THREADS extern unsigned int __mg_csrimgsize; diff --git a/src/kernel/cursor-procs.c b/src/kernel/cursor-procs.c index 2a2a2c1b..05305edb 100644 --- a/src/kernel/cursor-procs.c +++ b/src/kernel/cursor-procs.c @@ -229,23 +229,23 @@ HCURSOR GUIAPI CreateCursor (int xhotspot, int yhotspot, int w, int h, static HCURSOR srvLoadCursorFromFile (const char* filename) { FILE* fp; - WORD wTemp; + WORD16 wTemp; int ret = 0; int w, h, xhot, yhot, colornum; - DWORD size, offset; - DWORD imagesize, imagew, imageh; + DWORD32 size, offset; + DWORD32 imagesize, imagew, imageh; BYTE* image; if( !(fp = fopen(filename, "rb")) ) return 0; - fseek(fp, sizeof(WORD), SEEK_SET); + fseek(fp, sizeof(WORD16), SEEK_SET); /* the cbType of struct CURSORDIR. */ wTemp = MGUI_ReadLE16FP (fp); if(wTemp != 2) goto error; /* skip the cdCount of struct CURSORDIR, we always use the first cursor. */ - fseek(fp, sizeof(WORD), SEEK_CUR); + fseek(fp, sizeof(WORD16), SEEK_CUR); /* cursor info, read the members of struct CURSORDIRENTRY. */ w = fgetc (fp); /* the width of first cursor. */ @@ -261,7 +261,7 @@ static HCURSOR srvLoadCursorFromFile (const char* filename) /* read the cursor image info. */ fseek(fp, offset, SEEK_SET); - fseek(fp, sizeof(DWORD), SEEK_CUR); /* skip biSize member. */ + fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip biSize member. */ imagew = MGUI_ReadLE32FP (fp); imageh = MGUI_ReadLE32FP (fp); /* check the biPlanes member; */ @@ -271,11 +271,11 @@ static HCURSOR srvLoadCursorFromFile (const char* filename) wTemp = MGUI_ReadLE16FP (fp); if(wTemp > 4) goto error; colornum = (int)wTemp; - fseek(fp, sizeof(DWORD), SEEK_CUR); /* skip the biCompression members. */ + fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biCompression members. */ imagesize = MGUI_ReadLE32FP (fp); /* skip the rest members and the color table. */ - fseek(fp, sizeof(DWORD)*4 + sizeof(BYTE)*(4< 4) goto error; colornum = (int)wTemp; - fseek(fp, sizeof(DWORD), SEEK_CUR); /* skip the biCompression members. */ + fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biCompression members. */ imagesize = MGUI_ReadLE32FP (fp); /* skip the rest members and the color table. */ - fseek(fp, sizeof(DWORD)*4 + sizeof(BYTE)*(4< 32 || imageh > 32) { + goto error; + } + /* check the biPlanes member; */ wTemp = MGUI_ReadLE16FP (fp); if(wTemp != 1) goto error; @@ -135,18 +145,21 @@ HCURSOR GUIAPI LoadCursorFromFile(const char* filename) wTemp = MGUI_ReadLE16FP (fp); if(wTemp > 4) goto error; colornum = (int)wTemp; - fseek(fp, sizeof(DWORD), SEEK_CUR); /* skip the biCompression members. */ + fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biCompression members. */ imagesize = MGUI_ReadLE32FP (fp); /* skip the rest members and the color table. */ - fseek(fp, sizeof(DWORD)*4 + sizeof(BYTE)*(4< 32 || imageh > 32) { + goto error; + } /* check the biPlanes member; */ wTemp = MGUI_ReadLE16Mem (&p); @@ -205,11 +227,11 @@ HCURSOR GUIAPI LoadCursorFromMem (const void* area) colornum = wTemp; /* skip the biCompression members. */ - p += sizeof (DWORD); + p += sizeof (DWORD32); imagesize = MGUI_ReadLE32Mem (&p); /* skip the rest members and the color table. */ - p += sizeof(DWORD)*4 + sizeof(BYTE)*(4<hCursor; pWin->hCursor = (HCURSOR)lParam; - return old; + return (LRESULT)old; } case MSG_GETNEXTMAINWIN: @@ -1431,8 +1430,9 @@ static int WindowMessageHandler(int message, PMAINWIN pWin, LPARAM lParam) last_type = ZOF_TYPE_NORMAL; slot = __mg_zorder_info->first_normal; continue; - }else{ - return HWND_NULL; + } + else { + return (LRESULT)HWND_NULL; } } @@ -1444,7 +1444,7 @@ static int WindowMessageHandler(int message, PMAINWIN pWin, LPARAM lParam) slot = nodes[slot].next; continue; }else{ - return hWnd; + return (LRESULT)hWnd; } } break; @@ -1476,7 +1476,7 @@ static int WindowMessageHandler(int message, PMAINWIN pWin, LPARAM lParam) return dskCancelDragWindow (pWin); } - return iRet; + return lRet; } #define IDM_REDRAWBG MINID_RESERVED @@ -1943,7 +1943,7 @@ void GUIAPI DesktopUpdateAllWindow(void) # define HAS_NO_MAINWINDOW() ((__mg_zorder_info->nr_normals + __mg_zorder_info->nr_topmosts) == 1) #endif -int DesktopWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +LRESULT DesktopWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static HDC hDesktopDC; int flags, x, y; @@ -1965,7 +1965,7 @@ int DesktopWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) static int n = 1; char buffer[20]; - sprintf (buffer, "%x-%d.bmp", (lParam & KS_CTRL)? + sprintf (buffer, "%p-%d.bmp", (lParam & KS_CTRL)? (HWND)active_mainwnd: 0, n); if (SaveMainWindowContent ((lParam & KS_CTRL)? @@ -2132,17 +2132,17 @@ int DesktopWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) return dskOnRemoveCtrlInstance ((PCONTROL)wParam, (PCONTROL)lParam); case MSG_GETCTRLCLASSINFO: - return (int)gui_GetControlClassInfo ((const char*)lParam); + return (LRESULT)gui_GetControlClassInfo ((const char*)lParam); case MSG_CTRLCLASSDATAOP: - return (int)gui_ControlClassDataOp (wParam, (WNDCLASS*)lParam); + return (LRESULT)gui_ControlClassDataOp (wParam, (WNDCLASS*)lParam); case MSG_REGISTERKEYHOOK: - return (int)dskRegisterKeyHook ((void*)wParam, + return (LRESULT)dskRegisterKeyHook ((void*)wParam, (MSGHOOK)lParam); case MSG_REGISTERMOUSEHOOK: - return (int)dskRegisterMouseHook ((void*)wParam, + return (LRESULT)dskRegisterMouseHook ((void*)wParam, (MSGHOOK)lParam); case MSG_IME_REGISTER: diff --git a/src/kernel/desktop-ths.c b/src/kernel/desktop-ths.c index 22a25c68..638aa9f9 100644 --- a/src/kernel/desktop-ths.c +++ b/src/kernel/desktop-ths.c @@ -125,7 +125,7 @@ void* DesktopMain (void* data) int iRet = 0; #ifdef _MGHAVE_TRACE_MSG - fprintf (stderr, "Message, %s: hWnd: %#x, wP: %#x, lP: %#lx. %s\n", + fprintf (stderr, "Message, %s: hWnd: %p, wP: %#lx, lP: %#lx. %s\n", Message2Str (Msg.message), Msg.hwnd, Msg.wParam, diff --git a/src/kernel/desktop.c b/src/kernel/desktop.c index 53684580..12ab2cc4 100644 --- a/src/kernel/desktop.c +++ b/src/kernel/desktop.c @@ -1017,7 +1017,10 @@ int PopupMenuTrackProc (PTRACKMENUINFO ptmi, static int srvForceCloseMenu (int cli) { ZORDERINFO* zi = _get_zorder_info(cli); - int i, ret = 0, cli_trackmenu; + int i, ret = 0; +#if defined(_MGRM_PROCESSES) && !defined(_MGRM_STANDALONE) + int cli_trackmenu; +#endif ZORDERNODE* menu_nodes; ZORDERNODE* win_nodes; RECT rc_bound; @@ -1047,7 +1050,9 @@ static int srvForceCloseMenu (int cli) win_nodes [0].flags |= ZOF_REFERENCE; } +#if defined(_MGRM_PROCESSES) && !defined(_MGRM_STANDALONE) cli_trackmenu = zi->cli_trackmenu; +#endif zi->cli_trackmenu = -1; zi->nr_popupmenus = 0; @@ -1234,7 +1239,7 @@ post_msg_by_znode_p (const ZORDERINFO* zi, const ZORDERNODE* znode, return ret; } -static int dskSetActiveZOrderNode (int cli, int idx_znode) +static HWND dskSetActiveZOrderNode (int cli, int idx_znode) { int old_active = 0; ZORDERINFO* zi = _get_zorder_info(cli); @@ -1243,14 +1248,14 @@ static int dskSetActiveZOrderNode (int cli, int idx_znode) if (idx_znode > zi->max_nr_globals + zi->max_nr_topmosts + zi->max_nr_normals) { - return (int)HWND_INVALID; + return HWND_INVALID; } nodes = GET_ZORDERNODE(zi); if ((__mg_ime_wnd && __mg_ime_wnd == nodes [idx_znode].main_win) || nodes [idx_znode].flags & ZOF_TF_TOOLWIN) - return (int)HWND_INVALID; + return HWND_INVALID; #ifdef _MGHAVE_MENU if (zi->cli_trackmenu >= 0) @@ -1291,7 +1296,7 @@ static int dskSetActiveZOrderNode (int cli, int idx_znode) post_msg_by_znode_p (zi, nodes + old_active, MSG_ACTIVE, FALSE, 0); post_msg_by_znode_p (zi, nodes + old_active, - MSG_KILLFOCUS, new_hwnd, 0); + MSG_KILLFOCUS, (WPARAM)new_hwnd, 0); } if (idx_znode) { @@ -1300,7 +1305,7 @@ static int dskSetActiveZOrderNode (int cli, int idx_znode) post_msg_by_znode_p (zi, nodes + idx_znode, MSG_ACTIVE, TRUE, 0); post_msg_by_znode_p (zi, nodes + idx_znode, - MSG_SETFOCUS, old_hwnd, 0); + MSG_SETFOCUS, (WPARAM)old_hwnd, 0); } return old_hwnd; diff --git a/src/kernel/message.c b/src/kernel/message.c index 73d258ec..2ab138f5 100644 --- a/src/kernel/message.c +++ b/src/kernel/message.c @@ -390,11 +390,11 @@ BOOL GUIAPI HavePendingMessage (HWND hWnd) return HavePendingMessageEx (hWnd, FALSE); } -int GUIAPI BroadcastMessage (int iMsg, WPARAM wParam, LPARAM lParam) +int GUIAPI BroadcastMessage (UINT nMsg, WPARAM wParam, LPARAM lParam) { MSG msg; - msg.message = iMsg; + msg.message = nMsg; msg.wParam = wParam; msg.lParam = lParam; @@ -419,10 +419,10 @@ const char* GUIAPI Message2Str (int message) } void GUIAPI PrintMessage (FILE* fp, HWND hWnd, - int iMsg, WPARAM wParam, LPARAM lParam) + UINT nMsg, WPARAM wParam, LPARAM lParam) { - fprintf (fp, "Message %s: hWnd: %#x, wP: %x, lP: %lx.\n", - Message2Str (iMsg), hWnd, wParam, lParam); + fprintf (fp, "Message %s: hWnd: %p, wP: %lx, lP: %lx.\n", + Message2Str (nMsg), hWnd, wParam, lParam); } #endif @@ -445,11 +445,11 @@ static inline void CheckCapturedMouseMessage (PMSG pMsg) } #define IS_MSG_WANTED(message) \ - ( (iMsgFilterMin <= 0 && iMsgFilterMax <= 0) || \ - (iMsgFilterMin > 0 && iMsgFilterMax >= iMsgFilterMin && \ - message >= iMsgFilterMin && message <= iMsgFilterMax) ) + ( (nMsgFilterMin <= 0 && nMsgFilterMax <= 0) || \ + (nMsgFilterMin > 0 && nMsgFilterMax >= nMsgFilterMin && \ + message >= nMsgFilterMin && message <= nMsgFilterMax) ) -BOOL PeekMessageEx (PMSG pMsg, HWND hWnd, int iMsgFilterMin, int iMsgFilterMax, +BOOL PeekMessageEx (PMSG pMsg, HWND hWnd, UINT nMsgFilterMin, UINT nMsgFilterMax, BOOL bWait, UINT uRemoveMsg) { PMSGQUEUE pMsgQueue; @@ -725,10 +725,10 @@ int GUIAPI GetMessage (PMSG pMsg, HWND hWnd) return PeekMessageEx (pMsg, hWnd, 0, 0, TRUE, PM_REMOVE); } -BOOL GUIAPI PeekMessage (PMSG pMsg, HWND hWnd, int iMsgFilterMin, - int iMsgFilterMax, UINT uRemoveMsg) +BOOL GUIAPI PeekMessage (PMSG pMsg, HWND hWnd, UINT nMsgFilterMin, + UINT nMsgFilterMax, UINT uRemoveMsg) { - return PeekMessageEx (pMsg, hWnd, iMsgFilterMin, iMsgFilterMax, + return PeekMessageEx (pMsg, hWnd, nMsgFilterMin, nMsgFilterMax, FALSE, uRemoveMsg); } */ @@ -806,8 +806,8 @@ getit: return TRUE; } -BOOL GUIAPI PeekPostMessage (PMSG pMsg, HWND hWnd, int iMsgFilterMin, - int iMsgFilterMax, UINT uRemoveMsg) +BOOL GUIAPI PeekPostMessage (PMSG pMsg, HWND hWnd, UINT nMsgFilterMin, + UINT nMsgFilterMax, UINT uRemoveMsg) { PMSGQUEUE pMsgQueue; PMSG pPostMsg; @@ -826,10 +826,10 @@ BOOL GUIAPI PeekPostMessage (PMSG pMsg, HWND hWnd, int iMsgFilterMin, if (pMsgQueue->readpos != pMsgQueue->writepos) { pPostMsg = pMsgQueue->msg + pMsgQueue->readpos; - if (iMsgFilterMin == 0 && iMsgFilterMax == 0) + if (nMsgFilterMin == 0 && nMsgFilterMax == 0) *pMsg = *pPostMsg; - else if (pPostMsg->message <= iMsgFilterMax && - pPostMsg->message >= iMsgFilterMin) + else if (pPostMsg->message <= nMsgFilterMax && + pPostMsg->message >= nMsgFilterMin) *pMsg = *pPostMsg; else { UNLOCK_MSGQ (pMsgQueue); @@ -858,7 +858,7 @@ BOOL GUIAPI PeekPostMessage (PMSG pMsg, HWND hWnd, int iMsgFilterMin, return FALSE; } -int GUIAPI SendMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam) +LRESULT GUIAPI SendMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) { WNDPROC WndProc; @@ -866,18 +866,18 @@ int GUIAPI SendMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam) #ifdef _MGRM_THREADS if (!BE_THIS_THREAD(hWnd)) - return SendSyncMessage (hWnd, iMsg, wParam, lParam); + return SendSyncMessage (hWnd, nMsg, wParam, lParam); #endif if ( !(WndProc = GetWndProc(hWnd)) ) return ERR_INV_HWND; - return (*WndProc)(hWnd, iMsg, wParam, lParam); + return (*WndProc)(hWnd, nMsg, wParam, lParam); } /* houhh 20090619, send notify message to topmost of queue.*/ -int SendTopNotifyMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam) +LRESULT SendTopNotifyMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) { PMSGQUEUE pMsgQueue; PQMSG pqmsg; @@ -893,7 +893,7 @@ int SendTopNotifyMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam) /* queue the notification message. */ pqmsg->Msg.hwnd = hWnd; - pqmsg->Msg.message = iMsg; + pqmsg->Msg.message = nMsg; pqmsg->Msg.wParam = wParam; pqmsg->Msg.lParam = lParam; pqmsg->next = NULL; @@ -917,7 +917,7 @@ int SendTopNotifyMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam) return ERR_OK; } -int GUIAPI SendNotifyMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam) +int GUIAPI SendNotifyMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) { PMSGQUEUE pMsgQueue; PQMSG pqmsg; @@ -933,7 +933,7 @@ int GUIAPI SendNotifyMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam) /* queue the notification message. */ pqmsg->Msg.hwnd = hWnd; - pqmsg->Msg.message = iMsg; + pqmsg->Msg.message = nMsg; pqmsg->Msg.wParam = wParam; pqmsg->Msg.lParam = lParam; pqmsg->next = NULL; @@ -957,7 +957,7 @@ int GUIAPI SendNotifyMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam) return ERR_OK; } -int GUIAPI PostMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam) +int GUIAPI PostMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) { PMSGQUEUE pMsgQueue; MSG msg; @@ -965,7 +965,7 @@ int GUIAPI PostMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam) if (!(pMsgQueue = kernel_GetMsgQueue(hWnd))) return ERR_INV_HWND; - if (iMsg == MSG_PAINT) { + if (nMsg == MSG_PAINT) { LOCK_MSGQ (pMsgQueue); pMsgQueue->dwState |= QS_PAINT; UNLOCK_MSGQ (pMsgQueue); @@ -977,7 +977,7 @@ int GUIAPI PostMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam) } msg.hwnd = hWnd; - msg.message = iMsg; + msg.message = nMsg; msg.wParam = wParam; msg.lParam = lParam; @@ -1028,7 +1028,7 @@ int GUIAPI DispatchMessage (PMSG pMsg) LICENSE_MODIFY_MESSAGE(pMsg); #ifdef _MGHAVE_TRACE_MSG - fprintf (stderr, "Message, %s: hWnd: %x, wP: %x, lP: %lx. %s\n", + fprintf (stderr, "Message, %s: hWnd: %p, wP: %lx, lP: %lx. %s\n", Message2Str (pMsg->message), pMsg->hwnd, pMsg->wParam, @@ -1241,7 +1241,7 @@ BOOL GUIAPI EmptyMessageQueue (HWND hWnd) #else /* send a synchronous message to a window in a different thread */ -int SendSyncMessage (HWND hWnd, int msg, WPARAM wParam, LPARAM lParam) +LRESULT SendSyncMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { PMSGQUEUE pMsgQueue, thinfo = NULL; SYNCMSG SyncMsg; @@ -1342,7 +1342,7 @@ int SendSyncMessage (HWND hWnd, int msg, WPARAM wParam, LPARAM lParam) return SyncMsg.retval; } -int GUIAPI PostSyncMessage (HWND hWnd, int msg, WPARAM wParam, LPARAM lParam) +LRESULT GUIAPI PostSyncMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { MG_CHECK_RET (MG_IS_WINDOW(hWnd), -1); if (BE_THIS_THREAD(hWnd)) @@ -1351,7 +1351,7 @@ int GUIAPI PostSyncMessage (HWND hWnd, int msg, WPARAM wParam, LPARAM lParam) return SendSyncMessage (hWnd, msg, wParam, lParam); } -int GUIAPI SendAsyncMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam) +int GUIAPI SendAsyncMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) { WNDPROC WndProc; @@ -1360,7 +1360,7 @@ int GUIAPI SendAsyncMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam) if ( !(WndProc = GetWndProc(hWnd)) ) return -1; - return (*WndProc)(hWnd, iMsg, wParam, lParam); + return (*WndProc)(hWnd, nMsg, wParam, lParam); } #endif /* !LITE_VERSION */ diff --git a/src/kernel/zorder.c b/src/kernel/zorder.c index 26718db6..430b81a9 100644 --- a/src/kernel/zorder.c +++ b/src/kernel/zorder.c @@ -120,7 +120,7 @@ int kernel_alloc_z_order_info (int nr_topmosts, int nr_normals) __mg_zorder_info->active_win = 0; __mg_zorder_info->cli_trackmenu = -1; - __mg_zorder_info->ptmi_in_cli = -1; + __mg_zorder_info->ptmi_in_cli = (HWND)-1; /* Set zorder node usage map. */ memset (__mg_zorder_info + 1, 0xFF, SIZE_USAGE_BMP); diff --git a/src/misc/about.c b/src/misc/about.c index 3b807063..a81ac153 100644 --- a/src/misc/about.c +++ b/src/misc/about.c @@ -27,7 +27,7 @@ static HWND sg_AboutWnd = 0; -static int AboutWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT AboutWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { RECT rcClient; diff --git a/src/mybmp/mybmp.c b/src/mybmp/mybmp.c index 59cdcf50..ebcfb9a0 100644 --- a/src/mybmp/mybmp.c +++ b/src/mybmp/mybmp.c @@ -138,7 +138,7 @@ int bmp_ComputePitch(int bpp, Uint32 width, Uint32 *pitch, BOOL does_round) bytespp = 4; } - /* rows are DWORD right aligned */ + /* rows are DWORD32 right aligned */ if (does_round) *pitch = (linesize + 3) & -4; else diff --git a/src/mybmp/winbmp.c b/src/mybmp/winbmp.c index 463a2ae5..049a4b89 100644 --- a/src/mybmp/winbmp.c +++ b/src/mybmp/winbmp.c @@ -354,7 +354,7 @@ typedef struct { unsigned long biHeight; unsigned short biBitCount; unsigned long biCompression; - DWORD rmask, gmask, bmask; + unsigned long rmask, gmask, bmask; } init_info_t; void * __mg_init_bmp (MG_RWops* fp, MYBITMAP * bmp, RGB * pal) @@ -609,14 +609,14 @@ int __mg_save_bmp (MG_RWops* fp, MYBITMAP* bmp, RGB* pal) WINBMPINFOHEADER bmih; memset (&bmfh, 0, sizeof (BITMAPFILEHEADER)); - bmfh.bfType = MAKEWORD ('B', 'M'); + bmfh.bfType = MAKEWORD16 ('B', 'M'); bmfh.bfReserved1 = 0; bmfh.bfReserved2 = 0; memset (&bmih, 0, sizeof (WINBMPINFOHEADER)); - bmih.biSize = (DWORD)(WININFOHEADERSIZE); - bmih.biWidth = (DWORD)(bmp->w); - bmih.biHeight = (DWORD)(bmp->h); + bmih.biSize = (unsigned long)(WININFOHEADERSIZE); + bmih.biWidth = (unsigned long)(bmp->w); + bmih.biHeight = (unsigned long)(bmp->h); bmih.biPlanes = 1; bmih.biCompression = BI_RGB; @@ -641,23 +641,23 @@ int __mg_save_bmp (MG_RWops* fp, MYBITMAP* bmp, RGB* pal) bmih.biClrUsed = 16L; bmih.biClrImportant = 16L; - MGUI_RWwrite (fp, &bmfh.bfType, sizeof (WORD), 1); - MGUI_RWwrite (fp, &bmfh.bfSize, sizeof (DWORD), 1); - MGUI_RWwrite (fp, &bmfh.bfReserved1, sizeof (WORD), 1); - MGUI_RWwrite (fp, &bmfh.bfReserved2, sizeof (WORD), 1); - MGUI_RWwrite (fp, &bmfh.bfOffBits, sizeof (DWORD), 1); + MGUI_RWwrite (fp, &bmfh.bfType, sizeof (WORD16), 1); + MGUI_RWwrite (fp, &bmfh.bfSize, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmfh.bfReserved1, sizeof (WORD16), 1); + MGUI_RWwrite (fp, &bmfh.bfReserved2, sizeof (WORD16), 1); + MGUI_RWwrite (fp, &bmfh.bfOffBits, sizeof (DWORD32), 1); - MGUI_RWwrite (fp, &bmih.biSize, sizeof (DWORD), 1); - MGUI_RWwrite (fp, &bmih.biWidth, sizeof (LONG), 1); - MGUI_RWwrite (fp, &bmih.biHeight, sizeof (LONG), 1); - MGUI_RWwrite (fp, &bmih.biPlanes, sizeof (WORD), 1); - MGUI_RWwrite (fp, &bmih.biBitCount, sizeof (WORD), 1); - MGUI_RWwrite (fp, &bmih.biCompression, sizeof (DWORD), 1); - MGUI_RWwrite (fp, &bmih.biSizeImage, sizeof (DWORD), 1); - MGUI_RWwrite (fp, &bmih.biXPelsPerMeter, sizeof (LONG), 1); - MGUI_RWwrite (fp, &bmih.biYPelsPerMeter, sizeof (LONG), 1); - MGUI_RWwrite (fp, &bmih.biClrUsed, sizeof (DWORD), 1); - MGUI_RWwrite (fp, &bmih.biClrImportant, sizeof (DWORD), 1); + MGUI_RWwrite (fp, &bmih.biSize, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biWidth, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biHeight, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biPlanes, sizeof (WORD16), 1); + MGUI_RWwrite (fp, &bmih.biBitCount, sizeof (WORD16), 1); + MGUI_RWwrite (fp, &bmih.biCompression, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biSizeImage, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biXPelsPerMeter, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biYPelsPerMeter, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biClrUsed, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biClrImportant, sizeof (DWORD32), 1); for (i = 0; i < 16; i++) { RGBQUAD rgbquad; @@ -692,23 +692,23 @@ int __mg_save_bmp (MG_RWops* fp, MYBITMAP* bmp, RGB* pal) bmih.biClrUsed = 256; bmih.biClrImportant = 256; - MGUI_RWwrite (fp, &bmfh.bfType, sizeof (WORD), 1); - MGUI_RWwrite (fp, &bmfh.bfSize, sizeof (DWORD), 1); - MGUI_RWwrite (fp, &bmfh.bfReserved1, sizeof (WORD), 1); - MGUI_RWwrite (fp, &bmfh.bfReserved2, sizeof (WORD), 1); - MGUI_RWwrite (fp, &bmfh.bfOffBits, sizeof (DWORD), 1); + MGUI_RWwrite (fp, &bmfh.bfType, sizeof (WORD16), 1); + MGUI_RWwrite (fp, &bmfh.bfSize, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmfh.bfReserved1, sizeof (WORD16), 1); + MGUI_RWwrite (fp, &bmfh.bfReserved2, sizeof (WORD16), 1); + MGUI_RWwrite (fp, &bmfh.bfOffBits, sizeof (DWORD32), 1); - MGUI_RWwrite (fp, &bmih.biSize, sizeof (DWORD), 1); - MGUI_RWwrite (fp, &bmih.biWidth, sizeof (LONG), 1); - MGUI_RWwrite (fp, &bmih.biHeight, sizeof (LONG), 1); - MGUI_RWwrite (fp, &bmih.biPlanes, sizeof (WORD), 1); - MGUI_RWwrite (fp, &bmih.biBitCount, sizeof (WORD), 1); - MGUI_RWwrite (fp, &bmih.biCompression, sizeof (DWORD), 1); - MGUI_RWwrite (fp, &bmih.biSizeImage, sizeof (DWORD), 1); - MGUI_RWwrite (fp, &bmih.biXPelsPerMeter, sizeof (LONG), 1); - MGUI_RWwrite (fp, &bmih.biYPelsPerMeter, sizeof (LONG), 1); - MGUI_RWwrite (fp, &bmih.biClrUsed, sizeof (DWORD), 1); - MGUI_RWwrite (fp, &bmih.biClrImportant, sizeof (DWORD), 1); + MGUI_RWwrite (fp, &bmih.biSize, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biWidth, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biHeight, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biPlanes, sizeof (WORD16), 1); + MGUI_RWwrite (fp, &bmih.biBitCount, sizeof (WORD16), 1); + MGUI_RWwrite (fp, &bmih.biCompression, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biSizeImage, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biXPelsPerMeter, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biYPelsPerMeter, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biClrUsed, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biClrImportant, sizeof (DWORD32), 1); for (i = 0; i < 256; i++) { RGBQUAD rgbquad; @@ -740,23 +740,23 @@ int __mg_save_bmp (MG_RWops* fp, MYBITMAP* bmp, RGB* pal) bmfh.bfSize = bmfh.bfOffBits + bmih.biSizeImage; bmih.biBitCount = 24; - MGUI_RWwrite (fp, &bmfh.bfType, sizeof (WORD), 1); - MGUI_RWwrite (fp, &bmfh.bfSize, sizeof (DWORD), 1); - MGUI_RWwrite (fp, &bmfh.bfReserved1, sizeof (WORD), 1); - MGUI_RWwrite (fp, &bmfh.bfReserved2, sizeof (WORD), 1); - MGUI_RWwrite (fp, &bmfh.bfOffBits, sizeof (DWORD), 1); + MGUI_RWwrite (fp, &bmfh.bfType, sizeof (WORD16), 1); + MGUI_RWwrite (fp, &bmfh.bfSize, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmfh.bfReserved1, sizeof (WORD16), 1); + MGUI_RWwrite (fp, &bmfh.bfReserved2, sizeof (WORD16), 1); + MGUI_RWwrite (fp, &bmfh.bfOffBits, sizeof (DWORD32), 1); - MGUI_RWwrite (fp, &bmih.biSize, sizeof (DWORD), 1); - MGUI_RWwrite (fp, &bmih.biWidth, sizeof (LONG), 1); - MGUI_RWwrite (fp, &bmih.biHeight, sizeof (LONG), 1); - MGUI_RWwrite (fp, &bmih.biPlanes, sizeof (WORD), 1); - MGUI_RWwrite (fp, &bmih.biBitCount, sizeof (WORD), 1); - MGUI_RWwrite (fp, &bmih.biCompression, sizeof (DWORD), 1); - MGUI_RWwrite (fp, &bmih.biSizeImage, sizeof (DWORD), 1); - MGUI_RWwrite (fp, &bmih.biXPelsPerMeter, sizeof (LONG), 1); - MGUI_RWwrite (fp, &bmih.biYPelsPerMeter, sizeof (LONG), 1); - MGUI_RWwrite (fp, &bmih.biClrUsed, sizeof (DWORD), 1); - MGUI_RWwrite (fp, &bmih.biClrImportant, sizeof (DWORD), 1); + MGUI_RWwrite (fp, &bmih.biSize, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biWidth, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biHeight, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biPlanes, sizeof (WORD16), 1); + MGUI_RWwrite (fp, &bmih.biBitCount, sizeof (WORD16), 1); + MGUI_RWwrite (fp, &bmih.biCompression, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biSizeImage, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biXPelsPerMeter, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biYPelsPerMeter, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biClrUsed, sizeof (DWORD32), 1); + MGUI_RWwrite (fp, &bmih.biClrImportant, sizeof (DWORD32), 1); for (i = bmp->h - 1; i >= 0; i--) { bmpGetHighCScanline (bmp->bits + i * bmp->pitch, scanline, diff --git a/src/sysres/resmgr.c b/src/sysres/resmgr.c index 80351822..153927a1 100644 --- a/src/sysres/resmgr.c +++ b/src/sysres/resmgr.c @@ -470,17 +470,25 @@ int AddResPath(const char* paths) int SetResPath(const char* path) { - if(path == NULL) - //ERR_RETV(RES_RET_INVALID_PARAM, RES_RET_INVALID_PARAM, "param path is null"); + if(path == NULL) { +#ifdef _DEBUG + ERR_RETV (RES_RET_INVALID_PARAM, RES_RET_INVALID_PARAM, "param path is null"); +#else return RES_RET_INVALID_PARAM; +#endif + } //test path is valid directory #if !defined(__NOUNIX__) && !defined(WIN32) struct stat buf; - if(stat(path, &buf) != 0 || !S_ISDIR(buf.st_mode)) - //ERR_RETV(RES_RET_INVALID_PARAM,RES_RET_INVALID_PARAM, "param path (%s) is not a valid directory", path); + if(stat(path, &buf) != 0 || !S_ISDIR(buf.st_mode)) { +# ifdef _DEBUG + ERR_RETV (RES_RET_INVALID_PARAM, RES_RET_INVALID_PARAM, "param path (%s) is not a valid directory", path); +# else return RES_RET_INVALID_PARAM; #endif + } +#endif if(usr_res_path != NULL) DELETE(usr_res_path); @@ -493,9 +501,13 @@ int SetResPath(const char* path) int AddInnerRes(INNER_RES* inner_res, int count, BOOL bcopy) { int i; - if(inner_res == NULL || count <= 0) - //ERR_RETV(RES_RET_INVALID_PARAM,RES_RET_INVALID_PARAM,"param inner_res is null or count is less zero"); + if (inner_res == NULL || count <= 0) { +#ifdef _DEBUG + ERR_RETV (RES_RET_INVALID_PARAM, RES_RET_INVALID_PARAM, "param inner_res is null or count is less zero"); +#else return RES_RET_INVALID_PARAM; +#endif + } RES_LOCK(); @@ -535,13 +547,23 @@ int AddSharedRes(const char* shared_name) int RegisterResType(int type, RES_TYPE_OPS* ops) { RES_TYPE_INFO *info; - if((type >= 0 && type < RES_TYPE_USER)) - //ERR_RETV(RES_RET_INVALID_PARAM, RES_RET_INVALID_PARAM, "cannot register a predefined type(%d)", type); + if ((type >= 0 && type < RES_TYPE_USER)) { +#ifdef _DEBUG + ERR_RETV(RES_RET_INVALID_PARAM, RES_RET_INVALID_PARAM, "cannot register a predefined type(%d)", type); +#else return RES_RET_INVALID_PARAM; +#endif + } - if(type >= RES_TYPE_USER_MAX || ops == NULL) - //ERR_RETV(RES_RET_INVALID_PARAM,RES_RET_INVALID_PARAM, "cannot register a null ops(%p) or type(%d) is invalid(type must be in %d-%d)", ops, type, RES_TYPE_USER, RES_TYPE_USER_MAX-1); + if (type >= RES_TYPE_USER_MAX || ops == NULL) { +#ifdef _DEBUG + ERR_RETV(RES_RET_INVALID_PARAM, RES_RET_INVALID_PARAM, + "cannot register a null ops(%p) or type(%d) is invalid(type must be in %d-%d)", + ops, type, RES_TYPE_USER, RES_TYPE_USER_MAX-1); +#else return RES_RET_INVALID_PARAM; +#endif + } RES_LOCK(); if((info = get_res_type_info(type))) @@ -560,9 +582,13 @@ int RegisterResType(int type, RES_TYPE_OPS* ops) int UnregisterResType(int type) { - if(type >= 0 && type < RES_TYPE_USER) - //ERR_RETV(RES_RET_INVALID_PARAM,RES_RET_INVALID_PARAM, "cannot unregister predefined type(%d)", type); + if(type >= 0 && type < RES_TYPE_USER) { +#ifdef _DEBUG + ERR_RETV (RES_RET_INVALID_PARAM, RES_RET_INVALID_PARAM, "cannot unregister predefined type(%d)", type); +#else return RES_RET_INVALID_PARAM; +#endif + } RES_LOCK(); delete_user_type(type); @@ -646,9 +672,13 @@ void* LoadResource(const char* res_name, int type, DWORD usr_param) void *data = NULL; char szfilename[MAX_PATH+1]={0}; - if(res_name == NULL) - //ERR_RETV(NULL, NULL, "param res_name is NULL"); + if (res_name == NULL) { +#ifdef _DEBUG + ERR_RETV (NULL, type, "param res_name is NULL"); +#else return NULL; +#endif + } RES_LOCK(); key = Str2Key(res_name); @@ -656,24 +686,33 @@ void* LoadResource(const char* res_name, int type, DWORD usr_param) entry = get_entry(&hash_table, key, TRUE); if(entry == NULL){ RES_UNLOCK(); - //ERR_RETV(NULL, NULL, "%s is not exists", res_name); +#ifdef _DEBUG + ERR_RETV(NULL, type, "%s is not exists", res_name); +#else return NULL; +#endif } ti = get_res_type_info(type); if(ti == NULL){ RES_UNLOCK(); - //ERR_RETV(NULL, NULL, "type(%d) is invalid", type); +#ifdef _DEBUG + ERR_RETV (NULL, type, "type(%d) is invalid", type); +#else return NULL; +#endif } if(!IsUsed(entry) || entry->type == RES_TYPE_INVALID) entry->type = type; else if(entry->type != type){ RES_UNLOCK(); - //ERR_RETV(NULL, NULL, "type is not match(resource\' type:%d != type:%d)", entry->type, type); +#ifdef _DEBUG + ERR_RETV (NULL, type, "type is not match(resource\' type:%d != type:%d)", entry->type, type); +#else return NULL; +#endif } if(!IsUsed(entry)) //try load entry from file @@ -709,17 +748,25 @@ void* GetResource(RES_KEY key) { RES_ENTRY * entry; - if(key == RES_KEY_INVALID) - //ERR_RETV(NULL, NULL, "key(%x) is invalid", key); + if(key == RES_KEY_INVALID) { +#ifdef _DEBUG + ERR_RETV (NULL, -1, "key(%x) is invalid", key); +#else return NULL; +#endif + } RES_LOCK(); entry = get_entry(&hash_table, key, FALSE); RES_UNLOCK(); - if(entry == NULL || entry->data == NULL) - //ERR_RETV(NULL, NULL, "data is not exist"); + if (entry == NULL || entry->data == NULL) { +#ifdef _DEBUG + ERR_RETV (NULL, -1, "data is not exist"); +#else return NULL; +#endif + } return entry->data; } @@ -731,9 +778,13 @@ int AddResRef(RES_KEY key) RES_LOCK(); entry = get_entry(&hash_table, key,FALSE); RES_UNLOCK(); - if(entry == NULL) - //ERR_RETV(-1, -1, "resouce is not exist(key=%x)", key); + if (entry == NULL) { +#ifdef _DEBUG + ERR_RETV (-1, -1, "resouce is not exist(key=%x)", key); +#else return -1; +#endif + } return ++entry->refcnt ; } @@ -789,7 +840,7 @@ RES_KEY Str2Key (const char* str) #ifdef _DEBUG static void res_error(int type, const char* funcname, const char* strinfo, ... ) { - char szformat[256]="\0"; + char strbuff [256]; static const char* errinfo[]={ "invalid param", "key is not exits", @@ -799,18 +850,16 @@ static void res_error(int type, const char* funcname, const char* strinfo, ... ) "not implement", "res is in used" }; + va_list va; - if(szformat){ - va_list va; - va_start(va, strinfo); - vsprintf(szformat, strinfo, va); - } + va_start (va, strinfo); + vsnprintf (strbuff, 255, strinfo, va); fprintf (stderr, "SYSRES: (@%s)%s(ret %d): %s\n", funcname?funcname:"<>", type>=1&&type<=RES_RET_INUSED?errinfo[type-1]:"", type, - szformat); + strbuff); } #endif diff --git a/src/sysres/resource.c b/src/sysres/resource.c index d6661eb0..c830a27e 100644 --- a/src/sysres/resource.c +++ b/src/sysres/resource.c @@ -211,12 +211,12 @@ void TermRendererSystemIcon (HICON *small_icon, HICON GUIAPI GetLargeSystemIconEx (HWND hWnd, int iItem) { - return GetWindowElementAttr (hWnd, WE_ATTR_TYPE_LARGEICON | iItem); + return (HICON)GetWindowElementAttr (hWnd, WE_ATTR_TYPE_LARGEICON | iItem); } HICON GUIAPI GetSmallSystemIconEx (HWND hWnd, int iItem) { - return GetWindowElementAttr (hWnd, WE_ATTR_TYPE_SMALLICON | iItem); + return (HICON)GetWindowElementAttr (hWnd, WE_ATTR_TYPE_SMALLICON | iItem); } HICON GUIAPI LoadSystemIcon (const char* szItemName, int which) From 8b6731d706b085e7832a3d7b732ae729fd8f87ed Mon Sep 17 00:00:00 2001 From: VincentWei Date: Thu, 18 Jan 2018 09:57:50 +0800 Subject: [PATCH 04/26] tune code for 64-bit --- src/gui/window.c | 3 +- src/newgal/RLEaccel.c | 5 +-- src/newgal/fbcon/fb3dfx.c | 10 +++--- src/newgal/fbcon/fbneomagic.c | 2 +- src/newgal/pcxvfb/pcxvfb.c | 10 ++++-- src/newgal/stretch.c | 2 -- src/newgal/video.c | 8 +---- src/newgdi/bidi.c | 7 +++- src/newgdi/bitmap.c | 8 ++--- src/newgdi/drawtext.c | 2 +- src/newgdi/gdi.c | 2 +- src/newgdi/icon.c | 62 ++++++++++++++++++++++++----------- src/newgdi/miarc.c | 7 ++-- src/newgdi/miwideline.c | 8 +++-- src/newgdi/rotatebmp.c | 6 ++-- src/newgdi/tabbedtextout.c | 6 ++-- src/textedit/mtextedit.c | 15 +++------ src/textedit/object.c | 15 ++++++--- src/textedit/object.h | 21 ++++++++---- 19 files changed, 119 insertions(+), 80 deletions(-) diff --git a/src/gui/window.c b/src/gui/window.c index d3270320..27270b90 100644 --- a/src/gui/window.c +++ b/src/gui/window.c @@ -5838,12 +5838,11 @@ static RECT4MASK* CalcXYBannedRects (HDC hdc, const void* mask, int * rect_size, int pitch = bmp->bmAlphaPitch; sA = bmp->bmAlphaMask[y * pitch + x/bmp->bmBytesPerPixel]; DISEMBLE_RGB (p, bpp, pixfmt, pixel, sR, sG, sB); - sR += sG + sB; /* suspend the warning */ } else { DISEMBLE_RGBA (p, bpp, pixfmt, pixel, sR, sG, sB, sA); - sR += sG + sB; /* suspend the warning */ } + sR ^= sG & sB; /* prevent unused-but-set-variable warning */ } else { pixel = bits [y * ((MYBITMAP*)mask)->pitch + x]; diff --git a/src/newgal/RLEaccel.c b/src/newgal/RLEaccel.c index 13249722..d08db111 100644 --- a/src/newgal/RLEaccel.c +++ b/src/newgal/RLEaccel.c @@ -1210,9 +1210,8 @@ static int RLEColorkeySurface(GAL_Surface *surface) Uint8 *rlebuf, *dst; int maxn; int y; - Uint8 *srcbuf, *curbuf, *lastline; + Uint8 *srcbuf, *lastline; int maxsize = 0; - int skip, run; int bpp = surface->format->BytesPerPixel; getpix_func getpix; Uint32 ckey, rgbmask; @@ -1246,9 +1245,7 @@ static int RLEColorkeySurface(GAL_Surface *surface) /* Set up the conversion */ srcbuf = (Uint8 *)surface->pixels+surface->offset; - curbuf = srcbuf; maxn = bpp == 4 ? 65535 : 255; - skip = run = 0; dst = rlebuf; rgbmask = ~surface->format->Amask; ckey = surface->format->colorkey & rgbmask; diff --git a/src/newgal/fbcon/fb3dfx.c b/src/newgal/fbcon/fb3dfx.c index 86179105..cda0f062 100644 --- a/src/newgal/fbcon/fb3dfx.c +++ b/src/newgal/fbcon/fb3dfx.c @@ -55,7 +55,7 @@ static int FillHWRect(_THIS, GAL_Surface *dst, GAL_Rect *rect, Uint32 color) /* Execute the fill command */ tdfx_wait(6); - tdfx_out32(DSTBASE, (Uint32)dst_base); + tdfx_out32(DSTBASE, (UINT_PTR)dst_base); tdfx_out32(DSTFORMAT, format); tdfx_out32(COLORFORE, color); tdfx_out32(COMMAND_2D, COMMAND_2D_FILLRECT); @@ -73,7 +73,7 @@ static int HWAccelBlit(GAL_Surface *src, GAL_Rect *srcrect, GAL_VideoDevice *this = current_video; int bpp; Uint32 src_format; - Uint32 dst_format; + /* Uint32 dst_format; */ char *src_base; char *dst_base; int srcX, srcY; @@ -89,7 +89,7 @@ static int HWAccelBlit(GAL_Surface *src, GAL_Rect *srcrect, src_format = src->pitch | ((bpp+((bpp==8) ? 0 : 8)) << 13); dst_base = (char *)((char *)dst->pixels - mapped_mem); bpp = dst->format->BitsPerPixel; - dst_format = dst->pitch | ((bpp+((bpp==8) ? 0 : 8)) << 13); + /* dst_format = dst->pitch | ((bpp+((bpp==8) ? 0 : 8)) << 13); */ srcX = srcrect->x; srcY = srcrect->y; @@ -120,9 +120,9 @@ static int HWAccelBlit(GAL_Surface *src, GAL_Rect *srcrect, use_colorkey = 0; } tdfx_wait(9); - tdfx_out32(SRCBASE, (Uint32)src_base); + tdfx_out32(SRCBASE, (UINT_PTR)src_base); tdfx_out32(SRCFORMAT, src_format); - tdfx_out32(DSTBASE, (Uint32)dst_base); + tdfx_out32(DSTBASE, (UINT_PTR)dst_base); tdfx_out32(DSTFORMAT, src_format); tdfx_out32(COMMAND_2D, blitop); tdfx_out32(COMMANDEXTRA_2D, use_colorkey); diff --git a/src/newgal/fbcon/fbneomagic.c b/src/newgal/fbcon/fbneomagic.c index 27304ed7..849090f1 100644 --- a/src/newgal/fbcon/fbneomagic.c +++ b/src/newgal/fbcon/fbneomagic.c @@ -99,7 +99,7 @@ static int FillHWRect(_THIS, GAL_Surface *dst, GAL_Rect *rect, Uint32 color) NEO_BC0_SRC_IS_FG | NEO_BC3_SKIP_MAPPING | 0x0c0000; - neo2200->dstStart = (Uint32) dst_base + + neo2200->dstStart = (UINT_PTR) dst_base + (rect->y * dst->pitch) + (rect->x * dst->format->BytesPerPixel); diff --git a/src/newgal/pcxvfb/pcxvfb.c b/src/newgal/pcxvfb/pcxvfb.c index d4c27f05..2ef7db18 100644 --- a/src/newgal/pcxvfb/pcxvfb.c +++ b/src/newgal/pcxvfb/pcxvfb.c @@ -516,7 +516,13 @@ static int PCXVFB_VideoInit (_THIS, GAL_PixelFormat *vformat) return -1; } } - read(__mg_pcxvfb_client_sockfd, &shmid, sizeof(int)); + + if (read(__mg_pcxvfb_client_sockfd, &shmid, sizeof(int)) < sizeof (int)) { + GAL_SetError ("NEWGAL>PCXVFB: read error from client socket.\n"); + close (__mg_pcxvfb_client_sockfd); + close (__mg_pcxvfb_server_sockfd); + return -1; + } if (shmid != -1) { data->shmrgn = (unsigned char *)shmat (shmid, 0, 0); @@ -548,7 +554,7 @@ static int PCXVFB_VideoInit (_THIS, GAL_PixelFormat *vformat) #endif #endif //end of os (windows, cygwin, linux) - if ((int)data->shmrgn == -1 || data->shmrgn == NULL) { + if ((INT_PTR)data->shmrgn == -1 || data->shmrgn == NULL) { GAL_SetError ("NEWGAL>PCXVFB: Unable to attach to " "virtual FrameBuffer server.\n"); return -1; diff --git a/src/newgal/stretch.c b/src/newgal/stretch.c index 1aef1032..ef140b13 100644 --- a/src/newgal/stretch.c +++ b/src/newgal/stretch.c @@ -157,7 +157,6 @@ int GAL_SoftStretch(GAL_Surface *src, GAL_Rect *srcrect, GAL_Surface *dst, GAL_Rect *dstrect) { int pos, inc; - int dst_width; int dst_maxrow; int src_row, dst_row; Uint8 *srcp = NULL; @@ -209,7 +208,6 @@ int GAL_SoftStretch(GAL_Surface *src, GAL_Rect *srcrect, inc = (srcrect->h << 16) / dstrect->h; src_row = srcrect->y; dst_row = dstrect->y; - dst_width = dstrect->w*bpp; #ifdef USE_ASM_STRETCH /* Write the opcodes for this stretch */ diff --git a/src/newgal/video.c b/src/newgal/video.c index c6f51e55..b4b0da25 100644 --- a/src/newgal/video.c +++ b/src/newgal/video.c @@ -925,13 +925,7 @@ static GAL_Surface *Slave_CreateSurface (GAL_VideoDevice *this, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) { - GAL_Surface *screen, *surface; - - if (this) { - screen = this->screen; - } else { - screen = NULL; - } + GAL_Surface *surface; surface = (GAL_Surface *)malloc(sizeof(*surface)); diff --git a/src/newgdi/bidi.c b/src/newgdi/bidi.c index b98c042a..6492ced6 100644 --- a/src/newgdi/bidi.c +++ b/src/newgdi/bidi.c @@ -364,11 +364,16 @@ static int _gdi_output_glyphs_direct(PDC pdc, const unsigned char* text, int prev_len = 0; const unsigned char* prev_mchar = NULL; int i = 0; - int limit_width = -1, line_width = 0; + int line_width = 0; DRAWTEXTEX2_CTXT* ctxt = (DRAWTEXTEX2_CTXT*)context; + +#if 0 + int limit_width = -1; if(if_break){ limit_width = ctxt->max_extent; } +#endif + while (left_bytes > 0){ if(mbc_devfont){ len_cur_char = mbc_devfont->charset_ops->len_first_char diff --git a/src/newgdi/bitmap.c b/src/newgdi/bitmap.c index 97ba7a5e..f4dfe4e4 100644 --- a/src/newgdi/bitmap.c +++ b/src/newgdi/bitmap.c @@ -2486,14 +2486,14 @@ void GUIAPI ExpandPart16CBitmapEx (HDC hdc, BYTE* bits, Uint32 pitch, const BYTE Uint32 x, y; BYTE *dst, *dst_line; const BYTE *src, *src_line; - int index, bpp; + int index; + //int bpp; Uint32 pixel; BYTE byte = 0; int bnum,continum,i; - pdc = dc_HDC2PDC(hdc); - bpp = GAL_BytesPerPixel (pdc->surface); + // bpp = GAL_BytesPerPixel (pdc->surface); dst_line = bits; if (flags & MYBMP_FLOW_UP) @@ -2945,7 +2945,6 @@ void GUIAPI HFlipBitmap (BITMAP* bmp, unsigned char* inter_buff) void GUIAPI VFlipBitmap (BITMAP* bmp, unsigned char* inter_buff) { int y; - int bpp; unsigned char* sline, *dline; if (bmp->bmType & BMP_TYPE_ALPHA_MASK) { @@ -2967,7 +2966,6 @@ void GUIAPI VFlipBitmap (BITMAP* bmp, unsigned char* inter_buff) free(alpha_inter_buff); } - bpp = bmp->bmBytesPerPixel; sline = bmp->bmBits; dline = bmp->bmBits + bmp->bmPitch * bmp->bmHeight; diff --git a/src/newgdi/drawtext.c b/src/newgdi/drawtext.c index 10da0120..35a5461a 100644 --- a/src/newgdi/drawtext.c +++ b/src/newgdi/drawtext.c @@ -289,7 +289,7 @@ static BOOL cb_drawtextex2 (void* context, Glyph32 glyph_value, int glyph_type) { DRAWTEXTEX2_CTXT* ctxt = (DRAWTEXTEX2_CTXT*)context; - int adv_x, adv_y; + int adv_x = 0, adv_y = 0; BBOX bbox; int bkmode; diff --git a/src/newgdi/gdi.c b/src/newgdi/gdi.c index 5616cec1..63571f64 100644 --- a/src/newgdi/gdi.c +++ b/src/newgdi/gdi.c @@ -608,7 +608,7 @@ static void _dc_draw_pixel_span_set_2 (COMP_CTXT* comp_ctxt, int w) | (Uint16)comp_ctxt->cur_pixel); Uint32 * dest32; int count; - if ((Uint32)comp_ctxt->cur_dst & 3) // Ensure 4-byte alignment. + if ((UINT_PTR)comp_ctxt->cur_dst & 3) // Ensure 4-byte alignment. { *dest16++ = (Uint16)comp_ctxt->cur_pixel; --w; diff --git a/src/newgdi/icon.c b/src/newgdi/icon.c index e81f568b..616a22c0 100644 --- a/src/newgdi/icon.c +++ b/src/newgdi/icon.c @@ -109,18 +109,18 @@ static void read_bmicolors_m (int ncols, RGB *pal, const Uint8 *p) HICON GUIAPI LoadIconFromFile (HDC hdc, const char* filename, int which) { FILE* fp; - WORD wTemp; + WORD16 wTemp; BYTE bTemp; int w, h, colornum; - DWORD size, offset; - DWORD imagesize, imagew, imageh; + DWORD32 offset; + DWORD32 imagesize; BYTE* image; HICON icon = 0; RGB pal[256]; - if( !(fp = fopen(filename, "rb")) ) return 0; + if (!(fp = fopen (filename, "rb"))) return 0; - fseek(fp, sizeof(WORD), SEEK_SET); + fseek (fp, sizeof (WORD16), SEEK_SET); /* the cbType of struct ICONDIR.*/ wTemp = MGUI_ReadLE16FP (fp); @@ -151,14 +151,25 @@ HICON GUIAPI LoadIconFromFile (HDC hdc, const char* filename, int which) wTemp = MGUI_ReadLE16FP (fp); /* the wBitCount*/ if(wTemp > 8) goto error; +#if 0 + DWORD32 size; size = MGUI_ReadLE32FP (fp); +#else + fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the wSize member.*/ +#endif offset = MGUI_ReadLE32FP (fp); /* read the cursor image info. */ fseek(fp, offset, SEEK_SET); - fseek(fp, sizeof(DWORD), SEEK_CUR); /* skip the biSize member.*/ + fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biSize member.*/ +#if 0 + DWORD32 imagew, imageh; imagew = MGUI_ReadLE32FP (fp); imageh = MGUI_ReadLE32FP (fp); +#else + fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biWidth member.*/ + fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biHeight member.*/ +#endif /* check the biPlanes member;*/ wTemp = MGUI_ReadLE16FP (fp); @@ -169,7 +180,7 @@ HICON GUIAPI LoadIconFromFile (HDC hdc, const char* filename, int which) if(wTemp > 8) goto error; colornum = (int)wTemp; - fseek(fp, sizeof(DWORD), SEEK_CUR); /* skip the biCompression members.*/ + fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biCompression members.*/ if (colornum == 1) imagesize = align_32_bits(w>>3) * h; @@ -179,10 +190,10 @@ HICON GUIAPI LoadIconFromFile (HDC hdc, const char* filename, int which) imagesize = align_32_bits(w) * h; imagesize += align_32_bits(w>>3) * h; - fseek(fp, sizeof(DWORD), SEEK_CUR); + fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the rest members and the color table.*/ - fseek(fp, sizeof(DWORD)*4, SEEK_CUR); + fseek(fp, sizeof(DWORD32)*4, SEEK_CUR); read_bmicolors_f (1 << colornum, pal, fp); /* allocate memory for image.*/ @@ -195,12 +206,15 @@ HICON GUIAPI LoadIconFromFile (HDC hdc, const char* filename, int which) goto error; /* read image*/ - fread (image, imagesize, 1, fp); + if (fread (image, imagesize, 1, fp) < imagesize) { + goto error_free; + } icon = CreateIconEx (hdc, w, h, image + (imagesize - (align_32_bits(w>>3) * h)), image, colornum, pal); +error_free: #ifndef HAVE_ALLOCA free (image); #endif @@ -213,15 +227,15 @@ error: HICON GUIAPI LoadIconFromMem (HDC hdc, const void* area, int which) { const Uint8* p = (Uint8*)area; - WORD wTemp; + WORD16 wTemp; BYTE bTemp; int w, h, colornum; - DWORD size, offset; - DWORD imagesize, imagew, imageh; + DWORD32 offset; + DWORD32 imagesize; RGB pal[256]; - p += sizeof (WORD); + p += sizeof (WORD16); /* the cbType of struct ICONDIR.*/ wTemp = MGUI_ReadLE16Mem (&p); @@ -252,15 +266,25 @@ HICON GUIAPI LoadIconFromMem (HDC hdc, const void* area, int which) if (wTemp != 0 && wTemp != 1) goto error; wTemp = MGUI_ReadLE16Mem (&p); /* the wBitCount */ if (wTemp > 8) goto error; +#if 0 + DWORD32 size; size = MGUI_ReadLE32Mem (&p); +#else + p += sizeof(DWORD32); +#endif offset = MGUI_ReadLE32Mem (&p); /* read the cursor image info. */ p = (Uint8*)area + offset; /* skip the biSize member. */ - p += sizeof(DWORD); + p += sizeof(DWORD32); +#if 0 + DWORD32 imagew, imageh; imagew = MGUI_ReadLE32Mem (&p); imageh = MGUI_ReadLE32Mem (&p); +#else + p += sizeof(DWORD32); +#endif /* check the biPlanes member; */ wTemp = MGUI_ReadLE16Mem (&p); if (wTemp != 1) goto error; @@ -269,7 +293,7 @@ HICON GUIAPI LoadIconFromMem (HDC hdc, const void* area, int which) if (wTemp > 8) goto error; colornum = (int)wTemp; /* skip the biCompression members. */ - p += sizeof (DWORD); + p += sizeof (DWORD32); if (colornum == 1) imagesize = align_32_bits(w>>3) * h; @@ -279,10 +303,10 @@ HICON GUIAPI LoadIconFromMem (HDC hdc, const void* area, int which) imagesize = align_32_bits(w) * h; imagesize += align_32_bits(w>>3) * h; - p += sizeof (DWORD); + p += sizeof (DWORD32); /* skip the rest members and the color table. */ - p += sizeof(DWORD)*4; + p += sizeof(DWORD32)*4; read_bmicolors_m (1 << colornum, pal, p); p += sizeof(BYTE)*(4<surface); if( (w%16) != 0 || (h%16) != 0 ) return 0; diff --git a/src/newgdi/miarc.c b/src/newgdi/miarc.c index e36ff4db..90e8edd2 100644 --- a/src/newgdi/miarc.c +++ b/src/newgdi/miarc.c @@ -1,7 +1,7 @@ /* $Id: miarc.c 12871 2010-05-07 06:13:42Z wanzheng $ */ /*********************************************************** -Copyright (C) 2005 ~ 2007 Feynman Software +Copyright (C) 2005 ~ 2018 FMSoft Copyright 1987, 1998 The Open Group @@ -1465,7 +1465,6 @@ static int miGetArcPts (SppArcPtr parc, int cpt, SppPointPtr *ppPts) xc, yc; /* the center point */ int count, i; SppPointPtr poly; - POINT last; /* last point on integer boundaries */ /* The spec says that positive angles indicate counterclockwise motion. * Given our coordinate system (with 0,0 in the upper left corner), @@ -1512,8 +1511,12 @@ static int miGetArcPts (SppArcPtr parc, int cpt, SppPointPtr *ppPts) poly[cpt].x = (xc + x0); poly[cpt].y = (yc + y0); + +#if 0 + POINT last; /* last point on integer boundaries */ last.x = ROUNDTOINT( poly[cpt + 1].x = (xc + x1) ); last.y = ROUNDTOINT( poly[cpt + 1].y = (yc + y1) ); +#endif for(i = 2; i < count; i++) { diff --git a/src/newgdi/miwideline.c b/src/newgdi/miwideline.c index 041b452e..d818933d 100644 --- a/src/newgdi/miwideline.c +++ b/src/newgdi/miwideline.c @@ -1374,19 +1374,23 @@ static void miWideDashSegment (PDC pdc, SpanDataPtr spanData, int* pDashOffset, double saveK = 0.0; BOOL first = TRUE; double lcenterx, lcentery, rcenterx = 0.0, rcentery = 0.0; - gal_pixel fgPixel, bgPixel; dx = x2 - x1; dy = y2 - y1; dashIndex = *pDashIndex; pDash = pdc->dash_list; dashRemain = pDash[dashIndex] - *pDashOffset; + +#if 0 + gal_pixel fgPixel; + gal_pixel bgPixel; + fgPixel = pdc->pencolor; bgPixel = pdc->bkcolor; - if (pdc->brush_type == BT_OPAQUE_STIPPLED || pdc->brush_type == BT_TILED) { bgPixel = fgPixel; } +#endif l = ((double) pdc->pen_width) / 2.0; if (dx == 0) { diff --git a/src/newgdi/rotatebmp.c b/src/newgdi/rotatebmp.c index d0142771..f3b22bda 100644 --- a/src/newgdi/rotatebmp.c +++ b/src/newgdi/rotatebmp.c @@ -149,7 +149,7 @@ static void _parallelogram_map(HDC hdc, const BITMAP *bmp, fixed sx[4], int right_index; /* Loop variables. */ - int index, i, y; + int index, i; /* Coordinates in bmp ordered as top-right-bottom-left. */ fixed corner_dc_x[4], corner_dc_y[4]; @@ -329,7 +329,9 @@ static void _parallelogram_map(HDC hdc, const BITMAP *bmp, fixed sx[4], } fill_info.dst_rect.h = 1; - y = 0; +#if 0 + int y = 0; +#endif while (1) { if (scanline > MIN(dc_maxh, fixtoi(bottom_dc_y))) break; diff --git a/src/newgdi/tabbedtextout.c b/src/newgdi/tabbedtextout.c index 6dc35e69..c89e19d5 100644 --- a/src/newgdi/tabbedtextout.c +++ b/src/newgdi/tabbedtextout.c @@ -366,12 +366,14 @@ int _gdi_tabbedex_text_out (PDC pdc, int x, int y, int nTabs, int *pTabPos, int nTabOrig, POINT* cur_pos) { TABBEDTEXTOUTEX_CTXT ctxt; - DEVFONT* sbc_devfont; - DEVFONT* mbc_devfont; int nr_delim_newline = 0, line_len = 0; +#if 0 + DEVFONT* sbc_devfont; + DEVFONT* mbc_devfont; sbc_devfont = pdc->pLogFont->sbc_devfont; mbc_devfont = pdc->pLogFont->mbc_devfont; +#endif ctxt.pdc = pdc; ctxt.start_x = x; diff --git a/src/textedit/mtextedit.c b/src/textedit/mtextedit.c index 93f79bda..bfac2020 100644 --- a/src/textedit/mtextedit.c +++ b/src/textedit/mtextedit.c @@ -432,7 +432,7 @@ static int mTextBuffer_find(mTextBuffer* self, int start, if(start >= self->char_len) return -1; - if((int)str == TI_LINERETURN || (int) str == TI_EOF) + if((INT_PTR)str == TI_LINERETURN || (INT_PTR)str == TI_EOF) { pos = findnstr(self->buffer + start, self->char_len - start, "\n", 1); } @@ -1155,13 +1155,10 @@ static void textlayout_updateselection(mTextLayout* self) && self->old_height != self->new_height) { int max; - int min; if(self->old_height > self->new_height) { - min = self->new_height; max = self->old_height; }else{ - min = self->old_height; max = self->new_height; } @@ -1367,7 +1364,7 @@ static void textlayout_relayout(mTextLayout* self, int begin, { mTextLayoutNodeSearchInfo searchInfo; mTextLayoutNode *begin_node=NULL, *end_node = NULL; - int begin_index, end_index; + int begin_index; ITextIterator* txtit; mCommBTreeLeafIterator node_it; BOOL bHeightChanged = FALSE; /* Very important for unequal height*/ @@ -1393,7 +1390,7 @@ static void textlayout_relayout(mTextLayout* self, int begin, if(begin_node == NULL) { end_node = begin_node = textlayout_get_last_node(self, FALSE); - end_index = begin_index = textlayout_get_str_count(self); + begin_index = textlayout_get_str_count(self); } else { @@ -6405,7 +6402,6 @@ static int mTextEditor_wndProc(mTextEditor *self, int message, WPARAM wParam, LP static void mTextEditor_setTitle(mTextEditor* self, const char* buff, int len) { //repalce - int old_title_idx; int slen ; if(!(GetWindowStyle(self->hwnd) & NCSS_TE_TITLE)) @@ -6417,7 +6413,6 @@ static void mTextEditor_setTitle(mTextEditor* self, const char* buff, int len) if(len <= 0) len = -1; - old_title_idx = self->title_idx; _c(pTextBuffer)->replace(pTextBuffer, 0, self->title_idx, buff, len); if(buff == NULL || len <= 0) { @@ -6555,7 +6550,7 @@ static void init_textedit(void) } /*======== The following is textedit control implementation. =========*/ -static int mTextEditCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT mTextEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { mTextEditor *self = NULL; @@ -6565,7 +6560,7 @@ static int mTextEditCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lPar switch(message) { case MSG_CREATE: - if (!(self = NEWEX(mTextEditor, hWnd))) + if (!(self = NEWEX(mTextEditor, (DWORD)hWnd))) return -1; SetWindowAdditionalData2 (hWnd, (DWORD)self); diff --git a/src/textedit/object.c b/src/textedit/object.c index f631afc2..9ff266ab 100644 --- a/src/textedit/object.c +++ b/src/textedit/object.c @@ -207,8 +207,13 @@ int ncsParseConstructParams(va_list args, const char* signature, ...) int argc; int i; + /* + ** the implementation of GET_ARG_COUNT is bad, because some systems + ** define va_list as a pointer, and others define it as an array of + ** pointers (of length 1). if(GET_ARG_COUNT(args) <= 0) return 0; + */ argc = va_arg(args, int); if(argc <= 0) @@ -226,11 +231,11 @@ int ncsParseConstructParams(va_list args, const char* signature, ...) break; case 'f': //float -/* FIXME gcc says: - * warning: 'float' is promoted to 'double' when passed through '...' - * warning: (so you should pass 'double' not 'float' to 'va_arg') - * note: if this code is reached, the program will abort. - */ + /* FIXME gcc says: + ** warning: 'float' is promoted to 'double' when passed through '...' + ** warning: (so you should pass 'double' not 'float' to 'va_arg') + ** note: if this code is reached, the program will abort. + */ *(va_arg(params, float*)) = va_arg(args, double); break; case 'i': //integer diff --git a/src/textedit/object.h b/src/textedit/object.h index e661af11..2ca7322e 100644 --- a/src/textedit/object.h +++ b/src/textedit/object.h @@ -56,12 +56,13 @@ static ClassType(clss) * clss##ClassConstructor(ClassType(clss)* _class); \ ClassType(clss) Class(clss) = { (PClassConstructor)clss##ClassConstructor }; \ static const char* clss##_type_name = #clss; \ static ClassType(clss) * clss##ClassConstructor(ClassType(clss)* _class) { \ - unsigned short * _pintfOffset; \ + unsigned short * _pintfOffset = NULL; \ + _pintfOffset = (PVOID)((UINT_PTR)_pintfOffset ^ 0); /* prevent unused-but-set-variable warning */ \ _class = (ClassType(clss)*)((PClassConstructor)(Class(superCls).classConstructor))((mObjectClass*)_class); \ + _pintfOffset = &_class->intfOffset; \ _class->super = &Class(superCls); \ _class->typeName = clss##_type_name; \ - _class->objSize = sizeof(clss); \ - _pintfOffset = &_class->intfOffset; + _class->objSize = sizeof(clss); #define END_MINI_CLASS return _class; } @@ -126,9 +127,9 @@ static ClassType(clss) * clss##ClassConstructor(ClassType(clss)* _class) { \ struct _##Interface { Interface##VTable *_vtable; }; #define IMPLEMENT(Clss,Interface) \ - _class->_##Interface##_obj_offset = (unsigned int)(void*)&(((Clss*)0)->Interface##_); \ + _class->_##Interface##_obj_offset = (UINT_PTR)(void*)&(((Clss*)0)->Interface##_); \ _class->_##Interface##_next_offset = 0; \ - *_pintfOffset = (unsigned short)(unsigned int)(void*)&(((ClassType(Clss)*)0)->_##Interface##_obj_offset); \ + *_pintfOffset = (unsigned short)(UINT_PTR)(void*)&(((ClassType(Clss)*)0)->_##Interface##_obj_offset); \ _pintfOffset = &_class->_##Interface##_next_offset; #define INTERFACE_CAST(Interface, pobj) \ @@ -266,12 +267,18 @@ MGNCS_EXPORT mObject* mgInitObjectArgs(mObject* pobj, mObjectClass* _class, ...) #define INIT_OBJ(Clss, pobj) INIT_OBJEX(Clss, pobj, 0) #define INIT_OBJV(Clss, pobj, ...) ((Clss* )initObjectArgs((mObject*)((void*)(pobj)), \ (mObjectClass*)((void*)(&(Class(Clss)))), ##__VA_ARGS__)) + +/* +** the implementation of GET_ARG_COUNT is bad, because some systems +** define va_list as a pointer, and others define it as an array of +** pointers (of length 1). static inline int MGGET_ARG_COUNT(va_list va) { union { va_list va; DWORD dva; - }_va; + } _va; + _va.va = va; if(_va.dva == 0) return 0; @@ -282,6 +289,8 @@ static inline int MGGET_ARG_COUNT(va_list va) return 1; } #define GET_ARG_COUNT MGGET_ARG_COUNT +*/ + #define UNIT_OBJ(pobj) (_c(pobj)->destroy(pobj)) From 786bb5f770f52bfd4663096c0008e2af91f3db5d Mon Sep 17 00:00:00 2001 From: VincentWei Date: Thu, 18 Jan 2018 10:53:36 +0800 Subject: [PATCH 05/26] tune code for 64-bit --- configure.ac | 56 ++++++++++++++++++++++++ src/control/bidiedit.c | 2 +- src/ex_ctrl/gridview.c | 20 ++++----- src/ex_ctrl/gridviewcelltype.c | 78 +++++++++++++++++----------------- src/ex_ctrl/listview.c | 18 ++++---- src/ex_ctrl/spinbox.c | 2 +- src/ex_ctrl/treeview.c | 28 ++++++------ src/ex_ctrl/treeview_rdr.c | 24 +++++------ src/gui/arabickeymap.c | 3 -- src/gui/hebrewkeymap.c | 3 -- src/ial/netial/netial.c | 3 +- 11 files changed, 143 insertions(+), 94 deletions(-) diff --git a/configure.ac b/configure.ac index 58973239..8fb20340 100644 --- a/configure.ac +++ b/configure.ac @@ -1687,6 +1687,62 @@ fi if test "x$devel_mode" = "xyes"; then use_debug="yes" trace_message="yes" + + build_auto_ial_engine="yes" + build_random_ial_engine="yes" + build_net_ial_engine="yes" + + build_qpf_support="yes" + use_ttf_lib="ft2" + + build_latin2_support="yes" + build_latin3_support="yes" + build_latin4_support="yes" + build_cyrillic_support="yes" + build_arabic_support="yes" + build_greek_support="yes" + build_hebrew_support="yes" + build_latin5_support="yes" + build_latin6_support="yes" + build_thai_support="yes" + build_latin7_support="yes" + build_latin8_support="yes" + build_latin10_support="yes" + + build_gb18030_support="yes" + build_big5_support="yes" + build_euckr_support="yes" + build_eucjp_support="yes" + build_shiftjis_support="yes" + + use_kbd_hebrewpc="yes" + use_kbd_arabicpc="yes" + use_kbd_frpc="yes" + use_kbd_fr="yes" + use_kbd_de="yes" + use_kbd_delatin1="yes" + use_kbd_it="yes" + use_kbd_es="yes" + use_kbd_escp850="yes" + + build_ctrl_bidisledit="yes" + build_ctrl_textedit="yes" + build_ctrl_monthcal="yes" + build_ctrl_treeview="yes" + build_ctrl_treeview_rdr="yes" + build_ctrl_spinbox="yes" + build_ctrl_coolbar="yes" + build_ctrl_listview="yes" + build_ctrl_iconview="yes" + build_ctrl_gridview="yes" + + enable_video_commlcd="yes" + enable_video_shadow="yes" + enable_video_mlshadow="yes" + enable_video_custom="yes" + + build_screensaver="yes" + CFLAGS="$CFLAGS -Werror" fi diff --git a/src/control/bidiedit.c b/src/control/bidiedit.c index 20dbf41a..ed703403 100644 --- a/src/control/bidiedit.c +++ b/src/control/bidiedit.c @@ -2466,7 +2466,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) unsigned char charBuffer [3]; int chars; - _MG_PRINTF("get char-----------------char----%x\n", wParam); + _MG_PRINTF("get char-----------------char----%lx\n", wParam); if (wParam == 127) // BS wParam = '\b'; diff --git a/src/ex_ctrl/gridview.c b/src/ex_ctrl/gridview.c index b61b96af..4527304c 100644 --- a/src/ex_ctrl/gridview.c +++ b/src/ex_ctrl/gridview.c @@ -911,7 +911,7 @@ static BOOL gridview_is_pt_in_control(gvGridViewData* view, int x, int y) if(cell != NULL) { HWND ctrl = cell->func->get_control(cell, view, row, col); - if(ctrl != -1 && gridview_is_pt_in_hwnd_rect(view->hCtrl, ctrl, x, y)) + if(ctrl != HWND_INVALID && gridview_is_pt_in_hwnd_rect(view->hCtrl, ctrl, x, y)) return TRUE; } return FALSE; @@ -1293,7 +1293,7 @@ static int gridview_init(HWND hWnd, GRIDVIEWDATA* data) // set window handles view->ctrl_id = GetDlgCtrlID(hWnd); view->hCtrl = hWnd; - view->hEdit = -1; + view->hEdit = HWND_INVALID; //initialize modal view->modal = GridDataModalArray_new_modal(data->nr_rows, data->nr_cols); //set table properties @@ -1616,7 +1616,7 @@ static LRESULT GridViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM int row, col; HDC hdc = BeginPaint(hWnd); - if(view->hEdit != -1) + if(view->hEdit != HWND_INVALID) { RECT r; GetWindowRect(view->hEdit, &r); @@ -1689,7 +1689,7 @@ static LRESULT GridViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM int x = LOSWORD (lParam); int y = HISWORD (lParam); - if(view->hEdit != -1) + if(view->hEdit != HWND_INVALID) { int row, col; if(!gridview_is_pt_in_hwnd_rect(view->hCtrl, view->hEdit, x, y)) @@ -1749,7 +1749,7 @@ static LRESULT GridViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM ScreenToClient(hWnd, &x, &y); ReleaseCapture(); } - else if(view->hEdit != -1) + else if(view->hEdit != HWND_INVALID) break; switch(view->mouse_status) @@ -1786,7 +1786,7 @@ static LRESULT GridViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM int y = HISWORD (lParam); GetClientRect(hWnd, &rect); - if(view->hEdit != -1) + if(view->hEdit != HWND_INVALID) break; is_capture = (GetCapture() == hWnd); if (is_capture) { @@ -1827,7 +1827,7 @@ static LRESULT GridViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM // MiniGUI key Messages {{{ case MSG_KEYDOWN: { - if(view->hEdit != -1) + if(view->hEdit != HWND_INVALID) return DefaultControlProc(hWnd, message, wParam, lParam); else { @@ -1971,7 +1971,7 @@ static LRESULT GridViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM RECT rect; if(view->current_row > 0 && view->current_col > 0) { - if (view->hEdit == -1 && isalnum(wParam)) + if (view->hEdit == HWND_INVALID && isalnum(wParam)) { get_cell_rect(view, view->current_row, view->current_col, &rect); gridview_make_rect_visible(view, &rect); @@ -1987,13 +1987,13 @@ static LRESULT GridViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM // MiniGUI scroll Messages {{{ case MSG_HSCROLL: { - if (view->hEdit != -1) + if (view->hEdit != HWND_INVALID) SendMessage(view->hEdit, MSG_KEYDOWN, SCANCODE_ENTER, 0); break; } case MSG_VSCROLL: { - if (view->hEdit != -1) + if (view->hEdit != HWND_INVALID) SendMessage(view->hEdit, MSG_KEYDOWN, SCANCODE_ENTER, 0); break; } diff --git a/src/ex_ctrl/gridviewcelltype.c b/src/ex_ctrl/gridviewcelltype.c index 948116e6..4b391627 100644 --- a/src/ex_ctrl/gridviewcelltype.c +++ b/src/ex_ctrl/gridviewcelltype.c @@ -59,7 +59,7 @@ static inline void GridCell_get_ctrl_rect(gvGridCellData* cell, gvGridViewData* // Editor Proc {{{ -static int GridCell_EditDefaultProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT GridCell_EditDefaultProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { GridCellEditData* editdata = (GridCellEditData*)GetWindowAdditionalData(hWnd); @@ -78,7 +78,7 @@ static int GridCell_EditDefaultProc(HWND hWnd, int message, WPARAM wParam, LPARA return editdata->old_proc(hWnd, message, wParam, lParam); } -static int GridCell_EditBgColorProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT GridCell_EditBgColorProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { GridCellEditData* editdata = (GridCellEditData*)GetWindowAdditionalData(hWnd); @@ -138,7 +138,7 @@ static void GridCell_SelectionNotify(HWND hWnd, int id, int nc, DWORD add_data) switch(nc) { case CBN_DROPDOWN: - if (editdata->view->hEdit != -1) + if (editdata->view->hEdit != HWND_INVALID) { if (editdata->view->hEdit != hWnd) { @@ -321,7 +321,7 @@ double GridCellTypeNull_get_double_value(gvGridCellData* cell, int row, int col) HWND GridCellTypeNull_get_control(gvGridCellData* cell, gvGridViewData* view, int row, int col) { - return (HWND)-1; + return HWND_INVALID; } void GridCellTypeNull_get_format(gvGridCellData* cell, HWND hWnd, HDC hdc, GridCellFormat* format) @@ -350,7 +350,7 @@ int GridCellTypeNull_draw(gvGridCellData* cell, gvGridViewData* view, is_highlight = FALSE; ctrl = cell->func->get_control(cell, view, row, col); - if(ctrl != -1) + if(ctrl != HWND_INVALID) { RECT r; GetWindowRect(ctrl, &r); @@ -887,12 +887,12 @@ HWND GridCellTypeText_create_edit_ctrl(gvGridViewData* view, gvGridCellData* cel if(real_cell == NULL || real_cell != cell) is_default = TRUE; if(cell == NULL) - return -1; + return HWND_INVALID; if( cell->style & GVS_MULTLINE ) ctrl_type = CTRL_MLEDIT; else ctrl_type = CTRL_SLEDIT; - if(view->hEdit != -1) + if(view->hEdit != HWND_INVALID) { editdata = (GridCellEditData*)GetWindowAdditionalData(view->hEdit); editdata->commit = FALSE; @@ -903,7 +903,7 @@ HWND GridCellTypeText_create_edit_ctrl(gvGridViewData* view, gvGridCellData* cel WS_CHILD|WS_VISIBLE, col, rect->left, rect->top, RECTWP(rect), RECTHP(rect), view->hCtrl, 0); - if(view->hEdit != -1) + if(view->hEdit != HWND_INVALID) { editdata = calloc(1, sizeof(GridCellEditData)); editdata->view = view; @@ -922,7 +922,7 @@ int GridCellTypeText_begin_edit(gvGridCellData* cell, gvGridViewData* view, int row, int col, RECT* rect) { RECT r; - HWND hEdit = -1; + HWND hEdit = HWND_INVALID; int len; char* text; if( gvGridCell_is_readonly(cell) ) @@ -933,7 +933,7 @@ int GridCellTypeText_begin_edit(gvGridCellData* cell, gvGridViewData* view, GridCell_get_ctrl_rect(cell, view, row, col, rect, &r); hEdit = GridCellTypeText_create_edit_ctrl(view, cell, row, col, &r, text); free(text); - if (hEdit != -1) + if (hEdit != HWND_INVALID) SetFocusChild(hEdit); return 0; } @@ -945,7 +945,7 @@ int GridCellTypeText_end_edit(gvGridCellData* cell, gvGridViewData* view, int ro gvGridCellData tmp_cell; gvGridCellData* p_cell = cell; GridCellEditData* editdata; - if(view->hEdit == -1) + if(view->hEdit == HWND_INVALID) return -1; editdata = (GridCellEditData*)GetWindowAdditionalData(hEdit); if(editdata->commit) @@ -965,7 +965,7 @@ int GridCellTypeText_end_edit(gvGridCellData* cell, gvGridViewData* view, int ro free(buf); } DestroyWindow(hEdit); - view->hEdit = -1; + view->hEdit = HWND_INVALID; free(editdata); InvalidateRect(view->hCtrl, NULL, FALSE); return 0; @@ -1179,7 +1179,7 @@ int GridCellTypeCheckBox_init(gvGridCellData* cell) memset(cell, 0, sizeof(gvGridCellData)); cell->celltype = GV_TYPE_CHECKBOX; cell->func = gvGridCellTypeCheckBox; - cell->data.checkbox.handle = -1; + cell->data.checkbox.handle = HWND_INVALID; return 0; } @@ -1244,7 +1244,7 @@ int GridCellTypeCheckBox_merge(gvGridCellData* cell, gvGridCellData* data) int GridCellTypeCheckBox_copy(gvGridCellData* to, gvGridCellData* from) { memcpy(to, from, sizeof(gvGridCellData)); - to->data.checkbox.handle = -1; + to->data.checkbox.handle = HWND_INVALID; to->data.checkbox.dirty = FALSE; if(from->data.checkbox.text != NULL) to->data.checkbox.text = strdup(from->data.checkbox.text); @@ -1318,8 +1318,8 @@ HWND GridCellTypeCheckBox_create_checkbox_ctrl(gvGridViewData* view, gvGridCellD HWND ctrl; GridCellEditData* editdata = NULL; if(cell == NULL) - return -1; - if(cell->data.checkbox.handle != -1) + return HWND_INVALID; + if(cell->data.checkbox.handle != HWND_INVALID) return cell->data.checkbox.handle; ctrl = CreateWindow(CTRL_BUTTON, text, @@ -1327,10 +1327,10 @@ HWND GridCellTypeCheckBox_create_checkbox_ctrl(gvGridViewData* view, gvGridCellD row*0x10000+col, rect->left, rect->top, RECTWP(rect), RECTHP(rect), view->hCtrl, 0); - if(ctrl == -1) + if(ctrl == HWND_INVALID) { - cell->data.checkbox.handle = -1; - return -1; + cell->data.checkbox.handle = HWND_INVALID; + return HWND_INVALID; } cell->data.checkbox.handle = ctrl; editdata = calloc(1, sizeof(GridCellEditData)); @@ -1360,7 +1360,7 @@ int GridCellTypeCheckBox_draw_content(gvGridCellData* cell, gvGridViewData* view if(EqualRect(&r_bound, &view->cells_rect)) { int checked = cell->data.checkbox.checked?BST_CHECKED:BST_UNCHECKED; - if(ctrl == -1) + if(ctrl == HWND_INVALID) { char* text = cell->data.checkbox.text; if(text == NULL) @@ -1383,11 +1383,11 @@ int GridCellTypeCheckBox_invisible_draw(gvGridCellData* cell, gvGridViewData* vi HDC hdc, int row, int col, RECT* rect) { HWND ctrl = cell->data.checkbox.handle; - if(ctrl != -1) + if(ctrl != HWND_INVALID) { GridCellEditData* editdata = (GridCellEditData*)GetWindowAdditionalData(ctrl); DestroyWindow(ctrl); - cell->data.checkbox.handle = -1; + cell->data.checkbox.handle = HWND_INVALID; free(editdata); } return 0; @@ -1407,7 +1407,7 @@ int GridCellTypeCheckBox_end_edit(gvGridCellData* cell, gvGridViewData* view, in if(cell == NULL) return -1; ctrl = cell->data.checkbox.handle; - if (ctrl == -1) + if (ctrl == HWND_INVALID) return -1; editdata = (GridCellEditData*)GetWindowAdditionalData(ctrl); if(editdata->commit) @@ -1430,12 +1430,12 @@ int GridCellTypeCheckBox_on_destroy(gvGridCellData* cell) free(cell->data.checkbox.text); cell->data.checkbox.text = NULL; } - if(cell->data.checkbox.handle != -1) + if(cell->data.checkbox.handle != HWND_INVALID) { HWND ctrl = cell->data.checkbox.handle; GridCellEditData* editdata = (GridCellEditData*)GetWindowAdditionalData(ctrl); DestroyWindow(ctrl); - cell->data.checkbox.handle = -1; + cell->data.checkbox.handle = HWND_INVALID; free(editdata); } return 0; @@ -1450,7 +1450,7 @@ int GridCellTypeSelection_init(gvGridCellData* cell) memset(cell, 0, sizeof(gvGridCellData)); cell->celltype = GV_TYPE_SELECTION; cell->func = gvGridCellTypeSelection; - cell->data.selection.handle = -1; + cell->data.selection.handle = HWND_INVALID; return 0; } @@ -1514,7 +1514,7 @@ int GridCellTypeSelection_merge(gvGridCellData* cell, gvGridCellData* data) int GridCellTypeSelection_copy(gvGridCellData* to, gvGridCellData* from) { memcpy(to, from, sizeof(gvGridCellData)); - to->data.selection.handle = -1; + to->data.selection.handle = HWND_INVALID; to->data.selection.dirty = FALSE; if(from->data.selection.text != NULL) to->data.selection.text = strdup(from->data.selection.text); @@ -1590,8 +1590,8 @@ HWND GridCellTypeSelection_create_selection_ctrl(gvGridViewData* view, gvGridCel char *tmp = NULL; if(cell == NULL) - return -1; - if(cell->data.selection.handle != -1) + return HWND_INVALID; + if(cell->data.selection.handle != HWND_INVALID) return cell->data.selection.handle; ctrl = CreateWindow(CTRL_COMBOBOX, @@ -1601,9 +1601,9 @@ HWND GridCellTypeSelection_create_selection_ctrl(gvGridViewData* view, gvGridCel rect->left, rect->top, RECTWP(rect), RECTHP(rect), view->hCtrl, 0); - if(ctrl == -1) { - cell->data.selection.handle = -1; - return -1; + if(ctrl == HWND_INVALID) { + cell->data.selection.handle = HWND_INVALID; + return HWND_INVALID; } do { @@ -1645,7 +1645,7 @@ int GridCellTypeSelection_draw_content(gvGridCellData* cell, gvGridViewData* vie GetBoundRect(&r_bound, &r, &view->cells_rect); if(EqualRect(&r_bound, &view->cells_rect)) { - if(ctrl == -1) + if(ctrl == HWND_INVALID) { char* text = cell->data.selection.text; if(text == NULL) @@ -1666,11 +1666,11 @@ int GridCellTypeSelection_invisible_draw(gvGridCellData* cell, gvGridViewData* v HDC hdc, int row, int col, RECT* rect) { HWND ctrl = cell->data.selection.handle; - if(ctrl != -1) + if(ctrl != HWND_INVALID) { GridCellEditData* editdata = (GridCellEditData*)GetWindowAdditionalData(ctrl); DestroyWindow(ctrl); - cell->data.selection.handle = -1; + cell->data.selection.handle = HWND_INVALID; free(editdata); } return 0; @@ -1690,7 +1690,7 @@ int GridCellTypeSelection_end_edit(gvGridCellData* cell, gvGridViewData* view, i if(cell == NULL) return -1; ctrl = cell->data.selection.handle; - if(ctrl == -1) + if(ctrl == HWND_INVALID) return -1; editdata = (GridCellEditData*)GetWindowAdditionalData(ctrl); index = SendMessage(ctrl, CB_GETCURSEL, 0, 0); @@ -1702,7 +1702,7 @@ int GridCellTypeSelection_end_edit(gvGridCellData* cell, gvGridViewData* view, i else cell->data.selection.cur_index = 0; if(view->hEdit == ctrl) - view->hEdit = -1; + view->hEdit = HWND_INVALID; return 0; } @@ -1713,12 +1713,12 @@ int GridCellTypeSelection_on_destroy(gvGridCellData* cell) free(cell->data.selection.text); cell->data.selection.text = NULL; } - if(cell->data.selection.handle != -1) + if(cell->data.selection.handle != HWND_INVALID) { HWND ctrl = cell->data.selection.handle; GridCellEditData* editdata = (GridCellEditData*)GetWindowAdditionalData(ctrl); DestroyWindow(ctrl); - cell->data.selection.handle = -1; + cell->data.selection.handle = HWND_INVALID; free(editdata); } return 0; diff --git a/src/ex_ctrl/listview.c b/src/ex_ctrl/listview.c index 8db35a2a..5828b721 100644 --- a/src/ex_ctrl/listview.c +++ b/src/ex_ctrl/listview.c @@ -1724,17 +1724,17 @@ static LRESULT ListViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM } else if (pprev) { ptmp = lvGetLastChild (plvdata, pprev); - hsvi = ptmp->addData; + hsvi = (HICON)ptmp->addData; pnew->addData = (DWORD) scrollview_add_item (hWnd, &plvdata->svdata, hsvi, &svii, &nItem); } else { - hsvi = parent->addData; + hsvi = (HICON)parent->addData; pnew->addData = (DWORD) scrollview_add_item (hWnd, &plvdata->svdata, hsvi, &svii, &nItem); } - return (int)pnew; + return (LRESULT)pnew; } case LVM_GETITEM: @@ -1770,7 +1770,7 @@ static LRESULT ListViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM hsvi = scrollview_get_hilighted_item (&plvdata->svdata); pi = LV_GET_ITEM (hsvi); - return (int)pi; + return (LRESULT)pi; } case LVM_GETRELATEDITEM: @@ -1781,16 +1781,16 @@ static LRESULT ListViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM return 0; if (wParam == LVIR_PARENT) { - return (int)pi->parent; + return (LRESULT)pi->parent; } else if (wParam == LVIR_FIRSTCHILD) { - return (int)pi->child; + return (LRESULT)pi->child; } else if (wParam == LVIR_NEXTSIBLING) { - return (int)pi->next; + return (LRESULT)pi->next; } else if (wParam == LVIR_PREVSIBLING) { - return (int)lvGetPrevSib(plvdata, pi); + return (LRESULT)lvGetPrevSib(plvdata, pi); } return 0; } @@ -1918,7 +1918,7 @@ static LRESULT ListViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM } case LVM_FINDITEM: { - return (int)lvFindItem(plvdata, (PITEMDATA)wParam, (PLVFINDINFO)lParam); + return (LRESULT)lvFindItem(plvdata, (PITEMDATA)wParam, (PLVFINDINFO)lParam); } case LVM_DELITEM: { diff --git a/src/ex_ctrl/spinbox.c b/src/ex_ctrl/spinbox.c index bc69ed0b..4d1eecb5 100644 --- a/src/ex_ctrl/spinbox.c +++ b/src/ex_ctrl/spinbox.c @@ -295,7 +295,7 @@ SpinCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) return 0; case SPM_GETTARGET: - return pData->hTarget; + return (LRESULT)pData->hTarget; case MSG_NCPAINT: return 0; diff --git a/src/ex_ctrl/treeview.c b/src/ex_ctrl/treeview.c index 84bb1ef6..bef7379a 100644 --- a/src/ex_ctrl/treeview.c +++ b/src/ex_ctrl/treeview.c @@ -873,7 +873,7 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM case TVM_GETROOT: pData = (PTVDATA) GetWindowAdditionalData2 (hwnd); - return (int) pData->root; + return (LRESULT) pData->root; break; case TVM_SEARCHITEM: @@ -892,7 +892,7 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM return 0; matched = findStringDepthFirst (pData, root, text); - return (int)matched; + return (LRESULT)matched; } case TVM_FINDCHILD: @@ -911,12 +911,12 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM return 0; matched = findStringInChildren (pData, item, text); - return (int)matched; + return (LRESULT)matched; } case TVM_GETSELITEM: pData = (PTVDATA) GetWindowAdditionalData2 (hwnd); - return (int)pData->pItemSelected; + return (LRESULT)pData->pItemSelected; case TVM_SETSELITEM: { @@ -957,7 +957,7 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM } #endif - return (int)old_sel; + return (LRESULT)old_sel; } case TVM_GETRELATEDITEM: @@ -972,13 +972,13 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM switch (related) { case TVIR_PARENT: - return (int)item->parent; + return (LRESULT)item->parent; case TVIR_FIRSTCHILD: - return (int)item->child; + return (LRESULT)item->child; case TVIR_NEXTSIBLING: - return (int)item->next; + return (LRESULT)item->next; case TVIR_PREVSIBLING: - return (int)getPrev (pData, item); + return (LRESULT)getPrev (pData, item); } return 0; @@ -1108,9 +1108,9 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM if (pTVItemInfo->text == NULL || pTVItemInfo->text[0] == '\0') pTVItemInfo->text = " "; if (pTVItemInfo->hIconFold == 0) - pTVItemInfo->hIconFold = (DWORD) ICON_FOLD; + pTVItemInfo->hIconFold = (HICON) ICON_FOLD; if (pTVItemInfo->hIconUnfold == 0) - pTVItemInfo->hIconUnfold = (DWORD) ICON_UNFOLD; + pTVItemInfo->hIconUnfold = (HICON) ICON_UNFOLD; } else { return 0; @@ -1141,8 +1141,8 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM } #endif if (pData->dwStyle & TVS_WITHICON) { - newItem->hIconFold = (DWORD) pTVItemInfo->hIconFold; - newItem->hIconUnfold = (DWORD) pTVItemInfo->hIconUnfold; + newItem->hIconFold = (HICON) pTVItemInfo->hIconFold; + newItem->hIconUnfold = (HICON) pTVItemInfo->hIconUnfold; } else { newItem->hIconFold = 0L; @@ -1158,7 +1158,7 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM tvSetVScrollInfo (hwnd, pData, TRUE); tvSetHScrollInfo (hwnd, pData, TRUE); InvalidateRect (hwnd, NULL, TRUE); - return (int) newItem; + return (LRESULT) newItem; } case MSG_KEYDOWN: diff --git a/src/ex_ctrl/treeview_rdr.c b/src/ex_ctrl/treeview_rdr.c index 1168a803..98277c54 100644 --- a/src/ex_ctrl/treeview_rdr.c +++ b/src/ex_ctrl/treeview_rdr.c @@ -854,7 +854,7 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM case TVM_GETROOT: pData = (PTVDATA) GetWindowAdditionalData2 (hwnd); - return (int) pData->root; + return (LRESULT)pData->root; break; case TVM_SEARCHITEM: @@ -873,7 +873,7 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM return 0; matched = findStringDepthFirst (pData, root, text); - return (int)matched; + return (LRESULT)matched; } case TVM_FINDCHILD: @@ -892,12 +892,12 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM return 0; matched = findStringInChildren (pData, item, text); - return (int)matched; + return (LRESULT)matched; } case TVM_GETSELITEM: pData = (PTVDATA) GetWindowAdditionalData2 (hwnd); - return (int)pData->pItemSelected; + return (LRESULT)pData->pItemSelected; case TVM_SETSELITEM: { @@ -938,7 +938,7 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM } #endif - return (int)old_sel; + return (LRESULT)old_sel; } case TVM_GETRELATEDITEM: @@ -953,13 +953,13 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM switch (related) { case TVIR_PARENT: - return (int)item->parent; + return (LRESULT)item->parent; case TVIR_FIRSTCHILD: - return (int)item->child; + return (LRESULT)item->child; case TVIR_NEXTSIBLING: - return (int)item->next; + return (LRESULT)item->next; case TVIR_PREVSIBLING: - return (int)getPrev (pData, item); + return (LRESULT)getPrev (pData, item); } return 0; @@ -1120,8 +1120,8 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM } #endif if (pData->dwStyle & TVS_WITHICON) { - newItem->hIconFold = (DWORD) pTVItemInfo->hIconFold; - newItem->hIconUnfold = (DWORD) pTVItemInfo->hIconUnfold; + newItem->hIconFold = (HICON) pTVItemInfo->hIconFold; + newItem->hIconUnfold = (HICON) pTVItemInfo->hIconUnfold; } else { newItem->hIconFold = 0L; @@ -1137,7 +1137,7 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM tvSetVScrollInfo (hwnd, pData, TRUE); tvSetHScrollInfo (hwnd, pData, TRUE); InvalidateRect (hwnd, NULL, TRUE); - return (int) newItem; + return (LRESULT)newItem; } case MSG_KEYDOWN: diff --git a/src/gui/arabickeymap.c b/src/gui/arabickeymap.c index 5de009db..0d64cd3b 100644 --- a/src/gui/arabickeymap.c +++ b/src/gui/arabickeymap.c @@ -180,9 +180,6 @@ static ushort *key_maps[MAX_NR_KEYMAPS] = { ctrl_alt_map,0 }; -static unsigned int keymap_count = 64; - - /* * Philosophy: most people do not define more strings, but they who do * often want quite a lot of string space. So, we statically allocate diff --git a/src/gui/hebrewkeymap.c b/src/gui/hebrewkeymap.c index 5c45e9cf..d5a5c3f3 100644 --- a/src/gui/hebrewkeymap.c +++ b/src/gui/hebrewkeymap.c @@ -162,9 +162,6 @@ static ushort *key_maps[MAX_NR_KEYMAPS] = { ctrl_alt_map,0 }; -static unsigned int keymap_count = 64; - - /* * Philosophy: most people do not define more strings, but they who do * often want quite a lot of string space. So, we statically allocate diff --git a/src/ial/netial/netial.c b/src/ial/netial/netial.c index 46409c4c..0d0d63b8 100644 --- a/src/ial/netial/netial.c +++ b/src/ial/netial/netial.c @@ -49,7 +49,6 @@ typedef struct static int mousex = 0; static int mousey = 0; static ts_EVENT ts_event; -static unsigned char state [NR_KEYS]; static int port = 8800; @@ -60,7 +59,7 @@ static struct sockaddr_in sin; static struct sockaddr_in pin; static int sock_descriptor; static int temp_sock_descriptor; -static int address_size; +static unsigned int address_size; static int n = 0; static MOUSE_EVENT *mouse_event; static char event_buf[100]; From b4e43c35140acbce53921ed1b4ba3b04e97b8803 Mon Sep 17 00:00:00 2001 From: VincentWei Date: Thu, 18 Jan 2018 16:51:44 +0800 Subject: [PATCH 06/26] tune code for 64 bitts --- configure.ac | 10 +++++++++ include/common.h | 4 ++-- include/ctrl/scrollview.h | 2 +- include/gdi.h | 12 +++++------ include/window.h | 2 +- src/control/listmodel.c | 10 ++++----- src/control/scrollview.c | 2 +- src/control/scrollview_impl.h | 7 +++---- src/control/scrollwnd.c | 8 +++---- src/control/scrollwnd.h | 2 -- src/gui/lf_classic.c | 1 - src/gui/lf_manager.c | 5 +++-- src/gui/window.c | 11 ++++------ src/include/ctrlclass.h | 12 +++++++---- src/include/dc.h | 13 ++++++------ src/include/internals.h | 14 ++++++++----- src/include/newgal.h | 3 ++- src/kernel/cursor.c | 39 ++++++++++++++++++++++++++++------- src/misc/endianrw.c | 4 ++-- src/newgdi/gdi.c | 1 - src/newgdi/icon.c | 2 +- 21 files changed, 100 insertions(+), 64 deletions(-) diff --git a/configure.ac b/configure.ac index 8fb20340..8ba71a9f 100644 --- a/configure.ac +++ b/configure.ac @@ -1727,6 +1727,7 @@ if test "x$devel_mode" = "xyes"; then build_ctrl_bidisledit="yes" build_ctrl_textedit="yes" + build_ctrl_scrollview="yes" build_ctrl_monthcal="yes" build_ctrl_treeview="yes" build_ctrl_treeview_rdr="yes" @@ -1746,6 +1747,15 @@ if test "x$devel_mode" = "xyes"; then CFLAGS="$CFLAGS -Werror" fi +dnl Depedencies +if test "x$build_ctrl_treeview" = "xyes"; then + build_ctrl_scrollview="yes" +fi + +if test "x$build_ctrl_treeview_rdr" = "xyes"; then + build_ctrl_scrollview="yes" +fi + if test "x$use_debug" = "xyes"; then AC_DEFINE(_DEBUG, 1, [Define if build with debugging messages]) diff --git a/include/common.h b/include/common.h index ac1ccbc8..658e7351 100644 --- a/include/common.h +++ b/include/common.h @@ -8,7 +8,7 @@ * \verbatim - Copyright (C) 2002-2012 FMSoft. + Copyright (C) 2002-2018 FMSoft. Copyright (C) 1998-2002 Wei Yongming. All rights reserved by FMSoft (http://www.fmsoft.cn). @@ -238,7 +238,7 @@ MGUI_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); * * to write endianness independent code. */ -#if defined(__i386__) || defined(__ia64__) || defined(__x86_64__) || defined(__amd64) || \ +#if defined(__i386__) || defined(__ia64__) || defined(__x86_64__) || defined(__amd64) || \ (defined(__alpha__) || defined(__alpha)) || \ defined(__arm__) || \ (defined(__CC_ARM) && !defined(__BIG_ENDIAN)) || \ diff --git a/include/ctrl/scrollview.h b/include/ctrl/scrollview.h index a2216578..907d2111 100644 --- a/include/ctrl/scrollview.h +++ b/include/ctrl/scrollview.h @@ -70,7 +70,7 @@ extern "C" { /** Default container window procedure * \sa DefaultDialogProc */ -MG_EXPORT int GUIAPI DefaultContainerProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam); +MG_EXPORT LRESULT GUIAPI DefaultContainerProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); /** Scrollview item object, use this handle to access a scrollview item */ typedef GHANDLE HSVITEM; diff --git a/include/gdi.h b/include/gdi.h index 962a1d3e..d916b787 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -7,7 +7,7 @@ * \verbatim - Copyright (C) 2002-2012 FMSoft. + Copyright (C) 2002-2018 FMSoft. Copyright (C) 1998-2002 Wei Yongming. All rights reserved by FMSoft (http://www.fmsoft.cn). @@ -8891,20 +8891,20 @@ MG_EXPORT void GUIAPI BIDIGetVisualEmbeddLevels (LOGFONT* log_font, * */ typedef struct _COMP_CTXT { - /** the step of current pixel operations. */ - int step; - /** the pointer to the destination */ gal_uint8* cur_dst; + /** The user context passed to SetUserCompositionOps */ + void* user_comp_ctxt; + /** the pixel value shoulb be skipped (the color key) */ gal_pixel skip_pixel; /** the current pixel value for setpixel and setpixels operation */ gal_pixel cur_pixel; - /** The user context passed to SetUserCompositionOps */ - void* user_comp_ctxt; + /** the step of current pixel operations. */ + int step; } COMP_CTXT; /* diff --git a/include/window.h b/include/window.h index 6eda525f..bc3f6a71 100644 --- a/include/window.h +++ b/include/window.h @@ -4118,7 +4118,7 @@ typedef struct _WINDOWINFO */ static inline const WINDOWINFO* GUIAPI GetWindowInfo (HWND hWnd) { - return (WINDOWINFO*)((unsigned char*)hWnd + 2*sizeof (short)); + return (WINDOWINFO*)hWnd; } /** diff --git a/src/control/listmodel.c b/src/control/listmodel.c index e923411a..9ae6214b 100644 --- a/src/control/listmodel.c +++ b/src/control/listmodel.c @@ -409,27 +409,27 @@ int DefaultItemViewProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam, return 0; case SVM_SETITEMDRAW: - return (int)mglist_set_itemdraw (mglst, (SVITEM_DRAWFUNC)lParam); + return (LRESULT)mglist_set_itemdraw (mglst, (SVITEM_DRAWFUNC)lParam); case SVM_SETITEMINIT: { SVITEM_INITFUNC old_pfn; old_pfn = mglst->iop.initItem; mglst->iop.initItem = (SVITEM_INITFUNC)lParam; - return (int)old_pfn; + return (LRESULT)old_pfn; } case SVM_SETITEMDESTROY: { SVITEM_DESTROYFUNC old_pfn; old_pfn = mglst->iop.destroyItem; mglst->iop.destroyItem = (SVITEM_DESTROYFUNC)lParam; - return (int)old_pfn; + return (LRESULT)old_pfn; } case SVM_GETITEMADDDATA: { if (lParam) - return mglist_get_item_adddata(lParam); + return mglist_get_item_adddata((HITEM)lParam); else { HITEM hitem = (HITEM)mglist_getitem_byindex(mglst, wParam); return mglist_get_item_adddata(hitem); @@ -523,7 +523,7 @@ int DefaultItemViewProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam, { SVITEM_CMP oldcmp = mglst->itemCmp; mglst->itemCmp = (SVITEM_CMP)lParam; - return (int)oldcmp; + return (LRESULT)oldcmp; } case SVM_SORTITEMS: diff --git a/src/control/scrollview.c b/src/control/scrollview.c index 0097ae16..51ce6fd8 100644 --- a/src/control/scrollview.c +++ b/src/control/scrollview.c @@ -430,7 +430,7 @@ void scrollview_destroy (PSVDATA psvdata) } /* --------------------------------------------------------------------------------- */ -static LRESULT ScrollViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +LRESULT ScrollViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PSVDATA psvdata = NULL; diff --git a/src/control/scrollview_impl.h b/src/control/scrollview_impl.h index eb6cff8e..50e4d460 100644 --- a/src/control/scrollview_impl.h +++ b/src/control/scrollview_impl.h @@ -3,16 +3,14 @@ ** ** scrollview.h: header file of ScrollView control. ** -** Copyright (C) 2004 ~ 2007 Feynman Software. +** Copyright (C) 2004 ~ 2018 FMSoft */ #ifndef _SCROLLVIEW_IMPL_H_ #define _SCROLLVIEW_IMPL_H_ - #include "listmodel.h" - #ifdef __cplusplus extern "C" { @@ -81,7 +79,8 @@ typedef SVDATA *PSVDATA; /* ------------------------- external api -------------------------- */ -MG_EXPORT int ScrollViewCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam); +MG_EXPORT LRESULT ScrollViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + MG_EXPORT int scrollview_init (HWND hWnd, PSVDATA psv); MG_EXPORT void scrollview_destroy (PSVDATA psvdata); MG_EXPORT HSVITEM scrollview_add_item (HWND hWnd, PSVDATA psvdata, HSVITEM hsvi, PSVITEMINFO pii, int *idx); diff --git a/src/control/scrollwnd.c b/src/control/scrollwnd.c index 85ffcaba..76b70296 100644 --- a/src/control/scrollwnd.c +++ b/src/control/scrollwnd.c @@ -220,7 +220,7 @@ static LRESULT ScrollWndCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM } case SVM_GETCTRL: - return GetDlgItem (pswdata->hContainer, wParam); + return (LRESULT)GetDlgItem (pswdata->hContainer, wParam); case SVM_RESETCONTENT: scrollwnd_reset_content (hWnd, pswdata); @@ -231,7 +231,7 @@ static LRESULT ScrollWndCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM return 0; case SVM_GETFOCUSCHILD: - return (int)GetFocus (pswdata->hContainer); + return (LRESULT)GetFocus (pswdata->hContainer); }/* end switch */ @@ -285,8 +285,8 @@ static void container_destroy (HWND hWnd, PCONTDATA pcontdata) /* ---------------------------------------------------------------------------- */ -int GUIAPI -DefaultContainerProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +LRESULT GUIAPI +DefaultContainerProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PCONTDATA pcontdata = NULL; diff --git a/src/control/scrollwnd.h b/src/control/scrollwnd.h index b1c8d3e3..4bc02808 100644 --- a/src/control/scrollwnd.h +++ b/src/control/scrollwnd.h @@ -50,8 +50,6 @@ typedef struct _swdata } SWDATA; typedef SWDATA *PSWDATA; - -int ScrollWndCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam); int scrollwnd_init (HWND hWnd, PSWDATA psv); void scrollwnd_destroy (PSWDATA pswdata); void scrollwnd_hscroll (HWND hWnd, PSWDATA pswdata, WPARAM wParam, LPARAM lParam); diff --git a/src/gui/lf_classic.c b/src/gui/lf_classic.c index 2e8e519b..4976c298 100644 --- a/src/gui/lf_classic.c +++ b/src/gui/lf_classic.c @@ -374,7 +374,6 @@ static int init (PWERENDERER renderer) renderer->private_info = NULL; - return 0; } diff --git a/src/gui/lf_manager.c b/src/gui/lf_manager.c index abb19e1b..6af2a188 100644 --- a/src/gui/lf_manager.c +++ b/src/gui/lf_manager.c @@ -822,10 +822,11 @@ BOOL mg_InitLFManager (void) /** be sure to success initializing default renderer */ rdr = wnd_lf_info[0].wnd_rdr; - if (NULL == rdr) return FALSE; + if (NULL == rdr) + return FALSE; if (rdr->init && 0 != rdr->init (rdr)) { - _MG_PRINTF ("GUI>InitLFM: fail to initialize default renderer's private info.\n"); + _MG_PRINTF ("GUI>InitLFM: failed to initialize default renderer's private info.\n"); return FALSE; } diff --git a/src/gui/window.c b/src/gui/window.c index 27270b90..8fed0a13 100644 --- a/src/gui/window.c +++ b/src/gui/window.c @@ -4747,20 +4747,17 @@ static BOOL _wndInvalidateRect(HWND hWnd, const RECT* prc, BOOL bEraseBkgnd, int #ifdef _MGRM_THREADS pthread_mutex_lock(&pInvRgn->lock); #endif - if (bEraseBkgnd) - { + if (bEraseBkgnd) { pCtrl->Flags |= WF_ERASEBKGND; } - if(prc) - { + if(prc) { rcInv = *prc; NormalizeRect(&rcInv); if(IntersectRect(&rcInv, &rcInv, &rcClient)) AddClipRect(&pInvRgn->rgn, &rcInv); } - else - { + else { rcInv = rcClient; SetClipRgn(&pInvRgn->rgn, &rcInv); } @@ -4769,7 +4766,7 @@ static BOOL _wndInvalidateRect(HWND hWnd, const RECT* prc, BOOL bEraseBkgnd, int OffsetRect(&rcTemp, pCtrl->cl, pCtrl->ct); //subtract from next sibling controls - if(pCtrl->WinType==TYPE_CONTROL /*&& ( mark & WIRM_NEXT_SIBLING)*/) + if(pCtrl->WinType == TYPE_CONTROL /*&& ( mark & WIRM_NEXT_SIBLING)*/) { for(pNext = pCtrl->next; pNext; pNext = pNext->next) { diff --git a/src/include/ctrlclass.h b/src/include/ctrlclass.h index 89b242b0..a43b18a1 100644 --- a/src/include/ctrlclass.h +++ b/src/include/ctrlclass.h @@ -42,10 +42,6 @@ typedef struct tagCONTROL /* * These fields are similiar with MAINWIN struct. */ - unsigned char DataType; // the data type - unsigned char WinType; // the window type - unsigned short Flags; // speical runtime flags, such EraseBkGnd flags - int left, top; // the position of control in main window's int right, bottom; // client area. @@ -110,6 +106,14 @@ typedef struct tagCONTROL */ struct _wnd_element_data* wed; + /* + * some internal fields + * VM[2018-01-18]: Move these fields from header to here to compatible with WINDOWINFO + */ + unsigned char DataType; // the data type + unsigned char WinType; // the window type + unsigned short Flags; // speical runtime flags, such EraseBkGnd flags + /* * The following members are only implemented for control. */ diff --git a/src/include/dc.h b/src/include/dc.h index 8498e48f..70dd2b28 100644 --- a/src/include/dc.h +++ b/src/include/dc.h @@ -186,11 +186,12 @@ struct tagDC /* === context information. ============================================= */ /* DK[01/22/10]:This segment is binary compatible with _COMP_CTXT struct */ - int step; - gal_uint8* cur_dst; - gal_pixel skip_pixel; - gal_pixel cur_pixel; - void * user_comp_ctxt; + /* VW[01/18/18]:Adjust the fields sequence for 64-bit to ensure 8-byte alignment */ + gal_uint8* cur_dst; + void* user_comp_ctxt; + gal_pixel skip_pixel; + gal_pixel cur_pixel; + int step; /* ====================================================================== */ CLIPRECT* cur_ban; @@ -212,7 +213,7 @@ struct tagDC CB_BITMAP_SCALER_FUNC bitmap_scaler; }; -#define PDC_TO_COMP_CTXT(pdc) ((COMP_CTXT* )(&pdc->step)) +#define PDC_TO_COMP_CTXT(pdc) ((COMP_CTXT* )(&pdc->cur_dst)) extern DC __mg_screen_dc; extern DC __mg_screen_sys_dc; diff --git a/src/include/internals.h b/src/include/internals.h index ed4e679a..0be8e69a 100644 --- a/src/include/internals.h +++ b/src/include/internals.h @@ -293,10 +293,6 @@ typedef struct _MAINWIN /* * These fields are similiar with CONTROL struct. */ - unsigned char DataType; // the data type. - unsigned char WinType; // the window type. - unsigned short Flags; // special runtime flags, such EraseBkGnd flags - int left, top; // the position and size of main window. int right, bottom; @@ -363,9 +359,17 @@ typedef struct _MAINWIN */ struct _wnd_element_data* wed; + /* + * some internal fields + * VM[2018-01-18]: Move these fields from header to here to compatible with WINDOWINFO + */ + unsigned char DataType; // the data type. + unsigned char WinType; // the window type. + unsigned short Flags; // special runtime flags, such EraseBkGnd flags + /* - * Main Window hosting. * The following members are only implemented for main window. + * Main Window hosting. */ struct _MAINWIN* pHosting; // the hosting main window. diff --git a/src/include/newgal.h b/src/include/newgal.h index a74a8326..b87f15c0 100644 --- a/src/include/newgal.h +++ b/src/include/newgal.h @@ -63,7 +63,8 @@ typedef struct GAL_Surface { GAL_PixelFormat *format; /* Read-only */ void *video; /* Read-only */ int w, h; /* Read-only */ - Uint32 pitch; /* Read-only */ + /* VW[2018-01-18]: For 64b, use signed int instead of Uint32 for pitch. */ + int pitch; /* Read-only */ void *pixels; /* Read-write */ int offset; /* Private */ diff --git a/src/kernel/cursor.c b/src/kernel/cursor.c index 1377dec2..617f21ca 100644 --- a/src/kernel/cursor.c +++ b/src/kernel/cursor.c @@ -102,13 +102,17 @@ HCURSOR GUIAPI LoadCursorFromFile(const char* filename) BYTE* image; HCURSOR csr = 0; - if( !(fp = fopen(filename, "rb")) ) return 0; + if (!(fp = fopen(filename, "rb"))) + return 0; fseek(fp, sizeof(WORD16), SEEK_SET); /* the cbType of struct CURSORDIR. */ wTemp = MGUI_ReadLE16FP (fp); - if(wTemp != 2) goto error; + if(wTemp != 2) { + _MG_PRINTF ("LoadCursorFromFile: bad file type: %d\n", wTemp); + goto error; + } /* skip the cdCount of struct CURSORDIR, we always use the first cursor. */ fseek(fp, sizeof(WORD16), SEEK_CUR); @@ -116,7 +120,11 @@ HCURSOR GUIAPI LoadCursorFromFile(const char* filename) /* cursor info, read the members of struct CURSORDIRENTRY. */ w = fgetc (fp); /* the width of first cursor. */ h = fgetc (fp); /* the height of first cursor. */ - if(w != CURSORWIDTH || h != CURSORHEIGHT) goto error; + if (w != CURSORWIDTH || h != CURSORHEIGHT) { + _MG_PRINTF ("LoadCursorFromFile: bad first cursor width (%d) and height (%d)\n", w, h); + goto error; + } + fseek(fp, sizeof(BYTE)*2, SEEK_CUR); /* skip bColorCount and bReserved. */ wTemp = MGUI_ReadLE16FP (fp); xhot = wTemp; @@ -134,16 +142,25 @@ HCURSOR GUIAPI LoadCursorFromFile(const char* filename) fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biSize member. */ imagew = MGUI_ReadLE32FP (fp); imageh = MGUI_ReadLE32FP (fp); - if (imagew > 32 || imageh > 32) { + if (imagew != CURSORWIDTH || imageh != (CURSORHEIGHT*2)) { + _MG_PRINTF ("LoadCursorFromFile: bad cursor image width (%d) and height (%d)\n", imagew, imageh); goto error; } /* check the biPlanes member; */ wTemp = MGUI_ReadLE16FP (fp); - if(wTemp != 1) goto error; + if (wTemp != 1) { + _MG_PRINTF ("LoadCursorFromFile: bad planes (%d)\n", wTemp); + goto error; + } + /* check the biBitCount member; */ wTemp = MGUI_ReadLE16FP (fp); - if(wTemp > 4) goto error; + if (wTemp > 4) { + _MG_PRINTF ("LoadCursorFromFile: bad bit count (%d)\n", wTemp); + goto error; + } + colornum = (int)wTemp; fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biCompression members. */ imagesize = MGUI_ReadLE32FP (fp); @@ -153,20 +170,25 @@ HCURSOR GUIAPI LoadCursorFromFile(const char* filename) /* allocate memory for image. */ if ((image = (BYTE*)ALLOCATE_LOCAL (imagesize)) == NULL) { + _MG_PRINTF ("LoadCursorFromFile: error when allocating memory for image (%d)\n", imagesize); goto error; } /* read image */ - if (fread (image, imagesize, 1, fp) < imagesize) { + if (fread (image, 1, imagesize, fp) < imagesize) { + _MG_PRINTF ("LoadCursorFromFile: error when reading data from file\n"); goto error; } - csr = CreateCursor(xhot, yhot, w, h, + csr = CreateCursor (xhot, yhot, w, h, image + (imagesize - MONOSIZE), image, colornum); DEALLOCATE_LOCAL (image); + fclose (fp); + return csr; error: + _MG_PRINTF ("LoadCursorFromFile: failed when loading cursor from %s\n", filename); fclose (fp); return csr; } @@ -237,6 +259,7 @@ HCURSOR GUIAPI LoadCursorFromMem (const void* area) p + (imagesize - MONOSIZE), p, colornum); error: + _MG_PRINTF ("LoadCursorFromMem: failed when loading cursor from %p\n", area); return 0; } diff --git a/src/misc/endianrw.c b/src/misc/endianrw.c index 54092028..acad8e41 100644 --- a/src/misc/endianrw.c +++ b/src/misc/endianrw.c @@ -111,7 +111,7 @@ Uint16 MGUI_ReadLE16FP (FILE *src) size_t size; size = fread (&value, (sizeof value), 1, src); - if (size < sizeof (value)) + if (size < 1) return -1; return (ArchSwapLE16(value)); @@ -123,7 +123,7 @@ Uint32 MGUI_ReadLE32FP (FILE *src) size_t size; size = fread(&value, (sizeof value), 1, src); - if (size < sizeof (value)) + if (size < 1) return -1; return (ArchSwapLE32(value)); diff --git a/src/newgdi/gdi.c b/src/newgdi/gdi.c index 63571f64..4bbde3d5 100644 --- a/src/newgdi/gdi.c +++ b/src/newgdi/gdi.c @@ -591,7 +591,6 @@ static void _dc_draw_pixel_span_set_1 (COMP_CTXT* comp_ctxt, int w) static void _dc_draw_pixel_span_set_2 (COMP_CTXT* comp_ctxt, int w) { int step = comp_ctxt->step; -// printf("w=%d, %X\t", w, comp_ctxt->cur_pixel); if (comp_ctxt->cur_pixel != 0 || comp_ctxt->step != 1) { Uint16 * dest16 = (Uint16 *)comp_ctxt->cur_dst; if (w < 5 || step != 1) diff --git a/src/newgdi/icon.c b/src/newgdi/icon.c index 616a22c0..966d057f 100644 --- a/src/newgdi/icon.c +++ b/src/newgdi/icon.c @@ -206,7 +206,7 @@ HICON GUIAPI LoadIconFromFile (HDC hdc, const char* filename, int which) goto error; /* read image*/ - if (fread (image, imagesize, 1, fp) < imagesize) { + if (fread (image, 1, imagesize, fp) < imagesize) { goto error_free; } From a2a5dcbc2a84df14f023e23ff4041ce1f5ad1783 Mon Sep 17 00:00:00 2001 From: VincentWei Date: Thu, 18 Jan 2018 17:52:48 +0800 Subject: [PATCH 07/26] tune code for 64bit --- src/kernel/message.c | 1 + src/misc/about.c | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/kernel/message.c b/src/kernel/message.c index 2ab138f5..96a5d6ac 100644 --- a/src/kernel/message.c +++ b/src/kernel/message.c @@ -1017,6 +1017,7 @@ int GUIAPI PostQuitMessage (HWND hWnd) } #include "license.h" + int GUIAPI DispatchMessage (PMSG pMsg) { WNDPROC WndProc; diff --git a/src/misc/about.c b/src/misc/about.c index a81ac153..500e0ef4 100644 --- a/src/misc/about.c +++ b/src/misc/about.c @@ -41,24 +41,23 @@ static LRESULT AboutWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar (RECTW(rcClient) - 80)>>1, rcClient.bottom - 40, 80, 24, hWnd, 0); - break; + break; case MSG_COMMAND: if (LOWORD (wParam) == IDOK && HIWORD (wParam) == BN_CLICKED) PostMessage (hWnd, MSG_CLOSE, 0, 0); - break; + break; case MSG_KEYDOWN: if (LOWORD (wParam) == SCANCODE_ESCAPE) PostMessage (hWnd, MSG_CLOSE, 0, 0); - break; + break; case MSG_PAINT: { HDC hdc; hdc = BeginPaint (hWnd); - GetClientRect (hWnd, &rcClient); rcClient.top = 30; rcClient.bottom -= 50; @@ -68,18 +67,17 @@ static LRESULT AboutWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar SetBkMode (hdc, BM_TRANSPARENT); DrawText (hdc, "MiniGUI -- a mature cross-platform windowing system " - "and GUI support system for real-time embedded devices.\n\n" - "Copyright (C) 2002 ~ 2010 FMSoft Co., Ltd.", + "and GUI support system for embedded or IoT devices.\n\n" + "Copyright (C) 2002 ~ 2018 FMSoft Co., Ltd.", -1, &rcClient, DT_WORDBREAK | DT_CENTER); EndPaint (hWnd, hdc); + return 0; } - return 0; case MSG_CLOSE: - DestroyAllControls (hWnd); - DestroyMainWindow (hWnd); sg_AboutWnd = 0; + DestroyAllControls (hWnd); #ifdef _MGRM_THREADS PostQuitMessage (hWnd); #endif @@ -136,10 +134,17 @@ static void* AboutDialogThread (void* data) ShowWindow (hMainWnd, SW_SHOWNORMAL); - while( GetMessage(&Msg, hMainWnd) ) { + while (GetMessage(&Msg, hMainWnd)) { + printf ("AboutDialogBox Message, %s: hWnd: %p, wP: %lx, lP: %lx.\n", + Message2Str (Msg.message), + Msg.hwnd, + Msg.wParam, + Msg.lParam); + DispatchMessage(&Msg); } + DestroyMainWindow (hMainWnd); MainWindowThreadCleanup(hMainWnd); return NULL; } From 01bc3d7c42a235ffa4117866bdf3977fe3a4aa0d Mon Sep 17 00:00:00 2001 From: VincentWei Date: Thu, 18 Jan 2018 19:01:29 +0800 Subject: [PATCH 08/26] tune code for 64 bits --- include/common.h | 2 ++ include/window.h | 6 +++--- src/control/button.c | 3 ++- src/gui/window.c | 2 +- src/kernel/desktop-comm.c | 1 - src/kernel/desktop-ths.c | 10 +++++----- src/kernel/message.c | 20 ++++++++++---------- src/misc/about.c | 6 ------ 8 files changed, 23 insertions(+), 27 deletions(-) diff --git a/include/common.h b/include/common.h index 658e7351..57667980 100644 --- a/include/common.h +++ b/include/common.h @@ -1885,8 +1885,10 @@ int init_minigui_printf (int (*output_char) (int ch), #if defined(__GNUC__) #ifdef _DEBUG # define _MG_PRINTF(fmt...) fprintf (stderr, fmt) +# define _DBG_PRINTF(fmt...) fprintf (stdout, fmt) #else # define _MG_PRINTF(fmt...) +# define _DBG_PRINTF(fmt...) #endif #else /* __GNUC__ */ #include diff --git a/include/window.h b/include/window.h index bc3f6a71..760e42b7 100644 --- a/include/window.h +++ b/include/window.h @@ -2564,7 +2564,7 @@ MG_EXPORT LRESULT GUIAPI PostSyncMessage (HWND hWnd, UINT nMsg, WPARAM wParam, L * * \sa PostSyncMessage */ -MG_EXPORT int GUIAPI SendAsyncMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam); +MG_EXPORT LRESULT GUIAPI SendAsyncMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam); #endif /** @@ -2728,7 +2728,7 @@ MG_EXPORT BOOL GUIAPI TranslateKeyMsgToChar (int message, WPARAM wParam, LPARAM lParam, WORD *ch); /** - * \fn int DispatchMessage (PMSG pMsg) + * \fn LRESULT DispatchMessage (PMSG pMsg) * \brief Dispatches a message to the window's callback procedure. * * This function dispatches the message pointed to by \a pMsg to the @@ -2743,7 +2743,7 @@ MG_EXPORT BOOL GUIAPI TranslateKeyMsgToChar (int message, * * \include getmessage.c */ -MG_EXPORT int GUIAPI DispatchMessage (PMSG pMsg); +MG_EXPORT LRESULT GUIAPI DispatchMessage (PMSG pMsg); /** * \fn int ThrowAwayMessages (HWND pMainWnd) diff --git a/src/control/button.c b/src/control/button.c index 77df4f44..6ac04144 100644 --- a/src/control/button.c +++ b/src/control/button.c @@ -941,8 +941,9 @@ static LRESULT ButtonCtrlProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara case MSG_LBUTTONDOWN: if (GetCapture () == hWnd) break; + SetCapture (hWnd); - + BUTTON_STATUS(pctrl) |= BST_FOCUS; change_status_from_pose(pctrl, BST_PUSHED, TRUE, TRUE); break; diff --git a/src/gui/window.c b/src/gui/window.c index 8fed0a13..20e2c2e5 100644 --- a/src/gui/window.c +++ b/src/gui/window.c @@ -2761,7 +2761,7 @@ HWND GUIAPI SetCapture (HWND hWnd) HWND GUIAPI GetCapture (void) { - return (HWND) SendMessage (HWND_DESKTOP, MSG_GETCAPTURE, 0, 0); + return (HWND)SendMessage (HWND_DESKTOP, MSG_GETCAPTURE, 0, 0); } void GUIAPI ReleaseCapture (void) diff --git a/src/kernel/desktop-comm.c b/src/kernel/desktop-comm.c index 608760a8..51d48d46 100644 --- a/src/kernel/desktop-comm.c +++ b/src/kernel/desktop-comm.c @@ -870,7 +870,6 @@ static HWND DesktopSetCapture (HWND hwnd) hTemp = __mg_capture_wnd; __mg_capture_wnd = hwnd; - return hTemp; } diff --git a/src/kernel/desktop-ths.c b/src/kernel/desktop-ths.c index 638aa9f9..b945c0ab 100644 --- a/src/kernel/desktop-ths.c +++ b/src/kernel/desktop-ths.c @@ -122,7 +122,7 @@ void* DesktopMain (void* data) /* process messages of desktop thread */ while (GetMessage(&Msg, HWND_DESKTOP)) { - int iRet = 0; + LRESULT lRet = 0; #ifdef _MGHAVE_TRACE_MSG fprintf (stderr, "Message, %s: hWnd: %p, wP: %#lx, lP: %#lx. %s\n", @@ -133,19 +133,19 @@ void* DesktopMain (void* data) Msg.pAdd?"Sync":"Normal"); #endif - iRet = DesktopWinProc (HWND_DESKTOP, + lRet = DesktopWinProc (HWND_DESKTOP, Msg.message, Msg.wParam, Msg.lParam); if (Msg.pAdd) /* this is a sync message. */ { PSYNCMSG pSyncMsg = (PSYNCMSG)(Msg.pAdd); - pSyncMsg->retval = iRet; + pSyncMsg->retval = lRet; sem_post(pSyncMsg->sem_handle); } #ifdef _MGHAVE_TRACE_MSG - fprintf (stderr, "Message, %s done, return value: %#x\n", - Message2Str (Msg.message), iRet); + fprintf (stderr, "Message, %s done, return value: %lx\n", + Message2Str (Msg.message), lRet); #endif } diff --git a/src/kernel/message.c b/src/kernel/message.c index 96a5d6ac..72983a89 100644 --- a/src/kernel/message.c +++ b/src/kernel/message.c @@ -1018,13 +1018,13 @@ int GUIAPI PostQuitMessage (HWND hWnd) #include "license.h" -int GUIAPI DispatchMessage (PMSG pMsg) +LRESULT GUIAPI DispatchMessage (PMSG pMsg) { WNDPROC WndProc; #ifdef _MGRM_THREADS PSYNCMSG pSyncMsg; #endif - int iRet; + LRESULT lRet; LICENSE_MODIFY_MESSAGE(pMsg); @@ -1059,23 +1059,23 @@ int GUIAPI DispatchMessage (PMSG pMsg) if (!(WndProc = GetWndProc (pMsg->hwnd))) return -1; - iRet = (*WndProc)(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam); + lRet = WndProc (pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam); #ifdef _MGRM_THREADS /* this is a sync message. */ if (pMsg->pAdd) { pSyncMsg = (PSYNCMSG)pMsg->pAdd; - pSyncMsg->retval = iRet; + pSyncMsg->retval = lRet; sem_post (pSyncMsg->sem_handle); } #endif #ifdef _MGHAVE_TRACE_MSG - fprintf (stderr, "Message, %s done, return value: %x\n", - Message2Str (pMsg->message), iRet); + fprintf (stderr, "Message, %s done, return value: %lx\n", + Message2Str (pMsg->message), lRet); #endif - return iRet; + return lRet; } /* define this to print debug info of ThrowAwayMessages */ @@ -1352,16 +1352,16 @@ LRESULT GUIAPI PostSyncMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara return SendSyncMessage (hWnd, msg, wParam, lParam); } -int GUIAPI SendAsyncMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) +LRESULT GUIAPI SendAsyncMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) { WNDPROC WndProc; MG_CHECK_RET (MG_IS_WINDOW(hWnd), -1); - if ( !(WndProc = GetWndProc(hWnd)) ) + if (!(WndProc = GetWndProc(hWnd))) return -1; - return (*WndProc)(hWnd, nMsg, wParam, lParam); + return WndProc (hWnd, nMsg, wParam, lParam); } #endif /* !LITE_VERSION */ diff --git a/src/misc/about.c b/src/misc/about.c index 500e0ef4..d5939af5 100644 --- a/src/misc/about.c +++ b/src/misc/about.c @@ -135,12 +135,6 @@ static void* AboutDialogThread (void* data) ShowWindow (hMainWnd, SW_SHOWNORMAL); while (GetMessage(&Msg, hMainWnd)) { - printf ("AboutDialogBox Message, %s: hWnd: %p, wP: %lx, lP: %lx.\n", - Message2Str (Msg.message), - Msg.hwnd, - Msg.wParam, - Msg.lParam); - DispatchMessage(&Msg); } From 766ddb5555ef75affb306cb6aa949c2bc0010abb Mon Sep 17 00:00:00 2001 From: VincentWei Date: Fri, 19 Jan 2018 15:35:26 +0800 Subject: [PATCH 09/26] tune code for 64b (MiniGUI-Processes runmode) --- include/common.h | 34 ++++++-- include/window.h | 4 +- src/include/client.h | 1 + src/include/newgal.h | 4 +- src/include/ourhdr.h | 4 +- src/include/server.h | 7 +- src/kernel/Makefile.am | 2 +- src/kernel/cursor-comm.c | 174 +++++++++++++++++++++++++++++++++++++ src/kernel/cursor-procs.c | 132 ++-------------------------- src/kernel/cursor-sa.c | 124 +------------------------- src/kernel/cursor.c | 172 ++---------------------------------- src/kernel/desktop-procs.c | 150 ++++++++++++++++---------------- src/kernel/desktop.c | 3 +- src/kernel/timer.c | 1 + src/misc/about.c | 2 +- src/newgal/pcxvfb/pcxvfb.c | 58 ++++++------- src/server/client.c | 16 ++-- src/server/layer.c | 2 +- src/server/request.c | 10 +-- 19 files changed, 347 insertions(+), 553 deletions(-) create mode 100644 src/kernel/cursor-comm.c diff --git a/include/common.h b/include/common.h index 57667980..86848eec 100644 --- a/include/common.h +++ b/include/common.h @@ -1883,17 +1883,26 @@ int init_minigui_printf (int (*output_char) (int ch), #endif /* _MGUSE_OWN_STDIO */ #if defined(__GNUC__) -#ifdef _DEBUG -# define _MG_PRINTF(fmt...) fprintf (stderr, fmt) -# define _DBG_PRINTF(fmt...) fprintf (stdout, fmt) -#else -# define _MG_PRINTF(fmt...) -# define _DBG_PRINTF(fmt...) -#endif +# define _ERR_PRINTF(fmt...) fprintf (stderr, fmt) +# ifdef _DEBUG +# define _MG_PRINTF(fmt...) fprintf (stderr, fmt) +# define _DBG_PRINTF(fmt...) fprintf (stdout, fmt) +# else +# define _MG_PRINTF(fmt...) +# define _DBG_PRINTF(fmt...) +# endif #else /* __GNUC__ */ #include #include +static inline void _ERR_PRINTF(const char* fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + fprintf(stderr, "\n"); + va_end(ap); +} static inline void _MG_PRINTF(const char* fmt, ...) { #ifdef _DEBUG @@ -1904,6 +1913,17 @@ 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__ */ #ifdef _MGRM_THREADS diff --git a/include/window.h b/include/window.h index 760e42b7..b9694e83 100644 --- a/include/window.h +++ b/include/window.h @@ -2443,7 +2443,7 @@ MG_EXPORT void GUIAPI SetAutoRepeatMessage (HWND hwnd, UINT msg, #define CLIENT_ACTIVE -4 /** - * \fn int Send2Client (MSG* msg, int cli) + * \fn int Send2Client (const MSG* msg, int cli) * \brief Sends a message to a client. * * This function sends a message to the specified client \a cli. @@ -2472,7 +2472,7 @@ MG_EXPORT void GUIAPI SetAutoRepeatMessage (HWND hwnd, UINT msg, * * \sa Send2TopMostClients, Send2ActiveWindow */ -int GUIAPI Send2Client (MSG* msg, int cli); +int GUIAPI Send2Client (const MSG* msg, int cli); /** * \fn BOOL Send2TopMostClients (UINT nMsg, WPARAM wParam, LPARAM lParam) diff --git a/src/include/client.h b/src/include/client.h index 6f8fc956..838dece4 100644 --- a/src/include/client.h +++ b/src/include/client.h @@ -144,6 +144,7 @@ typedef struct ZorderOpInfo HWND main_win; RECT rc; RECT rcA; + int location; char caption[MAX_CAPTION_LEN + 1]; } ZORDEROPINFO; diff --git a/src/include/newgal.h b/src/include/newgal.h index b87f15c0..33a0c550 100644 --- a/src/include/newgal.h +++ b/src/include/newgal.h @@ -31,8 +31,8 @@ extern "C" { #define GAL_LIL_ENDIAN MGUI_LIL_ENDIAN #define GAL_BIG_ENDIAN MGUI_BIG_ENDIAN -#define GAL_OutOfMemory() fprintf (stderr, "Out of memory\n") -#define GAL_SetError printf +#define GAL_OutOfMemory() _ERR_PRINTF("NEWGAL: Out of memory\n") +#define GAL_SetError _ERR_PRINTF #define GAL_ClearError() /* Transparency definitions: These define alpha as the opacity of a surface */ diff --git a/src/include/ourhdr.h b/src/include/ourhdr.h index 94a499c4..39dda6a2 100644 --- a/src/include/ourhdr.h +++ b/src/include/ourhdr.h @@ -62,9 +62,9 @@ void log_sys(const char *, ...); #endif typedef struct listen_fd { - int fd; - int hwnd; int type; + int fd; + void* hwnd; void* context; } LISTEN_FD; diff --git a/src/include/server.h b/src/include/server.h index b3c29fbf..bba1d043 100644 --- a/src/include/server.h +++ b/src/include/server.h @@ -56,15 +56,14 @@ void __mg_remove_client (int cli, int clifd); int __mg_handle_request (int clifd, int req_id, int cli); -int __mg_send2client (MSG* msg, MG_Client* client); +int __mg_send2client (const MSG* msg, MG_Client* client); void __mg_set_active_client (MG_Client* client); void __mg_start_server_desktop (void); int __mg_post_msg_by_znode (const ZORDERINFO* zi, int znode, int message, WPARAM wParam, LPARAM lParam); -int __mg_do_zorder_operation (int cli, const ZORDEROPINFO* info); -int __mg_do_zorder_maskrect_operation (int cli, - const ZORDERMASKRECTOPINFO* info); +intptr_t __mg_do_zorder_operation (int cli, const ZORDEROPINFO* info); +intptr_t __mg_do_zorder_maskrect_operation (int cli, const ZORDERMASKRECTOPINFO* info); int __mg_remove_all_znodes_of_client (int cli); int __mg_handle_normal_mouse_move (const ZORDERINFO* zi, int x, int y); diff --git a/src/kernel/Makefile.am b/src/kernel/Makefile.am index 87ae70bc..0bbedde8 100644 --- a/src/kernel/Makefile.am +++ b/src/kernel/Makefile.am @@ -18,7 +18,7 @@ libkernel_la_SOURCES = timer.c \ endif # hash.c -EXTRA_DIST= desktop.c desktop-comm.c makefile.ng makefile.msvc +EXTRA_DIST= desktop.c desktop-comm.c cursor-comm.c makefile.ng makefile.msvc # for makefile.ng and makefile.msvc LIB_NAME = libkernel diff --git a/src/kernel/cursor-comm.c b/src/kernel/cursor-comm.c new file mode 100644 index 00000000..c293ae21 --- /dev/null +++ b/src/kernel/cursor-comm.c @@ -0,0 +1,174 @@ + +static HCURSOR load_cursor_from_file (const char* filename) +{ + FILE* fp; + WORD16 wTemp; + int w, h, xhot, yhot, colornum; +#if 0 + DWORD32 size; +#endif + DWORD32 offset, imagesize, imagew, imageh; + BYTE* image; + HCURSOR csr = 0; + + if (!(fp = fopen(filename, "rb"))) + return 0; + + fseek(fp, sizeof(WORD16), SEEK_SET); + + /* the cbType of struct CURSORDIR. */ + wTemp = MGUI_ReadLE16FP (fp); + if(wTemp != 2) { + _MG_PRINTF ("LoadCursorFromFile: bad file type: %d\n", wTemp); + goto error; + } + + /* skip the cdCount of struct CURSORDIR, we always use the first cursor. */ + fseek(fp, sizeof(WORD16), SEEK_CUR); + + /* cursor info, read the members of struct CURSORDIRENTRY. */ + w = fgetc (fp); /* the width of first cursor. */ + h = fgetc (fp); /* the height of first cursor. */ + if (w != CURSORWIDTH || h != CURSORHEIGHT) { + _MG_PRINTF ("LoadCursorFromFile: bad first cursor width (%d) and height (%d)\n", w, h); + goto error; + } + + fseek(fp, sizeof(BYTE)*2, SEEK_CUR); /* skip bColorCount and bReserved. */ + wTemp = MGUI_ReadLE16FP (fp); + xhot = wTemp; + wTemp = MGUI_ReadLE16FP (fp); + yhot = wTemp; +#if 0 + size = MGUI_ReadLE32FP (fp); +#else + fseek (fp, sizeof(DWORD32), SEEK_CUR); /* skip size. */ +#endif + offset = MGUI_ReadLE32FP (fp); + + /* read the cursor image info. */ + fseek(fp, offset, SEEK_SET); + fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biSize member. */ + imagew = MGUI_ReadLE32FP (fp); + imageh = MGUI_ReadLE32FP (fp); + if (imagew != CURSORWIDTH || imageh != (CURSORHEIGHT*2)) { + _MG_PRINTF ("LoadCursorFromFile: bad cursor image width (%d) and height (%d)\n", imagew, imageh); + goto error; + } + + /* check the biPlanes member; */ + wTemp = MGUI_ReadLE16FP (fp); + if (wTemp != 1) { + _MG_PRINTF ("LoadCursorFromFile: bad planes (%d)\n", wTemp); + goto error; + } + + /* check the biBitCount member; */ + wTemp = MGUI_ReadLE16FP (fp); + if (wTemp > 4) { + _MG_PRINTF ("LoadCursorFromFile: bad bit count (%d)\n", wTemp); + goto error; + } + + colornum = (int)wTemp; + fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biCompression members. */ + imagesize = MGUI_ReadLE32FP (fp); + + /* skip the rest members and the color table. */ + fseek(fp, sizeof(DWORD32)*4 + sizeof(BYTE)*(4< 32 || imageh > 32) { + goto error; + } + + /* check the biPlanes member; */ + wTemp = MGUI_ReadLE16Mem (&p); + if (wTemp != 1) goto error; + + /* check the biBitCount member; */ + wTemp = MGUI_ReadLE16Mem (&p); + if (wTemp > 4) goto error; + colornum = wTemp; + + /* skip the biCompression members. */ + p += sizeof (DWORD32); + imagesize = MGUI_ReadLE32Mem (&p); + + /* skip the rest members and the color table. */ + p += sizeof(DWORD32)*4 + sizeof(BYTE)*(4< 4) goto error; - colornum = (int)wTemp; - fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biCompression members. */ - imagesize = MGUI_ReadLE32FP (fp); - - /* skip the rest members and the color table. */ - fseek(fp, sizeof(DWORD32)*4 + sizeof(BYTE)*(4< 4) goto error; - colornum = wTemp; - - /* skip the biCompression members. */ - p += sizeof (DWORD32); - imagesize = MGUI_ReadLE32Mem (&p); - - /* skip the rest members and the color table. */ - p += sizeof(DWORD32)*4 + sizeof(BYTE)*(4< 4) goto error; - colornum = (int)wTemp; - fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biCompression members. */ - imagesize = MGUI_ReadLE32FP (fp); - - /* skip the rest members and the color table. */ - fseek(fp, sizeof(DWORD32)*4 + sizeof(BYTE)*(4< 4) goto error; - colornum = wTemp; - - /* skip the biCompression members. */ - p += sizeof (DWORD32); - imagesize = MGUI_ReadLE32Mem (&p); - - /* skip the rest members and the color table. */ - p += sizeof(DWORD32)*4 + sizeof(BYTE)*(4< 4) { - _MG_PRINTF ("LoadCursorFromFile: bad bit count (%d)\n", wTemp); - goto error; - } - - colornum = (int)wTemp; - fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biCompression members. */ - imagesize = MGUI_ReadLE32FP (fp); - - /* skip the rest members and the color table. */ - fseek(fp, sizeof(DWORD32)*4 + sizeof(BYTE)*(4< 32 || imageh > 32) { - goto error; - } - - /* check the biPlanes member; */ - wTemp = MGUI_ReadLE16Mem (&p); - if (wTemp != 1) goto error; - - /* check the biBitCount member; */ - wTemp = MGUI_ReadLE16Mem (&p); - if (wTemp > 4) goto error; - colornum = wTemp; - - /* skip the biCompression members. */ - p += sizeof (DWORD32); - imagesize = MGUI_ReadLE32Mem (&p); - - /* skip the rest members and the color table. */ - p += sizeof(DWORD32)*4 + sizeof(BYTE)*(4<idx_znode; - info.hwnd = (HWND)drag_info->location; + info.location = drag_info->location; info.rc.left = drag_info->init_x; info.rc.top = drag_info->init_y; @@ -521,15 +521,15 @@ static int cliStartDragWindow (PMAINWIN pWin, const DRAGINFO* drag_info) req.data = &info; req.len_data = sizeof (ZORDEROPINFO); - if (ClientRequest (&req, &ret, sizeof (int)) < 0) + if (ClientRequest (&req, &ret, sizeof (intptr_t)) < 0) return -1; return ret; } -static int cliCancelDragWindow (PMAINWIN pWin) +static intptr_t cliCancelDragWindow (PMAINWIN pWin) { - int ret; + intptr_t ret; REQUEST req; ZORDEROPINFO info; @@ -540,15 +540,15 @@ static int cliCancelDragWindow (PMAINWIN pWin) req.data = &info; req.len_data = sizeof (ZORDEROPINFO); - if (ClientRequest (&req, &ret, sizeof (int)) < 0) + if (ClientRequest (&req, &ret, sizeof (intptr_t)) < 0) return -1; return ret; } -static int cliChangeCaption (PMAINWIN pWin) +static intptr_t cliChangeCaption (PMAINWIN pWin) { - int ret; + intptr_t ret; REQUEST req; ZORDEROPINFO info; @@ -565,7 +565,7 @@ static int cliChangeCaption (PMAINWIN pWin) req.id = REQID_ZORDEROP; req.data = &info; req.len_data = sizeof (ZORDEROPINFO); - if ((ret = ClientRequest (&req, &ret, sizeof (int))) < 0) { + if ((ret = ClientRequest (&req, &ret, sizeof (intptr_t))) < 0) { return -1; } @@ -588,9 +588,9 @@ void __mg_start_server_desktop (void) SendMessage (HWND_DESKTOP, MSG_ERASEDESKTOP, 0, 0); } -static int cliAllocZOrderMaskRect (HWND pWin, const RECT4MASK* rc, int nr_rc) +static intptr_t cliAllocZOrderMaskRect (HWND pWin, const RECT4MASK* rc, int nr_rc) { - int ret; + intptr_t ret; REQUEST req; ZORDERMASKRECTOPINFO info; @@ -607,16 +607,16 @@ static int cliAllocZOrderMaskRect (HWND pWin, const RECT4MASK* rc, int nr_rc) req.len_data = sizeof (info); if ((ret = ClientRequestEx (&req, rc, sizeof(RECT4MASK)*nr_rc, - &ret, sizeof (int))) < 0) { + &ret, sizeof (intptr_t))) < 0) { return -1; } return ret; } -static int cliFreeZOrderMaskRect (PMAINWIN pWin) +static intptr_t cliFreeZOrderMaskRect (PMAINWIN pWin) { - int ret; + intptr_t ret; REQUEST req; ZORDERMASKRECTOPINFO info; @@ -628,7 +628,7 @@ static int cliFreeZOrderMaskRect (PMAINWIN pWin) req.data = &info; req.len_data = sizeof(ZORDERMASKRECTOPINFO); - if ((ret = ClientRequest (&req, &ret, sizeof (int))) < 0) { + if ((ret = ClientRequest (&req, &ret, sizeof (intptr_t))) < 0) { return -1; } return ret; @@ -680,7 +680,7 @@ static BOOL _cb_update_cli_znode (void* context, const ZORDERINFO* zi, ZORDERNODE* znode) { RECT rcInv; - int cli = (int)context; + int cli = (int)(intptr_t)context; if (znode->cli == cli && znode->flags & ZOF_VISIBLE && znode->fortestinghwnd) { MSG msg = {znode->fortestinghwnd, MSG_UPDATECLIWIN, 0, 0, __mg_timer_counter}; @@ -706,20 +706,20 @@ void __mg_check_dirty_znode (int cli) { ZORDERINFO* zi = (ZORDERINFO *)get_zi_from_client (cli); - do_for_all_znodes ((void*)cli, zi, + do_for_all_znodes ((void*)(intptr_t)cli, zi, _cb_update_cli_znode, ZT_TOPMOST | ZT_NORMAL); mgClients [cli].has_dirty = FALSE; } -static int srvSetActiveWindow (int cli, int idx_znode) +static intptr_t srvSetActiveWindow (int cli, int idx_znode) { - int ret = dskSetActiveZOrderNode (cli, idx_znode); + HWND hRet = dskSetActiveZOrderNode (cli, idx_znode); - if ((ret != HWND_INVALID) && OnZNodeOperation) + if ((hRet != HWND_INVALID) && OnZNodeOperation) OnZNodeOperation (ZNOP_SETACTIVE, cli, idx_znode); - return ret; + return (intptr_t)hRet; } static int srvFreeZOrderNode (int cli, int idx_znode) @@ -1024,10 +1024,10 @@ static int srvChangeCaption (int cli, int idx_znode, const char *caption) return 0; } -int __mg_do_zorder_maskrect_operation (int cli, +intptr_t __mg_do_zorder_maskrect_operation (int cli, const ZORDERMASKRECTOPINFO* info) { - int ret = -1; + intptr_t ret = -1; switch (info->id_op) { case ID_ZOOP_MASKRECT_SET: @@ -1042,9 +1042,9 @@ int __mg_do_zorder_maskrect_operation (int cli, return ret; } -int __mg_do_zorder_operation (int cli, const ZORDEROPINFO* info) +intptr_t __mg_do_zorder_operation (int cli, const ZORDEROPINFO* info) { - int ret = -1; + intptr_t ret = -1; switch (info->id_op) { case ID_ZOOP_ALLOC: @@ -1084,7 +1084,7 @@ int __mg_do_zorder_operation (int cli, const ZORDEROPINFO* info) ret = srvEnableWindow (cli, info->idx_znode, info->flags); break; case ID_ZOOP_STARTDRAG: - ret = srvStartDragWindow (cli, info->idx_znode, (int)info->hwnd, + ret = srvStartDragWindow (cli, info->idx_znode, info->location, info->rc.left, info->rc.top); break; case ID_ZOOP_CANCELDRAG: @@ -1131,7 +1131,7 @@ static BOOL _cb_intersect_rc_no_cli (void* context, static BOOL _cb_update_rc_nocli (void* context, const ZORDERINFO* zi, ZORDERNODE* node) { - int cli = (int)context; + int cli = (int)(intptr_t)context; if (node->flags & ZOF_VISIBLE && node->cli != cli && //SubtractClipRect (&sg_UpdateRgn, &node->rc)) { @@ -1169,7 +1169,7 @@ int __mg_remove_all_znodes_of_client (int cli) SetClipRgn (&sg_UpdateRgn, &rc_bound); /* check influenced window zorder nodes */ - do_for_all_znodes ((void*)cli, zi, _cb_update_rc_nocli, ZT_ALL); + do_for_all_znodes ((void*)(intptr_t)cli, zi, _cb_update_rc_nocli, ZT_ALL); if (SubtractClipRect (&sg_UpdateRgn, &g_rcScr)) { nodes [0].age ++; @@ -2038,7 +2038,7 @@ static int dskChangeCaption (PMAINWIN pWin) return cliChangeCaption (pWin); } -static int dskWindowMessageHandler (int message, PMAINWIN pWin, LPARAM lParam) +static LRESULT dskWindowMessageHandler (UINT message, PMAINWIN pWin, LPARAM lParam) { switch (message) { case MSG_ADDNEWMAINWIN: @@ -2068,16 +2068,16 @@ static int dskWindowMessageHandler (int message, PMAINWIN pWin, LPARAM lParam) break; case MSG_GETACTIVEMAIN: - return (int)dskGetActiveWindow (NULL); + return (LRESULT)dskGetActiveWindow (NULL); case MSG_SETACTIVEMAIN: - return (int)dskSetActiveWindow (pWin); + return (LRESULT)dskSetActiveWindow (pWin); case MSG_GETCAPTURE: - return (int)dskGetCaptureWindow (); + return (LRESULT)dskGetCaptureWindow (); case MSG_SETCAPTURE: - return (int)dskSetCaptureWindow (pWin); + return (LRESULT)dskSetCaptureWindow (pWin); #ifdef _MGHAVE_MENU case MSG_TRACKPOPUPMENU: @@ -2116,11 +2116,11 @@ static int dskWindowMessageHandler (int message, PMAINWIN pWin, LPARAM lParam) HCURSOR old = pWin->hCursor; pWin->hCursor = (HCURSOR)lParam; - return old; + return (LRESULT)old; } case MSG_GETNEXTMAINWIN: - return (int)dskGetNextMainWindow (pWin); + return (LRESULT)dskGetNextMainWindow (pWin); case MSG_SHOWGLOBALCTRL: { @@ -2375,7 +2375,7 @@ int __mg_handle_normal_mouse_move (const ZORDERINFO* zi, int x, int y) ZORDERNODE* nodes = GET_ZORDERNODE(zi); static int old_slot, old_cli; - static int old_hwnd; + static HWND old_hwnd; int cur_slot; int cur_cli = 0; @@ -3236,7 +3236,7 @@ static void srvSaveScreen (BOOL active) rcActive = g_rcScr; } - sprintf (buffer, "%d-%x-%d.bmp", cliActive, hwndActive, n); + sprintf (buffer, "%d-%p-%d.bmp", cliActive, hwndActive, n); if (SaveScreenRectContent (&rcActive, buffer)) { Ping (); n ++; @@ -3461,7 +3461,7 @@ static int srvSesseionMessageHandler (int message, WPARAM wParam, LPARAM lParam) } -int DesktopWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +LRESULT DesktopWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int flags, x, y; @@ -3597,10 +3597,10 @@ int DesktopWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) return dskOnRemoveCtrlInstance ((PCONTROL)wParam, (PCONTROL)lParam); case MSG_GETCTRLCLASSINFO: - return (int)gui_GetControlClassInfo ((const char*)lParam); + return (LRESULT)gui_GetControlClassInfo ((const char*)lParam); case MSG_CTRLCLASSDATAOP: - return (int)gui_ControlClassDataOp (wParam, (WNDCLASS*)lParam); + return (LRESULT)gui_ControlClassDataOp (wParam, (WNDCLASS*)lParam); case MSG_IME_REGISTER: if (mgIsServer) diff --git a/src/kernel/desktop.c b/src/kernel/desktop.c index 12ab2cc4..73da3379 100644 --- a/src/kernel/desktop.c +++ b/src/kernel/desktop.c @@ -2558,8 +2558,7 @@ static int dskMoveWindow (int cli, int idx_znode, const RECT* rcWin) nodes [idx_znode].age ++; #if defined (_MGRM_PROCESSES) && !defined (_MGRM_STANDALONE) - if (cli == 0 - || (DWORD)mgClients [cli].layer == SHAREDRES_TOPMOST_LAYER) { + if (cli == 0 || mgClients [cli].layer == SHAREDRES_TOPMOST_LAYER) { #endif /* Copy window content to new postion */ InitClipRgn (&bblt_rgn, &sg_FreeClipRectList); diff --git a/src/kernel/timer.c b/src/kernel/timer.c index f38783b1..4875127c 100644 --- a/src/kernel/timer.c +++ b/src/kernel/timer.c @@ -28,6 +28,7 @@ #include "timer.h" #ifdef _MGRM_PROCESSES +#include "ourhdr.h" #include "client.h" #include "sharedres.h" #endif diff --git a/src/misc/about.c b/src/misc/about.c index d5939af5..2e09186b 100644 --- a/src/misc/about.c +++ b/src/misc/about.c @@ -78,6 +78,7 @@ static LRESULT AboutWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar case MSG_CLOSE: sg_AboutWnd = 0; DestroyAllControls (hWnd); + DestroyMainWindow (hWnd); #ifdef _MGRM_THREADS PostQuitMessage (hWnd); #endif @@ -138,7 +139,6 @@ static void* AboutDialogThread (void* data) DispatchMessage(&Msg); } - DestroyMainWindow (hMainWnd); MainWindowThreadCleanup(hMainWnd); return NULL; } diff --git a/src/newgal/pcxvfb/pcxvfb.c b/src/newgal/pcxvfb/pcxvfb.c index 2ef7db18..a0e59afc 100644 --- a/src/newgal/pcxvfb/pcxvfb.c +++ b/src/newgal/pcxvfb/pcxvfb.c @@ -156,11 +156,10 @@ static int execl_pcxvfb(void) skin[0] = '\0'; GetMgEtcValue("pc_xvfb", "skin", skin, sizeof(skin)-1); - - fprintf(stderr,"start-qvfb :%s pcxvfb %s %s %s %s\n", execl_file, ch_pid, window_caption, mode, skin); + _MG_PRINTF ("IAL>PCXVFB: start-qvfb :%s pcxvfb %s %s %s %s\n", execl_file, ch_pid, window_caption, mode, skin); if (execlp(execl_file, "pcxvfb", ch_pid, window_caption, mode, skin, NULL) < 0) { - fprintf(stderr, "execlp error!!\n"); + _MG_PRINTF ("IAL>PCXVFB: failed to start the virtual frame buffer process!\n"); } return 0; @@ -400,14 +399,12 @@ static int PCXVFB_VideoInit (_THIS, GAL_PixelFormat *vformat) //shm_init_lock(getpid()); - if ((pid = fork()) < 0) - { - fprintf(stderr, "fork() error in pcxvfb\n"); + if ((pid = fork()) < 0) { + _MG_PRINTF ("NEWGAL>PCXVFB: fork() error.\n"); } - else if (pid == 0) - { + else if (pid == 0) { if (execl_pcxvfb() == ERR_CONFIG_FILE) - fprintf(stderr, "PCXVFB GAL: Reading configuration failure!\n"); + _MG_PRINTF ("NEWGAL>PCXVFB: failed to read configuration failure.\n"); perror ("execl"); _exit (1); @@ -431,7 +428,6 @@ static int PCXVFB_VideoInit (_THIS, GAL_PixelFormat *vformat) close(fd); #else //-----------------linux---------------------- - int display; pid_t pid; int server_len; @@ -465,24 +461,21 @@ static int PCXVFB_VideoInit (_THIS, GAL_PixelFormat *vformat) shm_init_lock(getpid()); if ((pid = fork()) < 0) { - fprintf(stderr, "fork() error in pcxvfb\n"); - }else if (pid > 0) { + GAL_SetError ("NEWGAL>PCXVFB: Error occurred when calling fork().\n"); + } else if (pid > 0) { ;/* do nothing */ - }else { + } else { if (setpgid(getpid(), 0) < 0) { - fprintf(stderr, "Warning: Failed to change the group id of the VFB process.\n"); + GAL_SetError ("NEWGAL>PCXVFB: Failed to change the group id of the XVFB process.\n"); } if (execl_pcxvfb() == ERR_CONFIG_FILE) - fprintf(stderr, "PCXVFB GAL: Reading configuration failure!\n"); + GAL_SetError ("NEWGAL>PCXVFB: Reading configuration failure!\n"); perror ("execl"); _exit (1); } - if (GetMgEtcIntValue ("qvfb", "display", &display) < 0) - display = 0; - { fd_set rset; struct timeval tv; @@ -527,24 +520,32 @@ static int PCXVFB_VideoInit (_THIS, GAL_PixelFormat *vformat) if (shmid != -1) { data->shmrgn = (unsigned char *)shmat (shmid, 0, 0); #ifdef _MGRM_PROCESSES - fp = fopen("/tmp/.pcxvfb_tmp", "w+"); + fp = fopen("/var/tmp/.pcxvfb_tmp", "w+"); if (fp == NULL) { - fprintf(stderr, "mgServer can't open file /tmp/.pcxvfb_tmp\n"); + GAL_SetError ("NEWGAL>PCXVFB: mgServer can't open file /var/tmp/.pcxvfb_tmp\n"); return -1; } - fwrite(&shmid, sizeof(int), 1, fp); + + fwrite (&shmid, sizeof(int), 1, fp); fclose(fp); #endif } #if defined(_MGRM_PROCESSES) && !defined(_MGRM_STANDALONE) - } else { - fp = fopen("/tmp/.pcxvfb_tmp", "r"); + } + else { + fp = fopen ("/var/tmp/.pcxvfb_tmp", "r"); if (fp == NULL) { - fprintf(stderr, "minigui can't open file /tmp/.pcxvfb_tmp\n"); + GAL_SetError ("NEWGAL>PCXVFB: can't open file /var/tmp/.pcxvfb_tmp\n"); return -1; } - fread(&shmid, sizeof(int), 1, fp); + + if (fread(&shmid, sizeof(int), 1, fp) < 1) { + GAL_SetError ("NEWGAL>PCXVFB: can't read from /var/tmp/.pcxvfb_tmp\n"); + fclose (fp); + return -1; + } + fclose(fp); if (shmid != -1) { @@ -555,8 +556,7 @@ static int PCXVFB_VideoInit (_THIS, GAL_PixelFormat *vformat) #endif //end of os (windows, cygwin, linux) if ((INT_PTR)data->shmrgn == -1 || data->shmrgn == NULL) { - GAL_SetError ("NEWGAL>PCXVFB: Unable to attach to " - "virtual FrameBuffer server.\n"); + GAL_SetError ("NEWGAL>PCXVFB: Unable to attach to virtual frame buffer server.\n"); return -1; } @@ -597,8 +597,8 @@ static int PCXVFB_VideoInit (_THIS, GAL_PixelFormat *vformat) vformat->Bmask = data->hdr->Bmask; break; default: - GAL_SetError ("NEWGAL>PCXQVFB: Not supported depth: %d, " - "please try to use Shadow NEWGAL engine with targetname qvfb.\n", + GAL_SetError ("NEWGAL>PCXVFB: Not supported depth: %d, " + "please try to use Shadow NEWGAL engine with targetname pc_xvfb.\n", vformat->BitsPerPixel); return -1; } diff --git a/src/server/client.c b/src/server/client.c index 47bda1dc..3479d216 100644 --- a/src/server/client.c +++ b/src/server/client.c @@ -42,8 +42,8 @@ int mgClientSize = 0; #define off_pointer(p,off) \ do { \ if (p) { \ - unsigned int tmp; \ - tmp = (unsigned int)p; \ + intptr_t tmp; \ + tmp = (intptr_t)p; \ tmp += off; \ p = (void*)tmp; \ } \ @@ -190,7 +190,7 @@ void __mg_remove_client (int cli, int clifd) close (clifd); } -int __mg_send2client (MSG* msg, MG_Client* client) +int __mg_send2client (const MSG* msg, MG_Client* client) { int ret; @@ -243,7 +243,7 @@ void __mg_set_active_client (MG_Client* client) } /* send message to client(s) */ -int GUIAPI Send2Client (MSG* msg, int cli) +int GUIAPI Send2Client (const MSG* msg, int cli) { int i, n; @@ -296,9 +296,9 @@ int GUIAPI Send2Client (MSG* msg, int cli) return SOCKERR_OK; } -BOOL GUIAPI Send2TopMostClients (int iMsg, WPARAM wParam, LPARAM lParam) +BOOL GUIAPI Send2TopMostClients (UINT nMsg, WPARAM wParam, LPARAM lParam) { - MSG msg = {0, iMsg, wParam, lParam, __mg_timer_counter}; + MSG msg = {0, nMsg, wParam, lParam, __mg_timer_counter}; if (!mgIsServer) return FALSE; @@ -310,7 +310,7 @@ BOOL GUIAPI Send2TopMostClients (int iMsg, WPARAM wParam, LPARAM lParam) } BOOL GUIAPI Send2ActiveWindow (const MG_Layer* layer, - int iMsg, WPARAM wParam, LPARAM lParam) + UINT nMsg, WPARAM wParam, LPARAM lParam) { int active_win; @@ -322,7 +322,7 @@ BOOL GUIAPI Send2ActiveWindow (const MG_Layer* layer, return FALSE; if (__mg_post_msg_by_znode (layer->zorder_info, - active_win, iMsg, wParam, lParam) > 0) + active_win, nMsg, wParam, lParam) > 0) return TRUE; return FALSE; diff --git a/src/server/layer.c b/src/server/layer.c index 984d46fe..e7f4f555 100644 --- a/src/server/layer.c +++ b/src/server/layer.c @@ -89,7 +89,7 @@ static BOOL do_alloc_layer (MG_Layer* layer, const char* name, zi->active_win = 0; zi->cli_trackmenu = -1; - zi->ptmi_in_cli = -1; + zi->ptmi_in_cli = HWND_INVALID; zi->zi_semid = SHAREDRES_SEMID_LAYER; diff --git a/src/server/request.c b/src/server/request.c index d850de04..526986c3 100644 --- a/src/server/request.c +++ b/src/server/request.c @@ -170,7 +170,7 @@ static int create_cursor (int cli, int clifd, void* buff, size_t len) static int copy_cursor (int cli, int clifd, void* buff, size_t len) { - HCURSOR hcsr = CopyCursor ((HCURSOR)*(int*)buff); + HCURSOR hcsr = CopyCursor ((HCURSOR)*(intptr_t*)buff); #ifdef _MGHAVE_CURSOR if (hcsr) { add_global_res (cli, (void*) hcsr, (void*)hcsr, NULL); @@ -338,22 +338,22 @@ ret: static int zorder_op (int cli, int clifd, void* buff, size_t len) { - int ret_value; + intptr_t ret_value; ZORDEROPINFO* info = (ZORDEROPINFO*)buff; ret_value = __mg_do_zorder_operation (cli, info); - return ServerSendReply (clifd, &ret_value, sizeof (int)); + return ServerSendReply (clifd, &ret_value, sizeof (intptr_t)); } static int change_zorder_maskrect (int cli, int clifd, void* buff, size_t len) { - int ret_value; + intptr_t ret_value; ZORDERMASKRECTOPINFO* info = (ZORDERMASKRECTOPINFO *)buff; info->rc = (RECT4MASK*)(buff + sizeof (ZORDERMASKRECTOPINFO)); ret_value = __mg_do_zorder_maskrect_operation (cli, info); - return ServerSendReply (clifd, &ret_value, sizeof (int)); + return ServerSendReply (clifd, &ret_value, sizeof (intptr_t)); } #ifdef _MGGAL_SIGMA8654 extern int Sigma8654_ServerOnGetSurface(REQ_SIGMA8654_GETSURFACE *request, REP_SIGMA8654_GETSURFACE *reply); From 56f55fad9bc42561429db730e26969b5166003f4 Mon Sep 17 00:00:00 2001 From: VincentWei Date: Fri, 19 Jan 2018 17:18:07 +0800 Subject: [PATCH 10/26] use with-runmode instead of enable-options for runtime modes --- configure.ac | 96 +++++++++++++++++++--------------------------------- 1 file changed, 35 insertions(+), 61 deletions(-) diff --git a/configure.ac b/configure.ac index 8ba71a9f..e2194b45 100644 --- a/configure.ac +++ b/configure.ac @@ -86,8 +86,11 @@ devel_mode="no" use_debug="no" trace_message="no" message_string="no" -procs_version="no" + +runtime_mode="ths" + stand_alone="no" + incore_res="no" use_miniguientry="no" fixed_math="yes" @@ -295,9 +298,9 @@ AC_ARG_ENABLE(msgstr, [ --enable-msgstr include symbol name of message ], message_string=$enableval) -AC_ARG_ENABLE(procs, -[ --enable-procs build MiniGUI-Processes version ], -procs_version=$enableval) +AC_ARG_WITH(runmode, +[ --with-runmode=ths/procs/sa the MiniGUI runtime mode ], +runtime_mode=$withval) AC_ARG_ENABLE(standalone, [ --enable-standalone build MiniGUI-Standalone version ], @@ -1294,12 +1297,6 @@ CheckS3C6410Video() dnl ======================================================================== dnl Checks for option-specific libraries and headers. -if test "x$procs_version" = "xyes"; then - use_threads="no" -else - use_threads="yes" -fi - dnl Checks NewGAL Engine. { CheckDummyVideo @@ -1332,25 +1329,6 @@ dnl Checks NewGAL Engine. dnl ======================================================================== dnl Checks for libraries. -have_pthreads=no -if test "x$use_threads" != "xno"; then - AC_MSG_CHECKING(for pthread library) - TMP_SAVE_LIBS=$LIBS - AC_TRY_LINK([ -#include "confdefs.h" -#define __C_ASM_H /* fix for retarded Digital Unix headers */ -#include ],[ -void foo(void) -{ -pthread_exit (0); -} -], - have_pthreads=yes - AC_MSG_RESULT(yes), - AC_MSG_RESULT(no)) - LIBS=$TMP_SAVE_LIBS -fi - dnl Check for JPEG library. if test "x$build_jpg_support" != "xno"; then AC_CHECK_LIB(jpeg, jpeg_std_error, @@ -1407,15 +1385,17 @@ case "$with_libsuffix" in ;; "") conf="MiniGUI.cfg" - if test "x$procs_version" = "xyes"; then - if test "x$stand_alone" = "xyes"; then + case "$runtime_mode" in + sa) MGLIB_SUFFIX="sa" - else + ;; + procs) MGLIB_SUFFIX="procs" - fi - else - MGLIB_SUFFIX="ths" - fi + ;; + *) + MGLIB_SUFFIX="ths" + ;; + esac ;; *) conf="MiniGUI.cfg" @@ -1621,29 +1601,27 @@ fi CFLAGS="$CFLAGS -D__MINIGUI_LIB__" -if test "x$stand_alone" = "xyes"; then - procs_version="yes" -fi - -if test "x$procs_version" = "xyes"; then - if test "x$stand_alone" = "xyes"; then +case "$runtime_mode" in + sa) AC_DEFINE(_MGRM_STANDALONE, 1, [Define if build MiniGUI-Standalone]) AC_DEFINE(_STAND_ALONE, 1, [Define if build MiniGUI-Standalone (back-compatibility definition)]) AC_DEFINE(_LITE_VERSION, 1, [Define if build MiniGUI-Standalone (back-compatibility definition)]) - else + ;; + procs) AC_DEFINE(_MGRM_PROCESSES, 1, [Define if build MiniGUI-Processes]) AC_DEFINE(_LITE_VERSION, 1, [Define if build MiniGUI-Processes (back-compatibility definition)]) - fi -else - AC_DEFINE(_MGRM_THREADS, 1, + ;; + *) + AC_DEFINE(_MGRM_THREADS, 1, [Define if build MiniGUI-Threads]) - CFLAGS="$CFLAGS -D_REENTRANT" -fi + CFLAGS="$CFLAGS -D_REENTRANT" + ;; +esac if test "x$incore_res" = "xno"; then AC_DEFINE_UNQUOTED(ETCFILENAME, "${conf}", [MiniGUI configure file name]) @@ -2459,28 +2437,26 @@ if test "x$build_productid" = "xyes"; then [Define if insert a productid into the library file]) fi +dnl ======================================================================== +dnl Write output + +# define _GNU_SOURCE for pthread_rwlock_t +CFLAGS="$CFLAGS -D_GNU_SOURCE" + if test "$ac_cv_prog_gcc" = "yes"; then CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -pipe" fi -# define _GNU_SOURCE for pthread_rwlock_t -CFLAGS="$CFLAGS -D_GNU_SOURCE" -# define _GNU_SOURCE for pthread_rwlock_t -CFLAGS="$CFLAGS -D_GNU_SOURCE" - -if test "x$have_pthreads" = "xyes"; then +if test "$runtime_mode" = "ths"; then DEP_LIBS="$DEP_LIBS -lpthread" fi -dnl ======================================================================== -dnl Write output - AC_SUBST(VIDEO_SUBDIRS) AC_SUBST(VIDEO_DRIVERS) AC_SUBST(DEP_LIBS) -AM_CONDITIONAL(MGRM_PROCESSES, test "x$procs_version" = "xyes") -AM_CONDITIONAL(MGRM_STANDALONE, test "x$stand_alone" = "xyes") +AM_CONDITIONAL(MGRM_PROCESSES, test "x$runtime_mode" = "xprocs") +AM_CONDITIONAL(MGRM_STANDALONE, test "x$runtime_mode" = "xsa") AM_CONDITIONAL(MGIAL_CONSOLE, test "x$build_console_ial_engine" = "xyes") AM_CONDITIONAL(MGIAL_NEXUS, test "x$build_nexus_ial_engine" = "xyes") AM_CONDITIONAL(MGIAL_DLCUSTOM, test "x$build_dlcustom_ial_engine" = "xyes") @@ -2494,8 +2470,6 @@ AM_CONDITIONAL(MGLIB_MVFB, test "x$with_libsuffix" = "xmvfb") AM_CONDITIONAL(MG_MINIMALGDI, test "x$build_minimalgdi" = "xyes") AM_CONDITIONAL(MG_ENABLE_SPLASH, test "x$build_splash" = "xyes") AM_CONDITIONAL(MG_ENABLE_SCREENSAVER, test "x$build_screensaver" = "xyes") -#AM_CONDITIONAL(MGPLUS_FONT_SEF, test "x$build_sef_support" = "xyes") - AC_OUTPUT( minigui.pc From 4bbcc76f82e275c4736e9ca110fb63db215630ea Mon Sep 17 00:00:00 2001 From: VincentWei Date: Fri, 19 Jan 2018 17:24:27 +0800 Subject: [PATCH 11/26] tune code for 64 bits --- src/textedit/object.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/textedit/object.c b/src/textedit/object.c index 9ff266ab..39c2215d 100644 --- a/src/textedit/object.c +++ b/src/textedit/object.c @@ -200,6 +200,22 @@ BOOL ncsInstanceOf(mObject *object, mObjectClass* clss) return objClss != NULL; } +static inline int _va_check (va_list va) +{ + union { + va_list va; + DWORD dva; + } _va; + + if (va == 0) + return 0; + + va_copy (_va.va, va); + if(_va.dva == 0) + return 0; + + return 1; +} int ncsParseConstructParams(va_list args, const char* signature, ...) { @@ -214,6 +230,8 @@ int ncsParseConstructParams(va_list args, const char* signature, ...) if(GET_ARG_COUNT(args) <= 0) return 0; */ + if (_va_check (args) == 0) + return 0; argc = va_arg(args, int); if(argc <= 0) From c1071cde849f55fb8e2202a4f33608a9eb2f7cb6 Mon Sep 17 00:00:00 2001 From: VincentWei Date: Fri, 19 Jan 2018 17:37:31 +0800 Subject: [PATCH 12/26] tune code for 64 bits --- src/textedit/object.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/textedit/object.c b/src/textedit/object.c index 39c2215d..63ff4e9b 100644 --- a/src/textedit/object.c +++ b/src/textedit/object.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "common.h" #include "minigui.h" @@ -202,6 +203,7 @@ BOOL ncsInstanceOf(mObject *object, mObjectClass* clss) static inline int _va_check (va_list va) { +#if 0 union { va_list va; DWORD dva; @@ -215,6 +217,16 @@ static inline int _va_check (va_list va) return 0; return 1; +#else + intptr_t zero = 0; + size_t n = sizeof (intptr_t); + + if (sizeof (va_list) < n) { + n = sizeof (va_list); + } + + return memcmp (&zero, &va, n); +#endif } int ncsParseConstructParams(va_list args, const char* signature, ...) From ec35c3552abcd64410ff7976e90549e465f7d431 Mon Sep 17 00:00:00 2001 From: VincentWei Date: Fri, 19 Jan 2018 19:44:33 +0800 Subject: [PATCH 13/26] DEP_LIBS += freetype --- configure.ac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index e2194b45..0d97c5d0 100644 --- a/configure.ac +++ b/configure.ac @@ -2055,6 +2055,7 @@ case "$use_ttf_lib" in FT1_INC_DIR="-I$with_ft1_includes" fi + DEP_LIBS="$DEP_LIBS -lttf" AC_SUBST(FT1_INC_DIR) ;; ft2) @@ -2071,6 +2072,7 @@ case "$use_ttf_lib" in FT2_INC_DIR="-I$with_ft2_includes" fi + DEP_LIBS="$DEP_LIBS -lfreetype" AC_SUBST(FT2_INC_DIR) ;; esac From 599c98514621d96a13445201f40e8f67af103e9d Mon Sep 17 00:00:00 2001 From: WEI Yongming Date: Fri, 19 Jan 2018 22:41:37 +0800 Subject: [PATCH 14/26] tune code for 64-bit and 32-bit --- configure.ac | 16 ++++++++-------- src/control/bidiedit.c | 2 +- src/font/devfont.c | 4 ++-- src/font/logfont.c | 8 ++++---- src/gui/lf_manager.c | 2 +- src/gui/menu.c | 6 +++--- src/kernel/cursor.c | 4 ++-- src/kernel/desktop-ths.c | 10 +++++----- src/kernel/message.c | 14 +++++++------- 9 files changed, 33 insertions(+), 33 deletions(-) diff --git a/configure.ac b/configure.ac index 0d97c5d0..e8c06c2e 100644 --- a/configure.ac +++ b/configure.ac @@ -87,7 +87,7 @@ use_debug="no" trace_message="no" message_string="no" -runtime_mode="ths" +runtime_mode="procs" stand_alone="no" @@ -299,7 +299,7 @@ AC_ARG_ENABLE(msgstr, message_string=$enableval) AC_ARG_WITH(runmode, -[ --with-runmode=ths/procs/sa the MiniGUI runtime mode ], +[ --with-runmode=procs/ths/sa the MiniGUI runtime mode ], runtime_mode=$withval) AC_ARG_ENABLE(standalone, @@ -1389,11 +1389,11 @@ case "$with_libsuffix" in sa) MGLIB_SUFFIX="sa" ;; - procs) - MGLIB_SUFFIX="procs" + ths) + MGLIB_SUFFIX="ths" ;; *) - MGLIB_SUFFIX="ths" + MGLIB_SUFFIX="procs" ;; esac ;; @@ -1610,13 +1610,13 @@ case "$runtime_mode" in AC_DEFINE(_LITE_VERSION, 1, [Define if build MiniGUI-Standalone (back-compatibility definition)]) ;; - procs) + ths) AC_DEFINE(_MGRM_PROCESSES, 1, [Define if build MiniGUI-Processes]) AC_DEFINE(_LITE_VERSION, 1, [Define if build MiniGUI-Processes (back-compatibility definition)]) ;; - *) + procs) AC_DEFINE(_MGRM_THREADS, 1, [Define if build MiniGUI-Threads]) CFLAGS="$CFLAGS -D_REENTRANT" @@ -2449,7 +2449,7 @@ if test "$ac_cv_prog_gcc" = "yes"; then CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -pipe" fi -if test "$runtime_mode" = "ths"; then +if test "x$runtime_mode" = "xths"; then DEP_LIBS="$DEP_LIBS -lpthread" fi diff --git a/src/control/bidiedit.c b/src/control/bidiedit.c index ed703403..49168049 100644 --- a/src/control/bidiedit.c +++ b/src/control/bidiedit.c @@ -2466,7 +2466,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) unsigned char charBuffer [3]; int chars; - _MG_PRINTF("get char-----------------char----%lx\n", wParam); + _MG_PRINTF("get char-----------------char----%p\n", (PVOID)wParam); if (wParam == 127) // BS wParam = '\b'; diff --git a/src/font/devfont.c b/src/font/devfont.c index da65a747..72bb5c01 100644 --- a/src/font/devfont.c +++ b/src/font/devfont.c @@ -271,9 +271,9 @@ unsigned short font_GetBestScaleFactor (int height, int expect) { \ devfont = head; \ while (devfont) { \ - fprintf (stderr, " %d: %s, charsetname: %s, style: %lx\n", \ + fprintf (stderr, " %d: %s, charsetname: %s, style: %p\n", \ count, \ - devfont->name, devfont->charset_ops->name, devfont->style); \ + devfont->name, devfont->charset_ops->name, (PVOID)devfont->style); \ devfont = devfont->next; \ count++; \ } \ diff --git a/src/font/logfont.c b/src/font/logfont.c index 60364bb7..4c3972d9 100644 --- a/src/font/logfont.c +++ b/src/font/logfont.c @@ -102,8 +102,8 @@ static PLOGFONT gdiCreateLogFont (const char* type, const char* family, log_font->sbc_scale = 1; log_font->mbc_scale = 1; - _MG_PRINTF ("FONT>LogFont: requested info: type: %s, family: %s, style: %lx, charset: %s, size: %d.\n", - log_font->type, log_font->family, log_font->style, log_font->charset, + _MG_PRINTF ("FONT>LogFont: requested info: type: %s, family: %s, style: %p, charset: %s, size: %d.\n", + log_font->type, log_font->family, (PVOID)log_font->style, log_font->charset, log_font->size); sbc_devfont = font_GetMatchedSBDevFont (log_font); @@ -223,8 +223,8 @@ static PLOGFONT gdiCreateLogFont (const char* type, const char* family, log_font->style &= ~FS_FLIP_HORZVERT; } - _MG_PRINTF ("FONT>LogFont: created info: type: %s, family: %s, style: %lx, charset: %s, size: %d.\n", - log_font->type, log_font->family, log_font->style, log_font->charset, + _MG_PRINTF ("FONT>LogFont: created info: type: %s, family: %s, style: %p, charset: %s, size: %d.\n", + log_font->type, log_font->family, (PVOID)log_font->style, log_font->charset, log_font->size); return log_font; diff --git a/src/gui/lf_manager.c b/src/gui/lf_manager.c index 6af2a188..ef27ad94 100644 --- a/src/gui/lf_manager.c +++ b/src/gui/lf_manager.c @@ -600,7 +600,7 @@ void dump_window_element_data (HWND hwnd) break; case WE_ATTR_TYPE_COLOR: - _MG_PRINTF ("\tcolor in list: %lx.\n", wed->data); + _MG_PRINTF ("\tcolor in list: %p.\n", (PVOID)wed->data); } } _MG_PRINTF ("GUI>DumpWED: Done\n"); diff --git a/src/gui/menu.c b/src/gui/menu.c index f892b8e2..33c2f39d 100644 --- a/src/gui/menu.c +++ b/src/gui/menu.c @@ -1199,12 +1199,12 @@ void mnuDumpMenuItem (PMENUITEM pmi) printf ("\tmenu state: %#x\n", pmi->mnustate); printf ("\tmenu id: %d\n", pmi->id); printf ("\tchecked bitmap: 0x%p\n", pmi->checkedbmp); - printf ("\tunchecked bitmap: 0x%p\n", pmi->uncheckedbmp); - printf ("\titem data: %lu\n", pmi->itemdata); + printf ("\tunchecked bitmap:0x%p\n", pmi->uncheckedbmp); + printf ("\titem data: %p\n", (PVOID)pmi->itemdata); if (pmi->mnutype == MFT_STRING) printf ("\tstring: %s\n", (char*)pmi->typedata); else - printf ("\ttype data: %lu\n", pmi->typedata); + printf ("\ttype data: %p\n", (PVOID)pmi->typedata); printf ("\tnext item: 0x%p\n", pmi->next); if (pmi->submenu) { diff --git a/src/kernel/cursor.c b/src/kernel/cursor.c index 66342ee6..08fc5cdd 100644 --- a/src/kernel/cursor.c +++ b/src/kernel/cursor.c @@ -93,12 +93,12 @@ Uint8* GetPixelUnderCursor (int x, int y, gal_pixel* pixel) HCURSOR GUIAPI LoadCursorFromFile (const char* filename) { - return __mgLoadCursorFromFile (filename); + return load_cursor_from_file (filename); } HCURSOR GUIAPI LoadCursorFromMem (const void* area) { - return __mgLoadCursorFromMem (area); + return load_cursor_from_mem (area); } static BITMAP csr_bmp = { diff --git a/src/kernel/desktop-ths.c b/src/kernel/desktop-ths.c index b945c0ab..f3dee9ef 100644 --- a/src/kernel/desktop-ths.c +++ b/src/kernel/desktop-ths.c @@ -125,11 +125,11 @@ void* DesktopMain (void* data) LRESULT lRet = 0; #ifdef _MGHAVE_TRACE_MSG - fprintf (stderr, "Message, %s: hWnd: %p, wP: %#lx, lP: %#lx. %s\n", + fprintf (stderr, "Message, %s: hWnd: %p, wP: %p, lP: %p. %s\n", Message2Str (Msg.message), Msg.hwnd, - Msg.wParam, - Msg.lParam, + (PVOID)Msg.wParam, + (PVOID)Msg.lParam, Msg.pAdd?"Sync":"Normal"); #endif @@ -144,8 +144,8 @@ void* DesktopMain (void* data) } #ifdef _MGHAVE_TRACE_MSG - fprintf (stderr, "Message, %s done, return value: %lx\n", - Message2Str (Msg.message), lRet); + fprintf (stderr, "Message, %s done, return value: %p\n", + Message2Str (Msg.message), (PVOID)lRet); #endif } diff --git a/src/kernel/message.c b/src/kernel/message.c index 72983a89..aea1d7cf 100644 --- a/src/kernel/message.c +++ b/src/kernel/message.c @@ -421,8 +421,8 @@ const char* GUIAPI Message2Str (int message) void GUIAPI PrintMessage (FILE* fp, HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) { - fprintf (fp, "Message %s: hWnd: %p, wP: %lx, lP: %lx.\n", - Message2Str (nMsg), hWnd, wParam, lParam); + fprintf (fp, "Message %s: hWnd: %p, wP: %p, lP: %p.\n", + Message2Str (nMsg), hWnd, (PVOID)wParam, (PVOID)lParam); } #endif @@ -1029,11 +1029,11 @@ LRESULT GUIAPI DispatchMessage (PMSG pMsg) LICENSE_MODIFY_MESSAGE(pMsg); #ifdef _MGHAVE_TRACE_MSG - fprintf (stderr, "Message, %s: hWnd: %p, wP: %lx, lP: %lx. %s\n", + fprintf (stderr, "Message, %s: hWnd: %p, wP: %p, lP: %p. %s\n", Message2Str (pMsg->message), pMsg->hwnd, - pMsg->wParam, - pMsg->lParam, + (PVOID)pMsg->wParam, + (PVOID)pMsg->lParam, SYNMSGNAME); #endif @@ -1071,8 +1071,8 @@ LRESULT GUIAPI DispatchMessage (PMSG pMsg) #endif #ifdef _MGHAVE_TRACE_MSG - fprintf (stderr, "Message, %s done, return value: %lx\n", - Message2Str (pMsg->message), lRet); + fprintf (stderr, "Message, %s done, return value: %p\n", + Message2Str (pMsg->message), (PVOID)lRet); #endif return lRet; From 62ac274c27a5455bd0b097edfdfea9fd5697c121 Mon Sep 17 00:00:00 2001 From: WEI Yongming Date: Fri, 19 Jan 2018 23:28:43 +0800 Subject: [PATCH 15/26] --with-runmod=procs by default and --with-ttfsupport=ft2 by default --- configure.ac | 63 ++++++++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 36 deletions(-) diff --git a/configure.ac b/configure.ac index e8c06c2e..35651086 100644 --- a/configure.ac +++ b/configure.ac @@ -163,7 +163,7 @@ build_incorefont_times="yes" build_sef_support="no" build_qpf_support="no" -use_ttf_lib="none" +use_ttf_lib="ft2" build_ttfcache_support="no" build_bmpf_support="yes" @@ -532,35 +532,11 @@ build_sef_support=$enableval) AC_ARG_WITH(ttfsupport, [ --with-ttfsupport=ft1/ft2/none How to support TrueType font (FreeType 1/FreeType 2/None) ], -[ case "$with_ttfsupport" in - ft1) - use_ttf_lib="ft1" -dnl Check for FreeType1 library - AC_CHECK_LIB(ttf, TT_FreeType_Version, - DEP_LIBS="$DEP_LIBS -lttf", - use_ttf_lib="none") -dnl ttf cache - AC_ARG_ENABLE(ttfcache, - [ --enable-ttfcache include ttf cache support ], - build_ttfcache_support=$enableval) - ;; +use_ttf_lib=$withval) - ft2) - use_ttf_lib="ft2" -dnl Check for FreeType2 library - AC_CHECK_LIB(freetype, FT_Library_Version, - DEP_LIBS="$DEP_LIBS -lfreetype -lz -lpng12", - use_ttf_lib="none") -dnl ttf cache - AC_ARG_ENABLE(ttfcache, - [ --enable-ttfcache include ttf cache support ], - build_ttfcache_support=$enableval) - ;; - *) - use_ttf_lib="none" - ;; -esac ] -) +AC_ARG_ENABLE(ttfcache, +[ --enable-ttfcache include ttf cache support ], +build_ttfcache_support=$enableval) AC_ARG_ENABLE(bmpfsupport, [ --enable-bmpfsupport build support for Bitmap Font (bmpf) ], @@ -1611,16 +1587,16 @@ case "$runtime_mode" in [Define if build MiniGUI-Standalone (back-compatibility definition)]) ;; ths) + AC_DEFINE(_MGRM_THREADS, 1, + [Define if build MiniGUI-Threads]) + CFLAGS="$CFLAGS -D_REENTRANT" + ;; + procs) AC_DEFINE(_MGRM_PROCESSES, 1, [Define if build MiniGUI-Processes]) AC_DEFINE(_LITE_VERSION, 1, [Define if build MiniGUI-Processes (back-compatibility definition)]) ;; - procs) - AC_DEFINE(_MGRM_THREADS, 1, - [Define if build MiniGUI-Threads]) - CFLAGS="$CFLAGS -D_REENTRANT" - ;; esac if test "x$incore_res" = "xno"; then @@ -1671,7 +1647,6 @@ if test "x$devel_mode" = "xyes"; then build_net_ial_engine="yes" build_qpf_support="yes" - use_ttf_lib="ft2" build_latin2_support="yes" build_latin3_support="yes" @@ -1977,6 +1952,22 @@ if test "x$build_upf_support" = "xyes"; then fi fi +dnl Check FreeType lib +case "$use_ttf_lib" in + ft1) +dnl Check for FreeType1 library + AC_CHECK_LIB(ttf, TT_FreeType_Version, + DEP_LIBS="$DEP_LIBS -lttf", + use_ttf_lib="none") + ;; + ft2) +dnl Check for FreeType2 library + AC_CHECK_LIB(freetype, FT_Library_Version, + DEP_LIBS="$DEP_LIBS -lfreetype -lz -lpng12", + use_ttf_lib="none") + ;; +esac + dnl Dealing with TTF cache size case "$use_ttf_lib" in ft1|ft2) @@ -2067,7 +2058,7 @@ case "$use_ttf_lib" in [ --with-ft2-includes=DIR where the FreeType2 includes are]) if test "x$with_ft2_includes" = "x"; then - FT2_INC_DIR="`freetype-config --cflags`" + FT2_INC_DIR="-I/usr/include/freetype2" else FT2_INC_DIR="-I$with_ft2_includes" fi From ea1c7b27abffbeec0e07a66dfe7bb2f2ad7131b6 Mon Sep 17 00:00:00 2001 From: VincentWei Date: Sun, 21 Jan 2018 11:57:36 +0800 Subject: [PATCH 16/26] change version to 3.2.0 --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 35651086..7dccda53 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.60) -AC_INIT(libminigui, 3.0.13) +AC_INIT(libminigui, 3.2.0) AC_CONFIG_SRCDIR(src/main/main.c) dnl Set various version strings - taken gratefully from the SDL sources @@ -15,8 +15,8 @@ dnl Set various version strings - taken gratefully from the SDL sources # set MINIGUI_BINARY_AGE and MINIGUI_INTERFACE_AGE to 0. # MINIGUI_MAJOR_VERSION=3 -MINIGUI_MINOR_VERSION=0 -MINIGUI_MICRO_VERSION=13 +MINIGUI_MINOR_VERSION=2 +MINIGUI_MICRO_VERSION=0 MINIGUI_INTERFACE_AGE=0 MINIGUI_BINARY_AGE=0 MINIGUI_VERSION=$MINIGUI_MAJOR_VERSION.$MINIGUI_MINOR_VERSION.$MINIGUI_MICRO_VERSION From dbcc408ad38e27cdbbd5a53d7306f060b0e140f3 Mon Sep 17 00:00:00 2001 From: VincentWei Date: Sun, 21 Jan 2018 17:07:48 +0800 Subject: [PATCH 17/26] make timer-related APIs compiant to 64-bit --- configure.ac | 12 ++++++--- include/common.h | 30 ++++++++++++--------- include/gdi.h | 6 ++--- include/window.h | 58 +++++++++++++++++++++++++++-------------- src/client/client.c | 4 +-- src/include/internals.h | 4 +-- src/include/sharedres.h | 4 +-- src/include/timer.h | 14 +++++----- src/kernel/timer.c | 40 ++++++++++++++++------------ src/server/client.c | 2 +- src/server/server.c | 2 +- src/textedit/object.h | 2 +- 12 files changed, 107 insertions(+), 71 deletions(-) diff --git a/configure.ac b/configure.ac index 7dccda53..6e0796da 100644 --- a/configure.ac +++ b/configure.ac @@ -1696,8 +1696,6 @@ if test "x$devel_mode" = "xyes"; then enable_video_custom="yes" build_screensaver="yes" - - CFLAGS="$CFLAGS -Werror" fi dnl Depedencies @@ -2433,11 +2431,17 @@ fi dnl ======================================================================== dnl Write output -# define _GNU_SOURCE for pthread_rwlock_t +dnl define _GNU_SOURCE for pthread_rwlock_t CFLAGS="$CFLAGS -D_GNU_SOURCE" +if test "x$devel_mode" = "xyes"; then + if test "$ac_cv_prog_gcc" = "yes"; then + CPPFLAGS="$CPPFLAGS -Wall -Werror" + fi +fi + if test "$ac_cv_prog_gcc" = "yes"; then - CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -pipe" + CFLAGS="$CFLAGS -Wstrict-prototypes -pipe" fi if test "x$runtime_mode" = "xths"; then diff --git a/include/common.h b/include/common.h index 86848eec..85625ce4 100644 --- a/include/common.h +++ b/include/common.h @@ -299,22 +299,22 @@ typedef int BOOL; # endif #endif +/** + * \def INV_PTR + * \brief A value indicates an invalid non-null pointer. + */ +#define INV_PTR ((void *)-1) + #define GUIAPI #if !defined(__NODLL__) && (defined (WIN32) || defined (__NUCLEUS_MNT__)) - #if defined(__MINIGUI_LIB__) && !defined(__MGEXT_LIB__) - #define MG_EXPORT __declspec(dllexport) - #else - #define MG_EXPORT __declspec(dllimport) - #endif - #if defined(__MGEXT_LIB__) - #define MGEXT_EXPORT __declspec(dllexport) - #else - #define MGEXT_EXPORT __declspec(dllimport) - #endif +# if defined(__MINIGUI_LIB__) +# define MG_EXPORT __declspec(dllexport) +# else +# define MG_EXPORT __declspec(dllimport) +# endif #else - #define MG_EXPORT - #define MGEXT_EXPORT +# define MG_EXPORT #endif /** @} end of simple_types */ @@ -499,6 +499,12 @@ typedef long LONG_PTR; typedef int LONG_PTR; #endif +/** + * \var LINT + * \brief Signed integer which has pointer precision. + */ +typedef LONG_PTR LINT; + /** * \var LRESULT * \brief Signed result of message processing. diff --git a/include/gdi.h b/include/gdi.h index d916b787..7261bc6d 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -1090,19 +1090,19 @@ MG_EXPORT BOOL GUIAPI InitPolygonRegion (PCLIPRGN dst, * \note MiniGUI does not do any clipping operation for this DC, * so use this DC may make a mess of other windows. */ -#define HDC_SCREEN (HDC)0 +#define HDC_SCREEN ((HDC)0) /* * This is a system screen DC create for MiniGUI internal usage, for example, * menu and z-order operations */ -#define HDC_SCREEN_SYS (HDC)1 +#define HDC_SCREEN_SYS ((HDC)1) /** * \def HDC_INVALID * \brief Indicates an invalid handle to device context. */ -#define HDC_INVALID (HDC)-1 +#define HDC_INVALID ((HDC)-1) #define GDCAP_COLORNUM 0 #define GDCAP_HPIXEL 1 diff --git a/include/window.h b/include/window.h index b9694e83..7d9a51a3 100644 --- a/include/window.h +++ b/include/window.h @@ -2173,7 +2173,7 @@ typedef struct _MSG /** The second parameter of the message (32-bit integer). */ LPARAM lParam; /** Time */ - ULONG time; + DWORD time; #ifdef _MGRM_THREADS /** Addtional data*/ void* pAdd; @@ -4893,15 +4893,15 @@ extern MG_EXPORT HWND __mg_hwnd_desktop; * \def HWND_NULL * \brief Null window handle. */ -#define HWND_NULL (HWND)0 +#define HWND_NULL ((HWND)0) /** * \def HWND_INVALID * \brief Invalid window handle. */ -#define HWND_INVALID (HWND)-1 +#define HWND_INVALID ((HWND)-1) -#define HWND_OTHERPROC (HWND)-1 +#define HWND_OTHERPROC ((HWND)-1) /** * Structure defines a main window. @@ -7544,7 +7544,7 @@ MG_EXPORT NOTIFPROC GUIAPI GetNotificationCallback (HWND hwnd); */ /** - * \var typedef BOOL (* TIMERPROC)(HWND, int, DWORD) + * \var typedef BOOL (* TIMERPROC)(HWND, LINT, DWORD) * \brief Type of the timer callback procedure. * * This is the prototype of the callback procedure of a timer created by SetTimerEx. @@ -7554,11 +7554,14 @@ MG_EXPORT NOTIFPROC GUIAPI GetNotificationCallback (HWND hwnd); * by MiniGUI automatically. This can be used to implement a one-shot timer. * * \sa SetTimerEx + * + * \note The prototype had changed since MiniGUI v3.2; the old one: + * BOOL (* TIMERPROC)(HWND, int, unsigned int) */ -typedef BOOL (* TIMERPROC)(HWND, int, DWORD); +typedef BOOL (* TIMERPROC)(HWND, LINT, DWORD); /** - * \fn BOOL GUIAPI SetTimerEx (HWND hWnd, int id, unsigned int speed, \ + * \fn BOOL GUIAPI SetTimerEx (HWND hWnd, LINT id, DWORD speed, \ * TIMERPROC timer_proc) * \brief Creates a timer with the specified timeout value. * @@ -7586,11 +7589,14 @@ typedef BOOL (* TIMERPROC)(HWND, int, DWORD); * \note You should set, reset, and kill a timer in the same thread if your * MiniGUI is configured as MiniGUI-Threads. * + * \note The prototype had changed since MiniGUI v3.2; the old one: + * BOOL GUIAPI SetTimerEx (HWND hWnd, int id, unsigned int speed, TIMERPROC timer_proc); + * * Example: * * \include settimer.c */ -MG_EXPORT BOOL GUIAPI SetTimerEx (HWND hWnd, int id, unsigned int speed, +MG_EXPORT BOOL GUIAPI SetTimerEx (HWND hWnd, LINT id, DWORD speed, TIMERPROC timer_proc); /** @@ -7603,23 +7609,26 @@ MG_EXPORT BOOL GUIAPI SetTimerEx (HWND hWnd, int id, unsigned int speed, SetTimerEx(hwnd, id, speed, NULL) /** - * \fn int GUIAPI KillTimer (HWND hWnd, int id) + * \fn int GUIAPI KillTimer (HWND hWnd, LINT id) * \brief Destroys a timer. * * This function destroys the specified timer \a id. * * \param hWnd The window owns the timer. - * \param id The identifier of the timer. If \a id equals or is less than 0, + * \param id The identifier of the timer. If \a id equals 0, * this function will kill all timers in the system. * * \return The number of actually killed timer. * * \sa SetTimer + * + * \note The prototype had changed since MiniGUI v3.2; the old one: + * int GUIAPI KillTimer (HWND hWnd, int id) */ -MG_EXPORT int GUIAPI KillTimer (HWND hWnd, int id); +MG_EXPORT int GUIAPI KillTimer (HWND hWnd, LINT id); /** - * \fn BOOL GUIAPI ResetTimerEx (HWND hWnd, int id, unsigned int speed, \ + * \fn BOOL GUIAPI ResetTimerEx (HWND hWnd, LINT id, DWORD speed, \ * TIMERPROC timer_proc) * \brief Adjusts a timer with a different timeout value or different * timer callback procedure. @@ -7630,14 +7639,17 @@ MG_EXPORT int GUIAPI KillTimer (HWND hWnd, int id); * \param id The identifier of the timer. * \param speed The new timeout value. * \param timer_proc The new timer callback procedure. If \a timer_proc - * is 0xFFFFFFFF, the setting of timer callback procedure will - * not changed. + * is INV_PTR, the setting of timer callback procedure will + * not change. * * \return TRUE on success, FALSE on error. * * \sa SetTimerEx + * + * \note The prototype had changed since MiniGUI v3.2; the old one: + * BOOL GUIAPI ResetTimerEx (HWND hWnd, int id, unsigned int speed, TIMERPROC timer_proc) */ -MG_EXPORT BOOL GUIAPI ResetTimerEx (HWND hWnd, int id, unsigned int speed, +MG_EXPORT BOOL GUIAPI ResetTimerEx (HWND hWnd, LINT id, DWORD speed, TIMERPROC timer_proc); /** @@ -7647,10 +7659,10 @@ MG_EXPORT BOOL GUIAPI ResetTimerEx (HWND hWnd, int id, unsigned int speed, * \sa ResetTimerEx */ #define ResetTimer(hwnd, id, speed) \ - ResetTimerEx(hwnd, id, speed, (TIMERPROC)0xFFFFFFFF) + ResetTimerEx(hwnd, id, speed, (TIMERPROC)INV_PTR) /** - * \fn unsigned int GUIAPI GetTickCount (void) + * \fn DWORD GUIAPI GetTickCount (void) * \brief Retrieves the tick counts that have elapsed since MiniGUI was started. * * This function retrieves the tick counts that have elapsed since MiniGUI @@ -7658,11 +7670,14 @@ MG_EXPORT BOOL GUIAPI ResetTimerEx (HWND hWnd, int id, unsigned int speed, * for a general Linux box, the returned tick count value is in unit of 10ms. * * \return The tick counts value that have elapsed since MiniGUI was started. + * + * \note The prototype had changed since MiniGUI v3.2; The old one: + * unsinged int GUIAPI GetTickCount (void); */ -MG_EXPORT unsigned int GUIAPI GetTickCount (void); +MG_EXPORT DWORD GUIAPI GetTickCount (void); /** - * \fn BOOL GUIAPI IsTimerInstalled (HWND hWnd, int id) + * \fn BOOL GUIAPI IsTimerInstalled (HWND hWnd, LINT id) * \brief Determines whether a timer is installed. * * This function determines whether a timer with identifier \a id of @@ -7674,8 +7689,11 @@ MG_EXPORT unsigned int GUIAPI GetTickCount (void); * \return TRUE for installed, otherwise FALSE. * * \sa SetTimer, HaveFreeTimer + * + * \note The prototype had changed since MiniGUI v3.2; the old one: + * BOOL GUIAPI IsTimerInstalled (HWND hWnd, int id) */ -MG_EXPORT BOOL GUIAPI IsTimerInstalled (HWND hWnd, int id); +MG_EXPORT BOOL GUIAPI IsTimerInstalled (HWND hWnd, LINT id); /** * \fn BOOL GUIAPI HaveFreeTimer (void) diff --git a/src/client/client.c b/src/client/client.c index b28d0af3..e1b31587 100644 --- a/src/client/client.c +++ b/src/client/client.c @@ -235,8 +235,8 @@ static void check_live (void) BOOL client_IdleHandler4Client (PMSGQUEUE msg_que) { - static unsigned int old_timer; - static int repeat_timeout = TIMEOUT_START_REPEAT; + static DWORD old_timer; + static long repeat_timeout = TIMEOUT_START_REPEAT; fd_set rset, wset, eset; fd_set* wsetptr = NULL; fd_set* esetptr = NULL; diff --git a/src/include/internals.h b/src/include/internals.h index 0be8e69a..67d8331e 100644 --- a/src/include/internals.h +++ b/src/include/internals.h @@ -35,7 +35,7 @@ void screensaver_hide(void); */ #define WS_EX_CTRLASMAINWIN 0x20000000L -#define DEF_NR_TIMERS 32 +#define DEF_NR_TIMERS NR_BITS_DWORD #if defined (__NOUNIX__) || defined (__uClinux__) #define DEF_MSGQUEUE_LEN 16 @@ -475,7 +475,7 @@ PGCRINFO kernel_GetGCRgnInfo (HWND hWnd); /* internal variables */ typedef struct _TRACKMENUINFO* PTRACKMENUINFO; -extern unsigned int __mg_timer_counter; +extern DWORD __mg_timer_counter; extern HWND __mg_capture_wnd; extern HWND __mg_ime_wnd; diff --git a/src/include/sharedres.h b/src/include/sharedres.h index 5978a3be..b2ec4290 100644 --- a/src/include/sharedres.h +++ b/src/include/sharedres.h @@ -43,8 +43,8 @@ typedef struct tagG_RES { GHANDLE topmost_layer; - unsigned int timer_counter; - unsigned int tick_on_locksem; + DWORD timer_counter; + DWORD tick_on_locksem; struct timeval timeout; struct termios savedtermio; #ifdef _MGRM_PROCESSES diff --git a/src/include/timer.h b/src/include/timer.h index dfdd0d24..020df95c 100644 --- a/src/include/timer.h +++ b/src/include/timer.h @@ -20,14 +20,14 @@ extern "C" { #define USEC_10MS 10000 typedef struct _timer { - HWND hWnd; - int id; - unsigned int speed; - unsigned int count; + HWND hWnd; + LINT id; + DWORD speed; + UINT_PTR count; - TIMERPROC proc; - unsigned int tick_count; - PMSGQUEUE msg_queue; + TIMERPROC proc; + UINT_PTR tick_count; + PMSGQUEUE msg_queue; } TIMER; typedef TIMER* PTIMER; diff --git a/src/kernel/timer.c b/src/kernel/timer.c index 4875127c..9a3d02b2 100644 --- a/src/kernel/timer.c +++ b/src/kernel/timer.c @@ -3,7 +3,7 @@ ** ** timer.c: The Timer module for MiniGUI-Threads. ** -** Copyright (C) 2003 ~ 2008 Feynman Software. +** Copyright (C) 2003 ~ 2018 Feynman Software. ** Copyright (C) 1999 ~ 2002 Wei Yongming. ** ** All rights reserved by Feynman Software. @@ -39,7 +39,7 @@ #define TIMER_ERR_SYS(text) #endif -unsigned int __mg_timer_counter = 0; +DWORD __mg_timer_counter = 0; static TIMER *timerstr[DEF_NR_TIMERS]; #ifdef _MGRM_THREADS @@ -351,15 +351,17 @@ void __mg_move_timer_last (TIMER* timer, int slot) } #endif -BOOL GUIAPI SetTimerEx (HWND hWnd, int id, unsigned int speed, +BOOL GUIAPI SetTimerEx (HWND hWnd, LINT id, DWORD speed, TIMERPROC timer_proc) { int i; - PMSGQUEUE pMsgQueue; int slot = -1; + PMSGQUEUE pMsgQueue; - if (speed <= 0) - { + if (id == 0) + return FALSE; + + if (speed == 0) { speed = 1; } @@ -467,8 +469,8 @@ void mg_remove_timers_by_msg_queue (const MSGQUEUE* msg_que) TIMER_UNLOCK (); } -/* If id <= 0, clear all timers of the window */ -int GUIAPI KillTimer (HWND hWnd, int id) +/* If id == 0, clear all timers of the window */ +int GUIAPI KillTimer (HWND hWnd, LINT id) { int i; PMSGQUEUE pMsgQueue; @@ -485,13 +487,13 @@ int GUIAPI KillTimer (HWND hWnd, int id) for (i = 0; i < DEF_NR_TIMERS; i++) { if ((timerstr [i] && timerstr [i]->hWnd == hWnd) && - (id <= 0 || timerstr [i]->id == id)) { + (id == 0 || timerstr [i]->id == id)) { RemoveMsgQueueTimerFlag (pMsgQueue, i); free (timerstr[i]); timerstr [i] = NULL; killed ++; - if (id > 0) break; + if (id) break; } } @@ -504,12 +506,15 @@ int GUIAPI KillTimer (HWND hWnd, int id) return killed; } -BOOL GUIAPI ResetTimerEx (HWND hWnd, int id, unsigned int speed, +BOOL GUIAPI ResetTimerEx (HWND hWnd, LINT id, DWORD speed, TIMERPROC timer_proc) { int i; PMSGQUEUE pMsgQueue; + if (id == 0) + return FALSE; + #ifdef _MGRM_THREADS if (!(pMsgQueue = GetMsgQueueThisThread ())) return FALSE; @@ -519,13 +524,13 @@ BOOL GUIAPI ResetTimerEx (HWND hWnd, int id, unsigned int speed, TIMER_LOCK (); - for (i=0; ihWnd == hWnd && timerstr[i]->id == id) { /* Should clear old timer flags */ RemoveMsgQueueTimerFlag (pMsgQueue, i); timerstr[i]->speed = speed; timerstr[i]->count = 0; - if (timer_proc != (TIMERPROC)0xFFFFFFFF) + if (timer_proc != (TIMERPROC)INV_PTR) timerstr[i]->proc = timer_proc; timerstr[i]->tick_count = 0; @@ -538,13 +543,16 @@ BOOL GUIAPI ResetTimerEx (HWND hWnd, int id, unsigned int speed, return FALSE; } -BOOL GUIAPI IsTimerInstalled (HWND hWnd, int id) +BOOL GUIAPI IsTimerInstalled (HWND hWnd, LINT id) { int i; + if (id == 0) + return FALSE; + TIMER_LOCK (); - for (i=0; ihWnd == hWnd && timerstr[i]->id == id) { TIMER_UNLOCK (); @@ -570,7 +578,7 @@ BOOL GUIAPI HaveFreeTimer (void) return FALSE; } -unsigned int GUIAPI GetTickCount (void) +DWORD GUIAPI GetTickCount (void) { #ifdef _MGRM_PROCESSES return SHAREDRES_TIMER_COUNTER; diff --git a/src/server/client.c b/src/server/client.c index 3479d216..8fe52e8c 100644 --- a/src/server/client.c +++ b/src/server/client.c @@ -34,7 +34,7 @@ #define NALLOC 4 /* #Client structs to alloc/realloc for */ -extern unsigned int __mg_timer_counter; +extern DWORD __mg_timer_counter; MG_Client* mgClients = NULL; int mgClientSize = 0; diff --git a/src/server/server.c b/src/server/server.c index d36e979a..198ef333 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -41,7 +41,7 @@ #include "drawsemop.h" #include "license.h" -extern unsigned int __mg_timer_counter; +extern DWORD __mg_timer_counter; ON_NEW_DEL_CLIENT OnNewDelClient = NULL; diff --git a/src/textedit/object.h b/src/textedit/object.h index 2ca7322e..9b355ccb 100644 --- a/src/textedit/object.h +++ b/src/textedit/object.h @@ -57,7 +57,7 @@ ClassType(clss) Class(clss) = { (PClassConstructor)clss##ClassConstructor }; \ static const char* clss##_type_name = #clss; \ static ClassType(clss) * clss##ClassConstructor(ClassType(clss)* _class) { \ unsigned short * _pintfOffset = NULL; \ - _pintfOffset = (PVOID)((UINT_PTR)_pintfOffset ^ 0); /* prevent unused-but-set-variable warning */ \ + _pintfOffset = (PVOID)((UINT_PTR)_pintfOffset ^ 0); /* VW: prevent unused-but-set-variable warning */ \ _class = (ClassType(clss)*)((PClassConstructor)(Class(superCls).classConstructor))((mObjectClass*)_class); \ _pintfOffset = &_class->intfOffset; \ _class->super = &Class(superCls); \ From 75764eecb4128d735ed93da044d3b61bbb12f9cf Mon Sep 17 00:00:00 2001 From: VincentWei Date: Sun, 21 Jan 2018 17:19:18 +0800 Subject: [PATCH 18/26] tune code to reflect the new prototypes --- examples/buttondown.c | 2 +- examples/createwindow.c | 2 +- examples/dialogbox.c | 2 +- examples/helloworld.c | 2 +- examples/keydown.c | 2 +- examples/listenfd.c | 2 +- examples/msg_initdialog.c | 2 +- examples/rectvisible.c | 2 +- examples/registerwindowclass.c | 3 +-- examples/setcursor.c | 12 ++++++------ examples/settimer.c | 2 +- examples/socket.c | 2 +- examples/subclass.c | 4 ++-- examples/ws_ex_notdraggable.c | 2 +- 14 files changed, 20 insertions(+), 21 deletions(-) diff --git a/examples/buttondown.c b/examples/buttondown.c index 7d4f6f37..2a9c17e3 100644 --- a/examples/buttondown.c +++ b/examples/buttondown.c @@ -3,7 +3,7 @@ * This example trys to handle the event when the user presses * left button and right button of the mouse at the same time. */ -int MyWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +LRESULT MyWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_LBUTTONDOWN: diff --git a/examples/createwindow.c b/examples/createwindow.c index fd76e4ed..b6b8914d 100644 --- a/examples/createwindow.c +++ b/examples/createwindow.c @@ -9,7 +9,7 @@ #define IDC_EDIT1 130 #define IDC_EDIT2 140 -int ControlTestWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +LRESULT ControlTestWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static HWND hStaticWnd1, hStaticWnd2, hButton1, hButton2, hEdit1, hEdit2; switch (message) { diff --git a/examples/dialogbox.c b/examples/dialogbox.c index e7795402..b9430ecb 100644 --- a/examples/dialogbox.c +++ b/examples/dialogbox.c @@ -2,7 +2,7 @@ * The following code defines the dialog box callback procedure * and displays the dialog box by calling DialogBoxIndirectParam function. */ -static int InitDialogBoxProc (HWND hDlg, int message, WPARAM wParam, LPARAM lParam) +static LRESULT InitDialogBoxProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_INITDIALOG: diff --git a/examples/helloworld.c b/examples/helloworld.c index fe515e81..68268cc7 100644 --- a/examples/helloworld.c +++ b/examples/helloworld.c @@ -11,7 +11,7 @@ #include #include -static int HelloWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT HelloWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; diff --git a/examples/keydown.c b/examples/keydown.c index b9f8b986..fd3ea722 100644 --- a/examples/keydown.c +++ b/examples/keydown.c @@ -3,7 +3,7 @@ * This example trys to handle the event when the user * presses key as the key is down. */ -int MyWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +LRESULT MyWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_KEYDOWN: diff --git a/examples/listenfd.c b/examples/listenfd.c index 2967d968..8059721d 100644 --- a/examples/listenfd.c +++ b/examples/listenfd.c @@ -14,7 +14,7 @@ ... /* The window procedure. */ -static int VCOnGUIMainWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT VCOnGUIMainWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PCONINFO pConInfo; diff --git a/examples/msg_initdialog.c b/examples/msg_initdialog.c index bdb170cb..ddb586e6 100644 --- a/examples/msg_initdialog.c +++ b/examples/msg_initdialog.c @@ -1,4 +1,4 @@ -static int DepInfoBoxProc (HWND hDlg, int message, WPARAM wParam, LPARAM lParam) +static LRESULT DepInfoBoxProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { struct _DepInfo *info; diff --git a/examples/rectvisible.c b/examples/rectvisible.c index ca30e20e..8bb0c17d 100644 --- a/examples/rectvisible.c +++ b/examples/rectvisible.c @@ -1,7 +1,7 @@ /* * Use RectVisible to optimize the repaint of the window. */ -MSG_PAINT: +case MSG_PAINT: { HDC hdc = BeginPaint (hWnd); diff --git a/examples/registerwindowclass.c b/examples/registerwindowclass.c index 0bb5e66c..c40ced0c 100644 --- a/examples/registerwindowclass.c +++ b/examples/registerwindowclass.c @@ -3,8 +3,7 @@ #define MSG_SET_STEP_INFO (MSG_USER + 1) #define MSG_SET_CURR_STEP (MSG_USER + 2) -static int StepControlProc (HWND hwnd, - int message, WPARAM wParam, LPARAM lParam) +static LRESULT StepControlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; HELPWININFO* info; diff --git a/examples/setcursor.c b/examples/setcursor.c index d4089fb9..0971d0d3 100644 --- a/examples/setcursor.c +++ b/examples/setcursor.c @@ -2,9 +2,9 @@ * The following MSG_SETCURSOR handler set the cursor * shape to the arrow cursor when the window is disabled. */ - case MSG_SETCURSOR: - if (GetWindowStyle (hwnd) & WS_DISABLED) { - SetCursor (GetSystemCursor (IDC_ARROW)); - return 0; - } - break; +case MSG_SETCURSOR: + if (GetWindowStyle (hwnd) & WS_DISABLED) { + SetCursor (GetSystemCursor (IDC_ARROW)); + return 0; + } + break; diff --git a/examples/settimer.c b/examples/settimer.c index 599f651e..12474004 100644 --- a/examples/settimer.c +++ b/examples/settimer.c @@ -1,7 +1,7 @@ /* * A typical handling of timer. */ -int FlyingGUIWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +LRESULT FlyingGUIWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_CREATE: diff --git a/examples/socket.c b/examples/socket.c index 6c7cf503..ee787f89 100644 --- a/examples/socket.c +++ b/examples/socket.c @@ -14,7 +14,7 @@ BOOL listen_socket (HWND hwnd) * the window hwnd will receive a MSG_FDEVENT message. * Now the server can accept the request. */ -int MyWndProc (HWND hwnd, int message, WPARAM wParam, LPARAM lParam) +LRESULT MyWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { diff --git a/examples/subclass.c b/examples/subclass.c index b4b8f04e..8997e400 100644 --- a/examples/subclass.c +++ b/examples/subclass.c @@ -10,7 +10,7 @@ #define MY_ES_DIGIT_ONLY 0x0001 #define MY_ES_ALPHA_ONLY 0x0002 static WNDPROC old_edit_proc; -static int RestrictedEditBox (HWND hwnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT RestrictedEditBox (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { if (message == MSG_CHAR) { DWORD my_style = GetWindowAdditionalData (hwnd); @@ -28,7 +28,7 @@ static int RestrictedEditBox (HWND hwnd, int message, WPARAM wParam, LPARAM lPar return (*old_edit_proc) (hwnd, message, wParam, lParam); } -static int ControlTestWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT ControlTestWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_CREATE: diff --git a/examples/ws_ex_notdraggable.c b/examples/ws_ex_notdraggable.c index 4fc3a222..9c7d6d43 100644 --- a/examples/ws_ex_notdraggable.c +++ b/examples/ws_ex_notdraggable.c @@ -10,7 +10,7 @@ #include #include -static int HelloWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT HelloWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; From 6290779a02500f174cb8123da53d4987b3275642 Mon Sep 17 00:00:00 2001 From: VincentWei Date: Sun, 21 Jan 2018 18:09:51 +0800 Subject: [PATCH 19/26] tune the implementation of tracing message --- include/window.h | 6 +++--- src/include/msgstr.h | 8 +++++--- src/include/timer.h | 2 +- src/kernel/desktop-comm.c | 6 +++--- src/kernel/desktop-ths.c | 18 ++++++++++-------- src/kernel/event.c | 30 +++++++++++++++--------------- src/kernel/message.c | 23 +++++++++++++---------- src/kernel/timer.c | 4 ++-- src/standalone/standalone.c | 4 ++-- 9 files changed, 54 insertions(+), 47 deletions(-) diff --git a/include/window.h b/include/window.h index 7d9a51a3..b2c90991 100644 --- a/include/window.h +++ b/include/window.h @@ -561,9 +561,9 @@ extern "C" { */ #define DEF_INTERVAL_TIME 200 -extern unsigned int __mg_key_longpress_time; -extern unsigned int __mg_key_alwayspress_time; -extern unsigned int __mg_interval_time; +extern DWORD __mg_key_longpress_time; +extern DWORD __mg_key_alwayspress_time; +extern DWORD __mg_interval_time; /** * \def SetKeyLongPressTime(time) diff --git a/src/include/msgstr.h b/src/include/msgstr.h index ff346255..ff5cbd09 100644 --- a/src/include/msgstr.h +++ b/src/include/msgstr.h @@ -3,7 +3,7 @@ ** ** msgstr.h: the text name of all messages. ** -** Copyright (C) 2003 ~ 2007 Feynman Software. +** Copyright (C) 2003 ~ 2018 FMSoft ** Copyright (C) 1999 ~ 2002 Wei Yongming. ** ** Create date: 1999/01/03 @@ -201,9 +201,9 @@ char * __mg_msgstr2 [] = "", // 0x00DB "", // 0x00DC "", // 0x00DD - "MSG_ERASEDESKTOP ", // 0x00DE "MSG_PAINTDESKTOP ", // 0x00DF + "MSG_DT_LBUTTONDOWN ", // 0x00E0 "MSG_DT_LBUTTONUP ", // 0x00E1 "MSG_DT_LBUTTONDBLCLK ", // 0x00E2 @@ -237,6 +237,7 @@ char * __mg_msgstr2 [] = "MSG_SCROLLMAINWIN ", // 0x00FD "MSG_CARET_CREATE ", // 0x00FE "MSG_CARET_DESTROY ", // 0x00FF + "MSG_ENABLEMAINWIN ", // 0x0100 "MSG_ISENABLED ", // 0x0101 "MSG_SETWINCURSOR", // 0x0102 @@ -284,7 +285,8 @@ char * __mg_msgstr3 [] = "", // 0x0136 "", // 0x0137 "", // 0x0138 - "", // 0x0139 "", // 0x013A + "", // 0x0139 + "", // 0x013A "", // 0x013B "", // 0x013C "", // 0x013D diff --git a/src/include/timer.h b/src/include/timer.h index 020df95c..417e33aa 100644 --- a/src/include/timer.h +++ b/src/include/timer.h @@ -33,7 +33,7 @@ typedef TIMER* PTIMER; BOOL mg_InitTimer (void); void mg_TerminateTimer (void); -void mg_dispatch_timer_message (unsigned int inter); +void mg_dispatch_timer_message (DWORD inter); void mg_remove_timers_by_msg_queue (const MSGQUEUE* msg_que); TIMER* __mg_get_timer (int slot); diff --git a/src/kernel/desktop-comm.c b/src/kernel/desktop-comm.c index 51d48d46..6c16fdfc 100644 --- a/src/kernel/desktop-comm.c +++ b/src/kernel/desktop-comm.c @@ -2198,10 +2198,10 @@ LRESULT DesktopWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) case MSG_TIMER: // per 0.01s { - static UINT uCounter = 0; + static DWORD uCounter = 0; #ifndef _MGRM_THREADS - static UINT blink_counter = 0; - static UINT sg_old_counter = 0; + static DWORD blink_counter = 0; + static DWORD sg_old_counter = 0; if (sg_old_counter == 0) sg_old_counter = __mg_timer_counter; diff --git a/src/kernel/desktop-ths.c b/src/kernel/desktop-ths.c index f3dee9ef..2c4a07e2 100644 --- a/src/kernel/desktop-ths.c +++ b/src/kernel/desktop-ths.c @@ -125,12 +125,12 @@ void* DesktopMain (void* data) LRESULT lRet = 0; #ifdef _MGHAVE_TRACE_MSG - fprintf (stderr, "Message, %s: hWnd: %p, wP: %p, lP: %p. %s\n", - Message2Str (Msg.message), - Msg.hwnd, - (PVOID)Msg.wParam, - (PVOID)Msg.lParam, - Msg.pAdd?"Sync":"Normal"); + if (Msg.message != MSG_TIMEOUT && Msg.message != MSG_TIMER) { + fprintf (stderr, "Message %u (%s): hWnd: HWND_DESKTOP, wP: %p, lP: %p, tick: %u; %s\n", + Msg.message, Message2Str (Msg.message), + (PVOID)Msg.wParam, (PVOID)Msg.lParam, (UINT)Msg.time, + Msg.pAdd?"Sync":"Normal"); + } #endif lRet = DesktopWinProc (HWND_DESKTOP, @@ -144,8 +144,10 @@ void* DesktopMain (void* data) } #ifdef _MGHAVE_TRACE_MSG - fprintf (stderr, "Message, %s done, return value: %p\n", - Message2Str (Msg.message), (PVOID)lRet); + if (Msg.message != MSG_TIMEOUT && Msg.message != MSG_TIMER) { + fprintf (stderr, "Message %u (%s) done, return value: %p\n", + Msg.message, Message2Str (Msg.message), (PVOID)lRet); + } #endif } diff --git a/src/kernel/event.c b/src/kernel/event.c index 589eb552..c3f80ee2 100644 --- a/src/kernel/event.c +++ b/src/kernel/event.c @@ -54,9 +54,9 @@ static int repeatusec; static int dblclicktime; #ifndef _MGRM_THREADS -static unsigned int timeout_threshold; -static unsigned int repeat_threshold; -static unsigned int timeout_count; +static DWORD timeout_threshold; +static DWORD repeat_threshold; +static DWORD timeout_count; #endif static void GetDblclickTime(void) @@ -100,11 +100,11 @@ static void GetTimeout (void) /* Mouse event parameters. */ static int oldbutton = 0; -static unsigned int time1; -static unsigned int time2; +static DWORD time1; +static DWORD time2; /* Key event parameters. */ -static unsigned int ke_time; +static DWORD ke_time; #ifndef _MGRM_PROCESSES static unsigned char oldkeystate [MGUI_NR_KEYS + 1]; #endif @@ -180,15 +180,15 @@ static void ResetKeyEvent(void) * default long pressed and always pressed value * The default long press handling disabled at startup. */ -unsigned int __mg_key_longpress_time = 0; -unsigned int __mg_key_alwayspress_time = DEF_APRESS_TIME; -unsigned int __mg_interval_time = DEF_INTERVAL_TIME; +DWORD __mg_key_longpress_time = 0; +DWORD __mg_key_alwayspress_time = DEF_APRESS_TIME; +DWORD __mg_interval_time = DEF_INTERVAL_TIME; -static void treat_longpress (PKEYEVENT ke, unsigned int interval) +static void treat_longpress (PKEYEVENT ke, DWORD interval) { - static unsigned int starttime; + static DWORD starttime; static int flag1 = 0, flag2 = 1; /*flag1: longpress flags*/ - unsigned int maxctime; + DWORD maxctime; maxctime = (__mg_key_longpress_time < __mg_key_alwayspress_time) ? __mg_key_longpress_time : __mg_key_alwayspress_time; @@ -256,12 +256,12 @@ static void treat_longpress (PKEYEVENT ke, unsigned int interval) BOOL kernel_GetLWEvent (int event, PLWEVENT lwe) { static LWEVENT old_lwe = {0, 0}; - unsigned int interval; - int button; + DWORD interval; PMOUSEEVENT me = &(lwe->data.me); PKEYEVENT ke = &(lwe->data.ke); const char* keystate; int i; + int button; int make; /* 0 = release, 1 = presse */ if (event == 0) { @@ -516,7 +516,7 @@ BOOL kernel_GetLWEvent (int event, PLWEVENT lwe) static LWEVENT old_lwe = {0, 0}; int nr_keys = 0; - unsigned int interval; + DWORD interval; int button; PMOUSEEVENT me = &(lwe->data.me); PKEYEVENT ke = &(lwe->data.ke); diff --git a/src/kernel/message.c b/src/kernel/message.c index aea1d7cf..890d0186 100644 --- a/src/kernel/message.c +++ b/src/kernel/message.c @@ -1029,12 +1029,11 @@ LRESULT GUIAPI DispatchMessage (PMSG pMsg) LICENSE_MODIFY_MESSAGE(pMsg); #ifdef _MGHAVE_TRACE_MSG - fprintf (stderr, "Message, %s: hWnd: %p, wP: %p, lP: %p. %s\n", - Message2Str (pMsg->message), - pMsg->hwnd, - (PVOID)pMsg->wParam, - (PVOID)pMsg->lParam, - SYNMSGNAME); + if (pMsg->message != MSG_TIMEOUT && pMsg->message != MSG_CARETBLINK) { + fprintf (stderr, "Message %u (%s): hWnd: %p, wP: %p, lP: %p. %s\n", + pMsg->message, Message2Str (pMsg->message), + pMsg->hwnd, (PVOID)pMsg->wParam, (PVOID)pMsg->lParam, SYNMSGNAME); + } #endif if (pMsg->hwnd == HWND_INVALID) { @@ -1047,8 +1046,10 @@ LRESULT GUIAPI DispatchMessage (PMSG pMsg) #endif #ifdef _MGHAVE_TRACE_MSG - fprintf (stderr, "Message have been thrown away: %s\n", - Message2Str (pMsg->message)); + if (pMsg->message != MSG_TIMEOUT && pMsg->message != MSG_CARETBLINK) { + fprintf (stderr, "Message %u (%s) has been thrown away.\n", + pMsg->message, Message2Str (pMsg->message)); + } #endif return -1; } @@ -1071,8 +1072,10 @@ LRESULT GUIAPI DispatchMessage (PMSG pMsg) #endif #ifdef _MGHAVE_TRACE_MSG - fprintf (stderr, "Message, %s done, return value: %p\n", - Message2Str (pMsg->message), (PVOID)lRet); + if (pMsg->message != MSG_TIMEOUT && pMsg->message != MSG_CARETBLINK) { + fprintf (stderr, "Message %u (%s) done, return value: %p\n", + pMsg->message, Message2Str (pMsg->message), (PVOID)lRet); + } #endif return lRet; diff --git a/src/kernel/timer.c b/src/kernel/timer.c index 9a3d02b2..7c0fd136 100644 --- a/src/kernel/timer.c +++ b/src/kernel/timer.c @@ -54,7 +54,7 @@ static pthread_mutex_t timerLock; #ifdef _MGGAL_S3C6410 # define _MG_USE_BETTER_TIMER -#endif /* __NOUNIX__ */ +#endif /* _MGGAL_S3C6410 */ #ifdef _MG_USE_BETTER_TIMER #include @@ -255,7 +255,7 @@ void mg_TerminateTimer (void) } /************************* Functions run in desktop thread *******************/ -void mg_dispatch_timer_message (unsigned int inter) +void mg_dispatch_timer_message (DWORD inter) { int i; diff --git a/src/standalone/standalone.c b/src/standalone/standalone.c index 68a2ff58..7a7948c6 100644 --- a/src/standalone/standalone.c +++ b/src/standalone/standalone.c @@ -38,8 +38,8 @@ #include "menu.h" #include "ourhdr.h" -extern unsigned int __mg_timer_counter; -static unsigned int old_timer_counter = 0; +extern DWORD __mg_timer_counter; +static DWORD old_timer_counter = 0; static SRVEVTHOOK srv_evt_hook = NULL; From 78668dbdfcb9d09de9a0f33ceba3c3a9d3ae3f40 Mon Sep 17 00:00:00 2001 From: VincentWei Date: Sun, 21 Jan 2018 18:34:33 +0800 Subject: [PATCH 20/26] use pkgconfig to define the runmode of MiniGUI --- configure.ac | 6 +++++- minigui.pc.in | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 6e0796da..7f745431 100644 --- a/configure.ac +++ b/configure.ac @@ -1585,17 +1585,20 @@ case "$runtime_mode" in [Define if build MiniGUI-Standalone (back-compatibility definition)]) AC_DEFINE(_LITE_VERSION, 1, [Define if build MiniGUI-Standalone (back-compatibility definition)]) + MINIGUI_RUNMODE="sa" ;; ths) AC_DEFINE(_MGRM_THREADS, 1, [Define if build MiniGUI-Threads]) CFLAGS="$CFLAGS -D_REENTRANT" + MINIGUI_RUNMODE="ths" ;; - procs) + *) AC_DEFINE(_MGRM_PROCESSES, 1, [Define if build MiniGUI-Processes]) AC_DEFINE(_LITE_VERSION, 1, [Define if build MiniGUI-Processes (back-compatibility definition)]) + MINIGUI_RUNMODE="procs" ;; esac @@ -2451,6 +2454,7 @@ fi AC_SUBST(VIDEO_SUBDIRS) AC_SUBST(VIDEO_DRIVERS) AC_SUBST(DEP_LIBS) +AC_SUBST(MINIGUI_RUNMODE) AM_CONDITIONAL(MGRM_PROCESSES, test "x$runtime_mode" = "xprocs") AM_CONDITIONAL(MGRM_STANDALONE, test "x$runtime_mode" = "xsa") diff --git a/minigui.pc.in b/minigui.pc.in index 76fe7821..6280c7d9 100644 --- a/minigui.pc.in +++ b/minigui.pc.in @@ -4,8 +4,9 @@ libdir=@libdir@ includedir=@includedir@ Name: MiniGUI -Description: A mature cross-platform windowing system and GUI system for embedded and IoT devices. +Description: A mature cross-platform windowing and GUI system for embedded systems and IoT smart devices. Version: @MINIGUI_VERSION@ +Runmode: @MINIGUI_RUNMODE@ Requires: Libs: -L${libdir} -lminigui_@MGLIB_SUFFIX@ @DEP_LIBS@ Libs.private: From a41c96fdbff685edb9e5632bf5a05de7d65201a3 Mon Sep 17 00:00:00 2001 From: VincentWei Date: Wed, 24 Jan 2018 18:35:23 +0800 Subject: [PATCH 21/26] enable listview and spinbox by default --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 7f745431..fc3a351b 100644 --- a/configure.ac +++ b/configure.ac @@ -241,9 +241,9 @@ build_ctrl_textedit="no" build_ctrl_monthcal="no" build_ctrl_treeview="no" build_ctrl_treeview_rdr="no" -build_ctrl_spinbox="no" +build_ctrl_spinbox="yes" build_ctrl_coolbar="no" -build_ctrl_listview="no" +build_ctrl_listview="yes" build_ctrl_iconview="no" build_ctrl_gridview="no" build_ctrl_animation="yes" @@ -2444,7 +2444,7 @@ if test "x$devel_mode" = "xyes"; then fi if test "$ac_cv_prog_gcc" = "yes"; then - CFLAGS="$CFLAGS -Wstrict-prototypes -pipe" + CFLAGS="$CFLAGS -O2 -Wstrict-prototypes -pipe" fi if test "x$runtime_mode" = "xths"; then From 333ff9c83b8acd23d1a902b5de069a689beb13ad Mon Sep 17 00:00:00 2001 From: WEI Yongming Date: Thu, 25 Jan 2018 10:08:56 +0800 Subject: [PATCH 22/26] description of API changes --- README.md | 68 ++++++++++++++++++++++++++---------------------- RELEASE-NOTES.md | 44 +++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 5da79ac3..2816bf19 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ A mature cross-platform windowing system and GUI system for embedded and IoT dev ## TABLE OF CONTENTS 1. Introduction + 1. New features in version 3.2.x 1. The runtime modes of MiniGUI 1. History 1. About the authors @@ -18,20 +19,21 @@ A mature cross-platform windowing system and GUI system for embedded and IoT dev ## INTRODUCTION MiniGUI is a mature cross-platform windowing system and GUI (Graphics -User Interface) support system for embedded systems and IoT devices. This -is the mainline release of MiniGUI maintained by WEI Yongming. +User Interface) support system for embedded systems and smart IoT devices. +This is the version 3.2.x of MiniGUI maintained by WEI Yongming +(Vincent Wei, https://github.com/VincentWei). MiniGUI is released under GPLv3 and the dual-licensing applies to commercial use. MiniGUI aims to provide a fast, stable, full-featured, and cross-platform windowing and GUI support system, which is especially fit for -embedded systems or IoT devices based-on Linux/uClinux, eCos, and other +embedded systems or smart IoT devices based-on Linux/uClinux, eCos, and other traditional RTOSes, such as VxWorks, ThreadX, Nucleus, pSOS, uC/OS-II, and OSE. This is the MiniGUI core source tarball, which provides windowing -and graphics interfaces as well as a lot of standard controls. +and graphics interfaces as well as a lot of standard controls (tookit). Besides MiniGUI core, FMSoft also provides some components for the developers to develop app much easier: @@ -96,9 +98,22 @@ components, and other open source apps on GitHub. You can visit them on: https://github.com/VincentWei -FMSoft releases miniStudio, which is a WYSIWYG IDE for MiniGUI, as a shareware. +FMSoft also releases miniStudio, which is a WYSIWYG IDE for MiniGUI, as a shareware. You can also download it from the official site of MiniGUI. +http://www.minigui.com/en/download + + +## NEW FEATURES IN VERSION 3.2.x + +We introduce some new features in MiniGUI Version 3.2.x: + + * The support for 64-bit platform. Note that some APIs have changed + to support 64-bit platform. For more information, please refer to + RELEASE-NOTES.md file. + +Because of the changes of some APIs, we recommended strongly that you +use this version for new projects. ## THE RUNTIME MODES OF MINIGUI @@ -182,7 +197,7 @@ A brief history description of the development progress lay below: 0) 1994 ~ 1996: MiniGUI DOS version. 1) Dec, 1998: Began to write. 2) Apr, 1999: The skeleton of MiniGUI, windowing sub-system - and basic graphics device interfaces. + and basic graphics device interfaces. 3) May, 1999: Timer, menu, and the skeleton of control sub-system. 4) Jun, 1999: Chinese input method (by Kang Xiaoning). 5) July, 1999: GIF and JPG loading support (by LI Zhuo). @@ -191,43 +206,33 @@ A brief history description of the development progress lay below: 8) Sep, 1999: Snapshot of screen or window. 9) Jan., 2000: VCOnGUI (Virtual Console on MiniGUI) version 0.2.02. 10) Mar., 2000: Linux distribution installer based-on MiniGUI for - HappyLinux 1.0. + HappyLinux 1.0. 11) Jun., 2000: Began to develop version 1.0.xx. 12) Sep., 2000: MiniGUI version 0.3.06 released. 13) Oct., 2000: MiniGUI version 0.9.00 released. 14) Nov., 2000: MiniGUI version 0.9.96 released. 15) Jan., 2001: MiniGUI version 0.9.98 released. You can build - MiniGUI-Lite from this version. + MiniGUI-Lite from this version. 16) Jan., 2001: MiniGUI version 1.0.00Beta1 released. 17) Feb., 2001: MiniGUI version 1.0.00Pre1 released. 18) Apr., 2001: MiniGUI version 1.0.00 released (2001/04/16). 18) Sep., 2001: MiniGUI version 1.1.0Pre1 released (2001/09/12). 19) Sep., 2001: MiniGUI version 1.0.9 released (2001/09/17), - this will be the last version of - source branch 1.0.x. + this will be the last version of source branch 1.0.x. 20) Oct., 2001: MiniGUI version 1.1.0Pre4 released (2001/10/22). - This version have new GAL and GDI interfaces. - 21) Mar., 2002: MiniGUI official version 1.1.0 released - (2002/03/08). - MiniGUI API Reference documentation - version 0.9 released. - 22) Mar., 2002: MiniGUI API Reference documentation - version 1.0 released. - 23) Apr., 2002: MiniGUI the new stable version 1.2.0 released - (2002/04/11). + This version have new GAL and GDI interfaces. + 21) Mar., 2002: MiniGUI official version 1.1.0 released (2002/03/08). + MiniGUI API Reference documentation version 0.9 released. + 22) Mar., 2002: MiniGUI API Reference documentation version 1.0 released. + 23) Apr., 2002: MiniGUI the new stable version 1.2.0 released (2002/04/11). 24) Sep., 2002: The main developers of MiniGUI founded a - new software corporation: Beijing FMSoft - Technology Co., Ltd.. And the development and - maintenance of MiniGUI changes from - loosely-knit team to business organization. - 25) Mar., 2003: MiniGUI official version 1.2.5 released - (2003/03/23). - 25) May., 2003: MiniGUI official version 1.2.6 released - (2003/05/18). - 26) Sep., 2003: MiniGUI official version 1.3.1 released - (2003/09/11). - 27) Jan., 2004: MiniGUI official version 1.5.1 released - (2004/01/18). + new software corporation: Beijing FMSoft Technology Co., Ltd.. + And the development and maintenance of MiniGUI changes from + loosely-knit team to business organization. + 25) Mar., 2003: MiniGUI official version 1.2.5 released (2003/03/23). + 25) May., 2003: MiniGUI official version 1.2.6 released (2003/05/18). + 26) Sep., 2003: MiniGUI official version 1.3.1 released (2003/09/11). + 27) Jan., 2004: MiniGUI official version 1.5.1 released (2004/01/18). 28) Feb., 2004: MiniGUI tested on eCos and uC/OS-II. 29) Jun., 2004: MiniGUI tested on VxWorks. 30) Jan., 2005: MiniGUI tested on ThreadX and pSOS. @@ -247,6 +252,7 @@ A brief history description of the development progress lay below: 44) Aug., 2017: FMSoft released the latest source code of MiniGUI under GPL 3.0. 45) Aug., 2017: FMSoft released the latest source code of mDolphin under Apache 2.0. 46) Dec., 2017: FMSoft updated MiniGUI and miniStudio for latest Linux distributions. + 47) Feb., 2018: FMSoft released MiniGUI version 3.2. ## ABOUT THE AUTHORS diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 530041f4..7065edc0 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,5 +1,49 @@ # Release Notes +## Version 3.2.0 + +The MiniGUI development team announces the availability of MiniGUI 3.2.0. +All users of MiniGUI are recommended strongly to use this version for new +MiniGUI apps. Please report any bugs and incompatibilities in + + https://github.com/VincentWei/minigui. + +### What's new in this version + + * Support for 64-bit platform. The definitions of some types and APIs + changed. + * Eliminate all compilation warnings. + +### Type changes + + 1. Handle types. All handle types, including `GHANDLE`, `HWND`, `HDC`, and so on, + are now defined as aliases of `PVOID` (`typedef void* PVOID`). + You may need to check your code to reflect this change. + + 2. Integer types: + * The type of `DWORD` now has the pointer precision. That is, + the size of `DWORD` will be 4 bytes on 32-bit platform, and 8 bytes on + 64-bit platform. + + * Similarly, `WPARAM` and `LPARAM` are now have the pointer precision. + + * `WORD` and `SWORD` has a half of pointer precision. The size of these + two types is 2 bytes on 32-bit platform, and 4 bytes on 64-bit platform. + + 3. New integer types: + * `DWORD32` and `SWORD32`: We introduce `DWORD32` and `SWORD32` types, which have + the size of 4 bytes on both 32-bit and 64-bit platforms. You should use these + types when reading/writing 32-bit integer from a binary files for the + portibility. Of course, you can still use Uint8, Uint16, Uint32, and Uint64 types. + + * `LRESULT`: this type is defined for window callback procedure, and it has + the pointer precision. + + +### API changes + +### Configuration option changes + ## Version 3.0.13 The MiniGUI development team announces the availability of MiniGUI 3.0.13. From acda11e59e9201d27380c4fb766106b3b9c6097c Mon Sep 17 00:00:00 2001 From: WEI Yongming Date: Thu, 25 Jan 2018 22:05:23 +0800 Subject: [PATCH 23/26] tune code and release notes --- RELEASE-NOTES.md | 159 +++++++++++++++++++++++++++++++++++++------ configure.ac | 3 +- include/window.h | 18 +++-- src/gui/lf_manager.c | 5 +- 4 files changed, 156 insertions(+), 29 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 7065edc0..9974ee66 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -10,40 +10,161 @@ MiniGUI apps. Please report any bugs and incompatibilities in ### What's new in this version - * Support for 64-bit platform. The definitions of some types and APIs - changed. + * Support for 64-bit platform. Note that the definitions of some types + and APIs changed. * Eliminate all compilation warnings. ### Type changes - 1. Handle types. All handle types, including `GHANDLE`, `HWND`, `HDC`, and so on, - are now defined as aliases of `PVOID` (`typedef void* PVOID`). - You may need to check your code to reflect this change. +#### Changes of handle types - 2. Integer types: - * The type of `DWORD` now has the pointer precision. That is, - the size of `DWORD` will be 4 bytes on 32-bit platform, and 8 bytes on - 64-bit platform. +All handle types, including `GHANDLE`, `HWND`, `HDC`, etc., +are now defined as aliases of `PVOID` (`typedef void* PVOID`). +You may need to check your code to reflect this change. - * Similarly, `WPARAM` and `LPARAM` are now have the pointer precision. +#### Changes of integer types. - * `WORD` and `SWORD` has a half of pointer precision. The size of these - two types is 2 bytes on 32-bit platform, and 4 bytes on 64-bit platform. +The type of `DWORD` now has the pointer precision. That is, +the size of `DWORD` will be 4 bytes on 32-bit platform, and 8 bytes on +64-bit platform. - 3. New integer types: - * `DWORD32` and `SWORD32`: We introduce `DWORD32` and `SWORD32` types, which have - the size of 4 bytes on both 32-bit and 64-bit platforms. You should use these - types when reading/writing 32-bit integer from a binary files for the - portibility. Of course, you can still use Uint8, Uint16, Uint32, and Uint64 types. +Similarly, `WPARAM` and `LPARAM` are now have the pointer precision. - * `LRESULT`: this type is defined for window callback procedure, and it has - the pointer precision. +`WORD` and `SWORD` has a half of pointer precision. The size of these +two types is 2 bytes on 32-bit platform, and 4 bytes on 64-bit platform. +RGBCOLOR now is defined as an aliase of DWORD32. + +Note that the type of BYTE always has the size of 8-bit on both +32-bit and 64-bit platforms. + +#### New integer types: + +`DWORD32` and `SDWORD32`. We introduce `DWORD32` and `SDWORD32` types, +which have the size of 4 bytes on both 32-bit and 64-bit platforms. +You should use these types when reading/writing 32-bit integers from +a binary files for the portibility. Of course, you can also use +Uint32 or Sint32 types. + +`WORD16` and `SWORD16`. Similarly, we introduce `WORD16` and `SWORD16` types, +which have the size of 2 bytes on both 32-bit and 64-bit platforms. +You should use these types when reading/writing 16-bit integers from +a binary file for the portibility. Of course, you can also use +Uint16 or SUint16 types. + +`LRESULT` is defined for window callback procedure, and it has +the pointer precision. + +`LINT` is a new integer type with pointer precision. ### API changes +#### Integer macros + +`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 the pointer +precision. + +Note that 'MakeRGB` and `MakeRGBA` macros always make DWORD32 integers. +In contract, GetRValue, GetRValue, GetBValue, GetAValue always get Red, +green, blue, and alpha components from a DWORD32 integer respectively. + +Note that you should use (-1) instead of 0xFFFFFFFF for invalid values. + +#### Structure and functions + +The main changes in structure and functions: + + * We now use a `UINT` instead of an `int` integer for the message identifier. + This is not a very important change. + + * We now use a `DWORD` integer for the time tick count. Meanwhile, you can + create 64 timers on 64-bit platform. + + * We now use a `LRESULT` integer for the return value of a window callback + procedure. Now it is safe to return a pointer from the callback procedure + on 64-bit platform. This is a very important change, and it will break the + source compatibilty of your code. You should check the source code (use + gcc option `-Wall`) carefully. + + * We now use a `LINT` integer for the identifier of a timer. So you can pass + a pointer as the identifier of the timer on 64-bit platform. mGNCS uses + MiniGUI timer in this manner. + +As a result, 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) + +to + + LRESULT SendMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) + +Furthermore, the structure and functions to register window class, +create main window, and create dialog box changed. For example, the prototype +of `WNDPROC` changed from + + typedef int (* WNDPROC)(HWND, int, WPARAM, LPARAM) + +to + + typedef LRESULT (* WNDPROC)(HWND, UINT, WPARAM, LPARAM) + +Therefore, the prototype of `DefaultWindowProc` changed from + + int DefaultWindowProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) + +to + + LRESULT DefaultWindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) + +All main window procedures, control class procedures, and dialog box procedures +defined by your app should change the implementation to reflect the change above. + +The prototype of `GetTickCount` changed from + + unsigned int GetTickCount (void) + +to + + DWORD GetTickCount (void); + +And the prototye of `TIMERPROC` changed from + + typedef BOOL (* TIMERPROC)(HWND, int, DWORD) + +to + + typedef BOOL (* TIMERPROC)(HWND, LINT, DWORD) + +In additio, we correct the bad or wrong definitions of some APIs: + + 1. `DWORD2PIXEL` to 'DWORD2Pixel`. The old one has a bad name. + 2. `GetWindowRendererFromName`: The return type changes from + `const WINDOW_ELEMENT_RENDERER*` to `WINDOW_ELEMENT_RENDERER*`. + So you can overload some methods directly of a renderer. + 3. `GetDefaultWindowElementRenderer`: The return type changes from + `const WINDOW_ELEMENT_RENDERER*` to `WINDOW_ELEMENT_RENDERER*`. + So you can overload some methods directly of the default renderer. + ### Configuration option changes +We add some new options for autoconf script (`configure`): + + * --with-runmode: Now you can use this option to specify the runtime + mode of MiniGUI. The old enable options for runmode were removed. + Note that MiniGUI-Processes now is the default runmode. + + * --enable-develmode: You should use this option to define `_DEBUG` macro, + enable `-Wall -Werror` option, and enable all features of MiniGUI, + if you a MiniGUI developer. + ## Version 3.0.13 The MiniGUI development team announces the availability of MiniGUI 3.0.13. diff --git a/configure.ac b/configure.ac index fc3a351b..67c00c98 100644 --- a/configure.ac +++ b/configure.ac @@ -1643,7 +1643,8 @@ fi if test "x$devel_mode" = "xyes"; then use_debug="yes" - trace_message="yes" + message_string="yes" + trace_message="no" build_auto_ial_engine="yes" build_random_ial_engine="yes" diff --git a/include/window.h b/include/window.h index b2c90991..3691c458 100644 --- a/include/window.h +++ b/include/window.h @@ -2168,9 +2168,9 @@ typedef struct _MSG HWND hwnd; /** The message identifier. */ UINT message; - /** The first parameter of the message (32-bit integer). */ + /** The first parameter of the message (a unsigned integer with pointer precision). */ WPARAM wParam; - /** The second parameter of the message (32-bit integer). */ + /** The second parameter of the message (a unsigned integer with pointer precision). */ LPARAM lParam; /** Time */ DWORD time; @@ -4270,7 +4270,7 @@ MG_EXPORT gal_pixel GUIAPI GetWindowElementPixelEx (HWND hwnd, HDC hdc, int we_attr_id); /** - * \fn const WINDOW_ELEMENT_RENDERER* \ + * \fn WINDOW_ELEMENT_RENDERER* GUIAPI GetWindowRendererFromName (const char* name) * \brief Get window renderer from name. * @@ -4280,8 +4280,11 @@ MG_EXPORT gal_pixel GUIAPI GetWindowElementPixelEx (HWND hwnd, * which is case-insensitive. * * \return The handle to the window renderer for success, NULL for failure. + * + * \note The prototype had changed since MiniGUI v3.2; the old one returns + * a const value. */ -MG_EXPORT const WINDOW_ELEMENT_RENDERER* +MG_EXPORT WINDOW_ELEMENT_RENDERER* GUIAPI GetWindowRendererFromName (const char* name); /** @@ -4312,14 +4315,17 @@ MG_EXPORT BOOL GUIAPI AddWindowElementRenderer (const char* name, MG_EXPORT BOOL GUIAPI RemoveWindowElementRenderer (const char* name); /** - * \fn const WINDOW_ELEMENT_RENDERER* GUIAPI GetDefaultWindowElementRenderer (void) + * \fn WINDOW_ELEMENT_RENDERER* GUIAPI GetDefaultWindowElementRenderer (void) * \brief Get the default window renderer. * * This function gets the default window renderer in MiniGUI. * * \return the pointer to the default renderer. + * + * \note The prototype had changed since MiniGUI v3.2; the old one returns + * a const value. */ -MG_EXPORT const WINDOW_ELEMENT_RENDERER* +MG_EXPORT WINDOW_ELEMENT_RENDERER* GUIAPI GetDefaultWindowElementRenderer (void); /** diff --git a/src/gui/lf_manager.c b/src/gui/lf_manager.c index ef27ad94..b685059f 100644 --- a/src/gui/lf_manager.c +++ b/src/gui/lf_manager.c @@ -59,8 +59,7 @@ static LFINFO wnd_lf_info [MAX_NR_RENDERERS] = /** The default renderer */ WINDOW_ELEMENT_RENDERER * __mg_def_renderer = &__mg_wnd_rdr_classic; -const WINDOW_ELEMENT_RENDERER* -GUIAPI GetWindowRendererFromName (const char* name) +WINDOW_ELEMENT_RENDERER* GUIAPI GetWindowRendererFromName (const char* name) { int i; if (NULL == name) @@ -177,7 +176,7 @@ BOOL GUIAPI RemoveWindowElementRenderer (const char* name) return TRUE; } -const WINDOW_ELEMENT_RENDERER * GUIAPI GetDefaultWindowElementRenderer (void) +WINDOW_ELEMENT_RENDERER * GUIAPI GetDefaultWindowElementRenderer (void) { return __mg_def_renderer; } From 71b769416e8103d99bf49f3d701ec029ecce96a7 Mon Sep 17 00:00:00 2001 From: WEI Yongming Date: Thu, 25 Jan 2018 22:11:23 +0800 Subject: [PATCH 24/26] tune release notes --- RELEASE-NOTES.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 9974ee66..0aadd5db 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -33,24 +33,24 @@ Similarly, `WPARAM` and `LPARAM` are now have the pointer precision. `WORD` and `SWORD` has a half of pointer precision. The size of these two types is 2 bytes on 32-bit platform, and 4 bytes on 64-bit platform. -RGBCOLOR now is defined as an aliase of DWORD32. +`RGBCOLOR` now is defined as an aliase of `DWORD32` (see below). -Note that the type of BYTE always has the size of 8-bit on both +Note that the type of `BYTE` always has the size of 8-bit on both 32-bit and 64-bit platforms. #### New integer types: -`DWORD32` and `SDWORD32`. We introduce `DWORD32` and `SDWORD32` types, +We introduce `DWORD32` and `SDWORD32` types, which have the size of 4 bytes on both 32-bit and 64-bit platforms. You should use these types when reading/writing 32-bit integers from a binary files for the portibility. Of course, you can also use -Uint32 or Sint32 types. +`Uint32` or `Sint32` types. -`WORD16` and `SWORD16`. Similarly, we introduce `WORD16` and `SWORD16` types, +Similarly, we introduce `WORD16` and `SWORD16` types, which have the size of 2 bytes on both 32-bit and 64-bit platforms. You should use these types when reading/writing 16-bit integers from a binary file for the portibility. Of course, you can also use -Uint16 or SUint16 types. +`Uint16` or `SUint16` types. `LRESULT` is defined for window callback procedure, and it has the pointer precision. @@ -75,7 +75,8 @@ Note that 'MakeRGB` and `MakeRGBA` macros always make DWORD32 integers. In contract, GetRValue, GetRValue, GetBValue, GetAValue always get Red, green, blue, and alpha components from a DWORD32 integer respectively. -Note that you should use (-1) instead of 0xFFFFFFFF for invalid values. +Note that you should use `(-1)` instead of `0xFFFFFFFF` for invalid +pointer-type values for good portability. #### Structure and functions @@ -157,11 +158,11 @@ In additio, we correct the bad or wrong definitions of some APIs: We add some new options for autoconf script (`configure`): - * --with-runmode: Now you can use this option to specify the runtime + * `--with-runmode`: Now you can use this option to specify the runtime mode of MiniGUI. The old enable options for runmode were removed. Note that MiniGUI-Processes now is the default runmode. - * --enable-develmode: You should use this option to define `_DEBUG` macro, + * `--enable-develmode`: You should use this option to define `_DEBUG` macro, enable `-Wall -Werror` option, and enable all features of MiniGUI, if you a MiniGUI developer. From 708d8097ebbf0ac06f13a90b4c6510a3ca65c7d1 Mon Sep 17 00:00:00 2001 From: WEI Yongming Date: Thu, 25 Jan 2018 22:16:18 +0800 Subject: [PATCH 25/26] tune release notes --- RELEASE-NOTES.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 0aadd5db..459302db 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -33,7 +33,7 @@ Similarly, `WPARAM` and `LPARAM` are now have the pointer precision. `WORD` and `SWORD` has a half of pointer precision. The size of these two types is 2 bytes on 32-bit platform, and 4 bytes on 64-bit platform. -`RGBCOLOR` now is defined as an aliase of `DWORD32` (see below). +`RGBCOLOR` now is defined as an alias of `DWORD32` (see below). Note that the type of `BYTE` always has the size of 8-bit on both 32-bit and 64-bit platforms. @@ -43,13 +43,13 @@ Note that the type of `BYTE` always has the size of 8-bit on both We introduce `DWORD32` and `SDWORD32` types, which have the size of 4 bytes on both 32-bit and 64-bit platforms. You should use these types when reading/writing 32-bit integers from -a binary files for the portibility. Of course, you can also use +a binary files for the portability. Of course, you can also use `Uint32` or `Sint32` types. Similarly, we introduce `WORD16` and `SWORD16` types, which have the size of 2 bytes on both 32-bit and 64-bit platforms. You should use these types when reading/writing 16-bit integers from -a binary file for the portibility. Of course, you can also use +a binary file for the portability. Of course, you can also use `Uint16` or `SUint16` types. `LRESULT` is defined for window callback procedure, and it has @@ -75,8 +75,8 @@ Note that 'MakeRGB` and `MakeRGBA` macros always make DWORD32 integers. In contract, GetRValue, GetRValue, GetBValue, GetAValue always get Red, green, blue, and alpha components from a DWORD32 integer respectively. -Note that you should use `(-1)` instead of `0xFFFFFFFF` for invalid -pointer-type values for good portability. +Note that you should use `(-1)` instead of `0xFFFFFFFF` for the invalid +pointer-type value for good portability. #### Structure and functions @@ -146,7 +146,7 @@ to In additio, we correct the bad or wrong definitions of some APIs: - 1. `DWORD2PIXEL` to 'DWORD2Pixel`. The old one has a bad name. + 1. `DWORD2PIXEL` to `DWORD2Pixel`. The old one has a bad name. 2. `GetWindowRendererFromName`: The return type changes from `const WINDOW_ELEMENT_RENDERER*` to `WINDOW_ELEMENT_RENDERER*`. So you can overload some methods directly of a renderer. @@ -186,7 +186,7 @@ report any bugs and incompatibilities in * [NEW] CopyCursor: Copies a cursor object. * [NEW] GetKeyboardState: Gets status of all keys on keyboard. - * [NEW] ToUnicode/ToAscii: Converts the key code between unicode and ASCII. + * [NEW] ToUnicode/ToAscii: Converts the key code between Unicode and ASCII. * [NEW] GetWindowRegion: The function obtains a copy of the window region of a window. * [NEW] InvalidateRegion: Invalidates the client area within the specified region. * [NEW] ValidateRect: Validates the client area within a rectangle by removing the @@ -197,7 +197,7 @@ report any bugs and incompatibilities in * [NEW] AdjustWindowRectEx: Calculates the required size of the window rectangle based on the desired size of the client rectangle. * [NEW] WindowFromPointEx: Retrieves a handle to the window that contains the specified point. - * [NEW] ChildWindowFromPointEx: Retrives a handle to the child window that contains the + * [NEW] ChildWindowFromPointEx: Retrieves a handle to the child window that contains the speicified point and meets the certain criteria. * [NEW] ScrollWindowEx: Scrolls the content of a window's client area. * [ADJUST] GetIMEPos/SetIMEPos: inline functions -> normal functions. From 200855ddef12d9dd1056d20325b423a3c66e2729 Mon Sep 17 00:00:00 2001 From: WEI Yongming Date: Thu, 25 Jan 2018 22:18:29 +0800 Subject: [PATCH 26/26] tune release notes --- RELEASE-NOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 459302db..63061367 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -164,7 +164,7 @@ We add some new options for autoconf script (`configure`): * `--enable-develmode`: You should use this option to define `_DEBUG` macro, enable `-Wall -Werror` option, and enable all features of MiniGUI, - if you a MiniGUI developer. + if you were a MiniGUI developer. ## Version 3.0.13