Print useful information for a Client in scripting
Reusing the debug information already specified for QDebug. FEATURE: 314402 FIXED-IN: 4.11 REVIEW: 108959
This commit is contained in:
parent
2209b4851a
commit
3389d68c50
3 changed files with 19 additions and 4 deletions
|
@ -2350,8 +2350,7 @@ void Client::cancelAutoRaise()
|
|||
|
||||
void Client::debug(QDebug& stream) const
|
||||
{
|
||||
stream << "\'ID:" << window() << ";WMCLASS:" << resourceClass() << ":"
|
||||
<< resourceName() << ";Caption:" << caption() << "\'";
|
||||
print<QDebug>(stream);
|
||||
}
|
||||
|
||||
QPixmap* kwin_get_menu_pix_hack()
|
||||
|
|
10
client.h
10
client.h
|
@ -651,6 +651,9 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
void print(T &stream) const;
|
||||
|
||||
public slots:
|
||||
void closeWindow();
|
||||
void updateCaption();
|
||||
|
@ -1277,6 +1280,13 @@ inline bool Client::hiddenPreview() const
|
|||
return mapping_state == Kept;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void Client::print(T &stream) const
|
||||
{
|
||||
stream << "\'ID:" << window() << ";WMCLASS:" << resourceClass() << ":"
|
||||
<< resourceName() << ";Caption:" << caption() << "\'";
|
||||
}
|
||||
|
||||
KWIN_COMPARE_PREDICATE(WrapperIdMatchPredicate, Client, Window, cl->wrapperId() == value);
|
||||
KWIN_COMPARE_PREDICATE(InputIdMatchPredicate, Client, Window, cl->inputId() == value);
|
||||
|
||||
|
|
|
@ -57,11 +57,17 @@ QScriptValue kwinScriptPrint(QScriptContext *context, QScriptEngine *engine)
|
|||
return engine->undefinedValue();
|
||||
}
|
||||
QString result;
|
||||
QTextStream stream(&result);
|
||||
for (int i = 0; i < context->argumentCount(); ++i) {
|
||||
if (i > 0) {
|
||||
result.append(" ");
|
||||
stream << " ";
|
||||
}
|
||||
QScriptValue argument = context->argument(i);
|
||||
if (KWin::Client *client = qscriptvalue_cast<KWin::Client*>(argument)) {
|
||||
client->print<QTextStream>(stream);
|
||||
} else {
|
||||
stream << argument.toString();
|
||||
}
|
||||
result.append(context->argument(i).toString());
|
||||
}
|
||||
script->printMessage(result);
|
||||
|
||||
|
|
Loading…
Reference in a new issue