Bug 97347 - kpdf: unlucky fullscreen document placement with xinerama
Summary: kpdf: unlucky fullscreen document placement with xinerama
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kpdf
Classification: Applications
Component: general (show other bugs)
Version: 0.4
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Albert Astals Cid
URL:
Keywords:
: 97413 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-01-18 15:32 UTC by Daniel Franke
Modified: 2015-02-07 16:19 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
screenshot, the situation described before (308.43 KB, image/png)
2005-01-18 15:34 UTC, Daniel Franke
Details
A try to fix the problem (745 bytes, patch)
2005-01-23 17:07 UTC, Albert Astals Cid
Details
A try to fix the new problem (3.49 KB, patch)
2005-02-14 19:08 UTC, Albert Astals Cid
Details
A new try to fix the problem with screens with different resolutions (4.11 KB, patch)
2005-02-15 18:33 UTC, Albert Astals Cid
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Franke 2005-01-18 15:32:36 UTC
Version:           0.4 (using KDE KDE 3.3.91)
Installed from:    Compiled From Sources
Compiler:          gcc 3.3 
OS:                Linux

I've two screens side by side (Xinerama? - don't know the exact term) and therefore a resolution of 2560*1024 (more or less). 
Viewing a document in full screen mode, the left half is displayed on the left screen, the right half is not displayed at all (at least not on the right screen, I'm currently typing there, the left is occupied by the "full"-screen kpdf =)
Comment 1 Daniel Franke 2005-01-18 15:34:19 UTC
Created attachment 9153 [details]
screenshot, the situation described before

Version: kpdf 0.4, KDE 3.3.91, CVS 050113
Comment 2 Albert Astals Cid 2005-01-18 20:21:07 UTC
full screen mode or presentation mode?
Comment 3 Daniel Franke 2005-01-19 09:09:07 UTC
Presentation Mode:
View -> Presentation [F9]
Comment 4 Jakob Schröter 2005-01-19 11:06:11 UTC
*** Bug 97413 has been marked as a duplicate of this bug. ***
Comment 5 Albert Astals Cid 2005-01-21 23:32:12 UTC
What would the correct behaviour for you?
 - Having the presentation cover both screens
 - Having the presentation on only one of the screens
 - Something else
Comment 6 Shift 2005-01-23 15:29:06 UTC
Having the presentation covering only the current screen has other KDE apps do when using fullscreen
Comment 7 Albert Astals Cid 2005-01-23 16:45:33 UTC
Would any of you be able of testing a patch against CVS version?
Comment 8 Daniel Franke 2005-01-23 16:51:57 UTC
I would agree to #6 - might be a nice thing to have it configureable, though. 

I can test your patch, just let me know the exact command how/where to apply it (seems I can't get the hang of diff/patch *cough*)
Comment 9 Albert Astals Cid 2005-01-23 17:07:26 UTC
Created attachment 9234 [details]
A try to fix the problem

Just download the patch to kdegraphics/kpdf name it xinerama.patch while
saving, go there with a shell and do patch -p0 < xinerama.patch
Comment 10 Daniel Franke 2005-01-24 10:33:52 UTC
Applied the patch and it works as a charm - thnx! =)
Comment 11 Albert Astals Cid 2005-01-24 18:23:40 UTC
CVS commit by aacid: 

Fix presentation placement on xinerama
BUG: 97347


  M +3 -3      presentationwidget.cpp   1.16


--- kdegraphics/kpdf/ui/presentationwidget.cpp  #1.15:1.16
@@ -53,7 +53,7 @@ PresentationWidget::PresentationWidget( 
     // set look and geometry
     setBackgroundMode( Qt::NoBackground );
-    QDesktopWidget * d = QApplication::desktop();
-    m_width = d->width();
-    m_height = d->height();
+    QRect d = KGlobalSettings::desktopGeometry(this);
+    m_width = d.width();
+    m_height = d.height();
 
     // create top toolbar


Comment 12 Olaf Bonorden 2005-02-10 11:17:32 UTC
Does not work here, position is ok, but size of presentation is taken from the other (first) screen.

First screen: 1400x1050, second screen 1280x1024, presentation is shown on second display but right (and bottom) part is missing.

Can we reopen the bug or should i create a new report?
Comment 13 Albert Astals Cid 2005-02-10 20:14:50 UTC
Reopening the bug as seems it still has issues, thanks for reporting.
Comment 14 Albert Astals Cid 2005-02-12 00:28:38 UTC
Hi Olaf, can you please download that executable and run it on you PC. Try starting it from a konsole in your first screen, and the on your second screen and please paste here the text that is outputted in both cases to the konsole.
Test program: http://usuarios.lycos.es/tsdgeos/test

If you have problems getting the executable to run download the source from http://usuarios.lycos.es/tsdgeos/test.cpp
Comment 15 Olaf Bonorden 2005-02-14 10:07:01 UTC
Sorry for the delay, but i cannot run your program. Without xinerama no problem, but with two displays i allways got a segmentation fault. Binary or compiled from source, same error.

KDE version 3.3.92-1 (rpms for SuSE from ftp://ftp.gwdg.de/pub/linux/suse/apt/SuSE/9.2-i386/RPMS.kde-unstable)

Starting program: /home/bono/Documents/test
[Thread debugging using libthread_db enabled]
[New Thread 1096357376 (LWP 30576)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1096357376 (LWP 30576)]
0x40190fa7 in KInstance::config () from /opt/kde3/lib/libkdecore.so.4
(gdb) bt
#0  0x40190fa7 in KInstance::config () from /opt/kde3/lib/libkdecore.so.4
#1  0x40191872 in KGlobal::config () from /opt/kde3/lib/libkdecore.so.4
#2  0x401afad5 in KGlobalSettings::desktopGeometry ()
   from /opt/kde3/lib/libkdecore.so.4
#3  0x0804b448 in myWindow (this=0x8133ac0) at test.cpp:10
#4  0x0804b371 in main (argc=1, argv=0xbfffda24) at test.cpp:28

Comment 16 Albert Astals Cid 2005-02-14 11:53:37 UTC
Sorry, i've updated the source of the test(not the binary because i don't have a suitable PC here) can you please retest.
Comment 17 Olaf Bonorden 2005-02-14 13:19:29 UTC
First display (size 1400x1050):

Creator size 1400 1050
Paint Event size 1400 1050

Second display (size 1280x1024 right of display 1)

Creator size 1400 1050
Paint Event size 1280 1024
Comment 18 Albert Astals Cid 2005-02-14 19:08:29 UTC
Created attachment 9628 [details]
A try to fix the new problem

Can you try if that patch solves the problem?
If you don't know how to apply a patch read Comment #9
Comment 19 Olaf Bonorden 2005-02-15 14:50:40 UTC
I've checked out kdegraphics and apply your patch. First display ok, but if i start presentation mode on the second display i got a segfault.

I haven't updated kdelibs etc., still using precompiled binary labeled 3.3.92_2005021408, qt-3.3.4

Using host libthread_db library "/lib/tls/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread 1096002848 (LWP 1746)]
[KCrash handler]
#3  0x417efd21 in PresentationWidget::mouseMoveEvent (this=0x83c7b78, 
    e=0xbfffe9a0) at qwidget.h:860
#4  0x40c758da in QWidget::event () from /usr/lib/qt3/lib/libqt-mt.so.3
#5  0x40bdcbaf in QApplication::internalNotify ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#6  0x40bdef56 in QApplication::notify () from /usr/lib/qt3/lib/libqt-mt.so.3
#7  0x408465e1 in KApplication::notify () from /opt/kde3/lib/libkdecore.so.4
#8  0x40b7a25e in QETWidget::translateMouseEvent ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#9  0x40b79116 in QApplication::x11ProcessEvent ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#10 0x40b89b08 in QEventLoop::processEvents ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#11 0x40bf4b41 in QEventLoop::enterLoop () from /usr/lib/qt3/lib/libqt-mt.so.3
#12 0x40bf4986 in QEventLoop::exec () from /usr/lib/qt3/lib/libqt-mt.so.3
#13 0x40bde63f in QApplication::exec () from /usr/lib/qt3/lib/libqt-mt.so.3
#14 0x0804f577 in main (argc=1, argv=0xbffff104) at main.cpp:80
Comment 20 Albert Astals Cid 2005-02-15 18:33:01 UTC
Created attachment 9649 [details]
A new try to fix the problem with screens with different resolutions

Ok Olaf, here is a new try, revert the previous patch (patch -R -p0 <
xinerama.patch) and then apply the new one.

By the way, thanks a lot for the testing.
Comment 21 Olaf Bonorden 2005-02-16 10:45:32 UTC
Ok, works perfectly on both display.

Thank you for the bugfix and your great work! Now i do not need to start windows for presentations :-)

I'm developing distributed parallel programs (linux,cray,...), so i know the need of testers for different environments.
Comment 22 Albert Astals Cid 2005-02-16 18:19:53 UTC
CVS commit by aacid: 

Delay the calculation of m_width and m_height (and all its associated things) until first time the widget is shown (paintEvent), doing KGlobalSettings::desktopGeometry(this); in PresentationWidget::PresentationWidget always returns the geometry of the first screen, so it must be done in paintEvent (for example), where the widget has already been shown and KGlobalSettings::desktopGeometry(this); returns the geometry of the correct screen.
Thanks to Olaf Bonorden for the patch testing
BUGS: 97347


  M +39 -29    presentationwidget.cpp   1.21


--- kdegraphics/kpdf/ui/presentationwidget.cpp  #1.20:1.21
@@ -53,23 +53,9 @@ PresentationWidget::PresentationWidget( 
     // set look and geometry
     setBackgroundMode( Qt::NoBackground );
-    QRect d = KGlobalSettings::desktopGeometry(this);
-    m_width = d.width();
-    m_height = d.height();
 
-    // create top toolbar
-    m_topBar = new KToolBar( this, "presentationBar" );
-    m_topBar->setIconSize( 32 );
-    m_topBar->setMovingEnabled( false );
-    m_topBar->insertButton( "1leftarrow", 2, SIGNAL( clicked() ), this, SLOT( slotPrevPage() ) );
-    m_topBar->insertButton( "1rightarrow", 3, SIGNAL( clicked() ), this, SLOT( slotNextPage() ) );
-    m_topBar->insertButton( "exit", 1, SIGNAL( clicked() ), this, SLOT( close() ) );
-    m_topBar->setGeometry( 0, 0, m_width, 32 + 10 );
-    m_topBar->alignItemRight( 1 );
-    m_topBar->hide();
-    // change topbar background color
-    QPalette p = m_topBar->palette();
-    p.setColor( QPalette::Active, QColorGroup::Button, Qt::gray );
-    p.setColor( QPalette::Active, QColorGroup::Background, Qt::darkGray );
-    m_topBar->setPalette( p );
+    m_width = -1;
+
+    // show widget and take control
+    showFullScreen();
 
     // misc stuff
@@ -80,7 +66,4 @@ PresentationWidget::PresentationWidget( 
     connect( m_overlayHideTimer, SIGNAL( timeout() ), this, SLOT( slotHideOverlay() ) );
 
-    // show widget and take control
-    showFullScreen();
-
     // handle cursor appearance as specified in configuration
     if ( Settings::slidesCursor() == Settings::EnumSlidesCursor::HiddenDelay )
@@ -93,11 +76,4 @@ PresentationWidget::PresentationWidget( 
         setCursor( KCursor::blankCursor() );
     }
-
-    // register this observer in document. events will come immediately
-    m_document->addObserver( this );
-
-    // show summary if requested
-    if ( Settings::slidesShowSummary() )
-        generatePage();
 }
 
@@ -195,4 +171,6 @@ bool PresentationWidget::canUnloadPixmap
 void PresentationWidget::keyPressEvent( QKeyEvent * e )
 {
+    if (m_width == -1) return;
+        
     if ( e->key() == Key_Left || e->key() == Key_Backspace )
         slotPrevPage();
@@ -245,4 +223,6 @@ void PresentationWidget::mousePressEvent
 void PresentationWidget::mouseMoveEvent( QMouseEvent * e )
 {
+    if (m_width == -1) return;
+        
     // hide a shown bar when exiting the area
     if ( m_topBar->isShown() )
@@ -261,4 +241,34 @@ void PresentationWidget::mouseMoveEvent(
 void PresentationWidget::paintEvent( QPaintEvent * pe )
 {
+    if (m_width == -1)
+    {
+        QRect d = KGlobalSettings::desktopGeometry(this);
+        m_width = d.width();
+        m_height = d.height();
+
+        // create top toolbar
+        m_topBar = new KToolBar( this, "presentationBar" );
+        m_topBar->setIconSize( 32 );
+        m_topBar->setMovingEnabled( false );
+        m_topBar->insertButton( "1leftarrow", 2, SIGNAL( clicked() ), this, SLOT( slotPrevPage() ) );
+        m_topBar->insertButton( "1rightarrow", 3, SIGNAL( clicked() ), this, SLOT( slotNextPage() ) );
+        m_topBar->insertButton( "exit", 1, SIGNAL( clicked() ), this, SLOT( close() ) );
+        m_topBar->setGeometry( 0, 0, m_width, 32 + 10 );
+        m_topBar->alignItemRight( 1 );
+        m_topBar->hide();
+        // change topbar background color
+        QPalette p = m_topBar->palette();
+        p.setColor( QPalette::Active, QColorGroup::Button, Qt::gray );
+        p.setColor( QPalette::Active, QColorGroup::Background, Qt::darkGray );
+        m_topBar->setPalette( p );
+
+        // register this observer in document. events will come immediately
+        m_document->addObserver( this );
+
+        // show summary if requested
+        if ( Settings::slidesShowSummary() )
+            generatePage();
+    }
+
     // check painting rect consistancy
     QRect r = pe->rect().intersect( geometry() );


Comment 23 Brendon Higgins 2008-01-11 07:29:02 UTC
Hi there,

I'm getting the same problem with my current version of kpdf as described by this 3 year old bug. The screenshot supplied by the original reporter corresponds perfectly with what I'm seeing. I'm not using Xinerama but xrandr to configure my second screen, which I guess might be why it's happening again. Debian testing, kpdf 0.5.8, powerpc.

Peace,
Brendon
Comment 24 Albert Astals Cid 2008-01-12 12:12:06 UTC
Reopening, unfortunately i don't know how to further debug the problem though
Comment 25 Albert Astals Cid 2015-02-07 16:19:26 UTC
Thank you for your bug report or feature suggestion.

The "KPDF" application is no longer maintained, and all tickets are now closed.

We recommend to switch to the "Okular" application.

Due to the high number of bugs/suggestions in "KPDF" we are not able to go through all of them and verify if they are still valid in "Okular".

That's why are we asking you to help us by checking if your bug/suggestion is still valid in Okular and if it still is opening a new bug/suggestion against it.

Thank you for your effort in making KDE better :)

(This is an automatic message from the KDE bug triaging team)