[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    kcontrol patch- please review
From:       Dima Rogozin <dima () mercury ! co ! il>
Date:       1999-09-19 16:56:05
[Download RAW message or body]

Hi,

I have fixed some geometry issues in kcontrol and 
I would like somebody to review the patch.

Problem: 
kcontrol doesn't have minimalSize limit and 
can be resized by user to zero-size window. 
The complexity here is that kcontrol doesn't
know about minimal size of an applet because 
it belong to another process.

Solution: 
Use WMHints to get the minimal size info 
from the X window.

TODO: 
Kontrol applets do not resize well for it minimal size.
OK button goes under Default. 
Seems to be KControlApplication problem.

Let me know if this looks OK for you and 
if the addressed problem worth the solution at all.
Dima.


diff -Naur kcontrol.orig/configlist.cpp kcontrol/configlist.cpp
--- kcontrol.orig/configlist.cpp	Sun Sep 19 12:39:19 1999
+++ kcontrol/configlist.cpp	Sun Sep 19 12:38:36 1999
@@ -255,6 +255,8 @@
 
         swallowWidget->resize(swallowParent->width(),
swallowParent->height());
 
+	swallowParent->setMinimumSize(swallowWidget->minimumSize());
+
 	swallowWidget->raise();
 	swallowWidget->show();
 
diff -Naur kcontrol.orig/kswallow.cpp kcontrol/kswallow.cpp
--- kcontrol.orig/kswallow.cpp	Sun Sep 19 12:39:12 1999
+++ kcontrol/kswallow.cpp	Sun Sep 19 12:38:22 1999
@@ -55,6 +55,16 @@
 
   orig = QSize(width,height);
 
+  // Define minimum size for the widged 
+  // from the hints provided by window 
+  XSizeHints hints;
+  long flags;
+  if(XGetWMNormalHints(qt_xdisplay(), w, &hints, &flags) != 0 &&
+     (flags & PMinSize) != 0) {
+    setMinimumSize(hints.min_width, hints.min_height);
+    parentWidget()->setMinimumSize(hints.min_width, hints.min_height); 
+  }
+  
   QXEmbed::embed( w );
   show();
 }
diff -Naur kcontrol.orig/kswallow.h kcontrol/kswallow.h
--- kcontrol.orig/kswallow.h	Sun Sep 19 12:39:12 1999
+++ kcontrol/kswallow.h	Sun Sep 19 12:38:17 1999
@@ -25,6 +25,8 @@
 
 
 #include <X11/X.h>
+#include <X11/Xutil.h>
+
 #include <qwidget.h>
 #include <qstring.h>
 #include <qxembed.h>
diff -Naur kcontrol.orig/toplevel.cpp kcontrol/toplevel.cpp
--- kcontrol.orig/toplevel.cpp	Sun Sep 19 12:39:27 1999
+++ kcontrol/toplevel.cpp	Sun Sep 19 12:38:43 1999
@@ -58,19 +58,18 @@
   treelist->addColumn("");
   treelist->header()->hide();
   configList->fillTreeList(treelist);
-  treelist->setMinimumWidth(200);
+  treelist->setMinimumSize(200, 400);
   splitter->setResizeMode(treelist,QSplitter::KeepSize);
 
   mwidget = new mainWidget(splitter);
+  mwidget->setMinimumSize(450, 400);
+
   connect(mwidget, SIGNAL(resized()), this, SLOT(doResize()));
 
   connect(treelist, SIGNAL(selectionChanged(QListViewItem*)), this,
SLOT(itemSelected(QListViewItem*)));
   connect(treelist, SIGNAL(returnPressed(QListViewItem*)), this,
SLOT(itemSelected(QListViewItem*)));
 
   setView(splitter);
-  setMinimumSize(450,200);
-
-  resize(700,600);
 
   show();
   resizeEvent(NULL);

[Attachment #3 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2448.0">
<TITLE>kcontrol patch- please review</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Hi,</FONT>
</P>

<P><FONT SIZE=2>I have fixed some geometry issues in kcontrol and </FONT>
<BR><FONT SIZE=2>I would like somebody to review the patch.</FONT>
</P>

<P><FONT SIZE=2>Problem: </FONT>
<BR><FONT SIZE=2>kcontrol doesn't have minimalSize limit and </FONT>
<BR><FONT SIZE=2>can be resized by user to zero-size window. </FONT>
<BR><FONT SIZE=2>The complexity here is that kcontrol doesn't</FONT>
<BR><FONT SIZE=2>know about minimal size of an applet because </FONT>
<BR><FONT SIZE=2>it belong to another process.</FONT>
</P>

<P><FONT SIZE=2>Solution: </FONT>
<BR><FONT SIZE=2>Use WMHints to get the minimal size info </FONT>
<BR><FONT SIZE=2>from the X window.</FONT>
</P>

<P><FONT SIZE=2>TODO: </FONT>
<BR><FONT SIZE=2>Kontrol applets do not resize well for it minimal size.</FONT>
<BR><FONT SIZE=2>OK button goes under Default. </FONT>
<BR><FONT SIZE=2>Seems to be KControlApplication problem.</FONT>
</P>

<P><FONT SIZE=2>Let me know if this looks OK for you and </FONT>
<BR><FONT SIZE=2>if the addressed problem worth the solution at all.</FONT>
<BR><FONT SIZE=2>Dima.</FONT>
</P>
<BR>

<P><FONT SIZE=2>diff -Naur kcontrol.orig/configlist.cpp \
kcontrol/configlist.cpp</FONT> <BR><FONT SIZE=2>--- \
kcontrol.orig/configlist.cpp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sun Sep 19 \
12:39:19 1999</FONT> <BR><FONT SIZE=2>+++ \
kcontrol/configlist.cpp&nbsp;&nbsp;&nbsp;&nbsp; Sun Sep 19 12:38:36 1999</FONT> \
<BR><FONT SIZE=2>@@ -255,6 +255,8 @@</FONT> <BR><FONT SIZE=2>&nbsp;</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
swallowWidget-&gt;resize(swallowParent-&gt;width(), \
swallowParent-&gt;height());</FONT> <BR><FONT SIZE=2>&nbsp;</FONT>
<BR><FONT SIZE=2>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
swallowParent-&gt;setMinimumSize(swallowWidget-&gt;minimumSize());</FONT> <BR><FONT \
SIZE=2>+</FONT> <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
swallowWidget-&gt;raise();</FONT> <BR><FONT \
SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; swallowWidget-&gt;show();</FONT> \
<BR><FONT SIZE=2>&nbsp;</FONT> <BR><FONT SIZE=2>diff -Naur kcontrol.orig/kswallow.cpp \
kcontrol/kswallow.cpp</FONT> <BR><FONT SIZE=2>--- kcontrol.orig/kswallow.cpp&nbsp; \
Sun Sep 19 12:39:12 1999</FONT> <BR><FONT SIZE=2>+++ \
kcontrol/kswallow.cpp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sun Sep 19 12:38:22 \
1999</FONT> <BR><FONT SIZE=2>@@ -55,6 +55,16 @@</FONT>
<BR><FONT SIZE=2>&nbsp;</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; orig = QSize(width,height);</FONT>
<BR><FONT SIZE=2>&nbsp;</FONT>
<BR><FONT SIZE=2>+&nbsp; // Define minimum size for the widged </FONT>
<BR><FONT SIZE=2>+&nbsp; // from the hints provided by window </FONT>
<BR><FONT SIZE=2>+&nbsp; XSizeHints hints;</FONT>
<BR><FONT SIZE=2>+&nbsp; long flags;</FONT>
<BR><FONT SIZE=2>+&nbsp; if(XGetWMNormalHints(qt_xdisplay(), w, &amp;hints, \
&amp;flags) != 0 &amp;&amp;</FONT> <BR><FONT SIZE=2>+&nbsp;&nbsp;&nbsp;&nbsp; (flags \
&amp; PMinSize) != 0) {</FONT> <BR><FONT SIZE=2>+&nbsp;&nbsp;&nbsp; \
setMinimumSize(hints.min_width, hints.min_height);</FONT> <BR><FONT \
SIZE=2>+&nbsp;&nbsp;&nbsp; parentWidget()-&gt;setMinimumSize(hints.min_width, \
hints.min_height); </FONT> <BR><FONT SIZE=2>+&nbsp; }</FONT>
<BR><FONT SIZE=2>+&nbsp; </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; QXEmbed::embed( w );</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; show();</FONT>
<BR><FONT SIZE=2>&nbsp;}</FONT>
<BR><FONT SIZE=2>diff -Naur kcontrol.orig/kswallow.h kcontrol/kswallow.h</FONT>
<BR><FONT SIZE=2>--- kcontrol.orig/kswallow.h&nbsp;&nbsp;&nbsp; Sun Sep 19 12:39:12 \
1999</FONT> <BR><FONT SIZE=2>+++ kcontrol/kswallow.h Sun Sep 19 12:38:17 1999</FONT>
<BR><FONT SIZE=2>@@ -25,6 +25,8 @@</FONT>
<BR><FONT SIZE=2>&nbsp;</FONT>
<BR><FONT SIZE=2>&nbsp;</FONT>
<BR><FONT SIZE=2>&nbsp;#include &lt;X11/X.h&gt;</FONT>
<BR><FONT SIZE=2>+#include &lt;X11/Xutil.h&gt;</FONT>
<BR><FONT SIZE=2>+</FONT>
<BR><FONT SIZE=2>&nbsp;#include &lt;qwidget.h&gt;</FONT>
<BR><FONT SIZE=2>&nbsp;#include &lt;qstring.h&gt;</FONT>
<BR><FONT SIZE=2>&nbsp;#include &lt;qxembed.h&gt;</FONT>
<BR><FONT SIZE=2>diff -Naur kcontrol.orig/toplevel.cpp kcontrol/toplevel.cpp</FONT>
<BR><FONT SIZE=2>--- kcontrol.orig/toplevel.cpp&nbsp; Sun Sep 19 12:39:27 1999</FONT>
<BR><FONT SIZE=2>+++ kcontrol/toplevel.cpp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sun \
Sep 19 12:38:43 1999</FONT> <BR><FONT SIZE=2>@@ -58,19 +58,18 @@</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; treelist-&gt;addColumn(&quot;&quot;);</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; treelist-&gt;header()-&gt;hide();</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; configList-&gt;fillTreeList(treelist);</FONT>
<BR><FONT SIZE=2>-&nbsp; treelist-&gt;setMinimumWidth(200);</FONT>
<BR><FONT SIZE=2>+&nbsp; treelist-&gt;setMinimumSize(200, 400);</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; \
splitter-&gt;setResizeMode(treelist,QSplitter::KeepSize);</FONT> <BR><FONT \
SIZE=2>&nbsp;</FONT> <BR><FONT SIZE=2>&nbsp;&nbsp; mwidget = new \
mainWidget(splitter);</FONT> <BR><FONT SIZE=2>+&nbsp; mwidget-&gt;setMinimumSize(450, \
400);</FONT> <BR><FONT SIZE=2>+</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; connect(mwidget, SIGNAL(resized()), this, \
SLOT(doResize()));</FONT> <BR><FONT SIZE=2>&nbsp;</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; connect(treelist, \
SIGNAL(selectionChanged(QListViewItem*)), this, \
SLOT(itemSelected(QListViewItem*)));</FONT> <BR><FONT SIZE=2>&nbsp;&nbsp; \
connect(treelist, SIGNAL(returnPressed(QListViewItem*)), this, \
SLOT(itemSelected(QListViewItem*)));</FONT> <BR><FONT SIZE=2>&nbsp;</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; setView(splitter);</FONT>
<BR><FONT SIZE=2>-&nbsp; setMinimumSize(450,200);</FONT>
<BR><FONT SIZE=2>-</FONT>
<BR><FONT SIZE=2>-&nbsp; resize(700,600);</FONT>
<BR><FONT SIZE=2>&nbsp;</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; show();</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; resizeEvent(NULL);</FONT>
</P>

</BODY>
</HTML>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic