tune code for 64b (MiniGUI-Processes runmode)

This commit is contained in:
VincentWei
2018-01-19 15:35:26 +08:00
parent 01bc3d7c42
commit 766ddb5555
19 changed files with 347 additions and 553 deletions

View File

@@ -1883,17 +1883,26 @@ int init_minigui_printf (int (*output_char) (int ch),
#endif /* _MGUSE_OWN_STDIO */
#if defined(__GNUC__)
#ifdef _DEBUG
# define _MG_PRINTF(fmt...) fprintf (stderr, fmt)
# define _DBG_PRINTF(fmt...) fprintf (stdout, fmt)
#else
# define _MG_PRINTF(fmt...)
# define _DBG_PRINTF(fmt...)
#endif
# define _ERR_PRINTF(fmt...) fprintf (stderr, fmt)
# ifdef _DEBUG
# define _MG_PRINTF(fmt...) fprintf (stderr, fmt)
# define _DBG_PRINTF(fmt...) fprintf (stdout, fmt)
# else
# define _MG_PRINTF(fmt...)
# define _DBG_PRINTF(fmt...)
# endif
#else /* __GNUC__ */
#include <stdio.h>
#include <stdarg.h>
static inline void _ERR_PRINTF(const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
va_end(ap);
}
static inline void _MG_PRINTF(const char* fmt, ...)
{
#ifdef _DEBUG
@@ -1904,6 +1913,17 @@ static inline void _MG_PRINTF(const char* fmt, ...)
va_end(ap);
#endif
}
static inline void _DBG_PRINTF(const char* fmt, ...)
{
#ifdef _DEBUG
va_list ap;
va_start(ap, fmt);
vfprintf(stdout, fmt, ap);
fprintf(stdout, "\n");
va_end(ap);
#endif
}
#endif /* __GNUC__ */
#ifdef _MGRM_THREADS

View File

@@ -2443,7 +2443,7 @@ MG_EXPORT void GUIAPI SetAutoRepeatMessage (HWND hwnd, UINT msg,
#define CLIENT_ACTIVE -4
/**
* \fn int Send2Client (MSG* msg, int cli)
* \fn int Send2Client (const MSG* msg, int cli)
* \brief Sends a message to a client.
*
* This function sends a message to the specified client \a cli.
@@ -2472,7 +2472,7 @@ MG_EXPORT void GUIAPI SetAutoRepeatMessage (HWND hwnd, UINT msg,
*
* \sa Send2TopMostClients, Send2ActiveWindow
*/
int GUIAPI Send2Client (MSG* msg, int cli);
int GUIAPI Send2Client (const MSG* msg, int cli);
/**
* \fn BOOL Send2TopMostClients (UINT nMsg, WPARAM wParam, LPARAM lParam)

View File

@@ -144,6 +144,7 @@ typedef struct ZorderOpInfo
HWND main_win;
RECT rc;
RECT rcA;
int location;
char caption[MAX_CAPTION_LEN + 1];
} ZORDEROPINFO;

View File

@@ -31,8 +31,8 @@ extern "C" {
#define GAL_LIL_ENDIAN MGUI_LIL_ENDIAN
#define GAL_BIG_ENDIAN MGUI_BIG_ENDIAN
#define GAL_OutOfMemory() fprintf (stderr, "Out of memory\n")
#define GAL_SetError printf
#define GAL_OutOfMemory() _ERR_PRINTF("NEWGAL: Out of memory\n")
#define GAL_SetError _ERR_PRINTF
#define GAL_ClearError()
/* Transparency definitions: These define alpha as the opacity of a surface */

View File

@@ -62,9 +62,9 @@ void log_sys(const char *, ...);
#endif
typedef struct listen_fd {
int fd;
int hwnd;
int type;
int fd;
void* hwnd;
void* context;
} LISTEN_FD;

View File

@@ -56,15 +56,14 @@ void __mg_remove_client (int cli, int clifd);
int __mg_handle_request (int clifd, int req_id, int cli);
int __mg_send2client (MSG* msg, MG_Client* client);
int __mg_send2client (const MSG* msg, MG_Client* client);
void __mg_set_active_client (MG_Client* client);
void __mg_start_server_desktop (void);
int __mg_post_msg_by_znode (const ZORDERINFO* zi, int znode,
int message, WPARAM wParam, LPARAM lParam);
int __mg_do_zorder_operation (int cli, const ZORDEROPINFO* info);
int __mg_do_zorder_maskrect_operation (int cli,
const ZORDERMASKRECTOPINFO* info);
intptr_t __mg_do_zorder_operation (int cli, const ZORDEROPINFO* info);
intptr_t __mg_do_zorder_maskrect_operation (int cli, const ZORDERMASKRECTOPINFO* info);
int __mg_remove_all_znodes_of_client (int cli);
int __mg_handle_normal_mouse_move (const ZORDERINFO* zi, int x, int y);

View File

@@ -18,7 +18,7 @@ libkernel_la_SOURCES = timer.c \
endif
# hash.c
EXTRA_DIST= desktop.c desktop-comm.c makefile.ng makefile.msvc
EXTRA_DIST= desktop.c desktop-comm.c cursor-comm.c makefile.ng makefile.msvc
# for makefile.ng and makefile.msvc
LIB_NAME = libkernel

174
src/kernel/cursor-comm.c Normal file
View File

@@ -0,0 +1,174 @@
static HCURSOR load_cursor_from_file (const char* filename)
{
FILE* fp;
WORD16 wTemp;
int w, h, xhot, yhot, colornum;
#if 0
DWORD32 size;
#endif
DWORD32 offset, imagesize, imagew, imageh;
BYTE* image;
HCURSOR csr = 0;
if (!(fp = fopen(filename, "rb")))
return 0;
fseek(fp, sizeof(WORD16), SEEK_SET);
/* the cbType of struct CURSORDIR. */
wTemp = MGUI_ReadLE16FP (fp);
if(wTemp != 2) {
_MG_PRINTF ("LoadCursorFromFile: bad file type: %d\n", wTemp);
goto error;
}
/* skip the cdCount of struct CURSORDIR, we always use the first cursor. */
fseek(fp, sizeof(WORD16), SEEK_CUR);
/* cursor info, read the members of struct CURSORDIRENTRY. */
w = fgetc (fp); /* the width of first cursor. */
h = fgetc (fp); /* the height of first cursor. */
if (w != CURSORWIDTH || h != CURSORHEIGHT) {
_MG_PRINTF ("LoadCursorFromFile: bad first cursor width (%d) and height (%d)\n", w, h);
goto error;
}
fseek(fp, sizeof(BYTE)*2, SEEK_CUR); /* skip bColorCount and bReserved. */
wTemp = MGUI_ReadLE16FP (fp);
xhot = wTemp;
wTemp = MGUI_ReadLE16FP (fp);
yhot = wTemp;
#if 0
size = MGUI_ReadLE32FP (fp);
#else
fseek (fp, sizeof(DWORD32), SEEK_CUR); /* skip size. */
#endif
offset = MGUI_ReadLE32FP (fp);
/* read the cursor image info. */
fseek(fp, offset, SEEK_SET);
fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biSize member. */
imagew = MGUI_ReadLE32FP (fp);
imageh = MGUI_ReadLE32FP (fp);
if (imagew != CURSORWIDTH || imageh != (CURSORHEIGHT*2)) {
_MG_PRINTF ("LoadCursorFromFile: bad cursor image width (%d) and height (%d)\n", imagew, imageh);
goto error;
}
/* check the biPlanes member; */
wTemp = MGUI_ReadLE16FP (fp);
if (wTemp != 1) {
_MG_PRINTF ("LoadCursorFromFile: bad planes (%d)\n", wTemp);
goto error;
}
/* check the biBitCount member; */
wTemp = MGUI_ReadLE16FP (fp);
if (wTemp > 4) {
_MG_PRINTF ("LoadCursorFromFile: bad bit count (%d)\n", wTemp);
goto error;
}
colornum = (int)wTemp;
fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biCompression members. */
imagesize = MGUI_ReadLE32FP (fp);
/* skip the rest members and the color table. */
fseek(fp, sizeof(DWORD32)*4 + sizeof(BYTE)*(4<<colornum), SEEK_CUR);
/* allocate memory for image. */
if ((image = (BYTE*)ALLOCATE_LOCAL (imagesize)) == NULL) {
_MG_PRINTF ("LoadCursorFromFile: error when allocating memory for image (%d)\n", imagesize);
goto error;
}
/* read image */
if (fread (image, 1, imagesize, fp) < imagesize) {
_MG_PRINTF ("LoadCursorFromFile: error when reading data from file\n");
goto error;
}
csr = CreateCursor (xhot, yhot, w, h,
image + (imagesize - MONOSIZE), image, colornum);
DEALLOCATE_LOCAL (image);
fclose (fp);
return csr;
error:
_MG_PRINTF ("LoadCursorFromFile: failed when loading cursor from %s\n", filename);
fclose (fp);
return csr;
}
static HCURSOR load_cursor_from_mem (const void* area)
{
const Uint8* p = (Uint8*)area;
WORD16 wTemp;
int w, h, xhot, yhot, colornum;
#if 0
DWORD32 size;
#endif
DWORD32 offset, imagesize, imagew, imageh;
p += sizeof (WORD16);
wTemp = MGUI_ReadLE16Mem (&p);
if(wTemp != 2) goto error;
/* skip the cdCount of struct CURSORDIR, we always use the first cursor. */
p += sizeof (WORD16);
/* cursor info, read the members of struct CURSORDIRENTRY. */
w = *p++; /* the width of first cursor. */
h = *p++; /* the height of first cursor. */
if (w != CURSORWIDTH || h != CURSORHEIGHT)
goto error;
/* skip the bColorCount and bReserved. */
p += sizeof(BYTE)*2;
xhot = MGUI_ReadLE16Mem (&p);
yhot = MGUI_ReadLE16Mem (&p);
#if 0
size = MGUI_ReadLE32Mem (&p);
#else
p += sizeof(DWORD32); /* skip size. */
#endif
offset = MGUI_ReadLE32Mem (&p);
/* read the cursor image info. */
p = (Uint8*)area + offset;
/* skip the biSize member. */
p += sizeof (DWORD32);
imagew = MGUI_ReadLE32Mem (&p);
imageh = MGUI_ReadLE32Mem (&p);
if (imagew > 32 || imageh > 32) {
goto error;
}
/* check the biPlanes member; */
wTemp = MGUI_ReadLE16Mem (&p);
if (wTemp != 1) goto error;
/* check the biBitCount member; */
wTemp = MGUI_ReadLE16Mem (&p);
if (wTemp > 4) goto error;
colornum = wTemp;
/* skip the biCompression members. */
p += sizeof (DWORD32);
imagesize = MGUI_ReadLE32Mem (&p);
/* skip the rest members and the color table. */
p += sizeof(DWORD32)*4 + sizeof(BYTE)*(4<<colornum);
return CreateCursor (xhot, yhot, w, h,
p + (imagesize - MONOSIZE), p, colornum);
error:
_MG_PRINTF ("LoadCursorFromMem: failed when loading cursor from %p\n", area);
return 0;
}

View File

@@ -1,13 +1,11 @@
/*
** $Id: cursor-lite.c 7188 2007-05-16 11:01:59Z weiym $
** $Id: cursor-procs.c 7188 2007-05-16 11:01:59Z weiym $
**
** cursor-lite.c: Cursor support module for MiniGUI-Processes.
**
** Copyright (C) 2003 ~ 2008 Feynman Software.
** Copyright (C) 2003 ~ 2018 FMSoft
** Copyright (C) 1999 ~ 2002 Wei Yongming.
**
** All right reserved by Feynman Software.
**
** Current maintainer: Wei Yongming.
**
** Create date: 1999/01/06
@@ -226,77 +224,12 @@ HCURSOR GUIAPI CreateCursor (int xhotspot, int yhotspot, int w, int h,
}
}
static HCURSOR srvLoadCursorFromFile (const char* filename)
{
FILE* fp;
WORD16 wTemp;
int ret = 0;
int w, h, xhot, yhot, colornum;
DWORD32 size, offset;
DWORD32 imagesize, imagew, imageh;
BYTE* image;
if( !(fp = fopen(filename, "rb")) ) return 0;
fseek(fp, sizeof(WORD16), SEEK_SET);
/* the cbType of struct CURSORDIR. */
wTemp = MGUI_ReadLE16FP (fp);
if(wTemp != 2) goto error;
/* skip the cdCount of struct CURSORDIR, we always use the first cursor. */
fseek(fp, sizeof(WORD16), SEEK_CUR);
/* cursor info, read the members of struct CURSORDIRENTRY. */
w = fgetc (fp); /* the width of first cursor. */
h = fgetc (fp); /* the height of first cursor. */
if (w != CURSORWIDTH || h != CURSORHEIGHT) goto error;
fseek(fp, sizeof(BYTE)*2, SEEK_CUR); /* skip bColorCount and bReserved. */
wTemp = MGUI_ReadLE16FP (fp);
xhot = wTemp;
wTemp = MGUI_ReadLE16FP (fp);
yhot = wTemp;
size = MGUI_ReadLE32FP (fp);
offset = MGUI_ReadLE32FP (fp);
/* read the cursor image info. */
fseek(fp, offset, SEEK_SET);
fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip biSize member. */
imagew = MGUI_ReadLE32FP (fp);
imageh = MGUI_ReadLE32FP (fp);
/* check the biPlanes member; */
wTemp = MGUI_ReadLE16FP (fp);
if(wTemp != 1) goto error;
/* check the biBitCount member; */
wTemp = MGUI_ReadLE16FP (fp);
if(wTemp > 4) goto error;
colornum = (int)wTemp;
fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biCompression members. */
imagesize = MGUI_ReadLE32FP (fp);
/* skip the rest members and the color table. */
fseek(fp, sizeof(DWORD32)*4 + sizeof(BYTE)*(4<<colornum), SEEK_CUR);
/* allocate memory for image. */
if ((image = (BYTE*)ALLOCATE_LOCAL (imagesize)) == NULL)
goto error;
/* read image */
fread (image, imagesize, 1, fp);
ret = srvCreateCursor (xhot, yhot, w, h,
image + (imagesize - MONOSIZE), image, colornum);
DEALLOCATE_LOCAL (image);
error:
fclose (fp);
return ret;
}
#include "cursor-comm.c"
HCURSOR GUIAPI LoadCursorFromFile (const char* filename)
{
if (mgIsServer) {
return srvLoadCursorFromFile (filename);
return load_cursor_from_file (filename);
}
else {
HCURSOR hcursor;
@@ -315,62 +248,7 @@ HCURSOR GUIAPI LoadCursorFromFile (const char* filename)
HCURSOR GUIAPI LoadCursorFromMem (const void* area)
{
const Uint8* p = (Uint8*)area;
WORD16 wTemp;
int w, h, xhot, yhot, colornum;
DWORD32 size, offset;
DWORD32 imagesize, imagew, imageh;
p += sizeof (WORD16);
wTemp = MGUI_ReadLE16Mem (&p);
if(wTemp != 2) goto error;
/* skip the cdCount of struct CURSORDIR, we always use the first cursor. */
p += sizeof (WORD16);
/* cursor info, read the members of struct CURSORDIRENTRY. */
w = *p++; /* the width of first cursor. */
h = *p++; /* the height of first cursor. */
if (w != CURSORWIDTH || h != CURSORHEIGHT)
goto error;
/* skip the bColorCount and bReserved. */
p += sizeof(BYTE)*2;
xhot = MGUI_ReadLE16Mem (&p);
yhot = MGUI_ReadLE16Mem (&p);
size = MGUI_ReadLE32Mem (&p);
offset = MGUI_ReadLE32Mem (&p);
/* read the cursor image info. */
p = (Uint8*)area + offset;
/* skip the biSize member. */
p += sizeof (DWORD32);
imagew = MGUI_ReadLE32Mem (&p);
imageh = MGUI_ReadLE32Mem (&p);
/* check the biPlanes member; */
wTemp = MGUI_ReadLE16Mem (&p);
if (wTemp != 1) goto error;
/* check the biBitCount member; */
wTemp = MGUI_ReadLE16Mem (&p);
if (wTemp > 4) goto error;
colornum = wTemp;
/* skip the biCompression members. */
p += sizeof (DWORD32);
imagesize = MGUI_ReadLE32Mem (&p);
/* skip the rest members and the color table. */
p += sizeof(DWORD32)*4 + sizeof(BYTE)*(4<<colornum);
return CreateCursor (xhot, yhot, w, h,
p + (imagesize - MONOSIZE), p, colornum);
error:
return 0;
return load_cursor_from_mem (area);
}
static BOOL srvDestroyCursor (HCURSOR hcsr)

View File

@@ -58,132 +58,16 @@ static int nShowCount = 0;
static PCURSOR pCurCsr = NULL;
/* Cursor creating and destroying. */
#include "cursor-comm.c"
HCURSOR GUIAPI LoadCursorFromFile(const char* filename)
{
FILE* fp;
WORD16 wTemp;
int w, h, xhot, yhot, colornum;
DWORD32 size, offset;
DWORD32 imagesize, imagew, imageh;
BYTE* image;
HCURSOR csr = 0;
if( !(fp = fopen(filename, "rb")) ) return 0;
fseek(fp, sizeof(WORD16), SEEK_SET);
/* the cbType of struct CURSORDIR. */
wTemp = MGUI_ReadLE16FP (fp);
if(wTemp != 2) goto error;
/* skip the cdCount of struct CURSORDIR, we always use the first cursor. */
fseek(fp, sizeof(WORD16), SEEK_CUR);
/* cursor info, read the members of struct CURSORDIRENTRY. */
w = fgetc (fp); /* the width of first cursor. */
h = fgetc (fp); /* the height of first cursor. */
if(w != CURSORWIDTH || h != CURSORHEIGHT) goto error;
fseek(fp, sizeof(BYTE)*2, SEEK_CUR); /* skip bColorCount and bReserved. */
wTemp = MGUI_ReadLE16FP (fp);
xhot = wTemp;
wTemp = MGUI_ReadLE16FP (fp);
yhot = wTemp;
size = MGUI_ReadLE32FP (fp);
offset = MGUI_ReadLE32FP (fp);
/* read the cursor image info. */
fseek(fp, offset, SEEK_SET);
fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biSize member. */
imagew = MGUI_ReadLE32FP (fp);
imageh = MGUI_ReadLE32FP (fp);
/* check the biPlanes member; */
wTemp = MGUI_ReadLE16FP (fp);
if(wTemp != 1) goto error;
/* check the biBitCount member; */
wTemp = MGUI_ReadLE16FP (fp);
if(wTemp > 4) goto error;
colornum = (int)wTemp;
fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biCompression members. */
imagesize = MGUI_ReadLE32FP (fp);
/* skip the rest members and the color table. */
fseek(fp, sizeof(DWORD32)*4 + sizeof(BYTE)*(4<<colornum), SEEK_CUR);
/* allocate memory for image. */
if ((image = (BYTE*)ALLOCATE_LOCAL (imagesize)) == NULL)
goto error;
/* read image */
fread (image, imagesize, 1, fp);
csr = CreateCursor(xhot, yhot, w, h,
image + (imagesize - MONOSIZE), image, colornum);
DEALLOCATE_LOCAL (image);
error:
fclose (fp);
return csr;
return load_cursor_from_file (filename);
}
HCURSOR GUIAPI LoadCursorFromMem (const void* area)
{
const Uint8* p = (Uint8*)area;
WORD16 wTemp;
int w, h, xhot, yhot, colornum;
DWORD32 size, offset;
DWORD32 imagesize, imagew, imageh;
p += sizeof (WORD16);
wTemp = MGUI_ReadLE16Mem (&p);
if(wTemp != 2) goto error;
/* skip the cdCount of struct CURSORDIR, we always use the first cursor. */
p += sizeof (WORD16);
/* cursor info, read the members of struct CURSORDIRENTRY. */
w = *p++; /* the width of first cursor. */
h = *p++; /* the height of first cursor. */
if (w != CURSORWIDTH || h != CURSORHEIGHT)
goto error;
/* skip the bColorCount and bReserved. */
p += sizeof(BYTE)*2;
xhot = MGUI_ReadLE16Mem (&p);
yhot = MGUI_ReadLE16Mem (&p);
size = MGUI_ReadLE32Mem (&p);
offset = MGUI_ReadLE32Mem (&p);
/* read the cursor image info. */
p = (Uint8*)area + offset;
/* skip the biSize member. */
p += sizeof (DWORD32);
imagew = MGUI_ReadLE32Mem (&p);
imageh = MGUI_ReadLE32Mem (&p);
/* check the biPlanes member; */
wTemp = MGUI_ReadLE16Mem (&p);
if (wTemp != 1) goto error;
/* check the biBitCount member; */
wTemp = MGUI_ReadLE16Mem (&p);
if (wTemp > 4) goto error;
colornum = wTemp;
/* skip the biCompression members. */
p += sizeof (DWORD32);
imagesize = MGUI_ReadLE32Mem (&p);
/* skip the rest members and the color table. */
p += sizeof(DWORD32)*4 + sizeof(BYTE)*(4<<colornum);
return CreateCursor (xhot, yhot, w, h,
p + (imagesize - MONOSIZE), p, colornum);
error:
return 0;
return load_cursor_from_mem (area);
}
static BITMAP csr_bmp = {

View File

@@ -89,178 +89,16 @@ Uint8* GetPixelUnderCursor (int x, int y, gal_pixel* pixel)
}
/* Cursor creating and destroying. */
/* Only called from InitCursor and client code. */
HCURSOR GUIAPI LoadCursorFromFile(const char* filename)
#include "cursor-comm.c"
HCURSOR GUIAPI LoadCursorFromFile (const char* filename)
{
FILE* fp;
WORD16 wTemp;
int w, h, xhot, yhot, colornum;
#if 0
DWORD32 size;
#endif
DWORD32 offset, imagesize, imagew, imageh;
BYTE* image;
HCURSOR csr = 0;
if (!(fp = fopen(filename, "rb")))
return 0;
fseek(fp, sizeof(WORD16), SEEK_SET);
/* the cbType of struct CURSORDIR. */
wTemp = MGUI_ReadLE16FP (fp);
if(wTemp != 2) {
_MG_PRINTF ("LoadCursorFromFile: bad file type: %d\n", wTemp);
goto error;
}
/* skip the cdCount of struct CURSORDIR, we always use the first cursor. */
fseek(fp, sizeof(WORD16), SEEK_CUR);
/* cursor info, read the members of struct CURSORDIRENTRY. */
w = fgetc (fp); /* the width of first cursor. */
h = fgetc (fp); /* the height of first cursor. */
if (w != CURSORWIDTH || h != CURSORHEIGHT) {
_MG_PRINTF ("LoadCursorFromFile: bad first cursor width (%d) and height (%d)\n", w, h);
goto error;
}
fseek(fp, sizeof(BYTE)*2, SEEK_CUR); /* skip bColorCount and bReserved. */
wTemp = MGUI_ReadLE16FP (fp);
xhot = wTemp;
wTemp = MGUI_ReadLE16FP (fp);
yhot = wTemp;
#if 0
size = MGUI_ReadLE32FP (fp);
#else
fseek (fp, sizeof(DWORD32), SEEK_CUR); /* skip size. */
#endif
offset = MGUI_ReadLE32FP (fp);
/* read the cursor image info. */
fseek(fp, offset, SEEK_SET);
fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biSize member. */
imagew = MGUI_ReadLE32FP (fp);
imageh = MGUI_ReadLE32FP (fp);
if (imagew != CURSORWIDTH || imageh != (CURSORHEIGHT*2)) {
_MG_PRINTF ("LoadCursorFromFile: bad cursor image width (%d) and height (%d)\n", imagew, imageh);
goto error;
}
/* check the biPlanes member; */
wTemp = MGUI_ReadLE16FP (fp);
if (wTemp != 1) {
_MG_PRINTF ("LoadCursorFromFile: bad planes (%d)\n", wTemp);
goto error;
}
/* check the biBitCount member; */
wTemp = MGUI_ReadLE16FP (fp);
if (wTemp > 4) {
_MG_PRINTF ("LoadCursorFromFile: bad bit count (%d)\n", wTemp);
goto error;
}
colornum = (int)wTemp;
fseek(fp, sizeof(DWORD32), SEEK_CUR); /* skip the biCompression members. */
imagesize = MGUI_ReadLE32FP (fp);
/* skip the rest members and the color table. */
fseek(fp, sizeof(DWORD32)*4 + sizeof(BYTE)*(4<<colornum), SEEK_CUR);
/* allocate memory for image. */
if ((image = (BYTE*)ALLOCATE_LOCAL (imagesize)) == NULL) {
_MG_PRINTF ("LoadCursorFromFile: error when allocating memory for image (%d)\n", imagesize);
goto error;
}
/* read image */
if (fread (image, 1, imagesize, fp) < imagesize) {
_MG_PRINTF ("LoadCursorFromFile: error when reading data from file\n");
goto error;
}
csr = CreateCursor (xhot, yhot, w, h,
image + (imagesize - MONOSIZE), image, colornum);
DEALLOCATE_LOCAL (image);
fclose (fp);
return csr;
error:
_MG_PRINTF ("LoadCursorFromFile: failed when loading cursor from %s\n", filename);
fclose (fp);
return csr;
return __mgLoadCursorFromFile (filename);
}
HCURSOR GUIAPI LoadCursorFromMem (const void* area)
{
const Uint8* p = (Uint8*)area;
WORD16 wTemp;
int w, h, xhot, yhot, colornum;
#if 0
DWORD32 size;
#endif
DWORD32 offset, imagesize, imagew, imageh;
p += sizeof (WORD16);
wTemp = MGUI_ReadLE16Mem (&p);
if(wTemp != 2) goto error;
/* skip the cdCount of struct CURSORDIR, we always use the first cursor. */
p += sizeof (WORD16);
/* cursor info, read the members of struct CURSORDIRENTRY. */
w = *p++; /* the width of first cursor. */
h = *p++; /* the height of first cursor. */
if (w != CURSORWIDTH || h != CURSORHEIGHT)
goto error;
/* skip the bColorCount and bReserved. */
p += sizeof(BYTE)*2;
xhot = MGUI_ReadLE16Mem (&p);
yhot = MGUI_ReadLE16Mem (&p);
#if 0
size = MGUI_ReadLE32Mem (&p);
#else
p += sizeof(DWORD32); /* skip size. */
#endif
offset = MGUI_ReadLE32Mem (&p);
/* read the cursor image info. */
p = (Uint8*)area + offset;
/* skip the biSize member. */
p += sizeof (DWORD32);
imagew = MGUI_ReadLE32Mem (&p);
imageh = MGUI_ReadLE32Mem (&p);
if (imagew > 32 || imageh > 32) {
goto error;
}
/* check the biPlanes member; */
wTemp = MGUI_ReadLE16Mem (&p);
if (wTemp != 1) goto error;
/* check the biBitCount member; */
wTemp = MGUI_ReadLE16Mem (&p);
if (wTemp > 4) goto error;
colornum = wTemp;
/* skip the biCompression members. */
p += sizeof (DWORD32);
imagesize = MGUI_ReadLE32Mem (&p);
/* skip the rest members and the color table. */
p += sizeof(DWORD32)*4 + sizeof(BYTE)*(4<<colornum);
return CreateCursor (xhot, yhot, w, h,
p + (imagesize - MONOSIZE), p, colornum);
error:
_MG_PRINTF ("LoadCursorFromMem: failed when loading cursor from %p\n", area);
return 0;
return __mgLoadCursorFromMem (area);
}
static BITMAP csr_bmp = {

View File

@@ -3,7 +3,7 @@
**
** desktop-procs.c: The desktop procedures for MiniGUI-Processes
**
** Copyright (C) 2002 ~ 2008 Feynman Software.
** Copyright (C) 2002 ~ 2018 FMSoft
**
** Current maintainer: Wei Yongming.
**
@@ -278,9 +278,9 @@ void __mg_start_client_desktop (void)
SendMessage (HWND_DESKTOP, MSG_STARTSESSION, 0, 0);
}
static int cliAllocZOrderNode (PMAINWIN pWin)
static intptr_t cliAllocZOrderNode (PMAINWIN pWin)
{
int ret;
intptr_t ret;
REQUEST req;
ZORDEROPINFO info;
@@ -304,15 +304,15 @@ static int cliAllocZOrderNode (PMAINWIN pWin)
req.data = &info;
req.len_data = sizeof (ZORDEROPINFO);
if (ClientRequest (&req, &ret, sizeof (int)) < 0)
if (ClientRequest (&req, &ret, sizeof (intptr_t)) < 0)
return -1;
return ret;
}
static int cliFreeZOrderNode (PMAINWIN pWin)
static intptr_t cliFreeZOrderNode (PMAINWIN pWin)
{
int ret;
intptr_t ret;
REQUEST req;
ZORDEROPINFO info;
@@ -323,15 +323,15 @@ static int cliFreeZOrderNode (PMAINWIN pWin)
req.data = &info;
req.len_data = sizeof (ZORDEROPINFO);
if (ClientRequest (&req, &ret, sizeof (int)) < 0)
if (ClientRequest (&req, &ret, sizeof (intptr_t)) < 0)
return -1;
return ret;
}
static int cliMove2Top (PMAINWIN pWin)
static intptr_t cliMove2Top (PMAINWIN pWin)
{
int ret;
intptr_t ret;
REQUEST req;
ZORDEROPINFO info;
@@ -342,15 +342,15 @@ static int cliMove2Top (PMAINWIN pWin)
req.data = &info;
req.len_data = sizeof (ZORDEROPINFO);
if (ClientRequest (&req, &ret, sizeof (int)) < 0)
if (ClientRequest (&req, &ret, sizeof (intptr_t)) < 0)
return -1;
return ret;
}
static int cliShowWindow (PMAINWIN pWin)
static intptr_t cliShowWindow (PMAINWIN pWin)
{
int ret;
intptr_t ret;
REQUEST req;
ZORDEROPINFO info;
@@ -361,15 +361,15 @@ static int cliShowWindow (PMAINWIN pWin)
req.data = &info;
req.len_data = sizeof (ZORDEROPINFO);
if (ClientRequest (&req, &ret, sizeof (int)) < 0)
if (ClientRequest (&req, &ret, sizeof (intptr_t)) < 0)
return -1;
return ret;
}
static int cliHideWindow (PMAINWIN pWin)
static intptr_t cliHideWindow (PMAINWIN pWin)
{
int ret;
intptr_t ret;
REQUEST req;
ZORDEROPINFO info;
@@ -380,15 +380,15 @@ static int cliHideWindow (PMAINWIN pWin)
req.data = &info;
req.len_data = sizeof (ZORDEROPINFO);
if (ClientRequest (&req, &ret, sizeof (int)) < 0)
if (ClientRequest (&req, &ret, sizeof (intptr_t)) < 0)
return -1;
return ret;
}
static int cliMoveWindow (PMAINWIN pWin, const RECT* rcWin)
static intptr_t cliMoveWindow (PMAINWIN pWin, const RECT* rcWin)
{
int ret;
intptr_t ret;
REQUEST req;
ZORDEROPINFO info;
@@ -400,15 +400,15 @@ static int cliMoveWindow (PMAINWIN pWin, const RECT* rcWin)
req.data = &info;
req.len_data = sizeof (ZORDEROPINFO);
if (ClientRequest (&req, &ret, sizeof (int)) < 0)
if (ClientRequest (&req, &ret, sizeof (intptr_t)) < 0)
return -1;
return ret;
}
static int cliSetActiveWindow (PMAINWIN pWin)
static intptr_t cliSetActiveWindow (PMAINWIN pWin)
{
int ret;
intptr_t ret;
REQUEST req;
ZORDEROPINFO info;
@@ -419,16 +419,16 @@ static int cliSetActiveWindow (PMAINWIN pWin)
req.data = &info;
req.len_data = sizeof (ZORDEROPINFO);
if (ClientRequest (&req, &ret, sizeof (int)) < 0)
if (ClientRequest (&req, &ret, sizeof (intptr_t)) < 0)
return -1;
return ret;
}
#ifdef _MGHAVE_MENU
static int cliStartTrackPopupMenu (PTRACKMENUINFO ptmi)
static intptr_t cliStartTrackPopupMenu (PTRACKMENUINFO ptmi)
{
int ret;
intptr_t ret;
REQUEST req;
ZORDEROPINFO info;
@@ -440,15 +440,15 @@ static int cliStartTrackPopupMenu (PTRACKMENUINFO ptmi)
req.data = &info;
req.len_data = sizeof (ZORDEROPINFO);
if (ClientRequest (&req, &ret, sizeof (int)) < 0)
if (ClientRequest (&req, &ret, sizeof (intptr_t)) < 0)
return -1;
return ret;
}
static int cliEndTrackPopupMenu (PTRACKMENUINFO ptmi)
static intptr_t cliEndTrackPopupMenu (PTRACKMENUINFO ptmi)
{
int ret;
intptr_t ret;
REQUEST req;
ZORDEROPINFO info;
@@ -460,15 +460,15 @@ static int cliEndTrackPopupMenu (PTRACKMENUINFO ptmi)
req.data = &info;
req.len_data = sizeof (ZORDEROPINFO);
if (ClientRequest (&req, &ret, sizeof (int)) < 0)
if (ClientRequest (&req, &ret, sizeof (intptr_t)) < 0)
return -1;
return ret;
}
static int cliForceCloseMenu (void)
static intptr_t cliForceCloseMenu (void)
{
int ret;
intptr_t ret;
REQUEST req;
ZORDEROPINFO info;
@@ -478,16 +478,16 @@ static int cliForceCloseMenu (void)
req.data = &info;
req.len_data = sizeof (ZORDEROPINFO);
if (ClientRequest (&req, &ret, sizeof (int)) < 0)
if (ClientRequest (&req, &ret, sizeof (intptr_t)) < 0)
return -1;
return ret;
}
#endif
static int cliEnableWindow (PMAINWIN pWin, int flags)
static intptr_t cliEnableWindow (PMAINWIN pWin, int flags)
{
int ret;
intptr_t ret;
REQUEST req;
ZORDEROPINFO info;
@@ -499,21 +499,21 @@ static int cliEnableWindow (PMAINWIN pWin, int flags)
req.data = &info;
req.len_data = sizeof (ZORDEROPINFO);
if (ClientRequest (&req, &ret, sizeof (int)) < 0)
if (ClientRequest (&req, &ret, sizeof (intptr_t)) < 0)
return -1;
return ret;
}
static int cliStartDragWindow (PMAINWIN pWin, const DRAGINFO* drag_info)
static intptr_t cliStartDragWindow (PMAINWIN pWin, const DRAGINFO* drag_info)
{
int ret;
intptr_t ret;
REQUEST req;
ZORDEROPINFO info;
info.id_op = ID_ZOOP_STARTDRAG;
info.idx_znode = pWin->idx_znode;
info.hwnd = (HWND)drag_info->location;
info.location = drag_info->location;
info.rc.left = drag_info->init_x;
info.rc.top = drag_info->init_y;
@@ -521,15 +521,15 @@ static int cliStartDragWindow (PMAINWIN pWin, const DRAGINFO* drag_info)
req.data = &info;
req.len_data = sizeof (ZORDEROPINFO);
if (ClientRequest (&req, &ret, sizeof (int)) < 0)
if (ClientRequest (&req, &ret, sizeof (intptr_t)) < 0)
return -1;
return ret;
}
static int cliCancelDragWindow (PMAINWIN pWin)
static intptr_t cliCancelDragWindow (PMAINWIN pWin)
{
int ret;
intptr_t ret;
REQUEST req;
ZORDEROPINFO info;
@@ -540,15 +540,15 @@ static int cliCancelDragWindow (PMAINWIN pWin)
req.data = &info;
req.len_data = sizeof (ZORDEROPINFO);
if (ClientRequest (&req, &ret, sizeof (int)) < 0)
if (ClientRequest (&req, &ret, sizeof (intptr_t)) < 0)
return -1;
return ret;
}
static int cliChangeCaption (PMAINWIN pWin)
static intptr_t cliChangeCaption (PMAINWIN pWin)
{
int ret;
intptr_t ret;
REQUEST req;
ZORDEROPINFO info;
@@ -565,7 +565,7 @@ static int cliChangeCaption (PMAINWIN pWin)
req.id = REQID_ZORDEROP;
req.data = &info;
req.len_data = sizeof (ZORDEROPINFO);
if ((ret = ClientRequest (&req, &ret, sizeof (int))) < 0) {
if ((ret = ClientRequest (&req, &ret, sizeof (intptr_t))) < 0) {
return -1;
}
@@ -588,9 +588,9 @@ void __mg_start_server_desktop (void)
SendMessage (HWND_DESKTOP, MSG_ERASEDESKTOP, 0, 0);
}
static int cliAllocZOrderMaskRect (HWND pWin, const RECT4MASK* rc, int nr_rc)
static intptr_t cliAllocZOrderMaskRect (HWND pWin, const RECT4MASK* rc, int nr_rc)
{
int ret;
intptr_t ret;
REQUEST req;
ZORDERMASKRECTOPINFO info;
@@ -607,16 +607,16 @@ static int cliAllocZOrderMaskRect (HWND pWin, const RECT4MASK* rc, int nr_rc)
req.len_data = sizeof (info);
if ((ret = ClientRequestEx (&req, rc, sizeof(RECT4MASK)*nr_rc,
&ret, sizeof (int))) < 0) {
&ret, sizeof (intptr_t))) < 0) {
return -1;
}
return ret;
}
static int cliFreeZOrderMaskRect (PMAINWIN pWin)
static intptr_t cliFreeZOrderMaskRect (PMAINWIN pWin)
{
int ret;
intptr_t ret;
REQUEST req;
ZORDERMASKRECTOPINFO info;
@@ -628,7 +628,7 @@ static int cliFreeZOrderMaskRect (PMAINWIN pWin)
req.data = &info;
req.len_data = sizeof(ZORDERMASKRECTOPINFO);
if ((ret = ClientRequest (&req, &ret, sizeof (int))) < 0) {
if ((ret = ClientRequest (&req, &ret, sizeof (intptr_t))) < 0) {
return -1;
}
return ret;
@@ -680,7 +680,7 @@ static BOOL _cb_update_cli_znode (void* context,
const ZORDERINFO* zi, ZORDERNODE* znode)
{
RECT rcInv;
int cli = (int)context;
int cli = (int)(intptr_t)context;
if (znode->cli == cli && znode->flags & ZOF_VISIBLE && znode->fortestinghwnd) {
MSG msg = {znode->fortestinghwnd, MSG_UPDATECLIWIN, 0, 0, __mg_timer_counter};
@@ -706,20 +706,20 @@ void __mg_check_dirty_znode (int cli)
{
ZORDERINFO* zi = (ZORDERINFO *)get_zi_from_client (cli);
do_for_all_znodes ((void*)cli, zi,
do_for_all_znodes ((void*)(intptr_t)cli, zi,
_cb_update_cli_znode, ZT_TOPMOST | ZT_NORMAL);
mgClients [cli].has_dirty = FALSE;
}
static int srvSetActiveWindow (int cli, int idx_znode)
static intptr_t srvSetActiveWindow (int cli, int idx_znode)
{
int ret = dskSetActiveZOrderNode (cli, idx_znode);
HWND hRet = dskSetActiveZOrderNode (cli, idx_znode);
if ((ret != HWND_INVALID) && OnZNodeOperation)
if ((hRet != HWND_INVALID) && OnZNodeOperation)
OnZNodeOperation (ZNOP_SETACTIVE, cli, idx_znode);
return ret;
return (intptr_t)hRet;
}
static int srvFreeZOrderNode (int cli, int idx_znode)
@@ -1024,10 +1024,10 @@ static int srvChangeCaption (int cli, int idx_znode, const char *caption)
return 0;
}
int __mg_do_zorder_maskrect_operation (int cli,
intptr_t __mg_do_zorder_maskrect_operation (int cli,
const ZORDERMASKRECTOPINFO* info)
{
int ret = -1;
intptr_t ret = -1;
switch (info->id_op) {
case ID_ZOOP_MASKRECT_SET:
@@ -1042,9 +1042,9 @@ int __mg_do_zorder_maskrect_operation (int cli,
return ret;
}
int __mg_do_zorder_operation (int cli, const ZORDEROPINFO* info)
intptr_t __mg_do_zorder_operation (int cli, const ZORDEROPINFO* info)
{
int ret = -1;
intptr_t ret = -1;
switch (info->id_op) {
case ID_ZOOP_ALLOC:
@@ -1084,7 +1084,7 @@ int __mg_do_zorder_operation (int cli, const ZORDEROPINFO* info)
ret = srvEnableWindow (cli, info->idx_znode, info->flags);
break;
case ID_ZOOP_STARTDRAG:
ret = srvStartDragWindow (cli, info->idx_znode, (int)info->hwnd,
ret = srvStartDragWindow (cli, info->idx_znode, info->location,
info->rc.left, info->rc.top);
break;
case ID_ZOOP_CANCELDRAG:
@@ -1131,7 +1131,7 @@ static BOOL _cb_intersect_rc_no_cli (void* context,
static BOOL _cb_update_rc_nocli (void* context,
const ZORDERINFO* zi, ZORDERNODE* node)
{
int cli = (int)context;
int cli = (int)(intptr_t)context;
if (node->flags & ZOF_VISIBLE && node->cli != cli &&
//SubtractClipRect (&sg_UpdateRgn, &node->rc)) {
@@ -1169,7 +1169,7 @@ int __mg_remove_all_znodes_of_client (int cli)
SetClipRgn (&sg_UpdateRgn, &rc_bound);
/* check influenced window zorder nodes */
do_for_all_znodes ((void*)cli, zi, _cb_update_rc_nocli, ZT_ALL);
do_for_all_znodes ((void*)(intptr_t)cli, zi, _cb_update_rc_nocli, ZT_ALL);
if (SubtractClipRect (&sg_UpdateRgn, &g_rcScr)) {
nodes [0].age ++;
@@ -2038,7 +2038,7 @@ static int dskChangeCaption (PMAINWIN pWin)
return cliChangeCaption (pWin);
}
static int dskWindowMessageHandler (int message, PMAINWIN pWin, LPARAM lParam)
static LRESULT dskWindowMessageHandler (UINT message, PMAINWIN pWin, LPARAM lParam)
{
switch (message) {
case MSG_ADDNEWMAINWIN:
@@ -2068,16 +2068,16 @@ static int dskWindowMessageHandler (int message, PMAINWIN pWin, LPARAM lParam)
break;
case MSG_GETACTIVEMAIN:
return (int)dskGetActiveWindow (NULL);
return (LRESULT)dskGetActiveWindow (NULL);
case MSG_SETACTIVEMAIN:
return (int)dskSetActiveWindow (pWin);
return (LRESULT)dskSetActiveWindow (pWin);
case MSG_GETCAPTURE:
return (int)dskGetCaptureWindow ();
return (LRESULT)dskGetCaptureWindow ();
case MSG_SETCAPTURE:
return (int)dskSetCaptureWindow (pWin);
return (LRESULT)dskSetCaptureWindow (pWin);
#ifdef _MGHAVE_MENU
case MSG_TRACKPOPUPMENU:
@@ -2116,11 +2116,11 @@ static int dskWindowMessageHandler (int message, PMAINWIN pWin, LPARAM lParam)
HCURSOR old = pWin->hCursor;
pWin->hCursor = (HCURSOR)lParam;
return old;
return (LRESULT)old;
}
case MSG_GETNEXTMAINWIN:
return (int)dskGetNextMainWindow (pWin);
return (LRESULT)dskGetNextMainWindow (pWin);
case MSG_SHOWGLOBALCTRL:
{
@@ -2375,7 +2375,7 @@ int __mg_handle_normal_mouse_move (const ZORDERINFO* zi, int x, int y)
ZORDERNODE* nodes = GET_ZORDERNODE(zi);
static int old_slot, old_cli;
static int old_hwnd;
static HWND old_hwnd;
int cur_slot;
int cur_cli = 0;
@@ -3236,7 +3236,7 @@ static void srvSaveScreen (BOOL active)
rcActive = g_rcScr;
}
sprintf (buffer, "%d-%x-%d.bmp", cliActive, hwndActive, n);
sprintf (buffer, "%d-%p-%d.bmp", cliActive, hwndActive, n);
if (SaveScreenRectContent (&rcActive, buffer)) {
Ping ();
n ++;
@@ -3461,7 +3461,7 @@ static int srvSesseionMessageHandler (int message, WPARAM wParam, LPARAM lParam)
}
int DesktopWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
LRESULT DesktopWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int flags, x, y;
@@ -3597,10 +3597,10 @@ int DesktopWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
return dskOnRemoveCtrlInstance ((PCONTROL)wParam, (PCONTROL)lParam);
case MSG_GETCTRLCLASSINFO:
return (int)gui_GetControlClassInfo ((const char*)lParam);
return (LRESULT)gui_GetControlClassInfo ((const char*)lParam);
case MSG_CTRLCLASSDATAOP:
return (int)gui_ControlClassDataOp (wParam, (WNDCLASS*)lParam);
return (LRESULT)gui_ControlClassDataOp (wParam, (WNDCLASS*)lParam);
case MSG_IME_REGISTER:
if (mgIsServer)

View File

@@ -2558,8 +2558,7 @@ static int dskMoveWindow (int cli, int idx_znode, const RECT* rcWin)
nodes [idx_znode].age ++;
#if defined (_MGRM_PROCESSES) && !defined (_MGRM_STANDALONE)
if (cli == 0
|| (DWORD)mgClients [cli].layer == SHAREDRES_TOPMOST_LAYER) {
if (cli == 0 || mgClients [cli].layer == SHAREDRES_TOPMOST_LAYER) {
#endif
/* Copy window content to new postion */
InitClipRgn (&bblt_rgn, &sg_FreeClipRectList);

View File

@@ -28,6 +28,7 @@
#include "timer.h"
#ifdef _MGRM_PROCESSES
#include "ourhdr.h"
#include "client.h"
#include "sharedres.h"
#endif

View File

@@ -78,6 +78,7 @@ static LRESULT AboutWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
case MSG_CLOSE:
sg_AboutWnd = 0;
DestroyAllControls (hWnd);
DestroyMainWindow (hWnd);
#ifdef _MGRM_THREADS
PostQuitMessage (hWnd);
#endif
@@ -138,7 +139,6 @@ static void* AboutDialogThread (void* data)
DispatchMessage(&Msg);
}
DestroyMainWindow (hMainWnd);
MainWindowThreadCleanup(hMainWnd);
return NULL;
}

View File

@@ -156,11 +156,10 @@ static int execl_pcxvfb(void)
skin[0] = '\0';
GetMgEtcValue("pc_xvfb", "skin", skin, sizeof(skin)-1);
fprintf(stderr,"start-qvfb :%s pcxvfb %s %s %s %s\n", execl_file, ch_pid, window_caption, mode, skin);
_MG_PRINTF ("IAL>PCXVFB: start-qvfb :%s pcxvfb %s %s %s %s\n", execl_file, ch_pid, window_caption, mode, skin);
if (execlp(execl_file, "pcxvfb", ch_pid, window_caption, mode, skin, NULL) < 0) {
fprintf(stderr, "execlp error!!\n");
_MG_PRINTF ("IAL>PCXVFB: failed to start the virtual frame buffer process!\n");
}
return 0;
@@ -400,14 +399,12 @@ static int PCXVFB_VideoInit (_THIS, GAL_PixelFormat *vformat)
//shm_init_lock(getpid());
if ((pid = fork()) < 0)
{
fprintf(stderr, "fork() error in pcxvfb\n");
if ((pid = fork()) < 0) {
_MG_PRINTF ("NEWGAL>PCXVFB: fork() error.\n");
}
else if (pid == 0)
{
else if (pid == 0) {
if (execl_pcxvfb() == ERR_CONFIG_FILE)
fprintf(stderr, "PCXVFB GAL: Reading configuration failure!\n");
_MG_PRINTF ("NEWGAL>PCXVFB: failed to read configuration failure.\n");
perror ("execl");
_exit (1);
@@ -431,7 +428,6 @@ static int PCXVFB_VideoInit (_THIS, GAL_PixelFormat *vformat)
close(fd);
#else //-----------------linux----------------------
int display;
pid_t pid;
int server_len;
@@ -465,24 +461,21 @@ static int PCXVFB_VideoInit (_THIS, GAL_PixelFormat *vformat)
shm_init_lock(getpid());
if ((pid = fork()) < 0) {
fprintf(stderr, "fork() error in pcxvfb\n");
}else if (pid > 0) {
GAL_SetError ("NEWGAL>PCXVFB: Error occurred when calling fork().\n");
} else if (pid > 0) {
;/* do nothing */
}else {
} else {
if (setpgid(getpid(), 0) < 0) {
fprintf(stderr, "Warning: Failed to change the group id of the VFB process.\n");
GAL_SetError ("NEWGAL>PCXVFB: Failed to change the group id of the XVFB process.\n");
}
if (execl_pcxvfb() == ERR_CONFIG_FILE)
fprintf(stderr, "PCXVFB GAL: Reading configuration failure!\n");
GAL_SetError ("NEWGAL>PCXVFB: Reading configuration failure!\n");
perror ("execl");
_exit (1);
}
if (GetMgEtcIntValue ("qvfb", "display", &display) < 0)
display = 0;
{
fd_set rset;
struct timeval tv;
@@ -527,24 +520,32 @@ static int PCXVFB_VideoInit (_THIS, GAL_PixelFormat *vformat)
if (shmid != -1) {
data->shmrgn = (unsigned char *)shmat (shmid, 0, 0);
#ifdef _MGRM_PROCESSES
fp = fopen("/tmp/.pcxvfb_tmp", "w+");
fp = fopen("/var/tmp/.pcxvfb_tmp", "w+");
if (fp == NULL) {
fprintf(stderr, "mgServer can't open file /tmp/.pcxvfb_tmp\n");
GAL_SetError ("NEWGAL>PCXVFB: mgServer can't open file /var/tmp/.pcxvfb_tmp\n");
return -1;
}
fwrite(&shmid, sizeof(int), 1, fp);
fwrite (&shmid, sizeof(int), 1, fp);
fclose(fp);
#endif
}
#if defined(_MGRM_PROCESSES) && !defined(_MGRM_STANDALONE)
} else {
fp = fopen("/tmp/.pcxvfb_tmp", "r");
}
else {
fp = fopen ("/var/tmp/.pcxvfb_tmp", "r");
if (fp == NULL) {
fprintf(stderr, "minigui can't open file /tmp/.pcxvfb_tmp\n");
GAL_SetError ("NEWGAL>PCXVFB: can't open file /var/tmp/.pcxvfb_tmp\n");
return -1;
}
fread(&shmid, sizeof(int), 1, fp);
if (fread(&shmid, sizeof(int), 1, fp) < 1) {
GAL_SetError ("NEWGAL>PCXVFB: can't read from /var/tmp/.pcxvfb_tmp\n");
fclose (fp);
return -1;
}
fclose(fp);
if (shmid != -1) {
@@ -555,8 +556,7 @@ static int PCXVFB_VideoInit (_THIS, GAL_PixelFormat *vformat)
#endif //end of os (windows, cygwin, linux)
if ((INT_PTR)data->shmrgn == -1 || data->shmrgn == NULL) {
GAL_SetError ("NEWGAL>PCXVFB: Unable to attach to "
"virtual FrameBuffer server.\n");
GAL_SetError ("NEWGAL>PCXVFB: Unable to attach to virtual frame buffer server.\n");
return -1;
}
@@ -597,8 +597,8 @@ static int PCXVFB_VideoInit (_THIS, GAL_PixelFormat *vformat)
vformat->Bmask = data->hdr->Bmask;
break;
default:
GAL_SetError ("NEWGAL>PCXQVFB: Not supported depth: %d, "
"please try to use Shadow NEWGAL engine with targetname qvfb.\n",
GAL_SetError ("NEWGAL>PCXVFB: Not supported depth: %d, "
"please try to use Shadow NEWGAL engine with targetname pc_xvfb.\n",
vformat->BitsPerPixel);
return -1;
}

View File

@@ -42,8 +42,8 @@ int mgClientSize = 0;
#define off_pointer(p,off) \
do { \
if (p) { \
unsigned int tmp; \
tmp = (unsigned int)p; \
intptr_t tmp; \
tmp = (intptr_t)p; \
tmp += off; \
p = (void*)tmp; \
} \
@@ -190,7 +190,7 @@ void __mg_remove_client (int cli, int clifd)
close (clifd);
}
int __mg_send2client (MSG* msg, MG_Client* client)
int __mg_send2client (const MSG* msg, MG_Client* client)
{
int ret;
@@ -243,7 +243,7 @@ void __mg_set_active_client (MG_Client* client)
}
/* send message to client(s) */
int GUIAPI Send2Client (MSG* msg, int cli)
int GUIAPI Send2Client (const MSG* msg, int cli)
{
int i, n;
@@ -296,9 +296,9 @@ int GUIAPI Send2Client (MSG* msg, int cli)
return SOCKERR_OK;
}
BOOL GUIAPI Send2TopMostClients (int iMsg, WPARAM wParam, LPARAM lParam)
BOOL GUIAPI Send2TopMostClients (UINT nMsg, WPARAM wParam, LPARAM lParam)
{
MSG msg = {0, iMsg, wParam, lParam, __mg_timer_counter};
MSG msg = {0, nMsg, wParam, lParam, __mg_timer_counter};
if (!mgIsServer)
return FALSE;
@@ -310,7 +310,7 @@ BOOL GUIAPI Send2TopMostClients (int iMsg, WPARAM wParam, LPARAM lParam)
}
BOOL GUIAPI Send2ActiveWindow (const MG_Layer* layer,
int iMsg, WPARAM wParam, LPARAM lParam)
UINT nMsg, WPARAM wParam, LPARAM lParam)
{
int active_win;
@@ -322,7 +322,7 @@ BOOL GUIAPI Send2ActiveWindow (const MG_Layer* layer,
return FALSE;
if (__mg_post_msg_by_znode (layer->zorder_info,
active_win, iMsg, wParam, lParam) > 0)
active_win, nMsg, wParam, lParam) > 0)
return TRUE;
return FALSE;

View File

@@ -89,7 +89,7 @@ static BOOL do_alloc_layer (MG_Layer* layer, const char* name,
zi->active_win = 0;
zi->cli_trackmenu = -1;
zi->ptmi_in_cli = -1;
zi->ptmi_in_cli = HWND_INVALID;
zi->zi_semid = SHAREDRES_SEMID_LAYER;

View File

@@ -170,7 +170,7 @@ static int create_cursor (int cli, int clifd, void* buff, size_t len)
static int copy_cursor (int cli, int clifd, void* buff, size_t len)
{
HCURSOR hcsr = CopyCursor ((HCURSOR)*(int*)buff);
HCURSOR hcsr = CopyCursor ((HCURSOR)*(intptr_t*)buff);
#ifdef _MGHAVE_CURSOR
if (hcsr) {
add_global_res (cli, (void*) hcsr, (void*)hcsr, NULL);
@@ -338,22 +338,22 @@ ret:
static int zorder_op (int cli, int clifd, void* buff, size_t len)
{
int ret_value;
intptr_t ret_value;
ZORDEROPINFO* info = (ZORDEROPINFO*)buff;
ret_value = __mg_do_zorder_operation (cli, info);
return ServerSendReply (clifd, &ret_value, sizeof (int));
return ServerSendReply (clifd, &ret_value, sizeof (intptr_t));
}
static int change_zorder_maskrect (int cli, int clifd, void* buff, size_t len)
{
int ret_value;
intptr_t ret_value;
ZORDERMASKRECTOPINFO* info = (ZORDERMASKRECTOPINFO *)buff;
info->rc = (RECT4MASK*)(buff + sizeof (ZORDERMASKRECTOPINFO));
ret_value = __mg_do_zorder_maskrect_operation (cli, info);
return ServerSendReply (clifd, &ret_value, sizeof (int));
return ServerSendReply (clifd, &ret_value, sizeof (intptr_t));
}
#ifdef _MGGAL_SIGMA8654
extern int Sigma8654_ServerOnGetSurface(REQ_SIGMA8654_GETSURFACE *request, REP_SIGMA8654_GETSURFACE *reply);