mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-26 20:45:36 +08:00
Compare commits
16
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
57bdcd4754 | ||
|
|
b95538a415 | ||
|
|
fa7c84b2b5 | ||
|
|
bc77048488 | ||
|
|
2f21b22a49 | ||
|
|
ec91986854 | ||
|
|
e7b03037be | ||
|
|
9ff822c7fd | ||
|
|
239924c63e | ||
|
|
2f85645e9d | ||
|
|
9a6b208a85 | ||
|
|
28e49dd768 | ||
|
|
d5200eec58 | ||
|
|
d35bde9a4c | ||
|
|
daab1ae19b | ||
|
|
0581365fcd |
@@ -24,3 +24,7 @@ Makefile.in
|
|||||||
/*config.h.in
|
/*config.h.in
|
||||||
/*config.h.in~
|
/*config.h.in~
|
||||||
|
|
||||||
|
/src/font/utils/emoji/
|
||||||
|
/src/font/utils/ucd/
|
||||||
|
/src/sysres/font_list
|
||||||
|
/src/sysres/license/dat_files/
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
MAJOR_VERSION = 3
|
MAJOR_VERSION = 4
|
||||||
MINOR_VERSION = 0
|
MINOR_VERSION = 0
|
||||||
MICRO_VERSION = 13
|
MICRO_VERSION = 4
|
||||||
EXTRAVERSION =
|
EXTRAVERSION =
|
||||||
|
|
||||||
MINIGUI_RELEASE=$(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)$(EXTRAVERSION)
|
MINIGUI_RELEASE=$(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)$(EXTRAVERSION)
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@ SUBDIRS = src 3rd-party include rtos etc m4 cmake build
|
|||||||
|
|
||||||
EXTRA_DIST = minigui.pc.in \
|
EXTRA_DIST = minigui.pc.in \
|
||||||
GNUmakefile makefile.ng makefile.msvc rules.make \
|
GNUmakefile makefile.ng makefile.msvc rules.make \
|
||||||
Version INSTALL LICENSE \
|
INSTALL LICENSE \
|
||||||
README.md RELEASE-NOTES.md \
|
Version.md README.md RELEASE-NOTES.md \
|
||||||
LICENSE-POLICY-en.md LICENSE-POLICY-zh.md
|
LICENSE-POLICY-en.md LICENSE-POLICY-zh.md
|
||||||
|
|
||||||
# The directory where the include files will be installed
|
# The directory where the include files will be installed
|
||||||
|
|||||||
@@ -147,11 +147,11 @@ and MiniGUI components, please fetch one of the following repositories
|
|||||||
from GitHub and follow the instructions to build the samples and
|
from GitHub and follow the instructions to build the samples and
|
||||||
the demonstration programs:
|
the demonstration programs:
|
||||||
|
|
||||||
https://github.com/VincentWei/build-minigui-4.0
|
<https://github.com/VincentWei/build-minigui-4.0>
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
https://github.com/VincentWei/build-minigui-3.2
|
<https://github.com/VincentWei/build-minigui-3.2>
|
||||||
|
|
||||||
|
|
||||||
### Unit Tests
|
### Unit Tests
|
||||||
@@ -159,7 +159,7 @@ https://github.com/VincentWei/build-minigui-3.2
|
|||||||
Since MiniGUI 4.0.0, we organize the unit test code of MiniGUI APIs in the
|
Since MiniGUI 4.0.0, we organize the unit test code of MiniGUI APIs in the
|
||||||
following repository:
|
following repository:
|
||||||
|
|
||||||
https://github.com/VincentWei/mg-tests
|
<https://github.com/VincentWei/mg-tests>
|
||||||
|
|
||||||
If you are interested in hacking the MiniGUI code, please visit this repository.
|
If you are interested in hacking the MiniGUI code, please visit this repository.
|
||||||
|
|
||||||
|
|||||||
+24
-1
@@ -1,5 +1,28 @@
|
|||||||
# Release Notes
|
# Release Notes
|
||||||
|
|
||||||
|
## Version 4.0.5
|
||||||
|
|
||||||
|
The MiniGUI development team announces the availability of MiniGUI 4.0.5.
|
||||||
|
We strongly recommend that you use this version for any new MiniGUI
|
||||||
|
apps, especially if the new features of MiniGUI 4.0 are must for your
|
||||||
|
new apps.
|
||||||
|
|
||||||
|
Please report any bugs and incompatibilities in
|
||||||
|
|
||||||
|
<https://github.com/VincentWei/minigui>
|
||||||
|
|
||||||
|
### What's new in this version
|
||||||
|
|
||||||
|
In this version, we mainly fixed some bugs found.
|
||||||
|
|
||||||
|
* BUGFIXING:
|
||||||
|
- Always initialize BITMAP fields with explicit assignments.
|
||||||
|
This bug makes the cursor messy.
|
||||||
|
- Fix some conditional compilation of mg-tests.
|
||||||
|
* ENHANCEMENTS:
|
||||||
|
- The server of MiniGUI-Processes now can delete global System V IPC
|
||||||
|
objects left by a previous failed run.
|
||||||
|
|
||||||
## Version 4.0.4
|
## Version 4.0.4
|
||||||
|
|
||||||
The MiniGUI development team announces the availability of MiniGUI 4.0.4.
|
The MiniGUI development team announces the availability of MiniGUI 4.0.4.
|
||||||
@@ -13,7 +36,7 @@ Please report any bugs and incompatibilities in
|
|||||||
|
|
||||||
### What's new in this version
|
### What's new in this version
|
||||||
|
|
||||||
In this version, we mainly enhance the DRM engine of MiniGUI in order
|
In this version, we mainly enhanced the DRM engine of MiniGUI in order
|
||||||
to integrate MiniGUI with Mesa and Cairo, for example, to implement EGL
|
to integrate MiniGUI with Mesa and Cairo, for example, to implement EGL
|
||||||
for MiniGUI platform.
|
for MiniGUI platform.
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
Version 4.0.4 (2019/12/24)
|
Version 4.0.5 (2020/01/10)
|
||||||
|
|
||||||
This release needs the following packages:
|
This release needs the following packages:
|
||||||
|
|
||||||
- The resource package: `minigui-res-4.0.0.tar.gz`
|
- The resource package: `minigui-res-4.0.0.tar.gz`
|
||||||
- The sample package: `mg-samples-4.0.1.tar.gz`
|
- The sample package: `mg-samples-4.0.1.tar.gz`
|
||||||
- The test package: `mg-test-4.0.4.tar.gz`
|
- The test cases package: `mg-tests-4.0.4.tar.gz`
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
AC_PREREQ(2.60)
|
AC_PREREQ(2.60)
|
||||||
AC_INIT(libminigui, 4.0.4)
|
AC_INIT(libminigui, 4.0.5)
|
||||||
AC_CONFIG_SRCDIR(src/main/main.c)
|
AC_CONFIG_SRCDIR(src/main/main.c)
|
||||||
|
|
||||||
dnl Set various version strings - taken gratefully from the SDL sources
|
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=4
|
MINIGUI_MAJOR_VERSION=4
|
||||||
MINIGUI_MINOR_VERSION=0
|
MINIGUI_MINOR_VERSION=0
|
||||||
MINIGUI_MICRO_VERSION=4
|
MINIGUI_MICRO_VERSION=5
|
||||||
MINIGUI_INTERFACE_AGE=0
|
MINIGUI_INTERFACE_AGE=1
|
||||||
MINIGUI_BINARY_AGE=0
|
MINIGUI_BINARY_AGE=1
|
||||||
MINIGUI_VERSION=$MINIGUI_MAJOR_VERSION.$MINIGUI_MINOR_VERSION.$MINIGUI_MICRO_VERSION
|
MINIGUI_VERSION=$MINIGUI_MAJOR_VERSION.$MINIGUI_MINOR_VERSION.$MINIGUI_MICRO_VERSION
|
||||||
|
|
||||||
AC_SUBST(MINIGUI_MAJOR_VERSION)
|
AC_SUBST(MINIGUI_MAJOR_VERSION)
|
||||||
|
|||||||
+3
-2
@@ -13755,9 +13755,10 @@ typedef struct _DrmSurfaceInfo {
|
|||||||
} DrmSurfaceInfo;
|
} DrmSurfaceInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function gets the DRM surface information from the handle of the surface.
|
* This function gets the DRM surface information from specified device context.
|
||||||
*
|
*
|
||||||
* \param surface The handle to the surface.
|
* \param video The handle to the video.
|
||||||
|
* \param hdc The handle to the device context.
|
||||||
* \param info The pointer to a DrmSurfaceInfo structure to hold
|
* \param info The pointer to a DrmSurfaceInfo structure to hold
|
||||||
* the surface information.
|
* the surface information.
|
||||||
*
|
*
|
||||||
|
|||||||
+28
-10
@@ -11,35 +11,35 @@
|
|||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
/*
|
/*
|
||||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||||
* and Graphics User Interface (GUI) support system for embedded systems
|
* and Graphics User Interface (GUI) support system for embedded systems
|
||||||
* and smart IoT devices.
|
* and smart IoT devices.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||||
* Copyright (C) 1998~2002, WEI Yongming
|
* Copyright (C) 1998~2002, WEI Yongming
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* Or,
|
* Or,
|
||||||
*
|
*
|
||||||
* As this program is a library, any link to this program must follow
|
* As this program is a library, any link to this program must follow
|
||||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||||
* GPLv3, you need to be licensed from FMSoft.
|
* GPLv3, you need to be licensed from FMSoft.
|
||||||
*
|
*
|
||||||
* If you have got a commercial license of this program, please use it
|
* If you have got a commercial license of this program, please use it
|
||||||
* under the terms and conditions of the commercial license.
|
* under the terms and conditions of the commercial license.
|
||||||
*
|
*
|
||||||
* For more information about the commercial license, please refer to
|
* For more information about the commercial license, please refer to
|
||||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||||
*/
|
*/
|
||||||
@@ -70,6 +70,24 @@ enum {
|
|||||||
_NR_SEM
|
_NR_SEM
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// key base for System V IPC
|
||||||
|
#define IPC_KEY_BASE 0x464D4700
|
||||||
|
|
||||||
|
inline static key_t get_shm_key_for_system (void)
|
||||||
|
{
|
||||||
|
return (key_t)(IPC_KEY_BASE + 0x01);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline static key_t get_sem_key_for_system (void)
|
||||||
|
{
|
||||||
|
return (key_t)(IPC_KEY_BASE + 0x02);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline static key_t get_sem_key_for_layers (void)
|
||||||
|
{
|
||||||
|
return (key_t)(IPC_KEY_BASE + 0x03);
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct tagG_RES {
|
typedef struct tagG_RES {
|
||||||
int semid;
|
int semid;
|
||||||
int shmid;
|
int shmid;
|
||||||
@@ -95,7 +113,7 @@ typedef struct tagG_RES {
|
|||||||
int mousebutton;
|
int mousebutton;
|
||||||
int shiftstatus;
|
int shiftstatus;
|
||||||
Uint8 kbd_state [MGUI_NR_KEYS + 1];
|
Uint8 kbd_state [MGUI_NR_KEYS + 1];
|
||||||
|
|
||||||
#ifdef _MGHAVE_CURSOR
|
#ifdef _MGHAVE_CURSOR
|
||||||
int cursorx, cursory;
|
int cursorx, cursory;
|
||||||
int oldboxleft, oldboxtop;
|
int oldboxleft, oldboxtop;
|
||||||
|
|||||||
@@ -370,9 +370,7 @@ HCURSOR GUIAPI GetDefaultCursor (void)
|
|||||||
return def_cursor;
|
return def_cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BITMAP csr_bmp = {
|
static BITMAP csr_bmp;
|
||||||
BMP_TYPE_NORMAL, 0, 0, 0, 0, CURSORWIDTH, CURSORHEIGHT
|
|
||||||
};
|
|
||||||
|
|
||||||
BOOL mg_InitCursor (void)
|
BOOL mg_InitCursor (void)
|
||||||
{
|
{
|
||||||
@@ -392,10 +390,14 @@ BOOL mg_InitCursor (void)
|
|||||||
CSR_OLDBOXTOP = -100;
|
CSR_OLDBOXTOP = -100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* always initialize fields by explicitly assignments */
|
||||||
|
csr_bmp.bmType = BMP_TYPE_NORMAL;
|
||||||
csr_bmp.bmBitsPerPixel = __gal_screen->format->BitsPerPixel;
|
csr_bmp.bmBitsPerPixel = __gal_screen->format->BitsPerPixel;
|
||||||
csr_bmp.bmBytesPerPixel = __gal_screen->format->BytesPerPixel;
|
csr_bmp.bmBytesPerPixel = __gal_screen->format->BytesPerPixel;
|
||||||
|
csr_bmp.bmWidth = CURSORWIDTH;
|
||||||
|
csr_bmp.bmHeight = CURSORHEIGHT;
|
||||||
csr_bmp.bmPitch = __gal_screen->format->BytesPerPixel * CURSORWIDTH;
|
csr_bmp.bmPitch = __gal_screen->format->BytesPerPixel * CURSORWIDTH;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,9 +108,7 @@ HCURSOR GUIAPI LoadCursorFromMem (const void* area)
|
|||||||
return load_cursor_from_mem (area);
|
return load_cursor_from_mem (area);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BITMAP csr_bmp = {
|
static BITMAP csr_bmp;
|
||||||
BMP_TYPE_NORMAL, 0, 0, 0, 0, CURSORWIDTH, CURSORHEIGHT
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Only called from InitCursor and client code. */
|
/* Only called from InitCursor and client code. */
|
||||||
HCURSOR GUIAPI CreateCursor(int xhotspot, int yhotspot, int w, int h,
|
HCURSOR GUIAPI CreateCursor(int xhotspot, int yhotspot, int w, int h,
|
||||||
@@ -242,6 +240,10 @@ BOOL mg_InitCursor(void)
|
|||||||
|
|
||||||
csrimgsize = GAL_GetBoxSize (__gal_screen, CURSORWIDTH, CURSORHEIGHT, &csrimgpitch);
|
csrimgsize = GAL_GetBoxSize (__gal_screen, CURSORWIDTH, CURSORHEIGHT, &csrimgpitch);
|
||||||
|
|
||||||
|
/* always initialize fields by explicitly assignments */
|
||||||
|
csr_bmp.bmType = BMP_TYPE_NORMAL;
|
||||||
|
csr_bmp.bmWidth = CURSORWIDTH;
|
||||||
|
csr_bmp.bmHeight = CURSORHEIGHT;
|
||||||
csr_bmp.bmBitsPerPixel = __gal_screen->format->BitsPerPixel;
|
csr_bmp.bmBitsPerPixel = __gal_screen->format->BitsPerPixel;
|
||||||
csr_bmp.bmBytesPerPixel = __gal_screen->format->BytesPerPixel;
|
csr_bmp.bmBytesPerPixel = __gal_screen->format->BytesPerPixel;
|
||||||
csr_bmp.bmPitch = csrimgpitch;
|
csr_bmp.bmPitch = csrimgpitch;
|
||||||
|
|||||||
+3
-6
@@ -139,9 +139,7 @@ HCURSOR GUIAPI LoadCursorFromMem (const void* area)
|
|||||||
return load_cursor_from_mem (area);
|
return load_cursor_from_mem (area);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BITMAP csr_bmp = {
|
static BITMAP csr_bmp;
|
||||||
BMP_TYPE_NORMAL, 0, 0, 0, 0, CURSORWIDTH, CURSORHEIGHT
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Only called from InitCursor and client code. */
|
/* Only called from InitCursor and client code. */
|
||||||
HCURSOR GUIAPI CreateCursor(int xhotspot, int yhotspot, int w, int h,
|
HCURSOR GUIAPI CreateCursor(int xhotspot, int yhotspot, int w, int h,
|
||||||
@@ -279,11 +277,10 @@ BOOL realInitCursor(void)
|
|||||||
&csrimgpitch);
|
&csrimgpitch);
|
||||||
|
|
||||||
csr_bmp.bmType = BMP_TYPE_NORMAL;
|
csr_bmp.bmType = BMP_TYPE_NORMAL;
|
||||||
csr_bmp.bmWidth = CURSORWIDTH;
|
|
||||||
csr_bmp.bmHeight = CURSORHEIGHT;
|
|
||||||
|
|
||||||
csr_bmp.bmBitsPerPixel = __gal_screen->format->BitsPerPixel;
|
csr_bmp.bmBitsPerPixel = __gal_screen->format->BitsPerPixel;
|
||||||
csr_bmp.bmBytesPerPixel = __gal_screen->format->BytesPerPixel;
|
csr_bmp.bmBytesPerPixel = __gal_screen->format->BytesPerPixel;
|
||||||
|
csr_bmp.bmWidth = CURSORWIDTH;
|
||||||
|
csr_bmp.bmHeight = CURSORHEIGHT;
|
||||||
csr_bmp.bmPitch = csrimgpitch;
|
csr_bmp.bmPitch = csrimgpitch;
|
||||||
|
|
||||||
if( !(savedbits = malloc(csrimgsize)) )
|
if( !(savedbits = malloc(csrimgsize)) )
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ GHANDLE __mg_layer;
|
|||||||
/* always be zero for clients. */
|
/* always be zero for clients. */
|
||||||
BOOL __mg_switch_away;
|
BOOL __mg_switch_away;
|
||||||
|
|
||||||
void lock_zi_for_read (const ZORDERINFO* zi)
|
static void lock_zi_for_read (const ZORDERINFO* zi)
|
||||||
{
|
{
|
||||||
struct sembuf sb;
|
struct sembuf sb;
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ again:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void unlock_zi_for_read (const ZORDERINFO* zi)
|
static void unlock_zi_for_read (const ZORDERINFO* zi)
|
||||||
{
|
{
|
||||||
struct sembuf sb;
|
struct sembuf sb;
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ again:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lock_zi_for_change (const ZORDERINFO* zi)
|
static void lock_zi_for_change (const ZORDERINFO* zi)
|
||||||
{
|
{
|
||||||
int clients = 0;
|
int clients = 0;
|
||||||
struct sembuf sb;
|
struct sembuf sb;
|
||||||
@@ -157,7 +157,7 @@ again:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void unlock_zi_for_change (const ZORDERINFO* zi)
|
static void unlock_zi_for_change (const ZORDERINFO* zi)
|
||||||
{
|
{
|
||||||
int clients = 0;
|
int clients = 0;
|
||||||
struct sembuf sb;
|
struct sembuf sb;
|
||||||
@@ -176,7 +176,7 @@ again:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void* get_zi_from_client(int cli)
|
static inline void* get_zi_from_client(int cli)
|
||||||
{
|
{
|
||||||
return (((cli>0)?mgClients[cli].layer:mgTopmostLayer)->zorder_info);
|
return (((cli>0)?mgClients[cli].layer:mgTopmostLayer)->zorder_info);
|
||||||
}
|
}
|
||||||
|
|||||||
+236
-236
File diff suppressed because it is too large
Load Diff
+16
-6
@@ -55,6 +55,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#define _DEBUG
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#ifndef __NOUNIX__
|
#ifndef __NOUNIX__
|
||||||
@@ -252,7 +254,7 @@ static void treat_longpress (PKEYEVENT ke, DWORD interval)
|
|||||||
ke->event = KE_KEYLONGPRESS;
|
ke->event = KE_KEYLONGPRESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ke->event = 0;
|
ke->event = KE_KEYDOWN;
|
||||||
}
|
}
|
||||||
else if (interval >= __mg_key_alwayspress_time) {
|
else if (interval >= __mg_key_alwayspress_time) {
|
||||||
if (flag2) {
|
if (flag2) {
|
||||||
@@ -261,7 +263,7 @@ static void treat_longpress (PKEYEVENT ke, DWORD interval)
|
|||||||
ke->event = KE_KEYALWAYSPRESS;
|
ke->event = KE_KEYALWAYSPRESS;
|
||||||
}
|
}
|
||||||
else if (__mg_timer_counter - starttime < __mg_interval_time) {
|
else if (__mg_timer_counter - starttime < __mg_interval_time) {
|
||||||
ke->event = 0;
|
ke->event = KE_KEYDOWN;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
starttime = __mg_timer_counter;
|
starttime = __mg_timer_counter;
|
||||||
@@ -278,7 +280,7 @@ static void treat_longpress (PKEYEVENT ke, DWORD interval)
|
|||||||
ke->event = KE_KEYALWAYSPRESS;
|
ke->event = KE_KEYALWAYSPRESS;
|
||||||
}
|
}
|
||||||
else if (__mg_timer_counter - starttime < __mg_interval_time) {
|
else if (__mg_timer_counter - starttime < __mg_interval_time) {
|
||||||
ke->event = 0;
|
ke->event = KE_KEYDOWN;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
starttime = __mg_timer_counter;
|
starttime = __mg_timer_counter;
|
||||||
@@ -291,7 +293,7 @@ static void treat_longpress (PKEYEVENT ke, DWORD interval)
|
|||||||
ke->event = KE_KEYLONGPRESS;
|
ke->event = KE_KEYLONGPRESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ke->event = 0;
|
ke->event = KE_KEYDOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -465,8 +467,12 @@ BOOL kernel_GetLWEvent (int event, PLWEVENT lwe)
|
|||||||
ke->scancode = olddownkey;
|
ke->scancode = olddownkey;
|
||||||
interval = __mg_timer_counter - ke_time;
|
interval = __mg_timer_counter - ke_time;
|
||||||
treat_longpress (ke, interval);
|
treat_longpress (ke, interval);
|
||||||
if (ke->event == 0)
|
if (ke->event == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
else if (ke->event == KE_KEYDOWN) {
|
||||||
|
status |= KS_REPEATED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
make = (ke->event == KE_KEYDOWN)?1:0;
|
make = (ke->event == KE_KEYDOWN)?1:0;
|
||||||
@@ -765,8 +771,12 @@ BOOL kernel_GetLWEvent (int event, PLWEVENT lwe)
|
|||||||
ke->scancode = olddownkey;
|
ke->scancode = olddownkey;
|
||||||
interval = __mg_timer_counter - ke_time;
|
interval = __mg_timer_counter - ke_time;
|
||||||
treat_longpress (ke, interval);
|
treat_longpress (ke, interval);
|
||||||
if (ke->event == 0)
|
if (ke->event == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
else if (ke->event == KE_KEYDOWN) {
|
||||||
|
status |= KS_REPEATED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
make = (ke->event == KE_KEYDOWN) ? 1 : 0;
|
make = (ke->event == KE_KEYDOWN) ? 1 : 0;
|
||||||
|
|||||||
+76
-50
@@ -11,41 +11,41 @@
|
|||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
/*
|
/*
|
||||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||||
* and Graphics User Interface (GUI) support system for embedded systems
|
* and Graphics User Interface (GUI) support system for embedded systems
|
||||||
* and smart IoT devices.
|
* and smart IoT devices.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||||
* Copyright (C) 1998~2002, WEI Yongming
|
* Copyright (C) 1998~2002, WEI Yongming
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* Or,
|
* Or,
|
||||||
*
|
*
|
||||||
* As this program is a library, any link to this program must follow
|
* As this program is a library, any link to this program must follow
|
||||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||||
* GPLv3, you need to be licensed from FMSoft.
|
* GPLv3, you need to be licensed from FMSoft.
|
||||||
*
|
*
|
||||||
* If you have got a commercial license of this program, please use it
|
* If you have got a commercial license of this program, please use it
|
||||||
* under the terms and conditions of the commercial license.
|
* under the terms and conditions of the commercial license.
|
||||||
*
|
*
|
||||||
* For more information about the commercial license, please refer to
|
* For more information about the commercial license, please refer to
|
||||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
** sharedres.c: Load and init shared resource.
|
** sharedres.c: Load and init shared resource.
|
||||||
**
|
**
|
||||||
** Create date: 2000/12/22
|
** Create date: 2000/12/22
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@
|
|||||||
#define SEM_PARAM 0666
|
#define SEM_PARAM 0666
|
||||||
|
|
||||||
// define to use mmap instead of shared memory.
|
// define to use mmap instead of shared memory.
|
||||||
#undef _USE_MMAP
|
#undef _USE_MMAP
|
||||||
// #define _USE_MMAP 1
|
// #define _USE_MMAP 1
|
||||||
|
|
||||||
#ifdef _MGHAVE_CURSOR
|
#ifdef _MGHAVE_CURSOR
|
||||||
@@ -125,7 +125,7 @@ static BOOL LoadCursorRes (void)
|
|||||||
mgSizeRes += __mg_csrimgsize;
|
mgSizeRes += __mg_csrimgsize;
|
||||||
((PG_RES)mgSharedRes)->csroffset = mgSizeRes;
|
((PG_RES)mgSharedRes)->csroffset = mgSizeRes;
|
||||||
|
|
||||||
// pointer to begin of cursor struct,
|
// pointer to begin of cursor struct,
|
||||||
// and reserve a space for handles for system cursors.
|
// and reserve a space for handles for system cursors.
|
||||||
temp = (char*)mgSharedRes + mgSizeRes + sizeof (PCURSOR) * number;
|
temp = (char*)mgSharedRes + mgSizeRes + sizeof (PCURSOR) * number;
|
||||||
|
|
||||||
@@ -133,12 +133,12 @@ static BOOL LoadCursorRes (void)
|
|||||||
if ( !(tempcsr = sysres_load_system_cursor (i)) )
|
if ( !(tempcsr = sysres_load_system_cursor (i)) )
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
memcpy (temp, tempcsr, sizeof(CURSOR));
|
memcpy (temp, tempcsr, sizeof(CURSOR));
|
||||||
temp += sizeof(CURSOR);
|
temp += sizeof(CURSOR);
|
||||||
memcpy (temp, tempcsr->AndBits, __mg_csrimgsize);
|
memcpy (temp, tempcsr->AndBits, __mg_csrimgsize);
|
||||||
temp += __mg_csrimgsize;
|
temp += __mg_csrimgsize;
|
||||||
memcpy (temp, tempcsr->XorBits, __mg_csrimgsize);
|
memcpy (temp, tempcsr->XorBits, __mg_csrimgsize);
|
||||||
temp += __mg_csrimgsize;
|
temp += __mg_csrimgsize;
|
||||||
free (tempcsr->AndBits);
|
free (tempcsr->AndBits);
|
||||||
free (tempcsr->XorBits);
|
free (tempcsr->XorBits);
|
||||||
free (tempcsr);
|
free (tempcsr);
|
||||||
@@ -153,23 +153,46 @@ error:
|
|||||||
|
|
||||||
#endif /* _MGHAVE_CURSOR */
|
#endif /* _MGHAVE_CURSOR */
|
||||||
|
|
||||||
inline static key_t get_shm_key (void)
|
|
||||||
{
|
|
||||||
return (key_t)(IPC_KEY_BASE + 0x01);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline static key_t get_sem_key (void)
|
|
||||||
{
|
|
||||||
return (key_t)(IPC_KEY_BASE + 0x02);
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL kernel_IsOnlyMe (void)
|
BOOL kernel_IsOnlyMe (void)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
if ((fd = open (LOCKFILE, O_RDONLY)) == -1)
|
if ((fd = open (LOCKFILE, O_RDONLY)) == -1) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flock (fd, LOCK_EX | LOCK_NB) == 0) {
|
||||||
|
// It is time to remove the old SysV IPC objects.
|
||||||
|
key_t sem_key = get_sem_key_for_system ();
|
||||||
|
|
||||||
|
// remove system semaphore set.
|
||||||
|
int semid = semget (sem_key, 0, SEM_PARAM);
|
||||||
|
if (semid >= 0) {
|
||||||
|
union semun ignored;
|
||||||
|
if (semctl (semid, 0, IPC_RMID, ignored) < 0) {
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
_WRN_PRINTF("The old semaphore set for system (0x%06x) dicarded\n",
|
||||||
|
semid);
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove system semaphore set.
|
||||||
|
sem_key = get_sem_key_for_layers ();
|
||||||
|
semid = semget (sem_key, 0, SEM_PARAM);
|
||||||
|
if (semid >= 0) {
|
||||||
|
union semun ignored;
|
||||||
|
if (semctl (semid, 0, IPC_RMID, ignored) < 0) {
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
_WRN_PRINTF("The old semaphore set for layers (0x%06x) dicarded\n",
|
||||||
|
semid);
|
||||||
|
}
|
||||||
|
|
||||||
|
close (fd);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
failed:
|
||||||
close (fd);
|
close (fd);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -186,6 +209,8 @@ error:
|
|||||||
perror("remove semaphore");
|
perror("remove semaphore");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lockfd;
|
||||||
|
|
||||||
void *kernel_LoadSharedResource (void)
|
void *kernel_LoadSharedResource (void)
|
||||||
{
|
{
|
||||||
key_t sem_key;
|
key_t sem_key;
|
||||||
@@ -193,7 +218,7 @@ void *kernel_LoadSharedResource (void)
|
|||||||
key_t shm_key;
|
key_t shm_key;
|
||||||
void *memptr;
|
void *memptr;
|
||||||
#endif
|
#endif
|
||||||
int lockfd, semid;
|
int semid;
|
||||||
#ifndef _USE_MMAP
|
#ifndef _USE_MMAP
|
||||||
int shmid;
|
int shmid;
|
||||||
#endif
|
#endif
|
||||||
@@ -205,30 +230,30 @@ void *kernel_LoadSharedResource (void)
|
|||||||
|
|
||||||
#ifdef _MGHAVE_CURSOR
|
#ifdef _MGHAVE_CURSOR
|
||||||
if (!LoadCursorRes()) {
|
if (!LoadCursorRes()) {
|
||||||
perror ("InitCursor");
|
perror ("InitCursor");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _USE_MMAP
|
#ifndef _USE_MMAP
|
||||||
if ((shm_key = get_shm_key ()) == -1) {
|
if ((shm_key = get_shm_key_for_system ()) == -1) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
shmid = shmget (shm_key, mgSizeRes, SHM_PARAM | IPC_CREAT | IPC_EXCL);
|
shmid = shmget (shm_key, mgSizeRes, SHM_PARAM | IPC_CREAT | IPC_EXCL);
|
||||||
if (shmid == -1) {
|
if (shmid == -1) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attach to the share memory.
|
// Attach to the share memory.
|
||||||
memptr = shmat (shmid, 0, 0);
|
memptr = shmat (shmid, 0, 0);
|
||||||
if (memptr == (char*)-1)
|
if (memptr == (char*)-1)
|
||||||
goto error;
|
goto error;
|
||||||
else {
|
else {
|
||||||
memcpy (memptr, mgSharedRes, mgSizeRes);
|
memcpy (memptr, mgSharedRes, mgSizeRes);
|
||||||
free (mgSharedRes);
|
free (mgSharedRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shmctl (shmid, IPC_RMID, NULL) < 0)
|
if (shmctl (shmid, IPC_RMID, NULL) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -252,19 +277,19 @@ void *kernel_LoadSharedResource (void)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if 0
|
|
||||||
if (flock (lockfd, LOCK_EX | LOCK_NB) == -1)
|
|
||||||
goto error;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
close (lockfd);
|
if (flock (lockfd, LOCK_EX) == -1)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
// close lockfd will release the exclusive lock
|
||||||
|
// close (lockfd);
|
||||||
|
|
||||||
// Obtain the semophore syncing drawing.
|
// Obtain the semophore syncing drawing.
|
||||||
if ((sem_key = get_sem_key ()) == -1) {
|
if ((sem_key = get_sem_key_for_system ()) == -1) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
semid = semget (sem_key, _NR_SEM, SEM_PARAM | IPC_CREAT | IPC_EXCL);
|
semid = semget (sem_key, _NR_SEM, SEM_PARAM | IPC_CREAT | IPC_EXCL);
|
||||||
if (semid == -1) {
|
if (semid == -1) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
atexit (__mg_delete_sharedres_sem);
|
atexit (__mg_delete_sharedres_sem);
|
||||||
@@ -291,15 +316,16 @@ void *kernel_LoadSharedResource (void)
|
|||||||
#endif
|
#endif
|
||||||
SHAREDRES_SEMID = semid;
|
SHAREDRES_SEMID = semid;
|
||||||
|
|
||||||
return mgSharedRes;
|
return mgSharedRes;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
perror ("KERNEL>LoadSharedResource");
|
perror ("KERNEL>LoadSharedResource");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void kernel_UnloadSharedResource (void)
|
void kernel_UnloadSharedResource (void)
|
||||||
{
|
{
|
||||||
|
close (lockfd);
|
||||||
unlink (LOCKFILE);
|
unlink (LOCKFILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,12 +350,12 @@ void* kernel_AttachSharedResource (void)
|
|||||||
|
|
||||||
memptr = shmat (shmid, 0, SHM_RDONLY);
|
memptr = shmat (shmid, 0, SHM_RDONLY);
|
||||||
#endif
|
#endif
|
||||||
if (memptr == (char*)-1)
|
if (memptr == (char*)-1)
|
||||||
goto error;
|
goto error;
|
||||||
return memptr;
|
return memptr;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
perror ("AttachSharedResource");
|
perror ("AttachSharedResource");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,10 +363,10 @@ void kernel_UnattachSharedResource (void)
|
|||||||
{
|
{
|
||||||
#ifdef _USE_MMAP
|
#ifdef _USE_MMAP
|
||||||
if (munmap(mgSharedRes, mgSizeRes))
|
if (munmap(mgSharedRes, mgSizeRes))
|
||||||
perror("detaches shared resource");
|
perror("detaches shared resource");
|
||||||
#else
|
#else
|
||||||
if (shmdt (mgSharedRes) < 0)
|
if (shmdt (mgSharedRes) < 0)
|
||||||
perror("detaches shared resource");
|
perror("detaches shared resource");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -160,6 +160,12 @@ GAL_Surface * GAL_CreateRGBSurface (Uint32 flags,
|
|||||||
surface->flags &= ~GAL_HWSURFACE;
|
surface->flags &= ~GAL_HWSURFACE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
/* set a static buff to pixels for empty surface */
|
||||||
|
static char buff[8];
|
||||||
|
surface->flags |= GAL_PREALLOC;
|
||||||
|
surface->pixels = buff;
|
||||||
|
}
|
||||||
|
|
||||||
/* Allocate an empty mapping */
|
/* Allocate an empty mapping */
|
||||||
surface->map = GAL_AllocBlitMap();
|
surface->map = GAL_AllocBlitMap();
|
||||||
|
|||||||
+29
-34
@@ -11,41 +11,41 @@
|
|||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
/*
|
/*
|
||||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||||
* and Graphics User Interface (GUI) support system for embedded systems
|
* and Graphics User Interface (GUI) support system for embedded systems
|
||||||
* and smart IoT devices.
|
* and smart IoT devices.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||||
* Copyright (C) 1998~2002, WEI Yongming
|
* Copyright (C) 1998~2002, WEI Yongming
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* Or,
|
* Or,
|
||||||
*
|
*
|
||||||
* As this program is a library, any link to this program must follow
|
* As this program is a library, any link to this program must follow
|
||||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||||
* GPLv3, you need to be licensed from FMSoft.
|
* GPLv3, you need to be licensed from FMSoft.
|
||||||
*
|
*
|
||||||
* If you have got a commercial license of this program, please use it
|
* If you have got a commercial license of this program, please use it
|
||||||
* under the terms and conditions of the commercial license.
|
* under the terms and conditions of the commercial license.
|
||||||
*
|
*
|
||||||
* For more information about the commercial license, please refer to
|
* For more information about the commercial license, please refer to
|
||||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
** layer.c: maintain the layers in server.
|
** layer.c: maintain the layers in server.
|
||||||
**
|
**
|
||||||
** Current maintainer: Wei Yongming.
|
** Current maintainer: Wei Yongming.
|
||||||
**
|
**
|
||||||
** Create date: 2005/08/14
|
** Create date: 2005/08/14
|
||||||
@@ -83,7 +83,7 @@ ON_CHANGE_LAYER OnChangeLayer = NULL;
|
|||||||
static int sg_nr_layers = 0;
|
static int sg_nr_layers = 0;
|
||||||
static unsigned char sem_usage [(MAX_NR_LAYERS + 7)/8];
|
static unsigned char sem_usage [(MAX_NR_LAYERS + 7)/8];
|
||||||
|
|
||||||
static BOOL do_alloc_layer (MG_Layer* layer, const char* name,
|
static BOOL do_alloc_layer (MG_Layer* layer, const char* name,
|
||||||
int nr_topmosts, int nr_normals)
|
int nr_topmosts, int nr_normals)
|
||||||
{
|
{
|
||||||
ZORDERINFO* zi;
|
ZORDERINFO* zi;
|
||||||
@@ -97,10 +97,10 @@ static BOOL do_alloc_layer (MG_Layer* layer, const char* name,
|
|||||||
|
|
||||||
/* Attach to the share memory. */
|
/* Attach to the share memory. */
|
||||||
zi = shmat (layer->zorder_shmid, 0, 0);
|
zi = shmat (layer->zorder_shmid, 0, 0);
|
||||||
if (zi == (void*)-1)
|
if (zi == (void*)-1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (shmctl (layer->zorder_shmid, IPC_RMID, NULL) < 0)
|
if (shmctl (layer->zorder_shmid, IPC_RMID, NULL) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
strcpy (layer->name, name);
|
strcpy (layer->name, name);
|
||||||
@@ -148,7 +148,7 @@ static BOOL do_alloc_layer (MG_Layer* layer, const char* name,
|
|||||||
memset (maskrect_usage_bmp, 0xFF, zi->size_maskrect_usage_bmp);
|
memset (maskrect_usage_bmp, 0xFF, zi->size_maskrect_usage_bmp);
|
||||||
|
|
||||||
/* init z-order node for desktop */
|
/* init z-order node for desktop */
|
||||||
znodes = (ZORDERNODE*) ((char*)(zi + 1) + zi->size_usage_bmp +
|
znodes = (ZORDERNODE*) ((char*)(zi + 1) + zi->size_usage_bmp +
|
||||||
sizeof (ZORDERNODE) * DEF_NR_POPUPMENUS);
|
sizeof (ZORDERNODE) * DEF_NR_POPUPMENUS);
|
||||||
|
|
||||||
znodes [0].flags = ZOF_TYPE_DESKTOP | ZOF_VISIBLE;
|
znodes [0].flags = ZOF_TYPE_DESKTOP | ZOF_VISIBLE;
|
||||||
@@ -239,11 +239,6 @@ BOOL __mg_is_valid_layer (MG_Layer* layer)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static key_t get_sem_key (void)
|
|
||||||
{
|
|
||||||
return (key_t)(IPC_KEY_BASE + 0x03);
|
|
||||||
}
|
|
||||||
|
|
||||||
void __mg_delete_zi_sem (void)
|
void __mg_delete_zi_sem (void)
|
||||||
{
|
{
|
||||||
union semun ignored;
|
union semun ignored;
|
||||||
@@ -268,11 +263,11 @@ int __mg_init_layers ()
|
|||||||
|
|
||||||
memset (sem_usage, 0xFF, sizeof (sem_usage));
|
memset (sem_usage, 0xFF, sizeof (sem_usage));
|
||||||
|
|
||||||
if ((sem_key = get_sem_key ()) == -1) {
|
if ((sem_key = get_sem_key_for_layers ()) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
semid = semget (sem_key, MAX_NR_LAYERS, SEM_PARAM | IPC_CREAT | IPC_EXCL);
|
semid = semget (sem_key, MAX_NR_LAYERS, SEM_PARAM | IPC_CREAT | IPC_EXCL);
|
||||||
if (semid == -1)
|
if (semid == -1)
|
||||||
return -1;
|
return -1;
|
||||||
atexit (__mg_delete_zi_sem);
|
atexit (__mg_delete_zi_sem);
|
||||||
@@ -280,7 +275,7 @@ int __mg_init_layers ()
|
|||||||
SHAREDRES_SEMID_LAYER = semid;
|
SHAREDRES_SEMID_LAYER = semid;
|
||||||
|
|
||||||
/* allocate the first layer for the default layer. */
|
/* allocate the first layer for the default layer. */
|
||||||
if (!do_alloc_layer (mgLayers, NAME_DEF_LAYER,
|
if (!do_alloc_layer (mgLayers, NAME_DEF_LAYER,
|
||||||
SHAREDRES_DEF_NR_TOPMOSTS, SHAREDRES_DEF_NR_NORMALS)) {
|
SHAREDRES_DEF_NR_TOPMOSTS, SHAREDRES_DEF_NR_NORMALS)) {
|
||||||
|
|
||||||
free (mgLayers);
|
free (mgLayers);
|
||||||
@@ -349,18 +344,18 @@ static MG_Layer* alloc_layer (const char* layer_name,
|
|||||||
|
|
||||||
mgTopmostLayer = new_layer;
|
mgTopmostLayer = new_layer;
|
||||||
|
|
||||||
_WRN_PRINTF ("SERVER: alloc_layer, mgTopmostLayer->zi = %p\n",
|
_WRN_PRINTF ("SERVER: alloc_layer, mgTopmostLayer->zi = %p\n",
|
||||||
mgTopmostLayer->zorder_info);
|
mgTopmostLayer->zorder_info);
|
||||||
|
|
||||||
/* Topmost layer changed */
|
/* Topmost layer changed */
|
||||||
CHANGE_TOPMOST_LAYER(mgTopmostLayer);
|
CHANGE_TOPMOST_LAYER(mgTopmostLayer);
|
||||||
|
|
||||||
__mg_do_change_topmost_layer ();
|
__mg_do_change_topmost_layer ();
|
||||||
_WRN_PRINTF ("SERVER: alloc_layer, mgTopmostLayer->zi = %p\n",
|
_WRN_PRINTF ("SERVER: alloc_layer, mgTopmostLayer->zi = %p\n",
|
||||||
mgTopmostLayer->zorder_info);
|
mgTopmostLayer->zorder_info);
|
||||||
|
|
||||||
/* Notify that a new topmost layer have been set. */
|
/* Notify that a new topmost layer have been set. */
|
||||||
if (OnChangeLayer)
|
if (OnChangeLayer)
|
||||||
OnChangeLayer (LCO_TOPMOST_CHANGED, mgTopmostLayer, NULL);
|
OnChangeLayer (LCO_TOPMOST_CHANGED, mgTopmostLayer, NULL);
|
||||||
|
|
||||||
PostMessage (HWND_DESKTOP, MSG_ERASEDESKTOP, 0, 0);
|
PostMessage (HWND_DESKTOP, MSG_ERASEDESKTOP, 0, 0);
|
||||||
@@ -421,7 +416,7 @@ void __mg_get_layer_info (int cli, const char* layer_name, LAYERINFO* info)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_client_join_layer (int cli,
|
static void do_client_join_layer (int cli,
|
||||||
const JOINLAYERINFO* info, JOINEDCLIENTINFO* joined_info)
|
const JOINLAYERINFO* info, JOINEDCLIENTINFO* joined_info)
|
||||||
{
|
{
|
||||||
MG_Layer* layer = (MG_Layer*)(joined_info->layer);
|
MG_Layer* layer = (MG_Layer*)(joined_info->layer);
|
||||||
@@ -433,11 +428,11 @@ static void do_client_join_layer (int cli,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_WRN_PRINTF ("SERVER: Join a client (%s) to layer %s\n",
|
_WRN_PRINTF ("SERVER: Join a client (%s) to layer %s\n",
|
||||||
info->client_name, layer->name);
|
info->client_name, layer->name);
|
||||||
|
|
||||||
strcpy (new_client->name, info->client_name);
|
strcpy (new_client->name, info->client_name);
|
||||||
|
|
||||||
new_client->layer = layer;
|
new_client->layer = layer;
|
||||||
|
|
||||||
/* Notify that a new client joined to this layer. */
|
/* Notify that a new client joined to this layer. */
|
||||||
@@ -455,13 +450,13 @@ static void do_client_join_layer (int cli,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Join a client to a layer, the server side of JoinLayer */
|
/* Join a client to a layer, the server side of JoinLayer */
|
||||||
void __mg_client_join_layer (int cli,
|
void __mg_client_join_layer (int cli,
|
||||||
const JOINLAYERINFO* info, JOINEDCLIENTINFO* joined_info)
|
const JOINLAYERINFO* info, JOINEDCLIENTINFO* joined_info)
|
||||||
{
|
{
|
||||||
MG_Layer* layer;
|
MG_Layer* layer;
|
||||||
|
|
||||||
if ((layer = __mg_find_layer_by_name (info->layer_name)) == NULL) {
|
if ((layer = __mg_find_layer_by_name (info->layer_name)) == NULL) {
|
||||||
layer = alloc_layer (info->layer_name,
|
layer = alloc_layer (info->layer_name,
|
||||||
(info->max_nr_topmosts <= 0)?SHAREDRES_DEF_NR_TOPMOSTS:
|
(info->max_nr_topmosts <= 0)?SHAREDRES_DEF_NR_TOPMOSTS:
|
||||||
info->max_nr_topmosts,
|
info->max_nr_topmosts,
|
||||||
(info->max_nr_normals<= 0)?SHAREDRES_DEF_NR_NORMALS:
|
(info->max_nr_normals<= 0)?SHAREDRES_DEF_NR_NORMALS:
|
||||||
@@ -512,7 +507,7 @@ BOOL GUIAPI ServerSetTopmostLayer (MG_Layer* layer)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
MG_Layer* GUIAPI ServerCreateLayer (const char* layer_name,
|
MG_Layer* GUIAPI ServerCreateLayer (const char* layer_name,
|
||||||
int max_nr_topmosts, int max_nr_normals)
|
int max_nr_topmosts, int max_nr_normals)
|
||||||
{
|
{
|
||||||
MG_Layer* new_layer;
|
MG_Layer* new_layer;
|
||||||
@@ -604,7 +599,7 @@ int GUIAPI ServerGetNextZNode (MG_Layer* layer, int idx_znode, int* cli)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
zi = (ZORDERINFO*)layer->zorder_info;
|
zi = (ZORDERINFO*)layer->zorder_info;
|
||||||
if (idx_znode > zi->max_nr_globals
|
if (idx_znode > zi->max_nr_globals
|
||||||
+ zi->max_nr_topmosts + zi->max_nr_normals) {
|
+ zi->max_nr_topmosts + zi->max_nr_normals) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -680,7 +675,7 @@ BOOL GUIAPI ServerGetZNodeInfo (MG_Layer* layer, int idx_znode,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
zi = (ZORDERINFO*)layer->zorder_info;
|
zi = (ZORDERINFO*)layer->zorder_info;
|
||||||
if (idx_znode > zi->max_nr_globals
|
if (idx_znode > zi->max_nr_globals
|
||||||
+ zi->max_nr_topmosts + zi->max_nr_normals) {
|
+ zi->max_nr_topmosts + zi->max_nr_normals) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -713,7 +708,7 @@ BOOL GUIAPI ServerDoZNodeOperation (MG_Layer* layer,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
zi = (ZORDERINFO*)layer->zorder_info;
|
zi = (ZORDERINFO*)layer->zorder_info;
|
||||||
if (idx_znode > zi->max_nr_globals
|
if (idx_znode > zi->max_nr_globals
|
||||||
+ zi->max_nr_topmosts + zi->max_nr_normals) {
|
+ zi->max_nr_topmosts + zi->max_nr_normals) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user