summaryrefslogtreecommitdiff
path: root/ucb/source
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
commit4438b99e247ba7d5e24f3d70cd9567497556918c (patch)
tree308ce8e1a7159817f91395b741b578b6e9def0ce /ucb/source
parent024a388c2a3b5bf9c2fcc6f5a195c76b59372a63 (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')
-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 5415afb9ec9c..5c4e67884d11 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: