Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
93b6c455
Commit
93b6c455
authored
Apr 13, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Apr 13, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
imm32: Use INPUTCONTEXT directly in ImmGetCompositionFont(A|W).
parent
d4318270
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
32 deletions
+47
-32
imm.c
dlls/imm32/imm.c
+33
-18
imm32.c
dlls/imm32/tests/imm32.c
+14
-14
No files found.
dlls/imm32/imm.c
View file @
93b6c455
...
@@ -1413,38 +1413,53 @@ BOOL WINAPI ImmGetCandidateWindow(
...
@@ -1413,38 +1413,53 @@ BOOL WINAPI ImmGetCandidateWindow(
/***********************************************************************
/***********************************************************************
* ImmGetCompositionFontA (IMM32.@)
* ImmGetCompositionFontA (IMM32.@)
*/
*/
BOOL
WINAPI
ImmGetCompositionFontA
(
HIMC
hIMC
,
LPLOGFONTA
lplf
)
BOOL
WINAPI
ImmGetCompositionFontA
(
HIMC
himc
,
LOGFONTA
*
fontA
)
{
{
LOGFONTW
lfW
;
INPUTCONTEXT
*
ctx
;
BOOL
rc
;
LOGFONTW
fontW
;
BOOL
ret
=
TRUE
;
TRACE
(
"(%p, %p):
\n
"
,
hIMC
,
lplf
);
TRACE
(
"himc %p, fontA %p
\n
"
,
himc
,
fontA
);
rc
=
ImmGetCompositionFontW
(
hIMC
,
&
lfW
);
if
(
!
fontA
)
return
FALSE
;
if
(
!
rc
||
!
lplf
)
return
FALSE
;
memcpy
(
lplf
,
&
lfW
,
sizeof
(
LOGFONTA
));
if
(
!
(
ctx
=
ImmLockIMC
(
himc
)))
return
FALSE
;
WideCharToMultiByte
(
CP_ACP
,
0
,
lfW
.
lfFaceName
,
-
1
,
lplf
->
lfFaceName
,
if
(
!
(
ctx
->
fdwInit
&
INIT_LOGFONT
))
ret
=
FALSE
;
LF_FACESIZE
,
NULL
,
NULL
);
else
if
(
!
input_context_is_unicode
(
ctx
))
*
fontA
=
ctx
->
lfFont
.
A
;
return
TRUE
;
else
if
((
ret
=
ImmGetCompositionFontW
(
himc
,
&
fontW
)))
{
memcpy
(
fontA
,
&
fontW
,
offsetof
(
LOGFONTA
,
lfFaceName
)
);
WideCharToMultiByte
(
CP_ACP
,
0
,
fontW
.
lfFaceName
,
-
1
,
fontA
->
lfFaceName
,
LF_FACESIZE
,
NULL
,
NULL
);
}
ImmUnlockIMC
(
himc
);
return
ret
;
}
}
/***********************************************************************
/***********************************************************************
* ImmGetCompositionFontW (IMM32.@)
* ImmGetCompositionFontW (IMM32.@)
*/
*/
BOOL
WINAPI
ImmGetCompositionFontW
(
HIMC
hIMC
,
LPLOGFONTW
lplf
)
BOOL
WINAPI
ImmGetCompositionFontW
(
HIMC
himc
,
LOGFONTW
*
fontW
)
{
{
struct
imc
*
data
=
get_imc_data
(
hIMC
);
INPUTCONTEXT
*
ctx
;
LOGFONTA
fontA
;
BOOL
ret
=
TRUE
;
TRACE
(
"(%p, %p):
\n
"
,
hIMC
,
lplf
);
TRACE
(
"himc %p, fontW %p
\n
"
,
himc
,
fontW
);
if
(
!
data
||
!
lplf
)
if
(
!
fontW
)
return
FALSE
;
return
FALSE
;
*
lplf
=
data
->
IMC
.
lfFont
.
W
;
if
(
!
(
ctx
=
ImmLockIMC
(
himc
)))
return
FALSE
;
if
(
!
(
ctx
->
fdwInit
&
INIT_LOGFONT
))
ret
=
FALSE
;
else
if
(
input_context_is_unicode
(
ctx
))
*
fontW
=
ctx
->
lfFont
.
W
;
else
if
((
ret
=
ImmGetCompositionFontA
(
himc
,
&
fontA
)))
{
memcpy
(
fontW
,
&
fontA
,
offsetof
(
LOGFONTW
,
lfFaceName
)
);
MultiByteToWideChar
(
CP_ACP
,
0
,
fontA
.
lfFaceName
,
-
1
,
fontW
->
lfFaceName
,
LF_FACESIZE
);
}
ImmUnlockIMC
(
himc
);
return
TRUE
;
return
ret
;
}
}
...
...
dlls/imm32/tests/imm32.c
View file @
93b6c455
...
@@ -182,8 +182,8 @@ static void check_composition_form_( int line, COMPOSITIONFORM *form, const COMP
...
@@ -182,8 +182,8 @@ static void check_composition_form_( int line, COMPOSITIONFORM *form, const COMP
check_member_rect_
(
__FILE__
,
line
,
*
form
,
*
expect
,
rcArea
);
check_member_rect_
(
__FILE__
,
line
,
*
form
,
*
expect
,
rcArea
);
}
}
#define check_logfont_w( a, b ) check_logfont_w_( __LINE__, a, b
, FALSE
)
#define check_logfont_w( a, b ) check_logfont_w_( __LINE__, a, b )
static
void
check_logfont_w_
(
int
line
,
LOGFONTW
*
font
,
const
LOGFONTW
*
expect
,
BOOL
todo
)
static
void
check_logfont_w_
(
int
line
,
LOGFONTW
*
font
,
const
LOGFONTW
*
expect
)
{
{
check_member_
(
__FILE__
,
line
,
*
font
,
*
expect
,
"%lu"
,
lfHeight
);
check_member_
(
__FILE__
,
line
,
*
font
,
*
expect
,
"%lu"
,
lfHeight
);
check_member_
(
__FILE__
,
line
,
*
font
,
*
expect
,
"%lu"
,
lfWidth
);
check_member_
(
__FILE__
,
line
,
*
font
,
*
expect
,
"%lu"
,
lfWidth
);
...
@@ -198,11 +198,11 @@ static void check_logfont_w_( int line, LOGFONTW *font, const LOGFONTW *expect,
...
@@ -198,11 +198,11 @@ static void check_logfont_w_( int line, LOGFONTW *font, const LOGFONTW *expect,
check_member_
(
__FILE__
,
line
,
*
font
,
*
expect
,
"%u"
,
lfClipPrecision
);
check_member_
(
__FILE__
,
line
,
*
font
,
*
expect
,
"%u"
,
lfClipPrecision
);
check_member_
(
__FILE__
,
line
,
*
font
,
*
expect
,
"%u"
,
lfQuality
);
check_member_
(
__FILE__
,
line
,
*
font
,
*
expect
,
"%u"
,
lfQuality
);
check_member_
(
__FILE__
,
line
,
*
font
,
*
expect
,
"%u"
,
lfPitchAndFamily
);
check_member_
(
__FILE__
,
line
,
*
font
,
*
expect
,
"%u"
,
lfPitchAndFamily
);
todo_wine_if
(
todo
)
check_member_wstr_
(
__FILE__
,
line
,
*
font
,
*
expect
,
lfFaceName
);
check_member_wstr_
(
__FILE__
,
line
,
*
font
,
*
expect
,
lfFaceName
);
}
}
#define check_logfont_a( a, b ) check_logfont_a_( __LINE__, a, b
, FALSE
)
#define check_logfont_a( a, b ) check_logfont_a_( __LINE__, a, b )
static
void
check_logfont_a_
(
int
line
,
LOGFONTA
*
font
,
const
LOGFONTA
*
expect
,
BOOL
todo
)
static
void
check_logfont_a_
(
int
line
,
LOGFONTA
*
font
,
const
LOGFONTA
*
expect
)
{
{
check_member_
(
__FILE__
,
line
,
*
font
,
*
expect
,
"%lu"
,
lfHeight
);
check_member_
(
__FILE__
,
line
,
*
font
,
*
expect
,
"%lu"
,
lfHeight
);
check_member_
(
__FILE__
,
line
,
*
font
,
*
expect
,
"%lu"
,
lfWidth
);
check_member_
(
__FILE__
,
line
,
*
font
,
*
expect
,
"%lu"
,
lfWidth
);
...
@@ -217,7 +217,7 @@ static void check_logfont_a_( int line, LOGFONTA *font, const LOGFONTA *expect,
...
@@ -217,7 +217,7 @@ static void check_logfont_a_( int line, LOGFONTA *font, const LOGFONTA *expect,
check_member_
(
__FILE__
,
line
,
*
font
,
*
expect
,
"%u"
,
lfClipPrecision
);
check_member_
(
__FILE__
,
line
,
*
font
,
*
expect
,
"%u"
,
lfClipPrecision
);
check_member_
(
__FILE__
,
line
,
*
font
,
*
expect
,
"%u"
,
lfQuality
);
check_member_
(
__FILE__
,
line
,
*
font
,
*
expect
,
"%u"
,
lfQuality
);
check_member_
(
__FILE__
,
line
,
*
font
,
*
expect
,
"%u"
,
lfPitchAndFamily
);
check_member_
(
__FILE__
,
line
,
*
font
,
*
expect
,
"%u"
,
lfPitchAndFamily
);
todo_wine_if
(
todo
)
check_member_str_
(
__FILE__
,
line
,
*
font
,
*
expect
,
lfFaceName
);
check_member_str_
(
__FILE__
,
line
,
*
font
,
*
expect
,
lfFaceName
);
}
}
#define DEFINE_EXPECT(func) \
#define DEFINE_EXPECT(func) \
...
@@ -6357,13 +6357,13 @@ static void test_ImmSetCompositionFont( BOOL unicode )
...
@@ -6357,13 +6357,13 @@ static void test_ImmSetCompositionFont( BOOL unicode )
if
(
unicode
)
ctx
->
lfFont
.
W
=
expect_fontW
;
if
(
unicode
)
ctx
->
lfFont
.
W
=
expect_fontW
;
else
ctx
->
lfFont
.
A
=
expect_fontA
;
else
ctx
->
lfFont
.
A
=
expect_fontA
;
ctx
->
fdwInit
=
~
INIT_LOGFONT
;
ctx
->
fdwInit
=
~
INIT_LOGFONT
;
todo_wine
ok_ret
(
0
,
ImmGetCompositionFontW
(
himc
,
&
fontW
)
);
ok_ret
(
0
,
ImmGetCompositionFontW
(
himc
,
&
fontW
)
);
todo_wine
ok_ret
(
0
,
ImmGetCompositionFontA
(
himc
,
&
fontA
)
);
ok_ret
(
0
,
ImmGetCompositionFontA
(
himc
,
&
fontA
)
);
ctx
->
fdwInit
=
INIT_LOGFONT
;
ctx
->
fdwInit
=
INIT_LOGFONT
;
ok_ret
(
1
,
ImmGetCompositionFontW
(
himc
,
&
fontW
)
);
ok_ret
(
1
,
ImmGetCompositionFontW
(
himc
,
&
fontW
)
);
check_logfont_w
_
(
__LINE__
,
&
fontW
,
&
expect_fontW
,
!
unicode
);
check_logfont_w
(
&
fontW
,
&
expect_fontW
);
ok_ret
(
1
,
ImmGetCompositionFontA
(
himc
,
&
fontA
)
);
ok_ret
(
1
,
ImmGetCompositionFontA
(
himc
,
&
fontA
)
);
check_logfont_a
_
(
__LINE__
,
&
fontA
,
&
expect_fontA
,
!
unicode
);
check_logfont_a
(
&
fontA
,
&
expect_fontA
);
ctx
->
hWnd
=
hwnd
;
ctx
->
hWnd
=
hwnd
;
ctx
->
fdwInit
=
0
;
ctx
->
fdwInit
=
0
;
...
@@ -6377,9 +6377,9 @@ static void test_ImmSetCompositionFont( BOOL unicode )
...
@@ -6377,9 +6377,9 @@ static void test_ImmSetCompositionFont( BOOL unicode )
else
check_logfont_a
(
&
ctx
->
lfFont
.
A
,
&
expect_fontA
);
else
check_logfont_a
(
&
ctx
->
lfFont
.
A
,
&
expect_fontA
);
ok_ret
(
1
,
ImmGetCompositionFontW
(
himc
,
&
fontW
)
);
ok_ret
(
1
,
ImmGetCompositionFontW
(
himc
,
&
fontW
)
);
check_logfont_w
_
(
__LINE__
,
&
fontW
,
&
expect_fontW
,
!
unicode
);
check_logfont_w
(
&
fontW
,
&
expect_fontW
);
ok_ret
(
1
,
ImmGetCompositionFontA
(
himc
,
&
fontA
)
);
ok_ret
(
1
,
ImmGetCompositionFontA
(
himc
,
&
fontA
)
);
check_logfont_a
_
(
__LINE__
,
&
fontA
,
&
expect_fontA
,
!
unicode
);
check_logfont_a
(
&
fontA
,
&
expect_fontA
);
ctx
->
hWnd
=
hwnd
;
ctx
->
hWnd
=
hwnd
;
ctx
->
fdwInit
=
0
;
ctx
->
fdwInit
=
0
;
...
@@ -6393,9 +6393,9 @@ static void test_ImmSetCompositionFont( BOOL unicode )
...
@@ -6393,9 +6393,9 @@ static void test_ImmSetCompositionFont( BOOL unicode )
else
check_logfont_a
(
&
ctx
->
lfFont
.
A
,
&
expect_fontA
);
else
check_logfont_a
(
&
ctx
->
lfFont
.
A
,
&
expect_fontA
);
ok_ret
(
1
,
ImmGetCompositionFontW
(
himc
,
&
fontW
)
);
ok_ret
(
1
,
ImmGetCompositionFontW
(
himc
,
&
fontW
)
);
check_logfont_w
_
(
__LINE__
,
&
fontW
,
&
expect_fontW
,
!
unicode
);
check_logfont_w
(
&
fontW
,
&
expect_fontW
);
ok_ret
(
1
,
ImmGetCompositionFontA
(
himc
,
&
fontA
)
);
ok_ret
(
1
,
ImmGetCompositionFontA
(
himc
,
&
fontA
)
);
check_logfont_a
_
(
__LINE__
,
&
fontA
,
&
expect_fontA
,
!
unicode
);
check_logfont_a
(
&
fontA
,
&
expect_fontA
);
ctx
->
hWnd
=
0
;
ctx
->
hWnd
=
0
;
ok_ret
(
1
,
ImmSetCompositionFontW
(
himc
,
&
expect_fontW
)
);
ok_ret
(
1
,
ImmSetCompositionFontW
(
himc
,
&
expect_fontW
)
);
...
...
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