Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
e113aa4f
O
obs-studio
项目概览
尘离序散
/
obs-studio
与 Fork 源项目一致
从无法访问的项目Fork
通知
30
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
obs-studio
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e113aa4f
编写于
12月 19, 2014
作者:
J
Jim
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #308 from jakeprobst/master
linux x11: get monitors with x11 if xinerama is not found
上级
de6e9972
cc2d3b2d
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
66 addition
and
43 deletion
+66
-43
cmake/Modules/FindXCB.cmake
cmake/Modules/FindXCB.cmake
+7
-1
obs/CMakeLists.txt
obs/CMakeLists.txt
+11
-8
obs/platform-x11.cpp
obs/platform-x11.cpp
+48
-34
未找到文件。
cmake/Modules/FindXCB.cmake
浏览文件 @
e113aa4f
...
...
@@ -53,7 +53,8 @@ set(knownComponents XCB
UTIL
XFIXES
XTEST
XV
)
XV
XINERAMA
)
unset
(
unknownComponents
)
...
...
@@ -111,6 +112,8 @@ foreach(comp ${comps})
list
(
APPEND pkgConfigModules
"xcb-xtest"
)
elseif
(
"
${
comp
}
"
STREQUAL
"XV"
)
list
(
APPEND pkgConfigModules
"xcb-xv"
)
elseif
(
"
${
comp
}
"
STREQUAL
"XINERAMA"
)
list
(
APPEND pkgConfigModules
"xcb-xinerama"
)
endif
()
endif
()
endforeach
()
...
...
@@ -187,6 +190,9 @@ macro(_XCB_HANDLE_COMPONENT _comp)
elseif
(
"
${
_comp
}
"
STREQUAL
"XV"
)
set
(
_header
"xcb/xv.h"
)
set
(
_lib
"xcb-xv"
)
elseif
(
"
${
_comp
}
"
STREQUAL
"XINERAMA"
)
set
(
_header
"xcb/xinerama.h"
)
set
(
_lib
"xcb-xinerama"
)
endif
()
find_path
(
XCB_
${
_comp
}
_INCLUDE_DIR NAMES
${
_header
}
HINTS
${
PKG_XCB_INCLUDE_DIRS
}
)
...
...
obs/CMakeLists.txt
浏览文件 @
e113aa4f
...
...
@@ -70,16 +70,19 @@ elseif(UNIX)
set
(
obs_PLATFORM_SOURCES
platform-x11.cpp
)
find_package
(
X11
)
include_directories
(
${
X11_INCLUDE_DIRS
}
${
X11_Xinerama_INCLUDE_PATH
}
)
find_package
(
XCB COMPONENTS XCB REQUIRED RANDR REQUIRED XINERAMA REQUIRED
)
if
(
NOT X11_Xinerama_FOUND
)
message
(
FATAL_ERROR
"Xinerama not found!"
)
endif
()
include_directories
(
${
XCB_INCLUDE_DIRS
}
${
X11_XCB_INCLUDE_DIRS
}
)
add_definitions
(
${
XCB_DEFINITIONS
}
${
X11_XCB_DEFINITIONS
}
)
set
(
obs_PLATFORM_LIBRARIES
${
X
11
_LIBRARIES
}
${
X11_X
inerama_LIB
}
${
X
CB
_LIBRARIES
}
${
X11_X
CB_LIBRARIES
}
Qt5::X11Extras
)
endif
()
...
...
obs/platform-x11.cpp
浏览文件 @
e113aa4f
...
...
@@ -23,8 +23,9 @@
#include <obs-config.h>
#include "obs-app.hpp"
#include <X11/Xlib.h>
#include <X11/extensions/Xinerama.h>
#include <xcb/xcb.h>
#include <xcb/xinerama.h>
#include <xcb/randr.h>
#include <unistd.h>
#include <sstream>
#include <locale.h>
...
...
@@ -64,41 +65,54 @@ bool GetDataFilePath(const char *data, string &output)
void
GetMonitors
(
vector
<
MonitorInfo
>
&
monitors
)
{
int
num_screens
;
XineramaScreenInfo
*
screens
;
int
event_code
=
0
,
error_code
=
0
;
Display
*
display
=
XOpenDisplay
(
NULL
);
if
(
!
XineramaQueryExtension
(
display
,
&
event_code
,
&
error_code
))
{
printf
(
"Xinerama extension unavailable. We don't handle this "
"yet.
\n
"
);
return
;
}
/* Do I need to make a call to XineramaQueryVersion...? */
screens
=
XineramaQueryScreens
(
display
,
&
num_screens
);
if
(
num_screens
==
0
||
!
screens
)
{
printf
(
"Xinerama isn't active on this screen.
\n
"
);
return
;
}
xcb_connection_t
*
xcb_conn
;
monitors
.
clear
();
xcb_conn
=
xcb_connect
(
NULL
,
NULL
);
if
(
xcb_get_extension_data
(
xcb_conn
,
&
xcb_xinerama_id
)
->
present
)
{
xcb_xinerama_is_active_cookie_t
xinerama_cookie
;
xcb_xinerama_is_active_reply_t
*
xinerama_reply
=
NULL
;
xcb_xinerama_query_screens_cookie_t
screens_cookie
;
xcb_xinerama_query_screens_reply_t
*
screens_reply
=
NULL
;
xcb_xinerama_screen_info_iterator_t
iter
;
xinerama_cookie
=
xcb_xinerama_is_active
(
xcb_conn
);
xinerama_reply
=
xcb_xinerama_is_active_reply
(
xcb_conn
,
xinerama_cookie
,
NULL
);
if
(
xinerama_reply
==
NULL
||
xinerama_reply
->
state
==
0
)
{
free
(
xinerama_reply
);
goto
err
;
}
do
{
--
num_screens
;
monitors
.
emplace_back
(
screens
[
num_screens
].
x_org
,
screens
[
num_screens
].
y_org
,
screens
[
num_screens
].
width
,
screens
[
num_screens
].
height
);
}
while
(
num_screens
>
0
);
screens_cookie
=
xcb_xinerama_query_screens
(
xcb_conn
);
screens_reply
=
xcb_xinerama_query_screens_reply
(
xcb_conn
,
screens_cookie
,
NULL
);
iter
=
xcb_xinerama_query_screens_screen_info_iterator
(
screens_reply
);
for
(;
iter
.
rem
;
xcb_xinerama_screen_info_next
(
&
iter
))
{
monitors
.
emplace_back
(
iter
.
data
->
x_org
,
iter
.
data
->
y_org
,
iter
.
data
->
width
,
iter
.
data
->
height
);
}
free
(
xinerama_reply
);
free
(
screens_reply
);
}
else
{
// no xinerama so fall back to basic x11 calls
xcb_screen_iterator_t
iter
;
iter
=
xcb_setup_roots_iterator
(
xcb_get_setup
(
xcb_conn
));
for
(;
iter
.
rem
;
xcb_screen_next
(
&
iter
))
{
monitors
.
emplace_back
(
0
,
0
,
iter
.
data
->
width_in_pixels
,
iter
.
data
->
height_in_pixels
);
}
}
XFree
(
screens
);
XCloseDisplay
(
display
);
err:
xcb_disconnect
(
xcb_conn
);
}
bool
InitApplicationBundle
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录