[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: [patch] b2 window decoration
From: Luciano Montanaro <mikelima () virgilio ! it>
Date: 2002-07-23 9:40:27
[Download RAW message or body]
Hello,
this patch has been ignored for a while on the kwin list.
The stirring about the inconsistent menu button double click
made me dig again for it, for a possible inclusion.
My original message and patch follows.
Luciano
Hello,
I played around a bit with the b2 client for kwin.
I added the ability to double-click on the menu button to close the window,
as most other clients do, and adding spacers now works.
I sent the patch to kde-devel for review (bad place, probably), and someone
hinted that the QTime * in the double click code is leaked when changing
theme. I changed my code around, and here is the result.
I also fixed the default theme.
If the patches are good, I'd like them to be applied to both the trunk and
KDE 3.0 branches.
--
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;
["default.diff" (text/x-diff)]
Common subdirectories: default.orig/.deps and default/.deps
Only in default.orig/: .libs
Common subdirectories: default.orig/CVS and default/CVS
Common subdirectories: default.orig/config and default/config
diff -u default.orig/kdedefault.cpp default/kdedefault.cpp
--- default.orig/kdedefault.cpp Fri Apr 5 21:22:17 2002
+++ default/kdedefault.cpp Fri Apr 5 21:23:59 2002
@@ -1064,12 +1064,9 @@
// Make sure the menu button follows double click conventions set in kcontrol
void KDEDefaultClient::menuButtonPressed()
{
- static QTime* t = 0;
static KDEDefaultClient* tc = 0;
- if ( !t )
- t = new QTime;
- if ( tc != this || t->elapsed() > QApplication::doubleClickInterval() )
+ if ( tc != this || t.elapsed() > QApplication::doubleClickInterval() )
{
QPoint menupoint ( button[BtnMenu]->rect().bottomLeft().x()-1,
button[BtnMenu]->rect().bottomLeft().y()+2 );
@@ -1078,7 +1075,7 @@
}
else closeWindow();
- t->start();
+ t.start();
tc = this;
}
diff -u default.orig/kdedefault.h default/kdedefault.h
--- default.orig/kdedefault.h Fri Apr 5 21:22:17 2002
+++ default/kdedefault.h Tue Apr 9 15:09:59 2002
@@ -16,6 +16,7 @@
#include <qbutton.h>
#include <qbitmap.h>
+#include <qdatetime.h>
#include <kpixmap.h>
#include "../../client.h"
#include "../../kwinbutton.h"
@@ -111,9 +112,9 @@
bool largeButtons;
QHBoxLayout* hb;
QSpacerItem* titlebar;
+ QTime t;
};
};
-
#endif
// vim: ts=4
Only in default.orig/: kdedefault.moc
Only in default.orig/: kwin_default.la
Only in default.orig/: kwin_default.la.closure
Only in default.orig/: kwin_default_la.all_cpp.cpp
Only in default.orig/: kwin_default_la.all_cpp.lo
Only in default.orig/: kwin_default_la_meta_unload.cpp
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic