mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-08-10 00:52:16 +00:00
Fix bug causing a crash when changing resolution of the monitor while in a session
This commit is contained in:
@@ -86,13 +86,17 @@ std::string get_local_ip() { return get_local_ip(AF_INET); }
|
||||
|
||||
struct display_attr_t {
|
||||
display_attr_t() : display { XOpenDisplay(nullptr) }, window { DefaultRootWindow(display) }, attr {} {
|
||||
XGetWindowAttributes(display, window, &attr);
|
||||
refresh();
|
||||
}
|
||||
|
||||
~display_attr_t() {
|
||||
XCloseDisplay(display);
|
||||
}
|
||||
|
||||
void refresh() {
|
||||
XGetWindowAttributes(display, window, &attr);
|
||||
}
|
||||
|
||||
Display *display;
|
||||
Window window;
|
||||
XWindowAttributes attr;
|
||||
@@ -110,6 +114,7 @@ display_t display() {
|
||||
img_t snapshot(display_t &display_void) {
|
||||
auto &display = *((display_attr_t*)display_void.get());
|
||||
|
||||
display.refresh();
|
||||
XImage *img { XGetImage(
|
||||
display.display,
|
||||
display.window,
|
||||
|
||||
Reference in New Issue
Block a user