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

Side by Side Diff: ui/platform_window/x11/x11_window.cc

Issue 1139673003: Make Mandoline shut down cleanly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 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
« no previous file with comments | « ui/platform_window/win/win_window.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/platform_window/x11/x11_window.h" 5 #include "ui/platform_window/x11/x11_window.h"
6 6
7 #include <X11/extensions/XInput2.h> 7 #include <X11/extensions/XInput2.h>
8 #include <X11/Xatom.h> 8 #include <X11/Xatom.h>
9 #include <X11/Xlib.h> 9 #include <X11/Xlib.h>
10 #include <X11/Xutil.h> 10 #include <X11/Xutil.h>
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 xdisplay_(gfx::GetXDisplay()), 45 xdisplay_(gfx::GetXDisplay()),
46 xwindow_(None), 46 xwindow_(None),
47 xroot_window_(DefaultRootWindow(xdisplay_)), 47 xroot_window_(DefaultRootWindow(xdisplay_)),
48 atom_cache_(xdisplay_, kAtomsToCache), 48 atom_cache_(xdisplay_, kAtomsToCache),
49 window_mapped_(false) { 49 window_mapped_(false) {
50 CHECK(delegate_); 50 CHECK(delegate_);
51 TouchFactory::SetTouchDeviceListFromCommandLine(); 51 TouchFactory::SetTouchDeviceListFromCommandLine();
52 } 52 }
53 53
54 X11Window::~X11Window() { 54 X11Window::~X11Window() {
55 Destroy();
56 } 55 }
57 56
58 void X11Window::Destroy() { 57 void X11Window::Destroy() {
59 delegate_->OnClosed();
60 if (xwindow_ == None) 58 if (xwindow_ == None)
61 return; 59 return;
62 60
63 // Stop processing events. 61 // Stop processing events.
64 PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); 62 PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
65 XDestroyWindow(xdisplay_, xwindow_); 63 XID xwindow = xwindow_;
64 XDisplay* xdisplay = xdisplay_;
66 xwindow_ = None; 65 xwindow_ = None;
66 delegate_->OnClosed();
67 // |this| might be deleted because of the above call.
68
69 XDestroyWindow(xdisplay, xwindow);
67 } 70 }
68 71
69 void X11Window::ProcessXInput2Event(XEvent* xev) { 72 void X11Window::ProcessXInput2Event(XEvent* xev) {
70 if (!TouchFactory::GetInstance()->ShouldProcessXI2Event(xev)) 73 if (!TouchFactory::GetInstance()->ShouldProcessXI2Event(xev))
71 return; 74 return;
72 EventType event_type = EventTypeFromNative(xev); 75 EventType event_type = EventTypeFromNative(xev);
73 switch (event_type) { 76 switch (event_type) {
74 case ET_KEY_PRESSED: 77 case ET_KEY_PRESSED:
75 case ET_KEY_RELEASED: { 78 case ET_KEY_RELEASED: {
76 KeyEvent key_event(xev); 79 KeyEvent key_event(xev);
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 358
356 case GenericEvent: { 359 case GenericEvent: {
357 ProcessXInput2Event(xev); 360 ProcessXInput2Event(xev);
358 break; 361 break;
359 } 362 }
360 } 363 }
361 return POST_DISPATCH_STOP_PROPAGATION; 364 return POST_DISPATCH_STOP_PROPAGATION;
362 } 365 }
363 366
364 } // namespace ui 367 } // namespace ui
OLDNEW
« no previous file with comments | « ui/platform_window/win/win_window.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698