Use expose instead of visibility event

This commit is contained in:
dec05eba 2022-07-18 00:13:14 +02:00
parent db4944cd08
commit be69d51f25

View File

@ -1173,7 +1173,7 @@ int main(int argc, char **argv) {
// avcodec_close(av_codec_context); // avcodec_close(av_codec_context);
if(dpy) if(dpy)
XSelectInput(dpy, src_window_id, StructureNotifyMask | VisibilityChangeMask); XSelectInput(dpy, src_window_id, StructureNotifyMask | ExposureMask);
/* /*
int damage_event; int damage_event;
@ -1245,7 +1245,6 @@ int main(int argc, char **argv) {
double record_start_time = glfwGetTime(); double record_start_time = glfwGetTime();
std::deque<AVPacket> frame_data_queue; std::deque<AVPacket> frame_data_queue;
bool frames_erased = false; bool frames_erased = false;
int prev_visibility_state = VisibilityFullyObscured;
SoundDevice sound_device; SoundDevice sound_device;
uint8_t *audio_frame_buf; uint8_t *audio_frame_buf;
@ -1319,13 +1318,10 @@ int main(int argc, char **argv) {
running = 0; running = 0;
} }
if (XCheckTypedWindowEvent(dpy, src_window_id, VisibilityNotify, &e)) { if (XCheckTypedWindowEvent(dpy, src_window_id, Expose, &e) && e.xexpose.count == 0) {
if((prev_visibility_state == VisibilityFullyObscured && e.xvisibility.state != VisibilityFullyObscured) || (e.xvisibility.state == prev_visibility_state)) {
window_resize_timer = glfwGetTime(); window_resize_timer = glfwGetTime();
window_resized = true; window_resized = true;
} }
prev_visibility_state = e.xvisibility.state;
}
if (XCheckTypedWindowEvent(dpy, src_window_id, ConfigureNotify, &e) && e.xconfigure.window == src_window_id) { if (XCheckTypedWindowEvent(dpy, src_window_id, ConfigureNotify, &e) && e.xconfigure.window == src_window_id) {
// Window resize // Window resize