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
c84fd858
Commit
c84fd858
authored
Feb 26, 2015
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
imm32: Simplify the helper functions to retrieve the thread data.
parent
29ce21e2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
34 deletions
+16
-34
imm.c
dlls/imm32/imm.c
+16
-34
No files found.
dlls/imm32/imm.c
View file @
c84fd858
...
@@ -225,43 +225,29 @@ static DWORD convert_candidatelist_AtoW(
...
@@ -225,43 +225,29 @@ static DWORD convert_candidatelist_AtoW(
return
ret
;
return
ret
;
}
}
static
IMMThreadData
*
IMM_GetThreadData
(
DWORD
i
d
)
static
IMMThreadData
*
IMM_GetThreadData
(
HWND
hwn
d
)
{
{
IMMThreadData
*
data
;
IMMThreadData
*
data
;
DWORD
process
,
thread
;
if
(
!
id
)
id
=
GetCurrentThreadId
();
if
(
hwnd
)
{
if
(
!
(
thread
=
GetWindowThreadProcessId
(
hwnd
,
&
process
)))
return
NULL
;
if
(
process
!=
GetCurrentProcessId
())
return
NULL
;
}
else
thread
=
GetCurrentThreadId
();
EnterCriticalSection
(
&
threaddata_cs
);
EnterCriticalSection
(
&
threaddata_cs
);
LIST_FOR_EACH_ENTRY
(
data
,
&
ImmThreadDataList
,
IMMThreadData
,
entry
)
LIST_FOR_EACH_ENTRY
(
data
,
&
ImmThreadDataList
,
IMMThreadData
,
entry
)
{
if
(
data
->
threadID
==
thread
)
return
data
;
if
(
data
->
threadID
==
id
)
return
data
;
}
data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
data
));
sizeof
(
IMMThreadData
));
data
->
threadID
=
thread
;
data
->
threadID
=
id
;
list_add_head
(
&
ImmThreadDataList
,
&
data
->
entry
);
list_add_head
(
&
ImmThreadDataList
,
&
data
->
entry
);
TRACE
(
"Thread Data Created (%x)
\n
"
,
id
);
TRACE
(
"Thread Data Created (%x)
\n
"
,
thread
);
return
data
;
return
data
;
}
}
static
IMMThreadData
*
IMM_GetThreadDataForWindow
(
HWND
hwnd
)
{
DWORD
process
;
DWORD
thread
=
0
;
if
(
hwnd
)
{
thread
=
GetWindowThreadProcessId
(
hwnd
,
&
process
);
if
(
process
!=
GetCurrentProcessId
())
return
NULL
;
}
return
IMM_GetThreadData
(
thread
);
}
static
BOOL
IMM_IsDefaultContext
(
HIMC
imc
)
static
BOOL
IMM_IsDefaultContext
(
HIMC
imc
)
{
{
InputContextData
*
data
=
get_imc_data
(
imc
);
InputContextData
*
data
=
get_imc_data
(
imc
);
...
@@ -497,7 +483,7 @@ static InputContextData* get_imc_data(HIMC hIMC)
...
@@ -497,7 +483,7 @@ static InputContextData* get_imc_data(HIMC hIMC)
static
HIMC
get_default_context
(
HWND
hwnd
)
static
HIMC
get_default_context
(
HWND
hwnd
)
{
{
HIMC
ret
;
HIMC
ret
;
IMMThreadData
*
thread_data
=
IMM_GetThreadData
ForWindow
(
hwnd
);
IMMThreadData
*
thread_data
=
IMM_GetThreadData
(
hwnd
);
if
(
!
thread_data
)
return
0
;
if
(
!
thread_data
)
return
0
;
...
@@ -1625,7 +1611,7 @@ BOOL WINAPI ImmGetConversionStatus(
...
@@ -1625,7 +1611,7 @@ BOOL WINAPI ImmGetConversionStatus(
HWND
WINAPI
ImmGetDefaultIMEWnd
(
HWND
hWnd
)
HWND
WINAPI
ImmGetDefaultIMEWnd
(
HWND
hWnd
)
{
{
HWND
ret
,
new
=
NULL
;
HWND
ret
,
new
=
NULL
;
IMMThreadData
*
thread_data
=
IMM_GetThreadData
ForWindow
(
hWnd
);
IMMThreadData
*
thread_data
=
IMM_GetThreadData
(
hWnd
);
if
(
!
thread_data
)
if
(
!
thread_data
)
return
NULL
;
return
NULL
;
if
(
thread_data
->
hwndDefault
==
NULL
&&
thread_data
->
threadID
==
GetCurrentThreadId
())
if
(
thread_data
->
hwndDefault
==
NULL
&&
thread_data
->
threadID
==
GetCurrentThreadId
())
...
@@ -1634,12 +1620,8 @@ HWND WINAPI ImmGetDefaultIMEWnd(HWND hWnd)
...
@@ -1634,12 +1620,8 @@ HWND WINAPI ImmGetDefaultIMEWnd(HWND hWnd)
LeaveCriticalSection
(
&
threaddata_cs
);
LeaveCriticalSection
(
&
threaddata_cs
);
new
=
CreateWindowExW
(
WS_EX_TOOLWINDOW
,
new
=
CreateWindowExW
(
WS_EX_TOOLWINDOW
,
szwIME
,
NULL
,
WS_POPUP
,
0
,
0
,
1
,
1
,
0
,
0
,
0
,
0
);
szwIME
,
NULL
,
WS_POPUP
,
0
,
0
,
1
,
1
,
0
,
0
,
0
,
0
);
thread_data
=
IMM_GetThreadDataForWindow
(
hWnd
);
/* thread_data is in the current thread so we can assume it's still valid */
if
(
!
thread_data
)
EnterCriticalSection
(
&
threaddata_cs
);
{
DestroyWindow
(
new
);
return
NULL
;
}
/* See if anyone beat us */
/* See if anyone beat us */
if
(
thread_data
->
hwndDefault
==
NULL
)
if
(
thread_data
->
hwndDefault
==
NULL
)
{
{
...
...
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