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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 "XdndFinished", | 114 "XdndFinished", |
115 "XdndLeave", | 115 "XdndLeave", |
116 "XdndPosition", | 116 "XdndPosition", |
117 "XdndProxy", // Proxy windows? | 117 "XdndProxy", // Proxy windows? |
118 "XdndSelection", | 118 "XdndSelection", |
119 "XdndStatus", | 119 "XdndStatus", |
120 "XdndTypeList", | 120 "XdndTypeList", |
121 NULL | 121 NULL |
122 }; | 122 }; |
123 | 123 |
| 124 const char kX11WindowRolePopup[] = "popup"; |
| 125 const char kX11WindowRoleBubble[] = "bubble"; |
| 126 |
124 } // namespace | 127 } // namespace |
125 | 128 |
126 //////////////////////////////////////////////////////////////////////////////// | 129 //////////////////////////////////////////////////////////////////////////////// |
127 // DesktopWindowTreeHostX11, public: | 130 // DesktopWindowTreeHostX11, public: |
128 | 131 |
129 DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( | 132 DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( |
130 internal::NativeWidgetDelegate* native_widget_delegate, | 133 internal::NativeWidgetDelegate* native_widget_delegate, |
131 DesktopNativeWidgetAura* desktop_native_widget_aura) | 134 DesktopNativeWidgetAura* desktop_native_widget_aura) |
132 : xdisplay_(gfx::GetXDisplay()), | 135 : xdisplay_(gfx::GetXDisplay()), |
133 xwindow_(0), | 136 xwindow_(0), |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 ui::SetAtomArrayProperty(xwindow_, | 1181 ui::SetAtomArrayProperty(xwindow_, |
1179 "_NET_WM_STATE", | 1182 "_NET_WM_STATE", |
1180 "ATOM", | 1183 "ATOM", |
1181 state_atom_list); | 1184 state_atom_list); |
1182 } | 1185 } |
1183 | 1186 |
1184 if (!params.wm_class_name.empty() || !params.wm_class_class.empty()) { | 1187 if (!params.wm_class_name.empty() || !params.wm_class_class.empty()) { |
1185 ui::SetWindowClassHint( | 1188 ui::SetWindowClassHint( |
1186 xdisplay_, xwindow_, params.wm_class_name, params.wm_class_class); | 1189 xdisplay_, xwindow_, params.wm_class_name, params.wm_class_class); |
1187 } | 1190 } |
1188 if (!params.wm_role_name.empty() || | 1191 |
1189 params.type == Widget::InitParams::TYPE_POPUP) { | 1192 const char* wm_role_name = NULL; |
1190 const char kX11WindowRolePopup[] = "popup"; | 1193 // If the widget isn't overriding the role, provide a default value for popup |
1191 ui::SetWindowRole(xdisplay_, xwindow_, params.wm_role_name.empty() ? | 1194 // and bubble types. |
1192 std::string(kX11WindowRolePopup) : params.wm_role_name); | 1195 if (!params.wm_role_name.empty()) { |
| 1196 wm_role_name = params.wm_role_name.c_str(); |
| 1197 } else { |
| 1198 switch (params.type) { |
| 1199 case Widget::InitParams::TYPE_POPUP: |
| 1200 wm_role_name = kX11WindowRolePopup; |
| 1201 break; |
| 1202 case Widget::InitParams::TYPE_BUBBLE: |
| 1203 wm_role_name = kX11WindowRoleBubble; |
| 1204 break; |
| 1205 default: |
| 1206 break; |
| 1207 } |
1193 } | 1208 } |
| 1209 if (wm_role_name) |
| 1210 ui::SetWindowRole(xdisplay_, xwindow_, std::string(wm_role_name)); |
1194 | 1211 |
1195 if (params.remove_standard_frame) { | 1212 if (params.remove_standard_frame) { |
1196 // Setting _GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED tells gnome-shell to not force | 1213 // Setting _GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED tells gnome-shell to not force |
1197 // fullscreen on the window when it matches the desktop size. | 1214 // fullscreen on the window when it matches the desktop size. |
1198 ui::SetHideTitlebarWhenMaximizedProperty(xwindow_, | 1215 ui::SetHideTitlebarWhenMaximizedProperty(xwindow_, |
1199 ui::HIDE_TITLEBAR_WHEN_MAXIMIZED); | 1216 ui::HIDE_TITLEBAR_WHEN_MAXIMIZED); |
1200 } | 1217 } |
1201 | 1218 |
1202 // If we have a parent, record the parent/child relationship. We use this | 1219 // If we have a parent, record the parent/child relationship. We use this |
1203 // data during destruction to make sure that when we try to close a parent | 1220 // data during destruction to make sure that when we try to close a parent |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1943 if (linux_ui) { | 1960 if (linux_ui) { |
1944 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 1961 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
1945 if (native_theme) | 1962 if (native_theme) |
1946 return native_theme; | 1963 return native_theme; |
1947 } | 1964 } |
1948 | 1965 |
1949 return ui::NativeTheme::instance(); | 1966 return ui::NativeTheme::instance(); |
1950 } | 1967 } |
1951 | 1968 |
1952 } // namespace views | 1969 } // namespace views |
OLD | NEW |