Rename linuxwindowpicker to x11windowpicker & only use it with use_x11
These days we have Linux chromium builds that don't use X11. We don't want webrtc to add an X11 dependency to those builds. BUG=3625 R=henrike@webrtc.org, tnakamura@webrtc.org Review URL: https://webrtc-codereview.appspot.com/20049004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6909 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
5b06b06cc0
commit
fb1eb43377
@ -9,6 +9,7 @@
|
||||
# TODO(kjellander): Rebase this to base.gyp changes after r6438.
|
||||
|
||||
import("//build/config/crypto.gni")
|
||||
import("//build/config/ui.gni")
|
||||
import("../build/webrtc.gni")
|
||||
|
||||
config("webrtc_base_config") {
|
||||
@ -401,8 +402,13 @@ static_library("webrtc_base") {
|
||||
"libdbusglibsymboltable.h",
|
||||
"linuxfdwalk.c",
|
||||
"linuxfdwalk.h",
|
||||
"linuxwindowpicker.cc",
|
||||
"linuxwindowpicker.h",
|
||||
]
|
||||
}
|
||||
|
||||
if (use_x11) {
|
||||
sources += [
|
||||
"x11windowpicker.cc",
|
||||
"x11windowpicker.h",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -127,8 +127,6 @@
|
||||
'linux.h',
|
||||
'linuxfdwalk.c',
|
||||
'linuxfdwalk.h',
|
||||
'linuxwindowpicker.cc',
|
||||
'linuxwindowpicker.h',
|
||||
'linked_ptr.h',
|
||||
'logging.cc',
|
||||
'logging.h',
|
||||
@ -311,6 +309,8 @@
|
||||
'winping.h',
|
||||
'worker.cc',
|
||||
'worker.h',
|
||||
'x11windowpicker.cc',
|
||||
'x11windowpicker.h',
|
||||
'../overrides/webrtc/base/basictypes.h',
|
||||
'../overrides/webrtc/base/constructormagic.h',
|
||||
'../overrides/webrtc/base/logging.cc',
|
||||
@ -381,8 +381,8 @@
|
||||
'libdbusglibsymboltable.h',
|
||||
'linuxfdwalk.c',
|
||||
'linuxfdwalk.h',
|
||||
'linuxwindowpicker.cc',
|
||||
'linuxwindowpicker.h',
|
||||
'x11windowpicker.cc',
|
||||
'x11windowpicker.h',
|
||||
'logging.cc',
|
||||
'logging.h',
|
||||
'macasyncsocket.cc',
|
||||
@ -569,7 +569,7 @@
|
||||
}],
|
||||
],
|
||||
}],
|
||||
['OS=="linux"', {
|
||||
['use_x11 == 1', {
|
||||
'link_settings': {
|
||||
'libraries': [
|
||||
'-ldl',
|
||||
@ -580,6 +580,20 @@
|
||||
'-lXrender',
|
||||
],
|
||||
},
|
||||
}, {
|
||||
'sources!': [
|
||||
'x11windowpicker.cc',
|
||||
'x11windowpicker.h',
|
||||
],
|
||||
}],
|
||||
['OS=="linux"', {
|
||||
'link_settings': {
|
||||
'libraries': [
|
||||
'-lcrypto',
|
||||
'-ldl',
|
||||
'-lrt',
|
||||
],
|
||||
},
|
||||
'conditions': [
|
||||
['build_ssl==1', {
|
||||
'link_settings': {
|
||||
@ -602,8 +616,6 @@
|
||||
'libdbusglibsymboltable.cc',
|
||||
'libdbusglibsymboltable.h',
|
||||
'linuxfdwalk.c',
|
||||
'linuxwindowpicker.cc',
|
||||
'linuxwindowpicker.h',
|
||||
],
|
||||
}],
|
||||
['OS=="mac"', {
|
||||
|
@ -16,8 +16,8 @@
|
||||
#elif defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
|
||||
#include "webrtc/base/macutils.h"
|
||||
#include "webrtc/base/macwindowpicker.h"
|
||||
#elif defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)
|
||||
#include "webrtc/base/linuxwindowpicker.h"
|
||||
#elif defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) && defined(HAVE_X11)
|
||||
#include "webrtc/base/x11windowpicker.h"
|
||||
#endif
|
||||
|
||||
#include "webrtc/base/windowpicker.h"
|
||||
@ -39,7 +39,8 @@ class WindowPickerFactory {
|
||||
#elif defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
|
||||
return new MacWindowPicker();
|
||||
#elif defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) && defined(HAVE_X11)
|
||||
return new LinuxWindowPicker();
|
||||
return new X11WindowPicker();
|
||||
#error
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
|
@ -8,7 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "webrtc/base/linuxwindowpicker.h"
|
||||
#include "webrtc/base/x11windowpicker.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
@ -625,7 +625,7 @@ class XWindowEnumerator {
|
||||
Window app_window = GetApplicationWindow(children[num_children - 1 - i]);
|
||||
#endif
|
||||
if (app_window &&
|
||||
!LinuxWindowPicker::IsDesktopElement(display_, app_window)) {
|
||||
!X11WindowPicker::IsDesktopElement(display_, app_window)) {
|
||||
std::string title;
|
||||
if (GetWindowTitle(app_window, &title)) {
|
||||
WindowId id(app_window);
|
||||
@ -721,13 +721,13 @@ class XWindowEnumerator {
|
||||
bool has_render_extension_;
|
||||
};
|
||||
|
||||
LinuxWindowPicker::LinuxWindowPicker() : enumerator_(new XWindowEnumerator()) {
|
||||
X11WindowPicker::X11WindowPicker() : enumerator_(new XWindowEnumerator()) {
|
||||
}
|
||||
|
||||
LinuxWindowPicker::~LinuxWindowPicker() {
|
||||
X11WindowPicker::~X11WindowPicker() {
|
||||
}
|
||||
|
||||
bool LinuxWindowPicker::IsDesktopElement(_XDisplay* display, Window window) {
|
||||
bool X11WindowPicker::IsDesktopElement(_XDisplay* display, Window window) {
|
||||
if (window == 0) {
|
||||
LOG(LS_WARNING) << "Zero is never a valid window.";
|
||||
return false;
|
||||
@ -769,48 +769,48 @@ bool LinuxWindowPicker::IsDesktopElement(_XDisplay* display, Window window) {
|
||||
return result;
|
||||
}
|
||||
|
||||
bool LinuxWindowPicker::Init() {
|
||||
bool X11WindowPicker::Init() {
|
||||
return enumerator_->Init();
|
||||
}
|
||||
|
||||
bool LinuxWindowPicker::GetWindowList(WindowDescriptionList* descriptions) {
|
||||
bool X11WindowPicker::GetWindowList(WindowDescriptionList* descriptions) {
|
||||
return enumerator_->EnumerateWindows(descriptions);
|
||||
}
|
||||
|
||||
bool LinuxWindowPicker::GetDesktopList(DesktopDescriptionList* descriptions) {
|
||||
bool X11WindowPicker::GetDesktopList(DesktopDescriptionList* descriptions) {
|
||||
return enumerator_->EnumerateDesktops(descriptions);
|
||||
}
|
||||
|
||||
bool LinuxWindowPicker::IsVisible(const WindowId& id) {
|
||||
bool X11WindowPicker::IsVisible(const WindowId& id) {
|
||||
return enumerator_->IsVisible(id);
|
||||
}
|
||||
|
||||
bool LinuxWindowPicker::MoveToFront(const WindowId& id) {
|
||||
bool X11WindowPicker::MoveToFront(const WindowId& id) {
|
||||
return enumerator_->MoveToFront(id);
|
||||
}
|
||||
|
||||
|
||||
uint8* LinuxWindowPicker::GetWindowIcon(const WindowId& id, int* width,
|
||||
uint8* X11WindowPicker::GetWindowIcon(const WindowId& id, int* width,
|
||||
int* height) {
|
||||
return enumerator_->GetWindowIcon(id, width, height);
|
||||
}
|
||||
|
||||
uint8* LinuxWindowPicker::GetWindowThumbnail(const WindowId& id, int width,
|
||||
uint8* X11WindowPicker::GetWindowThumbnail(const WindowId& id, int width,
|
||||
int height) {
|
||||
return enumerator_->GetWindowThumbnail(id, width, height);
|
||||
}
|
||||
|
||||
int LinuxWindowPicker::GetNumDesktops() {
|
||||
int X11WindowPicker::GetNumDesktops() {
|
||||
return enumerator_->GetNumDesktops();
|
||||
}
|
||||
|
||||
uint8* LinuxWindowPicker::GetDesktopThumbnail(const DesktopId& id,
|
||||
uint8* X11WindowPicker::GetDesktopThumbnail(const DesktopId& id,
|
||||
int width,
|
||||
int height) {
|
||||
return enumerator_->GetDesktopThumbnail(id, width, height);
|
||||
}
|
||||
|
||||
bool LinuxWindowPicker::GetDesktopDimensions(const DesktopId& id, int* width,
|
||||
bool X11WindowPicker::GetDesktopDimensions(const DesktopId& id, int* width,
|
||||
int* height) {
|
||||
return enumerator_->GetDesktopDimensions(id, width, height);
|
||||
}
|
@ -23,10 +23,10 @@ namespace rtc {
|
||||
|
||||
class XWindowEnumerator;
|
||||
|
||||
class LinuxWindowPicker : public WindowPicker {
|
||||
class X11WindowPicker : public WindowPicker {
|
||||
public:
|
||||
LinuxWindowPicker();
|
||||
~LinuxWindowPicker();
|
||||
X11WindowPicker();
|
||||
~X11WindowPicker();
|
||||
|
||||
static bool IsDesktopElement(_XDisplay* display, Window window);
|
||||
|
@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
#include "webrtc/base/gunit.h"
|
||||
#include "webrtc/base/linuxwindowpicker.h"
|
||||
#include "webrtc/base/x11windowpicker.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/base/testutils.h"
|
||||
#include "webrtc/base/windowpicker.h"
|
||||
@ -20,17 +20,17 @@
|
||||
|
||||
namespace rtc {
|
||||
|
||||
TEST(LinuxWindowPickerTest, TestGetWindowList) {
|
||||
TEST(X11WindowPickerTest, TestGetWindowList) {
|
||||
MAYBE_SKIP_SCREENCAST_TEST();
|
||||
LinuxWindowPicker window_picker;
|
||||
X11WindowPicker window_picker;
|
||||
WindowDescriptionList descriptions;
|
||||
window_picker.Init();
|
||||
window_picker.GetWindowList(&descriptions);
|
||||
}
|
||||
|
||||
TEST(LinuxWindowPickerTest, TestGetDesktopList) {
|
||||
TEST(X11WindowPickerTest, TestGetDesktopList) {
|
||||
MAYBE_SKIP_SCREENCAST_TEST();
|
||||
LinuxWindowPicker window_picker;
|
||||
X11WindowPicker window_picker;
|
||||
DesktopDescriptionList descriptions;
|
||||
EXPECT_TRUE(window_picker.Init());
|
||||
EXPECT_TRUE(window_picker.GetDesktopList(&descriptions));
|
Loading…
x
Reference in New Issue
Block a user