Resize accordingly when we are resized from "outside" (eg by the WM).

BUG: 173545

svn path=/trunk/KDE/kdegraphics/okular/; revision=890639
remotes/origin/old/work/record-presentation
Pino Toscano 18 years ago
parent 3ebce5aaf5
commit 9d1977d645
  1. 19
      ui/presentationwidget.cpp
  2. 2
      ui/presentationwidget.h

@ -620,6 +620,17 @@ void PresentationWidget::paintEvent( QPaintEvent * pe )
}
painter.end();
}
void PresentationWidget::resizeEvent( QResizeEvent *re )
{
// kDebug() << re->oldSize() << "=>" << re->size();
if ( re->oldSize() == QSize( -1, -1 ) )
return;
m_screen = QApplication::desktop()->screenNumber( this );
applyNewScreenSize( re->oldSize() );
}
// </widget events>
@ -1307,6 +1318,11 @@ void PresentationWidget::setScreen( int newScreen )
m_screen = newScreen;
setGeometry( screenGeom );
applyNewScreenSize( oldSize );
}
void PresentationWidget::applyNewScreenSize( const QSize & oldSize )
{
repositionContent();
// if by chance the new screen has the same resolution of the previous,
@ -1325,6 +1341,8 @@ void PresentationWidget::setScreen( int newScreen )
(*fIt)->recalcGeometry( m_width, m_height, screenRatio );
}
if ( m_frameIndex != -1 )
{
// ugliness alarm!
const_cast< Okular::Page * >( m_frames[ m_frameIndex ]->page )->deletePixmap( PRESENTATION_ID );
// force the regeneration of the pixmap
@ -1332,6 +1350,7 @@ void PresentationWidget::setScreen( int newScreen )
m_blockNotifications = true;
requestPixmaps();
m_blockNotifications = false;
}
generatePage( true /* no transitions */ );
}

@ -64,6 +64,7 @@ class PresentationWidget : public QWidget, public Okular::DocumentObserver
void mouseReleaseEvent( QMouseEvent * e );
void mouseMoveEvent( QMouseEvent * e );
void paintEvent( QPaintEvent * e );
void resizeEvent( QResizeEvent * e );
private:
const Okular::Action * getLink( int x, int y, QRect * geometry = 0 ) const;
@ -83,6 +84,7 @@ class PresentationWidget : public QWidget, public Okular::DocumentObserver
void repositionContent();
void requestPixmaps();
void setScreen( int );
void applyNewScreenSize( const QSize & oldSize );
void inhibitScreenSaver();
void allowScreenSaver();
// create actions that interact with this widget

Loading…
Cancel
Save