[prev in list] [next in list] [prev in thread] [next in thread]
List: kwin
Subject: [Kwin] [PATCH] kwin ops menu addition - "add to panel"
From: Alexander Kellett <kelletta () eidetica ! com>
Date: 2002-05-31 13:19:06
[Download RAW message or body]
Here's a tiny patch to add a feature that seems
pretty useful to me. It adds a "Add to Panel"
to the window operations menu.
Maybe it should be "Add Program to Panel".
Any opinions?
BTW, any chance that "Terminate Program" could be
added also, i worked on a patch but to get a windowed
confirmation box seems quite impossible, to make it
windowed kwin needs to continue running. A possibility
that i saw is to do the same ksmserver's shutdown
screen - the dense4 rootwin pattern - but i can't seem
to get it working, it also has focus problems and a
stupid first-try appearence (patch with both attached)
mvg,
Alex
--
kelletta@eidetica.com (lypanov) http://lypanov.shacknet.nu
["addtopanel.patch" (text/plain)]
? addtopanel.patch
? killop.diff
Index: client.cpp
===================================================================
RCS file: /home/kde/kdebase/kwin/client.cpp,v
retrieving revision 1.295
diff -u -p -r1.295 client.cpp
--- client.cpp 2002/05/29 19:11:01 1.295
+++ client.cpp 2002/05/31 12:47:11
@@ -589,6 +589,24 @@ Client::~Client()
delete d;
}
+void Client::addToKicker()
+{
+ QString appPath = wmCommand();
+
+ QByteArray data;
+ QDataStream args(data, IO_WriteOnly);
+
+ // AK - could make the icon from the truncated appname?
+
+ args << appPath;
+ args << QString("");
+ args << QString("");
+ args << (bool)false;
+
+ kapp->dcopClient()->send(
+ "kicker", "", "addNonKDEAppButton(QString,QString,QString,bool)", data);
+}
+
void Client::startMoveResize()
{
moveResizeMode = true;
Index: client.h
===================================================================
RCS file: /home/kde/kdebase/kwin/client.h,v
retrieving revision 1.81
diff -u -p -r1.81 client.h
--- client.h 2002/03/04 02:20:26 1.81
+++ client.h 2002/05/31 12:47:11
@@ -77,6 +77,8 @@ public:
Client( Workspace *ws, WId w, QWidget *parent=0, const char *name=0, WFlags f = \
0); ~Client();
+ void addToKicker();
+
WId window() const;
WindowWrapper* windowWrapper() const;
Workspace* workspace() const;
Index: options.h
===================================================================
RCS file: /home/kde/kdebase/kwin/options.h,v
retrieving revision 1.48
diff -u -p -r1.48 options.h
--- options.h 2002/03/16 09:26:49 1.48
+++ options.h 2002/05/31 12:47:11
@@ -221,7 +221,8 @@ public:
HMaximizeOp,
VMaximizeOp,
LowerOp,
- NoOp
+ NoOp,
+ AddToKicker
};
WindowOperation operationTitlebarDblClick() { return OpTitlebarDblClick; }
Index: workspace.cpp
===================================================================
RCS file: /home/kde/kdebase/kwin/workspace.cpp,v
retrieving revision 1.339
diff -u -p -r1.339 workspace.cpp
--- workspace.cpp 2002/05/29 21:31:32 1.339
+++ workspace.cpp 2002/05/31 12:47:13
@@ -1629,6 +1629,7 @@ QPopupMenu* Workspace::clientPopup( Clie
popup->insertItem( i18n("Sh&ade")+'\t'+keys->shortcut("Window \
Shade").toString(), Options::ShadeOp );
popup->insertItem( SmallIconSet( "attach" ), i18n("Always &on Top"), \
Options::StaysOnTopOp );
popup->insertItem( SmallIconSet( "filesave" ), i18n("Sto&re Settings"), \
Options::ToggleStoreSettingsOp ); + popup->insertItem( SmallIconSet( "copy" ), \
i18n("Add to &Panel"), Options::AddToKicker );
popup->insertSeparator();
@@ -1688,6 +1689,9 @@ void Workspace::performWindowOperation(
case Options::StaysOnTopOp:
c->setStaysOnTop( !c->staysOnTop() );
raiseClient( c );
+ break;
+ case Options::AddToKicker:
+ c->addToKicker( );
break;
case Options::ToggleStoreSettingsOp:
c->setStoreSettings( !c->storeSettings() );
["killop.diff" (text/plain)]
? killop.diff
Index: client.cpp
===================================================================
RCS file: /home/kde/kdebase/kwin/client.cpp,v
retrieving revision 1.295
diff -u -p -r1.295 client.cpp
--- client.cpp 2002/05/29 19:11:01 1.295
+++ client.cpp 2002/05/31 12:43:38
@@ -589,6 +589,24 @@ Client::~Client()
delete d;
}
+void Client::addToKicker()
+{
+ QString appPath = wmCommand();
+
+ QByteArray data;
+ QDataStream args(data, IO_WriteOnly);
+
+ // AK - could make the icon from the truncated appname?
+
+ args << appPath;
+ args << QString("");
+ args << QString("");
+ args << (bool)false;
+
+ kapp->dcopClient()->send(
+ "kicker", "", "addNonKDEAppButton(QString,QString,QString,bool)", data);
+}
+
void Client::startMoveResize()
{
moveResizeMode = true;
Index: client.h
===================================================================
RCS file: /home/kde/kdebase/kwin/client.h,v
retrieving revision 1.81
diff -u -p -r1.81 client.h
--- client.h 2002/03/04 02:20:26 1.81
+++ client.h 2002/05/31 12:43:38
@@ -77,6 +77,8 @@ public:
Client( Workspace *ws, WId w, QWidget *parent=0, const char *name=0, WFlags f = \
0); ~Client();
+ void addToKicker();
+
WId window() const;
WindowWrapper* windowWrapper() const;
Workspace* workspace() const;
Index: options.h
===================================================================
RCS file: /home/kde/kdebase/kwin/options.h,v
retrieving revision 1.48
diff -u -p -r1.48 options.h
--- options.h 2002/03/16 09:26:49 1.48
+++ options.h 2002/05/31 12:43:38
@@ -221,7 +221,9 @@ public:
HMaximizeOp,
VMaximizeOp,
LowerOp,
- NoOp
+ NoOp,
+ AddToKicker,
+ KillOp
};
WindowOperation operationTitlebarDblClick() { return OpTitlebarDblClick; }
Index: workspace.cpp
===================================================================
RCS file: /home/kde/kdebase/kwin/workspace.cpp,v
retrieving revision 1.339
diff -u -p -r1.339 workspace.cpp
--- workspace.cpp 2002/05/29 21:31:32 1.339
+++ workspace.cpp 2002/05/31 12:43:40
@@ -45,6 +45,9 @@ Copyright (C) 1999, 2000 Matthias Ettric
#include <X11/cursorfont.h>
#include <sys/time.h>
+#include <kmessagebox.h>
+#include <qpainter.h>
+
const int XIconicState = IconicState;
#undef IconicState
@@ -950,6 +953,8 @@ void Workspace::slotWalkBackThroughDeskt
}
}
+// AK - add a grabAll() function???
+
bool Workspace::startKDEWalkThroughWindows()
{
if ( XGrabPointer( qt_xdisplay(), root, TRUE,
@@ -1629,6 +1634,7 @@ QPopupMenu* Workspace::clientPopup( Clie
popup->insertItem( i18n("Sh&ade")+'\t'+keys->shortcut("Window \
Shade").toString(), Options::ShadeOp );
popup->insertItem( SmallIconSet( "attach" ), i18n("Always &on Top"), \
Options::StaysOnTopOp );
popup->insertItem( SmallIconSet( "filesave" ), i18n("Sto&re Settings"), \
Options::ToggleStoreSettingsOp ); + popup->insertItem( SmallIconSet( "copy" ), \
i18n("Add to &Panel"), Options::AddToKicker );
popup->insertSeparator();
@@ -1637,6 +1643,7 @@ QPopupMenu* Workspace::clientPopup( Clie
popup->insertSeparator();
+ popup->insertItem( SmallIconSet( "kill" ), i18n("&Terminate \
Program")+'\t'+keys->shortcut("Terminate Program").toString(), \
Options::KillOp );
popup->insertItem( SmallIconSet( "fileclose" ), \
i18n("&Close")+'\t'+keys->shortcut("Window Close").toString(), Options::CloseOp ); }
return popup;
@@ -1656,6 +1663,34 @@ void Workspace::showWindowMenuAt( unsign
requestFocus( c );
}
+/*
+ Stolen directly from ksmserver
+
+ BEGIN DUPLICATION
+*/
+
+KSMShutdownFeedback * KSMShutdownFeedback::s_pSelf = 0L;
+
+KSMShutdownFeedback::KSMShutdownFeedback()
+ : QWidget( 0L, "feedbackwidget", WType_Popup )
+{
+ setBackgroundMode( QWidget::NoBackground );
+ setGeometry( QApplication::desktop()->geometry() );
+}
+
+
+void KSMShutdownFeedback::paintEvent( QPaintEvent* )
+{
+ QPainter p;
+ QBrush b( Qt::Dense4Pattern );
+ p.begin( this );
+ p.fillRect( rect(), b);
+ p.end();
+}
+
+
+/* END DUPLICATION */
+
void Workspace::performWindowOperation( Client* c, Options::WindowOperation op ) {
if ( !c )
return;
@@ -1670,6 +1705,40 @@ void Workspace::performWindowOperation(
case Options::ResizeOp:
c->performMouseCommand( Options::MouseResize, QCursor::pos() );
break;
+ case Options::KillOp:
+ {
+ QWidget *blah = new QWidget();
+ Client *c = mgr->allocateClient( this, blah->winId(), false );
+ addClient( c );
+ c->manage( TRUE );
+ requestFocus(c);
+ if ( XGrabPointer( qt_xdisplay(), root, TRUE,
+ (uint)(ButtonPressMask | ButtonReleaseMask |
+ ButtonMotionMask | EnterWindowMask |
+ LeaveWindowMask | PointerMotionMask),
+ GrabModeAsync, GrabModeAsync,
+ None, None, qt_x_time ) != GrabSuccess ) {
+ }
+ if ( XGrabKeyboard(qt_xdisplay(),
+ root, FALSE,
+ GrabModeAsync, GrabModeAsync,
+ qt_x_time) != GrabSuccess ) {
+ XUngrabPointer( qt_xdisplay(), qt_x_time);
+ }
+ if (KMessageBox::warningYesNo( blah,
+ i18n("Are you sure you wish to terminate this program?"),
+ i18n("Warning"),
+ KStdGuiItem::yes(), KStdGuiItem::no(),
+ "killwarning")
+ == KMessageBox::Yes
+ ) {
+ c->killWindow();
+ }
+ delete blah;
+ removeClient(c);
+ delete c;
+ break;
+ }
case Options::CloseOp:
c->closeWindow();
break;
@@ -1688,6 +1757,9 @@ void Workspace::performWindowOperation(
case Options::StaysOnTopOp:
c->setStaysOnTop( !c->staysOnTop() );
raiseClient( c );
+ break;
+ case Options::AddToKicker:
+ c->addToKicker( );
break;
case Options::ToggleStoreSettingsOp:
c->setStoreSettings( !c->storeSettings() );
Index: workspace.h
===================================================================
RCS file: /home/kde/kdebase/kwin/workspace.h,v
retrieving revision 1.111
diff -u -p -r1.111 workspace.h
--- workspace.h 2002/04/01 02:54:00 1.111
+++ workspace.h 2002/05/31 12:43:40
@@ -92,6 +92,27 @@ public:
static bool noBorder( WId w );
};
+/* BEGIN CODE DUPLICATION FROM KSMSERVER */
+// The (singleton) widget that makes the desktop gray.
+class KSMShutdownFeedback : public QWidget
+{
+ Q_OBJECT
+
+ public:
+ static void start() { s_pSelf = new KSMShutdownFeedback(); s_pSelf->show(); }
+ static void stop() { delete s_pSelf; s_pSelf = 0L; }
+ static KSMShutdownFeedback * self() { return s_pSelf; }
+
+ protected:
+ ~KSMShutdownFeedback() {}
+
+ private:
+ void paintEvent( QPaintEvent* );
+ static KSMShutdownFeedback * s_pSelf;
+ KSMShutdownFeedback();
+};
+/* END CODE DUPLICATION FROM KSMSERVER */
+
class WorkspacePrivate;
// NOTE: this class has to keep binary compatibility, just like other
// KWin classes accessible from the plugins
_______________________________________________
Kwin mailing list
Kwin@mail.kde.org
http://mail.kde.org/mailman/listinfo/kwin
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic