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

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: Change to use #define 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
« no previous file with comments | « ui/gl/gl_surface_glx.h ('k') | ui/gl/gl_surface_glx_x11.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_surface_glx.cc
diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc
index e8427ed9e64cb56ffdb46aaa27c1c25ebf773a08..add3a62fc587b0447fb9a2d8ef4e51e0e728d1d9 100644
--- a/ui/gl/gl_surface_glx.cc
+++ b/ui/gl/gl_surface_glx.cc
@@ -520,13 +520,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();
@@ -560,28 +554,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) {
@@ -639,6 +618,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) {
« no previous file with comments | « ui/gl/gl_surface_glx.h ('k') | ui/gl/gl_surface_glx_x11.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698