📄 qwscommand_qws_p.h
字号:
reinterpret_cast<char*>(&simpleData)) {} void setData(const char *d, int len, bool allocateMem = true) { QWSCommand::setData(d, len, allocateMem); if( simpleData.nrectangles * int(sizeof(QRect)) > len ) { qWarning( "repaint region command - region rectangle count %d - buffer size %d - buffer overrun", simpleData.nrectangles, len ); simpleData.nrectangles = len / sizeof(QRect); } rectangles = reinterpret_cast<QRect *>(rawDataPtr); } struct SimpleData { int windowid; int windowFlags; bool opaque; int nrectangles; } simpleData; QRect * rectangles;};struct QWSRemovePropertyCommand : public QWSCommand{ QWSRemovePropertyCommand() : QWSCommand(QWSCommand::RemoveProperty, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) {} struct SimpleData { int windowid, property; } simpleData;};struct QWSGetPropertyCommand : public QWSCommand{ QWSGetPropertyCommand() : QWSCommand(QWSCommand::GetProperty, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) {} struct SimpleData { int windowid, property; } simpleData;};struct QWSSetSelectionOwnerCommand : public QWSCommand{ QWSSetSelectionOwnerCommand() : QWSCommand(QWSCommand::SetSelectionOwner, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) {} struct SimpleData { int windowid; int hour, minute, sec, ms; // time } simpleData;};struct QWSConvertSelectionCommand : public QWSCommand{ QWSConvertSelectionCommand() : QWSCommand(QWSCommand::ConvertSelection, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) {} struct SimpleData { int requestor; // requestor window of the selection int selection; // property on requestor into which the selection should be stored int mimeTypes; // property ion requestor in which the mimetypes, in which the selection may be, are stored } simpleData;};struct QWSDefineCursorCommand : public QWSCommand{ QWSDefineCursorCommand() : QWSCommand(QWSCommand::DefineCursor, sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {} void setData(const char *d, int len, bool allocateMem = true) { QWSCommand::setData(d, len, allocateMem); data = reinterpret_cast<unsigned char *>(rawDataPtr); if (simpleData.height * ((simpleData.width+7) / 8) > len) { qWarning("define cursor command - width %d height %d- buffer size %d - buffer overrun", simpleData.width, simpleData.height, len ); simpleData.width = simpleData.height = 0; } } struct SimpleData { int width; int height; int hotX; int hotY; int id; } simpleData; unsigned char *data;};struct QWSSelectCursorCommand : public QWSCommand{ QWSSelectCursorCommand() : QWSCommand(QWSCommand::SelectCursor, sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {} struct SimpleData { int windowid; int id; } simpleData;};struct QWSPositionCursorCommand : public QWSCommand{ QWSPositionCursorCommand() : QWSCommand(QWSCommand::PositionCursor, sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {} struct SimpleData { int newX; int newY; } simpleData;};struct QWSGrabMouseCommand : public QWSCommand{ QWSGrabMouseCommand() : QWSCommand(QWSCommand::GrabMouse, sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {} struct SimpleData { int windowid; bool grab; // grab or ungrab? } simpleData;};struct QWSGrabKeyboardCommand : public QWSCommand{ QWSGrabKeyboardCommand() : QWSCommand(QWSCommand::GrabKeyboard, sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {} struct SimpleData { int windowid; bool grab; // grab or ungrab? } simpleData;};#ifndef QT_NO_SOUNDstruct QWSPlaySoundCommand : public QWSCommand{ QWSPlaySoundCommand() : QWSCommand(QWSCommand::PlaySound, sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {} void setData(const char *d, int len, bool allocateMem) { QWSCommand::setData(d, len, allocateMem); filename = QString(reinterpret_cast<QChar*>(rawDataPtr),len/2); } void setFileName(const QString& n) { setData(reinterpret_cast<const char*>(n.unicode()), n.length()*2, true); } struct SimpleData { int windowid; } simpleData; QString filename;};#endif#ifndef QT_NO_COPstruct QWSQCopRegisterChannelCommand : public QWSCommand{ QWSQCopRegisterChannelCommand() : QWSCommand(QWSCommand::QCopRegisterChannel, sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {} void setData(const char *d, int len, bool allocateMem) { QWSCommand::setData(d, len, allocateMem); if ( simpleData.chLen > MAX_COMMAND_SIZE ) { qWarning( "Command channel name too large!" ); simpleData.chLen = MAX_COMMAND_SIZE; } if( simpleData.chLen * int(sizeof(QChar)) > len ) { qWarning( "register qcop channel command - channel name length %d - buffer size %d - buffer overrun!", simpleData.chLen, len ); } else { channel = QString(reinterpret_cast<const QChar*>(d), simpleData.chLen); } } void setChannel(const QString& n) { channel = n; simpleData.chLen = channel.length(); setData(reinterpret_cast<const char*>(channel.unicode()), simpleData.chLen*2, true); } struct SimpleData { int chLen; } simpleData; QString channel;};struct QWSQCopSendCommand : public QWSCommand{ QWSQCopSendCommand() : QWSCommand(QWSCommand::QCopSend, sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {} void setData(const char *d, int len, bool allocateMem) { QWSCommand::setData(d, len, allocateMem); if( simpleData.clen * int(sizeof(QChar)) + simpleData.mlen * int(sizeof(QChar)) + simpleData.dlen * int(sizeof(char)) > len ) { qWarning( "qcop send command - channel name length %d - message name length %d - data size %d - buffer size %d - buffer overrun!", simpleData.clen, simpleData.mlen, simpleData.dlen, len ); } else { const QChar *cd = reinterpret_cast<const QChar*>(d); channel = QString(cd,simpleData.clen); cd += simpleData.clen; message = QString(cd,simpleData.mlen); d += simpleData.clen*sizeof(QChar) + simpleData.mlen*sizeof(QChar); data = QByteArray(d, simpleData.dlen); } } void setMessage(const QString &c, const QString &m, const QByteArray &data) { this->channel = c; this->message = m; this->data = data; simpleData.clen = c.length(); simpleData.mlen = m.length(); simpleData.dlen = data.size(); int l = simpleData.clen*sizeof(QChar); l += simpleData.mlen*sizeof(QChar); l += simpleData.dlen; char *tmp = new char[l]; char *d = tmp; memcpy(d, c.unicode(), simpleData.clen*sizeof(QChar)); d += simpleData.clen*sizeof(QChar); memcpy(d, m.unicode(), simpleData.mlen*sizeof(QChar)); d += simpleData.mlen*sizeof(QChar); memcpy(d, data.data(), simpleData.dlen); QWSCommand::setData(tmp, l, false); deleteRaw = true; } struct SimpleData { int clen; int mlen; int dlen; } simpleData; QString channel; QString message; QByteArray data;};#endif#ifndef QT_NO_QWS_INPUTMETHODSstruct QWSIMMouseCommand : public QWSCommand{ QWSIMMouseCommand() : QWSCommand(QWSCommand::IMMouse, sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {} struct SimpleData { int windowid; int state; int index; } simpleData;};struct QWSIMResponseCommand : public QWSCommand{ QWSIMResponseCommand() : QWSCommand(QWSCommand::IMResponse, sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {} void setData(const char *d, int len, bool allocateMem) { QWSCommand::setData(d, len, allocateMem); QByteArray tmp = QByteArray::fromRawData(d, len); QDataStream s(tmp); s >> result; } void setResult(const QVariant & v) { QByteArray tmp; QDataStream s(&tmp, QIODevice::WriteOnly); s << v; setData(tmp.data(), tmp.size(), true); } struct SimpleData { int windowid; int property; } simpleData; QVariant result;};struct QWSIMUpdateCommand: public QWSCommand{ QWSIMUpdateCommand() : QWSCommand(QWSCommand::IMUpdate, sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {} struct SimpleData { int windowid; int type; int widgetid; } simpleData;};#endif#ifndef QT_NO_QWSEMBEDWIDGETstruct QWSEmbedCommand : public QWSCommand{ QWSEmbedCommand() : QWSCommand(QWSCommand::Embed, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) {} void setData(const char *d, int len, bool allocateMem = true) { QWSCommand::setData(d, len, allocateMem); if( simpleData.rects * int(sizeof(QRect)) > len ) { qWarning( "embed command - region rectangle count %d - buffer size %d - buffer overrun!", simpleData.rects, len ); } else { region.setRects(reinterpret_cast<QRect*>(rawDataPtr), simpleData.rects); } } void setData(WId embedder, WId embedded, QWSEmbedEvent::Type type, const QRegion reg = QRegion()) { simpleData.embedder = embedder; simpleData.embedded = embedded; simpleData.type = type; region = reg; const QVector<QRect> rects = reg.rects(); simpleData.rects = rects.count(); QWSCommand::setData(reinterpret_cast<const char*>(rects.constData()), rects.count() * sizeof(QRect)); } struct { WId embedder; WId embedded; QWSEmbedEvent::Type type; int rects; } simpleData; QRegion region;};#endif // QT_NO_QWSEMBEDWIDGETstruct QWSFontCommand : public QWSCommand{ enum CommandType { StartedUsingFont, StoppedUsingFont }; QWSFontCommand() : QWSCommand(QWSCommand::Font, sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {} void setData(const char *d, int len, bool allocateMem) { QWSCommand::setData(d, len, allocateMem); fontName = QByteArray(d, len); } void setFontName(const QByteArray &name) { setData(name.constData(), name.size(), true); } struct SimpleData { int type; } simpleData; QByteArray fontName;};#endif // QWSCOMMAND_QWS_P_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -