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
b38e1dec
Commit
b38e1dec
authored
Jun 12, 1999
by
Ulrich Weigand
Committed by
Alexandre Julliard
Jun 12, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better implementation of [GS]etForegroundWindow.
Fixed focus handling on inter-thread activation. Adapted FocusIn/Out event handling to per-queue focus.
parent
85bcb2e1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
30 deletions
+46
-30
winpos.c
windows/winpos.c
+38
-12
event.c
windows/x11drv/event.c
+8
-18
No files found.
windows/winpos.c
View file @
b38e1dec
...
...
@@ -899,17 +899,27 @@ BOOL16 WINAPI SetForegroundWindow16( HWND16 hwnd )
*/
HWND
WINAPI
GetForegroundWindow
(
void
)
{
return
GetActiveWindow
();
}
HWND
hwndActive
=
0
;
/* Get the foreground window (active window of hActiveQueue) */
if
(
hActiveQueue
)
{
MESSAGEQUEUE
*
pActiveQueue
=
QUEUE_Lock
(
hActiveQueue
);
if
(
pActiveQueue
)
hwndActive
=
PERQDATA_GetActiveWnd
(
pActiveQueue
->
pQData
);
QUEUE_Unlock
(
pActiveQueue
);
}
return
hwndActive
;
}
/*******************************************************************
* SetForegroundWindow (USER32.482)
*/
BOOL
WINAPI
SetForegroundWindow
(
HWND
hwnd
)
{
SetActiveWindow
(
hwnd
);
return
TRUE
;
return
WINPOS_ChangeActiveWindow
(
hwnd
,
FALSE
);
}
...
...
@@ -1643,6 +1653,8 @@ BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus)
HWND
hwndActive
=
0
;
BOOL
bRet
=
0
;
TRACE
(
win
,
"(%04x, %d, %d)
\n
"
,
hWnd
,
fMouse
,
fChangeFocus
);
/* Get current active window from the active queue */
if
(
hActiveQueue
)
{
...
...
@@ -1784,7 +1796,7 @@ BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus)
}
WIN_ReleaseDesktop
();
if
(
!
IsWindow
(
hWnd
))
goto
CLEANUP
;
if
(
hWnd
&&
!
IsWindow
(
hWnd
))
goto
CLEANUP
;
}
if
(
hWnd
)
...
...
@@ -1808,13 +1820,27 @@ BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus)
}
/* change focus if possible */
if
(
fChangeFocus
&&
GetFocus
()
)
if
(
WIN_GetTopParent
(
GetFocus
())
!=
hwndActive
)
FOCUS_SwitchFocus
(
pNewActiveQueue
,
GetFocus
(),
(
wndPtr
&&
(
wndPtr
->
dwStyle
&
WS_MINIMIZE
))
?
0
:
hwndActive
);
if
(
fChangeFocus
)
{
if
(
pNewActiveQueue
)
{
HWND
hOldFocus
=
PERQDATA_GetFocusWnd
(
pNewActiveQueue
->
pQData
);
if
(
WIN_GetTopParent
(
hOldFocus
)
!=
hwndActive
)
FOCUS_SwitchFocus
(
pNewActiveQueue
,
hOldFocus
,
(
wndPtr
&&
(
wndPtr
->
dwStyle
&
WS_MINIMIZE
))
?
0
:
hwndActive
);
}
if
(
pOldActiveQueue
&&
(
!
pNewActiveQueue
||
pNewActiveQueue
->
pQData
!=
pOldActiveQueue
->
pQData
)
)
{
HWND
hOldFocus
=
PERQDATA_GetFocusWnd
(
pOldActiveQueue
->
pQData
);
if
(
hOldFocus
)
FOCUS_SwitchFocus
(
pOldActiveQueue
,
hOldFocus
,
0
);
}
}
if
(
!
hwndPrevActive
&&
wndPtr
)
(
*
wndPtr
->
pDriver
->
pForceWindowRaise
)(
wndPtr
);
...
...
windows/x11drv/event.c
View file @
b38e1dec
...
...
@@ -660,18 +660,12 @@ static void EVENT_ButtonRelease( HWND hWnd, XButtonEvent *event )
*/
static
void
EVENT_FocusIn
(
HWND
hWnd
,
XFocusChangeEvent
*
event
)
{
if
(
Options
.
managed
)
EVENT_QueryZOrder
(
hWnd
);
if
(
event
->
detail
!=
NotifyPointer
)
{
if
(
hWnd
!=
GetActiveWindow
())
if
(
event
->
detail
!=
NotifyPointer
)
if
(
hWnd
!=
GetForegroundWindow
())
{
WINPOS_ChangeActiveWindow
(
hWnd
,
FALSE
);
X11DRV_KEYBOARD_UpdateState
();
SetForegroundWindow
(
hWnd
);
X11DRV_KEYBOARD_UpdateState
();
}
if
((
hWnd
!=
GetFocus
())
&&
!
IsChild
(
hWnd
,
GetFocus
()))
SetFocus
(
hWnd
);
}
}
...
...
@@ -683,15 +677,11 @@ static void EVENT_FocusIn( HWND hWnd, XFocusChangeEvent *event )
static
void
EVENT_FocusOut
(
HWND
hWnd
,
XFocusChangeEvent
*
event
)
{
if
(
event
->
detail
!=
NotifyPointer
)
{
if
(
hWnd
==
GetActiveWindow
())
if
(
hWnd
==
GetForegroundWindow
())
{
SendMessageA
(
hWnd
,
WM_CANCELMODE
,
0
,
0
);
WINPOS_ChangeActiveWindow
(
0
,
FALSE
);
SetForegroundWindow
(
0
);
}
if
((
hWnd
==
GetFocus
())
||
IsChild
(
hWnd
,
GetFocus
()))
SetFocus
(
0
);
}
}
/**********************************************************************
...
...
@@ -699,13 +689,13 @@ static void EVENT_FocusOut( HWND hWnd, XFocusChangeEvent *event )
*/
BOOL
X11DRV_EVENT_CheckFocus
(
void
)
{
WND
*
p
Wnd
;
HWND
h
Wnd
;
Window
xW
;
int
state
;
TSXGetInputFocus
(
display
,
&
xW
,
&
state
);
if
(
xW
==
None
||
TSXFindContext
(
display
,
xW
,
winContext
,
(
char
**
)
&
p
Wnd
)
)
TSXFindContext
(
display
,
xW
,
winContext
,
(
char
**
)
&
h
Wnd
)
)
return
FALSE
;
return
TRUE
;
}
...
...
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