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

Side by Side Diff: ui/aura/root_window_host_linux.cc

Issue 8892005: aura-x11: Make sure the list of devices to track are updated when device hierarchy changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
« no previous file with comments | « no previous file | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/aura/root_window_host.h" 5 #include "ui/aura/root_window_host.h"
6 6
7 #include <X11/cursorfont.h> 7 #include <X11/cursorfont.h>
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 9
10 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. 10 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class.
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 KeyPressMask | KeyReleaseMask | 337 KeyPressMask | KeyReleaseMask |
338 EnterWindowMask | LeaveWindowMask | 338 EnterWindowMask | LeaveWindowMask |
339 ExposureMask | VisibilityChangeMask | 339 ExposureMask | VisibilityChangeMask |
340 StructureNotifyMask | PropertyChangeMask | 340 StructureNotifyMask | PropertyChangeMask |
341 PointerMotionMask; 341 PointerMotionMask;
342 XSelectInput(xdisplay_, xwindow_, event_mask); 342 XSelectInput(xdisplay_, xwindow_, event_mask);
343 XSelectInput(xdisplay_, x_root_window_, StructureNotifyMask); 343 XSelectInput(xdisplay_, x_root_window_, StructureNotifyMask);
344 XFlush(xdisplay_); 344 XFlush(xdisplay_);
345 345
346 // TODO(sad): Re-enable once crbug.com/106516 is fixed. 346 // TODO(sad): Re-enable once crbug.com/106516 is fixed.
347 #if 0
348 if (base::MessagePumpForUI::HasXInput2()) 347 if (base::MessagePumpForUI::HasXInput2())
349 ui::TouchFactory::GetInstance()->SetupXI2ForXWindow(xwindow_); 348 ui::TouchFactory::GetInstance()->SetupXI2ForXWindow(xwindow_);
350 #endif
351 349
352 base::MessagePumpX::SetDefaultDispatcher(this); 350 base::MessagePumpX::SetDefaultDispatcher(this);
353 MessageLoopForUI::current()->AddDestructionObserver(this); 351 MessageLoopForUI::current()->AddDestructionObserver(this);
354 } 352 }
355 353
356 RootWindowHostLinux::~RootWindowHostLinux() { 354 RootWindowHostLinux::~RootWindowHostLinux() {
357 XDestroyWindow(xdisplay_, xwindow_); 355 XDestroyWindow(xdisplay_, xwindow_);
358 356
359 // Clears XCursorCache. 357 // Clears XCursorCache.
360 ui::GetXCursor(ui::kCursorClearXCursorCache); 358 ui::GetXCursor(ui::kCursorClearXCursorCache);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 if (size_changed) 413 if (size_changed)
416 root_window_->OnHostResized(bounds.size()); 414 root_window_->OnHostResized(bounds.size());
417 handled = true; 415 handled = true;
418 break; 416 break;
419 } 417 }
420 case GenericEvent: { 418 case GenericEvent: {
421 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); 419 ui::TouchFactory* factory = ui::TouchFactory::GetInstance();
422 if (!factory->ShouldProcessXI2Event(xev)) 420 if (!factory->ShouldProcessXI2Event(xev))
423 break; 421 break;
424 422
423 // Update the device list if necessary.
424 if (xev->xgeneric.evtype == XI_HierarchyChanged) {
425 factory->UpdateDeviceList(xdisplay_);
426 handled = true;
427 break;
428 }
429
425 // If this is a motion event we want to coalesce all pending motion 430 // If this is a motion event we want to coalesce all pending motion
426 // events that are at the top of the queue. 431 // events that are at the top of the queue.
427 XEvent last_event; 432 XEvent last_event;
428 int num_coalesced = 0; 433 int num_coalesced = 0;
429 if (xev->xgeneric.evtype == XI_Motion) { 434 if (xev->xgeneric.evtype == XI_Motion) {
430 num_coalesced = CoalescePendingXIMotionEvents(xev, &last_event); 435 num_coalesced = CoalescePendingXIMotionEvents(xev, &last_event);
431 if (num_coalesced > 0) 436 if (num_coalesced > 0)
432 xev = &last_event; 437 xev = &last_event;
433 } 438 }
434 439
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 return new RootWindowHostLinux(bounds); 635 return new RootWindowHostLinux(bounds);
631 } 636 }
632 637
633 // static 638 // static
634 gfx::Size RootWindowHost::GetNativeScreenSize() { 639 gfx::Size RootWindowHost::GetNativeScreenSize() {
635 ::Display* xdisplay = base::MessagePumpX::GetDefaultXDisplay(); 640 ::Display* xdisplay = base::MessagePumpX::GetDefaultXDisplay();
636 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); 641 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0));
637 } 642 }
638 643
639 } // namespace aura 644 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698