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

List:       kde-commits
Subject:    kdebase/ksplash
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2003-02-11 10:17:27
[Download RAW message or body]

CVS commit by lunakl: 

XRANDR support.


  M +29 -14    ksplash.cpp   1.54
  M +2 -0      ksplash.h   1.11


--- kdebase/ksplash/ksplash.cpp  #1.53:1.54
@@ -88,16 +88,4 @@ KSplash::KSplash( const char* name )
     bottom_label->setFixedHeight(status_label->sizeHint().height()+4);
 
-    QSize sh = sizeHint();
-    QDesktopWidget *desktop = QApplication::desktop();
-
-    KConfigGroup xineramaConfig(KGlobal::config(),"Xinerama");
-
-    QRect rect = desktop->screenGeometry(xineramaConfig.readNumEntry(
-        "KSplashScreen", desktop->screenNumber(QPoint(0,0)) ) );
-    move(rect.x() + (rect.width() - sh.width())/2,
-         rect.y() + (rect.height() - sh.height())/2);
-
-    setFixedSize(sh);
-
     close_timer = new QTimer( this );
     connect( close_timer, SIGNAL( timeout() ), this, SLOT( close() ) );
@@ -106,10 +94,23 @@ KSplash::KSplash( const char* name )
     QTimer::singleShot( 250, this, SLOT( tryDcop() ) );
 
+    KConfigGroup xineramaConfig(KGlobal::config(),"Xinerama");
+
+    QDesktopWidget *desktop = QApplication::desktop();
+    xinerama_screen = xineramaConfig.readNumEntry(
+        "KSplashScreen", desktop->screenNumber(QPoint(0,0)) );
+
+    positionSelf();
+
     // For Xinerama, let's put the mouse on the first head.  Otherwise it
     // could appear anywhere!
-    if (QApplication::desktop()->isVirtualDesktop()) {
+    if (desktop->isVirtualDesktop()) {
+        QRect rect = desktop->screenGeometry( xinerama_screen );
         if (!rect.contains(QCursor::pos()))
             QCursor::setPos(rect.center());
     }
+    
+#ifdef XRANDR_SUPPORT
+    connect( kapp->desktop(), SIGNAL( resized( int )), SLOT( positionSelf()));
+#endif
 }
 
@@ -264,4 +265,18 @@ void KSplash::resizeEvent(QResizeEvent*)
     progress->resize(120, status_label->height());
     progress->move(kapp->reverseLayout() ? 4 : status_label->width() - progress->width() - 4, 0);
+}
+
+void KSplash::positionSelf()
+{
+    QSize sh = sizeHint();
+    QDesktopWidget *desktop = QApplication::desktop();
+
+    QRect rect = desktop->screenGeometry( xinerama_screen );
+
+    move(rect.x() + (rect.width() - sh.width())/2,
+         rect.y() + (rect.height() - sh.height())/2);
+
+
+    setFixedSize(sh);
 }
 

--- kdebase/ksplash/ksplash.h  #1.10:1.11
@@ -32,4 +32,5 @@ protected slots:
     void resizeEvent(QResizeEvent*);
     void blink();
+    void positionSelf();
 
 protected:
@@ -52,4 +53,5 @@ private:
     int state;
     bool testmode;
+    int xinerama_screen;
 };
 


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

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