mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-30 11:43:36 +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
|
border.color: selectedScreenNumber === index ? JamiTheme.screenSelectionBorderColor : JamiTheme.tabbarBorderColor
|
||||||
visible: root.window && JamiStrings.selectScreen !== screens[index] && index >= Qt.application.screens.length
|
visible: root.window && JamiStrings.selectScreen !== screens[index] && index >= Qt.application.screens.length
|
||||||
|
&& screenName2.text != JamiStrings.selectWindow
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: screenName2
|
id: screenName2
|
||||||
|
|
|
@ -564,10 +564,13 @@ AVModel::stopPreview(const QString& resource)
|
||||||
BOOL
|
BOOL
|
||||||
IsAltTabWindow(HWND hwnd)
|
IsAltTabWindow(HWND hwnd)
|
||||||
{
|
{
|
||||||
LONG style = GetWindowLong(hwnd, GWL_STYLE);
|
auto styles = (DWORD) GetWindowLongPtr(hwnd, GWL_STYLE);
|
||||||
if (!((style & WS_DISABLED) != WS_DISABLED)) {
|
auto ex_styles = (DWORD) GetWindowLongPtr(hwnd, GWL_EXSTYLE);
|
||||||
|
|
||||||
|
if (ex_styles & WS_EX_TOOLWINDOW)
|
||||||
|
return false;
|
||||||
|
if (styles & WS_CHILD)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
DWORD cloaked = FALSE;
|
DWORD cloaked = FALSE;
|
||||||
HRESULT hrTemp = DwmGetWindowAttribute(hwnd, DWMWA_CLOAKED, &cloaked, sizeof(cloaked));
|
HRESULT hrTemp = DwmGetWindowAttribute(hwnd, DWMWA_CLOAKED, &cloaked, sizeof(cloaked));
|
||||||
|
@ -591,20 +594,9 @@ IsAltTabWindow(HWND hwnd)
|
||||||
BOOL CALLBACK
|
BOOL CALLBACK
|
||||||
CbEnumAltTab(HWND hwnd, LPARAM lParam)
|
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;
|
const size_t MAX_WINDOW_NAME = 256;
|
||||||
TCHAR windowName[MAX_WINDOW_NAME];
|
TCHAR windowName[MAX_WINDOW_NAME];
|
||||||
if (hwnd == GetShellWindow())
|
GetWindowText(hwnd, windowName, MAX_WINDOW_NAME);
|
||||||
return TRUE;
|
|
||||||
else
|
|
||||||
GetWindowText(hwnd, windowName, MAX_WINDOW_NAME);
|
|
||||||
|
|
||||||
// Do not show windows that has no caption
|
// Do not show windows that has no caption
|
||||||
if (0 == windowName[0])
|
if (0 == windowName[0])
|
||||||
|
@ -613,14 +605,27 @@ CbEnumAltTab(HWND hwnd, LPARAM lParam)
|
||||||
std::wstring msg = std::wstring(windowName);
|
std::wstring msg = std::wstring(windowName);
|
||||||
auto name = QString::fromStdWString(msg);
|
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);
|
QMap<QString, QVariant>* windowList = reinterpret_cast<QMap<QString, QVariant>*>(lParam);
|
||||||
auto keys = windowList->keys();
|
auto keys = windowList->keys();
|
||||||
if (keys.indexOf(name) > 0) {
|
if (keys.indexOf(name) > 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
DWORD processId;
|
std::stringstream ss;
|
||||||
GetWindowThreadProcessId(hwnd, &processId);
|
ss << hwnd;
|
||||||
windowList->insert(name, QVariant::fromValue(processId));
|
windowList->insert(name, QString::fromStdString(ss.str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -949,30 +949,6 @@ CallModel::getDisplay(int idx, int x, int y, int w, int h)
|
||||||
.arg(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
|
QString
|
||||||
CallModel::getDisplay(const QString& windowProcessId, const QString& windowId)
|
CallModel::getDisplay(const QString& windowProcessId, const QString& windowId)
|
||||||
{
|
{
|
||||||
|
@ -986,22 +962,10 @@ CallModel::getDisplay(const QString& windowProcessId, const QString& windowId)
|
||||||
.arg(windowProcessId);
|
.arg(windowProcessId);
|
||||||
#endif
|
#endif
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
// If window changed the name we must look for the parent process window
|
ret = QString("%1%2:+0,0 window-id:hwnd=%3")
|
||||||
QString newWindowId = windowId;
|
.arg(libjami::Media::VideoProtocolPrefix::DISPLAY)
|
||||||
auto hwnd = FindWindow(NULL, windowId.toStdWString().c_str());
|
.arg(sep)
|
||||||
if (!hwnd) {
|
.arg(windowProcessId);
|
||||||
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);
|
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,16 +30,16 @@ VideoManagerInterface::VideoManagerInterface()
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
bool isMixer) {
|
bool isMixer) {
|
||||||
Q_EMIT decodingStarted(QString::fromLatin1(QByteArray::fromStdString(id)),
|
Q_EMIT decodingStarted(QString(id.c_str()),
|
||||||
QString::fromLatin1(QByteArray::fromStdString(shmPath)),
|
QString(shmPath.c_str()),
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
isMixer);
|
isMixer);
|
||||||
}),
|
}),
|
||||||
exportable_callback<VideoSignal::DecodingStopped>(
|
exportable_callback<VideoSignal::DecodingStopped>(
|
||||||
[this](const std::string& id, const std::string& shmPath, bool isMixer) {
|
[this](const std::string& id, const std::string& shmPath, bool isMixer) {
|
||||||
Q_EMIT decodingStopped(QString::fromLatin1(QByteArray::fromStdString(id)),
|
Q_EMIT decodingStopped(QString(id.c_str()),
|
||||||
QString::fromLatin1(QByteArray::fromStdString(shmPath)),
|
QString(shmPath.c_str()),
|
||||||
isMixer);
|
isMixer);
|
||||||
})};
|
})};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -126,7 +126,7 @@ public Q_SLOTS: // METHODS
|
||||||
QString openVideoInput(const QString& resource)
|
QString openVideoInput(const QString& resource)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_VIDEO
|
#ifdef ENABLE_VIDEO
|
||||||
return QString::fromLatin1(QByteArray::fromStdString(libjami::openVideoInput(resource.toStdString())));
|
return libjami::openVideoInput(resource.toLatin1().toStdString()).c_str();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ public Q_SLOTS: // METHODS
|
||||||
bool registerSinkTarget(const QString& sinkID, const libjami::SinkTarget& target)
|
bool registerSinkTarget(const QString& sinkID, const libjami::SinkTarget& target)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_VIDEO
|
#ifdef ENABLE_VIDEO
|
||||||
return libjami::registerSinkTarget(sinkID.toLatin1().toStdString(), target);
|
return libjami::registerSinkTarget(sinkID.toStdString(), target);
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(sinkID)
|
Q_UNUSED(sinkID)
|
||||||
Q_UNUSED(target)
|
Q_UNUSED(target)
|
||||||
|
|
Loading…
Add table
Reference in a new issue