Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/widget/desktop_aura/desktop_window_tree_host_x11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" |
| 6 | 6 |
| 7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
| 8 #include <X11/Xregion.h> | 8 #include <X11/Xregion.h> |
| 9 #include <X11/Xutil.h> | 9 #include <X11/Xutil.h> |
| 10 #include <X11/extensions/XInput2.h> | 10 #include <X11/extensions/XInput2.h> |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 557 // We can't reliably track the restored bounds of a window, but we can get | 557 // We can't reliably track the restored bounds of a window, but we can get |
| 558 // the 90% case down. When *chrome* is the process that requests maximizing | 558 // the 90% case down. When *chrome* is the process that requests maximizing |
| 559 // or restoring bounds, we can record the current bounds before we request | 559 // or restoring bounds, we can record the current bounds before we request |
| 560 // maximization, and clear it when we detect a state change. | 560 // maximization, and clear it when we detect a state change. |
| 561 if (!restored_bounds_in_pixels_.IsEmpty()) | 561 if (!restored_bounds_in_pixels_.IsEmpty()) |
| 562 return ToDIPRect(restored_bounds_in_pixels_); | 562 return ToDIPRect(restored_bounds_in_pixels_); |
| 563 | 563 |
| 564 return GetWindowBoundsInScreen(); | 564 return GetWindowBoundsInScreen(); |
| 565 } | 565 } |
| 566 | 566 |
| 567 int DesktopWindowTreeHostX11::GetRestoredWorkspace() const { | |
| 568 int workspace_id; | |
| 569 if (ui::GetIntProperty(xwindow_, "_NET_WM_DESKTOP", &workspace_id)) | |
| 570 return workspace_id; | |
| 571 else | |
|
sky
2016/05/02 15:11:23
nit: no else after a return.
Tom (Use chromium acct)
2016/05/02 20:32:37
Done.
| |
| 572 return -1; | |
| 573 } | |
| 574 | |
| 567 gfx::Rect DesktopWindowTreeHostX11::GetWorkAreaBoundsInScreen() const { | 575 gfx::Rect DesktopWindowTreeHostX11::GetWorkAreaBoundsInScreen() const { |
| 568 return ToDIPRect(GetWorkAreaBoundsInPixels()); | 576 return ToDIPRect(GetWorkAreaBoundsInPixels()); |
| 569 } | 577 } |
| 570 | 578 |
| 571 void DesktopWindowTreeHostX11::SetShape(SkRegion* native_region) { | 579 void DesktopWindowTreeHostX11::SetShape(SkRegion* native_region) { |
| 572 custom_window_shape_ = false; | 580 custom_window_shape_ = false; |
| 573 window_shape_.reset(); | 581 window_shape_.reset(); |
| 574 | 582 |
| 575 if (native_region) { | 583 if (native_region) { |
| 576 gfx::Transform transform = GetRootTransform(); | 584 gfx::Transform transform = GetRootTransform(); |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1219 | 1227 |
| 1220 // If the window should stay on top of other windows, add the | 1228 // If the window should stay on top of other windows, add the |
| 1221 // _NET_WM_STATE_ABOVE property. | 1229 // _NET_WM_STATE_ABOVE property. |
| 1222 is_always_on_top_ = params.keep_on_top; | 1230 is_always_on_top_ = params.keep_on_top; |
| 1223 if (is_always_on_top_) | 1231 if (is_always_on_top_) |
| 1224 state_atom_list.push_back(atom_cache_.GetAtom("_NET_WM_STATE_ABOVE")); | 1232 state_atom_list.push_back(atom_cache_.GetAtom("_NET_WM_STATE_ABOVE")); |
| 1225 | 1233 |
| 1226 if (params.visible_on_all_workspaces) { | 1234 if (params.visible_on_all_workspaces) { |
| 1227 state_atom_list.push_back(atom_cache_.GetAtom("_NET_WM_STATE_STICKY")); | 1235 state_atom_list.push_back(atom_cache_.GetAtom("_NET_WM_STATE_STICKY")); |
| 1228 ui::SetIntProperty(xwindow_, "_NET_WM_DESKTOP", "CARDINAL", kAllDesktops); | 1236 ui::SetIntProperty(xwindow_, "_NET_WM_DESKTOP", "CARDINAL", kAllDesktops); |
| 1237 } else if (params.workspace != -1) { | |
| 1238 ui::SetIntProperty(xwindow_, "_NET_WM_DESKTOP", "CARDINAL", | |
| 1239 params.workspace); | |
| 1229 } | 1240 } |
| 1230 | 1241 |
| 1231 // Setting _NET_WM_STATE by sending a message to the root_window (with | 1242 // Setting _NET_WM_STATE by sending a message to the root_window (with |
| 1232 // SetWMSpecState) has no effect here since the window has not yet been | 1243 // SetWMSpecState) has no effect here since the window has not yet been |
| 1233 // mapped. So we manually change the state. | 1244 // mapped. So we manually change the state. |
| 1234 if (!state_atom_list.empty()) { | 1245 if (!state_atom_list.empty()) { |
| 1235 ui::SetAtomArrayProperty(xwindow_, | 1246 ui::SetAtomArrayProperty(xwindow_, |
| 1236 "_NET_WM_STATE", | 1247 "_NET_WM_STATE", |
| 1237 "ATOM", | 1248 "ATOM", |
| 1238 state_atom_list); | 1249 state_atom_list); |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1983 break; | 1994 break; |
| 1984 } | 1995 } |
| 1985 } | 1996 } |
| 1986 | 1997 |
| 1987 ui::MouseEvent mouseev(xev); | 1998 ui::MouseEvent mouseev(xev); |
| 1988 DispatchMouseEvent(&mouseev); | 1999 DispatchMouseEvent(&mouseev); |
| 1989 break; | 2000 break; |
| 1990 } | 2001 } |
| 1991 case PropertyNotify: { | 2002 case PropertyNotify: { |
| 1992 ::Atom changed_atom = xev->xproperty.atom; | 2003 ::Atom changed_atom = xev->xproperty.atom; |
| 1993 if (changed_atom == atom_cache_.GetAtom("_NET_WM_STATE")) | 2004 if (changed_atom == atom_cache_.GetAtom("_NET_WM_STATE")) { |
| 1994 OnWMStateUpdated(); | 2005 OnWMStateUpdated(); |
| 1995 else if (changed_atom == atom_cache_.GetAtom("_NET_FRAME_EXTENTS")) | 2006 } else if (changed_atom == atom_cache_.GetAtom("_NET_FRAME_EXTENTS")) { |
| 1996 OnFrameExtentsUpdated(); | 2007 OnFrameExtentsUpdated(); |
| 2008 } else if (changed_atom == atom_cache_.GetAtom("_NET_WM_DESKTOP")) { | |
| 2009 int workspace_id; | |
| 2010 if (ui::GetIntProperty(xwindow_, "_NET_WM_DESKTOP", &workspace_id)) | |
| 2011 OnHostWorkspaceChanged(workspace_id); | |
| 2012 } | |
| 1997 break; | 2013 break; |
| 1998 } | 2014 } |
| 1999 case SelectionNotify: { | 2015 case SelectionNotify: { |
| 2000 drag_drop_client_->OnSelectionNotify(xev->xselection); | 2016 drag_drop_client_->OnSelectionNotify(xev->xselection); |
| 2001 break; | 2017 break; |
| 2002 } | 2018 } |
| 2003 } | 2019 } |
| 2004 return ui::POST_DISPATCH_STOP_PROPAGATION; | 2020 return ui::POST_DISPATCH_STOP_PROPAGATION; |
| 2005 } | 2021 } |
| 2006 | 2022 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2062 if (linux_ui) { | 2078 if (linux_ui) { |
| 2063 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 2079 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
| 2064 if (native_theme) | 2080 if (native_theme) |
| 2065 return native_theme; | 2081 return native_theme; |
| 2066 } | 2082 } |
| 2067 | 2083 |
| 2068 return ui::NativeThemeAura::instance(); | 2084 return ui::NativeThemeAura::instance(); |
| 2069 } | 2085 } |
| 2070 | 2086 |
| 2071 } // namespace views | 2087 } // namespace views |
| OLD | NEW |