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

Unified Diff: ui/ozone/platform/x11/gl_surface_glx_ozone.cc

Issue 1723303002: Implement GLX for Ozone X11. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and cleanup. Created 4 years, 3 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
Index: ui/ozone/platform/x11/gl_surface_glx_ozone.cc
diff --git a/ui/ozone/platform/x11/gl_surface_glx_ozone.cc b/ui/ozone/platform/x11/gl_surface_glx_ozone.cc
new file mode 100644
index 0000000000000000000000000000000000000000..74ad75f9fbd99281fc21558b11acdecbb8b71367
--- /dev/null
+++ b/ui/ozone/platform/x11/gl_surface_glx_ozone.cc
@@ -0,0 +1,41 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/ozone/platform/x11/gl_surface_glx_ozone.h"
+
+#include <X11/Xlib.h>
+
+namespace ui {
+
+GLSurfaceGLXOzone::GLSurfaceGLXOzone(gfx::AcceleratedWidget window)
+ : NativeViewGLSurfaceGLX(window) {}
+
+GLSurfaceGLXOzone::~GLSurfaceGLXOzone() {
+ Destroy();
+}
+
+void GLSurfaceGLXOzone::RegisterEvents() {
+ auto* event_source = X11EventSourceLibevent::GetInstance();
+ // Can be null in tests, when we don't care about Exposes.
+ if (event_source) {
+ XSelectInput(gfx::GetXDisplay(), window(), ExposureMask);
+ event_source->AddXEventDispatcher(this);
+ }
+}
+
+void GLSurfaceGLXOzone::UnregisterEvents() {
+ auto* event_source = X11EventSourceLibevent::GetInstance();
+ if (event_source)
+ event_source->RemoveXEventDispatcher(this);
+}
+
+bool GLSurfaceGLXOzone::DispatchXEvent(XEvent* event) {
+ if (!CanHandleEvent(event))
+ return false;
+
+ ForwardExposeEvent(event);
+ return true;
+}
+
+} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698