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

List:       kde-commits
Subject:    KDE/kdelibs/kdeui/windowmanagement
From:       Romain Pokrzywka <romain () kdab ! net>
Date:       2009-07-12 23:54:11
Message-ID: 1247442851.197478.31225.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 995565 by pokrzywka:

- added a method to allow a window from another process to raise and activate itself. \
The implementation is only relevant for Windows atm, since it is not allowed there by \
                default.
- also removed unnecessary initialization calls in kwindowsystem_win.cpp, as it \
creates a hidden widget which in turns require a QApplication to be created, which \
may not always be the case (e.g. for forceActiveWindow() )

 M  +19 -0     kwindowsystem.h  
 M  +5 -0      kwindowsystem_mac.cpp  
 M  +7 -1      kwindowsystem_qws.cpp  
 M  +6 -18     kwindowsystem_win.cpp  
 M  +6 -0      kwindowsystem_x11.cpp  


--- trunk/KDE/kdelibs/kdeui/windowmanagement/kwindowsystem.h #995564:995565
@@ -477,6 +477,25 @@
      */
     static void doNotManage( const QString& title );
 
+    /**
+     * Allows a window from another process to raise and activate itself.
+     * Depending on the window manager, the grant may only be temporary,
+     * or for a single activation, and it may require the current process
+     * to be the "foreground" one" (ie. the process with the input focus).
+     *
+     * You should call this function before executing actions that may trigger
+     * the showing of a window or dialog in another process, e.g. a dbus signal
+     * or function call, or any other inter-process notification mechanism.
+     *
+     * This is mostly used on Windows, where windows are not allowed to be raised
+     * and activated if their process is not the foreground one, but it may also
+     * apply to other window managers.
+     *
+     * @param pid if specified, the grant only applies to windows belonging to the
+     *            specific process. By default, a value of -1 means all processes.
+     */
+    static void allowExternalProcessWindowActivation( int pid = -1 );
+
 #ifdef Q_WS_X11
     /**
      * @internal
--- trunk/KDE/kdelibs/kdeui/windowmanagement/kwindowsystem_mac.cpp #995564:995565
@@ -620,4 +620,9 @@
     //TODO
 }
 
+void KWindowSystem::allowExternalProcessWindowActivation( int pid )
+{
+    // Needed on mac ?
+}
+
 #include "moc_kwindowsystem.cpp"
--- trunk/KDE/kdelibs/kdeui/windowmanagement/kwindowsystem_qws.cpp #995564:995565
@@ -160,7 +160,7 @@
 
 QRect KWindowSystem::workArea( int desktop )
 {
-    //TODO 
+    //TODO
     kDebug() << "QRect KWindowSystem::workArea( int desktop ) isn't yet \
implemented!";  return QRect();
 }
@@ -259,5 +259,11 @@
  kDebug(240) << "KWindowSystem::setMainWindow( QWidget*, WId ) isn't yet \
implemented!";  }
 
+void KWindowSystem::allowExternalProcessWindowActivation( int pid )
+{
+    // TODO
+    kDebug() << "KWindowSystem::allowExternalProcessWindowActivation( int pid ) \
isn't yet implemented!"; +}
+
 #include "kwindowsystem.moc"
 
--- trunk/KDE/kdelibs/kdeui/windowmanagement/kwindowsystem_win.cpp #995564:995565
@@ -378,46 +378,39 @@
 
 void KWindowSystem::setMainWindow( QWidget* subwindow, WId mainwindow )
 {
-    KWindowSystem::init(INFO_WINDOWS);
     SetForegroundWindow(subwindow->winId());
 }
 
 void KWindowSystem::setCurrentDesktop( int desktop )
 {
-    KWindowSystem::init(INFO_WINDOWS);
     kDebug() << "KWindowSystem::setCurrentDesktop( int desktop ) isn't yet \
implemented!";  //TODO
 }
 
 void KWindowSystem::setOnAllDesktops( WId win, bool b )
 {
-    KWindowSystem::init(INFO_WINDOWS);
      kDebug() << "KWindowSystem::setOnAllDesktops( WId win, bool b ) isn't yet \
implemented!";  //TODO
 }
 
 void KWindowSystem::setOnDesktop( WId win, int desktop )
 {
-    KWindowSystem::init(INFO_WINDOWS);
      //TODO
      kDebug() << "KWindowSystem::setOnDesktop( WId win, int desktop ) isn't yet \
implemented!";  }
 
 WId KWindowSystem::activeWindow()
 {
-    KWindowSystem::init(INFO_WINDOWS);
     return GetActiveWindow();
 }
 
 void KWindowSystem::activateWindow( WId win, long )
 {
-    KWindowSystem::init(INFO_WINDOWS);
     SetActiveWindow( win );
 }
 
 void KWindowSystem::forceActiveWindow( WId win, long time )
 {
-    KWindowSystem::init(INFO_WINDOWS);
     // FIXME restoring a hidden window doesn't work: the window contents just appear \
                white.
     // But the mouse cursor still acts as if the widgets were there (e.g. button \
clicking works),  // which indicates the issue is at the window/backingstore level.
@@ -433,7 +426,6 @@
 
 void KWindowSystem::demandAttention( WId win, bool set )
 {
-    KWindowSystem::init(INFO_WINDOWS);
     FLASHWINFO fi;
     fi.cbSize = sizeof( FLASHWINFO );
     fi.hwnd = win;
@@ -495,7 +487,6 @@
 
 void KWindowSystem::setState( WId win, unsigned long state )
 {
-    KWindowSystem::init(INFO_WINDOWS);
     bool got = false;
     if (state & NET::SkipTaskbar) {
         got = true;
@@ -520,7 +511,6 @@
 
 void KWindowSystem::clearState( WId win, unsigned long state )
 {
-    KWindowSystem::init(INFO_WINDOWS);
     bool got = false;
 
     if (state & NET::SkipTaskbar) {
@@ -544,37 +534,32 @@
 void KWindowSystem::minimizeWindow( WId win, bool animation)
 {
     Q_UNUSED( animation );
-    KWindowSystem::init(INFO_WINDOWS);
     ShowWindow( win, SW_MINIMIZE );
 }
 
 void KWindowSystem::unminimizeWindow( WId win, bool animation )
 {
     Q_UNUSED( animation );
-    KWindowSystem::init(INFO_WINDOWS);
     ShowWindow( win, SW_RESTORE );
 }
 
 void KWindowSystem::raiseWindow( WId win )
 {
-    KWindowSystem::init(INFO_WINDOWS);
     SetWindowPos( win, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | \
SWP_NOSIZE ); // mhhh?  }
 
 void KWindowSystem::lowerWindow( WId win )
 {
-    KWindowSystem::init(INFO_WINDOWS);
     SetWindowPos( win, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | \
SWP_NOSIZE ); // mhhh?  }
 
 bool KWindowSystem::compositingActive()
 {
-    return false;
+    return true;
 }
 
 QRect KWindowSystem::workArea( int desktop )
 {
-    KWindowSystem::init(INFO_WINDOWS);
     return s_deskWidget->availableGeometry( desktop );
 }
 
@@ -582,7 +567,6 @@
 {
     //TODO
     kDebug() << "QRect KWindowSystem::workArea( const QList<WId>& exclude, int \
                desktop ) isn't yet implemented!";
-    KWindowSystem::init(INFO_WINDOWS);
     return QRect();
 }
 
@@ -673,7 +657,6 @@
 void KWindowSystem::setType( WId win, NET::WindowType windowType )
 {
  //TODO
- KWindowSystem::init(INFO_WINDOWS);
  kDebug() << "setType( WId win, NET::WindowType windowType ) isn't yet \
implemented!";  }
 
@@ -689,4 +672,9 @@
     return KWindowSystem::s_d_func()->winInfos.contains(w);
 }
 
+void KWindowSystem::allowExternalProcessWindowActivation( int pid )
+{
+    AllowSetForegroundWindow( pid == -1 ? ASFW_ANY : pid );
+}
+
 #include "kwindowsystem.moc"
--- trunk/KDE/kdelibs/kdeui/windowmanagement/kwindowsystem_x11.cpp #995564:995565
@@ -966,6 +966,12 @@
         .call("doNotManage", title);
 }
 
+void KWindowSystem::allowExternalProcessWindowActivation( int pid )
+{
+    // Normally supported by X11, but may depend on some window managers ?
+}
+
+
 bool KWindowSystem::mapViewport()
 {
     KWindowSystemPrivate* const s_d = s_d_func();


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

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