mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-03-28 08:37:15 +00:00
Abort when we don't have permission for either input or x11 display
This commit is contained in:
parent
a104862830
commit
19f3bc3a5b
@ -1 +1 @@
|
||||
Subproject commit e60a7ef75f02559e7c5271f4e08f815af5f4a8cc
|
||||
Subproject commit cfeb0ffd90992ee0fa4b6b4a179652e3e2786873
|
@ -134,7 +134,15 @@ void blend_cursor(Display *display, std::uint8_t *img_data, int width, int heigh
|
||||
}
|
||||
}
|
||||
struct x11_attr_t : public display_t {
|
||||
x11_attr_t() : xdisplay {XOpenDisplay(nullptr) }, xwindow {DefaultRootWindow(xdisplay.get()) }, xattr {} {
|
||||
x11_attr_t() : xdisplay {XOpenDisplay(nullptr) }, xwindow { }, xattr {} {
|
||||
if(!xdisplay) {
|
||||
BOOST_LOG(fatal) << "Could not open x11 display"sv;
|
||||
log_flush();
|
||||
std::abort();
|
||||
}
|
||||
|
||||
xwindow = DefaultRootWindow(xdisplay.get());
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
@ -421,16 +421,22 @@ input_t input() {
|
||||
auto &gp = *(input_raw_t*)result.get();
|
||||
|
||||
gp.keyboard.reset(XOpenDisplay(nullptr));
|
||||
|
||||
// If we do not have a keyboard, gamepad or mouse, no input is possible and we should abort
|
||||
if(!gp.keyboard) {
|
||||
return nullptr;
|
||||
BOOST_LOG(fatal) << "Could not open x11 display for keyboard"sv;
|
||||
log_flush();
|
||||
std::abort();
|
||||
}
|
||||
|
||||
if(gamepad(gp)) {
|
||||
return nullptr;
|
||||
log_flush();
|
||||
std::abort();
|
||||
}
|
||||
|
||||
if(mouse(gp)) {
|
||||
return nullptr;
|
||||
log_flush();
|
||||
std::abort();
|
||||
}
|
||||
|
||||
std::filesystem::path mouse_path { "sunshine_mouse" };
|
||||
|
Loading…
x
Reference in New Issue
Block a user