@@ -628,8 +628,30 @@ MainWindow::MainWindow(QWidget *parent)
628
628
qDebug () << __func__ << _engine->state ();
629
629
if (_engine->state () == PlayerEngine::CoreState::Playing) {
630
630
_miniPlayBtn->setObjectName (" MiniPauseBtn" );
631
+
632
+ if (_lastCookie > 0 ) {
633
+ utils::UnInhibitStandby (_lastCookie);
634
+ qDebug () << " uninhibit cookie" << _lastCookie;
635
+ _lastCookie = 0 ;
636
+ }
637
+ if (_powerCookie > 0 ) {
638
+ utils::UnInhibitPower (_powerCookie);
639
+ _powerCookie = 0 ;
640
+ }
641
+ _lastCookie = utils::InhibitStandby ();
642
+ _powerCookie = utils::InhibitPower ();
631
643
} else {
632
644
_miniPlayBtn->setObjectName (" MiniPlayBtn" );
645
+
646
+ if (_lastCookie > 0 ) {
647
+ utils::UnInhibitStandby (_lastCookie);
648
+ qDebug () << " uninhibit cookie" << _lastCookie;
649
+ _lastCookie = 0 ;
650
+ }
651
+ if (_powerCookie > 0 ) {
652
+ utils::UnInhibitPower (_powerCookie);
653
+ _powerCookie = 0 ;
654
+ }
633
655
}
634
656
_miniPlayBtn->setStyleSheet (_miniPlayBtn->styleSheet ());
635
657
});
@@ -851,26 +873,26 @@ void MainWindow::onWindowStateChanged()
851
873
{
852
874
qDebug () << windowState ();
853
875
854
- if (!isFullScreen ()) {
855
- qApp->restoreOverrideCursor ();
856
- if (_lastCookie > 0 ) {
857
- utils::UnInhibitStandby (_lastCookie);
858
- qDebug () << " uninhibit cookie" << _lastCookie;
859
- _lastCookie = 0 ;
860
- }
861
- if (_listener) _listener->setEnabled (!isMaximized () && !_miniMode);
862
- } else {
863
- qApp->setOverrideCursor (Qt::BlankCursor);
864
-
865
- if (_lastCookie > 0 ) {
866
- utils::UnInhibitStandby (_lastCookie);
867
- qDebug () << " uninhibit cookie" << _lastCookie;
868
- _lastCookie = 0 ;
869
- }
870
- _lastCookie = utils::InhibitStandby ();
871
- qDebug () << " inhibit cookie" << _lastCookie;
872
- if (_listener) _listener->setEnabled (false );
873
- }
876
+ // if (!isFullScreen()) {
877
+ // qApp->restoreOverrideCursor();
878
+ // if (_lastCookie > 0) {
879
+ // utils::UnInhibitStandby(_lastCookie);
880
+ // qDebug() << "uninhibit cookie" << _lastCookie;
881
+ // _lastCookie = 0;
882
+ // }
883
+ // if (_listener) _listener->setEnabled(!isMaximized() && !_miniMode);
884
+ // } else {
885
+ // qApp->setOverrideCursor(Qt::BlankCursor);
886
+
887
+ // if (_lastCookie > 0) {
888
+ // utils::UnInhibitStandby(_lastCookie);
889
+ // qDebug() << "uninhibit cookie" << _lastCookie;
890
+ // _lastCookie = 0;
891
+ // }
892
+ // _lastCookie = utils::InhibitStandby();
893
+ // qDebug() << "inhibit cookie" << _lastCookie;
894
+ // if (_listener) _listener->setEnabled(false);
895
+ // }
874
896
if (!_miniMode && !isFullScreen ()) {
875
897
_titlebar->setVisible (_toolbox->isVisible ());
876
898
} else {
@@ -969,6 +991,16 @@ MainWindow::~MainWindow()
969
991
disconnect (_engine, 0 , 0 , 0 );
970
992
disconnect (&_engine->playlist (), 0 , 0 , 0 );
971
993
994
+ if (_lastCookie > 0 ) {
995
+ utils::UnInhibitStandby (_lastCookie);
996
+ qDebug () << " uninhibit cookie" << _lastCookie;
997
+ _lastCookie = 0 ;
998
+ }
999
+ if (_powerCookie > 0 ) {
1000
+ utils::UnInhibitPower (_powerCookie);
1001
+ _powerCookie = 0 ;
1002
+ }
1003
+
972
1004
#ifdef USE_DXCB
973
1005
if (_evm) {
974
1006
disconnect (_evm, 0 , 0 , 0 );
0 commit comments