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

Side by Side Diff: ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc

Issue 2211473003: Remove calls to deprecated MessageLoop methods on Windows and Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 unified diff | Download patch
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/views/widget/desktop_aura/x11_whole_screen_move_loop.h" 5 #include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <X11/keysym.h> 8 #include <X11/keysym.h>
9 #include <X11/Xlib.h> 9 #include <X11/Xlib.h>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "base/run_loop.h" 15 #include "base/run_loop.h"
16 #include "base/single_thread_task_runner.h"
16 #include "ui/aura/client/capture_client.h" 17 #include "ui/aura/client/capture_client.h"
17 #include "ui/aura/env.h" 18 #include "ui/aura/env.h"
18 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
19 #include "ui/aura/window_event_dispatcher.h" 20 #include "ui/aura/window_event_dispatcher.h"
20 #include "ui/aura/window_tree_host.h" 21 #include "ui/aura/window_tree_host.h"
21 #include "ui/base/x/x11_util.h" 22 #include "ui/base/x/x11_util.h"
22 #include "ui/events/event.h" 23 #include "ui/events/event.h"
23 #include "ui/events/event_utils.h" 24 #include "ui/events/event_utils.h"
24 #include "ui/events/keycodes/keyboard_code_conversion_x.h" 25 #include "ui/events/keycodes/keyboard_code_conversion_x.h"
25 #include "ui/events/platform/platform_event_source.h" 26 #include "ui/events/platform/platform_event_source.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 case ui::ET_MOUSE_DRAGGED: { 83 case ui::ET_MOUSE_DRAGGED: {
83 bool dispatch_mouse_event = !last_motion_in_screen_.get(); 84 bool dispatch_mouse_event = !last_motion_in_screen_.get();
84 last_motion_in_screen_.reset( 85 last_motion_in_screen_.reset(
85 ui::EventFromNative(xev).release()->AsMouseEvent()); 86 ui::EventFromNative(xev).release()->AsMouseEvent());
86 last_motion_in_screen_->set_location( 87 last_motion_in_screen_->set_location(
87 ui::EventSystemLocationFromNative(xev)); 88 ui::EventSystemLocationFromNative(xev));
88 if (dispatch_mouse_event) { 89 if (dispatch_mouse_event) {
89 // Post a task to dispatch mouse movement event when control returns to 90 // Post a task to dispatch mouse movement event when control returns to
90 // the message loop. This allows smoother dragging since the events are 91 // the message loop. This allows smoother dragging since the events are
91 // dispatched without waiting for the drag widget updates. 92 // dispatched without waiting for the drag widget updates.
92 base::MessageLoopForUI::current()->PostTask( 93 base::MessageLoopForUI::current()->task_runner()->PostTask(
93 FROM_HERE, 94 FROM_HERE,
94 base::Bind(&X11WholeScreenMoveLoop::DispatchMouseMovement, 95 base::Bind(&X11WholeScreenMoveLoop::DispatchMouseMovement,
95 weak_factory_.GetWeakPtr())); 96 weak_factory_.GetWeakPtr()));
96 } 97 }
97 return ui::POST_DISPATCH_NONE; 98 return ui::POST_DISPATCH_NONE;
98 } 99 }
99 case ui::ET_MOUSE_RELEASED: { 100 case ui::ET_MOUSE_RELEASED: {
100 int button = (xev->type == ButtonRelease) 101 int button = (xev->type == ButtonRelease)
101 ? xev->xbutton.button 102 ? xev->xbutton.button
102 : ui::EventButtonFromNative(xev); 103 : ui::EventButtonFromNative(xev);
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 DefaultRootWindow(display), 271 DefaultRootWindow(display),
271 -100, -100, 10, 10, 272 -100, -100, 10, 10,
272 0, CopyFromParent, InputOnly, CopyFromParent, 273 0, CopyFromParent, InputOnly, CopyFromParent,
273 attribute_mask, &swa); 274 attribute_mask, &swa);
274 XMapRaised(display, window); 275 XMapRaised(display, window);
275 ui::X11EventSource::GetInstance()->BlockUntilWindowMapped(window); 276 ui::X11EventSource::GetInstance()->BlockUntilWindowMapped(window);
276 return window; 277 return window;
277 } 278 }
278 279
279 } // namespace views 280 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698