mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-26 03:23:46 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0abaeef4c7 | ||
|
|
c2779cbf09 | ||
|
|
e118805eef | ||
|
|
7513d461bf | ||
|
|
b131f00a79 | ||
|
|
649fbf571e | ||
|
|
e38fd05cb4 | ||
|
|
ce53f2c703 | ||
|
|
fbebc94718 | ||
|
|
b4ce6f9f10 | ||
|
|
c04dde31e5 | ||
|
|
5a2b425012 | ||
|
|
fa18025350 | ||
|
|
890ab1db44 | ||
|
|
3d963b3d25 | ||
|
|
29ac6a4277 | ||
|
|
96ecf5e9b7 | ||
|
|
50aafa3faa |
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
Version 5.0.13 (2023/08/31)
|
Version 5.2.0 (2023/09/30)
|
||||||
|
|
||||||
This is a minor enhancement and bugfix release of MiniGUI 5.0.x, the stable version.
|
This is a minor enhancement and bugfix release of MiniGUI 5.2.x, the stable version.
|
||||||
|
|
||||||
Other packages for MiniGUI resource, tools, components, and samples:
|
Other packages for MiniGUI resource, tools, components, and samples:
|
||||||
|
|
||||||
|
|||||||
+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, 5.0.14)
|
AC_INIT(libminigui, 5.2.0)
|
||||||
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
|
||||||
@@ -15,8 +15,8 @@ dnl Set various version strings - taken gratefully from the SDL sources
|
|||||||
# set MINIGUI_BINARY_AGE and MINIGUI_INTERFACE_AGE to 0.
|
# set MINIGUI_BINARY_AGE and MINIGUI_INTERFACE_AGE to 0.
|
||||||
#
|
#
|
||||||
MINIGUI_MAJOR_VERSION=5
|
MINIGUI_MAJOR_VERSION=5
|
||||||
MINIGUI_MINOR_VERSION=0
|
MINIGUI_MINOR_VERSION=2
|
||||||
MINIGUI_MICRO_VERSION=14
|
MINIGUI_MICRO_VERSION=0
|
||||||
MINIGUI_INTERFACE_AGE=0
|
MINIGUI_INTERFACE_AGE=0
|
||||||
MINIGUI_BINARY_AGE=0
|
MINIGUI_BINARY_AGE=0
|
||||||
MINIGUI_VERSION=$MINIGUI_MAJOR_VERSION.$MINIGUI_MINOR_VERSION.$MINIGUI_MICRO_VERSION
|
MINIGUI_VERSION=$MINIGUI_MAJOR_VERSION.$MINIGUI_MINOR_VERSION.$MINIGUI_MICRO_VERSION
|
||||||
@@ -62,7 +62,7 @@ dnl ========================================================================
|
|||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_HEADER_DIRENT
|
AC_HEADER_DIRENT
|
||||||
AC_CHECK_HEADERS(limits.h math.h locale.h unistd.h termio.h sys/types.h sys/time.h sys/select.h sys/memfd.h)
|
AC_CHECK_HEADERS(limits.h math.h stdatomic.h locale.h unistd.h termio.h sys/types.h sys/time.h sys/select.h sys/memfd.h)
|
||||||
|
|
||||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
|
|||||||
@@ -268,6 +268,8 @@ MGUI_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
|
|||||||
#define MG_UNLIKELY(expr) (expr)
|
#define MG_UNLIKELY(expr) (expr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define HAVE(FEATURE) (defined HAVE_##FEATURE && HAVE_##FEATURE)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \defgroup endian_info Endianness information
|
* \defgroup endian_info Endianness information
|
||||||
* @{
|
* @{
|
||||||
|
|||||||
+99
-58
@@ -1704,12 +1704,13 @@ MG_EXPORT BOOL GUIAPI IsScreenDC (HDC hdc);
|
|||||||
*/
|
*/
|
||||||
MG_EXPORT BOOL GUIAPI IsWindowDC (HDC hdc);
|
MG_EXPORT BOOL GUIAPI IsWindowDC (HDC hdc);
|
||||||
|
|
||||||
#ifdef _MGSCHEMA_COMPOSITING
|
|
||||||
struct GAL_Surface;
|
struct GAL_Surface;
|
||||||
typedef struct GAL_Surface *HSURF;
|
typedef struct GAL_Surface *HSURF;
|
||||||
|
|
||||||
|
#ifdef _MGSCHEMA_COMPOSITING
|
||||||
/**
|
/**
|
||||||
* \fn HSURF GUIAPI CreateSharedSurface (const char *name, DWORD flags,
|
* \fn HSURF GUIAPI CreateSharedSurface (GHANDLE video,
|
||||||
|
* const char *name, DWORD flags,
|
||||||
* int width, int height, int depth,
|
* int width, int height, int depth,
|
||||||
* Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
|
* Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
|
||||||
* \brief Creates a shared surface for specified size and pixel format.
|
* \brief Creates a shared surface for specified size and pixel format.
|
||||||
@@ -1717,8 +1718,8 @@ typedef struct GAL_Surface *HSURF;
|
|||||||
* This function creates a shared surface on the current video device with
|
* This function creates a shared surface on the current video device with
|
||||||
* the specified size and pixel format. This function also registers
|
* the specified size and pixel format. This function also registers
|
||||||
* the shared surface by using the specified name \a name to the server
|
* the shared surface by using the specified name \a name to the server
|
||||||
* if \a name is not NULL. Another client can use the name to retrieve
|
* if \a name is not NULL. Another client can use the name to get
|
||||||
* the shared surface by calling \a RetrieveSharedSurfaceFDByName().
|
* the shared surface by calling \a GetSharedSurfaceFDByName().
|
||||||
|
|
||||||
* \param video The handle to the video; NULL for the current default video.
|
* \param video The handle to the video; NULL for the current default video.
|
||||||
* \param name The gobal unique name for the shared surface.
|
* \param name The gobal unique name for the shared surface.
|
||||||
@@ -1740,11 +1741,12 @@ typedef struct GAL_Surface *HSURF;
|
|||||||
*
|
*
|
||||||
* \note This function only available when _MGSCHEMA_COMPOSITING is defined.
|
* \note This function only available when _MGSCHEMA_COMPOSITING is defined.
|
||||||
*
|
*
|
||||||
* \sa DestroySharedSurface, RetrieveSharedSurfaceFDByName
|
* \sa DestroySharedSurface, GetSharedSurfaceFDByName
|
||||||
*
|
*
|
||||||
* Since 5.2.0
|
* Since 5.2.0
|
||||||
*/
|
*/
|
||||||
MG_EXPORT HSURF GUIAPI CreateSharedSurface (const char *name, DWORD flags,
|
MG_EXPORT HSURF GUIAPI CreateSharedSurface (GHANDLE video,
|
||||||
|
const char *name, DWORD flags,
|
||||||
int width, int height, int depth,
|
int width, int height, int depth,
|
||||||
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
|
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
|
||||||
|
|
||||||
@@ -1770,7 +1772,7 @@ MG_EXPORT BOOL GUIAPI DestroySharedSurface (HSURF surf);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn int GUIAPI GetSharedSurfaceFDByClientWindow (int client,
|
* \fn int GUIAPI GetSharedSurfaceFDByClientWindow (int client,
|
||||||
* HWND hwnd)
|
* HWND hwnd, size_t *map_size, DWORD *flags)
|
||||||
* \brief Gets the file descriptor of the shared surface of a window created
|
* \brief Gets the file descriptor of the shared surface of a window created
|
||||||
* by another client.
|
* by another client.
|
||||||
*
|
*
|
||||||
@@ -1781,21 +1783,26 @@ MG_EXPORT BOOL GUIAPI DestroySharedSurface (HSURF surf);
|
|||||||
*
|
*
|
||||||
* \param client The client identifier.
|
* \param client The client identifier.
|
||||||
* \param hwnd The handle to the window created by the client.
|
* \param hwnd The handle to the window created by the client.
|
||||||
|
* \param map_size The pointer to a buffer of size_t to receive the whole size
|
||||||
|
* of the shared surface in bytes; nullable.
|
||||||
|
* \param flags The pointer to a buffer of DWORD to receive the flags of
|
||||||
|
* the shared surface; nullable.
|
||||||
*
|
*
|
||||||
* \return The file descriptor which represents the shared surface on success;
|
* \return The file descriptor which represents the shared surface on success;
|
||||||
* a value less than 0 for failure.
|
* a value less than 0 for failure.
|
||||||
*
|
*
|
||||||
* \note This function only available when _MGSCHEMA_COMPOSITING is defined.
|
* \note This function only available when _MGSCHEMA_COMPOSITING is defined.
|
||||||
*
|
*
|
||||||
* \sa CreateSharedSurface
|
* \sa AttachToSharedSurface, GetWindowSharedSurfaceFD
|
||||||
*
|
*
|
||||||
* Since 5.2.0
|
* Since 5.2.0
|
||||||
*/
|
*/
|
||||||
MG_EXPORT int GUIAPI GetSharedSurfaceFDByClientWindow (int client,
|
MG_EXPORT int GUIAPI GetSharedSurfaceFDByClientWindow (int client,
|
||||||
HWND hwnd);
|
HWND hwnd, size_t *map_size, DWORD *flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn int GUIAPI GetSharedSurfaceFDByName (const char *name)
|
* \fn int GUIAPI GetSharedSurfaceFDByName (const char *name,
|
||||||
|
* size_t *map_size, DWORD *flags)
|
||||||
* \brief Gets the file descriptor of a shared surface by name.
|
* \brief Gets the file descriptor of a shared surface by name.
|
||||||
*
|
*
|
||||||
* This function gets the file descriptor of the shared surface created
|
* This function gets the file descriptor of the shared surface created
|
||||||
@@ -1804,6 +1811,10 @@ MG_EXPORT int GUIAPI GetSharedSurfaceFDByClientWindow (int client,
|
|||||||
* the shared surface.
|
* the shared surface.
|
||||||
*
|
*
|
||||||
* \param name The gobal unique name for the shared surface.
|
* \param name The gobal unique name for the shared surface.
|
||||||
|
* \param map_size The pointer to a buffer of size_t to receive the whole size
|
||||||
|
* of the shared surface in bytes; nullable.
|
||||||
|
* \param flags The pointer to a buffer of DWORD to receive the flags of
|
||||||
|
* the shared surface; nullable.
|
||||||
*
|
*
|
||||||
* \return The file descriptor which represents the shared surface on success;
|
* \return The file descriptor which represents the shared surface on success;
|
||||||
* a value less than 0 for failure.
|
* a value less than 0 for failure.
|
||||||
@@ -1814,10 +1825,12 @@ MG_EXPORT int GUIAPI GetSharedSurfaceFDByClientWindow (int client,
|
|||||||
*
|
*
|
||||||
* Since 5.2.0
|
* Since 5.2.0
|
||||||
*/
|
*/
|
||||||
MG_EXPORT int GUIAPI GetSharedSurfaceFDByName (const char *name);
|
MG_EXPORT int GUIAPI GetSharedSurfaceFDByName (const char *name,
|
||||||
|
size_t *map_size, DWORD *flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn HSURF GUIAPI AttachToSharedSurface (GHANDLE video, int fd)
|
* \fn HSURF GUIAPI AttachToSharedSurface (GHANDLE video, int fd,
|
||||||
|
* size_t map_size, DWORD flags)
|
||||||
* \brief Attaches to a shared surface.
|
* \brief Attaches to a shared surface.
|
||||||
*
|
*
|
||||||
* This function attaches to the shared surface which is represents by
|
* This function attaches to the shared surface which is represents by
|
||||||
@@ -1834,18 +1847,22 @@ MG_EXPORT int GUIAPI GetSharedSurfaceFDByName (const char *name);
|
|||||||
*
|
*
|
||||||
* Since 5.2.0
|
* Since 5.2.0
|
||||||
*/
|
*/
|
||||||
MG_EXPORT HSURF GUIAPI AttachToSharedSurface (GHANDLE video, int fd);
|
MG_EXPORT HSURF GUIAPI AttachToSharedSurface (GHANDLE video, int fd,
|
||||||
|
size_t map_size, DWORD flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn int GUIAPI GetSharedSurfaceInfo (HSURF surf, SIZE *size, int *pitch,
|
* \fn const char *GUIAPI GetSharedSurfaceInfo (HSURF surf, int *fd,
|
||||||
* size_t *file_size, size_t *pixel_off)
|
* SIZE *size, int *pitch, size_t *map_size, off_t *pixels_off)
|
||||||
* \brief Gets the file descriptor of a shared surface.
|
* \brief Gets the basic information of a shared surface.
|
||||||
*
|
*
|
||||||
* This function gets the file descriptor of the shared surface. It also
|
* This function gets the name and other information of
|
||||||
* returns the size and the pitch of the surface if \a size or \a pitch is
|
* the given shared surface \a surf. It also returns the file descriptor,
|
||||||
* not NULL.
|
* the size, or the pitch of the surface if \a fd, \a size or \a pitch
|
||||||
|
* is not NULL.
|
||||||
*
|
*
|
||||||
* \param surf The handle to the shared surface.
|
* \param surf The handle to the shared surface.
|
||||||
|
* \param fd The pointer to a buffer of int to return the file descriptor of
|
||||||
|
* the shared surface; nullable.
|
||||||
* \param size The pointer to a buffer of SIZE to return the size of
|
* \param size The pointer to a buffer of SIZE to return the size of
|
||||||
* the shared surface; nullable.
|
* the shared surface; nullable.
|
||||||
* \param pitch The pointer to a buffer of int for value of pitch; nullable.
|
* \param pitch The pointer to a buffer of int for value of pitch; nullable.
|
||||||
@@ -1854,8 +1871,8 @@ MG_EXPORT HSURF GUIAPI AttachToSharedSurface (GHANDLE video, int fd);
|
|||||||
* \param pixel_off The pointer to a buffer of size_t for the offset of
|
* \param pixel_off The pointer to a buffer of size_t for the offset of
|
||||||
* pixel data; nullable.
|
* pixel data; nullable.
|
||||||
*
|
*
|
||||||
* \return The file descriptor of the shared surface on success;
|
* \return The name of the shared surface on success; NULL for failure.
|
||||||
* a value less than zero for failure.
|
* Note that if the name is an empty string, it is an anonymous surface.
|
||||||
*
|
*
|
||||||
* \note This function only available when _MGSCHEMA_COMPOSITING is defined.
|
* \note This function only available when _MGSCHEMA_COMPOSITING is defined.
|
||||||
*
|
*
|
||||||
@@ -1863,30 +1880,48 @@ MG_EXPORT HSURF GUIAPI AttachToSharedSurface (GHANDLE video, int fd);
|
|||||||
*
|
*
|
||||||
* Since 5.2.0
|
* Since 5.2.0
|
||||||
*/
|
*/
|
||||||
MG_EXPORT int GUIAPI GetSharedSurfaceInfo (HSURF surf, SIZE *size, int *pitch,
|
MG_EXPORT const char *GUIAPI GetSharedSurfaceInfo (HSURF surf, int *fd,
|
||||||
size_t *file_size, size_t *pixel_off);
|
SIZE *size, int *pitch, size_t *map_size, off_t *pixels_off);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn BOOL GUIAPI LockSharedSurfaceIfDirty (HSURF surf,
|
* \fn BOOL GUIAPI TestIfSharedSurfaceChanged (HSURF surf,
|
||||||
* unsigned old_dirty_age, unsigned *dirty_age,
|
* unsigned dirty_age)
|
||||||
* int *nr_dirty_rects, RECT *const *dirty_rects)
|
* \brief Tests if a shared surface changed.
|
||||||
* \brief Locks the shared surface if it is dirty.
|
|
||||||
*
|
*
|
||||||
* This function compares the dirty age of the shared surface with the value
|
* This function tests if the given shared surface \a surf had changed, i.e.,
|
||||||
* containing in \a dirty_age, and lock the shared surface if it has
|
* it has a different dirty age value against the specified value \a dirty_age.
|
||||||
* a larger dirty age value.
|
|
||||||
*
|
*
|
||||||
* \param surf The handle to the shared surface.
|
* \param surf The handle to the shared surface.
|
||||||
* \param old_dirty_age The old dirty age.
|
* \param dirty_age The dirty age to compare.
|
||||||
* \param dirty_age The pointer to a buffer of unsigned integer to return
|
*
|
||||||
* the current dirty age of the shared surface.
|
* \return TRUE for changed; FALSE for no change or failure.
|
||||||
|
*
|
||||||
|
* \note This function only available when _MGSCHEMA_COMPOSITING is defined.
|
||||||
|
*
|
||||||
|
* \sa LockSharedSurface
|
||||||
|
*
|
||||||
|
* Since 5.2.0
|
||||||
|
*/
|
||||||
|
MG_EXPORT BOOL GUIAPI TestIfSharedSurfaceChanged (HSURF surf,
|
||||||
|
unsigned dirty_age);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \fn BOOL GUIAPI LockSharedSurface (HSURF surf,
|
||||||
|
* unsigned *dirty_age, int *nr_dirty_rects, const RECT **dirty_rects)
|
||||||
|
* \brief Locks the shared surface for read.
|
||||||
|
*
|
||||||
|
* This function locks the given shared surface \a surf and returns
|
||||||
|
* the dirty information.
|
||||||
|
*
|
||||||
|
* \param surf The handle to the shared surface.
|
||||||
|
* \param dirty_age The pointer to a buffer of unsigned integer to
|
||||||
|
* return the latest dirty age of the shared surface; nullable.
|
||||||
* \param nr_dirty_rects The pointer to a buffer of integer to return the valid
|
* \param nr_dirty_rects The pointer to a buffer of integer to return the valid
|
||||||
* dirty rectangles; nullable.
|
* dirty rectangles; nullable.
|
||||||
* \param dirty_rects The pointer to a buffer of (const RECT *) for the array
|
* \param dirty_rects The pointer to a buffer of (const RECT *) for the array
|
||||||
* of dirty rectangles; nullable.
|
* of dirty rectangles; nullable.
|
||||||
*
|
*
|
||||||
* \return TRUE for success and if the value contains in \a dirty_age is larger
|
* \return TRUE for locked; FALSE for failure.
|
||||||
* than \a old_dirty_age, the surface was locked; otherwise failure.
|
|
||||||
*
|
*
|
||||||
* \note This function only available when _MGSCHEMA_COMPOSITING is defined.
|
* \note This function only available when _MGSCHEMA_COMPOSITING is defined.
|
||||||
*
|
*
|
||||||
@@ -1894,31 +1929,26 @@ MG_EXPORT int GUIAPI GetSharedSurfaceInfo (HSURF surf, SIZE *size, int *pitch,
|
|||||||
*
|
*
|
||||||
* Since 5.2.0
|
* Since 5.2.0
|
||||||
*/
|
*/
|
||||||
MG_EXPORT BOOL GUIAPI LockSharedSurfaceIfDirty (HSURF surf,
|
MG_EXPORT BOOL GUIAPI LockSharedSurface (HSURF surf,
|
||||||
unsigned old_dirty_age, unsigned *dirty_age,
|
unsigned *dirty_age, int *nr_dirty_rects, const RECT **dirty_rects);
|
||||||
int *nr_dirty_rects, RECT *const *dirty_rects);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn BOOL GUIAPI UnlockSharedSurface (HSURF surf, BOOL clear_dirty)
|
* \fn BOOL GUIAPI UnlockSharedSurface (HSURF surf)
|
||||||
* \brief Unocks the shared surface and clears the dirty information.
|
* \brief Unlocks the shared surface.
|
||||||
*
|
*
|
||||||
* This function compares the dirty age of the shared surface with the value
|
* This function unlocks the given shared surface \a surf.
|
||||||
* containing in \a dirty_age, and lock the shared surface if it has
|
|
||||||
* a larger dirty age value.
|
|
||||||
*
|
*
|
||||||
* \param surf The handle to the shared surface.
|
* \param surf The handle to the shared surface.
|
||||||
* \param clear_dirty A boolean value indicates whether to clear the dirty
|
|
||||||
* information of the shared surface.
|
|
||||||
*
|
*
|
||||||
* \return TRUE on success; otherwise failure.
|
* \return TRUE on success; otherwise failure.
|
||||||
*
|
*
|
||||||
* \note This function only available when _MGSCHEMA_COMPOSITING is defined.
|
* \note This function only available when _MGSCHEMA_COMPOSITING is defined.
|
||||||
*
|
*
|
||||||
* \sa LockSharedSurfaceIfDirty
|
* \sa LockSharedSurface
|
||||||
*
|
*
|
||||||
* Since 5.2.0
|
* Since 5.2.0
|
||||||
*/
|
*/
|
||||||
MG_EXPORT BOOL GUIAPI UnlockSharedSurface (HSURF surf, BOOL clear_dirty);
|
MG_EXPORT BOOL GUIAPI UnlockSharedSurface (HSURF surf);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn BOOL GUIAPI DetachFromSharedSurface (HSURF surf)
|
* \fn BOOL GUIAPI DetachFromSharedSurface (HSURF surf)
|
||||||
@@ -1938,28 +1968,39 @@ MG_EXPORT BOOL GUIAPI UnlockSharedSurface (HSURF surf, BOOL clear_dirty);
|
|||||||
* Since 5.2.0
|
* Since 5.2.0
|
||||||
*/
|
*/
|
||||||
MG_EXPORT BOOL GUIAPI DetachFromSharedSurface (HSURF surf);
|
MG_EXPORT BOOL GUIAPI DetachFromSharedSurface (HSURF surf);
|
||||||
|
#endif /* _MGSCHEMA_COMPOSITING */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn HDC GUIAPI CreateMemDCOnSharedSurface (HSURF surf, const RECT *rect);
|
* \fn HDC GUIAPI CreateMemDCFromSurface (HSURF surf);
|
||||||
* \brief Creates a memory DC on a shared surface.
|
* \brief Creates a memory DC from a surface.
|
||||||
*
|
*
|
||||||
* This function creates a memory DC on the specified shared surface \a surf
|
* This function creates a memory DC on the specified surface \a surf.
|
||||||
* within the specified rectangle \a rect on the surface.
|
|
||||||
*
|
*
|
||||||
* \param surf The handle to the shared surface.
|
* \param surf The handle to the shared surface.
|
||||||
* \param rect A rectangle in the surface which defines the bounds of memory DC;
|
|
||||||
* NULL for whole surface.
|
|
||||||
*
|
*
|
||||||
* \return The handle to a new memory DC, HDC_INVALID indicates an error.
|
* \return The handle to a new memory DC, HDC_INVALID indicates an error.
|
||||||
*
|
*
|
||||||
* \note This function only available when _MGSCHEMA_COMPOSITING is defined.
|
|
||||||
*
|
|
||||||
* \sa DeleteMemDC
|
* \sa DeleteMemDC
|
||||||
*
|
*
|
||||||
* Since 5.0.13
|
* Since 5.2.0
|
||||||
*/
|
*/
|
||||||
MG_EXPORT HDC GUIAPI CreateMemDCOnSharedSurface (HSURF surf, const RECT *rect);
|
MG_EXPORT HDC GUIAPI CreateMemDCFromSurface(HSURF surf);
|
||||||
#endif /* _MGSCHEMA_COMPOSITING */
|
|
||||||
|
/**
|
||||||
|
* \fn HSURF GUIAPI GetSurfaceFromDC(HDC hdc);
|
||||||
|
* \brief Gets surface handle from a DC.
|
||||||
|
*
|
||||||
|
* This function returns the handle to the surface of the given DC \a hdc.
|
||||||
|
*
|
||||||
|
* \param hdc The handle to the DC.
|
||||||
|
*
|
||||||
|
* \return The handle to the surface, NULL for failure.
|
||||||
|
*
|
||||||
|
* \sa CreateMemDCFromSurface
|
||||||
|
*
|
||||||
|
* Since 5.2.0
|
||||||
|
*/
|
||||||
|
MG_EXPORT HSURF GUIAPI GetSurfaceFromDC(HDC hdc);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn HDC GUIAPI CreateMemDCEx (int width, int height, int depth, DWORD flags, \
|
* \fn HDC GUIAPI CreateMemDCEx (int width, int height, int depth, DWORD flags, \
|
||||||
|
|||||||
+86
-5
@@ -456,6 +456,45 @@ MG_EXPORT void GUIAPI MiniGUIPanic (int exitcode);
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \fn GHANDLE GUIAPI JoinLayerEx (const char* layer_name,
|
||||||
|
const char* client_name,
|
||||||
|
int max_nr_highers, int max_nr_normals, int *cli_id)
|
||||||
|
* \brief Joins to a layer and returns the client identifier if success.
|
||||||
|
*
|
||||||
|
* This function should be called by clients before calling any other MiniGUI
|
||||||
|
* functions. You can call \a GetLayerInfo to get the layer information.
|
||||||
|
* If the layer to be joined does not exist, the server, i.e. \a mginit, will
|
||||||
|
* try to create a new one. If you passed a NULL pointer or a null string for
|
||||||
|
* \a layer_name, the client will join to the default layer.
|
||||||
|
*
|
||||||
|
* If the client want to create a new layer, you should specify the maximal
|
||||||
|
* number of z-nodes in the higher level (max_nr_highers) and the maximal
|
||||||
|
* number of z-nodes in the normal level (max_nr_normals) of the new layer.
|
||||||
|
* Passing zero to \a max_nr_highers and max_nr_normals will use the default
|
||||||
|
* values, and the default values are specified by ServerStartup.
|
||||||
|
*
|
||||||
|
* Note that the server will create a default layer named "mginit".
|
||||||
|
*
|
||||||
|
* \param layer_name The name of the layer. You can use NAME_TOPMOST_LAYER to
|
||||||
|
* specify the current topmost layer.
|
||||||
|
* \param client_name The name of the client.
|
||||||
|
* \param max_nr_highers The maximal number of z-nodes in the higher level of
|
||||||
|
* the new layer.
|
||||||
|
* \param max_nr_normals The maximal number of z-nodes in the normal level of
|
||||||
|
* the new layer.
|
||||||
|
* \param cli_id The pointer to a buffer of int to return the client identifier.
|
||||||
|
*
|
||||||
|
* \return The handle to the layer on success, INV_LAYER_HANDLE on error.
|
||||||
|
*
|
||||||
|
* \note Only call this function in clients of MiniGUI-Processes.
|
||||||
|
*
|
||||||
|
* \sa GetLayerInfo, ServerStartup, ServerCreateLayer
|
||||||
|
*/
|
||||||
|
MG_EXPORT GHANDLE GUIAPI JoinLayerEx (const char* layer_name,
|
||||||
|
const char* client_name,
|
||||||
|
int max_nr_highers, int max_nr_normals, int *cli_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn GHANDLE GUIAPI JoinLayer (const char* layer_name,
|
* \fn GHANDLE GUIAPI JoinLayer (const char* layer_name,
|
||||||
const char* client_name,
|
const char* client_name,
|
||||||
@@ -490,9 +529,30 @@ MG_EXPORT void GUIAPI MiniGUIPanic (int exitcode);
|
|||||||
*
|
*
|
||||||
* \sa GetLayerInfo, ServerStartup, ServerCreateLayer
|
* \sa GetLayerInfo, ServerStartup, ServerCreateLayer
|
||||||
*/
|
*/
|
||||||
MG_EXPORT GHANDLE GUIAPI JoinLayer (const char* layer_name,
|
static inline GHANDLE GUIAPI JoinLayer (const char* layer_name,
|
||||||
const char* client_name,
|
const char* client_name,
|
||||||
int max_nr_highers, int max_nr_normals);
|
int max_nr_highers, int max_nr_normals)
|
||||||
|
{
|
||||||
|
return JoinLayerEx (layer_name, client_name,
|
||||||
|
max_nr_highers, max_nr_normals, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \fn int GUIAPI GetClientId (void)
|
||||||
|
* \brief Gets the client identifier.
|
||||||
|
*
|
||||||
|
* You can get the information of a layer through this function.
|
||||||
|
* The information will be returned through the pointer arguments
|
||||||
|
* if the specific pointer is not NULL.
|
||||||
|
*
|
||||||
|
* \return Returns the client identifier of the current process.
|
||||||
|
* Note that the server always returns 0.
|
||||||
|
*
|
||||||
|
* \sa JoinLayerEx
|
||||||
|
*
|
||||||
|
* Since 5.2.0
|
||||||
|
*/
|
||||||
|
MG_EXPORT int GUIAPI GetClientId (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn GHANDLE GUIAPI GetLayerInfo (const char* layer_name,
|
* \fn GHANDLE GUIAPI GetLayerInfo (const char* layer_name,
|
||||||
@@ -1958,7 +2018,7 @@ const CompositorOps* __ex_compositor_get (const char* name,
|
|||||||
*
|
*
|
||||||
* \sa RegisterRequestHandler
|
* \sa RegisterRequestHandler
|
||||||
*/
|
*/
|
||||||
#define MAX_SYS_REQID 0x0024
|
#define MAX_SYS_REQID 0x0023
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \def MAX_REQID
|
* \def MAX_REQID
|
||||||
@@ -2125,7 +2185,7 @@ MG_EXPORT int GUIAPI ServerSendReplyEx (int clifd,
|
|||||||
* \fn int GUIAPI ServerSendReply (int clifd, const void* reply, int len)
|
* \fn int GUIAPI ServerSendReply (int clifd, const void* reply, int len)
|
||||||
* \brief Sends the reply to the client.
|
* \brief Sends the reply to the client.
|
||||||
*
|
*
|
||||||
* This function sends a replay pointed to by \a reply which is
|
* This function sends a reply pointed to by \a reply which is
|
||||||
* \a len bytes long to the client.
|
* \a len bytes long to the client.
|
||||||
*
|
*
|
||||||
* \note Only used by the server to send the reply to the client.
|
* \note Only used by the server to send the reply to the client.
|
||||||
@@ -2673,6 +2733,26 @@ MG_EXPORT void GUIAPI DesktopUpdateAllWindow (void);
|
|||||||
|
|
||||||
#define DUMMY_LAYER_HANDLE (GHANDLE)(-1)
|
#define DUMMY_LAYER_HANDLE (GHANDLE)(-1)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \fn GHANDLE GUIAPI JoinLayerEx (const char* layer_name,
|
||||||
|
const char* client_name,
|
||||||
|
int max_nr_highers, int max_nr_normals, int *cli_fd)
|
||||||
|
* \brief The dummy replacement of the same function for MiniGUI-Processes.
|
||||||
|
*
|
||||||
|
* This function is a replacment of the same function for MiniGUI-Processes
|
||||||
|
* runtime mode. We provide this function for MiniGUI-Threads and
|
||||||
|
* MiniGUI-Standalone runtime modes, in order to avoid using the
|
||||||
|
* conditional compilation instructions in your source code.
|
||||||
|
*
|
||||||
|
* \return Always returns DUMMY_LAYER_HANDLE to indicate success.
|
||||||
|
*/
|
||||||
|
static inline GHANDLE GUIAPI JoinLayerEx (const char* layer_name,
|
||||||
|
const char* client_name,
|
||||||
|
int max_nr_highers, int max_nr_normals, int *cli_fd)
|
||||||
|
{
|
||||||
|
return DUMMY_LAYER_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn GHANDLE GUIAPI JoinLayer (const char* layer_name,
|
* \fn GHANDLE GUIAPI JoinLayer (const char* layer_name,
|
||||||
const char* client_name,
|
const char* client_name,
|
||||||
@@ -2687,7 +2767,8 @@ MG_EXPORT void GUIAPI DesktopUpdateAllWindow (void);
|
|||||||
* \return Always returns DUMMY_LAYER_HANDLE to indicate success.
|
* \return Always returns DUMMY_LAYER_HANDLE to indicate success.
|
||||||
*/
|
*/
|
||||||
static inline GHANDLE GUIAPI JoinLayer (const char* layer_name,
|
static inline GHANDLE GUIAPI JoinLayer (const char* layer_name,
|
||||||
const char* client_name, int max_nr_highers, int max_nr_normals)
|
const char* client_name,
|
||||||
|
int max_nr_highers, int max_nr_normals)
|
||||||
{
|
{
|
||||||
return DUMMY_LAYER_HANDLE;
|
return DUMMY_LAYER_HANDLE;
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-5
@@ -2990,18 +2990,22 @@ typedef struct _WINMASKINFO {
|
|||||||
if the client moved to a new layer */
|
if the client moved to a new layer */
|
||||||
#define MSG_LAYERCHANGED 0x0149
|
#define MSG_LAYERCHANGED 0x0149
|
||||||
|
|
||||||
|
/* Since 5.2.0; the server send this message to the client
|
||||||
|
if a window has been composited to the screen. */
|
||||||
|
#define MSG_WINCOMPOSITED 0x014A
|
||||||
|
|
||||||
#endif /* defined _MGRM_PROCESSES */
|
#endif /* defined _MGRM_PROCESSES */
|
||||||
|
|
||||||
/* Since 5.0.0: for managing message thread */
|
/* Since 5.0.0: for managing message thread */
|
||||||
#define MSG_MANAGE_MSGTHREAD 0x014A
|
#define MSG_MANAGE_MSGTHREAD 0x014B
|
||||||
#define MSGTHREAD_SIGNIN 0x00
|
#define MSGTHREAD_SIGNIN 0x00
|
||||||
#define MSGTHREAD_SIGNOUT 0x01
|
#define MSGTHREAD_SIGNOUT 0x01
|
||||||
|
|
||||||
/* Since 5.0.0: for calculating the default position */
|
/* Since 5.0.0: for calculating the default position */
|
||||||
#define MSG_CALC_POSITION 0x014B
|
#define MSG_CALC_POSITION 0x014C
|
||||||
|
|
||||||
/* Since 5.0.6: for waking up the client */
|
/* Since 5.0.6: for waking up the client */
|
||||||
#define MSG_WAKEUP_CLIENT 0x014C
|
#define MSG_WAKEUP_CLIENT 0x014D
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \def MSG_DOESNEEDIME
|
* \def MSG_DOESNEEDIME
|
||||||
@@ -7238,7 +7242,8 @@ MG_EXPORT BOOL GUIAPI SetMainWindowGestureFlags (HWND hWnd, DWORD dwFlags);
|
|||||||
#ifdef _MGSCHEMA_COMPOSITING
|
#ifdef _MGSCHEMA_COMPOSITING
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn int GUIAPI GetWindowSharedSurfaceFD (HWND hwnd)
|
* \fn int GUIAPI GetWindowSharedSurfaceFD (HWND hwnd, size_t *map_size,
|
||||||
|
* DWORD *flags)
|
||||||
* \brief Gets the file descriptor of the surface buffer for a window or
|
* \brief Gets the file descriptor of the surface buffer for a window or
|
||||||
* the main window it locates.
|
* the main window it locates.
|
||||||
*
|
*
|
||||||
@@ -7258,7 +7263,8 @@ MG_EXPORT BOOL GUIAPI SetMainWindowGestureFlags (HWND hWnd, DWORD dwFlags);
|
|||||||
*
|
*
|
||||||
* Since 5.0.13
|
* Since 5.0.13
|
||||||
*/
|
*/
|
||||||
MG_EXPORT int GUIAPI GetWindowSharedSurfaceFD (HWND hWnd);
|
MG_EXPORT int GUIAPI GetWindowSharedSurfaceFD (HWND hWnd, size_t *map_size,
|
||||||
|
DWORD *flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn BOOL GUIAPI SetMainWindowCompositing (HWND hWnd,
|
* \fn BOOL GUIAPI SetMainWindowCompositing (HWND hWnd,
|
||||||
|
|||||||
+32
-3
@@ -184,6 +184,23 @@ static void process_socket_message (MSG *msg)
|
|||||||
LOSWORD(msg->wParam), HISWORD(msg->wParam),
|
LOSWORD(msg->wParam), HISWORD(msg->wParam),
|
||||||
LOSWORD(msg->lParam), HISWORD(msg->lParam));
|
LOSWORD(msg->lParam), HISWORD(msg->lParam));
|
||||||
}
|
}
|
||||||
|
#ifdef _MGSCHEMA_COMPOSITING
|
||||||
|
else if (msg->message == MSG_WINCOMPOSITED) {
|
||||||
|
/* Since 5.2.0 */
|
||||||
|
int slot = (int)msg->wParam;
|
||||||
|
HWND hwnd = (HWND)msg->lParam;
|
||||||
|
unsigned dirty_age = (unsigned)msg->time;
|
||||||
|
if (__mg_client_check_znode_hwnd(slot, hwnd, __mg_client_id)) {
|
||||||
|
GAL_Surface *ssurf = ((PMAINWIN)hwnd)->surf;
|
||||||
|
assert(ssurf->shared_header);
|
||||||
|
__mg_lock_file_for_write(ssurf->fd);
|
||||||
|
if (ssurf->dirty_info->dirty_age == dirty_age) {
|
||||||
|
ssurf->dirty_info->nr_dirty_rcs = 0;
|
||||||
|
}
|
||||||
|
__mg_unlock_file_for_write(ssurf->fd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
else {
|
else {
|
||||||
if (msg->hwnd == HWND_NULL) {
|
if (msg->hwnd == HWND_NULL) {
|
||||||
msg->hwnd = HWND_DESKTOP;
|
msg->hwnd = HWND_DESKTOP;
|
||||||
@@ -518,8 +535,8 @@ BOOL client_IdleHandler4Client (PMSGQUEUE msg_queue, BOOL wait)
|
|||||||
return (n > 0);
|
return (n > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GHANDLE GUIAPI JoinLayer (const char* layer_name, const char* client_name,
|
GHANDLE GUIAPI JoinLayerEx (const char* layer_name, const char* client_name,
|
||||||
int max_nr_topmosts, int max_nr_normals)
|
int max_nr_topmosts, int max_nr_normals, int *cli_id)
|
||||||
{
|
{
|
||||||
GHANDLE layer_handle = INV_LAYER_HANDLE;
|
GHANDLE layer_handle = INV_LAYER_HANDLE;
|
||||||
REQUEST req;
|
REQUEST req;
|
||||||
@@ -529,8 +546,12 @@ GHANDLE GUIAPI JoinLayer (const char* layer_name, const char* client_name,
|
|||||||
if (mgIsServer)
|
if (mgIsServer)
|
||||||
return layer_handle;
|
return layer_handle;
|
||||||
|
|
||||||
if (__mg_client_id != 0) /* Already joined, return the handle */
|
if (__mg_client_id != 0) {
|
||||||
|
/* Already joined, return the handle */
|
||||||
|
if (cli_id)
|
||||||
|
*cli_id = __mg_client_id;
|
||||||
return GetLayerInfo (NAME_SELF_LAYER, NULL, NULL, NULL);
|
return GetLayerInfo (NAME_SELF_LAYER, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if (layer_name) {
|
if (layer_name) {
|
||||||
strncpy (info.layer_name, layer_name, LEN_LAYER_NAME);
|
strncpy (info.layer_name, layer_name, LEN_LAYER_NAME);
|
||||||
@@ -593,10 +614,18 @@ GHANDLE GUIAPI JoinLayer (const char* layer_name, const char* client_name,
|
|||||||
|
|
||||||
__mg_start_client_desktop ();
|
__mg_start_client_desktop ();
|
||||||
|
|
||||||
|
if (cli_id)
|
||||||
|
*cli_id = __mg_client_id;
|
||||||
|
|
||||||
ret:
|
ret:
|
||||||
return layer_handle;
|
return layer_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GUIAPI GetClientId (void)
|
||||||
|
{
|
||||||
|
return __mg_client_id;
|
||||||
|
}
|
||||||
|
|
||||||
GHANDLE GUIAPI GetLayerInfo (const char* layer_name,
|
GHANDLE GUIAPI GetLayerInfo (const char* layer_name,
|
||||||
int* nr_clients, BOOL* is_topmost, int* cli_active)
|
int* nr_clients, BOOL* is_topmost, int* cli_active)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -2185,7 +2185,7 @@ static int create_memdc_for_menu (TRACKMENUINFO* ptmi)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptmi->dc = CreateMemDCFromSurface (surf);
|
ptmi->dc = __mg_create_memdc_for_surface (surf);
|
||||||
if (ptmi->dc == HDC_INVALID) {
|
if (ptmi->dc == HDC_INVALID) {
|
||||||
GAL_FreeSurface (surf);
|
GAL_FreeSurface (surf);
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
+24
-13
@@ -4476,10 +4476,10 @@ HWND GUIAPI CreateMainWindowEx2 (PMAINWINCREATE pCreateInfo, LINT id,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MGSCHEMA_COMPOSITING
|
#ifdef _MGSCHEMA_COMPOSITING
|
||||||
// Close file descriptor to free kernel memory?
|
/* Since 5.2.0: keep fd available. */
|
||||||
if (pWin->surf->shared_header) {
|
if (0 && pWin->surf->shared_header) {
|
||||||
close (pWin->surf->shared_header->fd);
|
close (pWin->surf->fd);
|
||||||
pWin->surf->shared_header->fd = -1;
|
pWin->surf->fd = -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -5585,11 +5585,13 @@ BOOL GUIAPI ValidateRegion (HWND hWnd, const CLIPRGN* pRgn)
|
|||||||
BOOL GUIAPI GetUpdateRect (HWND hWnd, RECT* update_rect)
|
BOOL GUIAPI GetUpdateRect (HWND hWnd, RECT* update_rect)
|
||||||
{
|
{
|
||||||
PMAINWIN pWin;
|
PMAINWIN pWin;
|
||||||
|
RECT rcClient;
|
||||||
|
|
||||||
MG_CHECK_RET (MG_IS_NORMAL_WINDOW(hWnd), FALSE);
|
MG_CHECK_RET (MG_IS_NORMAL_WINDOW(hWnd), FALSE);
|
||||||
pWin = MG_GET_WINDOW_PTR (hWnd);
|
pWin = MG_GET_WINDOW_PTR (hWnd);
|
||||||
|
|
||||||
*update_rect = pWin->InvRgn.rgn.rcBound;
|
GetClientRect(hWnd, &rcClient);
|
||||||
|
IntersectRect(update_rect, &pWin->InvRgn.rgn.rcBound, &rcClient);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6036,10 +6038,10 @@ HWND GUIAPI CreateWindowEx2 (const char* spClassName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MGSCHEMA_COMPOSITING
|
#ifdef _MGSCHEMA_COMPOSITING
|
||||||
// Close file descriptor to free kernel memory?
|
/* Since 5.2.0: keep fd available. */
|
||||||
if (dwExStyle & WS_EX_CTRLASMAINWIN && pNewCtrl->surf->shared_header) {
|
if (0 && dwExStyle & WS_EX_CTRLASMAINWIN && pNewCtrl->surf->shared_header) {
|
||||||
close (pNewCtrl->surf->shared_header->fd);
|
close (pNewCtrl->surf->fd);
|
||||||
pNewCtrl->surf->shared_header->fd = -1;
|
pNewCtrl->surf->fd = -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -6067,13 +6069,22 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MGSCHEMA_COMPOSITING
|
#ifdef _MGSCHEMA_COMPOSITING
|
||||||
int GUIAPI GetWindowSharedSurfaceFD (HWND hWnd)
|
int GUIAPI GetWindowSharedSurfaceFD (HWND hWnd, size_t *map_size, DWORD *flags)
|
||||||
{
|
{
|
||||||
MG_CHECK_RET (MG_IS_APP_WINDOW (hWnd), -1);
|
MG_CHECK_RET (MG_IS_NORMAL_WINDOW (hWnd), -1);
|
||||||
|
|
||||||
PMAINWIN pWin = (PMAINWIN)hWnd;
|
PMAINWIN pWin = (PMAINWIN)hWnd;
|
||||||
if (pWin->surf->shared_header)
|
if (pWin->surf->shared_header) {
|
||||||
return pWin->surf->shared_header->fd;
|
if (map_size)
|
||||||
|
*map_size = pWin->surf->shared_header->map_size;
|
||||||
|
if (flags) {
|
||||||
|
*flags = MEMDC_FLAG_SWSURFACE;
|
||||||
|
if (pWin->surf->shared_header->byhw)
|
||||||
|
*flags |= MEMDC_FLAG_HWSURFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pWin->surf->fd;
|
||||||
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-50
@@ -46,7 +46,6 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
@@ -66,18 +65,14 @@
|
|||||||
|
|
||||||
#define LEN_TOUCH_DEV 127
|
#define LEN_TOUCH_DEV 127
|
||||||
|
|
||||||
#define AUTO_MOUSE_UP_TICKCOUNT 20
|
|
||||||
|
|
||||||
static int sg_tp_event_fd = -1, sg_key_event_fd = -1;
|
static int sg_tp_event_fd = -1, sg_key_event_fd = -1;
|
||||||
static short MOUSEX = 0, MOUSEY = 0, MOUSEBUTTON = 0;
|
static short MOUSEX = 0, MOUSEY = 0, MOUSEBUTTON = 0;
|
||||||
static DWORD g_last_tickcount = 0;
|
|
||||||
static bool g_has_auto_event = false;
|
|
||||||
|
|
||||||
static int get_touch_data (short *x, short *y, short *button)
|
static int get_touch_data (short *x, short *y, short *button)
|
||||||
{
|
{
|
||||||
struct input_event data;
|
struct input_event data;
|
||||||
|
|
||||||
if (read (sg_tp_event_fd, &data, sizeof (data)) == sizeof (data)) {
|
while (read (sg_tp_event_fd, &data, sizeof (data)) == sizeof (data)) {
|
||||||
|
|
||||||
/* do nothing for EV_SYN due to non-blocking read.
|
/* do nothing for EV_SYN due to non-blocking read.
|
||||||
if (data.type == EV_SYN) {
|
if (data.type == EV_SYN) {
|
||||||
@@ -96,12 +91,10 @@ static int get_touch_data (short *x, short *y, short *button)
|
|||||||
if (data.type == EV_KEY) {
|
if (data.type == EV_KEY) {
|
||||||
switch (data.code) {
|
switch (data.code) {
|
||||||
case BTN_TOUCH:
|
case BTN_TOUCH:
|
||||||
if (data.value == 0) {
|
if (data.value > 0)
|
||||||
|
*button = IAL_MOUSE_LEFTBUTTON;
|
||||||
|
else
|
||||||
*button = 0;
|
*button = 0;
|
||||||
g_last_tickcount = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
g_last_tickcount = GetTickCount();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -110,7 +103,6 @@ static int get_touch_data (short *x, short *y, short *button)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (data.type == EV_ABS) {
|
else if (data.type == EV_ABS) {
|
||||||
g_last_tickcount = GetTickCount();
|
|
||||||
switch (data.code) {
|
switch (data.code) {
|
||||||
case ABS_X:
|
case ABS_X:
|
||||||
*x = data.value;
|
*x = data.value;
|
||||||
@@ -118,8 +110,7 @@ static int get_touch_data (short *x, short *y, short *button)
|
|||||||
|
|
||||||
case ABS_Y:
|
case ABS_Y:
|
||||||
*y = data.value;
|
*y = data.value;
|
||||||
*button = IAL_MOUSE_LEFTBUTTON;
|
break;
|
||||||
return 0;
|
|
||||||
|
|
||||||
case ABS_MT_POSITION_X:
|
case ABS_MT_POSITION_X:
|
||||||
*x = data.value;
|
*x = data.value;
|
||||||
@@ -127,8 +118,7 @@ static int get_touch_data (short *x, short *y, short *button)
|
|||||||
|
|
||||||
case ABS_MT_POSITION_Y:
|
case ABS_MT_POSITION_Y:
|
||||||
*y = data.value;
|
*y = data.value;
|
||||||
*button = IAL_MOUSE_LEFTBUTTON;
|
break;
|
||||||
return 0;
|
|
||||||
|
|
||||||
case ABS_MT_TOUCH_MAJOR:
|
case ABS_MT_TOUCH_MAJOR:
|
||||||
break;
|
break;
|
||||||
@@ -146,20 +136,13 @@ static int get_touch_data (short *x, short *y, short *button)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_has_auto_event) {
|
return 0;
|
||||||
g_has_auto_event = false;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mouse_update (void)
|
static int mouse_update (void)
|
||||||
{
|
{
|
||||||
static int idx = 0;
|
if (get_touch_data (&MOUSEX, &MOUSEY, &MOUSEBUTTON) == 0)
|
||||||
if (get_touch_data (&MOUSEX, &MOUSEY, &MOUSEBUTTON) == 0) {
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -210,32 +193,10 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (e < 0) {
|
else if (e < 0) {
|
||||||
if (g_last_tickcount > 0) {
|
retvalue = -1;
|
||||||
DWORD tickcount = GetTickCount();
|
|
||||||
if (tickcount - g_last_tickcount >= AUTO_MOUSE_UP_TICKCOUNT) {
|
|
||||||
MOUSEBUTTON = 0;
|
|
||||||
retvalue |= IAL_MOUSEEVENT;
|
|
||||||
g_last_tickcount = 0;
|
|
||||||
g_has_auto_event = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
retvalue = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (g_last_tickcount > 0) {
|
retvalue = 0;
|
||||||
DWORD tickcount = GetTickCount();
|
|
||||||
if (tickcount - g_last_tickcount >= AUTO_MOUSE_UP_TICKCOUNT) {
|
|
||||||
MOUSEBUTTON = 0;
|
|
||||||
retvalue |= IAL_MOUSEEVENT;
|
|
||||||
g_last_tickcount = 0;
|
|
||||||
g_has_auto_event = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
retvalue = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return retvalue;
|
return retvalue;
|
||||||
@@ -253,7 +214,7 @@ BOOL ial_InitSingleTouchKey (INPUT* input, const char* mdev, const char* mtype)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
sg_tp_event_fd = open (touch_dev, O_RDONLY);
|
sg_tp_event_fd = open (touch_dev, O_RDONLY | O_NONBLOCK);
|
||||||
if (sg_tp_event_fd < 0) {
|
if (sg_tp_event_fd < 0) {
|
||||||
_WRN_PRINTF ("failed when opening touch event device: %s\n", touch_dev);
|
_WRN_PRINTF ("failed when opening touch event device: %s\n", touch_dev);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
+16
-10
@@ -117,10 +117,22 @@
|
|||||||
#define REQID_LOADCURSOR_PNG 0x001D
|
#define REQID_LOADCURSOR_PNG 0x001D
|
||||||
// Load cursor from in-memory PNG
|
// Load cursor from in-memory PNG
|
||||||
#define REQID_LOADCURSOR_PNG_MEM 0x001E
|
#define REQID_LOADCURSOR_PNG_MEM 0x001E
|
||||||
|
|
||||||
|
#if 0 // Deprecated since 5.2.0
|
||||||
// allocate semaphore for shared surface
|
// allocate semaphore for shared surface
|
||||||
#define REQID_ALLOC_SURF_SEM 0x001F
|
#define REQID_ALLOC_SURF_SEM 0x001F
|
||||||
// free semaphore of shared surface
|
// free semaphore of shared surface
|
||||||
#define REQID_FREE_SURF_SEM 0x0020
|
#define REQID_FREE_SURF_SEM 0x0020
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Since 5.2.0 */
|
||||||
|
// Operate a shared surface to register/revoke the name and set the fd
|
||||||
|
#define REQID_OPERATENAMEDSSURF 0x001F
|
||||||
|
#define ID_NAMEDSSURFOP_REGISTER 1
|
||||||
|
#define ID_NAMEDSSURFOP_SET 2
|
||||||
|
#define ID_NAMEDSSURFOP_REVOKE 3
|
||||||
|
|
||||||
|
#define REQID_RESERVED 0x0020
|
||||||
|
|
||||||
// Move the current client to another layer
|
// Move the current client to another layer
|
||||||
#define REQID_MOVETOLAYER 0x0021
|
#define REQID_MOVETOLAYER 0x0021
|
||||||
@@ -130,14 +142,7 @@
|
|||||||
// Authenticate client
|
// Authenticate client
|
||||||
#define REQID_AUTHCLIENT 0x0023
|
#define REQID_AUTHCLIENT 0x0023
|
||||||
|
|
||||||
/* Since 5.2.0 */
|
#define REQID_SYS_LAST REQID_AUTHCLIENT
|
||||||
// Operate a shared surface to register/revoke the name and set the fd
|
|
||||||
#define REQID_OPERATENAMEDSSURF 0x0024
|
|
||||||
#define ID_NAMEDSSURFOP_REGISTER 1
|
|
||||||
#define ID_NAMEDSSURFOP_SET 2
|
|
||||||
#define ID_NAMEDSSURFOP_REVOKE 3
|
|
||||||
|
|
||||||
#define REQID_SYS_LAST REQID_OPERATENAMEDSSURF
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX: To fellows who need to add a new REQID,
|
* XXX: To fellows who need to add a new REQID,
|
||||||
@@ -163,13 +168,13 @@ typedef struct OperateNSSurfInfo
|
|||||||
|
|
||||||
/* Since 5.0.0 */
|
/* Since 5.0.0 */
|
||||||
typedef struct _SharedSurfInfo {
|
typedef struct _SharedSurfInfo {
|
||||||
|
size_t size; // whole size of the surface
|
||||||
|
off_t offset; // offset of pixel data
|
||||||
uint32_t flags; // the flags of the surface
|
uint32_t flags; // the flags of the surface
|
||||||
uint32_t width, height;
|
uint32_t width, height;
|
||||||
uint32_t pitch;
|
uint32_t pitch;
|
||||||
uint32_t name; // when use flink name
|
uint32_t name; // when use flink name
|
||||||
uint32_t drm_format; // DRM pixel format
|
uint32_t drm_format; // DRM pixel format
|
||||||
size_t size; // whole size of the surface
|
|
||||||
off_t offset; // offset of pixel data
|
|
||||||
} SHAREDSURFINFO;
|
} SHAREDSURFINFO;
|
||||||
|
|
||||||
typedef struct JoinLayerInfo {
|
typedef struct JoinLayerInfo {
|
||||||
@@ -378,6 +383,7 @@ void __mg_start_client_desktop (void);
|
|||||||
|
|
||||||
void __mg_update_window (HWND hwnd, int left, int top, int right, int bottom);
|
void __mg_update_window (HWND hwnd, int left, int top, int right, int bottom);
|
||||||
|
|
||||||
|
BOOL __mg_client_check_znode_hwnd (int slot, HWND hwnd, int cli);
|
||||||
BOOL __mg_client_check_hwnd (HWND hwnd, int cli);
|
BOOL __mg_client_check_hwnd (HWND hwnd, int cli);
|
||||||
BOOL __mg_client_on_layer_changed (GHANDLE layer_handle, int zi_shmid);
|
BOOL __mg_client_on_layer_changed (GHANDLE layer_handle, int zi_shmid);
|
||||||
|
|
||||||
|
|||||||
+6
-4
@@ -521,14 +521,16 @@ static inline void _dc_step_y (PDC pdc, int step)
|
|||||||
|
|
||||||
# define BLOCK_DRAW_SEM(pdc) \
|
# define BLOCK_DRAW_SEM(pdc) \
|
||||||
do { \
|
do { \
|
||||||
if (pdc->surface->shared_header) \
|
if (pdc->surface->shared_header) { \
|
||||||
LOCK_SURFACE_SEM (pdc->surface->shared_header->sem_num); \
|
__mg_lock_file_for_write(pdc->surface->fd); \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
# define UNBLOCK_DRAW_SEM(pdc) \
|
# define UNBLOCK_DRAW_SEM(pdc) \
|
||||||
do { \
|
do { \
|
||||||
if (pdc->surface->shared_header) \
|
if (pdc->surface->shared_header) { \
|
||||||
UNLOCK_SURFACE_SEM (pdc->surface->shared_header->sem_num); \
|
__mg_unlock_file_for_write(pdc->surface->fd); \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
# define IS_SCREEN_SURFACE(pdc) \
|
# define IS_SCREEN_SURFACE(pdc) \
|
||||||
|
|||||||
+10
-8
@@ -51,12 +51,10 @@
|
|||||||
#ifndef GUI_DRAWSEMOP_H
|
#ifndef GUI_DRAWSEMOP_H
|
||||||
#define GUI_DRAWSEMOP_H
|
#define GUI_DRAWSEMOP_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
static inline void my_sem_op (int semid, int num, int op)
|
static inline void my_sem_op (int semid, int num, int op)
|
||||||
{
|
{
|
||||||
struct sembuf sb;
|
struct sembuf sb;
|
||||||
@@ -70,6 +68,9 @@ again:
|
|||||||
if (errno == EINTR) {
|
if (errno == EINTR) {
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
_ERR_PRINTF("Failed semop: %m\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,10 +80,7 @@ again:
|
|||||||
#define LOCK_SCREEN_SEM() my_sem_op(SHAREDRES_SEMID, _IDX_SEM_SCR, -1)
|
#define LOCK_SCREEN_SEM() my_sem_op(SHAREDRES_SEMID, _IDX_SEM_SCR, -1)
|
||||||
#define UNLOCK_SCREEN_SEM() my_sem_op(SHAREDRES_SEMID, _IDX_SEM_SCR, 1)
|
#define UNLOCK_SCREEN_SEM() my_sem_op(SHAREDRES_SEMID, _IDX_SEM_SCR, 1)
|
||||||
|
|
||||||
#ifdef _MGSCHEMA_COMPOSITING
|
extern int __mg_client_id;
|
||||||
# define LOCK_SURFACE_SEM(num) my_sem_op(SHAREDRES_SEMID_SHARED_SURF, num, -1)
|
|
||||||
# define UNLOCK_SURFACE_SEM(num) my_sem_op(SHAREDRES_SEMID_SHARED_SURF, num, 1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _MGHAVE_CURSOR
|
#ifdef _MGHAVE_CURSOR
|
||||||
|
|
||||||
@@ -157,6 +155,10 @@ again:
|
|||||||
# define UNLOCK_MOUSEMOVE_SEM() my_sem_op(SHAREDRES_SEMID, _IDX_SEM_MOUSEMOVE, 1)
|
# define UNLOCK_MOUSEMOVE_SEM() my_sem_op(SHAREDRES_SEMID, _IDX_SEM_MOUSEMOVE, 1)
|
||||||
#endif /* _MGRM_PROCESSES */
|
#endif /* _MGRM_PROCESSES */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|||||||
@@ -958,9 +958,7 @@ BOOL gui_LoadIconRes(HDC hdc, const char* rdr_name, char* file);
|
|||||||
void gui_WndRect(HWND hWnd, PRECT prc);
|
void gui_WndRect(HWND hWnd, PRECT prc);
|
||||||
void gui_WndClientRect(HWND hWnd, PRECT prc);
|
void gui_WndClientRect(HWND hWnd, PRECT prc);
|
||||||
|
|
||||||
/* Undisclosed APIs */
|
HDC __mg_create_memdc_for_surface (struct GAL_Surface* surface);
|
||||||
HDC CreateMemDCFromSurface (struct GAL_Surface* surface);
|
|
||||||
struct GAL_Surface* GetSurfaceFromDC (HDC hdc);
|
|
||||||
|
|
||||||
/* Since 5.0.0 */
|
/* Since 5.0.0 */
|
||||||
#ifdef _MGRM_PROCESSES
|
#ifdef _MGRM_PROCESSES
|
||||||
|
|||||||
+9
-2
@@ -105,8 +105,15 @@ int __mg_map_get_size (map_t* map);
|
|||||||
|
|
||||||
map_entry_t* __mg_map_find (map_t* map, const void* key);
|
map_entry_t* __mg_map_find (map_t* map, const void* key);
|
||||||
|
|
||||||
int __mg_map_insert_ex (map_t* map, const void* key,
|
map_entry_t* __mg_map_insert_ex2 (map_t* map, const void* key,
|
||||||
const void* val, free_val_fn free_val_alt);
|
const void* val, free_val_fn free_val_alt);
|
||||||
|
|
||||||
|
static int __mg_map_insert_ex (map_t* map, const void* key,
|
||||||
|
const void* val, free_val_fn free_val_alt)
|
||||||
|
{
|
||||||
|
return __mg_map_insert_ex2(map, key, val, NULL) ? 0 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
static inline int __mg_map_insert (map_t* map, const void* key,
|
static inline int __mg_map_insert (map_t* map, const void* key,
|
||||||
const void* val)
|
const void* val)
|
||||||
{
|
{
|
||||||
@@ -119,7 +126,7 @@ int __mg_map_find_replace_or_insert (map_t* map, const void* key,
|
|||||||
int __mg_map_replace (map_t* map, const void* key,
|
int __mg_map_replace (map_t* map, const void* key,
|
||||||
const void* val, free_val_fn free_val_alt);
|
const void* val, free_val_fn free_val_alt);
|
||||||
|
|
||||||
int __mg_map_erase (map_t* map, void* key);
|
int __mg_map_erase (map_t* map, const void* key);
|
||||||
int __mg_map_get_size (map_t* map);
|
int __mg_map_get_size (map_t* map);
|
||||||
|
|
||||||
#if 0 /* deprecated code */
|
#if 0 /* deprecated code */
|
||||||
|
|||||||
+7
-1
@@ -79,6 +79,11 @@ struct timezone {
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
void __mg_lock_file_for_read(int fd);
|
||||||
|
void __mg_unlock_file_for_read(int fd);
|
||||||
|
void __mg_lock_file_for_write(int fd);
|
||||||
|
void __mg_unlock_file_for_write(int fd);
|
||||||
|
|
||||||
unsigned int __mg_os_get_random_seed (void);
|
unsigned int __mg_os_get_random_seed (void);
|
||||||
void __mg_os_time_delay (int ms);
|
void __mg_os_time_delay (int ms);
|
||||||
void __mg_os_start_time (void);
|
void __mg_os_start_time (void);
|
||||||
@@ -115,10 +120,11 @@ void mg_TerminateMisc (void);
|
|||||||
BOOL mg_InitSystemRes (void);
|
BOOL mg_InitSystemRes (void);
|
||||||
void mg_TerminateSystemRes (void);
|
void mg_TerminateSystemRes (void);
|
||||||
|
|
||||||
|
/* Deprecated since 5.2.0
|
||||||
#ifdef _MGSCHEMA_COMPOSITING
|
#ifdef _MGSCHEMA_COMPOSITING
|
||||||
int __mg_alloc_sem_for_shared_surf (void);
|
int __mg_alloc_sem_for_shared_surf (void);
|
||||||
int __mg_free_sem_for_shared_surf (int sem_num);
|
int __mg_free_sem_for_shared_surf (int sem_num);
|
||||||
#endif /* _MGSCHEMA_COMPOSITING */
|
#endif _MGSCHEMA_COMPOSITING */
|
||||||
|
|
||||||
size_t __mg_lookfor_unused_slot (unsigned char* bitmap, size_t len_bmp, int set);
|
size_t __mg_lookfor_unused_slot (unsigned char* bitmap, size_t len_bmp, int set);
|
||||||
|
|
||||||
|
|||||||
@@ -396,10 +396,10 @@ char * __mg_msgstr3 [] =
|
|||||||
"MSG_SRVNOTIFY", // 0x0147
|
"MSG_SRVNOTIFY", // 0x0147
|
||||||
"MSG_UPDATECLIWIN", // 0x0148
|
"MSG_UPDATECLIWIN", // 0x0148
|
||||||
"MSG_LAYERCHANGED", // 0x0149
|
"MSG_LAYERCHANGED", // 0x0149
|
||||||
"MSG_MANAGE_MSGTHREAD", // 0x014A
|
"MSG_WINCOMPOSITED", // 0x014A
|
||||||
"MSG_CALC_POSITION", // 0x014B
|
"MSG_MANAGE_MSGTHREAD", // 0x014B
|
||||||
"", // 0x014C
|
"MSG_CALC_POSITION", // 0x014C
|
||||||
"", // 0x014D
|
"MSG_WAKEUP_CLIENT", // 0x014D
|
||||||
"", // 0x014E
|
"", // 0x014E
|
||||||
"", // 0x014F
|
"", // 0x014F
|
||||||
|
|
||||||
|
|||||||
+31
-14
@@ -139,20 +139,25 @@ typedef struct _DirtyInfo {
|
|||||||
* than the creator.
|
* than the creator.
|
||||||
*/
|
*/
|
||||||
typedef struct _SharedSurfaceHeader {
|
typedef struct _SharedSurfaceHeader {
|
||||||
/* The number of semphore for this surface.
|
/* the name of the shared surface; since 5.2.0. */
|
||||||
The SysV semaphore set id for synchronizing this shared surface:
|
char name[NAME_MAX + 1];
|
||||||
SHAREDRES_SEMID_SHARED_SURF. */
|
|
||||||
int sem_num;
|
|
||||||
|
|
||||||
/* The pid of the creator */
|
/* The client identifier of the creator. */
|
||||||
pid_t creator;
|
int create_cli;
|
||||||
|
|
||||||
/* The file descriptor in context of the creator. */
|
|
||||||
int fd;
|
|
||||||
/* Not zero for hardware surface. */
|
/* Not zero for hardware surface. */
|
||||||
int byhw;
|
int byhw;
|
||||||
/* The dirty information */
|
|
||||||
GAL_DirtyInfo dirty_info;
|
/* Deprecated since 5.2.0.
|
||||||
|
The number of semphore for this surface.
|
||||||
|
The SysV semaphore set id for synchronizing this shared surface:
|
||||||
|
SHAREDRES_SEMID_SHARED_SURF.
|
||||||
|
int sem_num; */
|
||||||
|
|
||||||
|
/* Deprecated since 5.2.0.
|
||||||
|
The file descriptor in context of the creator.
|
||||||
|
int fd; */
|
||||||
|
|
||||||
/* the size of the surface */
|
/* the size of the surface */
|
||||||
int width, height;
|
int width, height;
|
||||||
/* the pitch of the surface */
|
/* the pitch of the surface */
|
||||||
@@ -166,6 +171,9 @@ typedef struct _SharedSurfaceHeader {
|
|||||||
size_t map_size;
|
size_t map_size;
|
||||||
/* the offset of pixels data */
|
/* the offset of pixels data */
|
||||||
off_t pixels_off;
|
off_t pixels_off;
|
||||||
|
|
||||||
|
/* The dirty information */
|
||||||
|
GAL_DirtyInfo dirty_info;
|
||||||
} GAL_SharedSurfaceHeader;
|
} GAL_SharedSurfaceHeader;
|
||||||
#endif /* IS_COMPOSITING_SCHEMA */
|
#endif /* IS_COMPOSITING_SCHEMA */
|
||||||
|
|
||||||
@@ -230,6 +238,8 @@ typedef struct GAL_Surface {
|
|||||||
GAL_SharedSurfaceHeader *shared_header; /* Private */
|
GAL_SharedSurfaceHeader *shared_header; /* Private */
|
||||||
/* The dirty info for non-shared surface. */
|
/* The dirty info for non-shared surface. */
|
||||||
GAL_DirtyInfo *dirty_info; /* Private */
|
GAL_DirtyInfo *dirty_info; /* Private */
|
||||||
|
/* The file descriptor if the surface is a shared surface. */
|
||||||
|
int fd; /* Private; since 5.2.0. */
|
||||||
#endif
|
#endif
|
||||||
} GAL_Surface;
|
} GAL_Surface;
|
||||||
|
|
||||||
@@ -252,6 +262,8 @@ typedef struct GAL_Surface {
|
|||||||
|
|
||||||
#define GAL_PREALLOC 0x01000000 /* Surface uses preallocated memory */
|
#define GAL_PREALLOC 0x01000000 /* Surface uses preallocated memory */
|
||||||
#define GAL_FORMAT_CHECKED 0x02000000 /* Pixman format checked */
|
#define GAL_FORMAT_CHECKED 0x02000000 /* Pixman format checked */
|
||||||
|
#define GAL_SSURF_ATTACHED 0x04000000 /* The shared surface is attached to. */
|
||||||
|
#define GAL_SSURF_LOCKED 0x08000000 /* The shared surface is locked. */
|
||||||
|
|
||||||
/* Available for GAL_SetVideoMode() */
|
/* Available for GAL_SetVideoMode() */
|
||||||
#define GAL_ANYFORMAT 0x10000000 /* Allow any video depth/pixel-format */
|
#define GAL_ANYFORMAT 0x10000000 /* Allow any video depth/pixel-format */
|
||||||
@@ -571,6 +583,11 @@ GAL_Surface *GAL_CreateRGBSurface
|
|||||||
GAL_Surface *GAL_CreateRGBSurfaceFrom (void *pixels,
|
GAL_Surface *GAL_CreateRGBSurfaceFrom (void *pixels,
|
||||||
int width, int height, int depth, int pitch,
|
int width, int height, int depth, int pitch,
|
||||||
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
|
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
|
||||||
|
/* Since 5.2.0 */
|
||||||
|
static GAL_Surface *GAL_RefSurface (GAL_Surface *surface) {
|
||||||
|
surface->refcount++;
|
||||||
|
return surface;
|
||||||
|
}
|
||||||
void GAL_FreeSurface (GAL_Surface *surface);
|
void GAL_FreeSurface (GAL_Surface *surface);
|
||||||
|
|
||||||
typedef struct REQ_HWSURFACE {
|
typedef struct REQ_HWSURFACE {
|
||||||
@@ -651,11 +668,11 @@ GAL_Surface *GAL_CreateSurfaceForZNodeAs (const GAL_Surface* ref_surf,
|
|||||||
void GAL_FreeSharedSurfaceData (GAL_Surface *surface);
|
void GAL_FreeSharedSurfaceData (GAL_Surface *surface);
|
||||||
|
|
||||||
/* Attach to a shared RGB surface. */
|
/* Attach to a shared RGB surface. */
|
||||||
GAL_Surface *GAL_AttachSharedRGBSurface (int fd, size_t map_size,
|
GAL_Surface *GAL_AttachSharedRGBSurface (GAL_VideoDevice* video,
|
||||||
Uint32 flags, BOOL with_wr);
|
int fd, size_t map_size, Uint32 flags, BOOL with_wr);
|
||||||
|
|
||||||
/* Dettach from a shared RGB surface from the specific video device. */
|
/* Detach from a shared RGB surface from the specific video device. */
|
||||||
void GAL_DettachSharedSurfaceData (GAL_Surface *surface);
|
void GAL_DetachSharedSurfaceData (GAL_Surface *surface);
|
||||||
|
|
||||||
/* Create a cursor surface from the specific video device. */
|
/* Create a cursor surface from the specific video device. */
|
||||||
GAL_Surface* GAL_CreateCursorSurface (GAL_VideoDevice* video,
|
GAL_Surface* GAL_CreateCursorSurface (GAL_VideoDevice* video,
|
||||||
|
|||||||
@@ -135,6 +135,9 @@ void __mg_release_global_res (int cli);
|
|||||||
/* Since 5.2.0 */
|
/* Since 5.2.0 */
|
||||||
int __mg_nssurf_map_new(void);
|
int __mg_nssurf_map_new(void);
|
||||||
void __mg_nssurf_map_delete(void);
|
void __mg_nssurf_map_delete(void);
|
||||||
|
int __mg_nssurf_map_operate_srv(const OPERATENSSURFINFO* req_info,
|
||||||
|
int cli, int fd);
|
||||||
|
int __mg_get_shared_surface_srv(const char *itn_name, SHAREDSURFINFO *info);
|
||||||
|
|
||||||
void __mg_remove_client (int cli, int clifd);
|
void __mg_remove_client (int cli, int clifd);
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ typedef struct tagG_RES {
|
|||||||
|
|
||||||
int nr_layers;
|
int nr_layers;
|
||||||
int semid_layer;
|
int semid_layer;
|
||||||
#ifdef _MGSCHEMA_COMPOSITING
|
#if 0 && defined(_MGSCHEMA_COMPOSITING) // deprecated since 5.2.0
|
||||||
int semid_shared_surf; /* the id of semaphore set for shared surfaces */
|
int semid_shared_surf; /* the id of semaphore set for shared surfaces */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ typedef G_RES* PG_RES;
|
|||||||
#define SHAREDRES_NR_LAYSERS (((PG_RES)mgSharedRes)->nr_layers)
|
#define SHAREDRES_NR_LAYSERS (((PG_RES)mgSharedRes)->nr_layers)
|
||||||
#define SHAREDRES_SEMID_LAYER (((PG_RES)mgSharedRes)->semid_layer)
|
#define SHAREDRES_SEMID_LAYER (((PG_RES)mgSharedRes)->semid_layer)
|
||||||
|
|
||||||
#ifdef _MGSCHEMA_COMPOSITING
|
#if 0 && defined(_MGSCHEMA_COMPOSITING) // Deprecated since 5.2.0
|
||||||
# define SHAREDRES_SEMID_SHARED_SURF (((PG_RES)mgSharedRes)->semid_shared_surf)
|
# define SHAREDRES_SEMID_SHARED_SURF (((PG_RES)mgSharedRes)->semid_shared_surf)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -679,6 +679,19 @@ static BOOL merge_dirty_ppp (CompositorCtxt* ctxt, MG_Layer* layer, int zidx)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
static void dump_dirty_region(CompositorCtxt* ctxt, const char *prefix, int zidx)
|
||||||
|
{
|
||||||
|
CLIPRGN* rgn = &ctxt->dirty_rgn;
|
||||||
|
_WRN_PRINTF("%s (%d): dirty region on screen: (%d, %d) %d x %d; "
|
||||||
|
"highest dirty win: %d; lowest dirty win: %d\n",
|
||||||
|
prefix, zidx,
|
||||||
|
rgn->rcBound.left, rgn->rcBound.top,
|
||||||
|
RECTW (rgn->rcBound), RECTH (rgn->rcBound),
|
||||||
|
ctxt->highest_dirty_win, ctxt->lowest_dirty_win);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static BOOL merge_dirty_win (CompositorCtxt* ctxt, MG_Layer* layer, int zidx)
|
static BOOL merge_dirty_win (CompositorCtxt* ctxt, MG_Layer* layer, int zidx)
|
||||||
{
|
{
|
||||||
BOOL rc = FALSE;
|
BOOL rc = FALSE;
|
||||||
@@ -722,9 +735,13 @@ static BOOL merge_dirty_wpp (CompositorCtxt* ctxt, MG_Layer* layer)
|
|||||||
static 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. */
|
/* the fallback compositor only manages znodes on the topmost layer. */
|
||||||
if (layer != mgTopmostLayer || IsEmptyClipRgn (&ctxt->dirty_rgn))
|
if (layer != mgTopmostLayer)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if (IsEmptyClipRgn (&ctxt->dirty_rgn)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (ctxt->highest_dirty_ppp >= 0) {
|
if (ctxt->highest_dirty_ppp >= 0) {
|
||||||
composite_ppp_znodes (ctxt);
|
composite_ppp_znodes (ctxt);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#define _DEBUG
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#if defined(_MGRM_PROCESSES) && defined(_MGSCHEMA_COMPOSITING)
|
#if defined(_MGRM_PROCESSES) && defined(_MGSCHEMA_COMPOSITING)
|
||||||
@@ -69,6 +68,7 @@
|
|||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "zorder.h"
|
#include "zorder.h"
|
||||||
#include "dc.h"
|
#include "dc.h"
|
||||||
|
#include "server.h"
|
||||||
|
|
||||||
#define MAX_NR_COMPOSITORS 8
|
#define MAX_NR_COMPOSITORS 8
|
||||||
#define LEN_COMPOSITOR_NAME 15
|
#define LEN_COMPOSITOR_NAME 15
|
||||||
@@ -133,31 +133,51 @@ static void lock_znode_surface (PDC pdc, ZORDERNODE* node)
|
|||||||
{
|
{
|
||||||
if (node->lock_count == 0) {
|
if (node->lock_count == 0) {
|
||||||
if (pdc->surface->shared_header) {
|
if (pdc->surface->shared_header) {
|
||||||
LOCK_SURFACE_SEM (pdc->surface->shared_header->sem_num);
|
__mg_lock_file_for_read(pdc->surface->fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
node->dirty_age = pdc->surface->dirty_info->dirty_age;
|
node->dirty_age = pdc->surface->dirty_info->dirty_age;
|
||||||
node->nr_dirty_rcs = pdc->surface->dirty_info->nr_dirty_rcs;
|
node->nr_dirty_rcs = pdc->surface->dirty_info->nr_dirty_rcs;
|
||||||
node->dirty_rcs = pdc->surface->dirty_info->dirty_rcs;
|
node->dirty_rcs = pdc->surface->dirty_info->dirty_rcs;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
node->lock_count++;
|
node->lock_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unlock_znode_surface (PDC pdc, ZORDERNODE* node)
|
static BOOL unlock_znode_surface (PDC pdc, ZORDERNODE* node)
|
||||||
{
|
{
|
||||||
|
BOOL need_reset = FALSE;
|
||||||
if (node->lock_count > 0) {
|
if (node->lock_count > 0) {
|
||||||
node->lock_count--;
|
node->lock_count--;
|
||||||
if (node->lock_count == 0) {
|
if (node->lock_count == 0) {
|
||||||
if (pdc->surface->shared_header)
|
if (node->changes != pdc->surface->dirty_info->dirty_age) {
|
||||||
UNLOCK_SURFACE_SEM (pdc->surface->shared_header->sem_num);
|
node->changes = pdc->surface->dirty_info->dirty_age;
|
||||||
|
need_reset = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pdc->surface->shared_header) {
|
||||||
|
__mg_unlock_file_for_read(pdc->surface->fd);
|
||||||
|
}
|
||||||
|
|
||||||
node->dirty_age = 0;
|
node->dirty_age = 0;
|
||||||
node->nr_dirty_rcs = 0;
|
node->nr_dirty_rcs = 0;
|
||||||
node->dirty_rcs = NULL;
|
node->dirty_rcs = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return need_reset;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void reset_znode_surface_dirty (PDC pdc, ZORDERNODE* node, int slot)
|
||||||
|
{
|
||||||
|
if (node->cli == 0 || slot == 0) {
|
||||||
|
pdc->surface->dirty_info->nr_dirty_rcs = 0;
|
||||||
|
}
|
||||||
|
else if (node->hwnd) {
|
||||||
|
MSG msg = { HWND_NULL, MSG_WINCOMPOSITED,
|
||||||
|
slot, (LPARAM)node->hwnd, (DWORD)node->changes };
|
||||||
|
__mg_send2client(&msg, mgClients + node->cli);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 /* not optimized */
|
#if 0 /* not optimized */
|
||||||
@@ -322,10 +342,8 @@ static void composite_layer (MG_Layer* layer, CompositorCtxt* ctxt,
|
|||||||
nodes = GET_MENUNODE(zi);
|
nodes = GET_MENUNODE(zi);
|
||||||
for (i = 0; i < zi->nr_popupmenus; i++) {
|
for (i = 0; i < zi->nr_popupmenus; i++) {
|
||||||
pdc = dc_HDC2PDC (nodes[i].mem_dc);
|
pdc = dc_HDC2PDC (nodes[i].mem_dc);
|
||||||
|
if (unlock_znode_surface (pdc, nodes + i))
|
||||||
nodes[i].changes = pdc->surface->dirty_info->dirty_age;
|
reset_znode_surface_dirty (pdc, nodes + i, i);
|
||||||
pdc->surface->dirty_info->nr_dirty_rcs = 0;
|
|
||||||
unlock_znode_surface (pdc, nodes + i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,9 +353,8 @@ static void composite_layer (MG_Layer* layer, CompositorCtxt* ctxt,
|
|||||||
while ((next = __kernel_get_next_znode (zi, next)) > 0) {
|
while ((next = __kernel_get_next_znode (zi, next)) > 0) {
|
||||||
if (nodes [next].flags & ZOF_VISIBLE) {
|
if (nodes [next].flags & ZOF_VISIBLE) {
|
||||||
pdc = dc_HDC2PDC (nodes[next].mem_dc);
|
pdc = dc_HDC2PDC (nodes[next].mem_dc);
|
||||||
nodes[next].changes = pdc->surface->dirty_info->dirty_age;
|
if (unlock_znode_surface (pdc, nodes + next))
|
||||||
pdc->surface->dirty_info->nr_dirty_rcs = 0;
|
reset_znode_surface_dirty (pdc, nodes + next, next);
|
||||||
unlock_znode_surface (pdc, nodes + next);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,9 +363,8 @@ static void composite_layer (MG_Layer* layer, CompositorCtxt* ctxt,
|
|||||||
if (layer == mgTopmostLayer) {
|
if (layer == mgTopmostLayer) {
|
||||||
pdc = dc_HDC2PDC (HDC_SCREEN);
|
pdc = dc_HDC2PDC (HDC_SCREEN);
|
||||||
if (pdc->surface->w > 0 && pdc->surface->h > 0) {
|
if (pdc->surface->w > 0 && pdc->surface->h > 0) {
|
||||||
nodes[0].changes = pdc->surface->dirty_info->dirty_age;
|
if (unlock_znode_surface (pdc, nodes))
|
||||||
pdc->surface->dirty_info->nr_dirty_rcs = 0;
|
reset_znode_surface_dirty (pdc, nodes, 0);
|
||||||
unlock_znode_surface (pdc, nodes);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+36
-16
@@ -365,7 +365,7 @@ static intptr_t cliAllocZOrderNode (PMAINWIN pWin, const COMPOSITINGINFO* ct_inf
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ClientRequestEx2 (&req, caption, strlen(caption) + 1,
|
if (ClientRequestEx2 (&req, caption, strlen(caption) + 1,
|
||||||
pWin->surf->shared_header->fd,
|
pWin->surf->fd,
|
||||||
&ret, sizeof (intptr_t), NULL) < 0)
|
&ret, sizeof (intptr_t), NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
#else /* ndef _MGSCHEMA_COMPOSITING */
|
#else /* ndef _MGSCHEMA_COMPOSITING */
|
||||||
@@ -524,7 +524,7 @@ static intptr_t cliStartTrackPopupMenu (PTRACKMENUINFO ptmi)
|
|||||||
|
|
||||||
info.surf_flags = surf->flags;
|
info.surf_flags = surf->flags;
|
||||||
info.surf_size = surf->shared_header->map_size;
|
info.surf_size = surf->shared_header->map_size;
|
||||||
if (ClientRequestEx2 (&req, NULL, 0, surf->shared_header->fd,
|
if (ClientRequestEx2 (&req, NULL, 0, surf->fd,
|
||||||
&ret, sizeof (intptr_t), NULL) < 0)
|
&ret, sizeof (intptr_t), NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -837,8 +837,10 @@ static int srvAllocZOrderNode (int cli, HWND hwnd, HWND main_win,
|
|||||||
surf->refcount++;
|
surf->refcount++;
|
||||||
}
|
}
|
||||||
else if (fd >= 0) {
|
else if (fd >= 0) {
|
||||||
surf = GAL_AttachSharedRGBSurface (fd, surf_size, surf_flags, TRUE);
|
surf = GAL_AttachSharedRGBSurface (NULL, fd,
|
||||||
close (fd);
|
surf_size, surf_flags, TRUE);
|
||||||
|
/* Since 5.2.0: keep fd available.
|
||||||
|
close (fd); */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_ERR_PRINTF("KERNEL: not server but fd for shared surface is invalid\n");
|
_ERR_PRINTF("KERNEL: not server but fd for shared surface is invalid\n");
|
||||||
@@ -846,7 +848,7 @@ static int srvAllocZOrderNode (int cli, HWND hwnd, HWND main_win,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (surf) {
|
if (surf) {
|
||||||
memdc = CreateMemDCFromSurface (surf);
|
memdc = __mg_create_memdc_for_surface (surf);
|
||||||
if (memdc == HDC_INVALID) {
|
if (memdc == HDC_INVALID) {
|
||||||
if (cli > 0) {
|
if (cli > 0) {
|
||||||
GAL_FreeSurface (surf);
|
GAL_FreeSurface (surf);
|
||||||
@@ -994,12 +996,14 @@ static int srvMoveWindow (int cli, int idx_znode, const RECT* rcWin,
|
|||||||
surf->refcount++;
|
surf->refcount++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
surf = GAL_AttachSharedRGBSurface (fd, surf_size, surf_flags, TRUE);
|
surf = GAL_AttachSharedRGBSurface (NULL, fd,
|
||||||
close (fd);
|
surf_size, surf_flags, TRUE);
|
||||||
|
/* Since 5.2.0: keep fd available.
|
||||||
|
close (fd); */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surf) {
|
if (surf) {
|
||||||
memdc = CreateMemDCFromSurface (surf);
|
memdc = __mg_create_memdc_for_surface (surf);
|
||||||
if (memdc == HDC_INVALID) {
|
if (memdc == HDC_INVALID) {
|
||||||
if (cli > 0) {
|
if (cli > 0) {
|
||||||
GAL_FreeSurface (surf);
|
GAL_FreeSurface (surf);
|
||||||
@@ -1014,7 +1018,6 @@ static int srvMoveWindow (int cli, int idx_znode, const RECT* rcWin,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* def _MGSCHEMA_COMPOSITING */
|
#endif /* def _MGSCHEMA_COMPOSITING */
|
||||||
|
|
||||||
ret = dskMoveWindow (cli, idx_znode, memdc, rcWin);
|
ret = dskMoveWindow (cli, idx_znode, memdc, rcWin);
|
||||||
@@ -2208,7 +2211,7 @@ static int resize_window_surface (PMAINWIN pWin, const RECT* prcResult)
|
|||||||
|
|
||||||
pWin->surf = new_surf;
|
pWin->surf = new_surf;
|
||||||
if (pWin->surf->shared_header)
|
if (pWin->surf->shared_header)
|
||||||
return pWin->surf->shared_header->fd;
|
return pWin->surf->fd;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2253,9 +2256,10 @@ static int dskMoveGlobalControl (PMAINWIN pCtrl, RECT* prcExpect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MGSCHEMA_COMPOSITING
|
#ifdef _MGSCHEMA_COMPOSITING
|
||||||
if (pCtrl->surf->shared_header && pCtrl->surf->shared_header->fd >= 0) {
|
/* Since 5.2.0: keep fd available. */
|
||||||
close (pCtrl->surf->shared_header->fd);
|
if (0 && pCtrl->surf->shared_header && pCtrl->surf->fd >= 0) {
|
||||||
pCtrl->surf->shared_header->fd = -1;
|
close (pCtrl->surf->fd);
|
||||||
|
pCtrl->surf->fd = -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2284,9 +2288,10 @@ static int dskMoveMainWindow (PMAINWIN pWin, RECT* prcExpect)
|
|||||||
__mg_update_dc_on_surface_changed ((HWND)pWin, pWin->surf);
|
__mg_update_dc_on_surface_changed ((HWND)pWin, pWin->surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pWin->surf->shared_header && pWin->surf->shared_header->fd >= 0) {
|
/* Since 5.2.0: keep fd available. */
|
||||||
close (pWin->surf->shared_header->fd);
|
if (0 && pWin->surf->shared_header && pWin->surf->fd >= 0) {
|
||||||
pWin->surf->shared_header->fd = -1;
|
close (pWin->surf->fd);
|
||||||
|
pWin->surf->fd = -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2902,6 +2907,21 @@ int __mg_handle_mouse_hook (int message, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
#endif /* deprecated code */
|
#endif /* deprecated code */
|
||||||
|
|
||||||
|
/* used by client to check the validation of a hwnd in the given znode slot. */
|
||||||
|
BOOL __mg_client_check_znode_hwnd (int slot, HWND hwnd, int cli)
|
||||||
|
{
|
||||||
|
BOOL ret = FALSE;
|
||||||
|
ZORDERINFO* zi = __mg_zorder_info;
|
||||||
|
ZORDERNODE* nodes;
|
||||||
|
|
||||||
|
nodes = GET_ZORDERNODE(zi);
|
||||||
|
lock_zi_for_read (zi);
|
||||||
|
if (nodes[slot].hwnd == hwnd && nodes[slot].cli == cli)
|
||||||
|
ret = TRUE;
|
||||||
|
unlock_zi_for_read (zi);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* used by client to check the validation of a hwnd */
|
/* used by client to check the validation of a hwnd */
|
||||||
BOOL __mg_client_check_hwnd (HWND hwnd, int cli)
|
BOOL __mg_client_check_hwnd (HWND hwnd, int cli)
|
||||||
{
|
{
|
||||||
|
|||||||
+10
-3
@@ -1603,8 +1603,10 @@ static int srvStartTrackPopupMenu (int cli, const RECT* rc, HWND ptmi,
|
|||||||
surf->refcount++;
|
surf->refcount++;
|
||||||
}
|
}
|
||||||
else if (fd >= 0) {
|
else if (fd >= 0) {
|
||||||
surf = GAL_AttachSharedRGBSurface (fd, surf_size, surf_flags, TRUE);
|
surf = GAL_AttachSharedRGBSurface (NULL, fd,
|
||||||
close (fd);
|
surf_size, surf_flags, TRUE);
|
||||||
|
/* Since 5.2.0: keep fd available.
|
||||||
|
close (fd); */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_WRN_PRINTF("not server but fd for shared surface is invalid\n");
|
_WRN_PRINTF("not server but fd for shared surface is invalid\n");
|
||||||
@@ -1612,7 +1614,7 @@ static int srvStartTrackPopupMenu (int cli, const RECT* rc, HWND ptmi,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (surf) {
|
if (surf) {
|
||||||
memdc = CreateMemDCFromSurface (surf);
|
memdc = __mg_create_memdc_for_surface (surf);
|
||||||
if (memdc == HDC_INVALID) {
|
if (memdc == HDC_INVALID) {
|
||||||
GAL_FreeSurface (surf);
|
GAL_FreeSurface (surf);
|
||||||
_WRN_PRINTF("failed to create memory dc for znode\n");
|
_WRN_PRINTF("failed to create memory dc for znode\n");
|
||||||
@@ -1646,11 +1648,14 @@ static int srvStartTrackPopupMenu (int cli, const RECT* rc, HWND ptmi,
|
|||||||
menu_nodes [zi->nr_popupmenus].flags = ZOF_TYPE_POPUPMENU;
|
menu_nodes [zi->nr_popupmenus].flags = ZOF_TYPE_POPUPMENU;
|
||||||
menu_nodes [zi->nr_popupmenus].rc = *rc;
|
menu_nodes [zi->nr_popupmenus].rc = *rc;
|
||||||
menu_nodes [zi->nr_popupmenus].hwnd = ptmi;
|
menu_nodes [zi->nr_popupmenus].hwnd = ptmi;
|
||||||
|
menu_nodes [zi->nr_popupmenus].cli = 0;
|
||||||
#ifdef _MGSCHEMA_COMPOSITING
|
#ifdef _MGSCHEMA_COMPOSITING
|
||||||
menu_nodes [zi->nr_popupmenus].changes = 0;
|
menu_nodes [zi->nr_popupmenus].changes = 0;
|
||||||
menu_nodes [zi->nr_popupmenus].ct = CT_OPAQUE;
|
menu_nodes [zi->nr_popupmenus].ct = CT_OPAQUE;
|
||||||
menu_nodes [zi->nr_popupmenus].ct_arg = 0;
|
menu_nodes [zi->nr_popupmenus].ct_arg = 0;
|
||||||
menu_nodes [zi->nr_popupmenus].mem_dc = memdc;
|
menu_nodes [zi->nr_popupmenus].mem_dc = memdc;
|
||||||
|
menu_nodes [zi->nr_popupmenus].dirty_age = 0;
|
||||||
|
menu_nodes [zi->nr_popupmenus].nr_dirty_rcs = 0;
|
||||||
menu_nodes [zi->nr_popupmenus].dirty_rcs = NULL;
|
menu_nodes [zi->nr_popupmenus].dirty_rcs = NULL;
|
||||||
#endif
|
#endif
|
||||||
menu_nodes [zi->nr_popupmenus].priv_data = NULL;
|
menu_nodes [zi->nr_popupmenus].priv_data = NULL;
|
||||||
@@ -2356,6 +2361,8 @@ static int AllocZOrderNodeEx (ZORDERINFO* zi, int cli, HWND hwnd, HWND main_win,
|
|||||||
nodes [free_slot].ct = validate_compositing_type (flags, ct);
|
nodes [free_slot].ct = validate_compositing_type (flags, ct);
|
||||||
nodes [free_slot].ct_arg = ct_arg;
|
nodes [free_slot].ct_arg = ct_arg;
|
||||||
nodes [free_slot].mem_dc = mem_dc;
|
nodes [free_slot].mem_dc = mem_dc;
|
||||||
|
nodes [free_slot].dirty_age = 0;
|
||||||
|
nodes [free_slot].nr_dirty_rcs = 0;
|
||||||
nodes [free_slot].dirty_rcs = NULL;
|
nodes [free_slot].dirty_rcs = NULL;
|
||||||
#else
|
#else
|
||||||
nodes [free_slot].age = 1;
|
nodes [free_slot].age = 1;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ EXTRA_DIST= misc.c systext.c rwops.c endianrw.c nposix.c clipboard.c \
|
|||||||
|
|
||||||
libmisc_la_SOURCES = misc.c systext.c rwops.c endianrw.c nposix.c clipboard.c \
|
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 \
|
math.c about.c license.c anon_file.c rbtree.c map.c \
|
||||||
error.c sockio.c
|
error.c sockio.c lock_file.c
|
||||||
|
|
||||||
SRC_FILES = $(libmisc_la_SOURCES)
|
SRC_FILES = $(libmisc_la_SOURCES)
|
||||||
LIB_NAME=libmisc
|
LIB_NAME=libmisc
|
||||||
|
|||||||
+1
-1
@@ -114,7 +114,7 @@ static LRESULT AboutWinProc (HWND hWnd, UINT message,
|
|||||||
DrawText (hdc,
|
DrawText (hdc,
|
||||||
"MiniGUI -- a mature cross-platform windowing system "
|
"MiniGUI -- a mature cross-platform windowing system "
|
||||||
"and GUI support system for embedded or IoT devices.\n\n"
|
"and GUI support system for embedded or IoT devices.\n\n"
|
||||||
"Copyright (C) 2002 ~ 2020 FMSoft Co., Ltd.",
|
"Copyright (C) 2002 ~ 2023 FMSoft Co., Ltd.",
|
||||||
-1, &rcClient, DT_WORDBREAK | DT_CENTER);
|
-1, &rcClient, DT_WORDBREAK | DT_CENTER);
|
||||||
|
|
||||||
EndPaint (hWnd, hdc);
|
EndPaint (hWnd, hdc);
|
||||||
|
|||||||
@@ -0,0 +1,112 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// IMPORTANT NOTICE
|
||||||
|
//
|
||||||
|
// The following open source license statement does not apply to any
|
||||||
|
// entity in the Exception List published by FMSoft.
|
||||||
|
//
|
||||||
|
// For more information, please visit:
|
||||||
|
//
|
||||||
|
// https://www.fmsoft.cn/exception-list
|
||||||
|
//
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
/*
|
||||||
|
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||||
|
* and Graphics User Interface (GUI) support system for embedded systems
|
||||||
|
* and smart IoT devices.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2023, Beijing FMSoft Technologies Co., Ltd.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Or,
|
||||||
|
*
|
||||||
|
* As this program is a library, any link to this program must follow
|
||||||
|
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||||
|
* GPLv3, you need to be licensed from FMSoft.
|
||||||
|
*
|
||||||
|
* If you have got a commercial license of this program, please use it
|
||||||
|
* under the terms and conditions of the commercial license.
|
||||||
|
*
|
||||||
|
* For more information about the commercial license, please refer to
|
||||||
|
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
** lock_file.c: This file include functions for locking/unlocking a file.
|
||||||
|
**
|
||||||
|
** Create date: 2023/09/10
|
||||||
|
**
|
||||||
|
** Current maintainer: Wei Yongming.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
#ifndef __NOUNIX__
|
||||||
|
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/file.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
void __mg_lock_file_for_read(int fd)
|
||||||
|
{
|
||||||
|
struct flock lock;
|
||||||
|
|
||||||
|
lock.l_type = F_RDLCK;
|
||||||
|
lock.l_whence = SEEK_SET;
|
||||||
|
lock.l_start = 0;
|
||||||
|
lock.l_len = 0;
|
||||||
|
|
||||||
|
while (fcntl(fd, F_SETLKW, &lock) == -1 && errno == EINTR);
|
||||||
|
}
|
||||||
|
|
||||||
|
void __mg_unlock_file_for_read(int fd)
|
||||||
|
{
|
||||||
|
struct flock lock;
|
||||||
|
|
||||||
|
lock.l_type = F_UNLCK;
|
||||||
|
lock.l_whence = SEEK_SET;
|
||||||
|
lock.l_start = 0;
|
||||||
|
lock.l_len = 0;
|
||||||
|
|
||||||
|
fcntl(fd, F_SETLK, &lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
void __mg_lock_file_for_write(int fd)
|
||||||
|
{
|
||||||
|
struct flock lock;
|
||||||
|
|
||||||
|
lock.l_type = F_WRLCK;
|
||||||
|
lock.l_whence = SEEK_SET;
|
||||||
|
lock.l_start = 0;
|
||||||
|
lock.l_len = 0;
|
||||||
|
|
||||||
|
while (fcntl(fd, F_SETLKW, &lock) == -1 && errno == EINTR);
|
||||||
|
}
|
||||||
|
|
||||||
|
void __mg_unlock_file_for_write(int fd)
|
||||||
|
{
|
||||||
|
struct flock lock;
|
||||||
|
|
||||||
|
lock.l_type = F_UNLCK;
|
||||||
|
lock.l_whence = SEEK_SET;
|
||||||
|
lock.l_start = 0;
|
||||||
|
lock.l_len = 0;
|
||||||
|
|
||||||
|
fcntl(fd, F_SETLK, &lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __NOUNIX__ */
|
||||||
+5
-5
@@ -243,7 +243,7 @@ map_entry_t* __mg_map_find (map_t* map, const void* key)
|
|||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
int __mg_map_erase (map_t* map, void* key)
|
int __mg_map_erase (map_t* map, const void* key)
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
map_entry_t* entry = NULL;
|
map_entry_t* entry = NULL;
|
||||||
@@ -299,7 +299,7 @@ ret:
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int __mg_map_insert_ex (map_t* map, const void* key,
|
map_entry_t* __mg_map_insert_ex2 (map_t* map, const void* key,
|
||||||
const void* val, free_val_fn free_val_alt)
|
const void* val, free_val_fn free_val_alt)
|
||||||
{
|
{
|
||||||
map_entry_t **pentry;
|
map_entry_t **pentry;
|
||||||
@@ -307,7 +307,7 @@ int __mg_map_insert_ex (map_t* map, const void* key,
|
|||||||
map_entry_t *parent;
|
map_entry_t *parent;
|
||||||
|
|
||||||
if (map == NULL)
|
if (map == NULL)
|
||||||
return -1;
|
return NULL;
|
||||||
|
|
||||||
WRLOCK_MAP (map);
|
WRLOCK_MAP (map);
|
||||||
|
|
||||||
@@ -317,7 +317,7 @@ int __mg_map_insert_ex (map_t* map, const void* key,
|
|||||||
|
|
||||||
while (*pentry) {
|
while (*pentry) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (map->comp_key)
|
if (map->comp_key)
|
||||||
ret = map->comp_key (key, (*pentry)->key);
|
ret = map->comp_key (key, (*pentry)->key);
|
||||||
else
|
else
|
||||||
@@ -354,7 +354,7 @@ int __mg_map_insert_ex (map_t* map, const void* key,
|
|||||||
}
|
}
|
||||||
|
|
||||||
UNLOCK_MAP (map);
|
UNLOCK_MAP (map);
|
||||||
return 0;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
int __mg_map_find_replace_or_insert (map_t* map, const void* key,
|
int __mg_map_find_replace_or_insert (map_t* map, const void* key,
|
||||||
|
|||||||
@@ -96,8 +96,12 @@ static BITMAP_TYPE_INFO bitmap_types [MAX_BITMAP_TYPES] =
|
|||||||
{ "jpeg", __mg_init_jpg, __mg_load_jpg, __mg_cleanup_jpg, __mg_save_jpg, __mg_check_jpg },
|
{ "jpeg", __mg_init_jpg, __mg_load_jpg, __mg_cleanup_jpg, __mg_save_jpg, __mg_check_jpg },
|
||||||
#endif
|
#endif
|
||||||
#ifdef _MGIMAGE_PNG
|
#ifdef _MGIMAGE_PNG
|
||||||
|
#if _MGLIBPNG_VER == 16
|
||||||
|
{ "png", __mg_init_png, __mg_load_png, __mg_cleanup_png, __mg_save_png, __mg_check_png },
|
||||||
|
#else
|
||||||
{ "png", __mg_init_png, __mg_load_png, __mg_cleanup_png, NULL, __mg_check_png },
|
{ "png", __mg_init_png, __mg_load_png, __mg_cleanup_png, NULL, __mg_check_png },
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#ifdef _MGIMAGE_WEBP
|
#ifdef _MGIMAGE_WEBP
|
||||||
{ "webp", __mg_init_webp, __mg_load_webp, __mg_cleanup_webp, NULL, __mg_check_webp },
|
{ "webp", __mg_init_webp, __mg_load_webp, __mg_cleanup_webp, NULL, __mg_check_webp },
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -381,6 +381,287 @@ BOOL __mg_check_png (MG_RWops* fp)
|
|||||||
return png_check_sig (sig, 8);
|
return png_check_sig (sig, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void png_error_callback (png_structp png, png_const_charp error_msg)
|
||||||
|
{
|
||||||
|
int *error = png_get_error_ptr (png);
|
||||||
|
|
||||||
|
*error = ERR_BMP_CANT_SAVE;
|
||||||
|
|
||||||
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
|
longjmp (png_jmpbuf (png), 1);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void png_warning_callback (png_structp png, png_const_charp error_msg)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void png_output_flush_fn (png_structp png_ptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void my_write_data_fn (png_structp png_ptr, png_bytep data,
|
||||||
|
png_size_t length)
|
||||||
|
{
|
||||||
|
png_size_t check;
|
||||||
|
png_voidp io_ptr = png_get_io_ptr(png_ptr);
|
||||||
|
|
||||||
|
if (MGUI_RWwrite((MG_RWops*)io_ptr, data, 1, length) !=
|
||||||
|
(size_t) length) {
|
||||||
|
png_error(png_ptr, "Write Error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef BYTE* (*MYBITMAP_get_pixel_row)(unsigned int cinfo,
|
||||||
|
MYBITMAP* mybmp,RGB* pal);
|
||||||
|
|
||||||
|
static BYTE* MYBITMAP_get_pixel_row_pal16(unsigned int next_scanline,
|
||||||
|
MYBITMAP* mybmp, RGB* pal)
|
||||||
|
{
|
||||||
|
RGB rgb0, rgb1;
|
||||||
|
|
||||||
|
BYTE *bits = mybmp->bits + next_scanline * mybmp->pitch;
|
||||||
|
int nr_data = mybmp->w * 4;
|
||||||
|
BYTE *data = (BYTE *)malloc(nr_data);
|
||||||
|
uint8_t alpha = 0xFF;
|
||||||
|
|
||||||
|
for (int i = 0, j = 0, end_i = (mybmp->w + 1) >> 1; i < end_i; ++i) {
|
||||||
|
|
||||||
|
rgb0 = pal[ (bits[ i ] & 0XF0) >> 4 ];
|
||||||
|
rgb1 = pal[ bits[ i ] & 0X0F ];
|
||||||
|
|
||||||
|
data[ j ++ ] = rgb0.r;
|
||||||
|
data[ j ++ ] = rgb0.g;
|
||||||
|
data[ j ++ ] = rgb0.b;
|
||||||
|
data[ j ++ ] = alpha;
|
||||||
|
|
||||||
|
data[ j ++ ] = rgb1.r;
|
||||||
|
data[ j ++ ] = rgb1.g;
|
||||||
|
data[ j ++ ] = rgb1.b;
|
||||||
|
data[ j ++ ] = alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BYTE* MYBITMAP_get_pixel_row_pal256(unsigned int next_scanline,
|
||||||
|
MYBITMAP* mybmp, RGB* pal)
|
||||||
|
{
|
||||||
|
RGB rgb;
|
||||||
|
BYTE *bits = mybmp->bits + next_scanline * mybmp->pitch;
|
||||||
|
|
||||||
|
int nr_data = mybmp->w * 4;
|
||||||
|
BYTE *data = (BYTE *)malloc(nr_data);
|
||||||
|
uint8_t alpha = 0xFF;
|
||||||
|
|
||||||
|
for (int i = 0, j = 0; i < mybmp->w; i++, j += 4) {
|
||||||
|
rgb = pal [bits[i] ];
|
||||||
|
|
||||||
|
data[0] = rgb.r;
|
||||||
|
data[1] = rgb.g;
|
||||||
|
data[2] = rgb.b;
|
||||||
|
data[3] = alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define RGB_FROM_RGB565(pixel, r, g, b) \
|
||||||
|
{ \
|
||||||
|
r = (((pixel&0xF800)>>11)<<3); \
|
||||||
|
g = (((pixel&0x07E0)>>5)<<2); \
|
||||||
|
b = ((pixel&0x001F)<<3); \
|
||||||
|
}
|
||||||
|
|
||||||
|
static BYTE* MYBITMAP_get_pixel_row_RGB565(unsigned int next_scanline,
|
||||||
|
MYBITMAP* mybmp, RGB* pal)
|
||||||
|
{
|
||||||
|
Uint16* bits = (Uint16*)(mybmp->bits + next_scanline * mybmp->pitch);
|
||||||
|
|
||||||
|
int nr_data = mybmp->w * 4;
|
||||||
|
BYTE* data = (BYTE *)malloc(nr_data);
|
||||||
|
uint8_t alpha = 0xFF;
|
||||||
|
for (int i = 0, j = 0; i < nr_data; i += 4, j++) {
|
||||||
|
uint8_t *b = data + i;
|
||||||
|
Uint16 *pixel = bits + j;
|
||||||
|
RGB_FROM_RGB565(pixel[j], b[0], b[1], b[2])
|
||||||
|
b[3] = alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BYTE* MYBITMAP_get_pixel_row_RGB(unsigned int next_scanline,
|
||||||
|
MYBITMAP* mybmp, RGB* pal)
|
||||||
|
{
|
||||||
|
BYTE *bits = mybmp->bits + next_scanline * mybmp->pitch;
|
||||||
|
|
||||||
|
int nr_data = mybmp->w * 4;
|
||||||
|
BYTE *data = (BYTE *)malloc(nr_data);
|
||||||
|
uint8_t alpha = 0xFF;
|
||||||
|
|
||||||
|
for (int i = 0, j = 0; i < nr_data; i += 4, j += 3) {
|
||||||
|
uint8_t *b = data + i;
|
||||||
|
BYTE *pixel = bits + j;
|
||||||
|
b[0] = pixel[2];
|
||||||
|
b[1] = pixel[1];
|
||||||
|
b[2] = pixel[0];
|
||||||
|
b[3] = alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BYTE* MYBITMAP_get_pixel_row_BGR(unsigned int next_scanline,
|
||||||
|
MYBITMAP* mybmp, RGB* pal)
|
||||||
|
{
|
||||||
|
BYTE *bits = mybmp->bits + next_scanline * mybmp->pitch;
|
||||||
|
|
||||||
|
int nr_data = mybmp->w * 4;
|
||||||
|
BYTE *data = (BYTE *)malloc(nr_data);
|
||||||
|
uint8_t alpha = 0xFF;
|
||||||
|
|
||||||
|
for (int i = 0, j = 0; i < nr_data; i += 4, j += 3) {
|
||||||
|
uint8_t *b = data + i;
|
||||||
|
BYTE *pixel = bits + j;
|
||||||
|
b[0] = pixel[0];
|
||||||
|
b[1] = pixel[1];
|
||||||
|
b[2] = pixel[2];
|
||||||
|
b[3] = alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BYTE* MYBITMAP_get_pixel_row_RGBA(unsigned int next_scanline,
|
||||||
|
MYBITMAP* mybmp, RGB* pal)
|
||||||
|
{
|
||||||
|
BYTE *bits = mybmp->bits + next_scanline * mybmp->pitch;
|
||||||
|
|
||||||
|
int nr_data = mybmp->w * 4;
|
||||||
|
BYTE *data = (BYTE *)malloc(nr_data);
|
||||||
|
|
||||||
|
for (int i = 0; i < nr_data; i += 4) {
|
||||||
|
uint8_t *b = data + i;
|
||||||
|
BYTE *pixel = bits + i;
|
||||||
|
|
||||||
|
uint8_t alpha = pixel[3];
|
||||||
|
if (alpha == 0) {
|
||||||
|
b[0] = b[1] = b[2] = b[3] = 0;
|
||||||
|
} else {
|
||||||
|
b[0] = (pixel[2] * 255 + alpha / 2) / alpha; /* red */
|
||||||
|
b[1] = (pixel[1] * 255 + alpha / 2) / alpha; /* green */
|
||||||
|
b[2] = (pixel[0] * 255 + alpha / 2) / alpha; /* blue */
|
||||||
|
b[3] = alpha;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
int __mg_save_png (MG_RWops* fp, MYBITMAP* bmp, RGB* pal)
|
||||||
|
{
|
||||||
|
png_struct *png;
|
||||||
|
png_info *info;
|
||||||
|
png_byte **volatile rows = NULL;
|
||||||
|
MYBITMAP_get_pixel_row get_row;
|
||||||
|
png_color_16 white;
|
||||||
|
int png_color_type;
|
||||||
|
int retcode = ERR_BMP_CANT_SAVE;
|
||||||
|
int bpc;
|
||||||
|
int bmp_type;
|
||||||
|
|
||||||
|
rows = calloc(bmp->h, sizeof(png_byte*));
|
||||||
|
if (rows == NULL) {
|
||||||
|
retcode = ERR_BMP_CANT_SAVE;
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
png = png_create_write_struct (PNG_LIBPNG_VER_STRING, &retcode,
|
||||||
|
png_error_callback, png_warning_callback);
|
||||||
|
if (png == NULL) {
|
||||||
|
retcode = ERR_BMP_MEM;
|
||||||
|
goto failed_clear_rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
info = png_create_info_struct (png);
|
||||||
|
if (info == NULL) {
|
||||||
|
retcode = ERR_BMP_MEM;
|
||||||
|
goto failed_clear_struct;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
|
if (setjmp (png_jmpbuf (png))) {
|
||||||
|
goto failed_clear_struct;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
png_set_write_fn (png, fp, my_write_data_fn, png_output_flush_fn);
|
||||||
|
|
||||||
|
bmp_type = bmp->flags & MYBMP_TYPE_MASK;
|
||||||
|
|
||||||
|
switch(bmp->depth) {
|
||||||
|
case 4:
|
||||||
|
get_row = MYBITMAP_get_pixel_row_pal16;
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
get_row = MYBITMAP_get_pixel_row_pal256;
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
get_row = MYBITMAP_get_pixel_row_RGB565;
|
||||||
|
break;
|
||||||
|
case 24:
|
||||||
|
if(MYBMP_TYPE_RGB == bmp_type)
|
||||||
|
get_row = MYBITMAP_get_pixel_row_RGB;
|
||||||
|
else
|
||||||
|
get_row = MYBITMAP_get_pixel_row_BGR;
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
|
get_row = MYBITMAP_get_pixel_row_RGBA;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
_ERR_PRINTF("MYBMP>PNG: invalid MYBITMAP.depth = %d\n", bmp->depth);
|
||||||
|
goto failed_clear_struct;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < bmp->h; i++) {
|
||||||
|
rows[i] = get_row(i, bmp, pal);
|
||||||
|
}
|
||||||
|
bpc = 8;
|
||||||
|
png_color_type = PNG_COLOR_TYPE_RGB_ALPHA;
|
||||||
|
|
||||||
|
png_set_IHDR (png, info,
|
||||||
|
bmp->w,
|
||||||
|
bmp->h, bpc,
|
||||||
|
png_color_type,
|
||||||
|
PNG_INTERLACE_NONE,
|
||||||
|
PNG_COMPRESSION_TYPE_DEFAULT,
|
||||||
|
PNG_FILTER_TYPE_DEFAULT);
|
||||||
|
|
||||||
|
white.gray = (1 << bpc) - 1;
|
||||||
|
white.red = white.blue = white.green = white.gray;
|
||||||
|
png_set_bKGD (png, info, &white);
|
||||||
|
|
||||||
|
png_write_info (png, info);
|
||||||
|
|
||||||
|
png_write_image (png, rows);
|
||||||
|
png_write_end (png, info);
|
||||||
|
|
||||||
|
retcode = ERR_BMP_OK;
|
||||||
|
|
||||||
|
failed_clear_struct:
|
||||||
|
png_destroy_write_struct (&png, &info);
|
||||||
|
failed_clear_rows:
|
||||||
|
for (int i = 0; i < bmp->h; i++) {
|
||||||
|
if (rows[i]) {
|
||||||
|
free(rows[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free (rows);
|
||||||
|
failed:
|
||||||
|
return retcode;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* _MGLIBPNG_VER == 16 */
|
#endif /* _MGLIBPNG_VER == 16 */
|
||||||
#endif /* _MGIMAGE_PNG */
|
#endif /* _MGIMAGE_PNG */
|
||||||
|
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ static int DRM_AllocSharedHWSurface(_THIS, GAL_Surface *surface,
|
|||||||
static int DRM_FreeSharedHWSurface(_THIS, GAL_Surface *surface);
|
static int DRM_FreeSharedHWSurface(_THIS, GAL_Surface *surface);
|
||||||
static int DRM_AttachSharedHWSurface(_THIS, GAL_Surface *surface,
|
static int DRM_AttachSharedHWSurface(_THIS, GAL_Surface *surface,
|
||||||
int prime_fd, size_t mapsize, BOOL with_rw);
|
int prime_fd, size_t mapsize, BOOL with_rw);
|
||||||
static int DRM_DettachSharedHWSurface(_THIS, GAL_Surface *surface);
|
static int DRM_DetachSharedHWSurface(_THIS, GAL_Surface *surface);
|
||||||
|
|
||||||
static int DRM_SetCursor(_THIS, GAL_Surface *surface, int hot_x, int hot_y);
|
static int DRM_SetCursor(_THIS, GAL_Surface *surface, int hot_x, int hot_y);
|
||||||
static int DRM_MoveCursor(_THIS, int x, int y);
|
static int DRM_MoveCursor(_THIS, int x, int y);
|
||||||
@@ -1410,7 +1410,7 @@ static GAL_VideoDevice *DRM_CreateDevice(int devindex)
|
|||||||
device->AllocSharedHWSurface = DRM_AllocSharedHWSurface;
|
device->AllocSharedHWSurface = DRM_AllocSharedHWSurface;
|
||||||
device->FreeSharedHWSurface = DRM_FreeSharedHWSurface;
|
device->FreeSharedHWSurface = DRM_FreeSharedHWSurface;
|
||||||
device->AttachSharedHWSurface = DRM_AttachSharedHWSurface;
|
device->AttachSharedHWSurface = DRM_AttachSharedHWSurface;
|
||||||
device->DettachSharedHWSurface = DRM_DettachSharedHWSurface;
|
device->DetachSharedHWSurface = DRM_DetachSharedHWSurface;
|
||||||
}
|
}
|
||||||
#endif /* IS_COMPOSITING_SCHEMA */
|
#endif /* IS_COMPOSITING_SCHEMA */
|
||||||
|
|
||||||
@@ -3127,7 +3127,7 @@ error:
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int DRM_DettachSharedHWSurface(_THIS, GAL_Surface *surface)
|
static int DRM_DetachSharedHWSurface(_THIS, GAL_Surface *surface)
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
DrmVideoData* vdata = this->hidden;
|
DrmVideoData* vdata = this->hidden;
|
||||||
|
|||||||
+1
-1
@@ -247,7 +247,7 @@ static GAL_Surface* create_wp_surface(GAL_Surface* screen)
|
|||||||
|
|
||||||
_DBG_PRINTF ("REQID_GETSHAREDSURFACE: size (%lu), flags (0x%x), fd: %d\n",
|
_DBG_PRINTF ("REQID_GETSHAREDSURFACE: size (%lu), flags (0x%x), fd: %d\n",
|
||||||
info.size, info.flags, fd);
|
info.size, info.flags, fd);
|
||||||
wp_surf = GAL_AttachSharedRGBSurface (fd, info.size,
|
wp_surf = GAL_AttachSharedRGBSurface (NULL, fd, info.size,
|
||||||
info.flags, TRUE);
|
info.flags, TRUE);
|
||||||
close (fd);
|
close (fd);
|
||||||
|
|
||||||
|
|||||||
+41
-35
@@ -15,7 +15,7 @@
|
|||||||
* 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~2020, Beijing FMSoft Technologies Co., Ltd.
|
* Copyright (C) 2002~2023, 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
|
||||||
@@ -59,6 +59,7 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "internals.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "newgal.h"
|
#include "newgal.h"
|
||||||
#include "sysvideo.h"
|
#include "sysvideo.h"
|
||||||
@@ -68,7 +69,7 @@
|
|||||||
/*
|
/*
|
||||||
* Create a shared empty RGB surface of the appropriate depth and pixel format
|
* Create a shared empty RGB surface of the appropriate depth and pixel format
|
||||||
*/
|
*/
|
||||||
GAL_Surface * GAL_CreateSharedRGBSurface (GAL_VideoDevice *video,
|
GAL_Surface *GAL_CreateSharedRGBSurface (GAL_VideoDevice *video,
|
||||||
Uint32 flags, Uint32 rw_modes, int width, int height, int depth,
|
Uint32 flags, Uint32 rw_modes, int width, int height, int depth,
|
||||||
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
|
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
|
||||||
{
|
{
|
||||||
@@ -142,6 +143,7 @@ GAL_Surface * GAL_CreateSharedRGBSurface (GAL_VideoDevice *video,
|
|||||||
#endif
|
#endif
|
||||||
surface->shared_header = NULL;
|
surface->shared_header = NULL;
|
||||||
surface->dirty_info = NULL;
|
surface->dirty_info = NULL;
|
||||||
|
surface->fd = -1;
|
||||||
GAL_SetClipRect (surface, NULL);
|
GAL_SetClipRect (surface, NULL);
|
||||||
|
|
||||||
#ifdef _MGUSE_UPDATE_REGION
|
#ifdef _MGUSE_UPDATE_REGION
|
||||||
@@ -201,10 +203,12 @@ GAL_Surface * GAL_CreateSharedRGBSurface (GAL_VideoDevice *video,
|
|||||||
surface->shared_header = hdr = (GAL_SharedSurfaceHeader*)data_map;
|
surface->shared_header = hdr = (GAL_SharedSurfaceHeader*)data_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
surface->fd = fd; /* Since 5.2.0 */
|
||||||
|
|
||||||
/* fill fileds of shared header */
|
/* fill fileds of shared header */
|
||||||
memset (hdr, 0, sizeof(GAL_SharedSurfaceHeader));
|
memset (hdr, 0, sizeof(GAL_SharedSurfaceHeader));
|
||||||
hdr->creator = getpid();
|
hdr->create_cli = __mg_client_id;
|
||||||
hdr->fd = fd;
|
// hdr->fd = fd;
|
||||||
hdr->byhw = byhw;
|
hdr->byhw = byhw;
|
||||||
hdr->width = surface->w;
|
hdr->width = surface->w;
|
||||||
hdr->height = surface->h;
|
hdr->height = surface->h;
|
||||||
@@ -221,7 +225,8 @@ GAL_Surface * GAL_CreateSharedRGBSurface (GAL_VideoDevice *video,
|
|||||||
surface->dirty_info->dirty_age = 0;
|
surface->dirty_info->dirty_age = 0;
|
||||||
surface->dirty_info->nr_dirty_rcs = 0;
|
surface->dirty_info->nr_dirty_rcs = 0;
|
||||||
|
|
||||||
/* allocate semaphore from semaphore for shared surface */
|
/* Deprecated since 5.2.0.
|
||||||
|
allocate semaphore from semaphore for shared surface
|
||||||
if (IsServer() && __gal_fake_screen == NULL) {
|
if (IsServer() && __gal_fake_screen == NULL) {
|
||||||
// use 0 for wallpaper pattern,
|
// use 0 for wallpaper pattern,
|
||||||
// because the semaphore set manager is not ready.
|
// because the semaphore set manager is not ready.
|
||||||
@@ -232,7 +237,7 @@ GAL_Surface * GAL_CreateSharedRGBSurface (GAL_VideoDevice *video,
|
|||||||
if (hdr->sem_num < 0) {
|
if (hdr->sem_num < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
surface->pixels = (uint8_t*)surface->shared_header + pixels_off;
|
surface->pixels = (uint8_t*)surface->shared_header + pixels_off;
|
||||||
|
|
||||||
@@ -254,16 +259,16 @@ GAL_Surface * GAL_CreateSharedRGBSurface (GAL_VideoDevice *video,
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
if (surface) {
|
if (surface) {
|
||||||
if (surface->shared_header) {
|
if (surface->fd >= 0) {
|
||||||
#if 0
|
close(surface->fd);
|
||||||
if (sem_inited) {
|
surface->fd = -1;
|
||||||
sem_destroy (&surface->shared_header->sem_lock);
|
}
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
if (surface->shared_header) {
|
||||||
|
/* Deprecated since 5.2.0
|
||||||
if (surface->shared_header->sem_num >= 0) {
|
if (surface->shared_header->sem_num >= 0) {
|
||||||
__mg_free_sem_for_shared_surf (surface->shared_header->sem_num);
|
__mg_free_sem_for_shared_surf (surface->shared_header->sem_num);
|
||||||
}
|
} */
|
||||||
|
|
||||||
if (surface->shared_header->byhw) {
|
if (surface->shared_header->byhw) {
|
||||||
assert(video->FreeSharedHWSurface);
|
assert(video->FreeSharedHWSurface);
|
||||||
@@ -271,7 +276,6 @@ error:
|
|||||||
surface->hwdata = NULL; /* set to NULL for GAL_FreeSurface */
|
surface->hwdata = NULL; /* set to NULL for GAL_FreeSurface */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
close (surface->shared_header->fd);
|
|
||||||
munmap (surface->shared_header,
|
munmap (surface->shared_header,
|
||||||
surface->shared_header->map_size);
|
surface->shared_header->map_size);
|
||||||
}
|
}
|
||||||
@@ -300,20 +304,16 @@ void GAL_FreeSharedSurfaceData (GAL_Surface *surface)
|
|||||||
GAL_VideoDevice *video = surface->video;
|
GAL_VideoDevice *video = surface->video;
|
||||||
|
|
||||||
assert (surface->shared_header);
|
assert (surface->shared_header);
|
||||||
|
assert (surface->fd >= 0);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
sem_destroy (&surface->shared_header->sem_lock);
|
sem_destroy (&surface->shared_header->sem_lock);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Deprecated since 5.2.0
|
||||||
if (surface->shared_header->sem_num >= 0) {
|
if (surface->shared_header->sem_num >= 0) {
|
||||||
__mg_free_sem_for_shared_surf (surface->shared_header->sem_num);
|
__mg_free_sem_for_shared_surf (surface->shared_header->sem_num);
|
||||||
}
|
} */
|
||||||
|
|
||||||
// the file descriptor may have been closed.
|
|
||||||
if (surface->shared_header->fd >= 0) {
|
|
||||||
close (surface->shared_header->fd);
|
|
||||||
surface->shared_header->fd = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (surface->shared_header->byhw) {
|
if (surface->shared_header->byhw) {
|
||||||
assert (video->FreeSharedHWSurface);
|
assert (video->FreeSharedHWSurface);
|
||||||
@@ -325,6 +325,8 @@ void GAL_FreeSharedSurfaceData (GAL_Surface *surface)
|
|||||||
surface->shared_header->map_size);
|
surface->shared_header->map_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
close(surface->fd);
|
||||||
|
|
||||||
surface->pixels = NULL;
|
surface->pixels = NULL;
|
||||||
#ifdef _MGUSE_PIXMAN
|
#ifdef _MGUSE_PIXMAN
|
||||||
surface->pix_img = NULL;
|
surface->pix_img = NULL;
|
||||||
@@ -332,15 +334,15 @@ void GAL_FreeSharedSurfaceData (GAL_Surface *surface)
|
|||||||
#endif
|
#endif
|
||||||
surface->shared_header = NULL;
|
surface->shared_header = NULL;
|
||||||
surface->dirty_info = NULL;
|
surface->dirty_info = NULL;
|
||||||
|
surface->fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Attach to a shared RGB surface
|
* Attach to a shared RGB surface
|
||||||
*/
|
*/
|
||||||
GAL_Surface * GAL_AttachSharedRGBSurface (int fd, size_t map_size,
|
GAL_Surface * GAL_AttachSharedRGBSurface (GAL_VideoDevice *video,
|
||||||
Uint32 flags, BOOL with_wr)
|
int fd, size_t map_size, Uint32 flags, BOOL with_wr)
|
||||||
{
|
{
|
||||||
GAL_VideoDevice *video = NULL;
|
|
||||||
GAL_Surface *surface;
|
GAL_Surface *surface;
|
||||||
void* data_map = MAP_FAILED;
|
void* data_map = MAP_FAILED;
|
||||||
GAL_SharedSurfaceHeader* hdr;
|
GAL_SharedSurfaceHeader* hdr;
|
||||||
@@ -362,11 +364,10 @@ GAL_Surface * GAL_AttachSharedRGBSurface (int fd, size_t map_size,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flags & GAL_HWSURFACE) == GAL_HWSURFACE) {
|
if (video == NULL) {
|
||||||
video = __mg_current_video;
|
if ((flags & GAL_HWSURFACE) == GAL_HWSURFACE) {
|
||||||
}
|
video = __mg_current_video;
|
||||||
else {
|
}
|
||||||
video = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
surface->video = video;
|
surface->video = video;
|
||||||
@@ -374,6 +375,8 @@ GAL_Surface * GAL_AttachSharedRGBSurface (int fd, size_t map_size,
|
|||||||
|
|
||||||
surface->shared_header = NULL;
|
surface->shared_header = NULL;
|
||||||
surface->hwdata = NULL;
|
surface->hwdata = NULL;
|
||||||
|
surface->fd = fd;
|
||||||
|
|
||||||
if (video && video->AttachSharedHWSurface) {
|
if (video && video->AttachSharedHWSurface) {
|
||||||
// this method should fill hwdata and shared_header fields if success
|
// this method should fill hwdata and shared_header fields if success
|
||||||
video->AttachSharedHWSurface (video, surface, fd, map_size, with_wr);
|
video->AttachSharedHWSurface (video, surface, fd, map_size, with_wr);
|
||||||
@@ -389,7 +392,7 @@ GAL_Surface * GAL_AttachSharedRGBSurface (int fd, size_t map_size,
|
|||||||
|
|
||||||
data_map = mmap (NULL, map_size, prot, MAP_SHARED, fd, 0);
|
data_map = mmap (NULL, map_size, prot, MAP_SHARED, fd, 0);
|
||||||
if (data_map == MAP_FAILED) {
|
if (data_map == MAP_FAILED) {
|
||||||
_ERR_PRINTF("NEWGAL: Failed to map shared RGB surface: %d\n", fd);
|
_ERR_PRINTF("NEWGAL: Failed to map shared RGB surface: %d (%m)\n", fd);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,14 +442,17 @@ GAL_Surface * GAL_AttachSharedRGBSurface (int fd, size_t map_size,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Since 5.2.0 */
|
||||||
|
surface->flags |= GAL_SSURF_ATTACHED;
|
||||||
|
|
||||||
/* The surface is ready to go */
|
/* The surface is ready to go */
|
||||||
surface->refcount = 1;
|
surface->refcount = 1;
|
||||||
return (surface);
|
return (surface);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (video && surface && surface->hwdata) {
|
if (video && surface && surface->hwdata) {
|
||||||
assert (video->DettachSharedHWSurface);
|
assert (video->DetachSharedHWSurface);
|
||||||
video->DettachSharedHWSurface (video, surface);
|
video->DetachSharedHWSurface (video, surface);
|
||||||
}
|
}
|
||||||
else if (data_map != MAP_FAILED) {
|
else if (data_map != MAP_FAILED) {
|
||||||
munmap (data_map, map_size);
|
munmap (data_map, map_size);
|
||||||
@@ -462,15 +468,15 @@ error:
|
|||||||
/*
|
/*
|
||||||
* Free data of a shared surface created by the above function.
|
* Free data of a shared surface created by the above function.
|
||||||
*/
|
*/
|
||||||
void GAL_DettachSharedSurfaceData (GAL_Surface *surface)
|
void GAL_DetachSharedSurfaceData (GAL_Surface *surface)
|
||||||
{
|
{
|
||||||
GAL_VideoDevice *video = surface->video;
|
GAL_VideoDevice *video = surface->video;
|
||||||
|
|
||||||
assert (surface->shared_header);
|
assert (surface->shared_header);
|
||||||
|
|
||||||
if (video && surface->hwdata) {
|
if (video && surface->hwdata) {
|
||||||
assert (video->DettachSharedHWSurface);
|
assert (video->DetachSharedHWSurface);
|
||||||
video->DettachSharedHWSurface (video, surface);
|
video->DetachSharedHWSurface (video, surface);
|
||||||
surface->hwdata = NULL;
|
surface->hwdata = NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -1836,10 +1836,15 @@ void GAL_FreeSurface (GAL_Surface *surface)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (surface->shared_header) {
|
if (surface->shared_header) {
|
||||||
if (surface->shared_header->creator == getpid())
|
if (surface->flags & GAL_SSURF_ATTACHED)
|
||||||
GAL_FreeSharedSurfaceData(surface);
|
GAL_DetachSharedSurfaceData(surface);
|
||||||
else
|
else
|
||||||
GAL_DettachSharedSurfaceData(surface);
|
GAL_FreeSharedSurfaceData(surface);
|
||||||
|
|
||||||
|
if (surface->fd >= 0) {
|
||||||
|
close(surface->fd);
|
||||||
|
surface->fd = -1;
|
||||||
|
}
|
||||||
|
|
||||||
surface->hwdata = NULL;
|
surface->hwdata = NULL;
|
||||||
surface->pixels = NULL;
|
surface->pixels = NULL;
|
||||||
|
|||||||
@@ -174,10 +174,10 @@ struct GAL_VideoDevice {
|
|||||||
int (*AttachSharedHWSurface)(_THIS, GAL_Surface *surface,
|
int (*AttachSharedHWSurface)(_THIS, GAL_Surface *surface,
|
||||||
int prime_fd, size_t mapsize, BOOL with_rw);
|
int prime_fd, size_t mapsize, BOOL with_rw);
|
||||||
|
|
||||||
/* Dettach from a shared surface in hardware video memory.
|
/* Detach from a shared surface in hardware video memory.
|
||||||
Set to NULL if no hardware shared surface supported.
|
Set to NULL if no hardware shared surface supported.
|
||||||
Return 0 if success, otherwise -1. */
|
Return 0 if success, otherwise -1. */
|
||||||
int (*DettachSharedHWSurface)(_THIS, GAL_Surface *surface);
|
int (*DetachSharedHWSurface)(_THIS, GAL_Surface *surface);
|
||||||
|
|
||||||
/* Allocate a dumb surface from hardware.
|
/* Allocate a dumb surface from hardware.
|
||||||
Set to NULL if dumb surface is not supported.
|
Set to NULL if dumb surface is not supported.
|
||||||
|
|||||||
+2
-2
@@ -918,9 +918,9 @@ BOOL GAL_SyncUpdate (GAL_Surface *surface)
|
|||||||
|
|
||||||
#ifdef _MGSCHEMA_COMPOSITING
|
#ifdef _MGSCHEMA_COMPOSITING
|
||||||
if (surface->shared_header) {
|
if (surface->shared_header) {
|
||||||
LOCK_SURFACE_SEM (surface->shared_header->sem_num);
|
__mg_lock_file_for_write (surface->fd);
|
||||||
mark_surface_dirty (surface, numrects, rects);
|
mark_surface_dirty (surface, numrects, rects);
|
||||||
UNLOCK_SURFACE_SEM (surface->shared_header->sem_num);
|
__mg_unlock_file_for_write (surface->fd);
|
||||||
}
|
}
|
||||||
else if (surface->dirty_info) {
|
else if (surface->dirty_info) {
|
||||||
mark_surface_dirty (surface, numrects, rects);
|
mark_surface_dirty (surface, numrects, rects);
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ SRC_FILES = gdi.c attr.c clip.c map.c coor.c rect.c \
|
|||||||
simple-glyph-renderer.c glyph-shaped.c \
|
simple-glyph-renderer.c glyph-shaped.c \
|
||||||
textruns.c \
|
textruns.c \
|
||||||
shape-glyphs-basic.c shape-glyphs-complex.c \
|
shape-glyphs-basic.c shape-glyphs-complex.c \
|
||||||
layout.c layout-utils.c layout-ellipsize.c
|
layout.c layout-utils.c layout-ellipsize.c \
|
||||||
|
shared-surface.c
|
||||||
|
|
||||||
HDR_FILES = glyph.h drawtext.h mi.h midc.h mistruct.h miwideline.h \
|
HDR_FILES = glyph.h drawtext.h mi.h midc.h mistruct.h miwideline.h \
|
||||||
pixel_ops.h mifillarc.h mispans.h polygon.h mifpoly.h \
|
pixel_ops.h mifillarc.h mispans.h polygon.h mifpoly.h \
|
||||||
|
|||||||
+18
-29
@@ -3346,8 +3346,7 @@ HDC GUIAPI CreateMemDCEx (int width, int height, int depth, DWORD flags,
|
|||||||
return (HDC)pmem_dc;
|
return (HDC)pmem_dc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Since 5.0.0 */
|
static HDC create_memdc_from_surface(HSURF surface, BOOL take_owner)
|
||||||
HDC CreateMemDCFromSurface (GAL_Surface* surface)
|
|
||||||
{
|
{
|
||||||
PDC pmem_dc = NULL;
|
PDC pmem_dc = NULL;
|
||||||
|
|
||||||
@@ -3360,7 +3359,10 @@ HDC CreateMemDCFromSurface (GAL_Surface* surface)
|
|||||||
pmem_dc->DataType = TYPE_HDC;
|
pmem_dc->DataType = TYPE_HDC;
|
||||||
pmem_dc->DCType = TYPE_MEMDC;
|
pmem_dc->DCType = TYPE_MEMDC;
|
||||||
pmem_dc->bInUse = TRUE;
|
pmem_dc->bInUse = TRUE;
|
||||||
pmem_dc->surface = surface;
|
if (take_owner)
|
||||||
|
pmem_dc->surface = surface;
|
||||||
|
else
|
||||||
|
pmem_dc->surface = GAL_RefSurface(surface);
|
||||||
|
|
||||||
dc_InitDC (pmem_dc, HWND_NULL, FALSE);
|
dc_InitDC (pmem_dc, HWND_NULL, FALSE);
|
||||||
|
|
||||||
@@ -3384,36 +3386,24 @@ HDC CreateMemDCFromSurface (GAL_Surface* surface)
|
|||||||
return (HDC)pmem_dc;
|
return (HDC)pmem_dc;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct GAL_Surface* GetSurfaceFromDC (HDC hdc)
|
/* Since 5.2.0 */
|
||||||
|
HDC GUIAPI CreateMemDCFromSurface (HSURF surface)
|
||||||
|
{
|
||||||
|
return create_memdc_from_surface(surface, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
HDC __mg_create_memdc_for_surface (HSURF surface)
|
||||||
|
{
|
||||||
|
return create_memdc_from_surface(surface, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
HSURF GUIAPI GetSurfaceFromDC (HDC hdc)
|
||||||
{
|
{
|
||||||
PDC pdc;
|
PDC pdc;
|
||||||
pdc = dc_HDC2PDC (hdc);
|
pdc = dc_HDC2PDC(hdc);
|
||||||
return pdc->surface;
|
return pdc->surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MGSCHEMA_COMPOSITING
|
|
||||||
HDC GUIAPI CreateMemDCFromSharedSurfaceFD (int fd)
|
|
||||||
{
|
|
||||||
HDC memdc = HDC_INVALID;
|
|
||||||
GAL_Surface* surf;
|
|
||||||
|
|
||||||
surf = GAL_AttachSharedRGBSurface (fd, 0, GAL_HWSURFACE, TRUE);
|
|
||||||
if (surf) {
|
|
||||||
memdc = CreateMemDCFromSurface (surf);
|
|
||||||
if (memdc == HDC_INVALID) {
|
|
||||||
GAL_FreeSurface(surf);
|
|
||||||
|
|
||||||
_ERR_PRINTF("failed to create memory dc from surface: %p\n", surf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
_ERR_PRINTF("failed to attach to surface buffer via fd: %d\n", fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
return memdc;
|
|
||||||
}
|
|
||||||
#endif /* _MGSCHEMA_COMPOSITING */
|
|
||||||
|
|
||||||
HDC GUIAPI CreateSubMemDC (HDC parent, int off_x, int off_y,
|
HDC GUIAPI CreateSubMemDC (HDC parent, int off_x, int off_y,
|
||||||
int width, int height, BOOL comp_to_parent)
|
int width, int height, BOOL comp_to_parent)
|
||||||
{
|
{
|
||||||
@@ -3438,7 +3428,6 @@ HDC GUIAPI CreateSubMemDC (HDC parent, int off_x, int off_y,
|
|||||||
if (width < 0) width = 0;
|
if (width < 0) width = 0;
|
||||||
if (height < 0) height = 0;
|
if (height < 0) height = 0;
|
||||||
|
|
||||||
|
|
||||||
if (off_x + width > pdc_parent->DevRC.right)
|
if (off_x + width > pdc_parent->DevRC.right)
|
||||||
width = pdc_parent->DevRC.right - off_x;
|
width = pdc_parent->DevRC.right - off_x;
|
||||||
if (off_y + height > pdc_parent->DevRC.bottom)
|
if (off_y + height > pdc_parent->DevRC.bottom)
|
||||||
|
|||||||
+1
-1
@@ -269,7 +269,7 @@ void GUIAPI GetClipRgnBoundRect (PCLIPRGN pRgn, PRECT pRect)
|
|||||||
|
|
||||||
BOOL GUIAPI IsEmptyClipRgn (const CLIPRGN* pRgn)
|
BOOL GUIAPI IsEmptyClipRgn (const CLIPRGN* pRgn)
|
||||||
{
|
{
|
||||||
if (pRgn->head == NULL)
|
if (pRgn->head == NULL || IsRectEmpty (&pRgn->rcBound))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -0,0 +1,407 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// IMPORTANT NOTICE
|
||||||
|
//
|
||||||
|
// The following open source license statement does not apply to any
|
||||||
|
// entity in the Exception List published by FMSoft.
|
||||||
|
//
|
||||||
|
// For more information, please visit:
|
||||||
|
//
|
||||||
|
// https://www.fmsoft.cn/exception-list
|
||||||
|
//
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
/*
|
||||||
|
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||||
|
* and Graphics User Interface (GUI) support system for embedded systems
|
||||||
|
* and smart IoT devices.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2023, Beijing FMSoft Technologies Co., Ltd.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Or,
|
||||||
|
*
|
||||||
|
* As this program is a library, any link to this program must follow
|
||||||
|
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||||
|
* GPLv3, you need to be licensed from FMSoft.
|
||||||
|
*
|
||||||
|
* If you have got a commercial license of this program, please use it
|
||||||
|
* under the terms and conditions of the commercial license.
|
||||||
|
*
|
||||||
|
* For more information about the commercial license, please refer to
|
||||||
|
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
** The graphics display interface module of MiniGUI.
|
||||||
|
**
|
||||||
|
** Current maintainer: Wei Yongming.
|
||||||
|
**
|
||||||
|
** Create date: 1999.01.03
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
#ifdef _MGSCHEMA_COMPOSITING
|
||||||
|
|
||||||
|
#include "minigui.h"
|
||||||
|
#include "gdi.h"
|
||||||
|
#include "window.h"
|
||||||
|
#include "cliprect.h"
|
||||||
|
#include "gal.h"
|
||||||
|
#include "cursor.h"
|
||||||
|
#include "internals.h"
|
||||||
|
#include "inline.h"
|
||||||
|
#include "dc.h"
|
||||||
|
#include "debug.h"
|
||||||
|
#include "client.h"
|
||||||
|
#include "server.h"
|
||||||
|
|
||||||
|
HSURF GUIAPI CreateSharedSurface(GHANDLE video, const char *name, DWORD flags,
|
||||||
|
int width, int height, int depth,
|
||||||
|
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
|
||||||
|
{
|
||||||
|
GAL_Surface *nssurf = NULL;
|
||||||
|
|
||||||
|
if (name) {
|
||||||
|
OPERATENSSURFINFO nssurf_req = {};
|
||||||
|
|
||||||
|
if (strlen(name) + 1 > sizeof(nssurf_req.name)) {
|
||||||
|
_ERR_PRINTF("TOOLONG: too long name for shared surface: %s\n",
|
||||||
|
name);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcpy(nssurf_req.name, name);
|
||||||
|
nssurf_req.id_op = ID_NAMEDSSURFOP_REGISTER;
|
||||||
|
|
||||||
|
int result;
|
||||||
|
if (IsServer()) {
|
||||||
|
result = __mg_nssurf_map_operate_srv(&nssurf_req, 0, -1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
REQUEST req;
|
||||||
|
|
||||||
|
req.id = REQID_OPERATENAMEDSSURF;
|
||||||
|
req.data = &nssurf_req;
|
||||||
|
req.len_data = sizeof(OPERATENSSURFINFO);
|
||||||
|
|
||||||
|
if (ClientRequest(&req, &result, sizeof(result))) {
|
||||||
|
_ERR_PRINTF("BAD_REQUEST: when registering name for a new shared surface\n");
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
_ERR_PRINTF("FAILED_REQUEST: when registering name of shared surface\n");
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nssurf = GAL_CreateSharedRGBSurface(video, flags, 0666, width, height, depth,
|
||||||
|
Rmask, Gmask, Bmask, Amask);
|
||||||
|
if (nssurf == NULL) {
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name) {
|
||||||
|
strcpy(nssurf->shared_header->name, name);
|
||||||
|
|
||||||
|
OPERATENSSURFINFO nssurf_req = {};
|
||||||
|
strcpy(nssurf_req.name, name);
|
||||||
|
nssurf_req.id_op = ID_NAMEDSSURFOP_SET;
|
||||||
|
nssurf_req.map_size = nssurf->shared_header->map_size;
|
||||||
|
|
||||||
|
int result;
|
||||||
|
if (IsServer()) {
|
||||||
|
result = __mg_nssurf_map_operate_srv(&nssurf_req, 0, nssurf->fd);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
REQUEST req;
|
||||||
|
|
||||||
|
req.id = REQID_OPERATENAMEDSSURF;
|
||||||
|
req.data = &nssurf_req;
|
||||||
|
req.len_data = sizeof(OPERATENSSURFINFO);
|
||||||
|
|
||||||
|
if (ClientRequestEx2(&req, NULL, 0, nssurf->fd,
|
||||||
|
&result, sizeof(result), NULL)) {
|
||||||
|
_ERR_PRINTF("BAD_REQUEST: when setting fd of the new shared surface.\n");
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
_ERR_PRINTF("FAILED_REQUEST: when setting fd of the shared surface\n");
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
nssurf->shared_header->name[0] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nssurf;
|
||||||
|
|
||||||
|
failed:
|
||||||
|
if (nssurf)
|
||||||
|
GAL_FreeSurface(nssurf);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL GUIAPI DestroySharedSurface(HSURF surf)
|
||||||
|
{
|
||||||
|
if (surf->shared_header == NULL) {
|
||||||
|
_ERR_PRINTF("INVALID_ARG: surface handle: %p\n", surf);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (surf->flags & GAL_SSURF_ATTACHED) {
|
||||||
|
_ERR_PRINTF("INVALID_CALL: surface is created by attaching: %p\n", surf);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (surf->shared_header->create_cli != __mg_client_id) {
|
||||||
|
_ERR_PRINTF("INVALID_CALL: surface is not created by current process: %p\n", surf);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (surf->shared_header->name[0]) {
|
||||||
|
/* This is a named shared surface created by this client */
|
||||||
|
|
||||||
|
OPERATENSSURFINFO nssurf_req = {};
|
||||||
|
strcpy(nssurf_req.name, surf->shared_header->name);
|
||||||
|
nssurf_req.id_op = ID_NAMEDSSURFOP_REVOKE;
|
||||||
|
|
||||||
|
int result;
|
||||||
|
if (IsServer()) {
|
||||||
|
result = __mg_nssurf_map_operate_srv(&nssurf_req, 0, -1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
REQUEST req;
|
||||||
|
|
||||||
|
req.id = REQID_OPERATENAMEDSSURF;
|
||||||
|
req.data = &nssurf_req;
|
||||||
|
req.len_data = sizeof(OPERATENSSURFINFO);
|
||||||
|
|
||||||
|
if (ClientRequest(&req, &result, sizeof(result))) {
|
||||||
|
_ERR_PRINTF("BAD_REQUEST: when revoking name of a shared surface.\n");
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
_ERR_PRINTF("FAILED_REQUEST: when revoking name of a shared surface\n");
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GAL_FreeSurface(surf);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
failed:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_shared_surface(const char *name, size_t *map_size, DWORD *flags)
|
||||||
|
{
|
||||||
|
int fd = -1;
|
||||||
|
SHAREDSURFINFO info;
|
||||||
|
|
||||||
|
if (IsServer()) {
|
||||||
|
fd = __mg_get_shared_surface_srv(name, &info);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
REQUEST req;
|
||||||
|
|
||||||
|
req.id = REQID_GETSHAREDSURFACE;
|
||||||
|
req.data = name;
|
||||||
|
req.len_data = strlen(name) + 1;
|
||||||
|
|
||||||
|
if (ClientRequestEx2(&req, NULL, 0, -1,
|
||||||
|
&info, sizeof(SHAREDSURFINFO), &fd) < 0) {
|
||||||
|
_ERR_PRINTF("BAD_REQUEST: when getting shared surface: %s\n", name);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fd < 0) {
|
||||||
|
_ERR_PRINTF("FAILED_REQUEST: when getting shared surface: %s\n", name);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
_DBG_PRINTF("REQID_GETSHAREDSURFACE: size (%lu), flags (0x%x), fd: %d\n",
|
||||||
|
info.size, info.flags, fd);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fd >= 0) {
|
||||||
|
if (map_size)
|
||||||
|
*map_size = info.size;
|
||||||
|
if (flags)
|
||||||
|
*flags = info.flags;
|
||||||
|
}
|
||||||
|
return fd;
|
||||||
|
|
||||||
|
failed:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GUIAPI GetSharedSurfaceFDByClientWindow(int client, HWND hwnd,
|
||||||
|
size_t *map_size, DWORD *flags)
|
||||||
|
{
|
||||||
|
char itn_name[sizeof(APPSF_NAME_PREFIX) + NAME_MAX + 1];
|
||||||
|
|
||||||
|
int ret = snprintf(itn_name, sizeof(itn_name), APPSF_HWND_PATTER,
|
||||||
|
client, hwnd);
|
||||||
|
if (ret <= 0 || (size_t)ret >= sizeof(itn_name)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return get_shared_surface(itn_name, map_size, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
int GUIAPI GetSharedSurfaceFDByName(const char *name,
|
||||||
|
size_t *map_size, DWORD *flags)
|
||||||
|
{
|
||||||
|
char itn_name[sizeof(APPSF_NAME_PREFIX) + NAME_MAX + 1];
|
||||||
|
|
||||||
|
int ret = snprintf(itn_name, sizeof(itn_name), APPSF_NAME_PATTER, name);
|
||||||
|
if (ret <= 0 || (size_t)ret >= sizeof(itn_name)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return get_shared_surface(itn_name, map_size, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
HSURF GUIAPI AttachToSharedSurface(GHANDLE video, int fd,
|
||||||
|
size_t map_size, DWORD flags)
|
||||||
|
{
|
||||||
|
return GAL_AttachSharedRGBSurface(video, fd, map_size, flags, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *GUIAPI GetSharedSurfaceInfo(HSURF surf, int *fd,
|
||||||
|
SIZE *size, int *pitch, size_t *map_size, off_t *pixels_off)
|
||||||
|
{
|
||||||
|
if (surf->shared_header == NULL) {
|
||||||
|
_ERR_PRINTF("INVALID_ARG: surface handle: %p\n", surf);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fd) {
|
||||||
|
*fd = surf->fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size) {
|
||||||
|
size->cx = surf->shared_header->width;
|
||||||
|
size->cy = surf->shared_header->height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pitch) {
|
||||||
|
*pitch = surf->shared_header->pitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (map_size) {
|
||||||
|
*map_size = surf->shared_header->map_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pixels_off) {
|
||||||
|
*pixels_off = surf->shared_header->pixels_off;
|
||||||
|
}
|
||||||
|
|
||||||
|
return surf->shared_header->name;
|
||||||
|
|
||||||
|
failed:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL GUIAPI TestIfSharedSurfaceChanged(HSURF surf, unsigned dirty_age)
|
||||||
|
{
|
||||||
|
if (surf->shared_header == NULL) {
|
||||||
|
_WRN_PRINTF("INVALID_ARG: surface handle: %p\n", surf);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO: use atomic comparison */
|
||||||
|
if (dirty_age != surf->shared_header->dirty_info.dirty_age)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
failed:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL GUIAPI LockSharedSurface(HSURF surf, unsigned *dirty_age,
|
||||||
|
int *nr_dirty_rcs, const RECT **dirty_rcs)
|
||||||
|
{
|
||||||
|
if (surf->shared_header == NULL) {
|
||||||
|
_WRN_PRINTF("INVALID_ARG: surface handle: %p\n", surf);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
__mg_lock_file_for_read(surf->fd);
|
||||||
|
|
||||||
|
if (dirty_age) {
|
||||||
|
*dirty_age = surf->shared_header->dirty_info.dirty_age;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nr_dirty_rcs) {
|
||||||
|
*nr_dirty_rcs = surf->shared_header->dirty_info.nr_dirty_rcs;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dirty_rcs) {
|
||||||
|
*dirty_rcs = surf->shared_header->dirty_info.dirty_rcs;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
failed:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL GUIAPI UnlockSharedSurface(HSURF surf)
|
||||||
|
{
|
||||||
|
if (surf->shared_header == NULL) {
|
||||||
|
_WRN_PRINTF("INVALID_ARG: surface handle: %p\n", surf);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
__mg_unlock_file_for_read(surf->fd);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
failed:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL GUIAPI DetachFromSharedSurface(HSURF surf)
|
||||||
|
{
|
||||||
|
if (surf->shared_header == NULL) {
|
||||||
|
_WRN_PRINTF("INVALID_ARG: not a shared surface: %p\n", surf);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(surf->flags & GAL_SSURF_ATTACHED)) {
|
||||||
|
_WRN_PRINTF("INVALID_CALL: surface was not created by attaching: %p\n", surf);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
GAL_FreeSurface(surf);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
failed:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* defined _MGSCHEMA_COMPOSITING */
|
||||||
|
|
||||||
+7
-5
@@ -309,7 +309,7 @@ BOOL GUIAPI ServerDeleteLayer (MG_Layer* layer)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MGSCHEMA_COMPOSITING
|
#if 0 // Deprecated since 5.2.0 def _MGSCHEMA_COMPOSITING
|
||||||
|
|
||||||
static SemSetManager* _ssm_shared_surf;
|
static SemSetManager* _ssm_shared_surf;
|
||||||
|
|
||||||
@@ -395,6 +395,7 @@ int __mg_init_layers ()
|
|||||||
|
|
||||||
memset (sem_usage, 0xFF, sizeof (sem_usage));
|
memset (sem_usage, 0xFF, sizeof (sem_usage));
|
||||||
|
|
||||||
|
#if 0 // Deprecated since 5.2.0
|
||||||
#ifdef _MGSCHEMA_COMPOSITING
|
#ifdef _MGSCHEMA_COMPOSITING
|
||||||
if ((sem_key = get_sem_key_for_shared_surf ()) == -1) {
|
if ((sem_key = get_sem_key_for_shared_surf ()) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -415,6 +416,7 @@ int __mg_init_layers ()
|
|||||||
__mg_alloc_mutual_sem (_ssm_shared_surf, NULL);
|
__mg_alloc_mutual_sem (_ssm_shared_surf, NULL);
|
||||||
|
|
||||||
on_exit (__mg_delete_sem_set_manager, _ssm_shared_surf);
|
on_exit (__mg_delete_sem_set_manager, _ssm_shared_surf);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((sem_key = get_sem_key_for_layers ()) == -1) {
|
if ((sem_key = get_sem_key_for_layers ()) == -1) {
|
||||||
@@ -910,7 +912,7 @@ const ZNODEHEADER* GUIAPI ServerGetWinZNodeHeader (MG_Layer* layer,
|
|||||||
if (hdr->lock_count == 0) {
|
if (hdr->lock_count == 0) {
|
||||||
if (pdc->surface->shared_header) {
|
if (pdc->surface->shared_header) {
|
||||||
// XXX: consider timeout.
|
// XXX: consider timeout.
|
||||||
LOCK_SURFACE_SEM (pdc->surface->shared_header->sem_num);
|
__mg_lock_file_for_read(pdc->surface->fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
hdr->dirty_age = pdc->surface->dirty_info->dirty_age;
|
hdr->dirty_age = pdc->surface->dirty_info->dirty_age;
|
||||||
@@ -962,7 +964,7 @@ const ZNODEHEADER* GUIAPI ServerGetPopupMenuZNodeHeader (int idx,
|
|||||||
if (hdr->lock_count == 0) {
|
if (hdr->lock_count == 0) {
|
||||||
if (pdc->surface->shared_header) {
|
if (pdc->surface->shared_header) {
|
||||||
// XXX: consider timeout
|
// XXX: consider timeout
|
||||||
LOCK_SURFACE_SEM (pdc->surface->shared_header->sem_num);
|
__mg_lock_file_for_read(pdc->surface->fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
hdr->dirty_age = pdc->surface->dirty_info->dirty_age;
|
hdr->dirty_age = pdc->surface->dirty_info->dirty_age;
|
||||||
@@ -1006,7 +1008,7 @@ BOOL GUIAPI ServerReleaseWinZNodeHeader (MG_Layer* layer, int idx_znode)
|
|||||||
hdr->lock_count--;
|
hdr->lock_count--;
|
||||||
if (hdr->lock_count == 0) {
|
if (hdr->lock_count == 0) {
|
||||||
if (pdc->surface->shared_header)
|
if (pdc->surface->shared_header)
|
||||||
UNLOCK_SURFACE_SEM (pdc->surface->shared_header->sem_num);
|
__mg_unlock_file_for_read(pdc->surface->fd);
|
||||||
|
|
||||||
hdr->dirty_age = 0;
|
hdr->dirty_age = 0;
|
||||||
hdr->nr_dirty_rcs = 0;
|
hdr->nr_dirty_rcs = 0;
|
||||||
@@ -1035,7 +1037,7 @@ BOOL GUIAPI ServerReleasePopupMenuZNodeHeader (int idx)
|
|||||||
hdr->lock_count--;
|
hdr->lock_count--;
|
||||||
if (hdr->lock_count == 0) {
|
if (hdr->lock_count == 0) {
|
||||||
if (pdc->surface->shared_header)
|
if (pdc->surface->shared_header)
|
||||||
UNLOCK_SURFACE_SEM (pdc->surface->shared_header->sem_num);
|
__mg_unlock_file_for_read(pdc->surface->fd);
|
||||||
|
|
||||||
hdr->dirty_age = 0;
|
hdr->dirty_age = 0;
|
||||||
hdr->nr_dirty_rcs = 0;
|
hdr->nr_dirty_rcs = 0;
|
||||||
|
|||||||
+104
-69
@@ -277,6 +277,7 @@ ret:
|
|||||||
return ServerSendReply (clifd, &hcsr, sizeof (HCURSOR));
|
return ServerSendReply (clifd, &hcsr, sizeof (HCURSOR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0 // Deprecated since 5.2.0
|
||||||
static void my_release_sem_for_shared_surf (void* res)
|
static void my_release_sem_for_shared_surf (void* res)
|
||||||
{
|
{
|
||||||
int sem_num = (int)(intptr_t)res;
|
int sem_num = (int)(intptr_t)res;
|
||||||
@@ -312,6 +313,7 @@ static int free_sem_for_shared_surf (int cli, int clifd, void* buff, size_t len)
|
|||||||
|
|
||||||
return ServerSendReply (clifd, &ret_value, sizeof (int));
|
return ServerSendReply (clifd, &ret_value, sizeof (int));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* IS_COMPOSITING_SCHEMA */
|
#endif /* IS_COMPOSITING_SCHEMA */
|
||||||
|
|
||||||
@@ -788,18 +790,10 @@ struct nssurf_info {
|
|||||||
size_t map_size;
|
size_t map_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void my_free_val(void *val)
|
|
||||||
{
|
|
||||||
struct nssurf_info *nssurf_info = val;
|
|
||||||
if (nssurf_info->fd >= 0)
|
|
||||||
close(nssurf_info->fd);
|
|
||||||
free(val);
|
|
||||||
}
|
|
||||||
|
|
||||||
int __mg_nssurf_map_new(void)
|
int __mg_nssurf_map_new(void)
|
||||||
{
|
{
|
||||||
__nssurf_map = __mg_map_create(copy_key_string,
|
__nssurf_map = __mg_map_create(copy_key_string,
|
||||||
free_key_string, NULL, my_free_val, comp_key_string);
|
free_key_string, NULL, NULL, comp_key_string);
|
||||||
if (__nssurf_map == NULL)
|
if (__nssurf_map == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@@ -809,73 +803,37 @@ int __mg_nssurf_map_new(void)
|
|||||||
void __mg_nssurf_map_delete(void)
|
void __mg_nssurf_map_delete(void)
|
||||||
{
|
{
|
||||||
assert(__nssurf_map);
|
assert(__nssurf_map);
|
||||||
|
int sz = __mg_map_get_size(__nssurf_map);
|
||||||
|
if (sz > 0) {
|
||||||
|
_WRN_PRINTF("There are still not freed named shared surface(s): %d\n", sz);
|
||||||
|
}
|
||||||
__mg_map_destroy(__nssurf_map);
|
__mg_map_destroy(__nssurf_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get the fake screen surface (wallpaper pattern surface) */
|
static void release_nssurf_info(void *res)
|
||||||
static int get_shared_surface (int cli, int clifd, void* buff, size_t len)
|
|
||||||
{
|
{
|
||||||
SHAREDSURFINFO info = {};
|
map_entry_t *entry;
|
||||||
int fd = -1;
|
entry = __mg_map_find(__nssurf_map, res);
|
||||||
|
if (entry) {
|
||||||
assert (__gal_fake_screen);
|
|
||||||
|
|
||||||
if (strcmp(buff, SYSSF_WALLPAPER_PATTER) == 0 &&
|
|
||||||
__gal_fake_screen->shared_header) {
|
|
||||||
info.flags = __gal_fake_screen->flags;
|
|
||||||
info.size = __gal_fake_screen->shared_header->map_size;
|
|
||||||
fd = __gal_fake_screen->shared_header->fd;
|
|
||||||
}
|
|
||||||
else if (strncmp(buff, APPSF_NAME_PREFIX,
|
|
||||||
sizeof(APPSF_NAME_PREFIX) - 1) == 0) {
|
|
||||||
const char *name = buff + sizeof(APPSF_NAME_PREFIX) - 1;
|
|
||||||
map_entry_t *entry = __mg_map_find(__nssurf_map, name);
|
|
||||||
if (entry == NULL)
|
|
||||||
goto failed;
|
|
||||||
|
|
||||||
struct nssurf_info *nssurf_info = entry->val;
|
struct nssurf_info *nssurf_info = entry->val;
|
||||||
assert(nssurf_info);
|
if (nssurf_info->fd >= 0)
|
||||||
info.size = nssurf_info->map_size;
|
close(nssurf_info->fd);
|
||||||
fd = nssurf_info->fd;
|
free(nssurf_info);
|
||||||
|
|
||||||
|
__mg_map_erase(__nssurf_map, res);
|
||||||
}
|
}
|
||||||
else if (strncmp(buff, APPSF_HWND_PREFIX,
|
|
||||||
sizeof(APPSF_HWND_PREFIX) - 1) == 0) {
|
|
||||||
int client;
|
|
||||||
HWND hwnd;
|
|
||||||
int ret = sscanf(buff, APPSF_HWND_PATTER, &client, &hwnd);
|
|
||||||
if (ret != 2)
|
|
||||||
goto failed;
|
|
||||||
|
|
||||||
ZORDERNODE *znode = __mg_find_znode_by_client_hwnd(client, hwnd);
|
|
||||||
if (znode == NULL)
|
|
||||||
goto failed;
|
|
||||||
|
|
||||||
PDC pdc = dc_HDC2PDC(znode->mem_dc);
|
|
||||||
assert(pdc->surface->shared_header);
|
|
||||||
info.size = pdc->surface->shared_header->map_size;
|
|
||||||
info.width = pdc->surface->shared_header->width;
|
|
||||||
info.height = pdc->surface->shared_header->height;
|
|
||||||
info.pitch = pdc->surface->shared_header->pitch;
|
|
||||||
info.offset = pdc->surface->shared_header->pixels_off;
|
|
||||||
fd = pdc->surface->shared_header->fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ServerSendReplyEx (clifd, &info, sizeof (SHAREDSURFINFO), fd);
|
|
||||||
|
|
||||||
failed:
|
|
||||||
return ServerSendReplyEx (clifd, &info, sizeof (SHAREDSURFINFO), -1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int __mg_nssurf_map_operate_srv(const OPERATENSSURFINFO* req_info,
|
||||||
operate_nssurface(int cli, int clifd, void* buff, size_t len, int fd)
|
int cli, int fd)
|
||||||
{
|
{
|
||||||
int result = -1;
|
int result = -1;
|
||||||
map_entry_t *entry;
|
map_entry_t *entry;
|
||||||
struct nssurf_info *nssurf_info;
|
struct nssurf_info *nssurf_info;
|
||||||
|
|
||||||
OPERATENSSURFINFO* req_info = (OPERATENSSURFINFO*)buff;
|
|
||||||
switch (req_info->id_op) {
|
switch (req_info->id_op) {
|
||||||
case ID_NAMEDSSURFOP_REGISTER:
|
case ID_NAMEDSSURFOP_REGISTER:
|
||||||
|
_DBG_PRINTF("Registering name: %s from client: %d\n", req_info->name, cli);
|
||||||
entry = __mg_map_find(__nssurf_map, req_info->name);
|
entry = __mg_map_find(__nssurf_map, req_info->name);
|
||||||
if (entry)
|
if (entry)
|
||||||
goto done;
|
goto done;
|
||||||
@@ -886,10 +844,15 @@ operate_nssurface(int cli, int clifd, void* buff, size_t len, int fd)
|
|||||||
nssurf_info->creator = cli;
|
nssurf_info->creator = cli;
|
||||||
nssurf_info->fd = -1;
|
nssurf_info->fd = -1;
|
||||||
nssurf_info->map_size = 0;
|
nssurf_info->map_size = 0;
|
||||||
if (__mg_map_insert(__nssurf_map, req_info->name, nssurf_info)) {
|
entry = __mg_map_insert_ex2(__nssurf_map, req_info->name,
|
||||||
|
nssurf_info, NULL);
|
||||||
|
if (entry == NULL) {
|
||||||
free(nssurf_info);
|
free(nssurf_info);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_global_res(cli, __nssurf_map, entry->key, release_nssurf_info);
|
||||||
|
result = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_NAMEDSSURFOP_SET:
|
case ID_NAMEDSSURFOP_SET:
|
||||||
@@ -907,6 +870,7 @@ operate_nssurface(int cli, int clifd, void* buff, size_t len, int fd)
|
|||||||
|
|
||||||
nssurf_info->fd = fd;
|
nssurf_info->fd = fd;
|
||||||
nssurf_info->map_size = req_info->map_size;
|
nssurf_info->map_size = req_info->map_size;
|
||||||
|
_DBG_PRINTF("fd set for named ssurf %s: %d\n", req_info->name, fd);
|
||||||
result = 0;
|
result = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -920,8 +884,7 @@ operate_nssurface(int cli, int clifd, void* buff, size_t len, int fd)
|
|||||||
if (nssurf_info->creator != cli)
|
if (nssurf_info->creator != cli)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if (__mg_map_erase(__nssurf_map, req_info->name))
|
del_global_res(cli, __nssurf_map, entry->key);
|
||||||
goto done;
|
|
||||||
result = 0;
|
result = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -930,6 +893,79 @@ operate_nssurface(int cli, int clifd, void* buff, size_t len, int fd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int __mg_get_shared_surface_srv(const char *itn_name, SHAREDSURFINFO *info)
|
||||||
|
{
|
||||||
|
int fd = -1;
|
||||||
|
assert (__gal_fake_screen);
|
||||||
|
|
||||||
|
if (strcmp(itn_name, SYSSF_WALLPAPER_PATTER) == 0 &&
|
||||||
|
__gal_fake_screen->shared_header) {
|
||||||
|
info->flags = __gal_fake_screen->flags;
|
||||||
|
info->size = __gal_fake_screen->shared_header->map_size;
|
||||||
|
fd = __gal_fake_screen->fd;
|
||||||
|
}
|
||||||
|
else if (strncmp(itn_name, APPSF_NAME_PREFIX,
|
||||||
|
sizeof(APPSF_NAME_PREFIX) - 1) == 0) {
|
||||||
|
const char *name = itn_name + sizeof(APPSF_NAME_PREFIX) - 1;
|
||||||
|
map_entry_t *entry = __mg_map_find(__nssurf_map, name);
|
||||||
|
if (entry == NULL) {
|
||||||
|
_DBG_PRINTF("Not found named ssurf: %s\n", name);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct nssurf_info *nssurf_info = entry->val;
|
||||||
|
assert(nssurf_info);
|
||||||
|
info->size = nssurf_info->map_size;
|
||||||
|
fd = nssurf_info->fd;
|
||||||
|
}
|
||||||
|
else if (strncmp(itn_name, APPSF_HWND_PREFIX,
|
||||||
|
sizeof(APPSF_HWND_PREFIX) - 1) == 0) {
|
||||||
|
int client;
|
||||||
|
HWND hwnd;
|
||||||
|
int ret = sscanf(itn_name, APPSF_HWND_PATTER, &client, &hwnd);
|
||||||
|
if (ret != 2) {
|
||||||
|
_WRN_PRINTF("Failed sscanf: %s\n", itn_name);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZORDERNODE *znode = __mg_find_znode_by_client_hwnd(client, hwnd);
|
||||||
|
if (znode == NULL)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
PDC pdc = dc_HDC2PDC(znode->mem_dc);
|
||||||
|
assert(pdc->surface->shared_header);
|
||||||
|
info->size = pdc->surface->shared_header->map_size;
|
||||||
|
info->width = pdc->surface->shared_header->width;
|
||||||
|
info->height = pdc->surface->shared_header->height;
|
||||||
|
info->pitch = pdc->surface->shared_header->pitch;
|
||||||
|
info->offset = pdc->surface->shared_header->pixels_off;
|
||||||
|
fd = pdc->surface->fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
return fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get the fake screen surface (wallpaper pattern surface) */
|
||||||
|
static int get_shared_surface (int cli, int clifd, void* buff, size_t len)
|
||||||
|
{
|
||||||
|
SHAREDSURFINFO info = {};
|
||||||
|
int fd = __mg_get_shared_surface_srv(buff, &info);
|
||||||
|
|
||||||
|
return ServerSendReplyEx (clifd, &info, sizeof (SHAREDSURFINFO), fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
operate_nssurface(int cli, int clifd, void* buff, size_t len, int fd)
|
||||||
|
{
|
||||||
|
int result = -1;
|
||||||
|
|
||||||
|
assert(len >= sizeof(OPERATENSSURFINFO));
|
||||||
|
OPERATENSSURFINFO* req_info = (OPERATENSSURFINFO*)buff;
|
||||||
|
result = __mg_nssurf_map_operate_srv(req_info, cli, fd);
|
||||||
return ServerSendReply(clifd, &result, sizeof(int));
|
return ServerSendReply(clifd, &result, sizeof(int));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1019,8 +1055,12 @@ static struct req_request {
|
|||||||
#if IS_COMPOSITING_SCHEMA
|
#if IS_COMPOSITING_SCHEMA
|
||||||
{ load_cursor_png_file, 0 }, // REQID_LOADCURSOR_PNG
|
{ load_cursor_png_file, 0 }, // REQID_LOADCURSOR_PNG
|
||||||
{ load_cursor_png_mem, 0 }, // REQID_LOADCURSOR_PNG_MEM
|
{ load_cursor_png_mem, 0 }, // REQID_LOADCURSOR_PNG_MEM
|
||||||
|
{ operate_nssurface, 1 }, // REQID_OPERATENSSURF
|
||||||
|
{ NULL, 0 },
|
||||||
|
#if 0 // Deprecated since 5.2.0
|
||||||
{ alloc_sem_for_shared_surf, 0 }, // REQID_ALLOC_SURF_SEM
|
{ alloc_sem_for_shared_surf, 0 }, // REQID_ALLOC_SURF_SEM
|
||||||
{ free_sem_for_shared_surf, 0 }, // REQID_FREE_SURF_SEM
|
{ free_sem_for_shared_surf, 0 }, // REQID_FREE_SURF_SEM
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
{ NULL, 0 },
|
{ NULL, 0 },
|
||||||
{ NULL, 0 },
|
{ NULL, 0 },
|
||||||
@@ -1030,11 +1070,6 @@ static struct req_request {
|
|||||||
{ move_to_layer, 0 }, // REQID_MOVETOLAYER
|
{ move_to_layer, 0 }, // REQID_MOVETOLAYER
|
||||||
{ calc_position, 0 }, // REQID_CALCPOSITION
|
{ calc_position, 0 }, // REQID_CALCPOSITION
|
||||||
{ authenticate_client, 0 }, // REQID_AUTHCLIENT
|
{ authenticate_client, 0 }, // REQID_AUTHCLIENT
|
||||||
#if IS_COMPOSITING_SCHEMA
|
|
||||||
{ operate_nssurface, 1 }, // REQID_OPERATENSSURF
|
|
||||||
#else
|
|
||||||
{ NULL, 0 },
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BOOL GUIAPI RegisterRequestHandler (int req_id, REQ_HANDLER your_handler)
|
BOOL GUIAPI RegisterRequestHandler (int req_id, REQ_HANDLER your_handler)
|
||||||
|
|||||||
Reference in New Issue
Block a user