FloatingControl Fix
Brought to you by:
err0rsm1th
Hello,
I've made some changes to floating control.
My patch
> fixes bad position of control when switching to fullscreen (tested on gnome 2)
> fixes showing of float control when switching virtual desktops (tested on gnome 2)
> uses auto_hide interval
It needs further testing, but I beleive it is working now as it is.
nowrep (nowrep@gmail.com)
patch
I have tested this patch on Archlinux x86-64 with latest umplayer svn version. But make gave me "wrong type argument to unary plus" error. So, i have removed plus signs on lines 72,73 and 74 then it compiled without a problem. This patch really works! Thank you. I attached modified patch below
diff -crB original/defaultgui.cpp edited/defaultgui.cpp
*** original/defaultgui.cpp 2011-08-18 17:01:03.000000000 +0200
--- edited/defaultgui.cpp 2011-10-02 14:25:44.797266740 +0200
***************
*** 79,91 ****
connect( mplayerwindow->videoLayer(), SIGNAL(floatShown()),
this, SLOT(showFloatingControl()));
! connect( mplayerwindow->videoLayer(), SIGNAL(floatHidden()),
! this, SLOT(hideFloatingControls()));
connect( mplayerwindow, SIGNAL(floatShown()),
this, SLOT(showFloatingControl()));
! connect( mplayerwindow, SIGNAL(floatHidden()),
! this, SLOT(hideFloatingControls()));
connect( core, SIGNAL(showPermanentMessage(QString)),
this, SLOT(displayPermanentMessage(QString)));
--- 79,91 ----
connect( mplayerwindow->videoLayer(), SIGNAL(floatShown()),
this, SLOT(showFloatingControl()));
! // connect( mplayerwindow->videoLayer(), SIGNAL(floatHidden()),
! // this, SLOT(hideFloatingControls()));
connect( mplayerwindow, SIGNAL(floatShown()),
this, SLOT(showFloatingControl()));
! // connect( mplayerwindow, SIGNAL(floatHidden()),
! // this, SLOT(hideFloatingControls()));
connect( core, SIGNAL(showPermanentMessage(QString)),
this, SLOT(displayPermanentMessage(QString)));
***************
*** 400,406 ****
floating_control->setBypassWindowManager(pref->bypass_window_manager);
#endif
if(fade)
! fade->close();
fade = new FaderWidget(floating_control);
floating_control->showOver(panel, pref->floating_control_width);
fade->start();
--- 400,407 ----
floating_control->setBypassWindowManager(pref->bypass_window_manager);
#endif
if(fade)
! // fade->close();
! return;
fade = new FaderWidget(floating_control);
floating_control->showOver(panel, pref->floating_control_width);
fade->start();
***************
*** 595,604 ****
if(isFullScreen())
{
mediaBarPanel->hide();
! showFloatingControl();
mplayerwindow->startCheckMouseTimer();
mplayerwindow->videoLayer()->startCheckMouseTimer();
!
}
else
{
--- 596,609 ----
if(isFullScreen())
{
mediaBarPanel->hide();
! // showFloatingControl();
mplayerwindow->startCheckMouseTimer();
mplayerwindow->videoLayer()->startCheckMouseTimer();
!
! // Wating here 100ms for resizing MplayerWindow to show
! // FloatingWidget in proper place on screen
!
! QTimer::singleShot(100, this, SLOT(showFloatingControl()));
}
else
{
diff -crB original/floatingwidget.cpp edited/floatingwidget.cpp
*** original/floatingwidget.cpp 2010-10-22 23:18:46.000000000 +0200
--- edited/floatingwidget.cpp 2011-10-02 14:28:34.658109031 +0200
***************
*** 162,174 ****
connect( &auto_hide_timer, SIGNAL(timeout()),
this, SLOT(checkUnderMouse()) );
! setAutoHide(false);
}
FloatingWidget::~FloatingWidget() {
}
#ifndef Q_OS_WIN
void FloatingWidget::setBypassWindowManager(bool b) {
if (b) {
--- 162,187 ----
connect( &auto_hide_timer, SIGNAL(timeout()),
this, SLOT(checkUnderMouse()) );
! // setAutoHide(false);
! auto_hide = true;
}
FloatingWidget::~FloatingWidget() {
}
+ void FloatingWidget::show()
+ {
+ auto_hide_timer.start(2500);
+ QWidget::show();
+ }
+
+ void FloatingWidget::hide()
+ {
+ auto_hide_timer.stop();
+ QWidget::hide();
+ }
+
#ifndef Q_OS_WIN
void FloatingWidget::setBypassWindowManager(bool b) {
if (b) {
***************
*** 193,198 ****
--- 206,212 ----
void FloatingWidget::showOver(QWidget * widget, int size, Place place) {
qDebug("FloatingWidget::showOver");
+ setParent(widget);
int w = widget->width() * size / 100;
int h = height();
resize( w, h );
diff -crB original/floatingwidget.h edited/floatingwidget.h
*** original/floatingwidget.h 2010-10-22 23:18:46.000000000 +0200
--- edited/floatingwidget.h 2011-10-02 14:28:58.894229218 +0200
***************
*** 46,51 ****
--- 46,54 ----
void showOver(QWidget * widget, int size = 100, Place place = Bottom);
void showAnimated(QPoint final_position, Movement movement);
+
+ virtual void show();
+ virtual void hide();
I'm glad to see that my patch is working :-) Thanks for your correction, this was my first patch ever, so apparently, I made some mistakes.
I'd like to see my patch in upstream, what is going on with umplayer ... last commit 2 months ago?