diff --git a/daemon b/daemon index 33f089ef50deb19c15b094dde10f87814b7c48b0..5e35e71d0959923ee3a0180b988ea7175f1530fb 160000 --- a/daemon +++ b/daemon @@ -1 +1 @@ -Subproject commit 33f089ef50deb19c15b094dde10f87814b7c48b0 +Subproject commit 5e35e71d0959923ee3a0180b988ea7175f1530fb diff --git a/src/app/mainview/components/SelectScreen.qml b/src/app/mainview/components/SelectScreen.qml index dcd35feaa61d3c8c65798aed222783b8251d2d83..3a673e0953964eeffdb171c44d183c45e685eda6 100644 --- a/src/app/mainview/components/SelectScreen.qml +++ b/src/app/mainview/components/SelectScreen.qml @@ -284,6 +284,7 @@ Window { border.color: selectedScreenNumber === index ? JamiTheme.screenSelectionBorderColor : JamiTheme.tabbarBorderColor visible: root.window && JamiStrings.selectScreen !== screens[index] && index >= Qt.application.screens.length + && screenName2.text != JamiStrings.selectWindow Text { id: screenName2 diff --git a/src/libclient/avmodel.cpp b/src/libclient/avmodel.cpp index 3ddd4ec00a6eae01757725aa069f4d2a7555ac1f..f0ccadf97882b09c36040551ade41bd782349aa9 100644 --- a/src/libclient/avmodel.cpp +++ b/src/libclient/avmodel.cpp @@ -564,10 +564,13 @@ AVModel::stopPreview(const QString& resource) BOOL IsAltTabWindow(HWND hwnd) { - LONG style = GetWindowLong(hwnd, GWL_STYLE); - if (!((style & WS_DISABLED) != WS_DISABLED)) { + auto styles = (DWORD) GetWindowLongPtr(hwnd, GWL_STYLE); + auto ex_styles = (DWORD) GetWindowLongPtr(hwnd, GWL_EXSTYLE); + + if (ex_styles & WS_EX_TOOLWINDOW) + return false; + if (styles & WS_CHILD) return false; - } DWORD cloaked = FALSE; HRESULT hrTemp = DwmGetWindowAttribute(hwnd, DWMWA_CLOAKED, &cloaked, sizeof(cloaked)); @@ -591,6 +594,17 @@ IsAltTabWindow(HWND hwnd) BOOL CALLBACK CbEnumAltTab(HWND hwnd, LPARAM lParam) { + const size_t MAX_WINDOW_NAME = 256; + TCHAR windowName[MAX_WINDOW_NAME]; + GetWindowText(hwnd, windowName, MAX_WINDOW_NAME); + + // Do not show windows that has no caption + if (0 == windowName[0]) + return TRUE; + + std::wstring msg = std::wstring(windowName); + auto name = QString::fromStdWString(msg); + // Do not show invisible windows if (!IsWindowVisible(hwnd)) return TRUE; @@ -599,28 +613,19 @@ CbEnumAltTab(HWND hwnd, LPARAM lParam) if (!IsAltTabWindow(hwnd)) return TRUE; - const size_t MAX_WINDOW_NAME = 256; - TCHAR windowName[MAX_WINDOW_NAME]; - if (hwnd == GetShellWindow()) - return TRUE; - else - GetWindowText(hwnd, windowName, MAX_WINDOW_NAME); + auto isShellWindow = hwnd == GetShellWindow(); - // Do not show windows that has no caption - if (0 == windowName[0]) + if (isShellWindow) return TRUE; - std::wstring msg = std::wstring(windowName); - auto name = QString::fromStdWString(msg); - QMap<QString, QVariant>* windowList = reinterpret_cast<QMap<QString, QVariant>*>(lParam); auto keys = windowList->keys(); if (keys.indexOf(name) > 0) { return FALSE; } else { - DWORD processId; - GetWindowThreadProcessId(hwnd, &processId); - windowList->insert(name, QVariant::fromValue(processId)); + std::stringstream ss; + ss << hwnd; + windowList->insert(name, QString::fromStdString(ss.str())); } return TRUE; diff --git a/src/libclient/callmodel.cpp b/src/libclient/callmodel.cpp index 57b169c89c33783a79a6110158631ce46360e5d9..da5c0841cd7f3a57bb81c91b5199ac644f2e693d 100644 --- a/src/libclient/callmodel.cpp +++ b/src/libclient/callmodel.cpp @@ -949,30 +949,6 @@ CallModel::getDisplay(int idx, int x, int y, int w, int h) .arg(h); } -#ifdef WIN32 -BOOL CALLBACK -EnumWindowsProcMy(HWND hwnd, LPARAM lParam) -{ - std::pair<DWORD, QString>* dataPair = reinterpret_cast<std::pair<DWORD, QString>*>(lParam); - DWORD lpdwProcessId; - if (auto parent = GetWindow(hwnd, GW_OWNER)) - GetWindowThreadProcessId(parent, &lpdwProcessId); - else - GetWindowThreadProcessId(hwnd, &lpdwProcessId); - int len = GetWindowTextLength(hwnd) + 1; - std::vector<wchar_t> buf(len); - GetWindowText(hwnd, &buf[0], len); - - if (lpdwProcessId == dataPair->first) { - if (!IsWindowVisible(hwnd)) - return TRUE; - dataPair->second = QString::fromStdWString(&buf[0]); - return FALSE; - } - return TRUE; -} -#endif - QString CallModel::getDisplay(const QString& windowProcessId, const QString& windowId) { @@ -986,22 +962,10 @@ CallModel::getDisplay(const QString& windowProcessId, const QString& windowId) .arg(windowProcessId); #endif #ifdef WIN32 - // If window changed the name we must look for the parent process window - QString newWindowId = windowId; - auto hwnd = FindWindow(NULL, windowId.toStdWString().c_str()); - if (!hwnd) { - std::pair<DWORD, QString> idName(windowProcessId.toInt(), {}); - LPARAM lParam = reinterpret_cast<LPARAM>(&idName); - EnumWindows(EnumWindowsProcMy, lParam); - if (!idName.second.isEmpty()) { - newWindowId = idName.second; - } - } - - ret = QString("%1%2:+0,0 window-id:title=%3") - .arg(libjami::Media::VideoProtocolPrefix::DISPLAY) - .arg(sep) - .arg(newWindowId); + ret = QString("%1%2:+0,0 window-id:hwnd=%3") + .arg(libjami::Media::VideoProtocolPrefix::DISPLAY) + .arg(sep) + .arg(windowProcessId); #endif return ret; } diff --git a/src/libclient/qtwrapper/videomanager_wrap.cpp b/src/libclient/qtwrapper/videomanager_wrap.cpp index f7889782cf01ce6101b86778209b50edd370ff03..280afc44816acd66498a1aa5163172cbf08699b6 100644 --- a/src/libclient/qtwrapper/videomanager_wrap.cpp +++ b/src/libclient/qtwrapper/videomanager_wrap.cpp @@ -30,16 +30,16 @@ VideoManagerInterface::VideoManagerInterface() int width, int height, bool isMixer) { - Q_EMIT decodingStarted(QString::fromLatin1(QByteArray::fromStdString(id)), - QString::fromLatin1(QByteArray::fromStdString(shmPath)), + Q_EMIT decodingStarted(QString(id.c_str()), + QString(shmPath.c_str()), width, height, isMixer); }), exportable_callback<VideoSignal::DecodingStopped>( [this](const std::string& id, const std::string& shmPath, bool isMixer) { - Q_EMIT decodingStopped(QString::fromLatin1(QByteArray::fromStdString(id)), - QString::fromLatin1(QByteArray::fromStdString(shmPath)), + Q_EMIT decodingStopped(QString(id.c_str()), + QString(shmPath.c_str()), isMixer); })}; #endif diff --git a/src/libclient/qtwrapper/videomanager_wrap.h b/src/libclient/qtwrapper/videomanager_wrap.h index f93a85c212fa1ca3379cd78a00680393311691ce..24402596e85f8a927e7900989895c8109572e1da 100644 --- a/src/libclient/qtwrapper/videomanager_wrap.h +++ b/src/libclient/qtwrapper/videomanager_wrap.h @@ -126,7 +126,7 @@ public Q_SLOTS: // METHODS QString openVideoInput(const QString& resource) { #ifdef ENABLE_VIDEO - return QString::fromLatin1(QByteArray::fromStdString(libjami::openVideoInput(resource.toStdString()))); + return libjami::openVideoInput(resource.toLatin1().toStdString()).c_str(); #endif } @@ -150,7 +150,7 @@ public Q_SLOTS: // METHODS bool registerSinkTarget(const QString& sinkID, const libjami::SinkTarget& target) { #ifdef ENABLE_VIDEO - return libjami::registerSinkTarget(sinkID.toLatin1().toStdString(), target); + return libjami::registerSinkTarget(sinkID.toStdString(), target); #else Q_UNUSED(sinkID) Q_UNUSED(target)