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/extensions/shape.h> | 7 #include <X11/extensions/shape.h> |
8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
9 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
10 #include <X11/Xregion.h> | 10 #include <X11/Xregion.h> |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
297 window()->SetProperty(kViewsWindowForRootWindow, content_window_); | 297 window()->SetProperty(kViewsWindowForRootWindow, content_window_); |
298 window()->SetProperty(kHostForRootWindow, this); | 298 window()->SetProperty(kHostForRootWindow, this); |
299 | 299 |
300 // Ensure that the X11DesktopHandler exists so that it dispatches activation | 300 // Ensure that the X11DesktopHandler exists so that it dispatches activation |
301 // messages to us. | 301 // messages to us. |
302 X11DesktopHandler::get(); | 302 X11DesktopHandler::get(); |
303 | 303 |
304 // TODO(erg): Unify this code once the other consumer goes away. | 304 // TODO(erg): Unify this code once the other consumer goes away. |
305 SwapNonClientEventHandler( | 305 SwapNonClientEventHandler( |
306 scoped_ptr<ui::EventHandler>(new X11WindowEventFilter(this)).Pass()); | 306 scoped_ptr<ui::EventHandler>(new X11WindowEventFilter(this)).Pass()); |
307 SetUseNativeFrame(params.type == Widget::InitParams::TYPE_WINDOW && | 307 SetUseNativeFrame((params.type == Widget::InitParams::TYPE_WINDOW || |
308 params.type == Widget::InitParams::TYPE_DRAG_BROWSER) && | |
308 !params.remove_standard_frame); | 309 !params.remove_standard_frame); |
309 | 310 |
310 x11_window_move_client_.reset(new X11DesktopWindowMoveClient); | 311 x11_window_move_client_.reset(new X11DesktopWindowMoveClient); |
311 aura::client::SetWindowMoveClient(window(), x11_window_move_client_.get()); | 312 aura::client::SetWindowMoveClient(window(), x11_window_move_client_.get()); |
312 | 313 |
313 SetWindowTransparency(); | 314 SetWindowTransparency(); |
314 | 315 |
315 native_widget_delegate_->OnNativeWidgetCreated(true); | 316 native_widget_delegate_->OnNativeWidgetCreated(true); |
316 } | 317 } |
317 | 318 |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1092 window_type = atom_cache_.GetAtom("_NET_WM_WINDOW_TYPE_TOOLTIP"); | 1093 window_type = atom_cache_.GetAtom("_NET_WM_WINDOW_TYPE_TOOLTIP"); |
1093 break; | 1094 break; |
1094 case Widget::InitParams::TYPE_POPUP: | 1095 case Widget::InitParams::TYPE_POPUP: |
1095 swa.override_redirect = True; | 1096 swa.override_redirect = True; |
1096 window_type = atom_cache_.GetAtom("_NET_WM_WINDOW_TYPE_NOTIFICATION"); | 1097 window_type = atom_cache_.GetAtom("_NET_WM_WINDOW_TYPE_NOTIFICATION"); |
1097 break; | 1098 break; |
1098 case Widget::InitParams::TYPE_DRAG: | 1099 case Widget::InitParams::TYPE_DRAG: |
1099 swa.override_redirect = True; | 1100 swa.override_redirect = True; |
1100 window_type = atom_cache_.GetAtom("_NET_WM_WINDOW_TYPE_DND"); | 1101 window_type = atom_cache_.GetAtom("_NET_WM_WINDOW_TYPE_DND"); |
1101 break; | 1102 break; |
1103 case Widget::InitParams::TYPE_DRAG_BROWSER: | |
1104 swa.override_redirect = True; | |
1105 break; | |
1102 default: | 1106 default: |
1103 window_type = atom_cache_.GetAtom("_NET_WM_WINDOW_TYPE_NORMAL"); | 1107 window_type = atom_cache_.GetAtom("_NET_WM_WINDOW_TYPE_NORMAL"); |
1104 break; | 1108 break; |
1105 } | 1109 } |
1106 if (swa.override_redirect) | 1110 if (swa.override_redirect) |
1107 attribute_mask |= CWOverrideRedirect; | 1111 attribute_mask |= CWOverrideRedirect; |
1108 | 1112 |
1109 // Detect whether we're running inside a compositing manager. If so, try to | 1113 // Detect whether we're running inside a compositing manager. If so, try to |
1110 // use the ARGB visual. Otherwise, just use our parent's visual. | 1114 // use the ARGB visual. Otherwise, just use our parent's visual. |
1111 Visual* visual = CopyFromParent; | 1115 Visual* visual = CopyFromParent; |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1272 ViewsDelegate::GetInstance() | 1276 ViewsDelegate::GetInstance() |
1273 ? ViewsDelegate::GetInstance()->GetDefaultWindowIcon() | 1277 ? ViewsDelegate::GetInstance()->GetDefaultWindowIcon() |
1274 : NULL; | 1278 : NULL; |
1275 if (window_icon) { | 1279 if (window_icon) { |
1276 SetWindowIcons(gfx::ImageSkia(), *window_icon); | 1280 SetWindowIcons(gfx::ImageSkia(), *window_icon); |
1277 } | 1281 } |
1278 CreateCompositor(); | 1282 CreateCompositor(); |
1279 OnAcceleratedWidgetAvailable(); | 1283 OnAcceleratedWidgetAvailable(); |
1280 } | 1284 } |
1281 | 1285 |
1286 void DesktopWindowTreeHostX11::RemapWindow() { | |
1287 XUnmapWindow(xdisplay_, xwindow_); | |
1288 XSetWindowAttributes swa; | |
1289 swa.override_redirect = False; | |
Daniel Erat
2015/12/28 21:33:02
i wouldn't have expected a method named RemapWindo
stapelberg
2016/01/18 17:22:23
Done.
| |
1290 XChangeWindowAttributes(xdisplay_, xwindow_, CWOverrideRedirect, &swa); | |
1291 XMapWindow(xdisplay_, xwindow_); | |
1292 } | |
1293 | |
1282 gfx::Size DesktopWindowTreeHostX11::AdjustSize( | 1294 gfx::Size DesktopWindowTreeHostX11::AdjustSize( |
1283 const gfx::Size& requested_size_in_pixels) { | 1295 const gfx::Size& requested_size_in_pixels) { |
1284 std::vector<gfx::Display> displays = | 1296 std::vector<gfx::Display> displays = |
1285 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE)->GetAllDisplays(); | 1297 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE)->GetAllDisplays(); |
1286 // Compare against all monitor sizes. The window manager can move the window | 1298 // Compare against all monitor sizes. The window manager can move the window |
1287 // to whichever monitor it wants. | 1299 // to whichever monitor it wants. |
1288 for (size_t i = 0; i < displays.size(); ++i) { | 1300 for (size_t i = 0; i < displays.size(); ++i) { |
1289 if (requested_size_in_pixels == displays[i].GetSizeInPixel()) { | 1301 if (requested_size_in_pixels == displays[i].GetSizeInPixel()) { |
1290 return gfx::Size(requested_size_in_pixels.width() - 1, | 1302 return gfx::Size(requested_size_in_pixels.width() - 1, |
1291 requested_size_in_pixels.height() - 1); | 1303 requested_size_in_pixels.height() - 1); |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2056 if (linux_ui) { | 2068 if (linux_ui) { |
2057 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 2069 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
2058 if (native_theme) | 2070 if (native_theme) |
2059 return native_theme; | 2071 return native_theme; |
2060 } | 2072 } |
2061 | 2073 |
2062 return ui::NativeTheme::instance(); | 2074 return ui::NativeTheme::instance(); |
2063 } | 2075 } |
2064 | 2076 |
2065 } // namespace views | 2077 } // namespace views |
OLD | NEW |