From b14622dcb65779866969842b48e4156c718d12ac Mon Sep 17 00:00:00 2001 From: hluk Date: Sat, 7 Jun 2014 06:00:19 -0700 Subject: [PATCH] Remove code for stealing focus in client --- src/app/clipboardclient.cpp | 8 +------- src/common/commandstatus.h | 2 -- src/gui/mainwindow.cpp | 4 +--- src/gui/mainwindow.h | 2 +- src/scriptable/scriptable.cpp | 24 ++++-------------------- src/scriptable/scriptableproxy.h | 8 ++------ 6 files changed, 9 insertions(+), 39 deletions(-) diff --git a/src/app/clipboardclient.cpp b/src/app/clipboardclient.cpp index 3e21e50de..9255a1baf 100644 --- a/src/app/clipboardclient.cpp +++ b/src/app/clipboardclient.cpp @@ -42,13 +42,7 @@ ClipboardClient::ClipboardClient(int &argc, char **argv, int skipArgc, const QSt void ClipboardClient::onMessageReceived(const QByteArray &data, int messageCode) { - if (messageCode == CommandActivateWindow) { - COPYQ_LOG("Activating window."); - WId wid = (WId)(data.toLongLong()); - PlatformWindowPtr window = createPlatformNativeInterface()->getWindow(wid); - if (window) - window->raise(); - } else if (messageCode == CommandReadInput) { + if (messageCode == CommandReadInput) { COPYQ_LOG("Sending standard input."); QFile in; in.open(stdin, QIODevice::ReadOnly); diff --git a/src/common/commandstatus.h b/src/common/commandstatus.h index fe36cf37a..ce68bf62a 100644 --- a/src/common/commandstatus.h +++ b/src/common/commandstatus.h @@ -30,8 +30,6 @@ enum CommandStatus { CommandBadSyntax = 2, /** Command successfully invoked. */ CommandSuccess, - /** Activate window */ - CommandActivateWindow, /** Ask client to send data from its stdin. */ CommandReadInput }; diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 8a58db269..deac8cea9 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -1688,7 +1688,7 @@ void MainWindow::openActionDialog(int row) openActionDialog(dataMap); } -WId MainWindow::openActionDialog(const QVariantMap &data) +void MainWindow::openActionDialog(const QVariantMap &data) { QScopedPointer actionDialog( m_actionHandler->createActionDialog(ui->tabWidget->tabs()) ); actionDialog->setWindowIcon(appIcon(AppIconRunning)); @@ -1702,8 +1702,6 @@ WId MainWindow::openActionDialog(const QVariantMap &data) window->raise(); actionDialog.take(); - - return wid; } void MainWindow::openPreferences() diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 1fdd2e2a2..8c095aac2 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -172,7 +172,7 @@ public slots: /** Open action dialog for given @a row (or current) in current tab. */ void openActionDialog(int row = -1); /** Open action dialog with given input @a text. */ - WId openActionDialog(const QVariantMap &data); + void openActionDialog(const QVariantMap &data); /** Open preferences dialog. */ void openPreferences(); diff --git a/src/scriptable/scriptable.cpp b/src/scriptable/scriptable.cpp index 018913b5d..ad14cf7ba 100644 --- a/src/scriptable/scriptable.cpp +++ b/src/scriptable/scriptable.cpp @@ -510,11 +510,7 @@ void Scriptable::show() m_proxy->showBrowser(toString(argument(0))); } else { throwError(argumentError()); - return; } - - QByteArray message = QByteArray::number((qlonglong)m_proxy->mainWinId()); - sendMessageToClient(message, CommandActivateWindow); } void Scriptable::hide() @@ -524,28 +520,17 @@ void Scriptable::hide() void Scriptable::toggle() { - if ( m_proxy->toggleVisible() ) { - QByteArray message = QByteArray::number((qlonglong)m_proxy->mainWinId()); - sendMessageToClient(message, CommandActivateWindow); - } + m_proxy->toggleVisible(); } void Scriptable::menu() { - bool shown = false; - if (argumentCount() == 0) { - shown = m_proxy->toggleMenu(); + m_proxy->toggleMenu(); } else if (argumentCount() == 1) { - shown = m_proxy->toggleMenu(toString(argument(0))); + m_proxy->toggleMenu(toString(argument(0))); } else { throwError(argumentError()); - return; - } - - if (shown) { - QByteArray message = QByteArray::number((qlonglong)m_proxy->trayMenuWinId()); - sendMessageToClient(message, CommandActivateWindow); } } @@ -871,8 +856,7 @@ void Scriptable::action() : QString('\n'); m_proxy->action(data, command); } else { - QByteArray message = QByteArray::number((qlonglong)m_proxy->openActionDialog(data)); - sendMessageToClient(message, CommandActivateWindow); + m_proxy->openActionDialog(data); } } diff --git a/src/scriptable/scriptableproxy.h b/src/scriptable/scriptableproxy.h index 9dd4d5049..9abfbaa50 100644 --- a/src/scriptable/scriptableproxy.h +++ b/src/scriptable/scriptableproxy.h @@ -255,11 +255,9 @@ public slots: void toggleVisible() { v = m_wnd->toggleVisible(); } void toggleMenu(const QString &tabName) { v = m_wnd->toggleMenu(fetchBrowser(tabName)); } void toggleMenu() { v = m_wnd->toggleMenu(); } - void mainWinId() { v = (qulonglong)m_wnd->winId(); } - void trayMenuWinId() { v = (qulonglong)m_wnd->trayMenu()->winId(); } void findTabIndex(const QString &arg1) { v = m_wnd->findTabIndex(arg1); } - void openActionDialog(const QVariantMap &arg1) { v = (qulonglong)m_wnd->openActionDialog(arg1); } + void openActionDialog(const QVariantMap &arg1) { m_wnd->openActionDialog(arg1); } void loadTab(const QString &arg1) { v = m_wnd->loadTab(arg1); } void saveTab(const QString &arg1) @@ -455,14 +453,12 @@ class ScriptableProxy PROXY_METHOD_0(bool, toggleVisible) PROXY_METHOD_0(bool, toggleMenu) PROXY_METHOD_1(bool, toggleMenu, const QString &) - PROXY_METHOD_0(qulonglong, mainWinId) - PROXY_METHOD_0(qulonglong, trayMenuWinId) PROXY_METHOD_1(int, findTabIndex, const QString &) PROXY_METHOD(showBrowser) PROXY_METHOD_VOID_1(showBrowser, const QString &) - PROXY_METHOD_1(qulonglong, openActionDialog, const QVariantMap &) + PROXY_METHOD_VOID_1(openActionDialog, const QVariantMap &) PROXY_METHOD_VOID_2(action, const QVariantMap &, const Command &) PROXY_METHOD_1(bool, loadTab, const QString &)