Browse Source

BUG: Flickering of ctkPopupWidget on Linux

This is because Compiz applies a Fading effect (and other animation effects
) on the raised popup widget.
Julien Finet 13 years ago
parent
commit
875281d550
1 changed files with 12 additions and 2 deletions
  1. 12 2
      Libs/Widgets/ctkPopupWidget.cpp

+ 12 - 2
Libs/Widgets/ctkPopupWidget.cpp

@@ -122,8 +122,6 @@ void ctkPopupWidgetPrivate::init()
   this->ScrollAnimation->setDuration(DEFAULT_FADING_DURATION);
   QObject::connect(this->ScrollAnimation, SIGNAL(finished()),
                    q, SLOT(onEffectFinished()));
-  QObject::connect(this->ScrollAnimation, SIGNAL(finished()),
-                   this->PopupPixmapWidget, SLOT(hide()));
 
   qApp->installEventFilter(this);
 
@@ -754,6 +752,18 @@ void ctkPopupWidget::onEffectFinished()
   else
     {
     this->show();
+#ifdef Q_WS_X11
+    // If the OS applies effects on window appearance, it
+    // can take time for the popup to be displayed, we don't want to
+    // hide the pixmap too early otherwise to would makes it "flicker"
+    // It has the disadvantage of 'opaquing' if the popup is
+    // semi transparent because the pixmap and the popup opacities
+    // get summed up until the pixmap is hidden.
+    // Alternatively, you could remove effects on windows with Compiz.
+    QTimer::singleShot(100, d->PopupPixmapWidget, SLOT(hide()));
+#else
+    d->PopupPixmapWidget->hide();
+#endif
     emit this->popupOpened(true);
     }
 }