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

List:       kde-devel
Subject:    Re: [PATCH] b2client, third try
From:       Luciano Montanaro <mikelima () virgilio ! it>
Date:       2002-04-02 9:09:21
[Download RAW message or body]

On Sunday 31 March 2002 20:18, Carsten Pfeiffer wrote:
> On Sunday 31 March 2002 17:27, mikelima@virgilio.it wrote:
> > This other patch appears to work, and it should not leak anything.
> > KdeDefaultClient should be changed the same way, by the way.
> >
> > +    static QTime t;
>
> That would work in theory, but unfortunately, there is a bug in older
> glibcs, that may cause crashes when unloading the library. So I'd suggest
> either using a member variable or passing "this" as argument to the
> (heap-allocated) timer, so that it will be destroyed automatically when
> "this" is destroyed.
>
> Cheers
> Carsten Pfeiffer
What about this, then? 
This one also support spacers in the window title. I find them useful to
e.g. separate the close button from the others.


-- 
Luciano Montanaro//
               \x/ mikelima@virgilio.it

["b2.diff" (text/x-diff)]

diff -u b2/b2client.cpp b2.ml/b2client.cpp
--- b2/b2client.cpp	Sat Nov  3 02:21:40 2001
+++ b2.ml/b2client.cpp	Tue Apr  2 07:42:29 2002
@@ -500,6 +500,8 @@
                             this, SLOT(closeWindow()));
                     titleLayout->addWidget(button[BtnClose]);
                 }
+	    case '_': // Spacer item (only for non-tool windows)
+		if (!isTool()) titleLayout->addSpacing(2);
 	}
     } 
 }
@@ -778,16 +780,24 @@
 
 void B2Client::menuButtonPressed()
 {
-    workspace()->clientPopup(this)->
-        popup(button[BtnMenu]->mapToGlobal(button[BtnMenu]->
-                                           rect().bottomLeft()));
+    static B2Client* tc = 0;
+
+    if (tc != this || t.elapsed() > QApplication::doubleClickInterval()) {
+        workspace()->clientPopup(this)->popup(
+		button[BtnMenu]->mapToGlobal(
+		    button[BtnMenu]->rect().bottomLeft()));
+    } else {
+        closeWindow();
+    }
+    t.start();
+    tc = this;
 }
 
 void B2Client::slotReset()
 {
     redraw_pixmaps();
-    QColor c = options->colorGroup(Options::TitleBar, isActive()).
-        color(QColorGroup::Button);
+    QColor c = options->colorGroup(Options::TitleBar, 
+		    isActive()).color(QColorGroup::Button);
 
     for(int i = 0; i < BtnCount; i++)
         if (button[i]) {
diff -u b2/b2client.h b2.ml/b2client.h
--- b2/b2client.h	Sat Sep  8 12:12:23 2001
+++ b2.ml/b2client.h	Tue Apr  2 08:00:01 2002
@@ -12,6 +12,7 @@
 
 #include <qvariant.h>
 #include <qbitmap.h>
+#include <qdatetime.h>
 #include <kpixmap.h>
 #include "../../client.h"
 #include "../../kwinbutton.h"
@@ -118,6 +119,7 @@
         BtnHelp, BtnCount};
     B2Button* button[BtnCount];
     QGridLayout *g;
+    QTime t;
     int bar_x_ofs;
     B2Titlebar *titlebar;
     int in_unobs;

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

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

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