summaryrefslogtreecommitdiff
path: root/ucb/source/ucp/odma
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@novell.com>2010-09-28 15:19:43 +0300
committerTor Lillqvist <tml@hemulen.(none)>2010-09-28 15:34:45 +0300
commit69bf04ccaedec01f348f1cf896a666c5480b50fb (patch)
treef54093955550b0e9bcaa2f82de3bad62006342f3 /ucb/source/ucp/odma
parent2c1320a1d3e5faee6c0176f62275816c78d3da24 (diff)
Pass proper parent window handle to ODMRegisterApp
Use short code snippet lifted from fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx to get a suitable window handle. Should fix bnc#398822.
Diffstat (limited to 'ucb/source/ucp/odma')
-rw-r--r--ucb/source/ucp/odma/odma_provider.cxx17
1 files changed, 16 insertions, 1 deletions
diff --git a/ucb/source/ucp/odma/odma_provider.cxx b/ucb/source/ucp/odma/odma_provider.cxx
index 7ba5b7c2f5..2f09e05103 100644
--- a/ucb/source/ucp/odma/odma_provider.cxx
+++ b/ucb/source/ucp/odma/odma_provider.cxx
@@ -79,11 +79,26 @@ ContentProvider::~ContentProvider()
}
}
// -----------------------------------------------------------------------------
+inline bool is_current_process_window(HWND hwnd)
+{
+ DWORD pid;
+ GetWindowThreadProcessId(hwnd, &pid);
+ return (pid == GetCurrentProcessId());
+}
+
+HWND choose_parent_window()
+{
+ HWND hwnd_parent = GetForegroundWindow();
+ if (!is_current_process_window(hwnd_parent))
+ hwnd_parent = GetDesktopWindow();
+ return hwnd_parent;
+}
+
ODMHANDLE ContentProvider::getHandle()
{
if(!m_aOdmHandle)
{
- ODMSTATUS odm = NODMRegisterApp(&m_aOdmHandle,ODM_API_VERSION,ODMA_ODMA_REGNAME,NULL,NULL);
+ ODMSTATUS odm = NODMRegisterApp(&m_aOdmHandle,ODM_API_VERSION,ODMA_ODMA_REGNAME,(DWORD) choose_parent_window( ),NULL);
switch(odm)
{
case ODM_SUCCESS: