Merge branch 'rel-5-0' into rel-5-0

This commit is contained in:
Vincent Wei
2020-09-29 17:12:40 +08:00
committed by GitHub
12 changed files with 262 additions and 66 deletions

44
build/buildlib-freertos Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/sh
rm config.cache config.status -f
./configure \
--disable-shared \
--enable-static \
--with-osname=freertos \
--with-targetname=external \
--with-runmode=sa \
--enable-mgslicefallback \
--disable-videopcxvfb \
--disable-videoqvfb \
--disable-videodrm \
--disable-videofbcon \
--enable-videocommlcd \
--enable-dummyial \
--disable-consoleial \
--disable-libinputial \
--enable-commial \
--disable-consoleimps2 \
--disable-mousecalibrate \
--enable-incoreres \
--disable-cursor \
--disable-clipboard \
--disable-adv2dapi \
--disable-savebitmap \
--disable-savescreen \
--disable-dblclk \
--disable-splash \
--disable-latin9support \
--disable-fullunicode \
--disable-rbfsupport \
--disable-vbfsupport \
--disable-upfsupport \
--disable-qpfsupport \
--disable-ttfsupport \
--disable-complexscripts \
--disable-ttfcache \
--disable-jpgsupport \
--disable-pngsupport \
--disable-flatlf \
--disable-textmode \
--disable-shmopen

41
build/buildlib-linux-minimal Executable file
View File

@@ -0,0 +1,41 @@
#!/bin/sh
rm config.cache config.status -f
./configure \
--disable-shared \
--enable-static \
--with-osname=linux \
--with-targetname=external \
--with-runmode=sa \
--enable-mgslicefallback \
--disable-videopcxvfb \
--disable-videoqvfb \
--disable-videodrm \
--disable-videofbcon \
--enable-videocommlcd \
--enable-dummyial \
--disable-consoleial \
--disable-libinputial \
--enable-commial \
--disable-consoleimps2 \
--disable-mousecalibrate \
--enable-incoreres \
--disable-cursor \
--disable-savebitmap \
--disable-savescreen \
--disable-dblclk \
--disable-splash \
--disable-latin9support \
--disable-fullunicode \
--disable-rbfsupport \
--disable-vbfsupport \
--disable-upfsupport \
--disable-qpfsupport \
--disable-ttfsupport \
--disable-complexscripts \
--disable-ttfcache \
--disable-jpgsupport \
--disable-pngsupport \
--disable-flatlf \
--disable-textmode

View File

@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.60)
AC_INIT(libminigui, 5.0.2)
AC_INIT(libminigui, 5.0.3)
AC_CONFIG_SRCDIR(src/main/main.c)
dnl Set various version strings - taken gratefully from the SDL sources
@@ -16,9 +16,9 @@ dnl Set various version strings - taken gratefully from the SDL sources
#
MINIGUI_MAJOR_VERSION=5
MINIGUI_MINOR_VERSION=0
MINIGUI_MICRO_VERSION=2
MINIGUI_INTERFACE_AGE=2
MINIGUI_BINARY_AGE=2
MINIGUI_MICRO_VERSION=3
MINIGUI_INTERFACE_AGE=0
MINIGUI_BINARY_AGE=3
MINIGUI_VERSION=$MINIGUI_MAJOR_VERSION.$MINIGUI_MINOR_VERSION.$MINIGUI_MICRO_VERSION
AC_SUBST(MINIGUI_MAJOR_VERSION)
@@ -77,7 +77,7 @@ AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(time mktime localtime clock_gettime strdup strcasecmp strncasecmp strerror setlocale)
AC_CHECK_FUNCS(posix_memalign memalign valloc memfd_create poll select)
AC_CHECK_FUNCS(posix_memalign memalign valloc memfd_create access poll select)
PKG_CHECK_MODULES(UDEV, [libudev >= 200], have_udev="yes", have_udev="no; need libudev 200+")

View File

@@ -101,9 +101,9 @@ extern "C" {
#define ZOF_TYPE_NORMAL 0x30000000
#define ZOF_TYPE_HIGHER 0x40000000
#define ZOF_TYPE_DOCKER 0x50000000 // Since 5.0.0
#define ZOF_TYPE_SCREENLOCK 0x60000000 // Since 5.0.0;
#define ZOF_TYPE_SCREENLOCK 0x60000000 // Since 5.0.0
#define ZOF_TYPE_GLOBAL 0x70000000
#define ZOF_TYPE_TOOLTIP 0x80000000 // Since 5.0.0; fixed and only one.
#define ZOF_TYPE_TOOLTIP 0x80000000 // Since 5.0.0
#define ZOF_TYPE_POPUPMENU 0x90000000
#define ZOF_TYPE_BOTTOMMOST ZOF_TYPE_LAUNCHER
@@ -669,21 +669,22 @@ typedef void (* ON_NEW_DEL_CLIENT) (int op, int cli);
typedef void (* ON_CHANGE_LAYER) (int op, MG_Layer* layer,
MG_Client* client);
#define ZNOP_ALLOCATE 1
#define ZNOP_FREE 2
#define ZNOP_MOVE2TOP 3
#define ZNOP_SHOW 4
#define ZNOP_HIDE 5
#define ZNOP_MOVEWIN 6
#define ZNOP_SETACTIVE 7
#define ZNOP_ALLOCATE 1
#define ZNOP_FREE 2
#define ZNOP_MOVE2TOP 3
#define ZNOP_SHOW 4
#define ZNOP_HIDE 5
#define ZNOP_MOVEWIN 6
#define ZNOP_SETACTIVE 7
#define ZNOP_ENABLEWINDOW 11
#define ZNOP_DISABLEWINDOW 12
#define ZNOP_STARTDRAG 13
#define ZNOP_CANCELDRAG 14
#define ZNOP_CHANGECAPTION 15
#define ZNOP_REGIONCHANGED 16
#define ZNOP_COMPOSITINGCHANGED 17
#define ZNOP_ENABLEWINDOW 11
#define ZNOP_DISABLEWINDOW 12
#define ZNOP_STARTDRAG 13
#define ZNOP_CANCELDRAG 14
#define ZNOP_CHANGECAPTION 15
#define ZNOP_REGIONCHANGED 16
#define ZNOP_COMPOSITINGCHANGED 17
#define ZNOP_ICONCHANGED 18 /* reserved for future */
/**
* \var typedef void (* ON_ZNODE_OPERATION) (int op, int cli, int idx_znode)
@@ -889,6 +890,39 @@ MG_EXPORT BOOL GUIAPI ServerSetTopmostLayer (MG_Layer* layer);
*/
MG_EXPORT BOOL GUIAPI ServerDeleteLayer (MG_Layer* layer);
/**
* \fn int GUIAPI ServerGetTopmostZNodeOfType (MG_Layer* layer, DWORD type,
* int* cli)
* \brief Get the topmost z-node in the specified layer for the specific
* window type from the server.
*
* This function gets the topmost z-node of the type specified by
* \a type in the specified layer \a layer from the server.
*
* \param layer The pointer to the layer, NULL for the current topmost layer.
* \param type The window type, can be one of the following values:
* - ZOF_TYPE_TOOLTIP
* - ZOF_TYPE_GLOBAL
* - ZOF_TYPE_SCREENLOCK
* - ZOF_TYPE_DOCKER
* - ZOF_TYPE_HIGHER
* - ZOF_TYPE_NORMAL
* - ZOF_TYPE_LAUNCHER
* \param cli The client identifier of the topmost z-node will be returned
* through this pointer. NULL is okay.
*
* \return The index of the topmost z-node of the specified type.
* Zero when there is no z-node in the level; < 0 when error.
*
* \note Server-only function. Note that this function will not return
* the z-node of the desktop, and the desktop always has the z-node index
* of zero.
*
* \sa ServerGetZNodeInfo
*/
MG_EXPORT int GUIAPI ServerGetTopmostZNodeOfType (MG_Layer* layer, DWORD type,
int* cli);
/**
* \fn int GUIAPI ServerGetNextZNode (MG_Layer* layer, int idx_znode,
* int* cli)

View File

@@ -711,7 +711,7 @@ static BOOL merge_dirty_wpp (CompositorCtxt* ctxt, MG_Layer* layer)
return rc;
}
BOOL refresh_dirty_region (CompositorCtxt* ctxt, MG_Layer* layer)
static BOOL refresh_dirty_region (CompositorCtxt* ctxt, MG_Layer* layer)
{
/* the fallback compositor only manages znodes on the topmost layer. */
if (layer != mgTopmostLayer || IsEmptyClipRgn (&ctxt->dirty_rgn))

View File

@@ -377,16 +377,16 @@ void __mg_composite_dirty_znodes (void)
#endif /* optimized */
static void purge_znodes_private_data_in_layer (const CompositorOps* ops,
CompositorCtxt* ctxt, MG_Layer* layer)
static void purge_all_znodes_private_data (const CompositorOps* ops,
CompositorCtxt* ctxt)
{
ZORDERINFO* zi;
ZORDERNODE* nodes;
int i, next;
MG_Layer* layer;
zi = (ZORDERINFO*)layer->zorder_info;
// travel popup menu znodes
/* travel menu znodes on the topmost layer */
zi = (ZORDERINFO*)mgTopmostLayer->zorder_info;
if (zi->nr_popupmenus > 0) {
nodes = GET_MENUNODE(zi);
for (i = 0; i < zi->nr_popupmenus; i++) {
@@ -397,25 +397,56 @@ static void purge_znodes_private_data_in_layer (const CompositorOps* ops,
}
}
// travel window znodes
nodes = GET_ZORDERNODE(zi);
next = 0;
while ((next = __kernel_get_next_znode (zi, next)) > 0) {
if (nodes[next].priv_data && ops->purge_win_data) {
ops->purge_win_data (ctxt, layer, next, nodes[next].priv_data);
nodes[next].priv_data = NULL;
/* travel all window znodes in all layers */
layer = mgLayers;
while (layer) {
zi = (ZORDERINFO*)layer->zorder_info;
nodes = GET_ZORDERNODE(zi);
next = 0;
while ((next = __kernel_get_next_znode (zi, next)) > 0) {
if (nodes[next].priv_data && ops->purge_win_data) {
ops->purge_win_data (ctxt, layer, next, nodes[next].priv_data);
nodes[next].priv_data = NULL;
}
}
layer = layer->next;
}
}
static inline void purge_all_znodes_private_data (const CompositorOps* ops,
static void rebuild_all_znodes_private_data (const CompositorOps* ops,
CompositorCtxt* ctxt)
{
ZORDERINFO* zi;
ZORDERNODE* nodes;
int i, next;
MG_Layer* layer;
/* travel menu znodes on the topmost layer */
zi = (ZORDERINFO*)mgTopmostLayer->zorder_info;
if (zi->nr_popupmenus > 0) {
nodes = GET_MENUNODE(zi);
for (i = 0; i < zi->nr_popupmenus; i++) {
if (nodes[i].flags & ZOF_VISIBLE) {
ops->on_showing_ppp (ctxt, i);
}
}
}
/* travel all window znodes in all layers */
layer = mgLayers;
while (layer) {
purge_znodes_private_data_in_layer (ops, ctxt, layer);
zi = (ZORDERINFO*)layer->zorder_info;
nodes = GET_ZORDERNODE(zi);
next = 0;
while ((next = __kernel_get_next_znode (zi, next)) > 0) {
if (nodes[next].flags & ZOF_VISIBLE) {
ops->on_showing_win (ctxt, layer, next);
}
}
layer = layer->next;
}
}
@@ -539,6 +570,9 @@ const CompositorOps* GUIAPI ServerSelectCompositor (const char* name,
}
curr_ops = ops;
curr_ctxt = ctxt;
/* Since 5.0.3, to rebuild the private data of visible znodes */
rebuild_all_znodes_private_data (curr_ops, curr_ctxt);
curr_ops->refresh (ctxt);
}

View File

@@ -140,6 +140,8 @@ static BOOL allocate_more_fd_slots (MSGQUEUE* msg_queue)
msg_queue->fd_slots[i] = NULL;
}
msg_queue->nr_fd_slots += MAX_NR_LISTEN_FD;
return TRUE;
}
return FALSE;
@@ -213,8 +215,11 @@ BOOL GUIAPI RegisterListenFD (int fd, int type, HWND hwnd, void* context)
}
}
if (ok && msg_queue->maxfd < fd) {
msg_queue->maxfd = fd;
if (ok) {
if (msg_queue->maxfd < fd) {
msg_queue->maxfd = fd;
}
return TRUE;
}
}

View File

@@ -5,17 +5,14 @@ noinst_LTLIBRARIES = libmisc.la
EXTRA_DIST= misc.c systext.c rwops.c endianrw.c nposix.c clipboard.c \
math.c about.c error.c sockio.c rc4.c rc4.h \
makefile.ng makefile.msvc
LITE_SRCS=error.c sockio.c
makefile.ng makefile.msvc
ifdef MG_MINIMALGDI
libmisc_la_SOURCES = misc.c math.c rwops.c nposix.c
else
libmisc_la_SOURCES = misc.c systext.c rwops.c endianrw.c nposix.c clipboard.c \
math.c about.c license.c anon_file.c rbtree.c map.c \
$(LITE_SRCS)
error.c sockio.c
endif
SRC_FILES = $(libmisc_la_SOURCES)

View File

@@ -414,7 +414,7 @@ unsigned int __mg_os_get_random_seed (void)
unsigned int rt_tick_get(void);
return rt_tick_get();
#elif defined (__FREERTOS__)
return 0;
return 0; // just return zero for now.
#else
/*other os use time, for example: linux, OSE, etc.*/
return time (NULL);
@@ -452,9 +452,8 @@ void __mg_os_time_delay (int ms)
extern int rt_thread_mdelay(int ms);
rt_thread_mdelay(ms);
#elif defined (__FREERTOS__)
//#error "Please implement __mg_os_time_delay for your OS"
extern void vTaskDelay( int xTicksToDelay );
vTaskDelay(ms);
extern void vTaskDelay(int xTicksToDelay);
vTaskDelay(ms);
#else
#error "Please implement __mg_os_time_delay for your OS"
#endif

View File

@@ -742,6 +742,34 @@ void GUIAPI UpdateTopmostLayer (const RECT* dirty_rc)
SendMessage (HWND_DESKTOP, MSG_PAINT, 0, 0);
}
int GUIAPI ServerGetTopmostZNodeOfType (MG_Layer* layer, DWORD type, int* cli)
{
ZORDERINFO* zi;
int topmost;
if (layer == NULL)
layer = mgTopmostLayer;
else if (!__mg_is_valid_layer (layer))
return -1;
if (type < ZOF_TYPE_LAUNCHER || type > ZOF_TYPE_TOOLTIP)
return -1;
zi = (ZORDERINFO*)layer->zorder_info;
topmost = zi->first_in_levels [(ZOF_TYPE_TOOLTIP - type) >> 28];
if (topmost <= 0) {
return 0;
}
else if (cli) {
ZORDERNODE* nodes;
nodes = GET_ZORDERNODE(zi);
*cli = nodes [topmost].cli;
}
return topmost;
}
int GUIAPI ServerGetNextZNode (MG_Layer* layer, int idx_znode, int* cli)
{
ZORDERINFO* zi;

View File

@@ -403,8 +403,16 @@ BOOL server_IdleHandler4Server (PMSGQUEUE msg_queue, BOOL wait)
/* It is time to check event again. */
if (errno == EINTR) {
if (wait)
if (wait) {
ParseEvent (msg_queue, 0);
/* Since 5.0.3: Always check timers */
nevts += __mg_check_expired_timers (msg_queue,
SHAREDRES_TIMER_COUNTER - msg_queue->old_tick_count);
msg_queue->old_tick_count = SHAREDRES_TIMER_COUNTER;
return (nevts > 0);
}
return FALSE;
}
#ifdef _DEBUG

View File

@@ -617,42 +617,39 @@ int UnregisterResType(int type)
return RES_RET_OK;
}
#ifdef HAVE_ACCESS
static char* get_res_file(const char* res_name, char* filename)
{
int i;
if (res_name == NULL || filename == NULL)
return NULL;
//test it is a full path or not
for(i=0; res_name[i] && res_name[i] == '/'; i++);
if(i>0) //is full path
{
for (i = 0; res_name[i] && res_name[i] == '/'; i++);
if (i > 0) { // full path
#ifndef __NOUNIX__
struct stat buf;
if(stat(res_name, &buf) == 0
&& !S_ISDIR(buf.st_mode)
&& (buf.st_mode&S_IRUSR))
if(stat (res_name, &buf) == 0
&& !S_ISDIR(buf.st_mode)
&& (buf.st_mode&S_IRUSR))
#endif
{
return (char*)res_name;
}
}
for (i=0; res_paths[i]; i++) {
for (i = 0; res_paths[i]; i++) {
#ifndef __NOUNIX__
struct stat buf;
sprintf(filename,"%s/%s", res_paths[i], res_name);
if(stat(filename, &buf) == 0 && !S_ISDIR(buf.st_mode) && (buf.st_mode&S_IRUSR))
sprintf (filename,"%s/%s", res_paths[i], res_name);
if (stat (filename, &buf) == 0 &&
!S_ISDIR (buf.st_mode) && (buf.st_mode & S_IRUSR))
#else
sprintf(filename,"%s/%s", res_paths[i], res_name);
#ifndef __VXWORKS__
#ifdef __FREERTOS__
if (access(filename, 04) != -1)
#else
//in vxworks, don't support _access method.
if (_access(filename, 04) != -1)
#endif
#endif
sprintf (filename,"%s/%s", res_paths[i], res_name);
if (access (filename, 04) != -1)
#endif
{
return filename;
@@ -662,6 +659,15 @@ static char* get_res_file(const char* res_name, char* filename)
return NULL;
}
#else
static char* get_res_file(const char* res_name, char* filename)
{
return NULL;
}
#endif /* !HAVE_ACCESS */
static void* get_res_data (RES_ENTRY *entry, RES_TYPE_OPS *ops, DWORD usr_param)
{
if (entry == NULL && ops == NULL)