[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdeui/windowmanagement
From:       Patrick von Reth <patrick.vonreth () gmail ! com>
Date:       2011-01-28 20:31:23
Message-ID: 20110128203123.A07AAAC8BB () svn ! kde ! org
[Download RAW message or body]

SVN commit 1217817 by vonreth:

fixed raise and forceActive to bring the window actually  to the front

 M  +20 -1     kwindowsystem_win.cpp  


--- trunk/KDE/kdelibs/kdeui/windowmanagement/kwindowsystem_win.cpp #1217816:1217817
@@ -417,9 +417,19 @@
     }
 #endif
     // Puts the window in front and activates it.
+    //to bring a window to the front while the user is active in a different apllication we
+    //have to atach our self to the current active window
+    HWND hwndActiveWin = GetForegroundWindow();
+    int  idActive      = GetWindowThreadProcessId(hwndActiveWin, NULL);
+    if ( AttachThreadInput(GetCurrentThreadId(), idActive, TRUE) )
+    {
     SetForegroundWindow( win );
+        SetFocus( win ); 
+        AttachThreadInput(GetCurrentThreadId(), idActive, FALSE);
 }
 
+}
+
 void KWindowSystem::demandAttention( WId win, bool set )
 {
 // One can not flash a windows in wince
@@ -548,8 +558,17 @@
 
 void KWindowSystem::raiseWindow( WId win )
 {
-    SetWindowPos( win, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE ); // mhhh?
+
+    //to bring a window to the front while the user is active in a different apllication we
+    //have to atach our self to the current active window
+    HWND hwndActiveWin = GetForegroundWindow();
+    int  idActive      = GetWindowThreadProcessId(hwndActiveWin, NULL);
+    if ( AttachThreadInput(GetCurrentThreadId(), idActive, TRUE) )
+    {
+        SetForegroundWindow( win );
+        AttachThreadInput(GetCurrentThreadId(), idActive, FALSE);
 }
+}
 
 void KWindowSystem::lowerWindow( WId win )
 {
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic