[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdebase/kstart
From: Luboš Luňák <l.lunak () kde ! org>
Date: 2004-06-10 12:28:24
Message-ID: 20040610122824.0B437126EF () office ! kde ! org
[Download RAW message or body]
CVS commit by lunakl:
--windowclass for specifying the window by its WM_CLASS instead of window
title (for #80013).
M +37 -15 kstart.cpp 1.50
--- kdebase/kstart/kstart.cpp #1.49:1.50
@@ -42,5 +42,6 @@ pid_t execute(const QCString & cmd){
static QCString command = 0;
-static QCString window = 0;
+static QCString windowtitle = 0;
+static QCString windowclass = 0;
static int desktop = 0;
static bool activate = false;
@@ -59,6 +60,6 @@ KStart::KStart()
connect(kwinmodule, SIGNAL(windowAdded(WId)), SLOT(windowAdded(WId)));
- if (window)
- kwinmodule->doNotManage( window );
+ if (windowtitle)
+ kwinmodule->doNotManage( windowtitle );
// propagate the app startup notification info to the started app
@@ -99,10 +100,23 @@ void KStart::windowAdded(WId w){
return;
- if ( window) {
- QString title = info.name();
- QRegExp r( window );
- if (r.match(title) == -1)
+ if ( windowtitle ) {
+ QString title = info.name().lower();
+ QRegExp r( windowtitle );
+ if (r.match(windowtitle) == -1)
return; // no match
- } else {
+ }
+ if ( windowclass ) {
+ XClassHint hint;
+ if( !XGetClassHint( qt_xdisplay(), w, &hint ))
+ return;
+ QCString cls = windowclass.contains( ' ' )
+ ? QCString( hint.res_name ) + ' ' + hint.res_class : hint.res_class;
+ cls = cls.lower();
+ XFree( hint.res_name );
+ XFree( hint.res_class );
+ if( cls != windowclass )
+ return;
+ }
+ if( !windowtitle && !windowclass ) {
// accept only "normal" windows
if( info.windowType( SUPPORTED_WINDOW_TYPES_MASK ) != NET::Unknown
@@ -197,8 +211,11 @@ static KCmdLineOptions options[] =
{ "!+command", I18N_NOOP("Command to execute."), 0 },
// "!" means: all options after command are treated as arguments to the command
- { "window <regexp>", I18N_NOOP("A regular expression matching the window title.\n"
- "If you do not specify one, then the very first\n"
- "window to appear will be taken;\n"
- "omitting this option is NOT recommended."), 0 },
+ { "window <regexp>", I18N_NOOP("A regular expression matching the window title."), \
0 }, + { "windowclass <class>", I18N_NOOP("A string matching the window class \
(WM_CLASS property).\n" + "The window class can be found out by \
running\n" + "'xprop | grep WM_CLASS' and clicking on a window.\n"
+ "NOTE: If you specify neither window title nor window class,\n"
+ "then the very first window to appear will be taken;\n"
+ "omitting both options is NOT recommended."), 0 },
{ "desktop <number>", I18N_NOOP("Desktop where to make the window appear. "), 0 },
{ "currentdesktop", I18N_NOOP("Make the window appear on the desktop that was \
active\nwhen starting the application. "), 0 }, @@ -260,8 +277,13 @@ int main( int \
argc, char *argv[] ) desktop = kwinmodule->currentDesktop();
- window = args->getOption( "window" );
+ windowtitle = args->getOption( "window" );
+ windowclass = args->getOption( "windowclass" );
+ if( windowtitle )
+ windowtitle = windowtitle.lower();
+ if( windowclass )
+ windowclass = windowclass.lower();
- if( window.isEmpty())
- kdWarning() << "Omitting --window argument is not recommended" << endl;
+ if( windowtitle.isEmpty() && windowclass.isEmpty())
+ kdWarning() << "Omitting both --window and --windowclass arguments is not \
recommended" << endl;
QCString s = args->getOption( "type" );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic