mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1037997 - Added possibility to choose monitors during screen capturing. r=florian,jesup
This commit is contained in:
parent
f9860ceb25
commit
a0fa9344ce
@ -571,6 +571,10 @@ getUserMedia.noScreen.label = No Screen
|
||||
getUserMedia.noWindow.label = No Window
|
||||
getUserMedia.noAudio.label = No Audio
|
||||
getUserMedia.shareEntireScreen.label = Entire screen
|
||||
# LOCALIZATION NOTE (getUserMedia.shareMonitor.label):
|
||||
# %S is screen number (digits 1, 2, etc)
|
||||
# Example: Screen 1, Screen 2,..
|
||||
getUserMedia.shareMonitor.label = Screen %S
|
||||
# LOCALIZATION NOTE (getUserMedia.shareApplicationWindowCount.label):
|
||||
# Semicolon-separated list of plural forms.
|
||||
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
|
||||
|
@ -432,12 +432,18 @@ function prompt(aBrowser, aRequest) {
|
||||
menupopup.appendChild(chromeDoc.createElement("menuseparator"));
|
||||
|
||||
// Build the list of 'devices'.
|
||||
let monitorIndex = 1;
|
||||
for (let i = 0; i < devices.length; ++i) {
|
||||
let name;
|
||||
// Screen has a special treatment because we currently only support
|
||||
// sharing the primary screen and want to display a localized string.
|
||||
// Building screen list from available screens.
|
||||
if (type == "screen") {
|
||||
name = stringBundle.getString("getUserMedia.shareEntireScreen.label");
|
||||
if (devices[i].name == "Primary Monitor") {
|
||||
name = stringBundle.getString("getUserMedia.shareEntireScreen.label");
|
||||
} else {
|
||||
name = stringBundle.getFormattedString("getUserMedia.shareMonitor.label",
|
||||
[monitorIndex]);
|
||||
++monitorIndex;
|
||||
}
|
||||
}
|
||||
else {
|
||||
name = devices[i].name;
|
||||
|
@ -46,6 +46,9 @@ gyp_vars = {
|
||||
'moz_webrtc_omx': 0,
|
||||
'moz_webrtc_mediacodec': 0,
|
||||
|
||||
# Turn off multi monitor screen share
|
||||
'multi_monitor_screenshare%' : 0,
|
||||
|
||||
# (for vp8) chromium sets to 0 also
|
||||
'use_temporal_layers': 0,
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
{
|
||||
'variables': {
|
||||
'multi_monitor_screenshare%' : 0,
|
||||
'multi_monitor_screenshare%' : 1,
|
||||
},
|
||||
'targets': [
|
||||
{
|
||||
|
@ -21,9 +21,7 @@ protected:
|
||||
virtual void InitializeScreenList() OVERRIDE;
|
||||
|
||||
private:
|
||||
#if !defined(MULTI_MONITOR_SCREENSHARE)
|
||||
void MultiMonitorScreenshare();
|
||||
#endif
|
||||
};
|
||||
|
||||
}// namespace webrtc
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <AppKit/AppKit.h>
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#include <unistd.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <map>
|
||||
|
||||
@ -14,7 +15,6 @@ namespace webrtc {
|
||||
// Helper type to track the number of window instances for a given process
|
||||
typedef std::map<ProcessId, uint32_t> AppWindowCountMap;
|
||||
|
||||
#define MULTI_MONITOR_NO_SUPPORT 1
|
||||
|
||||
DesktopDeviceInfo * DesktopDeviceInfoImpl::Create() {
|
||||
DesktopDeviceInfoMac * pDesktopDeviceInfo = new DesktopDeviceInfoMac();
|
||||
@ -31,27 +31,50 @@ DesktopDeviceInfoMac::DesktopDeviceInfoMac() {
|
||||
DesktopDeviceInfoMac::~DesktopDeviceInfoMac() {
|
||||
}
|
||||
|
||||
#if !defined(MULTI_MONITOR_SCREENSHARE)
|
||||
void DesktopDeviceInfoMac::MultiMonitorScreenshare()
|
||||
{
|
||||
DesktopDisplayDevice *pDesktopDeviceInfo = new DesktopDisplayDevice;
|
||||
if (pDesktopDeviceInfo) {
|
||||
pDesktopDeviceInfo->setScreenId(CGMainDisplayID());
|
||||
pDesktopDeviceInfo->setDeviceName("Primary Monitor");
|
||||
#if !defined(MULTI_MONITOR_SCREENSHARE)
|
||||
DesktopDisplayDevice* desktop_device_info = new DesktopDisplayDevice;
|
||||
if (desktop_device_info) {
|
||||
desktop_device_info->setScreenId(CGMainDisplayID());
|
||||
desktop_device_info->setDeviceName("Primary Monitor");
|
||||
|
||||
char idStr[64];
|
||||
snprintf(idStr, sizeof(idStr), "%ld", pDesktopDeviceInfo->getScreenId());
|
||||
pDesktopDeviceInfo->setUniqueIdName(idStr);
|
||||
desktop_display_list_[pDesktopDeviceInfo->getScreenId()] = pDesktopDeviceInfo;
|
||||
snprintf(idStr, sizeof(idStr), "%" PRIdPTR, desktop_device_info->getScreenId());
|
||||
desktop_device_info->setUniqueIdName(idStr);
|
||||
desktop_display_list_[desktop_device_info->getScreenId()] = desktop_device_info;
|
||||
}
|
||||
#else
|
||||
const UInt32 kMaxScreens = 256;
|
||||
CGDirectDisplayID screens[kMaxScreens];
|
||||
CGDisplayCount num_of_screens;
|
||||
CGGetActiveDisplayList(kMaxScreens, screens, &num_of_screens);
|
||||
|
||||
for (CFIndex i = 0; i < num_of_screens; ++i) {
|
||||
DesktopDisplayDevice* desktop_device_info = new DesktopDisplayDevice;
|
||||
if (desktop_device_info) {
|
||||
desktop_device_info->setScreenId(screens[i]);
|
||||
if (1 >= num_of_screens) {
|
||||
desktop_device_info->setDeviceName("Primary Monitor");
|
||||
} else {
|
||||
char nameStr[64];
|
||||
snprintf(nameStr, sizeof(nameStr), "Screen %" PRIdPTR, i + 1);
|
||||
desktop_device_info->setDeviceName(nameStr);
|
||||
}
|
||||
|
||||
char idStr[64];
|
||||
snprintf(idStr, sizeof(idStr), "%" PRIdPTR, desktop_device_info->getScreenId());
|
||||
desktop_device_info->setUniqueIdName(idStr);
|
||||
desktop_display_list_[desktop_device_info->getScreenId()] = desktop_device_info;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DesktopDeviceInfoMac::InitializeScreenList() {
|
||||
#if !defined(MULTI_MONITOR_SCREENSHARE)
|
||||
MultiMonitorScreenshare();
|
||||
#endif
|
||||
}
|
||||
|
||||
void DesktopDeviceInfoMac::InitializeApplicationList() {
|
||||
//List all running applications (excluding background processes).
|
||||
|
||||
|
@ -3,7 +3,9 @@
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "webrtc/modules/desktop_capture/win/desktop_device_info_win.h"
|
||||
#include "webrtc/modules/desktop_capture/win/screen_capture_utils.h"
|
||||
#include "webrtc/modules/desktop_capture/win/win_shared.h"
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// Duplicating declaration so that it always resolves in decltype use
|
||||
@ -31,27 +33,49 @@ DesktopDeviceInfoWin::DesktopDeviceInfoWin() {
|
||||
DesktopDeviceInfoWin::~DesktopDeviceInfoWin() {
|
||||
}
|
||||
|
||||
#if !defined(MULTI_MONITOR_SCREENSHARE)
|
||||
void DesktopDeviceInfoWin::MultiMonitorScreenshare()
|
||||
{
|
||||
DesktopDisplayDevice *pDesktopDeviceInfo = new DesktopDisplayDevice;
|
||||
if (pDesktopDeviceInfo) {
|
||||
pDesktopDeviceInfo->setScreenId(webrtc::kFullDesktopScreenId);
|
||||
pDesktopDeviceInfo->setDeviceName("Primary Monitor");
|
||||
#if !defined(MULTI_MONITOR_SCREENSHARE)
|
||||
DesktopDisplayDevice* desktop_device_info = new DesktopDisplayDevice;
|
||||
if (desktop_device_info) {
|
||||
desktop_device_info->setScreenId(webrtc::kFullDesktopScreenId);
|
||||
desktop_device_info->setDeviceName("Primary Monitor");
|
||||
|
||||
char idStr[64];
|
||||
_snprintf_s(idStr, sizeof(idStr), sizeof(idStr) - 1, "%ld", pDesktopDeviceInfo->getScreenId());
|
||||
pDesktopDeviceInfo->setUniqueIdName(idStr);
|
||||
desktop_display_list_[pDesktopDeviceInfo->getScreenId()] = pDesktopDeviceInfo;
|
||||
char idStr[64];
|
||||
_snprintf_s(idStr, sizeof(idStr), sizeof(idStr) - 1, "%" PRIdPTR, desktop_device_info->getScreenId());
|
||||
desktop_device_info->setUniqueIdName(idStr);
|
||||
desktop_display_list_[desktop_device_info->getScreenId()] = desktop_device_info;
|
||||
}
|
||||
#else
|
||||
ScreenCapturer::ScreenList screens;
|
||||
GetScreenList(&screens);
|
||||
auto num_of_screens = screens.size();
|
||||
|
||||
for (decltype(num_of_screens) i = 0; i < num_of_screens; ++i) {
|
||||
DesktopDisplayDevice* desktop_device_info = new DesktopDisplayDevice;
|
||||
if (desktop_device_info) {
|
||||
desktop_device_info->setScreenId(screens[i].id);
|
||||
if (1 >= num_of_screens) {
|
||||
desktop_device_info->setDeviceName("Primary Monitor");
|
||||
} else {
|
||||
char nameStr[64];
|
||||
_snprintf_s(nameStr, sizeof(nameStr), sizeof(nameStr) - 1, "Screen %" PRIdPTR, i + 1);
|
||||
desktop_device_info->setDeviceName(nameStr);
|
||||
}
|
||||
|
||||
char idStr[64];
|
||||
_snprintf_s(idStr, sizeof(idStr), sizeof(idStr) - 1, "%" PRIdPTR, desktop_device_info->getScreenId());
|
||||
desktop_device_info->setUniqueIdName(idStr);
|
||||
desktop_display_list_[desktop_device_info->getScreenId()] = desktop_device_info;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DesktopDeviceInfoWin::InitializeScreenList() {
|
||||
#if !defined(MULTI_MONITOR_SCREENSHARE)
|
||||
MultiMonitorScreenshare();
|
||||
#endif
|
||||
}
|
||||
|
||||
void DesktopDeviceInfoWin::InitializeApplicationList() {
|
||||
// List all running applications exclude background process.
|
||||
HWND hWnd;
|
||||
|
@ -21,9 +21,7 @@ protected:
|
||||
virtual void InitializeScreenList() OVERRIDE;
|
||||
|
||||
private:
|
||||
#if !defined(MULTI_MONITOR_SCREENSHARE)
|
||||
void MultiMonitorScreenshare();
|
||||
#endif
|
||||
};
|
||||
|
||||
}// namespace webrtc
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "webrtc/system_wrappers/interface/logging.h"
|
||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||
#include "webrtc/system_wrappers/interface/scoped_refptr.h"
|
||||
#include <inttypes.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include "webrtc/modules/desktop_capture/x11/shared_x_util.h"
|
||||
@ -30,27 +31,24 @@ DesktopDeviceInfoX11::DesktopDeviceInfoX11() {
|
||||
DesktopDeviceInfoX11::~DesktopDeviceInfoX11() {
|
||||
}
|
||||
|
||||
#if !defined(MULTI_MONITOR_SCREENSHARE)
|
||||
void DesktopDeviceInfoX11::MultiMonitorScreenshare()
|
||||
{
|
||||
DesktopDisplayDevice *pDesktopDeviceInfo = new DesktopDisplayDevice;
|
||||
if (pDesktopDeviceInfo) {
|
||||
pDesktopDeviceInfo->setScreenId(webrtc::kFullDesktopScreenId);
|
||||
pDesktopDeviceInfo->setDeviceName("Primary Monitor");
|
||||
DesktopDisplayDevice* desktop_device_info = new DesktopDisplayDevice;
|
||||
if (desktop_device_info) {
|
||||
desktop_device_info->setScreenId(webrtc::kFullDesktopScreenId);
|
||||
desktop_device_info->setDeviceName("Primary Monitor");
|
||||
|
||||
char idStr[64];
|
||||
snprintf(idStr, sizeof(idStr), "%ld", idStr);
|
||||
pDesktopDeviceInfo->setUniqueIdName(idStr);
|
||||
desktop_display_list_[pDesktopDeviceInfo->getScreenId()] = pDesktopDeviceInfo;
|
||||
snprintf(idStr, sizeof(idStr), "%" PRIdPTR, desktop_device_info->getScreenId());
|
||||
desktop_device_info->setUniqueIdName(idStr);
|
||||
desktop_display_list_[desktop_device_info->getScreenId()] = desktop_device_info;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void DesktopDeviceInfoX11::InitializeScreenList() {
|
||||
#if !defined(MULTI_MONITOR_SCREENSHARE)
|
||||
MultiMonitorScreenshare();
|
||||
#endif
|
||||
}
|
||||
|
||||
void DesktopDeviceInfoX11::InitializeApplicationList() {
|
||||
//List all running applications exclude background process.
|
||||
scoped_refptr<SharedXDisplay> SharedDisplay = SharedXDisplay::CreateDefault();
|
||||
|
@ -25,9 +25,7 @@ protected:
|
||||
virtual void InitializeScreenList() OVERRIDE;
|
||||
|
||||
private:
|
||||
#if !defined(MULTI_MONITOR_SCREENSHARE)
|
||||
void MultiMonitorScreenshare();
|
||||
#endif
|
||||
};
|
||||
|
||||
}// namespace webrtc
|
||||
|
Loading…
Reference in New Issue
Block a user