mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-02-06 10:21:57 +08:00
make timer-related APIs compiant to 64-bit
This commit is contained in:
12
configure.ac
12
configure.ac
@@ -1696,8 +1696,6 @@ if test "x$devel_mode" = "xyes"; then
|
||||
enable_video_custom="yes"
|
||||
|
||||
build_screensaver="yes"
|
||||
|
||||
CFLAGS="$CFLAGS -Werror"
|
||||
fi
|
||||
|
||||
dnl Depedencies
|
||||
@@ -2433,11 +2431,17 @@ fi
|
||||
dnl ========================================================================
|
||||
dnl Write output
|
||||
|
||||
# define _GNU_SOURCE for pthread_rwlock_t
|
||||
dnl define _GNU_SOURCE for pthread_rwlock_t
|
||||
CFLAGS="$CFLAGS -D_GNU_SOURCE"
|
||||
|
||||
if test "x$devel_mode" = "xyes"; then
|
||||
if test "$ac_cv_prog_gcc" = "yes"; then
|
||||
CPPFLAGS="$CPPFLAGS -Wall -Werror"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$ac_cv_prog_gcc" = "yes"; then
|
||||
CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -pipe"
|
||||
CFLAGS="$CFLAGS -Wstrict-prototypes -pipe"
|
||||
fi
|
||||
|
||||
if test "x$runtime_mode" = "xths"; then
|
||||
|
||||
@@ -299,22 +299,22 @@ typedef int BOOL;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def INV_PTR
|
||||
* \brief A value indicates an invalid non-null pointer.
|
||||
*/
|
||||
#define INV_PTR ((void *)-1)
|
||||
|
||||
#define GUIAPI
|
||||
|
||||
#if !defined(__NODLL__) && (defined (WIN32) || defined (__NUCLEUS_MNT__))
|
||||
#if defined(__MINIGUI_LIB__) && !defined(__MGEXT_LIB__)
|
||||
#define MG_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define MG_EXPORT __declspec(dllimport)
|
||||
#endif
|
||||
#if defined(__MGEXT_LIB__)
|
||||
#define MGEXT_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define MGEXT_EXPORT __declspec(dllimport)
|
||||
#endif
|
||||
# if defined(__MINIGUI_LIB__)
|
||||
# define MG_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
# define MG_EXPORT __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
#define MG_EXPORT
|
||||
#define MGEXT_EXPORT
|
||||
# define MG_EXPORT
|
||||
#endif
|
||||
|
||||
/** @} end of simple_types */
|
||||
@@ -499,6 +499,12 @@ typedef long LONG_PTR;
|
||||
typedef int LONG_PTR;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \var LINT
|
||||
* \brief Signed integer which has pointer precision.
|
||||
*/
|
||||
typedef LONG_PTR LINT;
|
||||
|
||||
/**
|
||||
* \var LRESULT
|
||||
* \brief Signed result of message processing.
|
||||
|
||||
@@ -1090,19 +1090,19 @@ MG_EXPORT BOOL GUIAPI InitPolygonRegion (PCLIPRGN dst,
|
||||
* \note MiniGUI does not do any clipping operation for this DC,
|
||||
* so use this DC may make a mess of other windows.
|
||||
*/
|
||||
#define HDC_SCREEN (HDC)0
|
||||
#define HDC_SCREEN ((HDC)0)
|
||||
|
||||
/*
|
||||
* This is a system screen DC create for MiniGUI internal usage, for example,
|
||||
* menu and z-order operations
|
||||
*/
|
||||
#define HDC_SCREEN_SYS (HDC)1
|
||||
#define HDC_SCREEN_SYS ((HDC)1)
|
||||
|
||||
/**
|
||||
* \def HDC_INVALID
|
||||
* \brief Indicates an invalid handle to device context.
|
||||
*/
|
||||
#define HDC_INVALID (HDC)-1
|
||||
#define HDC_INVALID ((HDC)-1)
|
||||
|
||||
#define GDCAP_COLORNUM 0
|
||||
#define GDCAP_HPIXEL 1
|
||||
|
||||
@@ -2173,7 +2173,7 @@ typedef struct _MSG
|
||||
/** The second parameter of the message (32-bit integer). */
|
||||
LPARAM lParam;
|
||||
/** Time */
|
||||
ULONG time;
|
||||
DWORD time;
|
||||
#ifdef _MGRM_THREADS
|
||||
/** Addtional data*/
|
||||
void* pAdd;
|
||||
@@ -4893,15 +4893,15 @@ extern MG_EXPORT HWND __mg_hwnd_desktop;
|
||||
* \def HWND_NULL
|
||||
* \brief Null window handle.
|
||||
*/
|
||||
#define HWND_NULL (HWND)0
|
||||
#define HWND_NULL ((HWND)0)
|
||||
|
||||
/**
|
||||
* \def HWND_INVALID
|
||||
* \brief Invalid window handle.
|
||||
*/
|
||||
#define HWND_INVALID (HWND)-1
|
||||
#define HWND_INVALID ((HWND)-1)
|
||||
|
||||
#define HWND_OTHERPROC (HWND)-1
|
||||
#define HWND_OTHERPROC ((HWND)-1)
|
||||
|
||||
/**
|
||||
* Structure defines a main window.
|
||||
@@ -7544,7 +7544,7 @@ MG_EXPORT NOTIFPROC GUIAPI GetNotificationCallback (HWND hwnd);
|
||||
*/
|
||||
|
||||
/**
|
||||
* \var typedef BOOL (* TIMERPROC)(HWND, int, DWORD)
|
||||
* \var typedef BOOL (* TIMERPROC)(HWND, LINT, DWORD)
|
||||
* \brief Type of the timer callback procedure.
|
||||
*
|
||||
* This is the prototype of the callback procedure of a timer created by SetTimerEx.
|
||||
@@ -7554,11 +7554,14 @@ MG_EXPORT NOTIFPROC GUIAPI GetNotificationCallback (HWND hwnd);
|
||||
* by MiniGUI automatically. This can be used to implement a one-shot timer.
|
||||
*
|
||||
* \sa SetTimerEx
|
||||
*
|
||||
* \note The prototype had changed since MiniGUI v3.2; the old one:
|
||||
* BOOL (* TIMERPROC)(HWND, int, unsigned int)
|
||||
*/
|
||||
typedef BOOL (* TIMERPROC)(HWND, int, DWORD);
|
||||
typedef BOOL (* TIMERPROC)(HWND, LINT, DWORD);
|
||||
|
||||
/**
|
||||
* \fn BOOL GUIAPI SetTimerEx (HWND hWnd, int id, unsigned int speed, \
|
||||
* \fn BOOL GUIAPI SetTimerEx (HWND hWnd, LINT id, DWORD speed, \
|
||||
* TIMERPROC timer_proc)
|
||||
* \brief Creates a timer with the specified timeout value.
|
||||
*
|
||||
@@ -7586,11 +7589,14 @@ typedef BOOL (* TIMERPROC)(HWND, int, DWORD);
|
||||
* \note You should set, reset, and kill a timer in the same thread if your
|
||||
* MiniGUI is configured as MiniGUI-Threads.
|
||||
*
|
||||
* \note The prototype had changed since MiniGUI v3.2; the old one:
|
||||
* BOOL GUIAPI SetTimerEx (HWND hWnd, int id, unsigned int speed, TIMERPROC timer_proc);
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* \include settimer.c
|
||||
*/
|
||||
MG_EXPORT BOOL GUIAPI SetTimerEx (HWND hWnd, int id, unsigned int speed,
|
||||
MG_EXPORT BOOL GUIAPI SetTimerEx (HWND hWnd, LINT id, DWORD speed,
|
||||
TIMERPROC timer_proc);
|
||||
|
||||
/**
|
||||
@@ -7603,23 +7609,26 @@ MG_EXPORT BOOL GUIAPI SetTimerEx (HWND hWnd, int id, unsigned int speed,
|
||||
SetTimerEx(hwnd, id, speed, NULL)
|
||||
|
||||
/**
|
||||
* \fn int GUIAPI KillTimer (HWND hWnd, int id)
|
||||
* \fn int GUIAPI KillTimer (HWND hWnd, LINT id)
|
||||
* \brief Destroys a timer.
|
||||
*
|
||||
* This function destroys the specified timer \a id.
|
||||
*
|
||||
* \param hWnd The window owns the timer.
|
||||
* \param id The identifier of the timer. If \a id equals or is less than 0,
|
||||
* \param id The identifier of the timer. If \a id equals 0,
|
||||
* this function will kill all timers in the system.
|
||||
*
|
||||
* \return The number of actually killed timer.
|
||||
*
|
||||
* \sa SetTimer
|
||||
*
|
||||
* \note The prototype had changed since MiniGUI v3.2; the old one:
|
||||
* int GUIAPI KillTimer (HWND hWnd, int id)
|
||||
*/
|
||||
MG_EXPORT int GUIAPI KillTimer (HWND hWnd, int id);
|
||||
MG_EXPORT int GUIAPI KillTimer (HWND hWnd, LINT id);
|
||||
|
||||
/**
|
||||
* \fn BOOL GUIAPI ResetTimerEx (HWND hWnd, int id, unsigned int speed, \
|
||||
* \fn BOOL GUIAPI ResetTimerEx (HWND hWnd, LINT id, DWORD speed, \
|
||||
* TIMERPROC timer_proc)
|
||||
* \brief Adjusts a timer with a different timeout value or different
|
||||
* timer callback procedure.
|
||||
@@ -7630,14 +7639,17 @@ MG_EXPORT int GUIAPI KillTimer (HWND hWnd, int id);
|
||||
* \param id The identifier of the timer.
|
||||
* \param speed The new timeout value.
|
||||
* \param timer_proc The new timer callback procedure. If \a timer_proc
|
||||
* is 0xFFFFFFFF, the setting of timer callback procedure will
|
||||
* not changed.
|
||||
* is INV_PTR, the setting of timer callback procedure will
|
||||
* not change.
|
||||
*
|
||||
* \return TRUE on success, FALSE on error.
|
||||
*
|
||||
* \sa SetTimerEx
|
||||
*
|
||||
* \note The prototype had changed since MiniGUI v3.2; the old one:
|
||||
* BOOL GUIAPI ResetTimerEx (HWND hWnd, int id, unsigned int speed, TIMERPROC timer_proc)
|
||||
*/
|
||||
MG_EXPORT BOOL GUIAPI ResetTimerEx (HWND hWnd, int id, unsigned int speed,
|
||||
MG_EXPORT BOOL GUIAPI ResetTimerEx (HWND hWnd, LINT id, DWORD speed,
|
||||
TIMERPROC timer_proc);
|
||||
|
||||
/**
|
||||
@@ -7647,10 +7659,10 @@ MG_EXPORT BOOL GUIAPI ResetTimerEx (HWND hWnd, int id, unsigned int speed,
|
||||
* \sa ResetTimerEx
|
||||
*/
|
||||
#define ResetTimer(hwnd, id, speed) \
|
||||
ResetTimerEx(hwnd, id, speed, (TIMERPROC)0xFFFFFFFF)
|
||||
ResetTimerEx(hwnd, id, speed, (TIMERPROC)INV_PTR)
|
||||
|
||||
/**
|
||||
* \fn unsigned int GUIAPI GetTickCount (void)
|
||||
* \fn DWORD GUIAPI GetTickCount (void)
|
||||
* \brief Retrieves the tick counts that have elapsed since MiniGUI was started.
|
||||
*
|
||||
* This function retrieves the tick counts that have elapsed since MiniGUI
|
||||
@@ -7658,11 +7670,14 @@ MG_EXPORT BOOL GUIAPI ResetTimerEx (HWND hWnd, int id, unsigned int speed,
|
||||
* for a general Linux box, the returned tick count value is in unit of 10ms.
|
||||
*
|
||||
* \return The tick counts value that have elapsed since MiniGUI was started.
|
||||
*
|
||||
* \note The prototype had changed since MiniGUI v3.2; The old one:
|
||||
* unsinged int GUIAPI GetTickCount (void);
|
||||
*/
|
||||
MG_EXPORT unsigned int GUIAPI GetTickCount (void);
|
||||
MG_EXPORT DWORD GUIAPI GetTickCount (void);
|
||||
|
||||
/**
|
||||
* \fn BOOL GUIAPI IsTimerInstalled (HWND hWnd, int id)
|
||||
* \fn BOOL GUIAPI IsTimerInstalled (HWND hWnd, LINT id)
|
||||
* \brief Determines whether a timer is installed.
|
||||
*
|
||||
* This function determines whether a timer with identifier \a id of
|
||||
@@ -7674,8 +7689,11 @@ MG_EXPORT unsigned int GUIAPI GetTickCount (void);
|
||||
* \return TRUE for installed, otherwise FALSE.
|
||||
*
|
||||
* \sa SetTimer, HaveFreeTimer
|
||||
*
|
||||
* \note The prototype had changed since MiniGUI v3.2; the old one:
|
||||
* BOOL GUIAPI IsTimerInstalled (HWND hWnd, int id)
|
||||
*/
|
||||
MG_EXPORT BOOL GUIAPI IsTimerInstalled (HWND hWnd, int id);
|
||||
MG_EXPORT BOOL GUIAPI IsTimerInstalled (HWND hWnd, LINT id);
|
||||
|
||||
/**
|
||||
* \fn BOOL GUIAPI HaveFreeTimer (void)
|
||||
|
||||
@@ -235,8 +235,8 @@ static void check_live (void)
|
||||
|
||||
BOOL client_IdleHandler4Client (PMSGQUEUE msg_que)
|
||||
{
|
||||
static unsigned int old_timer;
|
||||
static int repeat_timeout = TIMEOUT_START_REPEAT;
|
||||
static DWORD old_timer;
|
||||
static long repeat_timeout = TIMEOUT_START_REPEAT;
|
||||
fd_set rset, wset, eset;
|
||||
fd_set* wsetptr = NULL;
|
||||
fd_set* esetptr = NULL;
|
||||
|
||||
@@ -35,7 +35,7 @@ void screensaver_hide(void);
|
||||
*/
|
||||
#define WS_EX_CTRLASMAINWIN 0x20000000L
|
||||
|
||||
#define DEF_NR_TIMERS 32
|
||||
#define DEF_NR_TIMERS NR_BITS_DWORD
|
||||
|
||||
#if defined (__NOUNIX__) || defined (__uClinux__)
|
||||
#define DEF_MSGQUEUE_LEN 16
|
||||
@@ -475,7 +475,7 @@ PGCRINFO kernel_GetGCRgnInfo (HWND hWnd);
|
||||
/* internal variables */
|
||||
typedef struct _TRACKMENUINFO* PTRACKMENUINFO;
|
||||
|
||||
extern unsigned int __mg_timer_counter;
|
||||
extern DWORD __mg_timer_counter;
|
||||
|
||||
extern HWND __mg_capture_wnd;
|
||||
extern HWND __mg_ime_wnd;
|
||||
|
||||
@@ -43,8 +43,8 @@ typedef struct tagG_RES {
|
||||
|
||||
GHANDLE topmost_layer;
|
||||
|
||||
unsigned int timer_counter;
|
||||
unsigned int tick_on_locksem;
|
||||
DWORD timer_counter;
|
||||
DWORD tick_on_locksem;
|
||||
struct timeval timeout;
|
||||
struct termios savedtermio;
|
||||
#ifdef _MGRM_PROCESSES
|
||||
|
||||
@@ -20,14 +20,14 @@ extern "C" {
|
||||
#define USEC_10MS 10000
|
||||
|
||||
typedef struct _timer {
|
||||
HWND hWnd;
|
||||
int id;
|
||||
unsigned int speed;
|
||||
unsigned int count;
|
||||
HWND hWnd;
|
||||
LINT id;
|
||||
DWORD speed;
|
||||
UINT_PTR count;
|
||||
|
||||
TIMERPROC proc;
|
||||
unsigned int tick_count;
|
||||
PMSGQUEUE msg_queue;
|
||||
TIMERPROC proc;
|
||||
UINT_PTR tick_count;
|
||||
PMSGQUEUE msg_queue;
|
||||
} TIMER;
|
||||
typedef TIMER* PTIMER;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
**
|
||||
** timer.c: The Timer module for MiniGUI-Threads.
|
||||
**
|
||||
** Copyright (C) 2003 ~ 2008 Feynman Software.
|
||||
** Copyright (C) 2003 ~ 2018 Feynman Software.
|
||||
** Copyright (C) 1999 ~ 2002 Wei Yongming.
|
||||
**
|
||||
** All rights reserved by Feynman Software.
|
||||
@@ -39,7 +39,7 @@
|
||||
#define TIMER_ERR_SYS(text)
|
||||
#endif
|
||||
|
||||
unsigned int __mg_timer_counter = 0;
|
||||
DWORD __mg_timer_counter = 0;
|
||||
static TIMER *timerstr[DEF_NR_TIMERS];
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
@@ -351,15 +351,17 @@ void __mg_move_timer_last (TIMER* timer, int slot)
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOL GUIAPI SetTimerEx (HWND hWnd, int id, unsigned int speed,
|
||||
BOOL GUIAPI SetTimerEx (HWND hWnd, LINT id, DWORD speed,
|
||||
TIMERPROC timer_proc)
|
||||
{
|
||||
int i;
|
||||
PMSGQUEUE pMsgQueue;
|
||||
int slot = -1;
|
||||
PMSGQUEUE pMsgQueue;
|
||||
|
||||
if (speed <= 0)
|
||||
{
|
||||
if (id == 0)
|
||||
return FALSE;
|
||||
|
||||
if (speed == 0) {
|
||||
speed = 1;
|
||||
}
|
||||
|
||||
@@ -467,8 +469,8 @@ void mg_remove_timers_by_msg_queue (const MSGQUEUE* msg_que)
|
||||
TIMER_UNLOCK ();
|
||||
}
|
||||
|
||||
/* If id <= 0, clear all timers of the window */
|
||||
int GUIAPI KillTimer (HWND hWnd, int id)
|
||||
/* If id == 0, clear all timers of the window */
|
||||
int GUIAPI KillTimer (HWND hWnd, LINT id)
|
||||
{
|
||||
int i;
|
||||
PMSGQUEUE pMsgQueue;
|
||||
@@ -485,13 +487,13 @@ int GUIAPI KillTimer (HWND hWnd, int id)
|
||||
|
||||
for (i = 0; i < DEF_NR_TIMERS; i++) {
|
||||
if ((timerstr [i] && timerstr [i]->hWnd == hWnd) &&
|
||||
(id <= 0 || timerstr [i]->id == id)) {
|
||||
(id == 0 || timerstr [i]->id == id)) {
|
||||
RemoveMsgQueueTimerFlag (pMsgQueue, i);
|
||||
free (timerstr[i]);
|
||||
timerstr [i] = NULL;
|
||||
killed ++;
|
||||
|
||||
if (id > 0) break;
|
||||
if (id) break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -504,12 +506,15 @@ int GUIAPI KillTimer (HWND hWnd, int id)
|
||||
return killed;
|
||||
}
|
||||
|
||||
BOOL GUIAPI ResetTimerEx (HWND hWnd, int id, unsigned int speed,
|
||||
BOOL GUIAPI ResetTimerEx (HWND hWnd, LINT id, DWORD speed,
|
||||
TIMERPROC timer_proc)
|
||||
{
|
||||
int i;
|
||||
PMSGQUEUE pMsgQueue;
|
||||
|
||||
if (id == 0)
|
||||
return FALSE;
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
if (!(pMsgQueue = GetMsgQueueThisThread ()))
|
||||
return FALSE;
|
||||
@@ -519,13 +524,13 @@ BOOL GUIAPI ResetTimerEx (HWND hWnd, int id, unsigned int speed,
|
||||
|
||||
TIMER_LOCK ();
|
||||
|
||||
for (i=0; i<DEF_NR_TIMERS; i++) {
|
||||
for (i = 0; i < DEF_NR_TIMERS; i++) {
|
||||
if (timerstr[i] && timerstr[i]->hWnd == hWnd && timerstr[i]->id == id) {
|
||||
/* Should clear old timer flags */
|
||||
RemoveMsgQueueTimerFlag (pMsgQueue, i);
|
||||
timerstr[i]->speed = speed;
|
||||
timerstr[i]->count = 0;
|
||||
if (timer_proc != (TIMERPROC)0xFFFFFFFF)
|
||||
if (timer_proc != (TIMERPROC)INV_PTR)
|
||||
timerstr[i]->proc = timer_proc;
|
||||
timerstr[i]->tick_count = 0;
|
||||
|
||||
@@ -538,13 +543,16 @@ BOOL GUIAPI ResetTimerEx (HWND hWnd, int id, unsigned int speed,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL GUIAPI IsTimerInstalled (HWND hWnd, int id)
|
||||
BOOL GUIAPI IsTimerInstalled (HWND hWnd, LINT id)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (id == 0)
|
||||
return FALSE;
|
||||
|
||||
TIMER_LOCK ();
|
||||
|
||||
for (i=0; i<DEF_NR_TIMERS; i++) {
|
||||
for (i = 0; i < DEF_NR_TIMERS; i++) {
|
||||
if ( timerstr[i] != NULL ) {
|
||||
if ( timerstr[i]->hWnd == hWnd && timerstr[i]->id == id) {
|
||||
TIMER_UNLOCK ();
|
||||
@@ -570,7 +578,7 @@ BOOL GUIAPI HaveFreeTimer (void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
unsigned int GUIAPI GetTickCount (void)
|
||||
DWORD GUIAPI GetTickCount (void)
|
||||
{
|
||||
#ifdef _MGRM_PROCESSES
|
||||
return SHAREDRES_TIMER_COUNTER;
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#define NALLOC 4 /* #Client structs to alloc/realloc for */
|
||||
|
||||
extern unsigned int __mg_timer_counter;
|
||||
extern DWORD __mg_timer_counter;
|
||||
|
||||
MG_Client* mgClients = NULL;
|
||||
int mgClientSize = 0;
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#include "drawsemop.h"
|
||||
#include "license.h"
|
||||
|
||||
extern unsigned int __mg_timer_counter;
|
||||
extern DWORD __mg_timer_counter;
|
||||
|
||||
ON_NEW_DEL_CLIENT OnNewDelClient = NULL;
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ ClassType(clss) Class(clss) = { (PClassConstructor)clss##ClassConstructor }; \
|
||||
static const char* clss##_type_name = #clss; \
|
||||
static ClassType(clss) * clss##ClassConstructor(ClassType(clss)* _class) { \
|
||||
unsigned short * _pintfOffset = NULL; \
|
||||
_pintfOffset = (PVOID)((UINT_PTR)_pintfOffset ^ 0); /* prevent unused-but-set-variable warning */ \
|
||||
_pintfOffset = (PVOID)((UINT_PTR)_pintfOffset ^ 0); /* VW: prevent unused-but-set-variable warning */ \
|
||||
_class = (ClassType(clss)*)((PClassConstructor)(Class(superCls).classConstructor))((mObjectClass*)_class); \
|
||||
_pintfOffset = &_class->intfOffset; \
|
||||
_class->super = &Class(superCls); \
|
||||
|
||||
Reference in New Issue
Block a user