提交 cc56634e 编写于 作者: F fryshorts

linux-xshm: Handle missing screens.

This adds a check to the screen enumeration in order to handle missing
screens by adding them to the list but disabling them.
上级 67ca94f7
...@@ -260,6 +260,7 @@ static bool xshm_server_changed(obs_properties_t *props, ...@@ -260,6 +260,7 @@ static bool xshm_server_changed(obs_properties_t *props,
UNUSED_PARAMETER(p); UNUSED_PARAMETER(p);
bool advanced = obs_data_get_bool(settings, "advanced"); bool advanced = obs_data_get_bool(settings, "advanced");
int_fast32_t old_screen = obs_data_get_int(settings, "screen");
const char *server = obs_data_get_string(settings, "server"); const char *server = obs_data_get_string(settings, "server");
obs_property_t *screens = obs_properties_get(props, "screen"); obs_property_t *screens = obs_properties_get(props, "screen");
...@@ -296,6 +297,16 @@ static bool xshm_server_changed(obs_properties_t *props, ...@@ -296,6 +297,16 @@ static bool xshm_server_changed(obs_properties_t *props,
obs_property_list_add_int(screens, screen_info.array, i); obs_property_list_add_int(screens, screen_info.array, i);
} }
/* handle missing screen */
if (old_screen + 1 > count) {
dstr_printf(&screen_info, "Screen %"PRIuFAST32" (not found)",
old_screen);
size_t index = obs_property_list_add_int(screens,
screen_info.array, old_screen);
obs_property_list_item_disable(screens, index, true);
}
dstr_free(&screen_info); dstr_free(&screen_info);
XCloseDisplay(dpy); XCloseDisplay(dpy);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册