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

Side by Side Diff: ash/root_window_controller.cc

Issue 357063002: Snap widgets to pixel boundary on ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 (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 "ash/root_window_controller.h" 5 #include "ash/root_window_controller.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_constants.h" 10 #include "ash/ash_constants.h"
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 lock_background_container->AddChild(mouse_event_target_.get()); 849 lock_background_container->AddChild(mouse_event_target_.get());
850 mouse_event_target_->Show(); 850 mouse_event_target_->Show();
851 } 851 }
852 852
853 // Create Docked windows layout manager 853 // Create Docked windows layout manager
854 aura::Window* docked_container = GetContainer(kShellWindowId_DockedContainer); 854 aura::Window* docked_container = GetContainer(kShellWindowId_DockedContainer);
855 docked_layout_manager_ = 855 docked_layout_manager_ =
856 new DockedWindowLayoutManager(docked_container, workspace_controller()); 856 new DockedWindowLayoutManager(docked_container, workspace_controller());
857 docked_container->SetLayoutManager(docked_layout_manager_); 857 docked_container->SetLayoutManager(docked_layout_manager_);
858 858
859 // Installs SnapLayoutManager to containers who set the
860 // |kSnapsChildrenToPhysicalPixelBoundary| property.
861 wm::InstallSnapLayoutManagerToContainers(root_window);
862
Jun Mukai 2014/07/16 22:59:08 Not sure why this is necessary. Instead of settin
oshima 2014/07/17 22:07:56 Because some containers may install its own layout
Jun Mukai 2014/07/17 22:26:31 Hmm, I don't get the point. If a container with t
Jun Mukai 2014/07/17 22:27:16 ah, your new patchset is in this way. Thanks for q
oshima 2014/07/17 22:28:40 Sorry, I should have mentioned that.
859 // Create Panel layout manager 863 // Create Panel layout manager
860 aura::Window* panel_container = GetContainer(kShellWindowId_PanelContainer); 864 aura::Window* panel_container = GetContainer(kShellWindowId_PanelContainer);
861 panel_layout_manager_ = new PanelLayoutManager(panel_container); 865 panel_layout_manager_ = new PanelLayoutManager(panel_container);
862 panel_container->SetLayoutManager(panel_layout_manager_); 866 panel_container->SetLayoutManager(panel_layout_manager_);
863 panel_container_handler_.reset(new PanelWindowEventHandler); 867 panel_container_handler_.reset(new PanelWindowEventHandler);
864 panel_container->AddPreTargetHandler(panel_container_handler_.get()); 868 panel_container->AddPreTargetHandler(panel_container_handler_.get());
865 869
866 // Install an AttachedPanelWindowTargeter on the panel container to make it 870 // Install an AttachedPanelWindowTargeter on the panel container to make it
867 // easier to correctly target shelf buttons with touch. 871 // easier to correctly target shelf buttons with touch.
868 gfx::Insets mouse_extend(-kResizeOutsideBoundsSize, 872 gfx::Insets mouse_extend(-kResizeOutsideBoundsSize,
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 CreateContainer(kShellWindowId_ShelfContainer, 981 CreateContainer(kShellWindowId_ShelfContainer,
978 "ShelfContainer", 982 "ShelfContainer",
979 non_lock_screen_containers); 983 non_lock_screen_containers);
980 SetUsesScreenCoordinates(shelf_container); 984 SetUsesScreenCoordinates(shelf_container);
981 DescendantShouldStayInSameRootWindow(shelf_container); 985 DescendantShouldStayInSameRootWindow(shelf_container);
982 986
983 aura::Window* panel_container = CreateContainer( 987 aura::Window* panel_container = CreateContainer(
984 kShellWindowId_PanelContainer, 988 kShellWindowId_PanelContainer,
985 "PanelContainer", 989 "PanelContainer",
986 non_lock_screen_containers); 990 non_lock_screen_containers);
991 wm::SetSnapsChildrenToPhysicalPixelBoundary(panel_container);
987 SetUsesScreenCoordinates(panel_container); 992 SetUsesScreenCoordinates(panel_container);
988 993
989 aura::Window* shelf_bubble_container = 994 aura::Window* shelf_bubble_container =
990 CreateContainer(kShellWindowId_ShelfBubbleContainer, 995 CreateContainer(kShellWindowId_ShelfBubbleContainer,
991 "ShelfBubbleContainer", 996 "ShelfBubbleContainer",
992 non_lock_screen_containers); 997 non_lock_screen_containers);
998 wm::SetSnapsChildrenToPhysicalPixelBoundary(shelf_bubble_container);
993 SetUsesScreenCoordinates(shelf_bubble_container); 999 SetUsesScreenCoordinates(shelf_bubble_container);
994 DescendantShouldStayInSameRootWindow(shelf_bubble_container); 1000 DescendantShouldStayInSameRootWindow(shelf_bubble_container);
995 1001
996 aura::Window* app_list_container = 1002 aura::Window* app_list_container =
997 CreateContainer(kShellWindowId_AppListContainer, 1003 CreateContainer(kShellWindowId_AppListContainer,
998 "AppListContainer", 1004 "AppListContainer",
999 non_lock_screen_containers); 1005 non_lock_screen_containers);
1006 wm::SetSnapsChildrenToPhysicalPixelBoundary(app_list_container);
1000 SetUsesScreenCoordinates(app_list_container); 1007 SetUsesScreenCoordinates(app_list_container);
1001 1008
1002 aura::Window* modal_container = CreateContainer( 1009 aura::Window* modal_container = CreateContainer(
1003 kShellWindowId_SystemModalContainer, 1010 kShellWindowId_SystemModalContainer,
1004 "SystemModalContainer", 1011 "SystemModalContainer",
1005 non_lock_screen_containers); 1012 non_lock_screen_containers);
1006 modal_container->SetLayoutManager( 1013 modal_container->SetLayoutManager(
1007 new SystemModalContainerLayoutManager(modal_container)); 1014 new SystemModalContainerLayoutManager(modal_container));
1008 ::wm::SetChildWindowVisibilityChangesAnimated(modal_container); 1015 ::wm::SetChildWindowVisibilityChangesAnimated(modal_container);
1009 SetUsesScreenCoordinates(modal_container); 1016 SetUsesScreenCoordinates(modal_container);
(...skipping 30 matching lines...) Expand all
1040 "StatusContainer", 1047 "StatusContainer",
1041 lock_screen_related_containers); 1048 lock_screen_related_containers);
1042 SetUsesScreenCoordinates(status_container); 1049 SetUsesScreenCoordinates(status_container);
1043 DescendantShouldStayInSameRootWindow(status_container); 1050 DescendantShouldStayInSameRootWindow(status_container);
1044 1051
1045 aura::Window* settings_bubble_container = CreateContainer( 1052 aura::Window* settings_bubble_container = CreateContainer(
1046 kShellWindowId_SettingBubbleContainer, 1053 kShellWindowId_SettingBubbleContainer,
1047 "SettingBubbleContainer", 1054 "SettingBubbleContainer",
1048 lock_screen_related_containers); 1055 lock_screen_related_containers);
1049 ::wm::SetChildWindowVisibilityChangesAnimated(settings_bubble_container); 1056 ::wm::SetChildWindowVisibilityChangesAnimated(settings_bubble_container);
1057 wm::SetSnapsChildrenToPhysicalPixelBoundary(settings_bubble_container);
1050 SetUsesScreenCoordinates(settings_bubble_container); 1058 SetUsesScreenCoordinates(settings_bubble_container);
1051 DescendantShouldStayInSameRootWindow(settings_bubble_container); 1059 DescendantShouldStayInSameRootWindow(settings_bubble_container);
1052 1060
1053 aura::Window* menu_container = CreateContainer( 1061 aura::Window* menu_container = CreateContainer(
1054 kShellWindowId_MenuContainer, 1062 kShellWindowId_MenuContainer,
1055 "MenuContainer", 1063 "MenuContainer",
1056 lock_screen_related_containers); 1064 lock_screen_related_containers);
1057 ::wm::SetChildWindowVisibilityChangesAnimated(menu_container); 1065 ::wm::SetChildWindowVisibilityChangesAnimated(menu_container);
1066 wm::SetSnapsChildrenToPhysicalPixelBoundary(menu_container);
1058 SetUsesScreenCoordinates(menu_container); 1067 SetUsesScreenCoordinates(menu_container);
1059 1068
1060 aura::Window* drag_drop_container = CreateContainer( 1069 aura::Window* drag_drop_container = CreateContainer(
1061 kShellWindowId_DragImageAndTooltipContainer, 1070 kShellWindowId_DragImageAndTooltipContainer,
1062 "DragImageAndTooltipContainer", 1071 "DragImageAndTooltipContainer",
1063 lock_screen_related_containers); 1072 lock_screen_related_containers);
1064 ::wm::SetChildWindowVisibilityChangesAnimated(drag_drop_container); 1073 ::wm::SetChildWindowVisibilityChangesAnimated(drag_drop_container);
1074 wm::SetSnapsChildrenToPhysicalPixelBoundary(drag_drop_container);
1065 SetUsesScreenCoordinates(drag_drop_container); 1075 SetUsesScreenCoordinates(drag_drop_container);
1066 1076
1067 aura::Window* overlay_container = CreateContainer( 1077 aura::Window* overlay_container = CreateContainer(
1068 kShellWindowId_OverlayContainer, 1078 kShellWindowId_OverlayContainer,
1069 "OverlayContainer", 1079 "OverlayContainer",
1070 lock_screen_related_containers); 1080 lock_screen_related_containers);
1081 wm::SetSnapsChildrenToPhysicalPixelBoundary(overlay_container);
1071 SetUsesScreenCoordinates(overlay_container); 1082 SetUsesScreenCoordinates(overlay_container);
1072 1083
1073 aura::Window* virtual_keyboard_parent_container = CreateContainer( 1084 aura::Window* virtual_keyboard_parent_container = CreateContainer(
1074 kShellWindowId_VirtualKeyboardParentContainer, 1085 kShellWindowId_VirtualKeyboardParentContainer,
1075 "VirtualKeyboardParentContainer", 1086 "VirtualKeyboardParentContainer",
1076 root_window); 1087 root_window);
1088 wm::SetSnapsChildrenToPhysicalPixelBoundary(
1089 virtual_keyboard_parent_container);
1077 SetUsesScreenCoordinates(virtual_keyboard_parent_container); 1090 SetUsesScreenCoordinates(virtual_keyboard_parent_container);
1078 1091
1079 #if defined(OS_CHROMEOS) 1092 #if defined(OS_CHROMEOS)
1080 aura::Window* mouse_cursor_container = CreateContainer( 1093 aura::Window* mouse_cursor_container = CreateContainer(
1081 kShellWindowId_MouseCursorContainer, 1094 kShellWindowId_MouseCursorContainer,
1082 "MouseCursorContainer", 1095 "MouseCursorContainer",
1083 root_window); 1096 root_window);
1084 SetUsesScreenCoordinates(mouse_cursor_container); 1097 SetUsesScreenCoordinates(mouse_cursor_container);
1085 #endif 1098 #endif
1086 1099
(...skipping 23 matching lines...) Expand all
1110 else 1123 else
1111 DisableTouchHudProjection(); 1124 DisableTouchHudProjection();
1112 } 1125 }
1113 1126
1114 RootWindowController* GetRootWindowController( 1127 RootWindowController* GetRootWindowController(
1115 const aura::Window* root_window) { 1128 const aura::Window* root_window) {
1116 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; 1129 return root_window ? GetRootWindowSettings(root_window)->controller : NULL;
1117 } 1130 }
1118 1131
1119 } // namespace ash 1132 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698