mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-05 00:38:00 +02:00
Convert winwin32rootlesswindow.c's \r\n to \n. Top level X window has own
frame's HWND.
This commit is contained in:
parent
d0f8eb52b3
commit
cf52f32ac3
3 changed files with 233 additions and 200 deletions
|
|
@ -39,6 +39,7 @@
|
|||
#include "dixevents.h"
|
||||
#include "winmultiwindowclass.h"
|
||||
#include "winprefs.h"
|
||||
#include "Xatom.h"
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -52,6 +53,15 @@
|
|||
#define ULW_OPAQUE 0x00000004
|
||||
#define AC_SRC_ALPHA 0x01
|
||||
|
||||
|
||||
/*
|
||||
* Local function
|
||||
*/
|
||||
|
||||
DEFINE_ATOM_HELPER(AtmWindowsWmNativeHwnd, WINDOWSWM_NATIVE_HWND)
|
||||
static void
|
||||
winWin32RootlessSetNativeProperty (RootlessWindowPtr pFrame);
|
||||
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
|
|
@ -215,8 +225,8 @@ winWin32RootlessCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen,
|
|||
Bool fResult = TRUE;
|
||||
win32RootlessWindowPtr pRLWinPriv;
|
||||
WNDCLASS wc;
|
||||
char pszClass[CLASS_NAME_LENGTH], pszWindowID[12];
|
||||
HICON hIcon;
|
||||
char pszClass[CLASS_NAME_LENGTH], pszWindowID[12];
|
||||
HICON hIcon;
|
||||
char *res_name, *res_class, *res_role;
|
||||
static int s_iWindowID = 0;
|
||||
|
||||
|
|
@ -269,7 +279,7 @@ winWin32RootlessCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen,
|
|||
* if not use the WM_CLASS information.
|
||||
* For further information see:
|
||||
* http://tronche.com/gui/x/icccm/sec-5.html
|
||||
*/
|
||||
*/
|
||||
if (winMultiWindowGetWindowRole (pFrame->win, &res_role) )
|
||||
{
|
||||
strcat (pszClass, "-");
|
||||
|
|
@ -357,6 +367,9 @@ winWin32RootlessCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen,
|
|||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
winWin32RootlessSetNativeProperty (pFrame);
|
||||
|
||||
return fResult;
|
||||
}
|
||||
|
||||
|
|
@ -834,6 +847,8 @@ winWin32RootlessRootlessSwitchWindow (RootlessWindowPtr pFrame, WindowPtr oldWin
|
|||
pRLWinPriv->pFrame = pFrame;
|
||||
pRLWinPriv->fResized = TRUE;
|
||||
|
||||
DeleteProperty (oldWin, AtmWindowsWmNativeHwnd ());
|
||||
winWin32RootlessSetNativeProperty (pFrame);
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
#if 0
|
||||
{
|
||||
|
|
@ -933,3 +948,21 @@ winWin32RootlessCopyWindow (RootlessFrameID wid, int nDstRects, const BoxRec *pD
|
|||
ErrorF ("winWin32RootlessCopyWindow - done\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* winWin32RootlessSetNativeProperty
|
||||
*/
|
||||
|
||||
static void
|
||||
winWin32RootlessSetNativeProperty (RootlessWindowPtr pFrame)
|
||||
{
|
||||
win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) pFrame->wid;
|
||||
long lData;
|
||||
|
||||
/* FIXME: move this to WindowsWM extension */
|
||||
|
||||
lData = pRLWinPriv->hWnd;
|
||||
ChangeWindowProperty (pFrame->win, AtmWindowsWmNativeHwnd (),
|
||||
XA_INTEGER, 32, PropModeReplace, 1, &lData, TRUE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,196 +1,196 @@
|
|||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*
|
||||
*Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
*"Software"), to deal in the Software without restriction, including
|
||||
*without limitation the rights to use, copy, modify, merge, publish,
|
||||
*distribute, sublicense, and/or sell copies of the Software, and to
|
||||
*permit persons to whom the Software is furnished to do so, subject to
|
||||
*the following conditions:
|
||||
*
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
*
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*Except as contained in this notice, the name of the XFree86 Project
|
||||
*shall not be used in advertising or otherwise to promote the sale, use
|
||||
*or other dealings in this Software without prior written authorization
|
||||
*from the XFree86 Project.
|
||||
*
|
||||
* Authors: Kensuke Matsuzaki
|
||||
* Earle F. Philhower, III
|
||||
* Harold L Hunt II
|
||||
*/
|
||||
|
||||
#include "win.h"
|
||||
#include "winprefs.h"
|
||||
|
||||
|
||||
/*
|
||||
* External global variables
|
||||
*/
|
||||
|
||||
extern HICON g_hiconX;
|
||||
|
||||
|
||||
/*
|
||||
* winWin32RootlessReorderWindows
|
||||
*/
|
||||
|
||||
void
|
||||
winWin32RootlessReorderWindows (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
HWND hwnd = NULL;
|
||||
win32RootlessWindowPtr pRLWin = NULL;
|
||||
win32RootlessWindowPtr pRLWinSib = NULL;
|
||||
DWORD dwCurrentProcessID = GetCurrentProcessId ();
|
||||
DWORD dwWindowProcessID = 0;
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG && FALSE
|
||||
ErrorF ("winWin32RootlessReorderWindows\n");
|
||||
#endif
|
||||
|
||||
pScreenPriv->fRestacking = TRUE;
|
||||
|
||||
if (pScreenPriv->fWindowOrderChanged)
|
||||
{
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("winWin32RootlessReorderWindows - Need to restack\n");
|
||||
#endif
|
||||
hwnd = GetTopWindow (NULL);
|
||||
|
||||
while (hwnd)
|
||||
{
|
||||
GetWindowThreadProcessId (hwnd, &dwWindowProcessID);
|
||||
|
||||
if ((dwWindowProcessID == dwCurrentProcessID)
|
||||
&& GetProp (hwnd, WIN_WINDOW_PROP))
|
||||
{
|
||||
pRLWinSib = pRLWin;
|
||||
pRLWin = (win32RootlessWindowPtr)GetProp (hwnd, WIN_WINDOW_PROP);
|
||||
|
||||
if (pRLWinSib)
|
||||
{
|
||||
XID *vlist = malloc (sizeof(long) * 2);
|
||||
|
||||
if (vlist == NULL)
|
||||
{
|
||||
ErrorF ("winWin32RootlessReorderWindows - malloc () "
|
||||
"failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
((long*)vlist)[0] = pRLWinSib->pFrame->win->drawable.id;
|
||||
((long*)vlist)[1] = Below;
|
||||
|
||||
ConfigureWindow (pRLWin->pFrame->win, CWSibling | CWStackMode,
|
||||
vlist, wClient(pRLWin->pFrame->win));
|
||||
|
||||
free (vlist);
|
||||
}
|
||||
}
|
||||
hwnd = GetNextWindow (hwnd, GW_HWNDNEXT);
|
||||
}
|
||||
}
|
||||
|
||||
pScreenPriv->fRestacking = FALSE;
|
||||
pScreenPriv->fWindowOrderChanged = FALSE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* winWin32RootlessMoveXWindow
|
||||
*/
|
||||
|
||||
void
|
||||
winWin32RootlessMoveXWindow (WindowPtr pWin, int x, int y)
|
||||
{
|
||||
XID *vlist = malloc(sizeof(long)*2);
|
||||
|
||||
(CARD32*)vlist[0] = x;
|
||||
(CARD32*)vlist[1] = y;
|
||||
ConfigureWindow (pWin, CWX | CWY, vlist, wClient(pWin));
|
||||
free(vlist);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* winWin32RootlessResizeXWindow
|
||||
*/
|
||||
|
||||
void
|
||||
winWin32RootlessResizeXWindow (WindowPtr pWin, int w, int h)
|
||||
{
|
||||
XID *vlist = malloc(sizeof(long)*2);
|
||||
|
||||
(CARD32*)vlist[0] = w;
|
||||
(CARD32*)vlist[1] = h;
|
||||
ConfigureWindow (pWin, CWWidth | CWHeight, vlist, wClient(pWin));
|
||||
free(vlist);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* winWin32RootlessMoveResizeXWindow
|
||||
*/
|
||||
|
||||
void
|
||||
winWin32RootlessMoveResizeXWindow (WindowPtr pWin, int x, int y, int w, int h)
|
||||
{
|
||||
XID *vlist = malloc(sizeof(long)*4);
|
||||
|
||||
(CARD32*)vlist[0] = x;
|
||||
(CARD32*)vlist[1] = y;
|
||||
(CARD32*)vlist[2] = w;
|
||||
(CARD32*)vlist[3] = h;
|
||||
|
||||
ConfigureWindow (pWin, CWX | CWY | CWWidth | CWHeight, vlist, wClient(pWin));
|
||||
free(vlist);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* winWin32RootlessUpdateIcon
|
||||
* Change the Windows window icon
|
||||
*/
|
||||
|
||||
void
|
||||
winWin32RootlessUpdateIcon (Window id)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
HICON hIcon, hiconOld;
|
||||
|
||||
pWin = LookupIDByType (id, RT_WINDOW);
|
||||
hIcon = (HICON)winOverrideIcon ((unsigned long)pWin);
|
||||
|
||||
if (!hIcon)
|
||||
hIcon = winXIconToHICON (pWin);
|
||||
|
||||
if (hIcon)
|
||||
{
|
||||
win32RootlessWindowPtr pRLWinPriv
|
||||
= (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
|
||||
|
||||
if (pRLWinPriv->hWnd)
|
||||
{
|
||||
hiconOld = (HICON) SetClassLong (pRLWinPriv->hWnd,
|
||||
GCL_HICON,
|
||||
(int) hIcon);
|
||||
|
||||
/* Delete the icon if its not the default */
|
||||
if (hiconOld != g_hiconX &&
|
||||
!winIconIsOverride((unsigned long)hiconOld))
|
||||
DeleteObject (hiconOld);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*
|
||||
*Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
*"Software"), to deal in the Software without restriction, including
|
||||
*without limitation the rights to use, copy, modify, merge, publish,
|
||||
*distribute, sublicense, and/or sell copies of the Software, and to
|
||||
*permit persons to whom the Software is furnished to do so, subject to
|
||||
*the following conditions:
|
||||
*
|
||||
*The above copyright notice and this permission notice shall be
|
||||
*included in all copies or substantial portions of the Software.
|
||||
*
|
||||
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
*NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
|
||||
*ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*Except as contained in this notice, the name of the XFree86 Project
|
||||
*shall not be used in advertising or otherwise to promote the sale, use
|
||||
*or other dealings in this Software without prior written authorization
|
||||
*from the XFree86 Project.
|
||||
*
|
||||
* Authors: Kensuke Matsuzaki
|
||||
* Earle F. Philhower, III
|
||||
* Harold L Hunt II
|
||||
*/
|
||||
|
||||
#include "win.h"
|
||||
#include "winprefs.h"
|
||||
|
||||
|
||||
/*
|
||||
* External global variables
|
||||
*/
|
||||
|
||||
extern HICON g_hiconX;
|
||||
|
||||
|
||||
/*
|
||||
* winWin32RootlessReorderWindows
|
||||
*/
|
||||
|
||||
void
|
||||
winWin32RootlessReorderWindows (ScreenPtr pScreen)
|
||||
{
|
||||
winScreenPriv(pScreen);
|
||||
HWND hwnd = NULL;
|
||||
win32RootlessWindowPtr pRLWin = NULL;
|
||||
win32RootlessWindowPtr pRLWinSib = NULL;
|
||||
DWORD dwCurrentProcessID = GetCurrentProcessId ();
|
||||
DWORD dwWindowProcessID = 0;
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG && FALSE
|
||||
ErrorF ("winWin32RootlessReorderWindows\n");
|
||||
#endif
|
||||
|
||||
pScreenPriv->fRestacking = TRUE;
|
||||
|
||||
if (pScreenPriv->fWindowOrderChanged)
|
||||
{
|
||||
#if CYGMULTIWINDOW_DEBUG
|
||||
ErrorF ("winWin32RootlessReorderWindows - Need to restack\n");
|
||||
#endif
|
||||
hwnd = GetTopWindow (NULL);
|
||||
|
||||
while (hwnd)
|
||||
{
|
||||
GetWindowThreadProcessId (hwnd, &dwWindowProcessID);
|
||||
|
||||
if ((dwWindowProcessID == dwCurrentProcessID)
|
||||
&& GetProp (hwnd, WIN_WINDOW_PROP))
|
||||
{
|
||||
pRLWinSib = pRLWin;
|
||||
pRLWin = (win32RootlessWindowPtr)GetProp (hwnd, WIN_WINDOW_PROP);
|
||||
|
||||
if (pRLWinSib)
|
||||
{
|
||||
XID *vlist = malloc (sizeof(long) * 2);
|
||||
|
||||
if (vlist == NULL)
|
||||
{
|
||||
ErrorF ("winWin32RootlessReorderWindows - malloc () "
|
||||
"failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
((long*)vlist)[0] = pRLWinSib->pFrame->win->drawable.id;
|
||||
((long*)vlist)[1] = Below;
|
||||
|
||||
ConfigureWindow (pRLWin->pFrame->win, CWSibling | CWStackMode,
|
||||
vlist, wClient(pRLWin->pFrame->win));
|
||||
|
||||
free (vlist);
|
||||
}
|
||||
}
|
||||
hwnd = GetNextWindow (hwnd, GW_HWNDNEXT);
|
||||
}
|
||||
}
|
||||
|
||||
pScreenPriv->fRestacking = FALSE;
|
||||
pScreenPriv->fWindowOrderChanged = FALSE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* winWin32RootlessMoveXWindow
|
||||
*/
|
||||
|
||||
void
|
||||
winWin32RootlessMoveXWindow (WindowPtr pWin, int x, int y)
|
||||
{
|
||||
XID *vlist = malloc(sizeof(long)*2);
|
||||
|
||||
(CARD32*)vlist[0] = x;
|
||||
(CARD32*)vlist[1] = y;
|
||||
ConfigureWindow (pWin, CWX | CWY, vlist, wClient(pWin));
|
||||
free(vlist);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* winWin32RootlessResizeXWindow
|
||||
*/
|
||||
|
||||
void
|
||||
winWin32RootlessResizeXWindow (WindowPtr pWin, int w, int h)
|
||||
{
|
||||
XID *vlist = malloc(sizeof(long)*2);
|
||||
|
||||
(CARD32*)vlist[0] = w;
|
||||
(CARD32*)vlist[1] = h;
|
||||
ConfigureWindow (pWin, CWWidth | CWHeight, vlist, wClient(pWin));
|
||||
free(vlist);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* winWin32RootlessMoveResizeXWindow
|
||||
*/
|
||||
|
||||
void
|
||||
winWin32RootlessMoveResizeXWindow (WindowPtr pWin, int x, int y, int w, int h)
|
||||
{
|
||||
XID *vlist = malloc(sizeof(long)*4);
|
||||
|
||||
(CARD32*)vlist[0] = x;
|
||||
(CARD32*)vlist[1] = y;
|
||||
(CARD32*)vlist[2] = w;
|
||||
(CARD32*)vlist[3] = h;
|
||||
|
||||
ConfigureWindow (pWin, CWX | CWY | CWWidth | CWHeight, vlist, wClient(pWin));
|
||||
free(vlist);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* winWin32RootlessUpdateIcon
|
||||
* Change the Windows window icon
|
||||
*/
|
||||
|
||||
void
|
||||
winWin32RootlessUpdateIcon (Window id)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
HICON hIcon, hiconOld;
|
||||
|
||||
pWin = LookupIDByType (id, RT_WINDOW);
|
||||
hIcon = (HICON)winOverrideIcon ((unsigned long)pWin);
|
||||
|
||||
if (!hIcon)
|
||||
hIcon = winXIconToHICON (pWin);
|
||||
|
||||
if (hIcon)
|
||||
{
|
||||
win32RootlessWindowPtr pRLWinPriv
|
||||
= (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
|
||||
|
||||
if (pRLWinPriv->hWnd)
|
||||
{
|
||||
hiconOld = (HICON) SetClassLong (pRLWinPriv->hWnd,
|
||||
GCL_HICON,
|
||||
(int) hIcon);
|
||||
|
||||
/* Delete the icon if its not the default */
|
||||
if (hiconOld != g_hiconX &&
|
||||
!winIconIsOverride((unsigned long)hiconOld))
|
||||
DeleteObject (hiconOld);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
#define WIN_LOG_FNAME "/tmp/XWin.log"
|
||||
#define WIN_WID_PROP "cyg_wid_prop_rl"
|
||||
#define WIN_NEEDMANAGE_PROP "cyg_override_redirect_prop_rl"
|
||||
#define WIN_HWND_CACHE "cyg_privmap_rl"
|
||||
#define WIN_HWND_CACHE "cyg_privmap_rl"
|
||||
#define CYGMULTIWINDOW_DEBUG NO
|
||||
|
||||
typedef struct _winPrivScreenRec *winPrivScreenPtr;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue