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

Unified Diff: ui/gl/gl_surface_glx.cc

Issue 1723303002: Implement GLX for Ozone X11. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move refactor to new CL. Created 4 years, 8 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/gl/gl_surface_glx.cc
diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc
index 599895f009d590c387b829054523884a0c99f8bb..a482911a6409711460ff2a435ff5b735a5b69ec2 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) {

Powered by Google App Engine
This is Rietveld 408576698