Commit 366a4d12 authored by Maksim Sisov's avatar Maksim Sisov Committed by Commit Bot

[ozone/x11] Implement HasCapture method

When user clicks on a non client area, the content
area stops receiving events because base implementation
of the HasCapture method always returns false. This
confuses the capture client, and capture is never
reset.

Thus, to fix the problem, implement the method on
the X11WindowOzone level and provide up-to-date
information whether the window has explicit capture
or not.

Bug: 789065
Change-Id: I4445f4cceb7c801f0ab0cfe4df005e977ba36569
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1657829Reviewed-by: default avatarkylechar <kylechar@chromium.org>
Commit-Queue: Maksim Sisov <msisov@igalia.com>
Cr-Commit-Position: refs/heads/master@{#669142}
parent ed1767d6
...@@ -44,6 +44,10 @@ void X11WindowOzone::ReleaseCapture() { ...@@ -44,6 +44,10 @@ void X11WindowOzone::ReleaseCapture() {
window_manager_->UngrabEvents(this); window_manager_->UngrabEvents(this);
} }
bool X11WindowOzone::HasCapture() const {
return window_manager_->event_grabber() == this;
}
void X11WindowOzone::SetCursor(PlatformCursor cursor) { void X11WindowOzone::SetCursor(PlatformCursor cursor) {
X11CursorOzone* cursor_ozone = static_cast<X11CursorOzone*>(cursor); X11CursorOzone* cursor_ozone = static_cast<X11CursorOzone*>(cursor);
XDefineCursor(xdisplay(), xwindow(), cursor_ozone->xcursor()); XDefineCursor(xdisplay(), xwindow(), cursor_ozone->xcursor());
......
...@@ -31,6 +31,7 @@ class X11WindowOzone : public X11WindowBase, ...@@ -31,6 +31,7 @@ class X11WindowOzone : public X11WindowBase,
void PrepareForShutdown() override; void PrepareForShutdown() override;
void SetCapture() override; void SetCapture() override;
void ReleaseCapture() override; void ReleaseCapture() override;
bool HasCapture() const override;
void SetCursor(PlatformCursor cursor) override; void SetCursor(PlatformCursor cursor) override;
// XEventDispatcher: // XEventDispatcher:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment