| Index: ui/gl/gl_surface_glx.cc
|
| diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc
|
| index dea4bcc66fd9539a2d27e35de514c43620e3e784..85c2a1f3960b590be038c8b816679f1a83b70d8b 100644
|
| --- a/ui/gl/gl_surface_glx.cc
|
| +++ b/ui/gl/gl_surface_glx.cc
|
| @@ -23,7 +23,6 @@ extern "C" {
|
| #include "base/time/time.h"
|
| #include "base/trace_event/trace_event.h"
|
| #include "build/build_config.h"
|
| -#include "ui/events/platform/platform_event_source.h"
|
| #include "ui/gfx/x/x11_connection.h"
|
| #include "ui/gfx/x/x11_types.h"
|
| #include "ui/gl/gl_bindings.h"
|
| @@ -443,8 +442,7 @@ void* GLSurfaceGLX::GetDisplay() {
|
| GLSurfaceGLX::~GLSurfaceGLX() {}
|
|
|
| NativeViewGLSurfaceGLX::NativeViewGLSurfaceGLX(gfx::AcceleratedWidget window)
|
| - : parent_window_(window), window_(0), glx_window_(0), config_(nullptr) {
|
| -}
|
| + : parent_window_(window), window_(0), glx_window_(0), config_(nullptr) {}
|
|
|
| GLXDrawable NativeViewGLSurfaceGLX::GetDrawableHandle() const {
|
| return glx_window_;
|
| @@ -471,13 +469,7 @@ bool NativeViewGLSurfaceGLX::Initialize(GLSurface::Format format) {
|
| CopyFromParent, CWBackPixmap | CWBitGravity, &swa);
|
| XMapWindow(g_display, window_);
|
|
|
| - ui::PlatformEventSource* event_source =
|
| - ui::PlatformEventSource::GetInstance();
|
| - // Can be nullptr in tests, when we don't care about Exposes.
|
| - if (event_source) {
|
| - XSelectInput(g_display, window_, ExposureMask);
|
| - ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
|
| - }
|
| + RegisterEvents();
|
| XFlush(g_display);
|
|
|
| GetConfig();
|
| @@ -499,29 +491,13 @@ void NativeViewGLSurfaceGLX::Destroy() {
|
| glx_window_ = 0;
|
| }
|
| if (window_) {
|
| - ui::PlatformEventSource* event_source =
|
| - ui::PlatformEventSource::GetInstance();
|
| - if (event_source)
|
| - event_source->RemovePlatformEventDispatcher(this);
|
| + UnregisterEvents();
|
| XDestroyWindow(g_display, window_);
|
| window_ = 0;
|
| XFlush(g_display);
|
| }
|
| }
|
|
|
| -bool NativeViewGLSurfaceGLX::CanDispatchEvent(const ui::PlatformEvent& event) {
|
| - return event->type == Expose && event->xexpose.window == window_;
|
| -}
|
| -
|
| -uint32_t NativeViewGLSurfaceGLX::DispatchEvent(const ui::PlatformEvent& event) {
|
| - XEvent forwarded_event = *event;
|
| - forwarded_event.xexpose.window = parent_window_;
|
| - XSendEvent(g_display, parent_window_, False, ExposureMask,
|
| - &forwarded_event);
|
| - XFlush(g_display);
|
| - return ui::POST_DISPATCH_STOP_PROPAGATION;
|
| -}
|
| -
|
| bool NativeViewGLSurfaceGLX::Resize(const gfx::Size& size,
|
| float scale_factor,
|
| bool has_alpha) {
|
| @@ -580,6 +556,18 @@ NativeViewGLSurfaceGLX::~NativeViewGLSurfaceGLX() {
|
| Destroy();
|
| }
|
|
|
| +void NativeViewGLSurfaceGLX::ForwardExposeEvent(XEvent* event) {
|
| + XEvent forwarded_event = *event;
|
| + forwarded_event.xexpose.window = parent_window_;
|
| + XSendEvent(g_display, parent_window_, False, ExposureMask, &forwarded_event);
|
| + XFlush(g_display);
|
| +}
|
| +
|
| +bool NativeViewGLSurfaceGLX::CanHandleEvent(XEvent* event) {
|
| + return event->type == Expose &&
|
| + event->xexpose.window == static_cast<Window>(window_);
|
| +}
|
| +
|
| UnmappedNativeViewGLSurfaceGLX::UnmappedNativeViewGLSurfaceGLX(
|
| const gfx::Size& size)
|
| : size_(size), config_(nullptr), window_(0), glx_window_(0) {
|
|
|