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

Unified Diff: ui/views/widget/desktop_aura/desktop_screen_x11.cc

Issue 2398343002: X11: Avoid round-tripping to get the cursor position (Closed)
Patch Set: Add DCHECK Created 4 years, 2 months 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.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/desktop_screen_x11.cc
diff --git a/ui/views/widget/desktop_aura/desktop_screen_x11.cc b/ui/views/widget/desktop_aura/desktop_screen_x11.cc
index 96f20cca2160c9983c4ea002fb5be5eec4dd92e0..9e821e76490e8965cfe0a78084a8e9fbaf2e3456 100644
--- a/ui/views/widget/desktop_aura/desktop_screen_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_screen_x11.cc
@@ -22,6 +22,7 @@
#include "ui/display/util/display_util.h"
#include "ui/display/util/x11/edid_parser_x11.h"
#include "ui/events/platform/platform_event_source.h"
+#include "ui/events/platform/x11/x11_event_source.h"
#include "ui/gfx/font_render_params.h"
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/geometry/size_conversions.h"
@@ -133,20 +134,18 @@ DesktopScreenX11::~DesktopScreenX11() {
gfx::Point DesktopScreenX11::GetCursorScreenPoint() {
TRACE_EVENT0("views", "DesktopScreenX11::GetCursorScreenPoint()");
- XDisplay* display = gfx::GetXDisplay();
+ if (ui::X11EventSource::HasInstance()) {
+ auto point = ui::X11EventSource::GetInstance()
+ ->GetRootCursorLocationFromCurrentEvent();
+ if (point)
+ return point.value();
+ }
::Window root, child;
int root_x, root_y, win_x, win_y;
unsigned int mask;
- XQueryPointer(display,
- DefaultRootWindow(display),
- &root,
- &child,
- &root_x,
- &root_y,
- &win_x,
- &win_y,
- &mask);
+ XQueryPointer(xdisplay_, x_root_window_, &root, &child, &root_x, &root_y,
+ &win_x, &win_y, &mask);
return PixelToDIPPoint(gfx::Point(root_x, root_y));
}
« no previous file with comments | « ui/events/platform/x11/x11_event_source.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698