Spool fix_local_coordinates() call until release

This will cause the function to only be called on a `ConfigureNotify`
after all mouse buttons have been released. This prevents flickering
when dragging windows around.
This commit is contained in:
Robbert van der Helm
2023-04-28 15:27:02 +02:00
parent b8a115f655
commit 9005474ded
3 changed files with 62 additions and 1 deletions
+20
View File
@@ -234,6 +234,11 @@ class Editor {
* Lie to the Wine window about its coordinates on the screen for
* reparenting without using XEmbed. See the comment at the top of the
* implementation on why this is needed.
*
* One of the events that trigger this is `ConfigureNotify` messages. Some
* WMs may continuously send this message while dragging a window around. To
* avoid flickering, the main `handle_x11_events()` function will wait to
* call this function until the all mouse buttons have been released.
*/
void fix_local_coordinates() const;
@@ -312,6 +317,12 @@ class Editor {
*/
std::optional<POINT> get_current_pointer_position() const noexcept;
/**
* Checks whether any mouse button is held. Used to defer calling
* `fix_local_coordinates()` when dragging windows around.
*/
bool is_mouse_button_held() const;
/**
* Returns `true` if the currently active window (as per
* `_NET_ACTIVE_WINDOW`) contains `wine_window_`. If the window manager does
@@ -451,6 +462,15 @@ class Editor {
*/
xcb_window_t host_window_;
/**
* Used to delay calling `fix_local_coordinates()` when dragging windows
* around with the mouse. Some WMs will continuously send `ConfigureNotify`
* messages when dragging windows around, and the `fix_local_coordinates()`
* function may cause the window to blink. This becomes a but jarring if it
* happens 60 times per second while dragging windows around.
*/
bool should_fix_local_coordinates_ = false;
/**
* The atom corresponding to `_NET_ACTIVE_WINDOW`.
*/