From 32939cf0af683de76056336205d6ee82add40366 Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Fri, 21 Feb 2020 20:06:50 +0800 Subject: [PATCH] cleanup --- include/minigui.h | 36 ++++++++++++++++++------------------ include/window.h | 35 ++++++++++++++++++++++------------- src/gui/lf_classic.c | 6 +++--- 3 files changed, 43 insertions(+), 34 deletions(-) diff --git a/include/minigui.h b/include/minigui.h index 00519f69..d8c8bcd9 100644 --- a/include/minigui.h +++ b/include/minigui.h @@ -398,6 +398,24 @@ MG_EXPORT void GUIAPI TerminateGUI (int not_used); **/ MG_EXPORT void GUIAPI MiniGUIPanic (int exitcode); +/** +* \def NAME_SELF_LAYER +* \brief The name of the self layer. +**/ +#define NAME_SELF_LAYER "" + +/** +* \def NAME_TOPMOST_LAYER +* \brief The name of the topmost layer. +**/ +#define NAME_TOPMOST_LAYER "" + +/** +* \def NAME_DEF_LAYER +* \brief The default name of the layer. +**/ +#define NAME_DEF_LAYER "mginit" + #ifdef _MGRM_PROCESSES /** @@ -418,24 +436,6 @@ MG_EXPORT void GUIAPI MiniGUIPanic (int exitcode); * @{ */ -/** -* \def NAME_SELF_LAYER -* \brief The name of the self layer. -**/ -#define NAME_SELF_LAYER "" - -/** -* \def NAME_TOPMOST_LAYER -* \brief The name of the topmost layer. -**/ -#define NAME_TOPMOST_LAYER "" - -/** -* \def NAME_DEF_LAYER -* \brief The default name of the layer. -**/ -#define NAME_DEF_LAYER "mginit" - /** * \fn GHANDLE GUIAPI JoinLayer (const char* layer_name, const char* client_name, diff --git a/include/window.h b/include/window.h index 16af6eab..9cbf036f 100644 --- a/include/window.h +++ b/include/window.h @@ -8202,8 +8202,8 @@ MG_EXPORT HWND GUIAPI GetFirstHosted (HWND hHosting); * * \return Handle to the next hosted main window. * Returns 0 when \a hHosted is the last hosted main window; - * HWND_INVALID when error occurs. If \a hHosted is 0, this call - * equals GetFirstHosted(hHosting). + * HWND_INVALID when error occurs. If \a hHosted is 0, it is equivalent + * to GetFirstHosted(hHosting). * If an invalid window handle is passed as \a hHosting * or \a hHosted, HWND_INVALID will be returned; If \a hHosted is * not the hosted window of \a hHosting, HWND_INVALID will be returned. @@ -9446,15 +9446,20 @@ MG_EXPORT NOTIFPROC GUIAPI SetNotificationCallback (HWND hwnd, MG_EXPORT NOTIFPROC GUIAPI GetNotificationCallback (HWND hwnd); /** - * \def CreateWindow(class_name, caption, style, id, x, y, w, h, parent, add_data) + * \def CreateWindow(class_name, caption, style, id, x, y, w, h, parent, + * add_data) * \brief A simplified version of \a CreateWindowEx. * * \sa CreateWindowEx */ -#define CreateWindow(class_name, caption, style, \ - id, x, y, w, h, parent, add_data) \ - CreateWindowEx(class_name, caption, style, 0, \ - id, x, y, w, h, parent, add_data) +static inline HWND GUIAPI CreateWindow (const char* spClassName, + const char* spCaption, DWORD dwStyle, + LINT id, int x, int y, int w, int h, HWND hParentWnd, + DWORD dwAddData) +{ + return CreateWindowEx2 (spClassName, spCaption, dwStyle, WS_EX_NONE, + id, x, y, w, h, hParentWnd, NULL, NULL, dwAddData); +} /** @} end of control_fns */ @@ -9468,7 +9473,8 @@ MG_EXPORT NOTIFPROC GUIAPI GetNotificationCallback (HWND hwnd); * \var typedef BOOL (* TIMERPROC)(HWND, LINT, DWORD) * \brief Type of the timer callback procedure. * - * This is the prototype of the callback procedure of a timer created by SetTimerEx. + * This is the prototype of the callback procedure of a timer created by + * \a SetTimerEx. * MiniGUI will call the timer procedure instead of sending MSG_TIMER message. * * If the return value of a timer procedure is FALSE, the timer will be killed @@ -9477,6 +9483,7 @@ MG_EXPORT NOTIFPROC GUIAPI GetNotificationCallback (HWND hwnd); * \sa SetTimerEx * * \note The prototype had changed since MiniGUI v3.2; the old one: + * * BOOL (* TIMERPROC)(HWND, int, unsigned int) */ typedef BOOL (* TIMERPROC)(HWND, LINT, DWORD); @@ -9507,11 +9514,13 @@ typedef BOOL (* TIMERPROC)(HWND, LINT, DWORD); * * \sa SetTimer, ResetTimerEx, KillTimer, MSG_TIMER * - * \note You should set, reset, and kill a timer in the same thread if your - * MiniGUI is configured as MiniGUI-Threads. + * \note You should set, reset, and kill a timer in the same message thread + * if your enabled support for the virtual window. * * \note The prototype had changed since MiniGUI v3.2; the old one: - * BOOL GUIAPI SetTimerEx (HWND hWnd, int id, unsigned int speed, TIMERPROC timer_proc); + * + * BOOL SetTimerEx (HWND hWnd, int id, unsigned int speed, \ + * TIMERPROC timer_proc); * * Example: * @@ -9536,8 +9545,8 @@ MG_EXPORT BOOL GUIAPI SetTimerEx (HWND hWnd, LINT id, DWORD speed, * This function destroys the specified timer \a id. * * \param hWnd The window owns the timer. - * \param id The identifier of the timer. If \a id equals 0, - * this function will kill all timers in the system. + * \param id The identifier of the timer. If \a id is 0, this function will + * kill all timers of created by the window. * * \return The number of actually killed timer. * diff --git a/src/gui/lf_classic.c b/src/gui/lf_classic.c index 6c4c155b..1e850d77 100644 --- a/src/gui/lf_classic.c +++ b/src/gui/lf_classic.c @@ -2271,10 +2271,10 @@ static void draw_border (HWND hWnd, HDC hdc, BOOL is_active) if (border < -2) return ; - if(is_active) - border_color = GetWindowElementPixelEx (hWnd, hdc, WE_FGC_ACTIVE_WND_BORDER); + if (is_active) + border_color = GetWindowElementPixelEx (hWnd, hdc, WE_FGC_ACTIVE_WND_BORDER); else - border_color = GetWindowElementPixelEx (hWnd, hdc, WE_FGC_INACTIVE_WND_BORDER); + border_color = GetWindowElementPixelEx (hWnd, hdc, WE_FGC_INACTIVE_WND_BORDER); win_info = GetWindowInfo(hWnd);