From b59f0b6a933d5709880e171af34b8cab178b7a65 Mon Sep 17 00:00:00 2001 From: VincentWei Date: Wed, 17 Jan 2018 18:51:41 +0800 Subject: [PATCH] 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)