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

Side by Side Diff: ui/display/chromeos/x11/native_display_event_dispatcher_x11.cc

Issue 187073002: Refactoring display configuration state to allow generic state objects (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 9 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/display/chromeos/x11/native_display_event_dispatcher_x11.h" 5 #include "ui/display/chromeos/x11/native_display_event_dispatcher_x11.h"
6 #include "ui/display/chromeos/x11/display_mode_x11.h"
7 #include "ui/display/chromeos/x11/display_snapshot_x11.h"
6 8
7 #include <X11/extensions/Xrandr.h> 9 #include <X11/extensions/Xrandr.h>
8 10
9 namespace ui { 11 namespace ui {
10 12
11 NativeDisplayEventDispatcherX11::NativeDisplayEventDispatcherX11( 13 NativeDisplayEventDispatcherX11::NativeDisplayEventDispatcherX11(
12 NativeDisplayDelegateX11::HelperDelegate* delegate, 14 NativeDisplayDelegateX11::HelperDelegate* delegate,
13 int xrandr_event_base) 15 int xrandr_event_base)
14 : delegate_(delegate), xrandr_event_base_(xrandr_event_base) {} 16 : delegate_(delegate), xrandr_event_base_(xrandr_event_base) {}
15 17
(...skipping 21 matching lines...) Expand all
37 return POST_DISPATCH_PERFORM_DEFAULT; 39 return POST_DISPATCH_PERFORM_DEFAULT;
38 40
39 const bool connected = (action == RR_Connected); 41 const bool connected = (action == RR_Connected);
40 VLOG(1) << "Received RRNotify_OutputChange event:" 42 VLOG(1) << "Received RRNotify_OutputChange event:"
41 << " output=" << output_change_event->output 43 << " output=" << output_change_event->output
42 << " crtc=" << output_change_event->crtc 44 << " crtc=" << output_change_event->crtc
43 << " mode=" << output_change_event->mode 45 << " mode=" << output_change_event->mode
44 << " action=" << (connected ? "connected" : "disconnected"); 46 << " action=" << (connected ? "connected" : "disconnected");
45 47
46 bool found_changed_output = false; 48 bool found_changed_output = false;
47 const std::vector<OutputConfigurator::OutputSnapshot>& cached_outputs = 49 const std::vector<DisplaySnapshot*>& cached_outputs =
48 delegate_->GetCachedOutputs(); 50 delegate_->GetCachedOutputs();
49 for (std::vector<OutputConfigurator::OutputSnapshot>::const_iterator it = 51 for (std::vector<DisplaySnapshot*>::const_iterator it =
50 cached_outputs.begin(); 52 cached_outputs.begin();
51 it != cached_outputs.end(); 53 it != cached_outputs.end();
52 ++it) { 54 ++it) {
53 if (it->output == output_change_event->output) { 55 const DisplaySnapshotX11* x11_output =
54 if (connected && it->crtc == output_change_event->crtc && 56 static_cast<const DisplaySnapshotX11*>(*it);
55 it->current_mode == output_change_event->mode) { 57 const DisplayModeX11* x11_mode =
58 static_cast<const DisplayModeX11*>(x11_output->current_mode());
59
60 if (x11_output->output() == output_change_event->output) {
61 if (connected && x11_output->crtc() == output_change_event->crtc &&
62 x11_mode->mode_id() == output_change_event->mode) {
56 VLOG(1) << "Ignoring event describing already-cached state"; 63 VLOG(1) << "Ignoring event describing already-cached state";
57 return POST_DISPATCH_PERFORM_DEFAULT; 64 return POST_DISPATCH_PERFORM_DEFAULT;
58 } 65 }
59 found_changed_output = true; 66 found_changed_output = true;
60 break; 67 break;
61 } 68 }
62 } 69 }
63 70
64 if (!connected && !found_changed_output) { 71 if (!connected && !found_changed_output) {
65 VLOG(1) << "Ignoring event describing already-disconnected output"; 72 VLOG(1) << "Ignoring event describing already-disconnected output";
66 return POST_DISPATCH_PERFORM_DEFAULT; 73 return POST_DISPATCH_PERFORM_DEFAULT;
67 } 74 }
68 75
69 delegate_->NotifyDisplayObservers(); 76 delegate_->NotifyDisplayObservers();
70 77
71 return POST_DISPATCH_PERFORM_DEFAULT; 78 return POST_DISPATCH_PERFORM_DEFAULT;
72 } 79 }
73 80
74 } // namespace ui 81 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698