summaryrefslogtreecommitdiff
path: root/fpicker
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 /fpicker
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 'fpicker')
-rw-r--r--fpicker/source/odma/ODMAFilePicker.cxx17
1 files changed, 16 insertions, 1 deletions
diff --git a/fpicker/source/odma/ODMAFilePicker.cxx b/fpicker/source/odma/ODMAFilePicker.cxx
index 09eb01b737..2fe531015b 100644
--- a/fpicker/source/odma/ODMAFilePicker.cxx
+++ b/fpicker/source/odma/ODMAFilePicker.cxx
@@ -96,6 +96,21 @@ void SAL_CALL ODMAFilePicker::setTitle( const ::rtl::OUString& aTitle )
xExecutableDialog->setTitle( aTitle);
}
+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;
+}
+
sal_Int16 SAL_CALL ODMAFilePicker::execute( )
throw (RuntimeException)
{
@@ -104,7 +119,7 @@ sal_Int16 SAL_CALL ODMAFilePicker::execute( )
WORD count = 0;
DWORD flags;
- status = NODMRegisterApp( &handle, ODM_API_VERSION, "sodma", (DWORD) GetActiveWindow( ), NULL );
+ status = NODMRegisterApp( &handle, ODM_API_VERSION, "sodma", (DWORD) choose_parent_window( ), NULL );
if (status == ODM_SUCCESS)
{
if (m_nDialogKind == OPEN)