diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-07-25 05:20:52 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-07-25 05:20:52 +0200 |
commit | 71149bba010ee277110b8ac39eb113034c823583 (patch) | |
tree | 8cd370dca467e3356a6c68a3ff4827a26e30e955 /src/main.cpp | |
parent | 061f885fc6e5d3a4f44e52dfb398dc7829c4479a (diff) |
Revert "Use expose instead of visibility event"
This reverts commit be69d51f25189dba52f0c0d97906e9d1af3986fd.
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp index 5d06268..6afbc82 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1173,7 +1173,7 @@ int main(int argc, char **argv) { // avcodec_close(av_codec_context); if(dpy) - XSelectInput(dpy, src_window_id, StructureNotifyMask | ExposureMask); + XSelectInput(dpy, src_window_id, StructureNotifyMask | VisibilityChangeMask); /* int damage_event; @@ -1245,6 +1245,7 @@ int main(int argc, char **argv) { double record_start_time = glfwGetTime(); std::deque<AVPacket> frame_data_queue; bool frames_erased = false; + int prev_visibility_state = VisibilityFullyObscured; SoundDevice sound_device; uint8_t *audio_frame_buf; @@ -1318,9 +1319,12 @@ int main(int argc, char **argv) { running = 0; } - if (XCheckTypedWindowEvent(dpy, src_window_id, Expose, &e) && e.xexpose.count == 0) { - window_resize_timer = glfwGetTime(); - window_resized = true; + if (XCheckTypedWindowEvent(dpy, src_window_id, VisibilityNotify, &e)) { + if((prev_visibility_state == VisibilityFullyObscured && e.xvisibility.state != VisibilityFullyObscured) || (e.xvisibility.state == prev_visibility_state)) { + window_resize_timer = glfwGetTime(); + window_resized = true; + } + prev_visibility_state = e.xvisibility.state; } if (XCheckTypedWindowEvent(dpy, src_window_id, ConfigureNotify, &e) && e.xconfigure.window == src_window_id) { |