mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-02-06 10:21:57 +08:00
implement SetMainWindowAlwaysTop and SetMainWindowCompositing
This commit is contained in:
@@ -75,6 +75,72 @@ extern "C" {
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define ZOF_STATUS_MASK 0x0000000F
|
||||
#define ZOF_VISIBLE 0x00000001
|
||||
#define ZOF_DISABLED 0x00000002
|
||||
#define ZOF_MAXIMIZED 0x00000004 /* Since 4.2.0 */
|
||||
#define ZOF_MINIMIZED 0x00000008 /* Since 4.2.0 */
|
||||
|
||||
/* Since 4.2.0 */
|
||||
#define ZOF_COMPOSITING_MASK 0x000000F0
|
||||
#define ZOF_COMPOS_OPAQUE 0x00000000
|
||||
#define ZOF_COMPOS_COLORKEY 0x00000010
|
||||
#define ZOF_COMPOS_ALPHACHANNEL 0x00000020
|
||||
#define ZOF_COMPOS_ALPHAPIXEL 0x00000030
|
||||
#define ZOF_COMPOS_BLURRED 0x00000040
|
||||
|
||||
/* Since 4.2.0 */
|
||||
#define ZOF_INTERNAL_FLAGS_MASK 0X000F0000
|
||||
#define ZOF_IF_REFERENCE 0x00010000
|
||||
#define ZOF_IF_ALWAYSTOP 0x00020000
|
||||
|
||||
#define ZOF_TW_FLAG_MASK 0x00F00000
|
||||
#define ZOF_TW_TROUNDCNS 0x00100000
|
||||
#define ZOF_TW_BROUNDCNS 0x00200000
|
||||
#define ZOF_TW_TBROUNDCNS 0x00300000
|
||||
|
||||
#define ZOF_TYPE_FLAG_MASK 0xFF000000
|
||||
|
||||
#define ZOF_TYPE_MASK 0xF0000000
|
||||
#define ZOF_TYPE_NULL 0x00000000
|
||||
#define ZOF_TYPE_POPUPMENU 0x10000000
|
||||
#define ZOF_TYPE_SCREENLOCK 0x20000000 /* Since 4.2.0; fixed and only one */
|
||||
#define ZOF_TYPE_DOCKER 0x30000000 /* Since 4.2.0; fixed and only one */
|
||||
#define ZOF_TYPE_GLOBAL 0x40000000
|
||||
#define ZOF_TYPE_TOPMOST 0x50000000
|
||||
#define ZOF_TYPE_NORMAL 0x60000000
|
||||
#define ZOF_TYPE_LAUNCHER 0x70000000 /* Since 4.2.0; fixed and only one */
|
||||
#define ZOF_TYPE_DESKTOP 0x80000000 /* fixed and only one */
|
||||
|
||||
#define ZOF_TF_FLAG_MASK 0x0F000000
|
||||
#define ZOF_TF_CONTROL 0x00000000
|
||||
#define ZOF_TF_MAINWIN 0x01000000
|
||||
#define ZOF_TF_TOOLWIN 0x02000000
|
||||
|
||||
#define ZNIT_NULL (ZOF_TYPE_NULL)
|
||||
#define ZNIT_POPUPMENU (ZOF_TYPE_POPUPMENU)
|
||||
#define ZNIT_SCREENLOCK (ZOF_TYPE_SCREENLOCK)
|
||||
#define ZNIT_DESKTOP (ZOF_TYPE_DESKTOP)
|
||||
#define ZNIT_LAUNCHER (ZOF_TYPE_LAUNCHER)
|
||||
#define ZNIT_DESKTOP (ZOF_TYPE_DESKTOP)
|
||||
|
||||
#define ZNIT_GLOBAL_MAINWIN (ZOF_TYPE_GLOBAL | ZOF_TF_MAINWIN)
|
||||
#define ZNIT_GLOBAL_TOOLWIN (ZOF_TYPE_GLOBAL | ZOF_TF_TOOLWIN)
|
||||
#define ZNIT_GLOBAL_CONTROL (ZOF_TYPE_GLOBAL | ZOF_TF_CONTROL)
|
||||
|
||||
#define ZNIT_TOPMOST_MAINWIN (ZOF_TYPE_TOPMOST | ZOF_TF_MAINWIN)
|
||||
#define ZNIT_TOPMOST_TOOLWIN (ZOF_TYPE_TOPMOST | ZOF_TF_TOOLWIN)
|
||||
#define ZNIT_TOPMOST_CONTROL (ZOF_TYPE_TOPMOST | ZOF_TF_CONTROL)
|
||||
|
||||
#define ZNIT_NORMAL_MAINWIN (ZOF_TYPE_NORMAL | ZOF_TF_MAINWIN)
|
||||
#define ZNIT_NORMAL_TOOLWIN (ZOF_TYPE_NORMAL | ZOF_TF_TOOLWIN)
|
||||
#define ZNIT_NORMAL_CONTROL (ZOF_TYPE_NORMAL | ZOF_TF_CONTROL)
|
||||
|
||||
#define ZNIF_VISIBLE (ZOF_VISIBLE)
|
||||
#define ZNIF_DISABLED (ZOF_DISABLED)
|
||||
#define ZNIF_MAXIMIZED (ZOF_MAXIMIZED) /* Since 4.2.0 */
|
||||
#define ZNIF_MINIMIZED (ZOF_MINIMIZED) /* Since 4.2.0 */
|
||||
|
||||
/**
|
||||
* \defgroup rect_vars Global Rectangles
|
||||
* @{
|
||||
@@ -896,75 +962,6 @@ MG_EXPORT BOOL GUIAPI ServerDeleteLayer (MG_Layer* layer);
|
||||
MG_EXPORT int GUIAPI ServerGetNextZNode (MG_Layer* layer, int idx_znode,
|
||||
int* cli);
|
||||
|
||||
#define ZOF_STATUS_MASK 0x0000000F
|
||||
#define ZOF_VISIBLE 0x00000001
|
||||
#define ZOF_DISABLED 0x00000002
|
||||
#define ZOF_MAXIMIZED 0x00000004 /* Since 4.2.0 */
|
||||
#define ZOF_MINIMIZED 0x00000008 /* Since 4.2.0 */
|
||||
|
||||
/* Since 4.2.0 */
|
||||
#define ZOF_COMPOSITING_MASK 0x000000F0
|
||||
#define ZOF_COMPOS_OPAQUE 0x00000000
|
||||
#define ZOF_COMPOS_COLORKEY 0x00000010
|
||||
#define ZOF_COMPOS_ALPHACHANNEL 0x00000020
|
||||
#define ZOF_COMPOS_ALPHAPIXEL 0x00000030
|
||||
#define ZOF_COMPOS_BLURRED 0x00000040
|
||||
|
||||
/* Since 4.2.0; The alpha channel value or the radius of blur in pixels */
|
||||
#define ZOF_ALPHA_BLUR_MASK 0x0000FF00
|
||||
|
||||
/* Since 4.2.0 */
|
||||
#define ZOF_INTERNAL_FLAGS_MASK 0X000F0000
|
||||
#define ZOF_IF_REFERENCE 0x00010000
|
||||
#define ZOF_IF_ALWAYSTOP 0x00020000
|
||||
|
||||
#define ZOF_TW_FLAG_MASK 0x00F00000
|
||||
#define ZOF_TW_TROUNDCNS 0x00100000
|
||||
#define ZOF_TW_BROUNDCNS 0x00200000
|
||||
#define ZOF_TW_TBROUNDCNS 0x00300000
|
||||
|
||||
#define ZOF_TYPE_FLAG_MASK 0xFF000000
|
||||
|
||||
#define ZOF_TYPE_MASK 0xF0000000
|
||||
#define ZOF_TYPE_NULL 0x00000000
|
||||
#define ZOF_TYPE_POPUPMENU 0x10000000
|
||||
#define ZOF_TYPE_SCREENLOCK 0x20000000 /* Since 4.2.0; fixed and only one */
|
||||
#define ZOF_TYPE_DOCKER 0x30000000 /* Since 4.2.0; fixed and only one */
|
||||
#define ZOF_TYPE_GLOBAL 0x40000000
|
||||
#define ZOF_TYPE_TOPMOST 0x50000000
|
||||
#define ZOF_TYPE_NORMAL 0x60000000
|
||||
#define ZOF_TYPE_LAUNCHER 0x70000000 /* Since 4.2.0; fixed and only one */
|
||||
#define ZOF_TYPE_DESKTOP 0x80000000 /* fixed and only one */
|
||||
|
||||
#define ZOF_TF_FLAG_MASK 0x0F000000
|
||||
#define ZOF_TF_CONTROL 0x00000000
|
||||
#define ZOF_TF_MAINWIN 0x01000000
|
||||
#define ZOF_TF_TOOLWIN 0x02000000
|
||||
|
||||
#define ZNIT_NULL (ZOF_TYPE_NULL)
|
||||
#define ZNIT_POPUPMENU (ZOF_TYPE_POPUPMENU)
|
||||
#define ZNIT_SCREENLOCK (ZOF_TYPE_SCREENLOCK)
|
||||
#define ZNIT_DESKTOP (ZOF_TYPE_DESKTOP)
|
||||
#define ZNIT_LAUNCHER (ZOF_TYPE_LAUNCHER)
|
||||
#define ZNIT_DESKTOP (ZOF_TYPE_DESKTOP)
|
||||
|
||||
#define ZNIT_GLOBAL_MAINWIN (ZOF_TYPE_GLOBAL | ZOF_TF_MAINWIN)
|
||||
#define ZNIT_GLOBAL_TOOLWIN (ZOF_TYPE_GLOBAL | ZOF_TF_TOOLWIN)
|
||||
#define ZNIT_GLOBAL_CONTROL (ZOF_TYPE_GLOBAL | ZOF_TF_CONTROL)
|
||||
|
||||
#define ZNIT_TOPMOST_MAINWIN (ZOF_TYPE_TOPMOST | ZOF_TF_MAINWIN)
|
||||
#define ZNIT_TOPMOST_TOOLWIN (ZOF_TYPE_TOPMOST | ZOF_TF_TOOLWIN)
|
||||
#define ZNIT_TOPMOST_CONTROL (ZOF_TYPE_TOPMOST | ZOF_TF_CONTROL)
|
||||
|
||||
#define ZNIT_NORMAL_MAINWIN (ZOF_TYPE_NORMAL | ZOF_TF_MAINWIN)
|
||||
#define ZNIT_NORMAL_TOOLWIN (ZOF_TYPE_NORMAL | ZOF_TF_TOOLWIN)
|
||||
#define ZNIT_NORMAL_CONTROL (ZOF_TYPE_NORMAL | ZOF_TF_CONTROL)
|
||||
|
||||
#define ZNIF_VISIBLE (ZOF_VISIBLE)
|
||||
#define ZNIF_DISABLED (ZOF_DISABLED)
|
||||
#define ZNIF_MAXIMIZED (ZOF_MAXIMIZED) /* Since 4.2.0 */
|
||||
#define ZNIF_MINIMIZED (ZOF_MINIMIZED) /* Since 4.2.0 */
|
||||
|
||||
/** Z-node information structure */
|
||||
typedef struct _ZNODEINFO {
|
||||
/**
|
||||
@@ -1038,6 +1035,11 @@ typedef struct _ZNODEINFO {
|
||||
* The memory DC for this znode.
|
||||
*/
|
||||
HDC mem_dc;
|
||||
/**
|
||||
* The compositing argument for this znode.
|
||||
* For more information, see \a SetMainWindowCompositing.
|
||||
*/
|
||||
DWORD cmps_arg;
|
||||
#endif
|
||||
} ZNODEINFO;
|
||||
|
||||
|
||||
@@ -2398,6 +2398,15 @@ extern DWORD __mg_interval_time;
|
||||
|
||||
#define MSG_GETNEXTMAINWIN 0x0103
|
||||
|
||||
#define MSG_SETALWAYSTOP 0x0104
|
||||
|
||||
typedef struct _COMPOSITINGINFO {
|
||||
int type;
|
||||
DWORD arg;
|
||||
} COMPOSITINGINFO;
|
||||
|
||||
#define MSG_SETCOMPOSITING 0x0105
|
||||
|
||||
#define MSG_SHOWGLOBALCTRL 0x010A
|
||||
#define MSG_HIDEGLOBALCTRL 0x010B
|
||||
|
||||
@@ -4133,10 +4142,10 @@ MG_EXPORT HWND GUIAPI RegisterMouseHookWindow (HWND hwnd, DWORD flag);
|
||||
|
||||
/**
|
||||
* \def WS_EX_WINTYPE_SCREENLOCK
|
||||
* \brief The main window type is screen lock.
|
||||
* \brief The main window type is the screen lock.
|
||||
*
|
||||
* Use this style when you want to create a main window acting as
|
||||
* a screen lock. The screen lock will have the highest z-index.
|
||||
* the screen lock. The screen lock will have the highest z-index.
|
||||
*
|
||||
* \note If there is already a main window acts as the screen lock,
|
||||
* a topmost main window will be created.
|
||||
@@ -4145,10 +4154,10 @@ MG_EXPORT HWND GUIAPI RegisterMouseHookWindow (HWND hwnd, DWORD flag);
|
||||
|
||||
/**
|
||||
* \def WS_EX_WINTYPE_DOCKER
|
||||
* \brief The main window type is a docker.
|
||||
* \brief The main window type is the docker.
|
||||
*
|
||||
* Use this style when you want to create a main window acting as
|
||||
* a docker. The docker will have the z-index lower than screen lock.
|
||||
* the docker. The docker will have the z-index lower than screen lock.
|
||||
*
|
||||
* \note If there is already a main window acts as the docker,
|
||||
* a topmost main window will be created.
|
||||
@@ -4157,10 +4166,10 @@ MG_EXPORT HWND GUIAPI RegisterMouseHookWindow (HWND hwnd, DWORD flag);
|
||||
|
||||
/**
|
||||
* \def WS_EX_WINTYPE_LAUNCHER
|
||||
* \brief The main window type is a launcher.
|
||||
* \brief The main window type is the launcher.
|
||||
*
|
||||
* Use this style when you want to create a main window acting as
|
||||
* a launcher (or window manager). The launcher will have the lowest
|
||||
* the launcher (or the window manager). The launcher will have the lowest
|
||||
* z-index.
|
||||
*
|
||||
* \note If there is already a main window acts as the launcher,
|
||||
@@ -4169,7 +4178,7 @@ MG_EXPORT HWND GUIAPI RegisterMouseHookWindow (HWND hwnd, DWORD flag);
|
||||
#define WS_EX_WINTYPE_LAUNCHER 0x30000000L
|
||||
|
||||
/* Not used, obsolete. */
|
||||
#define WS_EX_INTERNAL_MASK 0xF0000000L
|
||||
#define WS_EX_INTERNAL_MASK 0x00000000L
|
||||
|
||||
/** @} end of styles */
|
||||
|
||||
@@ -6067,14 +6076,14 @@ MG_EXPORT BOOL GUIAPI SetWindowMask (HWND hWnd, const MYBITMAP* mask);
|
||||
MG_EXPORT BOOL GUIAPI SetWindowMaskEx (HWND hWnd, HDC hdc, const BITMAP* mask);
|
||||
|
||||
/**
|
||||
* \fn BOOL GUIAPI SetMainWindowAlwaysTop (HWND hWnd)
|
||||
* \brief Set a main window being always top.
|
||||
* \fn BOOL GUIAPI SetMainWindowAlwaysTop (HWND hWnd, BOOL fSet)
|
||||
* \brief Set or cancel a main window being always top.
|
||||
*
|
||||
* This function set a main window being always top on others.
|
||||
* If it succeed, the main window will have the exteneded style:
|
||||
* \a WS_ALWAYSTOP.
|
||||
* This function set or cancel a main window being always top on others.
|
||||
* If it succeed, the main window will have the style \a WS_ALWAYSTOP.
|
||||
*
|
||||
* \param hWnd The handle to the window.
|
||||
* \param fSet Set or cancel the always top style; TRUE to set, FALSE to cancel.
|
||||
*
|
||||
* \return return TRUE on success, otherwise FALSE.
|
||||
*
|
||||
@@ -6082,7 +6091,7 @@ MG_EXPORT BOOL GUIAPI SetWindowMaskEx (HWND hWnd, HDC hdc, const BITMAP* mask);
|
||||
*
|
||||
* Since 4.2.0
|
||||
*/
|
||||
MG_EXPORT BOOL GUIAPI SetMainWindowAlwaysTop (HWND hWnd);
|
||||
MG_EXPORT BOOL GUIAPI SetMainWindowAlwaysTop (HWND hWnd, BOOL fSet);
|
||||
|
||||
#ifdef _MGSCHEMA_COMPOSITING
|
||||
|
||||
|
||||
@@ -6350,5 +6350,41 @@ int GUIAPI SetWindowZOrder(HWND hWnd, int zorder)
|
||||
return idx;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* defined __TARGET_MSTUDIO__ */
|
||||
|
||||
/* Since 4.2.0 */
|
||||
BOOL GUIAPI SetMainWindowAlwaysTop (HWND hMainWnd, BOOL fSet)
|
||||
{
|
||||
PMAINWIN pMainWin;
|
||||
|
||||
if (hMainWnd == HWND_DESKTOP || hMainWnd == 0) {
|
||||
return FALSE;
|
||||
}
|
||||
else if (!(pMainWin = gui_CheckAndGetMainWindowPtr (hMainWnd))) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return (BOOL) SendMessage (HWND_DESKTOP,
|
||||
MSG_SETALWAYSTOP, (WPARAM)pMainWin, (LPARAM)fSet);
|
||||
}
|
||||
|
||||
#ifdef _MGSCHEMA_COMPOSITING
|
||||
BOOL GUIAPI SetMainWindowCompositing (HWND hMainWnd, int type, DWORD arg)
|
||||
{
|
||||
PMAINWIN pMainWin;
|
||||
COMPOSITINGINFO info;
|
||||
|
||||
if (hMainWnd == HWND_DESKTOP || hMainWnd == 0) {
|
||||
return FALSE;
|
||||
}
|
||||
else if (!(pMainWin = gui_CheckAndGetMainWindowPtr (hMainWnd))) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
info.type = type;
|
||||
info.arg = arg;
|
||||
return (BOOL) SendMessage (HWND_DESKTOP,
|
||||
MSG_SETCOMPOSITING, (WPARAM)pMainWin, (LPARAM)&info);
|
||||
}
|
||||
#endif /* defined _MGSCHEMA_COMPOSITING */
|
||||
|
||||
|
||||
@@ -158,24 +158,26 @@ typedef struct LayerOpInfo {
|
||||
} layer;
|
||||
} LAYEROPINFO;
|
||||
|
||||
#define ID_ZOOP_ALLOC 1
|
||||
#define ID_ZOOP_FREE 2
|
||||
#define ID_ZOOP_MOVE2TOP 3
|
||||
#define ID_ZOOP_SHOW 4
|
||||
#define ID_ZOOP_HIDE 5
|
||||
#define ID_ZOOP_MOVEWIN 6
|
||||
#define ID_ZOOP_SETACTIVE 7
|
||||
#define ID_ZOOP_ALLOC 1
|
||||
#define ID_ZOOP_FREE 2
|
||||
#define ID_ZOOP_MOVE2TOP 3
|
||||
#define ID_ZOOP_SHOW 4
|
||||
#define ID_ZOOP_HIDE 5
|
||||
#define ID_ZOOP_MOVEWIN 6
|
||||
#define ID_ZOOP_SETACTIVE 7
|
||||
#define ID_ZOOP_SETALWAYSTOP 8 /* since 4.2.0 */
|
||||
#define ID_ZOOP_SETCOMPOSITING 9 /* since 4.2.0 */
|
||||
|
||||
#define ID_ZOOP_START_TRACKMENU 9
|
||||
#define ID_ZOOP_END_TRACKMENU 10
|
||||
#define ID_ZOOP_CLOSEMENU 11
|
||||
#define ID_ZOOP_ENABLEWINDOW 12
|
||||
#define ID_ZOOP_STARTDRAG 13
|
||||
#define ID_ZOOP_CANCELDRAG 14
|
||||
#define ID_ZOOP_CHANGECAPTION 15
|
||||
#define ID_ZOOP_START_TRACKMENU 10
|
||||
#define ID_ZOOP_END_TRACKMENU 11
|
||||
#define ID_ZOOP_CLOSEMENU 12
|
||||
#define ID_ZOOP_ENABLEWINDOW 13
|
||||
#define ID_ZOOP_STARTDRAG 14
|
||||
#define ID_ZOOP_CANCELDRAG 15
|
||||
#define ID_ZOOP_CHANGECAPTION 16
|
||||
|
||||
#define ID_ZOOP_MASKRECT_SET 16
|
||||
#define ID_ZOOP_MASKRECT_FREE 17
|
||||
#define ID_ZOOP_MASKRECT_SET 17
|
||||
#define ID_ZOOP_MASKRECT_FREE 18
|
||||
|
||||
#ifndef MAX_CAPTION_LEN
|
||||
#define MAX_CAPTION_LEN 39 //40
|
||||
@@ -197,16 +199,25 @@ typedef struct ZorderOpInfo
|
||||
int id_op;
|
||||
|
||||
int idx_znode;
|
||||
|
||||
/* reuse for the flag of ID_ZOOP_SETALWAYSTOP */
|
||||
DWORD flags;
|
||||
|
||||
HWND hwnd;
|
||||
HWND main_win;
|
||||
RECT rc;
|
||||
RECT rcA;
|
||||
|
||||
int location;
|
||||
char caption[MAX_CAPTION_LEN + 1];
|
||||
|
||||
#ifdef _MGSCHEMA_COMPOSITING
|
||||
Uint32 surf_flags;
|
||||
size_t surf_size;
|
||||
/* the compositing type of ID_ZOOP_SETCOMPOSITING */
|
||||
int ct;
|
||||
/* the compositing argument of ID_ZOOP_SETCOMPOSITING */
|
||||
DWORD ct_arg;
|
||||
#endif
|
||||
} ZORDEROPINFO;
|
||||
|
||||
|
||||
@@ -54,6 +54,12 @@
|
||||
|
||||
#include "constants.h"
|
||||
|
||||
/* Since 4.2.0 */
|
||||
#define ZNODE_IDX_DESKTOP 0
|
||||
#define ZNODE_IDX_SCREENLOCK 1
|
||||
#define ZNODE_IDX_DOCKER 2
|
||||
#define ZNODE_IDX_LAUNCHER 3
|
||||
|
||||
typedef struct _RECT4MASK {
|
||||
unsigned short left, top, right, bottom;
|
||||
} RECT4MASK;
|
||||
@@ -81,6 +87,7 @@ typedef struct _ZORDERNODE {
|
||||
HWND main_win; /* handle to the main window */
|
||||
#ifdef _MGSCHEMA_COMPOSITING
|
||||
HDC mem_dc; /* The memory DC for this znode. */
|
||||
DWORD ct_arg; /* the argument for compositing. */
|
||||
#endif
|
||||
|
||||
int next;
|
||||
|
||||
@@ -341,6 +341,28 @@ static void dskMoveToTopMost (PMAINWIN pWin, int reason, LPARAM lParam)
|
||||
dskSetActiveWindow (pWin);
|
||||
}
|
||||
|
||||
/* Since 4.2.0 */
|
||||
static BOOL dskSetMainWindowAlwaysTop (PMAINWIN pWin, BOOL fSet)
|
||||
{
|
||||
if ((pWin->dwStyle & WS_ALWAYSTOP) && fSet)
|
||||
return TRUE;
|
||||
|
||||
if (!(pWin->dwStyle & WS_ALWAYSTOP) && !fSet)
|
||||
return TRUE;
|
||||
|
||||
if (dskSetZNodeAlwaysTop (0, pWin->idx_znode, fSet))
|
||||
return FALSE;
|
||||
|
||||
if (fSet) {
|
||||
pWin->dwStyle |= WS_ALWAYSTOP;
|
||||
}
|
||||
else {
|
||||
pWin->dwStyle &= ~WS_ALWAYSTOP;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void dskHideMainWindow (PMAINWIN pWin)
|
||||
{
|
||||
if (!(pWin->dwStyle & WS_VISIBLE))
|
||||
@@ -1515,6 +1537,10 @@ static LRESULT WindowMessageHandler(UINT message, PMAINWIN pWin, LPARAM lParam)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Since 4.2.0 */
|
||||
case MSG_SETALWAYSTOP:
|
||||
return dskSetMainWindowAlwaysTop(pWin, (BOOL)lParam);
|
||||
|
||||
case MSG_SHOWGLOBALCTRL:
|
||||
#ifdef _MGHAVE_MENU
|
||||
if (sg_ptmi)
|
||||
|
||||
@@ -645,6 +645,51 @@ static intptr_t cliChangeCaption (PMAINWIN pWin)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Since 4.2.0 */
|
||||
static intptr_t cliSetMainWinAlwaysTop (PMAINWIN pWin, BOOL fSet)
|
||||
{
|
||||
intptr_t ret;
|
||||
REQUEST req;
|
||||
ZORDEROPINFO info;
|
||||
|
||||
info.id_op = ID_ZOOP_SETALWAYSTOP;
|
||||
info.idx_znode = pWin->idx_znode;
|
||||
info.flags = fSet;
|
||||
|
||||
req.id = REQID_ZORDEROP;
|
||||
req.data = &info;
|
||||
req.len_data = sizeof (ZORDEROPINFO);
|
||||
|
||||
if (ClientRequest (&req, &ret, sizeof (intptr_t)) < 0)
|
||||
return -1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef _MGSCHEMA_COMPOSITING
|
||||
static intptr_t cliSetMainWinCompositing (PMAINWIN pWin,
|
||||
const COMPOSITINGINFO* my_info)
|
||||
{
|
||||
intptr_t ret;
|
||||
REQUEST req;
|
||||
ZORDEROPINFO info;
|
||||
|
||||
info.id_op = ID_ZOOP_SETCOMPOSITING;
|
||||
info.idx_znode = pWin->idx_znode;
|
||||
info.ct = my_info->type;
|
||||
info.ct_arg = my_info->arg;
|
||||
|
||||
req.id = REQID_ZORDEROP;
|
||||
req.data = &info;
|
||||
req.len_data = sizeof (ZORDEROPINFO);
|
||||
|
||||
if (ClientRequest (&req, &ret, sizeof (intptr_t)) < 0)
|
||||
return -1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif /* defined _MGSCHEMA_COMPOSTING */
|
||||
|
||||
/*********************** Server-side routines ********************************/
|
||||
|
||||
void __mg_start_server_desktop (void)
|
||||
@@ -1147,6 +1192,20 @@ static int srvChangeCaption (int cli, int idx_znode, const char *caption)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Since 4.2.0 */
|
||||
static inline int srvSetZNodeAlwaysTop (int cli, int idx_znode, BOOL fSet)
|
||||
{
|
||||
return dskSetZNodeAlwaysTop (cli, idx_znode, fSet);
|
||||
}
|
||||
|
||||
#ifdef _MGSCHEMA_COMPOSITING
|
||||
static inline int srvSetZNodeCompositing (int cli, int idx_znode,
|
||||
int type, DWORD arg)
|
||||
{
|
||||
return dskSetZNodeCompositing (cli, idx_znode, type, arg);
|
||||
}
|
||||
#endif /* _MGSCHEMA_COMPOSITING */
|
||||
|
||||
intptr_t __mg_do_zorder_maskrect_operation (int cli,
|
||||
const ZORDERMASKRECTOPINFO* info)
|
||||
{
|
||||
@@ -1229,6 +1288,15 @@ intptr_t __mg_do_zorder_operation (int cli, const ZORDEROPINFO* info, int fd)
|
||||
case ID_ZOOP_CHANGECAPTION:
|
||||
srvChangeCaption (cli, info->idx_znode, info->caption);
|
||||
break;
|
||||
case ID_ZOOP_SETALWAYSTOP:
|
||||
srvSetZNodeAlwaysTop (cli, info->idx_znode, info->flags);
|
||||
break;
|
||||
#ifdef _MGSCHEMA_COMPOSITING
|
||||
case ID_ZOOP_SETCOMPOSITING:
|
||||
srvSetZNodeCompositing (cli, info->idx_znode,
|
||||
info->ct, info->ct_arg);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -2178,6 +2246,51 @@ static int dskChangeCaption (PMAINWIN pWin)
|
||||
return cliChangeCaption (pWin);
|
||||
}
|
||||
|
||||
/* Since 4.2.0 */
|
||||
static BOOL dskSetMainWinAlwaysTop (PMAINWIN pWin, BOOL fSet)
|
||||
{
|
||||
if ((pWin->dwStyle & WS_ALWAYSTOP) && fSet)
|
||||
return TRUE;
|
||||
|
||||
if (!(pWin->dwStyle & WS_ALWAYSTOP) && !fSet)
|
||||
return TRUE;
|
||||
|
||||
if (mgIsServer) {
|
||||
if (srvSetZNodeAlwaysTop (0, pWin->idx_znode, fSet))
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
if (cliSetMainWinAlwaysTop (pWin, fSet))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (fSet) {
|
||||
pWin->dwStyle |= WS_ALWAYSTOP;
|
||||
}
|
||||
else {
|
||||
pWin->dwStyle &= ~WS_ALWAYSTOP;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#ifdef _MGSCHEMA_COMPOSITING
|
||||
/* Since 4.2.0 */
|
||||
static BOOL dskSetMainWinCompositing (PMAINWIN pWin, const COMPOSITINGINFO* info)
|
||||
{
|
||||
if (mgIsServer) {
|
||||
if (srvSetZNodeCompositing (0, pWin->idx_znode, info->type, info->arg))
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
if (cliSetMainWinCompositing (pWin, info))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* defined _MGSCHEMA_COMPOSITING */
|
||||
|
||||
static LRESULT dskWindowMessageHandler (UINT message, PMAINWIN pWin, LPARAM lParam)
|
||||
{
|
||||
switch (message) {
|
||||
@@ -2283,6 +2396,17 @@ static LRESULT dskWindowMessageHandler (UINT message, PMAINWIN pWin, LPARAM lPar
|
||||
|
||||
case MSG_CHANGECAPTION:
|
||||
return dskChangeCaption (pWin);
|
||||
|
||||
/* Since 4.2.0 */
|
||||
case MSG_SETALWAYSTOP:
|
||||
return dskSetMainWinAlwaysTop (pWin, (BOOL)lParam);
|
||||
|
||||
#ifdef _MGSCHEMA_COMPOSITING
|
||||
/* Since 4.2.0 */
|
||||
case MSG_SETCOMPOSITING:
|
||||
return dskSetMainWinCompositing (pWin, (const COMPOSITINGINFO*)lParam);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -2001,11 +2001,28 @@ static DWORD get_znode_flags_from_style (PMAINWIN pWin)
|
||||
zt_type |= ZOF_TYPE_NORMAL;
|
||||
}
|
||||
|
||||
if (pWin->dwStyle & WS_VISIBLE)
|
||||
/* XXX: Since 4.2.0 */
|
||||
if (!(pWin->dwStyle & WS_CHILD)) {
|
||||
if (pWin->dwStyle & WS_MINIMIZE) {
|
||||
zt_type |= ZOF_MINIMIZED;
|
||||
}
|
||||
else if (pWin->dwStyle & WS_MAXIMIZE) {
|
||||
zt_type |= ZOF_MAXIMIZED;
|
||||
/* TODO: change main window rect here */
|
||||
}
|
||||
}
|
||||
|
||||
if (pWin->dwStyle & WS_VISIBLE) {
|
||||
zt_type |= ZOF_VISIBLE;
|
||||
}
|
||||
|
||||
if (pWin->dwStyle & WS_DISABLED)
|
||||
zt_type |= ZOF_DISABLED;
|
||||
|
||||
/* Since 4.2.0 */
|
||||
if (pWin->dwStyle & WS_ALWAYSTOP)
|
||||
zt_type |= ZOF_IF_ALWAYSTOP;
|
||||
|
||||
if (pWin->WinType == TYPE_MAINWIN)
|
||||
zt_type |= ZOF_TF_MAINWIN;
|
||||
|
||||
@@ -2201,7 +2218,7 @@ static int dskDestroyTopZOrderNode (int cli, int idx_znode)
|
||||
}
|
||||
#endif /* _MG_ENABLE_SCREENSAVER || _MG_ENABLE_WATERMARK */
|
||||
|
||||
/*XXX static */int dskSetZNodeAlwaysTop (int cli, int idx_znode)
|
||||
/*XXX static */int dskSetZNodeAlwaysTop (int cli, int idx_znode, BOOL fSet)
|
||||
{
|
||||
// NUV DWORD type;
|
||||
ZORDERINFO* zi = _get_zorder_info (cli);
|
||||
@@ -2223,7 +2240,12 @@ static int dskDestroyTopZOrderNode (int cli, int idx_znode)
|
||||
|
||||
/* lock zi for change */
|
||||
lock_zi_for_change (zi);
|
||||
nodes[idx_znode].flags |= ZOF_IF_ALWAYSTOP;
|
||||
if (fSet) {
|
||||
nodes[idx_znode].flags |= ZOF_IF_ALWAYSTOP;
|
||||
}
|
||||
else {
|
||||
nodes[idx_znode].flags &= ~ZOF_IF_ALWAYSTOP;
|
||||
}
|
||||
/* unlock zi for change */
|
||||
unlock_zi_for_change (zi);
|
||||
|
||||
@@ -2250,7 +2272,7 @@ void __mg_screensaver_create(void)
|
||||
if (!_screensaver_node) {
|
||||
RECT rcScr = GetScreenRect();
|
||||
_screensaver_node = dskCreateTopZOrderNode (0, &rcScr);
|
||||
dskSetZNodeAlwaysTop (0, _screensaver_node);
|
||||
dskSetZNodeAlwaysTop (0, _screensaver_node, TRUE);
|
||||
dskHideWindow (0, _screensaver_node);
|
||||
}
|
||||
}
|
||||
@@ -2265,6 +2287,65 @@ void __mg_screensaver_destroy(void)
|
||||
}
|
||||
#endif /* defined _MG_ENABLE_SCREENSAVER */
|
||||
|
||||
#ifdef _MGSCHEMA_COMPOSITING
|
||||
static inline DWORD compositing_type_to_flag (int type)
|
||||
{
|
||||
switch (type) {
|
||||
case CT_OPAQUE:
|
||||
default:
|
||||
return ZOF_COMPOS_OPAQUE;
|
||||
case CT_COLORKEY:
|
||||
return ZOF_COMPOS_COLORKEY;
|
||||
case CT_ALPHACHANNEL:
|
||||
return ZOF_COMPOS_ALPHACHANNEL;
|
||||
case CT_ALPHAPIXEL:
|
||||
return ZOF_COMPOS_ALPHAPIXEL;
|
||||
case CT_BLURRED:
|
||||
return ZOF_COMPOS_BLURRED;
|
||||
}
|
||||
|
||||
return ZOF_COMPOS_OPAQUE;
|
||||
}
|
||||
|
||||
/* Since 4.2.0 */
|
||||
static int dskSetZNodeCompositing (int cli, int idx_znode, int ct, DWORD ct_arg)
|
||||
{
|
||||
ZORDERINFO* zi = _get_zorder_info (cli);
|
||||
DWORD type;
|
||||
DWORD flag, old_flag;
|
||||
ZORDERNODE* nodes;
|
||||
|
||||
if (idx_znode > (zi->max_nr_globals
|
||||
+ zi->max_nr_topmosts + zi->max_nr_normals)
|
||||
|| idx_znode <= 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
nodes = GET_ZORDERNODE(zi);
|
||||
type = nodes [idx_znode].flags & ZOF_TYPE_MASK;
|
||||
if (type == ZOF_TYPE_NULL || type >= ZOF_TYPE_DESKTOP) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
flag = compositing_type_to_flag (ct);
|
||||
old_flag = nodes [idx_znode].flags & ZOF_COMPOSITING_MASK;
|
||||
if ((flag == old_flag) && (nodes [idx_znode].ct_arg == ct_arg)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* lock zi for change */
|
||||
lock_zi_for_change (zi);
|
||||
|
||||
nodes [idx_znode].flags &= ~ZOF_COMPOSITING_MASK;
|
||||
nodes [idx_znode].flags |= flag;
|
||||
nodes [idx_znode].ct_arg = ct_arg;
|
||||
|
||||
/* unlock zi for change */
|
||||
unlock_zi_for_change (zi);
|
||||
return 0;
|
||||
}
|
||||
#endif /* defined _MGSCHEMA_COMPOSITING */
|
||||
|
||||
static int dskMove2Top (int cli, int idx_znode)
|
||||
{
|
||||
DWORD type;
|
||||
|
||||
Reference in New Issue
Block a user