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

Side by Side Diff: ui/views/controls/menu/menu_controller.cc

Issue 204253002: Do not repost events when the menu is closed for Linux Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« 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) 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/controls/menu/menu_controller.h" 5 #include "ui/views/controls/menu/menu_controller.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windowsx.h> 8 #include <windowsx.h>
9 #endif 9 #endif
10 10
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 // of the menus from the last run. 927 // of the menus from the last run.
928 gfx::Point screen_loc(event.location()); 928 gfx::Point screen_loc(event.location());
929 View::ConvertPointToScreen(source->GetScrollViewContainer(), &screen_loc); 929 View::ConvertPointToScreen(source->GetScrollViewContainer(), &screen_loc);
930 MenuPart last_part = GetMenuPartByScreenCoordinateUsingMenu( 930 MenuPart last_part = GetMenuPartByScreenCoordinateUsingMenu(
931 menu_stack_.back().item, screen_loc); 931 menu_stack_.back().item, screen_loc);
932 if (last_part.type != MenuPart::NONE) 932 if (last_part.type != MenuPart::NONE)
933 exit_type = EXIT_OUTERMOST; 933 exit_type = EXIT_OUTERMOST;
934 } 934 }
935 Cancel(exit_type); 935 Cancel(exit_type);
936 936
937 #if !defined(OS_WIN) 937 #if defined(OS_CHROMEOS)
938 // We're going to exit the menu and want to repost the event so that is 938 // We're going to exit the menu and want to repost the event so that is
939 // is handled normally after the context menu has exited. We call 939 // is handled normally after the context menu has exited. We call
940 // RepostEvent after Cancel so that mouse capture has been released so 940 // RepostEvent after Cancel so that mouse capture has been released so
941 // that finding the event target is unaffected by the current capture. 941 // that finding the event target is unaffected by the current capture.
942 RepostEvent(source, event); 942 RepostEvent(source, event);
943 #endif 943 #endif
944 944 // Do not repost events for Linux Aura because this behavior is more
945 // consistent with the behavior of other Linux apps.
945 return; 946 return;
946 } 947 }
947 948
948 // On a press we immediately commit the selection, that way a submenu 949 // On a press we immediately commit the selection, that way a submenu
949 // pops up immediately rather than after a delay. 950 // pops up immediately rather than after a delay.
950 int selection_types = SELECTION_UPDATE_IMMEDIATELY; 951 int selection_types = SELECTION_UPDATE_IMMEDIATELY;
951 if (!part.menu) { 952 if (!part.menu) {
952 part.menu = part.parent; 953 part.menu = part.parent;
953 selection_types |= SELECTION_OPEN_SUBMENU; 954 selection_types |= SELECTION_OPEN_SUBMENU;
954 } else { 955 } else {
(...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after
2346 (!pending_state_.item->HasSubmenu() || 2347 (!pending_state_.item->HasSubmenu() ||
2347 !pending_state_.item->GetSubmenu()->IsShowing())) { 2348 !pending_state_.item->GetSubmenu()->IsShowing())) {
2348 // On exit if the user hasn't selected an item with a submenu, move the 2349 // On exit if the user hasn't selected an item with a submenu, move the
2349 // selection back to the parent menu item. 2350 // selection back to the parent menu item.
2350 SetSelection(pending_state_.item->GetParentMenuItem(), 2351 SetSelection(pending_state_.item->GetParentMenuItem(),
2351 SELECTION_OPEN_SUBMENU); 2352 SELECTION_OPEN_SUBMENU);
2352 } 2353 }
2353 } 2354 }
2354 2355
2355 } // namespace views 2356 } // namespace views
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