[ooo-build-commit] .: fpicker/source ucb/source

Tor Lillqvist tml at kemper.freedesktop.org
Tue Sep 28 05:35:46 PDT 2010


 fpicker/source/odma/ODMAFilePicker.cxx |   17 ++++++++++++++++-
 ucb/source/ucp/odma/odma_provider.cxx  |   17 ++++++++++++++++-
 2 files changed, 32 insertions(+), 2 deletions(-)

New commits:
commit 69bf04ccaedec01f348f1cf896a666c5480b50fb
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Tue Sep 28 15:19:43 2010 +0300

    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.

diff --git a/fpicker/source/odma/ODMAFilePicker.cxx b/fpicker/source/odma/ODMAFilePicker.cxx
index 09eb01b..2fe5310 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)
diff --git a/ucb/source/ucp/odma/odma_provider.cxx b/ucb/source/ucp/odma/odma_provider.cxx
index 7ba5b7c..2f09e05 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:


More information about the ooo-build-commit mailing list