Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
e5811f0e
Commit
e5811f0e
authored
Apr 15, 1999
by
Francois Boisvert
Committed by
Alexandre Julliard
Apr 15, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Solved a deadlock between global lock and wnd lock in event.c.
parent
ef66ee6b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
148 additions
and
99 deletions
+148
-99
event.c
windows/x11drv/event.c
+148
-99
No files found.
windows/x11drv/event.c
View file @
e5811f0e
...
...
@@ -85,23 +85,23 @@ static const char * const event_names[] =
static
void
EVENT_ProcessEvent
(
XEvent
*
event
);
/* Event handlers */
static
void
EVENT_Key
(
WND
*
p
Wnd
,
XKeyEvent
*
event
);
static
void
EVENT_ButtonPress
(
WND
*
p
Wnd
,
XButtonEvent
*
event
);
static
void
EVENT_ButtonRelease
(
WND
*
p
Wnd
,
XButtonEvent
*
event
);
static
void
EVENT_MotionNotify
(
WND
*
p
Wnd
,
XMotionEvent
*
event
);
static
void
EVENT_FocusIn
(
WND
*
p
Wnd
,
XFocusChangeEvent
*
event
);
static
void
EVENT_FocusOut
(
WND
*
p
Wnd
,
XFocusChangeEvent
*
event
);
static
void
EVENT_Expose
(
WND
*
p
Wnd
,
XExposeEvent
*
event
);
static
void
EVENT_GraphicsExpose
(
WND
*
p
Wnd
,
XGraphicsExposeEvent
*
event
);
static
void
EVENT_ConfigureNotify
(
WND
*
p
Wnd
,
XConfigureEvent
*
event
);
static
void
EVENT_SelectionRequest
(
WND
*
p
Wnd
,
XSelectionRequestEvent
*
event
);
static
void
EVENT_SelectionClear
(
WND
*
p
Wnd
,
XSelectionClearEvent
*
event
);
static
void
EVENT_ClientMessage
(
WND
*
p
Wnd
,
XClientMessageEvent
*
event
);
static
void
EVENT_MapNotify
(
WND
*
w
nd
,
XMapEvent
*
event
);
static
void
EVENT_UnmapNotify
(
WND
*
w
nd
,
XUnmapEvent
*
event
);
static
void
EVENT_Key
(
HWND
h
Wnd
,
XKeyEvent
*
event
);
static
void
EVENT_ButtonPress
(
HWND
h
Wnd
,
XButtonEvent
*
event
);
static
void
EVENT_ButtonRelease
(
HWND
h
Wnd
,
XButtonEvent
*
event
);
static
void
EVENT_MotionNotify
(
HWND
h
Wnd
,
XMotionEvent
*
event
);
static
void
EVENT_FocusIn
(
HWND
h
Wnd
,
XFocusChangeEvent
*
event
);
static
void
EVENT_FocusOut
(
HWND
h
Wnd
,
XFocusChangeEvent
*
event
);
static
void
EVENT_Expose
(
HWND
h
Wnd
,
XExposeEvent
*
event
);
static
void
EVENT_GraphicsExpose
(
HWND
h
Wnd
,
XGraphicsExposeEvent
*
event
);
static
void
EVENT_ConfigureNotify
(
HWND
h
Wnd
,
XConfigureEvent
*
event
);
static
void
EVENT_SelectionRequest
(
HWND
h
Wnd
,
XSelectionRequestEvent
*
event
);
static
void
EVENT_SelectionClear
(
HWND
h
Wnd
,
XSelectionClearEvent
*
event
);
static
void
EVENT_ClientMessage
(
HWND
h
Wnd
,
XClientMessageEvent
*
event
);
static
void
EVENT_MapNotify
(
HWND
pW
nd
,
XMapEvent
*
event
);
static
void
EVENT_UnmapNotify
(
HWND
pW
nd
,
XUnmapEvent
*
event
);
/* Usable only with OLVWM - compile option perhaps?
static void EVENT_EnterNotify(
WND *p
Wnd, XCrossingEvent *event );
static void EVENT_EnterNotify(
HWND h
Wnd, XCrossingEvent *event );
*/
static
void
EVENT_GetGeometry
(
Window
win
,
int
*
px
,
int
*
py
,
...
...
@@ -385,6 +385,7 @@ void X11DRV_EVENT_Synchronize()
static
void
EVENT_ProcessEvent
(
XEvent
*
event
)
{
WND
*
pWnd
;
HWND
hWnd
;
switch
(
event
->
type
)
{
...
...
@@ -419,28 +420,38 @@ static void EVENT_ProcessEvent( XEvent *event )
pWnd
=
NULL
;
/* Not for a registered window */
}
}
WIN_LockWndPtr
(
pWnd
);
if
(
!
pWnd
)
hWnd
=
0
;
else
hWnd
=
pWnd
->
hwndSelf
;
if
(
!
pWnd
&&
event
->
xany
.
window
!=
X11DRV_GetXRootWindow
()
)
ERR
(
event
,
"Got event %s for unknown Window %08lx
\n
"
,
event_names
[
event
->
type
],
event
->
xany
.
window
);
else
TRACE
(
event
,
"Got event %s for hwnd %04x
\n
"
,
event_names
[
event
->
type
],
pWnd
?
pWnd
->
hwndSelf
:
0
);
event_names
[
event
->
type
],
hWnd
);
WIN_ReleaseWndPtr
(
pWnd
);
switch
(
event
->
type
)
{
case
KeyPress
:
case
KeyRelease
:
EVENT_Key
(
p
Wnd
,
(
XKeyEvent
*
)
event
);
EVENT_Key
(
h
Wnd
,
(
XKeyEvent
*
)
event
);
break
;
case
ButtonPress
:
EVENT_ButtonPress
(
p
Wnd
,
(
XButtonEvent
*
)
event
);
EVENT_ButtonPress
(
h
Wnd
,
(
XButtonEvent
*
)
event
);
break
;
case
ButtonRelease
:
EVENT_ButtonRelease
(
p
Wnd
,
(
XButtonEvent
*
)
event
);
EVENT_ButtonRelease
(
h
Wnd
,
(
XButtonEvent
*
)
event
);
break
;
case
MotionNotify
:
...
...
@@ -454,50 +465,50 @@ static void EVENT_ProcessEvent( XEvent *event )
*/
while
(
TSXCheckTypedWindowEvent
(
display
,((
XAnyEvent
*
)
event
)
->
window
,
MotionNotify
,
event
));
EVENT_MotionNotify
(
p
Wnd
,
(
XMotionEvent
*
)
event
);
EVENT_MotionNotify
(
h
Wnd
,
(
XMotionEvent
*
)
event
);
break
;
case
FocusIn
:
if
(
!
p
Wnd
)
return
;
EVENT_FocusIn
(
p
Wnd
,
(
XFocusChangeEvent
*
)
event
);
if
(
!
h
Wnd
)
return
;
EVENT_FocusIn
(
h
Wnd
,
(
XFocusChangeEvent
*
)
event
);
break
;
case
FocusOut
:
if
(
!
p
Wnd
)
return
;
EVENT_FocusOut
(
p
Wnd
,
(
XFocusChangeEvent
*
)
event
);
if
(
!
h
Wnd
)
return
;
EVENT_FocusOut
(
h
Wnd
,
(
XFocusChangeEvent
*
)
event
);
break
;
case
Expose
:
EVENT_Expose
(
p
Wnd
,
(
XExposeEvent
*
)
event
);
EVENT_Expose
(
h
Wnd
,
(
XExposeEvent
*
)
event
);
break
;
case
GraphicsExpose
:
EVENT_GraphicsExpose
(
p
Wnd
,
(
XGraphicsExposeEvent
*
)
event
);
EVENT_GraphicsExpose
(
h
Wnd
,
(
XGraphicsExposeEvent
*
)
event
);
break
;
case
ConfigureNotify
:
if
(
!
p
Wnd
)
return
;
EVENT_ConfigureNotify
(
p
Wnd
,
(
XConfigureEvent
*
)
event
);
if
(
!
h
Wnd
)
return
;
EVENT_ConfigureNotify
(
h
Wnd
,
(
XConfigureEvent
*
)
event
);
break
;
case
SelectionRequest
:
if
(
!
p
Wnd
)
return
;
EVENT_SelectionRequest
(
p
Wnd
,
(
XSelectionRequestEvent
*
)
event
);
if
(
!
h
Wnd
)
return
;
EVENT_SelectionRequest
(
h
Wnd
,
(
XSelectionRequestEvent
*
)
event
);
break
;
case
SelectionClear
:
if
(
!
p
Wnd
)
return
;
EVENT_SelectionClear
(
p
Wnd
,
(
XSelectionClearEvent
*
)
event
);
if
(
!
h
Wnd
)
return
;
EVENT_SelectionClear
(
h
Wnd
,
(
XSelectionClearEvent
*
)
event
);
break
;
case
ClientMessage
:
if
(
!
p
Wnd
)
return
;
EVENT_ClientMessage
(
p
Wnd
,
(
XClientMessageEvent
*
)
event
);
if
(
!
h
Wnd
)
return
;
EVENT_ClientMessage
(
h
Wnd
,
(
XClientMessageEvent
*
)
event
);
break
;
#if 0
case EnterNotify:
EVENT_EnterNotify(
p
Wnd, (XCrossingEvent *) event );
EVENT_EnterNotify(
h
Wnd, (XCrossingEvent *) event );
break;
#endif
...
...
@@ -505,21 +516,20 @@ static void EVENT_ProcessEvent( XEvent *event )
break
;
case
MapNotify
:
if
(
!
p
Wnd
)
return
;
EVENT_MapNotify
(
p
Wnd
,
(
XMapEvent
*
)
event
);
if
(
!
h
Wnd
)
return
;
EVENT_MapNotify
(
h
Wnd
,
(
XMapEvent
*
)
event
);
break
;
case
UnmapNotify
:
if
(
!
p
Wnd
)
return
;
EVENT_UnmapNotify
(
p
Wnd
,
(
XUnmapEvent
*
)
event
);
if
(
!
h
Wnd
)
return
;
EVENT_UnmapNotify
(
h
Wnd
,
(
XUnmapEvent
*
)
event
);
break
;
default:
WARN
(
event
,
"Unprocessed event %s for hwnd %04x
\n
"
,
event_names
[
event
->
type
],
pWnd
?
pWnd
->
hwndSelf
:
0
);
event_names
[
event
->
type
],
hWnd
);
break
;
}
WIN_ReleaseWndPtr
(
pWnd
);
}
/***********************************************************************
...
...
@@ -587,10 +597,11 @@ static unsigned __td_lookup( Window w, Window* list, unsigned max )
return
i
;
}
static
BOOL
EVENT_QueryZOrder
(
WND
*
pWndCheck
)
static
BOOL
EVENT_QueryZOrder
(
HWND
hWndCheck
)
{
BOOL
bRet
=
FALSE
;
HWND
hwndInsertAfter
=
HWND_TOP
;
WND
*
pWndCheck
=
WIN_FindWndPtr
(
hWndCheck
);
WND
*
pDesktop
=
WIN_GetDesktop
();
WND
*
pWnd
,
*
pWndZ
=
WIN_LockWndPtr
(
pDesktop
->
child
);
Window
w
,
parent
,
*
children
=
NULL
;
...
...
@@ -598,6 +609,7 @@ static BOOL EVENT_QueryZOrder( WND* pWndCheck )
if
(
!
__check_query_condition
(
&
pWndZ
,
&
pWnd
)
)
{
WIN_ReleaseWndPtr
(
pWndCheck
);
WIN_ReleaseWndPtr
(
pDesktop
->
child
);
WIN_ReleaseDesktop
();
return
TRUE
;
...
...
@@ -650,10 +662,10 @@ static BOOL EVENT_QueryZOrder( WND* pWndCheck )
if
(
children
)
TSXFree
(
children
);
WIN_ReleaseWndPtr
(
pWnd
);
WIN_ReleaseWndPtr
(
pWndZ
);
WIN_ReleaseWndPtr
(
pWndCheck
);
return
bRet
;
}
/***********************************************************************
* EVENT_XStateToKeyState
*
...
...
@@ -698,17 +710,19 @@ BOOL X11DRV_EVENT_QueryPointer(DWORD *posX, DWORD *posY, DWORD *state)
/***********************************************************************
* EVENT_Expose
*/
static
void
EVENT_Expose
(
WND
*
p
Wnd
,
XExposeEvent
*
event
)
static
void
EVENT_Expose
(
HWND
h
Wnd
,
XExposeEvent
*
event
)
{
RECT
rect
;
WND
*
pWnd
=
WIN_FindWndPtr
(
hWnd
);
/* Make position relative to client area instead of window */
rect
.
left
=
event
->
x
-
(
pWnd
?
(
pWnd
->
rectClient
.
left
-
pWnd
->
rectWindow
.
left
)
:
0
);
rect
.
top
=
event
->
y
-
(
pWnd
?
(
pWnd
->
rectClient
.
top
-
pWnd
->
rectWindow
.
top
)
:
0
);
rect
.
right
=
rect
.
left
+
event
->
width
;
rect
.
bottom
=
rect
.
top
+
event
->
height
;
WIN_ReleaseWndPtr
(
pWnd
);
Callout
.
RedrawWindow
(
pWnd
?
pWnd
->
hwndSelf
:
0
,
&
rect
,
0
,
Callout
.
RedrawWindow
(
hWnd
,
&
rect
,
0
,
RDW_INVALIDATE
|
RDW_FRAME
|
RDW_ALLCHILDREN
|
RDW_ERASE
|
(
event
->
count
?
0
:
RDW_ERASENOW
)
);
}
...
...
@@ -720,9 +734,10 @@ static void EVENT_Expose( WND *pWnd, XExposeEvent *event )
* This is needed when scrolling area is partially obscured
* by non-Wine X window.
*/
static
void
EVENT_GraphicsExpose
(
WND
*
p
Wnd
,
XGraphicsExposeEvent
*
event
)
static
void
EVENT_GraphicsExpose
(
HWND
h
Wnd
,
XGraphicsExposeEvent
*
event
)
{
RECT
rect
;
WND
*
pWnd
=
WIN_FindWndPtr
(
hWnd
);
/* Make position relative to client area instead of window */
rect
.
left
=
event
->
x
-
(
pWnd
?
(
pWnd
->
rectClient
.
left
-
pWnd
->
rectWindow
.
left
)
:
0
);
...
...
@@ -730,7 +745,9 @@ static void EVENT_GraphicsExpose( WND *pWnd, XGraphicsExposeEvent *event )
rect
.
right
=
rect
.
left
+
event
->
width
;
rect
.
bottom
=
rect
.
top
+
event
->
height
;
Callout
.
RedrawWindow
(
pWnd
?
pWnd
->
hwndSelf
:
0
,
&
rect
,
0
,
WIN_ReleaseWndPtr
(
pWnd
);
Callout
.
RedrawWindow
(
hWnd
,
&
rect
,
0
,
RDW_INVALIDATE
|
RDW_ALLCHILDREN
|
RDW_ERASE
|
(
event
->
count
?
0
:
RDW_ERASENOW
)
);
}
...
...
@@ -741,25 +758,30 @@ static void EVENT_GraphicsExpose( WND *pWnd, XGraphicsExposeEvent *event )
*
* Handle a X key event
*/
static
void
EVENT_Key
(
WND
*
p
Wnd
,
XKeyEvent
*
event
)
static
void
EVENT_Key
(
HWND
h
Wnd
,
XKeyEvent
*
event
)
{
WND
*
pWnd
=
WIN_FindWndPtr
(
hWnd
);
X11DRV_KEYBOARD_HandleEvent
(
pWnd
,
event
);
WIN_ReleaseWndPtr
(
pWnd
);
}
/***********************************************************************
* EVENT_MotionNotify
*/
static
void
EVENT_MotionNotify
(
WND
*
p
Wnd
,
XMotionEvent
*
event
)
static
void
EVENT_MotionNotify
(
HWND
h
Wnd
,
XMotionEvent
*
event
)
{
WND
*
pWnd
=
WIN_FindWndPtr
(
hWnd
);
int
xOffset
=
pWnd
?
pWnd
->
rectWindow
.
left
:
0
;
int
yOffset
=
pWnd
?
pWnd
->
rectWindow
.
top
:
0
;
WIN_ReleaseWndPtr
(
pWnd
);
MOUSE_SendEvent
(
MOUSEEVENTF_MOVE
,
xOffset
+
event
->
x
,
yOffset
+
event
->
y
,
EVENT_XStateToKeyState
(
event
->
state
),
event
->
time
-
MSG_WineStartTicks
,
pWnd
?
pWnd
->
hwndSelf
:
0
);
hWnd
);
}
...
...
@@ -783,16 +805,19 @@ void X11DRV_EVENT_DummyMotionNotify(void)
/***********************************************************************
* EVENT_ButtonPress
*/
static
void
EVENT_ButtonPress
(
WND
*
p
Wnd
,
XButtonEvent
*
event
)
static
void
EVENT_ButtonPress
(
HWND
h
Wnd
,
XButtonEvent
*
event
)
{
static
WORD
statusCodes
[
NB_BUTTONS
]
=
{
MOUSEEVENTF_LEFTDOWN
,
MOUSEEVENTF_MIDDLEDOWN
,
MOUSEEVENTF_RIGHTDOWN
};
int
buttonNum
=
event
->
button
-
1
;
WND
*
pWnd
=
WIN_FindWndPtr
(
hWnd
);
int
xOffset
=
pWnd
?
pWnd
->
rectWindow
.
left
:
0
;
int
yOffset
=
pWnd
?
pWnd
->
rectWindow
.
top
:
0
;
WORD
keystate
;
WIN_ReleaseWndPtr
(
pWnd
);
if
(
buttonNum
>=
NB_BUTTONS
)
return
;
/*
...
...
@@ -821,23 +846,25 @@ static void EVENT_ButtonPress( WND *pWnd, XButtonEvent *event )
xOffset
+
event
->
x
,
yOffset
+
event
->
y
,
keystate
,
event
->
time
-
MSG_WineStartTicks
,
pWnd
?
pWnd
->
hwndSelf
:
0
);
hWnd
);
}
/***********************************************************************
* EVENT_ButtonRelease
*/
static
void
EVENT_ButtonRelease
(
WND
*
p
Wnd
,
XButtonEvent
*
event
)
static
void
EVENT_ButtonRelease
(
HWND
h
Wnd
,
XButtonEvent
*
event
)
{
static
WORD
statusCodes
[
NB_BUTTONS
]
=
{
MOUSEEVENTF_LEFTUP
,
MOUSEEVENTF_MIDDLEUP
,
MOUSEEVENTF_RIGHTUP
};
int
buttonNum
=
event
->
button
-
1
;
WND
*
pWnd
=
WIN_FindWndPtr
(
hWnd
);
int
xOffset
=
pWnd
?
pWnd
->
rectWindow
.
left
:
0
;
int
yOffset
=
pWnd
?
pWnd
->
rectWindow
.
top
:
0
;
WORD
keystate
;
WIN_ReleaseWndPtr
(
pWnd
);
if
(
buttonNum
>=
NB_BUTTONS
)
return
;
/*
...
...
@@ -866,28 +893,26 @@ static void EVENT_ButtonRelease( WND *pWnd, XButtonEvent *event )
xOffset
+
event
->
x
,
yOffset
+
event
->
y
,
keystate
,
event
->
time
-
MSG_WineStartTicks
,
pWnd
?
pWnd
->
hwndSelf
:
0
);
hWnd
);
}
/**********************************************************************
* EVENT_FocusIn
*/
static
void
EVENT_FocusIn
(
WND
*
p
Wnd
,
XFocusChangeEvent
*
event
)
static
void
EVENT_FocusIn
(
HWND
h
Wnd
,
XFocusChangeEvent
*
event
)
{
if
(
Options
.
managed
)
EVENT_QueryZOrder
(
p
Wnd
);
if
(
Options
.
managed
)
EVENT_QueryZOrder
(
h
Wnd
);
if
(
event
->
detail
!=
NotifyPointer
)
{
HWND
hwnd
=
pWnd
->
hwndSelf
;
if
(
hwnd
!=
GetActiveWindow
())
if
(
hWnd
!=
GetActiveWindow
())
{
WINPOS_ChangeActiveWindow
(
h
w
nd
,
FALSE
);
WINPOS_ChangeActiveWindow
(
h
W
nd
,
FALSE
);
X11DRV_KEYBOARD_UpdateState
();
}
if
((
h
wnd
!=
GetFocus
())
&&
!
IsChild
(
hw
nd
,
GetFocus
()))
SetFocus
(
h
w
nd
);
if
((
h
Wnd
!=
GetFocus
())
&&
!
IsChild
(
hW
nd
,
GetFocus
()))
SetFocus
(
h
W
nd
);
}
}
...
...
@@ -897,18 +922,16 @@ static void EVENT_FocusIn( WND *pWnd, XFocusChangeEvent *event )
*
* Note: only top-level override-redirect windows get FocusOut events.
*/
static
void
EVENT_FocusOut
(
WND
*
p
Wnd
,
XFocusChangeEvent
*
event
)
static
void
EVENT_FocusOut
(
HWND
h
Wnd
,
XFocusChangeEvent
*
event
)
{
if
(
event
->
detail
!=
NotifyPointer
)
{
HWND
hwnd
=
pWnd
->
hwndSelf
;
if
(
hwnd
==
GetActiveWindow
())
if
(
hWnd
==
GetActiveWindow
())
{
SendMessageA
(
h
w
nd
,
WM_CANCELMODE
,
0
,
0
);
SendMessageA
(
h
W
nd
,
WM_CANCELMODE
,
0
,
0
);
WINPOS_ChangeActiveWindow
(
0
,
FALSE
);
}
if
((
h
wnd
==
GetFocus
())
||
IsChild
(
hw
nd
,
GetFocus
()))
if
((
h
Wnd
==
GetFocus
())
||
IsChild
(
hW
nd
,
GetFocus
()))
SetFocus
(
0
);
}
}
...
...
@@ -971,7 +994,7 @@ static void EVENT_GetGeometry( Window win, int *px, int *py,
* The ConfigureNotify event is only selected on top-level windows
* when the -managed flag is used.
*/
static
void
EVENT_ConfigureNotify
(
WND
*
p
Wnd
,
XConfigureEvent
*
event
)
static
void
EVENT_ConfigureNotify
(
HWND
h
Wnd
,
XConfigureEvent
*
event
)
{
WINDOWPOS
winpos
;
RECT
newWindowRect
,
newClientRect
;
...
...
@@ -980,6 +1003,7 @@ static void EVENT_ConfigureNotify( WND *pWnd, XConfigureEvent *event )
int
x
,
y
;
unsigned
int
width
,
height
;
WND
*
pWnd
=
WIN_FindWndPtr
(
hWnd
);
assert
(
pWnd
->
flags
&
WIN_MANAGED
);
/* We don't rely on the event geometry info, because it is relative
...
...
@@ -993,7 +1017,7 @@ TRACE(win, "%04x adjusted to (%i,%i)-(%i,%i)\n", pWnd->hwndSelf,
/* Fill WINDOWPOS struct */
winpos
.
flags
=
SWP_NOACTIVATE
|
SWP_NOZORDER
;
winpos
.
hwnd
=
pWnd
->
hwndSelf
;
winpos
.
hwnd
=
hWnd
;
winpos
.
x
=
x
;
winpos
.
y
=
y
;
winpos
.
cx
=
width
;
...
...
@@ -1015,7 +1039,11 @@ TRACE(win, "%04x adjusted to (%i,%i)-(%i,%i)\n", pWnd->hwndSelf,
/* Send WM_WINDOWPOSCHANGING */
SendMessageA
(
winpos
.
hwnd
,
WM_WINDOWPOSCHANGING
,
0
,
(
LPARAM
)
&
winpos
);
if
(
!
IsWindow
(
winpos
.
hwnd
))
return
;
if
(
!
IsWindow
(
winpos
.
hwnd
))
{
WIN_ReleaseWndPtr
(
pWnd
);
return
;
}
/* Calculate new position and size */
newWindowRect
.
left
=
x
;
...
...
@@ -1027,7 +1055,11 @@ TRACE(win, "%04x adjusted to (%i,%i)-(%i,%i)\n", pWnd->hwndSelf,
&
pWnd
->
rectWindow
,
&
pWnd
->
rectClient
,
&
winpos
,
&
newClientRect
);
if
(
!
IsWindow
(
winpos
.
hwnd
))
return
;
if
(
!
IsWindow
(
winpos
.
hwnd
))
{
WIN_ReleaseWndPtr
(
pWnd
);
return
;
}
oldWindowRect
=
pWnd
->
rectWindow
;
oldClientRect
=
pWnd
->
rectClient
;
...
...
@@ -1043,6 +1075,8 @@ TRACE(win, "%04x adjusted to (%i,%i)-(%i,%i)\n", pWnd->hwndSelf,
RedrawWindow
(
winpos
.
hwnd
,
NULL
,
0
,
RDW_FRAME
|
RDW_ALLCHILDREN
|
RDW_INVALIDATE
|
RDW_ERASE
|
RDW_ERASENOW
);
WIN_ReleaseWndPtr
(
pWnd
);
SendMessageA
(
winpos
.
hwnd
,
WM_WINDOWPOSCHANGED
,
0
,
(
LPARAM
)
&
winpos
);
if
(
!
IsWindow
(
winpos
.
hwnd
))
return
;
...
...
@@ -1051,14 +1085,14 @@ TRACE(win, "%04x adjusted to (%i,%i)-(%i,%i)\n", pWnd->hwndSelf,
WIN_UnlinkWindow
(
winpos
.
hwnd
);
WIN_LinkWindow
(
winpos
.
hwnd
,
HWND_BOTTOM
);
}
else
EVENT_QueryZOrder
(
p
Wnd
);
/* try to outsmart window manager */
else
EVENT_QueryZOrder
(
h
Wnd
);
/* try to outsmart window manager */
}
/***********************************************************************
* EVENT_SelectionRequest
*/
static
void
EVENT_SelectionRequest
(
WND
*
p
Wnd
,
XSelectionRequestEvent
*
event
)
static
void
EVENT_SelectionRequest
(
HWND
h
Wnd
,
XSelectionRequestEvent
*
event
)
{
XSelectionEvent
result
;
Atom
rprop
=
None
;
...
...
@@ -1084,7 +1118,7 @@ static void EVENT_SelectionRequest( WND *pWnd, XSelectionRequestEvent *event )
{
/* open to make sure that clipboard is available */
BOOL
couldOpen
=
OpenClipboard
(
pWnd
->
hwndSelf
);
BOOL
couldOpen
=
OpenClipboard
(
hWnd
);
char
*
lpstr
=
0
;
hText
=
GetClipboardData16
(
CF_TEXT
);
...
...
@@ -1131,10 +1165,10 @@ static void EVENT_SelectionRequest( WND *pWnd, XSelectionRequestEvent *event )
/***********************************************************************
* EVENT_SelectionClear
*/
static
void
EVENT_SelectionClear
(
WND
*
p
Wnd
,
XSelectionClearEvent
*
event
)
static
void
EVENT_SelectionClear
(
HWND
h
Wnd
,
XSelectionClearEvent
*
event
)
{
if
(
event
->
selection
!=
XA_PRIMARY
)
return
;
X11DRV_CLIPBOARD_ReleaseSelection
(
event
->
window
,
pWnd
->
hwndSelf
);
X11DRV_CLIPBOARD_ReleaseSelection
(
event
->
window
,
hWnd
);
}
...
...
@@ -1143,7 +1177,7 @@ static void EVENT_SelectionClear( WND *pWnd, XSelectionClearEvent *event )
*
* don't know if it still works (last Changlog is from 96/11/04)
*/
static
void
EVENT_DropFromOffiX
(
WND
*
p
Wnd
,
XClientMessageEvent
*
event
)
static
void
EVENT_DropFromOffiX
(
HWND
h
Wnd
,
XClientMessageEvent
*
event
)
{
unsigned
long
data_length
;
unsigned
long
aux_long
;
...
...
@@ -1163,14 +1197,17 @@ static void EVENT_DropFromOffiX( WND *pWnd, XClientMessageEvent *event )
SEGPTR
spDragInfo
=
(
SEGPTR
)
WIN16_GlobalLock16
(
hDragInfo
);
Window
w_aux_root
,
w_aux_child
;
WND
*
pDropWnd
;
WND
*
pWnd
;
if
(
!
lpDragInfo
||
!
spDragInfo
)
return
;
pWnd
=
WIN_FindWndPtr
(
hWnd
);
TSXQueryPointer
(
display
,
X11DRV_WND_GetXWindow
(
pWnd
),
&
w_aux_root
,
&
w_aux_child
,
&
x
,
&
y
,
(
int
*
)
&
u
.
pt_aux
.
x
,
(
int
*
)
&
u
.
pt_aux
.
y
,
(
unsigned
int
*
)
&
aux_long
);
lpDragInfo
->
hScope
=
pWnd
->
hwndSelf
;
lpDragInfo
->
hScope
=
hWnd
;
lpDragInfo
->
pt
.
x
=
(
INT16
)
x
;
lpDragInfo
->
pt
.
y
=
(
INT16
)
y
;
/* find out drop point and drop window */
...
...
@@ -1180,10 +1217,12 @@ static void EVENT_DropFromOffiX( WND *pWnd, XClientMessageEvent *event )
{
bAccept
=
pWnd
->
dwExStyle
&
WS_EX_ACCEPTFILES
;
x
=
y
=
0
;
}
else
{
bAccept
=
DRAG_QueryUpdate
(
pWnd
->
hwndSelf
,
spDragInfo
,
TRUE
);
bAccept
=
DRAG_QueryUpdate
(
hWnd
,
spDragInfo
,
TRUE
);
x
=
lpDragInfo
->
pt
.
x
;
y
=
lpDragInfo
->
pt
.
y
;
}
pDropWnd
=
WIN_FindWndPtr
(
lpDragInfo
->
hScope
);
WIN_ReleaseWndPtr
(
pWnd
);
GlobalFree16
(
hDragInfo
);
if
(
bAccept
)
...
...
@@ -1244,7 +1283,7 @@ static void EVENT_DropFromOffiX( WND *pWnd, XClientMessageEvent *event )
p
+=
strlen
(
p
)
+
1
;
}
*
p_drop
=
'\0'
;
PostMessage16
(
pWnd
->
hwndSelf
,
WM_DROPFILES
,
PostMessage16
(
hWnd
,
WM_DROPFILES
,
(
WPARAM16
)
hDrop
,
0L
);
}
}
...
...
@@ -1264,9 +1303,10 @@ static void EVENT_DropFromOffiX( WND *pWnd, XClientMessageEvent *event )
*
* event->data.l[3], event->data.l[4] contains drop x,y position
*/
static
void
EVENT_DropURLs
(
WND
*
p
Wnd
,
XClientMessageEvent
*
event
)
static
void
EVENT_DropURLs
(
HWND
h
Wnd
,
XClientMessageEvent
*
event
)
{
WND
*
pDropWnd
;
WND
*
pWnd
;
unsigned
long
data_length
;
unsigned
long
aux_long
,
drop_len
=
0
;
unsigned
char
*
p_data
=
NULL
;
/* property data */
...
...
@@ -1283,10 +1323,15 @@ static void EVENT_DropURLs( WND *pWnd, XClientMessageEvent *event )
HDROP
h32
;
}
hDrop
;
pWnd
=
WIN_FindWndPtr
(
hWnd
);
drop32
=
pWnd
->
flags
&
WIN_ISWIN32
;
if
(
!
(
pWnd
->
dwExStyle
&
WS_EX_ACCEPTFILES
))
{
WIN_ReleaseWndPtr
(
pWnd
);
return
;
}
WIN_ReleaseWndPtr
(
pWnd
);
TSXGetWindowProperty
(
display
,
DefaultRootWindow
(
display
),
dndSelection
,
0
,
65535
,
FALSE
,
...
...
@@ -1318,7 +1363,8 @@ static void EVENT_DropURLs( WND *pWnd, XClientMessageEvent *event )
if
(
drop_len
&&
drop_len
<
65535
)
{
TSXQueryPointer
(
display
,
X11DRV_GetXRootWindow
(),
&
u
.
w_aux
,
&
u
.
w_aux
,
&
x
,
&
y
,
&
u
.
i
,
&
u
.
i
,
&
u
.
i
);
pDropWnd
=
WIN_FindWndPtr
(
pWnd
->
hwndSelf
);
pDropWnd
=
WIN_FindWndPtr
(
hWnd
);
if
(
drop32
)
{
LPDROPFILESTRUCT
lpDrop
;
...
...
@@ -1389,11 +1435,11 @@ static void EVENT_DropURLs( WND *pWnd, XClientMessageEvent *event )
* PostMessage16 and WPARAM32 would be truncated to WPARAM16
*/
GlobalUnlock
(
hDrop
.
h32
);
SendMessageA
(
pWnd
->
hwndSelf
,
WM_DROPFILES
,
SendMessageA
(
hWnd
,
WM_DROPFILES
,
(
WPARAM
)
hDrop
.
h32
,
0L
);
}
else
{
GlobalUnlock16
(
hDrop
.
h16
);
PostMessage16
(
pWnd
->
hwndSelf
,
WM_DROPFILES
,
PostMessage16
(
hWnd
,
WM_DROPFILES
,
(
WPARAM16
)
hDrop
.
h16
,
0L
);
}
}
...
...
@@ -1406,18 +1452,18 @@ static void EVENT_DropURLs( WND *pWnd, XClientMessageEvent *event )
/**********************************************************************
* EVENT_ClientMessage
*/
static
void
EVENT_ClientMessage
(
WND
*
p
Wnd
,
XClientMessageEvent
*
event
)
static
void
EVENT_ClientMessage
(
HWND
h
Wnd
,
XClientMessageEvent
*
event
)
{
if
(
event
->
message_type
!=
None
&&
event
->
format
==
32
)
{
if
((
event
->
message_type
==
wmProtocols
)
&&
(((
Atom
)
event
->
data
.
l
[
0
])
==
wmDeleteWindow
))
SendMessage16
(
pWnd
->
hwndSelf
,
WM_SYSCOMMAND
,
SC_CLOSE
,
0
);
SendMessage16
(
hWnd
,
WM_SYSCOMMAND
,
SC_CLOSE
,
0
);
else
if
(
event
->
message_type
==
dndProtocol
&&
(
event
->
data
.
l
[
0
]
==
DndFile
||
event
->
data
.
l
[
0
]
==
DndFiles
)
)
EVENT_DropFromOffiX
(
p
Wnd
,
event
);
EVENT_DropFromOffiX
(
h
Wnd
,
event
);
else
if
(
event
->
message_type
==
dndProtocol
&&
event
->
data
.
l
[
0
]
==
DndURL
)
EVENT_DropURLs
(
p
Wnd
,
event
);
EVENT_DropURLs
(
h
Wnd
,
event
);
else
{
#if 0
/* enable this if you want to see the message */
...
...
@@ -1448,7 +1494,7 @@ static void EVENT_ClientMessage( WND *pWnd, XClientMessageEvent *event )
* self-managed mode with private colormap
*/
#if 0
void EVENT_EnterNotify(
WND *p
Wnd, XCrossingEvent *event )
void EVENT_EnterNotify(
HWND h
Wnd, XCrossingEvent *event )
{
if( !Options.managed && X11DRV_GetXRootWindow() == DefaultRootWindow(display) &&
(COLOR_GetSystemPaletteFlags() & COLOR_PRIVATE) && GetFocus() )
...
...
@@ -1459,15 +1505,16 @@ void EVENT_EnterNotify( WND *pWnd, XCrossingEvent *event )
/**********************************************************************
* EVENT_MapNotify
*/
void
EVENT_MapNotify
(
WND
*
w
nd
,
XMapEvent
*
event
)
void
EVENT_MapNotify
(
HWND
hW
nd
,
XMapEvent
*
event
)
{
HWND
hwndFocus
=
GetFocus
();
WND
*
wndFocus
=
WIN_FindWndPtr
(
hwndFocus
);
WND
*
pWnd
=
WIN_FindWndPtr
(
hWnd
);
if
(
pWnd
->
flags
&
WIN_MANAGED
)
pWnd
->
dwStyle
&=
~
WS_MINIMIZE
;
WIN_ReleaseWndPtr
(
pWnd
);
if
(
wnd
->
flags
&
WIN_MANAGED
)
wnd
->
dwStyle
&=
~
WS_MINIMIZE
;
if
(
hwndFocus
&&
IsChild
(
wnd
->
hwndSelf
,
hwndFocus
))
if
(
hwndFocus
&&
IsChild
(
hWnd
,
hwndFocus
))
X11DRV_WND_SetFocus
(
wndFocus
);
WIN_ReleaseWndPtr
(
wndFocus
);
...
...
@@ -1479,13 +1526,15 @@ void EVENT_MapNotify( WND* wnd, XMapEvent *event )
/**********************************************************************
* EVENT_MapNotify
*/
void
EVENT_UnmapNotify
(
WND
*
w
nd
,
XUnmapEvent
*
event
)
void
EVENT_UnmapNotify
(
HWND
hW
nd
,
XUnmapEvent
*
event
)
{
if
(
wnd
->
flags
&
WIN_MANAGED
)
WND
*
pWnd
=
WIN_FindWndPtr
(
hWnd
);
if
(
pWnd
->
flags
&
WIN_MANAGED
)
{
EndMenu
();
w
nd
->
dwStyle
|=
WS_MINIMIZE
;
pW
nd
->
dwStyle
|=
WS_MINIMIZE
;
}
WIN_ReleaseWndPtr
(
pWnd
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment