aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/display/window.rs
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2022-02-02 00:12:58 +0300
committerGitHub <noreply@github.com>2022-02-02 00:12:58 +0300
commit8f1abe13e6b80da181ee856e6d5a19c7731dbedc (patch)
treeafab9579c3fb1019cdda9fb7d006a51ebcd929d6 /alacritty/src/display/window.rs
parentd58dff18effc204d7fc9f05dac9d0b25be26ee1a (diff)
downloadr-alacritty-8f1abe13e6b80da181ee856e6d5a19c7731dbedc.tar.gz
r-alacritty-8f1abe13e6b80da181ee856e6d5a19c7731dbedc.tar.bz2
r-alacritty-8f1abe13e6b80da181ee856e6d5a19c7731dbedc.zip
Add damage tracking and reporting to compatible compositors
This allows compositors to only process damaged (that is, updated) regions of our window buffer, which for larger window sizes (think 4k) should significantly reduce compositing workload under compositors that support/honor it, which is good for performance, battery life and lower latency over remote connections like VNC. On Wayland, clients are expected to always report correct damage, so this makes us a good citizen there. It can also aid remote desktop (waypipe, rdp, vnc, ...) and other types of screencopy by having damage bubble up correctly. Fixes #3186.
Diffstat (limited to 'alacritty/src/display/window.rs')
-rw-r--r--alacritty/src/display/window.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/alacritty/src/display/window.rs b/alacritty/src/display/window.rs
index 493e5ef9..712b4ac9 100644
--- a/alacritty/src/display/window.rs
+++ b/alacritty/src/display/window.rs
@@ -39,7 +39,7 @@ use glutin::platform::windows::IconExtWindows;
use glutin::window::{
CursorIcon, Fullscreen, UserAttentionType, Window as GlutinWindow, WindowBuilder, WindowId,
};
-use glutin::{self, ContextBuilder, PossiblyCurrent, WindowedContext};
+use glutin::{self, ContextBuilder, PossiblyCurrent, Rect, WindowedContext};
#[cfg(target_os = "macos")]
use objc::{msg_send, sel, sel_impl};
#[cfg(target_os = "macos")]
@@ -428,6 +428,14 @@ impl Window {
self.windowed_context.swap_buffers().expect("swap buffers");
}
+ pub fn swap_buffers_with_damage(&self, damage: &[Rect]) {
+ self.windowed_context.swap_buffers_with_damage(damage).expect("swap buffes with damage");
+ }
+
+ pub fn swap_buffers_with_damage_supported(&self) -> bool {
+ self.windowed_context.swap_buffers_with_damage_supported()
+ }
+
pub fn resize(&self, size: PhysicalSize<u32>) {
self.windowed_context.resize(size);
}