GUI: fixed a weird problem with focus
This commit is contained in:
parent
ad26f81dce
commit
ce4d5642bb
|
|
@ -658,9 +658,15 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
|
|||
break;
|
||||
|
||||
case GUI_GET_ACTIVE_VIEW:
|
||||
{
|
||||
if(param1)
|
||||
memcpy(param1, &activeView, sizeof(ACTIVEVIEW));
|
||||
break;
|
||||
{
|
||||
BridgeResult result;
|
||||
emit getActiveView((ACTIVEVIEW*)param1);
|
||||
result.Wait();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ public:
|
|||
void* winId;
|
||||
QWidget* scriptView;
|
||||
ReferenceManager* referenceManager;
|
||||
ACTIVEVIEW activeView;
|
||||
|
||||
signals:
|
||||
void disassembleAt(dsint va, dsint eip);
|
||||
|
|
@ -137,6 +136,7 @@ signals:
|
|||
void setFavouriteItemShortcut(int type, const QString & name, const QString & shortcut);
|
||||
void foldDisassembly(duint startAddr, duint length);
|
||||
void selectInMemoryMap(duint addr);
|
||||
void getActiveView(ACTIVEVIEW* activeView);
|
||||
|
||||
private:
|
||||
QMutex* mBridgeMutex;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ LogStatusLabel::LogStatusLabel(QStatusBar* parent) : QLabel(parent)
|
|||
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
|
||||
connect(Bridge::getBridge(), SIGNAL(addMsgToLog(QString)), this, SLOT(logUpdate(QString)));
|
||||
connect(Bridge::getBridge(), SIGNAL(addMsgToStatusBar(QString)), this, SLOT(logUpdate(QString)));
|
||||
QApplication* app = (QApplication*)QApplication::instance();
|
||||
connect(app, SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(focusChanged(QWidget*, QWidget*)));
|
||||
connect(Bridge::getBridge(), SIGNAL(getActiveView(ACTIVEVIEW*)), this, SLOT(getActiveView(ACTIVEVIEW*)));
|
||||
connect(QApplication::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(focusChanged(QWidget*, QWidget*)));
|
||||
}
|
||||
|
||||
void LogStatusLabel::logUpdate(QString message)
|
||||
|
|
@ -41,7 +41,10 @@ void LogStatusLabel::focusChanged(QWidget* old, QWidget* now)
|
|||
old->setFocus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void LogStatusLabel::getActiveView(ACTIVEVIEW* active)
|
||||
{
|
||||
auto findTitle = [](QWidget * w, void* & hwnd) -> QString
|
||||
{
|
||||
if(!w)
|
||||
|
|
@ -66,17 +69,9 @@ void LogStatusLabel::focusChanged(QWidget* old, QWidget* now)
|
|||
return w->metaObject()->className();
|
||||
};
|
||||
|
||||
ACTIVEVIEW activeView;
|
||||
memset(&activeView, 0, sizeof(ACTIVEVIEW));
|
||||
strncpy_s(activeView.title, findTitle(now, activeView.titleHwnd).toUtf8().constData(), _TRUNCATE);
|
||||
strncpy_s(activeView.className, className(now, activeView.classHwnd).toUtf8().constData(), _TRUNCATE);
|
||||
Bridge::getBridge()->activeView = activeView;
|
||||
|
||||
/*QString oldTitle = findTitle(old);
|
||||
QString oldClass = className(old);
|
||||
QString nowTitle = findTitle(now);
|
||||
QString nowClass = className(now);
|
||||
printf("[FOCUS] old: %s%s, now: %s%s\n",
|
||||
oldTitle.toUtf8().constData(), oldClass.toUtf8().constData(),
|
||||
nowTitle.toUtf8().constData(), nowClass.toUtf8().constData());*/
|
||||
memset(active, 0, sizeof(ACTIVEVIEW));
|
||||
QWidget* now = QApplication::focusWidget();
|
||||
strncpy_s(active->title, findTitle(now, active->titleHwnd).toUtf8().constData(), _TRUNCATE);
|
||||
strncpy_s(active->className, className(now, active->classHwnd).toUtf8().constData(), _TRUNCATE);
|
||||
Bridge::getBridge()->setResult();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ public:
|
|||
public slots:
|
||||
void logUpdate(QString message);
|
||||
void focusChanged(QWidget* old, QWidget* now);
|
||||
void getActiveView(ACTIVEVIEW* active);
|
||||
|
||||
private:
|
||||
QString labelText;
|
||||
|
|
|
|||
Loading…
Reference in New Issue