OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/ozone/platform/x11/gl_surface_glx_ozone.h" |
| 6 |
| 7 #include <X11/Xlib.h> |
| 8 |
| 9 namespace ui { |
| 10 |
| 11 GLSurfaceGLXOzone::GLSurfaceGLXOzone(gfx::AcceleratedWidget window) |
| 12 : NativeViewGLSurfaceGLX(window) {} |
| 13 |
| 14 GLSurfaceGLXOzone::~GLSurfaceGLXOzone() { |
| 15 Destroy(); |
| 16 } |
| 17 |
| 18 void GLSurfaceGLXOzone::RegisterEvents() { |
| 19 auto* event_source = X11EventSourceLibevent::GetInstance(); |
| 20 // Can be null in tests, when we don't care about Exposes. |
| 21 if (event_source) { |
| 22 XSelectInput(gfx::GetXDisplay(), window(), ExposureMask); |
| 23 event_source->AddXEventDispatcher(this); |
| 24 } |
| 25 } |
| 26 |
| 27 void GLSurfaceGLXOzone::UnregisterEvents() { |
| 28 auto* event_source = X11EventSourceLibevent::GetInstance(); |
| 29 if (event_source) |
| 30 event_source->RemoveXEventDispatcher(this); |
| 31 } |
| 32 |
| 33 bool GLSurfaceGLXOzone::DispatchXEvent(XEvent* event) { |
| 34 if (!CanHandleEvent(event)) |
| 35 return false; |
| 36 |
| 37 ForwardExposeEvent(event); |
| 38 return true; |
| 39 } |
| 40 |
| 41 } // namespace ui |
OLD | NEW |