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

Side by Side Diff: ui/events/platform/x11/x11_event_source.cc

Issue 255823009: [WIP] ui/window: Master CL. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/events/platform/x11/x11_event_source.h" 5 #include "ui/events/platform/x11/x11_event_source.h"
6 6
7 #include <X11/extensions/XInput2.h> 7 #include <X11/extensions/XInput2.h>
8 #include <X11/X.h> 8 #include <X11/X.h>
9 #include <X11/Xlib.h> 9 #include <X11/Xlib.h>
10 #include <X11/XKBlib.h> 10 #include <X11/XKBlib.h>
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 return false; 74 return false;
75 } 75 }
76 76
77 return true; 77 return true;
78 } 78 }
79 79
80 } // namespace 80 } // namespace
81 81
82 X11EventSource::X11EventSource(XDisplay* display) 82 X11EventSource::X11EventSource(XDisplay* display)
83 : display_(display) { 83 : display_(display) {
84 LOG(ERROR) << "Created " << this << " with " << display_;
84 CHECK(display_); 85 CHECK(display_);
85 InitializeXInput2(display_); 86 InitializeXInput2(display_);
86 InitializeXkb(display_); 87 InitializeXkb(display_);
87 } 88 }
88 89
89 X11EventSource::~X11EventSource() { 90 X11EventSource::~X11EventSource() {
90 } 91 }
91 92
92 // static 93 // static
93 X11EventSource* X11EventSource::GetInstance() { 94 X11EventSource* X11EventSource::GetInstance() {
(...skipping 11 matching lines...) Expand all
105 while (XPending(display_)) { 106 while (XPending(display_)) {
106 XEvent xevent; 107 XEvent xevent;
107 XNextEvent(display_, &xevent); 108 XNextEvent(display_, &xevent);
108 uint32_t action = DispatchEvent(&xevent); 109 uint32_t action = DispatchEvent(&xevent);
109 if (action & POST_DISPATCH_QUIT_LOOP) 110 if (action & POST_DISPATCH_QUIT_LOOP)
110 break; 111 break;
111 } 112 }
112 } 113 }
113 114
114 void X11EventSource::BlockUntilWindowMapped(XID window) { 115 void X11EventSource::BlockUntilWindowMapped(XID window) {
116 LOG(ERROR) << "Blocking for " << window << " in " << this << " on "
117 << display_;
115 XEvent event; 118 XEvent event;
116 do { 119 do {
117 // Block until there's a message of |event_mask| type on |w|. Then remove 120 // Block until there's a message of |event_mask| type on |w|. Then remove
118 // it from the queue and stuff it in |event|. 121 // it from the queue and stuff it in |event|.
119 XWindowEvent(display_, window, StructureNotifyMask, &event); 122 XWindowEvent(display_, window, StructureNotifyMask, &event);
120 DispatchEvent(&event); 123 DispatchEvent(&event);
121 } while (event.type != MapNotify); 124 } while (event.type != MapNotify);
122 } 125 }
123 126
124 //////////////////////////////////////////////////////////////////////////////// 127 ////////////////////////////////////////////////////////////////////////////////
(...skipping 11 matching lines...) Expand all
136 xevent->xgeneric.evtype == XI_HierarchyChanged) { 139 xevent->xgeneric.evtype == XI_HierarchyChanged) {
137 ui::UpdateDeviceList(); 140 ui::UpdateDeviceList();
138 } 141 }
139 142
140 if (have_cookie) 143 if (have_cookie)
141 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie); 144 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie);
142 return action; 145 return action;
143 } 146 }
144 147
145 } // namespace ui 148 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698