Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Unified Diff: ui/events/platform/x11/x11_event_source.cc

Issue 2568233003: X11: Reset dispatching event when nested message loop ends (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/platform/x11/x11_event_source.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/platform/x11/x11_event_source.cc
diff --git a/ui/events/platform/x11/x11_event_source.cc b/ui/events/platform/x11/x11_event_source.cc
index b67543d53f3d8d477afb1f4e382fc67f52289299..9fbfe0d656d166a727423d94a3db02013fdc7aa4 100644
--- a/ui/events/platform/x11/x11_event_source.cc
+++ b/ui/events/platform/x11/x11_event_source.cc
@@ -96,6 +96,7 @@ X11EventSource::X11EventSource(X11EventSourceDelegate* delegate,
XDisplay* display)
: delegate_(delegate),
display_(display),
+ dispatching_event_(nullptr),
dummy_initialized_(false),
continue_stream_(true) {
DCHECK(!instance_);
@@ -183,9 +184,8 @@ Time X11EventSource::GetCurrentServerTime() {
}
Time X11EventSource::GetTimestamp() {
- if (!dispatching_events_.empty()) {
- DCHECK(dispatching_events_.top());
- Time timestamp = ExtractTimeFromXEvent(*dispatching_events_.top());
+ if (dispatching_event_) {
+ Time timestamp = ExtractTimeFromXEvent(*dispatching_event_);
if (timestamp != CurrentTime)
return timestamp;
}
@@ -195,10 +195,10 @@ Time X11EventSource::GetTimestamp() {
base::Optional<gfx::Point>
X11EventSource::GetRootCursorLocationFromCurrentEvent() const {
- if (dispatching_events_.empty())
+ if (!dispatching_event_)
return base::nullopt;
- XEvent* event = dispatching_events_.top();
+ XEvent* event = dispatching_event_;
DCHECK(event);
bool is_xi2_event = event->type == GenericEvent;
@@ -239,12 +239,12 @@ void X11EventSource::ExtractCookieDataDispatchEvent(XEvent* xevent) {
have_cookie = true;
}
- dispatching_events_.push(xevent);
+ dispatching_event_ = xevent;
delegate_->ProcessXEvent(xevent);
PostDispatchEvent(xevent);
- dispatching_events_.pop();
+ dispatching_event_ = nullptr;
if (have_cookie)
XFreeEventData(xevent->xgeneric.display, &xevent->xcookie);
« no previous file with comments | « ui/events/platform/x11/x11_event_source.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698