| Index: ui/gl/gl_surface_glx.cc
|
| diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc
|
| index 6d0ba1593c6eb92247f7cfda657f73e2024c3740..69c223c28b3809f135bea40bd422e3e0b2b3ca93 100644
|
| --- a/ui/gl/gl_surface_glx.cc
|
| +++ b/ui/gl/gl_surface_glx.cc
|
| @@ -7,7 +7,6 @@
|
| extern "C" {
|
| #include <X11/Xlib.h>
|
| }
|
| -#include <memory>
|
|
|
| #include "base/command_line.h"
|
| #include "base/lazy_instance.h"
|
| @@ -24,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"
|
| @@ -487,13 +485,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();
|
| @@ -527,29 +519,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) {
|
| @@ -608,6 +584,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) {
|
|
|