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
6117ea47
Commit
6117ea47
authored
May 22, 2009
by
Aric Stewart
Committed by
Alexandre Julliard
May 25, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msctf: Implement ITextStoreACPSink::OnStatusChange.
Requires changes in the way document locking is implemented and tested.
parent
7ac3fe28
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
28 deletions
+52
-28
context.c
dlls/msctf/context.c
+34
-9
inputprocessor.c
dlls/msctf/tests/inputprocessor.c
+18
-19
No files found.
dlls/msctf/context.c
View file @
6117ea47
...
...
@@ -70,6 +70,7 @@ typedef struct tagContext {
TfClientId
tidOwner
;
TfEditCookie
defaultCookie
;
TS_STATUS
documentStatus
;
ITextStoreACP
*
pITextStoreACP
;
ITfContextOwnerCompositionSink
*
pITfContextOwnerCompositionSink
;
...
...
@@ -223,7 +224,6 @@ static HRESULT WINAPI Context_RequestEditSession (ITfContext *iface,
HRESULT
hr
;
Context
*
This
=
(
Context
*
)
iface
;
DWORD
dwLockFlags
=
0x0
;
TS_STATUS
status
;
TRACE
(
"(%p) %i %p %x %p
\n
"
,
This
,
tid
,
pes
,
dwFlags
,
phrSession
);
...
...
@@ -248,10 +248,10 @@ static HRESULT WINAPI Context_RequestEditSession (ITfContext *iface,
else
if
(
dwFlags
&
TF_ES_READ
)
dwLockFlags
|=
TS_LF_READ
;
/* TODO: cache this */
ITextStoreACP_GetStatus
(
This
->
pITextStoreACP
,
&
s
tatus
);
if
(
!
This
->
documentStatus
.
dwDynamicFlags
)
ITextStoreACP_GetStatus
(
This
->
pITextStoreACP
,
&
This
->
documentS
tatus
);
if
(((
dwFlags
&
TF_ES_READWRITE
)
==
TF_ES_READWRITE
)
&&
(
s
tatus
.
dwDynamicFlags
&
TS_SD_READONLY
))
if
(((
dwFlags
&
TF_ES_READWRITE
)
==
TF_ES_READWRITE
)
&&
(
This
->
documentS
tatus
.
dwDynamicFlags
&
TS_SD_READONLY
))
{
*
phrSession
=
TS_E_READONLY
;
return
S_OK
;
...
...
@@ -263,7 +263,6 @@ static HRESULT WINAPI Context_RequestEditSession (ITfContext *iface,
return
E_INVALIDARG
;
}
hr
=
ITextStoreACP_RequestLock
(
This
->
pITextStoreACP
,
dwLockFlags
,
phrSession
);
return
hr
;
...
...
@@ -739,8 +738,28 @@ static HRESULT WINAPI TextStoreACPSink_OnStatusChange(ITextStoreACPSink *iface,
DWORD
dwFlags
)
{
TextStoreACPSink
*
This
=
(
TextStoreACPSink
*
)
iface
;
FIXME
(
"STUB:(%p)
\n
"
,
This
);
return
E_NOTIMPL
;
HRESULT
hr
,
hrSession
;
TRACE
(
"(%p) %x
\n
"
,
This
,
dwFlags
);
if
(
!
This
->
pContext
)
{
ERR
(
"No context?
\n
"
);
return
E_FAIL
;
}
if
(
!
This
->
pContext
->
pITextStoreACP
)
{
FIXME
(
"Context does not have a ITextStoreACP
\n
"
);
return
E_NOTIMPL
;
}
hr
=
ITextStoreACP_RequestLock
(
This
->
pContext
->
pITextStoreACP
,
TS_LF_READ
,
&
hrSession
);
if
(
SUCCEEDED
(
hr
)
&&
SUCCEEDED
(
hrSession
))
This
->
pContext
->
documentStatus
.
dwDynamicFlags
=
dwFlags
;
return
S_OK
;
}
static
HRESULT
WINAPI
TextStoreACPSink_OnAttrsChange
(
ITextStoreACPSink
*
iface
,
...
...
@@ -761,12 +780,18 @@ static HRESULT WINAPI TextStoreACPSink_OnLockGranted(ITextStoreACPSink *iface,
TRACE
(
"(%p) %x
\n
"
,
This
,
dwLockFlags
);
if
(
!
This
->
pContext
||
!
This
->
pContext
->
currentEditSession
)
if
(
!
This
->
pContext
)
{
ERR
(
"OnLockGranted called
on a context without a current edit session
\n
"
);
ERR
(
"OnLockGranted called
without a context
\n
"
);
return
E_FAIL
;
}
if
(
!
This
->
pContext
->
currentEditSession
)
{
FIXME
(
"OnLockGranted called for something other than an EditSession
\n
"
);
return
S_OK
;
}
cookie
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
EditCookie
));
if
(
!
cookie
)
return
E_OUTOFMEMORY
;
...
...
dlls/msctf/tests/inputprocessor.c
View file @
6117ea47
...
...
@@ -38,6 +38,8 @@ static ITfDocumentMgr *g_dm = NULL;
static
TfClientId
cid
=
0
;
static
TfClientId
tid
=
0
;
static
ITextStoreACPSink
*
ACPSink
;
#define SINK_UNEXPECTED 0
#define SINK_EXPECTED 1
#define SINK_FIRED 2
...
...
@@ -47,6 +49,7 @@ static BOOL test_ShouldDeactivate = FALSE;
static
DWORD
tmSinkCookie
;
static
DWORD
tmSinkRefCount
;
static
DWORD
documentStatus
;
static
ITfDocumentMgr
*
test_CurrentFocus
=
NULL
;
static
ITfDocumentMgr
*
test_PrevFocus
=
NULL
;
static
INT
test_OnSetFocus
=
SINK_UNEXPECTED
;
...
...
@@ -70,7 +73,6 @@ typedef struct tagTextStoreACP
const
ITextStoreACPVtbl
*
TextStoreACPVtbl
;
LONG
refCount
;
ITextStoreACPSink
*
sink
;
}
TextStoreACP
;
static
void
TextStoreACP_Destructor
(
TextStoreACP
*
This
)
...
...
@@ -117,13 +119,12 @@ static ULONG WINAPI TextStoreACP_Release(ITextStoreACP *iface)
static
HRESULT
WINAPI
TextStoreACP_AdviseSink
(
ITextStoreACP
*
iface
,
REFIID
riid
,
IUnknown
*
punk
,
DWORD
dwMask
)
{
TextStoreACP
*
This
=
(
TextStoreACP
*
)
iface
;
HRESULT
hr
;
ok
(
test_ACP_AdviseSink
==
SINK_EXPECTED
,
"Unexpected TextStoreACP_AdviseSink sink
\n
"
);
test_ACP_AdviseSink
=
SINK_FIRED
;
hr
=
IUnknown_QueryInterface
(
punk
,
&
IID_ITextStoreACPSink
,(
LPVOID
*
)(
&
This
->
s
ink
));
hr
=
IUnknown_QueryInterface
(
punk
,
&
IID_ITextStoreACPSink
,(
LPVOID
*
)(
&
ACPS
ink
));
ok
(
SUCCEEDED
(
hr
),
"Unable to QueryInterface on sink
\n
"
);
return
S_OK
;
}
...
...
@@ -138,28 +139,17 @@ static HRESULT WINAPI TextStoreACP_UnadviseSink(ITextStoreACP *iface,
static
HRESULT
WINAPI
TextStoreACP_RequestLock
(
ITextStoreACP
*
iface
,
DWORD
dwLockFlags
,
HRESULT
*
phrSession
)
{
TextStoreACP
*
This
=
(
TextStoreACP
*
)
iface
;
ok
(
test_ACP_RequestLock
==
SINK_EXPECTED
,
"Unexpected TextStoreACP_RequestLock
\n
"
);
test_ACP_RequestLock
=
SINK_FIRED
;
test_DoEditSession
=
SINK_EXPECTED
;
*
phrSession
=
ITextStoreACPSink_OnLockGranted
(
This
->
sink
,
TS_LF_READWRITE
);
ok
(
test_DoEditSession
=
SINK_FIRED
,
"expected DoEditSession not fired
\n
"
);
ok
(
*
phrSession
==
0xdeadcafe
,
"Unexpected return from ITextStoreACPSink_OnLockGranted
\n
"
);
*
phrSession
=
ITextStoreACPSink_OnLockGranted
(
ACPSink
,
dwLockFlags
);
return
S_OK
;
}
static
HRESULT
WINAPI
TextStoreACP_GetStatus
(
ITextStoreACP
*
iface
,
TS_STATUS
*
pdcs
)
{
static
UINT
count
=
0
;
count
++
;
if
(
count
==
1
)
ok
(
test_ACP_GetStatus
==
SINK_EXPECTED
,
"Unexpected TextStoreACP_GetStatus
\n
"
);
else
todo_wine
ok
(
count
==
1
,
"GetStatus called too many times
\n
"
);
ok
(
test_ACP_GetStatus
==
SINK_EXPECTED
,
"Unexpected TextStoreACP_GetStatus
\n
"
);
test_ACP_GetStatus
=
SINK_FIRED
;
pdcs
->
dwDynamicFlags
=
TS_SD_READONLY
;
pdcs
->
dwDynamicFlags
=
documentStatus
;
return
S_OK
;
}
static
HRESULT
WINAPI
TextStoreACP_QueryInsert
(
ITextStoreACP
*
iface
,
...
...
@@ -1483,6 +1473,7 @@ static void test_TStoApplicationText(void)
ok
(
hr
==
E_INVALIDARG
,
"RequestEditSession should have failed with %x not %x
\n
"
,
E_INVALIDARG
,
hr
);
ok
(
hrSession
==
E_FAIL
,
"hrSession should be %x not %x
\n
"
,
E_FAIL
,
hrSession
);
documentStatus
=
TS_SD_READONLY
;
hrSession
=
0xfeedface
;
test_ACP_GetStatus
=
SINK_EXPECTED
;
hr
=
ITfContext_RequestEditSession
(
cxt
,
tid
,
es
,
TF_ES_SYNC
|
TF_ES_READWRITE
,
&
hrSession
);
...
...
@@ -1490,13 +1481,21 @@ static void test_TStoApplicationText(void)
ok
(
hrSession
==
TS_E_READONLY
,
"Unexpected hrSession (%x)
\n
"
,
hrSession
);
ok
(
test_ACP_GetStatus
==
SINK_FIRED
,
" expected GetStatus not fired
\n
"
);
test_ACP_GetStatus
=
SINK_UNEXPECTED
;
/* signal a change to allow readwrite sessions */
documentStatus
=
0
;
test_ACP_RequestLock
=
SINK_EXPECTED
;
ITextStoreACPSink_OnStatusChange
(
ACPSink
,
documentStatus
);
ok
(
test_ACP_RequestLock
==
SINK_FIRED
,
" expected RequestLock not fired
\n
"
);
test_ACP_GetStatus
=
SINK_EXPECTED
;
test_ACP_RequestLock
=
SINK_EXPECTED
;
test_DoEditSession
=
SINK_EXPECTED
;
hrSession
=
0xfeedface
;
hr
=
ITfContext_RequestEditSession
(
cxt
,
tid
,
es
,
TF_ES_SYNC
|
TF_ES_READ
,
&
hrSession
);
hr
=
ITfContext_RequestEditSession
(
cxt
,
tid
,
es
,
TF_ES_SYNC
|
TF_ES_READ
WRITE
,
&
hrSession
);
ok
(
SUCCEEDED
(
hr
),
"ITfContext_RequestEditSession failed
\n
"
);
ok
(
test_ACP_RequestLock
==
SINK_FIRED
,
" expected RequestLock not fired
\n
"
);
ok
(
test_DoEditSession
==
SINK_FIRED
,
" expected DoEditSession not fired
\n
"
);
ok
(
test_ACP_GetStatus
==
SINK_FIRED
,
" expected GetStatus not fired
\n
"
);
ok
(
hrSession
==
0xdeadcafe
,
"Unexpected hrSession (%x)
\n
"
,
hrSession
);
ITfContext_Release
(
cxt
);
...
...
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