fix bugs when virtual window enabled for sa and procs runmodes

This commit is contained in:
Vincent Wei
2022-09-26 14:06:09 +08:00
parent 07f226f024
commit e293cf03ba
18 changed files with 69 additions and 87 deletions

View File

@@ -131,7 +131,31 @@
#define IAL_EVENT_GESTURE_PINCH_UPDATE 0x0084
#define IAL_EVENT_GESTURE_PINCH_END 0x0085
#define TABLET_TOOL_CHANGED_X (1 << 0)
#define TABLET_TOOL_CHANGED_Y (1 << 1)
#define TABLET_TOOL_CHANGED_PRESSURE (1 << 2)
#define TABLET_TOOL_CHANGED_DISTANCE (1 << 3)
#define TABLET_TOOL_CHANGED_TILT_X (1 << 4)
#define TABLET_TOOL_CHANGED_TILT_Y (1 << 5)
#define TABLET_TOOL_CHANGED_ROTATION (1 << 6)
#define TABLET_TOOL_CHANGED_SLIDER (1 << 7)
#define TABLET_TOOL_CHANGED_SIZE_MAJOR (1 << 8)
#define TABLET_TOOL_CHANGED_SIZE_MINOR (1 << 9)
#define TABLET_TOOL_CHANGED_WHEEL (1 << 10)
#ifndef TABLET_TOOL_X
#define TABLET_TOOL_X 0
#define TABLET_TOOL_Y 1
#define TABLET_TOOL_PRESSURE 2
#define TABLET_TOOL_DISTANCE 3
#define TABLET_TOOL_TILT_X 4
#define TABLET_TOOL_TILT_Y 5
#define TABLET_TOOL_ROTATION 6
#define TABLET_TOOL_SLIDER 7
#define TABLET_TOOL_SIZE_MAJOR 8
#define TABLET_TOOL_SIZE_MINOR 9
#define TABLET_TOOL_WHEEL 10
#define TABLET_TOOL_PROXIMITY_STATE_INVALID 0
#define TABLET_TOOL_PROXIMITY_STATE_OUT 1
#define TABLET_TOOL_PROXIMITY_STATE_IN 2
@@ -149,31 +173,6 @@
#define TABLET_PAD_STRIP_SOURCE_UNKNOWN 0
#define TABLET_PAD_STRIP_SOURCE_FINGER 1
#define TABLET_TOOL_CHANGED_X (1 << 0)
#define TABLET_TOOL_CHANGED_Y (1 << 1)
#define TABLET_TOOL_CHANGED_PRESSURE (1 << 2)
#define TABLET_TOOL_CHANGED_DISTANCE (1 << 3)
#define TABLET_TOOL_CHANGED_TILT_X (1 << 4)
#define TABLET_TOOL_CHANGED_TILT_Y (1 << 5)
#define TABLET_TOOL_CHANGED_ROTATION (1 << 6)
#define TABLET_TOOL_CHANGED_SLIDER (1 << 7)
#define TABLET_TOOL_CHANGED_SIZE_MAJOR (1 << 8)
#define TABLET_TOOL_CHANGED_SIZE_MINOR (1 << 9)
#define TABLET_TOOL_CHANGED_WHEEL (1 << 10)
#define TABLET_TOOL_X 0
#define TABLET_TOOL_Y 1
#define TABLET_TOOL_PRESSURE 2
#define TABLET_TOOL_DISTANCE 3
#define TABLET_TOOL_TILT_X 4
#define TABLET_TOOL_TILT_Y 5
#define TABLET_TOOL_ROTATION 6
#define TABLET_TOOL_SLIDER 7
#define TABLET_TOOL_SIZE_MAJOR 8
#define TABLET_TOOL_SIZE_MINOR 9
#define TABLET_TOOL_WHEEL 10
#endif
#define IAL_EVENT_TABLET_TOOL_AXIS 0x0090

View File

@@ -587,7 +587,7 @@ enum {
* \sa InitBlockDataHeap, DestroyBlockDataHeap
*/
typedef struct _BLOCKHEAP {
#ifdef _MGRM_THREADS
#ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_t lock;
#endif
/** Size of one block element in bytes. */

View File

@@ -59,7 +59,6 @@
#include "cliprect.h"
#include "gal.h"
#include "internals.h"
#include "blockheap.h"
#include "accelkey.h"
static BLOCKHEAP ACHeap;

View File

@@ -71,7 +71,6 @@
#include "cliprect.h"
#include "gal.h"
#include "internals.h"
#include "blockheap.h"
#include "menu.h"
#define SHORTEN 0

View File

@@ -3784,16 +3784,15 @@ static void* _message_thread_entry (void* arg)
goto failed;
/* create message queue for this thread */
if (!(entry_args.msg_queue = mg_AllocMsgQueueForThisThread ()))
if (!(entry_args.msg_queue = mg_AllocMsgQueueForThisThread (FALSE)))
goto failed;
orig_args->msg_queue = entry_args.msg_queue;
sem_post (entry_args.wait);
/* handle in mg_AllocMsgQueueForThisThread
/* register the message queue */
SendMessage (HWND_DESKTOP, MSG_MANAGE_MSGTHREAD,
MSGTHREAD_SIGNIN, (LPARAM)&entry_args.msg_queue);
*/
if (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL))
goto cancelled;
@@ -3801,11 +3800,10 @@ static void* _message_thread_entry (void* arg)
/* call start routine of app */
entry_args.start_routine (entry_args.arg);
/* handle in mg_FreeMsgQueueForThisThread
/* unregister the message queue */
SendMessage (HWND_DESKTOP, MSG_MANAGE_MSGTHREAD,
MSGTHREAD_SIGNOUT, (LPARAM)&entry_args.msg_queue);
*/
mg_FreeMsgQueueForThisThread ();
mg_FreeMsgQueueForThisThread (FALSE);
return NULL;

View File

@@ -3,7 +3,7 @@ noinst_HEADERS = \
cursor.h dc.h event.h list.h element.h \
ial.h inline.h internals.h zorder.h menu.h misc.h \
msgstr.h sysfont.h timer.h devfont.h fontname.h \
readbmp.h icon.h blockheap.h rbtree.h \
readbmp.h icon.h rbtree.h \
ourhdr.h client.h server.h sharedres.h sockio.h drawsemop.h \
gal.h newgal.h memops.h incoreres.h sysres.h clipboard.h \
glyph.h license.h mgsock.h unicode-ops.h \

View File

@@ -47,6 +47,8 @@
** blockheap.h: the head file of heap for block data.
**
** Create date: 2001/01/10
**
** DEPRECATED, USE window.h INSTEAD.
*/
#ifndef GUI_BLOCKHEAP_H
@@ -55,7 +57,7 @@
#ifndef _MGUI_GDI_H /* included in include/gdi.h */
struct _BLOCKHEAP {
#ifdef _MGRM_THREADS
#ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_t lock;
#endif
/* Size of one block element. */

View File

@@ -772,8 +772,8 @@ static inline PMSGQUEUE getMsgQueue (HWND hWnd)
}
MSGQUEUE* mg_AllocMsgQueueForThisThread (void);
void mg_FreeMsgQueueForThisThread (void);
MSGQUEUE* mg_AllocMsgQueueForThisThread (BOOL sign_in);
void mg_FreeMsgQueueForThisThread (BOOL sign_off);
/* Since 5.0.0 */
int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd);

View File

@@ -56,8 +56,8 @@
#define GUI_NEWGAL_H
#include "gdi.h"
#include "window.h"
#include "constants.h"
#include "blockheap.h"
#if IS_COMPOSITING_SCHEMA
#include <sys/types.h>

View File

@@ -59,13 +59,13 @@
#include "common.h"
#include "minigui.h"
#include "gdi.h"
#include "window.h"
#include "constants.h"
#include "blockheap.h"
#include "misc.h"
BOOL InitBlockDataHeap (PBLOCKHEAP heap, size_t sz_block, size_t sz_heap)
{
#ifdef _MGRM_THREADS
#ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_init (&heap->lock, NULL);
#endif
@@ -99,7 +99,7 @@ void* BlockDataAlloc (PBLOCKHEAP heap)
int free_slot;
unsigned char* block_data = NULL;
#ifdef _MGRM_THREADS
#ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_lock (&heap->lock);
#endif
@@ -118,7 +118,7 @@ void* BlockDataAlloc (PBLOCKHEAP heap)
ret:
#ifdef _MGRM_THREADS
#ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_unlock (&heap->lock);
#endif
return block_data;
@@ -128,7 +128,7 @@ void BlockDataFree (PBLOCKHEAP heap, void* data)
{
unsigned char* block_data = data;
#ifdef _MGRM_THREADS
#ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_lock (&heap->lock);
#endif
@@ -146,7 +146,7 @@ void BlockDataFree (PBLOCKHEAP heap, void* data)
heap, slot);
}
#ifdef _MGRM_THREADS
#ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_unlock (&heap->lock);
#endif
}
@@ -193,7 +193,7 @@ void DestroyBlockDataHeap (PBLOCKHEAP heap)
free (heap->usage_bmp);
heap->usage_bmp = NULL;
#ifdef _MGRM_THREADS
#ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_destroy (&heap->lock);
#endif
}

View File

@@ -231,14 +231,6 @@ static void init_desktop_win (void)
BOOL mg_InitDesktop (void)
{
#if 0 /* move to init-lite.c */
/* Since 5.0.0: allocate message queue for desktop thread */
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread ()) ) {
_WRN_PRINTF ("failed to allocate message queue\n");
return FALSE;
}
#endif /* moved code */
#ifndef _MGSCHEMA_COMPOSITING
/* Init heap of clipping rects. */
InitFreeClipRectList (&sg_FreeClipRectList, SIZE_CLIPRECTHEAP);
@@ -259,7 +251,7 @@ BOOL mg_InitDesktop (void)
void mg_TerminateDesktop (void)
{
/* Since 5.0.0: message queue for desktop thread was dynamically allocated */
mg_FreeMsgQueueForThisThread ();
mg_FreeMsgQueueForThisThread (TRUE);
__mg_dsk_msg_queue = NULL;
#ifndef _MGSCHEMA_COMPOSITING

View File

@@ -102,14 +102,6 @@ BOOL mg_InitDesktop (void)
int ret;
RECT rcScr = GetScreenRect();
#if 0 /* move to init-lite.c */
/* Since 5.0.0: allocate message queue for desktop thread */
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread ()) ) {
_WRN_PRINTF ("failed to allocate message queue\n");
return FALSE;
}
#endif /* moved code */
/*
* Init ZOrderInfo here.
*/
@@ -153,7 +145,7 @@ BOOL mg_InitDesktop (void)
void mg_TerminateDesktop (void)
{
if (__mg_dsk_msg_queue) {
mg_FreeMsgQueueForThisThread ();
mg_FreeMsgQueueForThisThread (TRUE);
__mg_dsk_msg_queue = NULL;
}

View File

@@ -145,7 +145,7 @@ void* __kernel_desktop_main (void* data)
MSG Msg;
/* init message queue of desktop thread */
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread ()) ) {
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread (TRUE)) ) {
_ERR_PRINTF ("failed to allocate message queue\n");
sem_post ((sem_t*)data);
return NULL;
@@ -191,7 +191,7 @@ void* __kernel_desktop_main (void* data)
#endif
}
mg_FreeMsgQueueForThisThread ();
mg_FreeMsgQueueForThisThread (TRUE);
__mg_dsk_msg_queue = NULL;
return NULL;
}

View File

@@ -66,7 +66,7 @@ static struct FIXSTR {
BYTE bitmap[LEN_BITMAP];
int offset[NR_HEAP];
char* heap[NR_HEAP + 1];
#ifdef _MGRM_THREADS
#ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_t lock;
#endif
} FixStrHeap;
@@ -98,7 +98,7 @@ BOOL mg_InitFixStr (void)
offset += 1<<i;
}
#ifdef _MGRM_THREADS
#ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_init (&FixStrHeap.lock, NULL);
#endif
return TRUE;
@@ -106,7 +106,7 @@ BOOL mg_InitFixStr (void)
void mg_TerminateFixStr (void)
{
#ifdef _MGRM_THREADS
#ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_destroy (&FixStrHeap.lock);
#endif
free (FixStrHeap.heap[0]);
@@ -154,7 +154,7 @@ char* GUIAPI FixStrAlloc (int len)
// ..
// if i == 0; then bufflen = 512
#ifdef _MGRM_THREADS
#ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_lock (&FixStrHeap.lock);
#endif
@@ -166,7 +166,7 @@ char* GUIAPI FixStrAlloc (int len)
for(j = 0; j < 8; j++) {
if (*bitmap & (0x80 >> j)) {
*bitmap &= (~(0x80 >> j));
#ifdef _MGRM_THREADS
#ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_unlock (&FixStrHeap.lock);
#endif
#if 0
@@ -181,7 +181,7 @@ char* GUIAPI FixStrAlloc (int len)
bitmap++;
}
#ifdef _MGRM_THREADS
#ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_unlock (&FixStrHeap.lock);
#endif
return (char*)malloc (len + 1);
@@ -216,7 +216,7 @@ void GUIAPI FreeFixStr (char* str)
// if i == 0; then bufflen = 512
bufflen = 1 << (NR_HEAP + 1 - i);
#ifdef _MGRM_THREADS
#ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_lock (&FixStrHeap.lock);
#endif
heap = FixStrHeap.heap[i];
@@ -236,7 +236,7 @@ void GUIAPI FreeFixStr (char* str)
bitmap = bitmap + (stroff>>3);
*bitmap |= (0x80 >> (stroff%8));
#ifdef _MGRM_THREADS
#ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_unlock (&FixStrHeap.lock);
#endif
}

View File

@@ -386,7 +386,7 @@ int InitGUI (int argc, const char* agr[])
/* Since 5.0.0
allocate message queue for desktop thread before starting client. */
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread ()) ) {
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread (TRUE)) ) {
err_message (step, "Failed to allocate message queue!");
return step;
}

View File

@@ -578,7 +578,7 @@ int GUIAPI InitGUI (int args, const char *agr[])
/* init message queue of main GUI thread */
step++;
if (!(msg_queue = mg_AllocMsgQueueForThisThread ())) {
if (!(msg_queue = mg_AllocMsgQueueForThisThread (TRUE))) {
_ERR_PRINTF ("KERNEL>InitGUI: failed to allocate message queue!\n");
goto failure;
}
@@ -655,7 +655,7 @@ void GUIAPI TerminateGUI (int not_used)
miFreeArcCache ();
#endif
mg_FreeMsgQueueForThisThread ();
mg_FreeMsgQueueForThisThread (TRUE);
deleteThreadInfoKey ();

View File

@@ -60,7 +60,6 @@
#include "gdi.h"
#include "window.h"
#include "blockheap.h"
#include "cliprect.h"
#include "gal.h"
#include "internals.h"
@@ -159,7 +158,7 @@ void mg_DestroyFreeQMSGList (void)
pthread_key_t __mg_threadinfo_key;
#endif
MSGQUEUE* mg_AllocMsgQueueForThisThread (void)
MSGQUEUE* mg_AllocMsgQueueForThisThread (BOOL sign_in)
{
MSGQUEUE* pMsgQueue;
@@ -177,13 +176,14 @@ MSGQUEUE* mg_AllocMsgQueueForThisThread (void)
pthread_setspecific (__mg_threadinfo_key, pMsgQueue);
#endif
// register this new message queue
if (sign_in) {
SendMessage (HWND_DESKTOP, MSG_MANAGE_MSGTHREAD,
MSGTHREAD_SIGNIN, (LPARAM)pMsgQueue);
}
return pMsgQueue;
}
void mg_FreeMsgQueueForThisThread (void)
void mg_FreeMsgQueueForThisThread (BOOL sign_off)
{
MSGQUEUE* pMsgQueue;
@@ -194,9 +194,10 @@ void mg_FreeMsgQueueForThisThread (void)
_WRN_PRINTF ("there are still some windows not destroyed\n");
}
// unregister this message queue
if (sign_off) {
SendMessage (HWND_DESKTOP, MSG_MANAGE_MSGTHREAD,
MSGTHREAD_SIGNOUT, (LPARAM)pMsgQueue);
}
mg_DestroyMsgQueue (pMsgQueue);
free (pMsgQueue);

View File

@@ -138,9 +138,9 @@ SOFTWARE.
#include "common.h"
#include "gdi.h"
#include "window.h"
#include "cliprect.h"
#include "gal.h"
#include "blockheap.h"
typedef void (*voidProcp1)(CLIPRGN *region, const CLIPRECT *r1, const CLIPRECT *r1End,
const CLIPRECT *r2, const CLIPRECT *r2End, int top, int bottom);