Bug 141612 - Kst starts with smallest possible window size
Summary: Kst starts with smallest possible window size
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-12 23:21 UTC by Andrew Walker
Modified: 2007-05-02 19:07 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Walker 2007-02-12 23:21:37 UTC
Version:           HEAD (using KDE KDE 3.5.1)
Installed from:    Compiled From Sources
OS:                Linux

PROBLEM:
When Kst is started on a machine where it has never been run before the main application window is sized to be the smallest possible.

STEPS TO REPRDOUCE:
Start Kst on a machine where it has never been run before (or delete kst's configuration file)

RESULTS:
The application window is the smallest possible size.

EXPECTED RESULTS:
The application window should be maximised or some significant portion of the display.
Comment 1 Andrew Walker 2007-02-13 00:31:51 UTC
The configuration is typically saved as ~/.kde/share/config/kstrc
Comment 2 Andrew Walker 2007-02-14 00:55:26 UTC
SVN commit 633390 by arwalker:

CCBUG:141612 a marginal improvement in the initial size of the app. the height is still the minimum value

 M  +16 -0     kst.cpp  
 M  +2 -0      kst.h  


--- trunk/extragear/graphics/kst/src/libkstapp/kst.cpp #633389:633390
@@ -252,6 +252,22 @@
 }
 
 
+QSize KstApp::sizeHint() const
+{
+  QSize size(600, 480);
+
+  QDesktopWidget *desktop = QApplication::desktop();
+  if (desktop) {
+    QRect rect(desktop->availableGeometry());
+
+    size.setWidth(3*rect.width()/4);
+    size.setHeight(3*rect.height()/4);
+  }
+
+  return size;
+}
+
+
 void KstApp::initialize() {
   KstSettings::checkUpdates();
   kConfigObject = new KConfig("kstdatarc", false, false);
--- trunk/extragear/graphics/kst/src/libkstapp/kst.h #633389:633390
@@ -97,6 +97,8 @@
     KstApp(QWidget* parent=0, const char* name=0);
     ~KstApp();
 
+    virtual QSize sizeHint() const;
+
     static KstApp* inst();
     static void doubleCheckCleanup();
 
Comment 3 George Staikos 2007-02-14 01:08:03 UTC
If the desktop is Xinerama then this will result in an application  
window that spans across multiple screens which is quite ugly.

On 13-Feb-07, at 6:55 PM, Andrew Walker wrote:

> SVN commit 633390 by arwalker:
>
> CCBUG:141612 a marginal improvement in the initial size of the app.  
> the height is still the minimum value
>
>  M  +16 -0     kst.cpp
>  M  +2 -0      kst.h
>
>
> --- trunk/extragear/graphics/kst/src/libkstapp/kst.cpp #633389:633390
> @@ -252,6 +252,22 @@
>  }
>
>
> +QSize KstApp::sizeHint() const
> +{
> +  QSize size(600, 480);
> +
> +  QDesktopWidget *desktop = QApplication::desktop();
> +  if (desktop) {
> +    QRect rect(desktop->availableGeometry());
> +
> +    size.setWidth(3*rect.width()/4);
> +    size.setHeight(3*rect.height()/4);
> +  }
> +
> +  return size;
> +}
> +
> +
>  void KstApp::initialize() {
>    KstSettings::checkUpdates();
>    kConfigObject = new KConfig("kstdatarc", false, false);
> --- trunk/extragear/graphics/kst/src/libkstapp/kst.h #633389:633390
> @@ -97,6 +97,8 @@
>      KstApp(QWidget* parent=0, const char* name=0);
>      ~KstApp();
>
> +    virtual QSize sizeHint() const;
> +
>      static KstApp* inst();
>      static void doubleCheckCleanup();
>
> _______________________________________________
> Kst mailing list
> Kst@kde.org
> https://mail.kde.org/mailman/listinfo/kst
>


--
George Staikos
KDE Developer				http://www.kde.org/
Staikos Computing Services Inc.		http://www.staikos.net/
Comment 4 Andrew Walker 2007-02-14 19:20:38 UTC
Isn't the point of xinerama to display the desktop across multiple monitors. As a result any background image or maximized window will span multiple monitors. Given that a user is running xinerama I would have thought that having Kst span across multiple screens was exactly what they were after.
Comment 5 George Staikos 2007-02-14 20:01:46 UTC
The desktop, not the window.  No-one wants windows to span multiple  
screens.  It's horribly unpleasant.  Please see the KDE programming  
FAQ: http://developer.kde.org/documentation/other/developer-faq.html

This should be corrected for the next release.

--
George Staikos
KDE Developer				http://www.kde.org/
Staikos Computing Services Inc.		http://www.staikos.net/
Comment 6 Andrew Walker 2007-02-14 22:55:49 UTC
use KGlobalSettings to determine desktop size to prevent problems with xinerama and multi-heads
Comment 7 Netterfield 2007-02-17 00:18:24 UTC
Is this ready to close?
Comment 8 Andrew Walker 2007-02-17 00:33:25 UTC
Its better than it was. I think the full solution would be to check if there's a size saved away in kstrc and if not set the initial geometry in main.cpp.
Comment 9 George Staikos 2007-02-17 00:51:28 UTC
What's wrong with using the size hint?  I'm assuming this isn't somehow overriding the KMainWindow auto-save settings, so it should be fine...
Comment 10 Andrew Walker 2007-02-17 02:23:01 UTC
The size given by the size hint is not used as the final geometry. It seems to make the window grow in width, but no change in height. 
Comment 11 George Staikos 2007-02-17 02:25:31 UTC
That sounds like the old KMdi bug that has never been sorted out.

--
George Staikos
KDE Developer				http://www.kde.org/
Staikos Computing Services Inc.		http://www.staikos.net/
Comment 12 Adam Treat 2007-02-17 03:28:33 UTC
What? KMdi doesn't have any bugs!
Comment 13 Andrew Walker 2007-05-02 19:07:04 UTC
SVN commit 660418 by arwalker:

BUG:141612 Set the default window size to something reasonable the first time kst is run. On subsequent runs the value from kstrc will be used. Fixed for 1.5 release. Also removed obsolete FIXMEs.

 M  +5 -2      main.cpp  


--- branches/work/kst/1.5/kst/src/kst/main.cpp #660417:660418
@@ -24,6 +24,7 @@
 #include <kaboutdata.h>
 #include <kcmdlineargs.h>
 #include "ksdebug.h"
+#include <kglobalsettings.h>
 #include <kimageio.h>
 
 #include "dialoglauncher-gui.h"
@@ -415,6 +416,8 @@
 
     if (!print_and_exit) {
       app.setMainWidget(kst);
+      QRect rect = KGlobalSettings::desktopGeometry(kst);
+      kst->resize(5 * rect.width() / 6, 5 * rect.height() / 6);
       kst->show();
     }
 
@@ -542,7 +545,7 @@
                 if (yvector) {
                   // make the curves
                   color = KstColorSequence::next(vcurves,plot->backgroundColor());
-                  curve = new KstVCurve(KST::suggestCurveName(yvector->tag(), false), // FIXME: this was yvector->field(), is this right?
+                  curve = new KstVCurve(KST::suggestCurveName(yvector->tag(), false),
                                       KstVectorPtr(xvector), KstVectorPtr(yvector),
                                       0L, 0L, 0L, 0L, color);
                   if (in.has_points) {
@@ -667,7 +670,7 @@
 
                 KstHistogram::AutoBin(KstVectorPtr(yvector), &N, &max, &min);
 
-                hs = new KstHistogram(KST::suggestHistogramName(yvector->tag()), // FIXME: this was yvector->field(), is this right?
+                hs = new KstHistogram(KST::suggestHistogramName(yvector->tag()),
                     KstVectorPtr(yvector), min, max, N, KST_HS_NUMBER);
                 KstVCurvePtr vc = new KstVCurve(KST::suggestCurveName(hs->tag(), true),
                     hs->vX(), hs->vY(),