OLD | NEW |
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/aura/window_event_dispatcher.h" | 5 #include "ui/aura/window_event_dispatcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 event->SetHandled(); | 784 event->SetHandled(); |
785 return DispatchDetails(); | 785 return DispatchDetails(); |
786 } else { | 786 } else { |
787 // We may have a held event for a period between the time move_hold_count_ | 787 // We may have a held event for a period between the time move_hold_count_ |
788 // fell to 0 and the DispatchHeldEvents executes. Since we're going to | 788 // fell to 0 and the DispatchHeldEvents executes. Since we're going to |
789 // dispatch the new event directly below, we can reset the old one. | 789 // dispatch the new event directly below, we can reset the old one. |
790 held_move_event_.reset(); | 790 held_move_event_.reset(); |
791 } | 791 } |
792 } | 792 } |
793 | 793 |
794 const int kMouseButtonFlagMask = ui::EF_LEFT_MOUSE_BUTTON | | |
795 ui::EF_MIDDLE_MOUSE_BUTTON | | |
796 ui::EF_RIGHT_MOUSE_BUTTON | | |
797 ui::EF_BACK_MOUSE_BUTTON | | |
798 ui::EF_FORWARD_MOUSE_BUTTON; | |
799 switch (event->type()) { | 794 switch (event->type()) { |
800 case ui::ET_MOUSE_EXITED: | 795 case ui::ET_MOUSE_EXITED: |
801 if (!target || target == window()) { | 796 if (!target || target == window()) { |
802 DispatchDetails details = | 797 DispatchDetails details = |
803 DispatchMouseEnterOrExit(target, *event, ui::ET_MOUSE_EXITED); | 798 DispatchMouseEnterOrExit(target, *event, ui::ET_MOUSE_EXITED); |
804 if (details.dispatcher_destroyed) { | 799 if (details.dispatcher_destroyed) { |
805 event->SetHandled(); | 800 event->SetHandled(); |
806 return details; | 801 return details; |
807 } | 802 } |
808 mouse_moved_handler_ = NULL; | 803 mouse_moved_handler_ = NULL; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 } | 844 } |
850 } | 845 } |
851 break; | 846 break; |
852 case ui::ET_MOUSE_PRESSED: | 847 case ui::ET_MOUSE_PRESSED: |
853 // Don't set the mouse pressed handler for non client mouse down events. | 848 // Don't set the mouse pressed handler for non client mouse down events. |
854 // These are only sent by Windows and are not always followed with non | 849 // These are only sent by Windows and are not always followed with non |
855 // client mouse up events which causes subsequent mouse events to be | 850 // client mouse up events which causes subsequent mouse events to be |
856 // sent to the wrong target. | 851 // sent to the wrong target. |
857 if (!(event->flags() & ui::EF_IS_NON_CLIENT) && !mouse_pressed_handler_) | 852 if (!(event->flags() & ui::EF_IS_NON_CLIENT) && !mouse_pressed_handler_) |
858 mouse_pressed_handler_ = target; | 853 mouse_pressed_handler_ = target; |
859 Env::GetInstance()->set_mouse_button_flags( | 854 Env::GetInstance()->set_mouse_button_flags(event->button_flags()); |
860 event->flags() & kMouseButtonFlagMask); | |
861 break; | 855 break; |
862 case ui::ET_MOUSE_RELEASED: | 856 case ui::ET_MOUSE_RELEASED: |
863 mouse_pressed_handler_ = NULL; | 857 mouse_pressed_handler_ = NULL; |
864 Env::GetInstance()->set_mouse_button_flags(event->flags() & | 858 Env::GetInstance()->set_mouse_button_flags( |
865 kMouseButtonFlagMask & ~event->changed_button_flags()); | 859 event->button_flags() & ~event->changed_button_flags()); |
866 break; | 860 break; |
867 default: | 861 default: |
868 break; | 862 break; |
869 } | 863 } |
870 | 864 |
871 return PreDispatchLocatedEvent(target, event); | 865 return PreDispatchLocatedEvent(target, event); |
872 } | 866 } |
873 | 867 |
874 DispatchDetails WindowEventDispatcher::PreDispatchTouchEvent( | 868 DispatchDetails WindowEventDispatcher::PreDispatchTouchEvent( |
875 Window* target, | 869 Window* target, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 } | 908 } |
915 | 909 |
916 // This flag is set depending on the gestures recognized in the call above, | 910 // This flag is set depending on the gestures recognized in the call above, |
917 // and needs to propagate with the forwarded event. | 911 // and needs to propagate with the forwarded event. |
918 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); | 912 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); |
919 | 913 |
920 return PreDispatchLocatedEvent(target, event); | 914 return PreDispatchLocatedEvent(target, event); |
921 } | 915 } |
922 | 916 |
923 } // namespace aura | 917 } // namespace aura |
OLD | NEW |