Skip to content
Snippets Groups Projects
Commit b7d4e112 authored by Pierre Lespagnol's avatar Pierre Lespagnol
Browse files

avadapter: fix screen sharing area for linux

Change-Id: I49dd406a8eca39e628985ea3d69a9c31e59fdc74
parent 8b2512c5
No related branches found
No related tags found
No related merge requests found
...@@ -88,21 +88,8 @@ AvAdapter::shareEntireScreen(int screenNumber) ...@@ -88,21 +88,8 @@ AvAdapter::shareEntireScreen(int screenNumber)
return; return;
QRect rect = screen->geometry(); QRect rect = screen->geometry();
int display = 0;
#ifdef Q_OS_WIN
display = screenNumber;
#else
QString display_env {getenv("DISPLAY")};
if (!display_env.isEmpty()) {
auto list = display_env.split(":", Qt::SkipEmptyParts);
// Should only be one display, so get the first one
if (list.size() > 0) {
display = list.at(0).toInt();
}
}
#endif
LRCInstance::avModel() LRCInstance::avModel()
.setDisplay(display, rect.x(), rect.y(), rect.width(), rect.height(), getCurrentCallId()); .setDisplay(getScreenNumber(), rect.x(), rect.y(), rect.width(), rect.height(), getCurrentCallId());
} }
void void
...@@ -117,7 +104,7 @@ AvAdapter::shareAllScreens() ...@@ -117,7 +104,7 @@ AvAdapter::shareAllScreens()
height = scr->geometry().height(); height = scr->geometry().height();
} }
LRCInstance::avModel().setDisplay(0, 0, 0, width, height, getCurrentCallId()); LRCInstance::avModel().setDisplay(getScreenNumber(), 0, 0, width, height, getCurrentCallId());
} }
void void
...@@ -183,18 +170,6 @@ void ...@@ -183,18 +170,6 @@ void
AvAdapter::shareScreenArea(unsigned x, unsigned y, unsigned width, unsigned height) AvAdapter::shareScreenArea(unsigned x, unsigned y, unsigned width, unsigned height)
{ {
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
int display;
// Get display
QString display_env {getenv("DISPLAY")};
if (!display_env.isEmpty()) {
auto list = display_env.split(":", Qt::SkipEmptyParts);
// Should only be one display, so get the first one
if (list.size() > 0) {
display = list.at(0).toInt();
}
}
// xrectsel will freeze all displays too fast so that the call // xrectsel will freeze all displays too fast so that the call
// context menu will not be closed even closed signal is emitted // context menu will not be closed even closed signal is emitted
// use timer to wait until popup is closed // use timer to wait until popup is closed
...@@ -202,7 +177,7 @@ AvAdapter::shareScreenArea(unsigned x, unsigned y, unsigned width, unsigned heig ...@@ -202,7 +177,7 @@ AvAdapter::shareScreenArea(unsigned x, unsigned y, unsigned width, unsigned heig
x = y = width = height = 0; x = y = width = height = 0;
xrectsel(&x, &y, &width, &height); xrectsel(&x, &y, &width, &height);
LRCInstance::avModel().setDisplay(0, LRCInstance::avModel().setDisplay(getScreenNumber(),
x, x,
y, y,
width < 128 ? 128 : width, width < 128 ? 128 : width,
...@@ -210,7 +185,7 @@ AvAdapter::shareScreenArea(unsigned x, unsigned y, unsigned width, unsigned heig ...@@ -210,7 +185,7 @@ AvAdapter::shareScreenArea(unsigned x, unsigned y, unsigned width, unsigned heig
getCurrentCallId()); getCurrentCallId());
}); });
#else #else
LRCInstance::avModel().setDisplay(0, LRCInstance::avModel().setDisplay(getScreenNumber(),
x, x,
y, y,
width < 128 ? 128 : width, width < 128 ? 128 : width,
...@@ -302,3 +277,22 @@ AvAdapter::slotDeviceEvent() ...@@ -302,3 +277,22 @@ AvAdapter::slotDeviceEvent()
deviceListSize_ = currentDeviceListSize; deviceListSize_ = currentDeviceListSize;
} }
int
AvAdapter::getScreenNumber() const
{
int display = 0;
#ifdef Q_OS_LINUX
// Get display
QString display_env {getenv("DISPLAY")};
if (!display_env.isEmpty()) {
auto list = display_env.split(":", Qt::SkipEmptyParts);
// Should only be one display, so get the first one
if (list.size() > 0) {
display = list.at(0).toInt();
}
}
#endif
return display;
}
...@@ -107,4 +107,9 @@ private: ...@@ -107,4 +107,9 @@ private:
* Device changed slot. * Device changed slot.
*/ */
void slotDeviceEvent(); void slotDeviceEvent();
/*
* Get the screen number
*/
int getScreenNumber() const;
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment