mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-07-15 04:55:23 +02:00
windows sharing: use windows id instead of name
Change-Id: Ie1708ae4be049206fb8337db1211b7844e45726f
This commit is contained in:
parent
86b84ea17e
commit
b16131e63a
6 changed files with 35 additions and 65 deletions
2
daemon
2
daemon
|
@ -1 +1 @@
|
|||
Subproject commit 33f089ef50deb19c15b094dde10f87814b7c48b0
|
||||
Subproject commit 5e35e71d0959923ee3a0180b988ea7175f1530fb
|
|
@ -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
|
||||
|
|
|
@ -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,20 +594,9 @@ IsAltTabWindow(HWND hwnd)
|
|||
BOOL CALLBACK
|
||||
CbEnumAltTab(HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
// Do not show invisible windows
|
||||
if (!IsWindowVisible(hwnd))
|
||||
return TRUE;
|
||||
|
||||
// Alt-tab test as described by Raymond Chen
|
||||
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);
|
||||
GetWindowText(hwnd, windowName, MAX_WINDOW_NAME);
|
||||
|
||||
// Do not show windows that has no caption
|
||||
if (0 == windowName[0])
|
||||
|
@ -613,14 +605,27 @@ CbEnumAltTab(HWND hwnd, LPARAM lParam)
|
|||
std::wstring msg = std::wstring(windowName);
|
||||
auto name = QString::fromStdWString(msg);
|
||||
|
||||
// Do not show invisible windows
|
||||
if (!IsWindowVisible(hwnd))
|
||||
return TRUE;
|
||||
|
||||
// Alt-tab test as described by Raymond Chen
|
||||
if (!IsAltTabWindow(hwnd))
|
||||
return TRUE;
|
||||
|
||||
auto isShellWindow = hwnd == GetShellWindow();
|
||||
|
||||
if (isShellWindow)
|
||||
return TRUE;
|
||||
|
||||
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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue