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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc

Issue 2597733002: [views] Makes DesktopWindowTreeHostX11::FrameTypeChanged use PostTask (Closed)
Patch Set: [views] Makes DesktopWindowTreeHostX11::FrameTypeChanged use PostTask Created 4 years 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
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ('k') | 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/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 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 } 1020 }
1021 1021
1022 void DesktopWindowTreeHostX11::FrameTypeChanged() { 1022 void DesktopWindowTreeHostX11::FrameTypeChanged() {
1023 Widget::FrameType new_type = 1023 Widget::FrameType new_type =
1024 native_widget_delegate_->AsWidget()->frame_type(); 1024 native_widget_delegate_->AsWidget()->frame_type();
1025 if (new_type == Widget::FRAME_TYPE_DEFAULT) { 1025 if (new_type == Widget::FRAME_TYPE_DEFAULT) {
1026 // The default is determined by Widget::InitParams::remove_standard_frame 1026 // The default is determined by Widget::InitParams::remove_standard_frame
1027 // and does not change. 1027 // and does not change.
1028 return; 1028 return;
1029 } 1029 }
1030 1030 // Avoid mutating |View::children_| while possibly iterating over them.
1031 SetUseNativeFrame(new_type == Widget::FRAME_TYPE_FORCE_NATIVE); 1031 // See View::PropagateNativeThemeChanged().
1032 // Replace the frame and layout the contents. Even though we don't have a 1032 base::ThreadTaskRunnerHandle::Get()->PostTask(
1033 // swapable glass frame like on Windows, we still replace the frame because 1033 FROM_HERE, base::Bind(&DesktopWindowTreeHostX11::DelayedChangeFrameType,
1034 // the button assets don't update otherwise. 1034 close_widget_factory_.GetWeakPtr(),
sadrul 2016/12/22 01:12:16 I think you want to use weak_factory_ here. |close
varkha 2016/12/22 01:22:52 Yeah, sorry, copy-paste only works most of the tim
varkha 2016/12/22 17:49:11 Done.
1035 native_widget_delegate_->AsWidget()->non_client_view()->UpdateFrame(); 1035 new_type));
1036 } 1036 }
1037 1037
1038 void DesktopWindowTreeHostX11::SetFullscreen(bool fullscreen) { 1038 void DesktopWindowTreeHostX11::SetFullscreen(bool fullscreen) {
1039 if (is_fullscreen_ == fullscreen) 1039 if (is_fullscreen_ == fullscreen)
1040 return; 1040 return;
1041 is_fullscreen_ = fullscreen; 1041 is_fullscreen_ = fullscreen;
1042 if (is_fullscreen_) 1042 if (is_fullscreen_)
1043 delayed_resize_task_.Cancel(); 1043 delayed_resize_task_.Cancel();
1044 1044
1045 // Work around a bug where if we try to unfullscreen, metacity immediately 1045 // Work around a bug where if we try to unfullscreen, metacity immediately
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after
2272 } 2272 }
2273 return ui::POST_DISPATCH_STOP_PROPAGATION; 2273 return ui::POST_DISPATCH_STOP_PROPAGATION;
2274 } 2274 }
2275 2275
2276 void DesktopWindowTreeHostX11::DelayedResize(const gfx::Size& size_in_pixels) { 2276 void DesktopWindowTreeHostX11::DelayedResize(const gfx::Size& size_in_pixels) {
2277 OnHostResizedInPixels(size_in_pixels); 2277 OnHostResizedInPixels(size_in_pixels);
2278 ResetWindowRegion(); 2278 ResetWindowRegion();
2279 delayed_resize_task_.Cancel(); 2279 delayed_resize_task_.Cancel();
2280 } 2280 }
2281 2281
2282 void DesktopWindowTreeHostX11::DelayedChangeFrameType(Widget::FrameType type) {
2283 SetUseNativeFrame(type == Widget::FRAME_TYPE_FORCE_NATIVE);
2284 // Replace the frame and layout the contents. Even though we don't have a
2285 // swappable glass frame like on Windows, we still replace the frame because
2286 // the button assets don't update otherwise.
2287 native_widget_delegate_->AsWidget()->non_client_view()->UpdateFrame();
2288 }
2289
2282 gfx::Rect DesktopWindowTreeHostX11::GetWorkAreaBoundsInPixels() const { 2290 gfx::Rect DesktopWindowTreeHostX11::GetWorkAreaBoundsInPixels() const {
2283 std::vector<int> value; 2291 std::vector<int> value;
2284 if (ui::GetIntArrayProperty(x_root_window_, "_NET_WORKAREA", &value) && 2292 if (ui::GetIntArrayProperty(x_root_window_, "_NET_WORKAREA", &value) &&
2285 value.size() >= 4) { 2293 value.size() >= 4) {
2286 return gfx::Rect(value[0], value[1], value[2], value[3]); 2294 return gfx::Rect(value[0], value[1], value[2], value[3]);
2287 } 2295 }
2288 2296
2289 // Fetch the geometry of the root window. 2297 // Fetch the geometry of the root window.
2290 Window root; 2298 Window root;
2291 int x, y; 2299 int x, y;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2344 2352
2345 // static 2353 // static
2346 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( 2354 DesktopWindowTreeHost* DesktopWindowTreeHost::Create(
2347 internal::NativeWidgetDelegate* native_widget_delegate, 2355 internal::NativeWidgetDelegate* native_widget_delegate,
2348 DesktopNativeWidgetAura* desktop_native_widget_aura) { 2356 DesktopNativeWidgetAura* desktop_native_widget_aura) {
2349 return new DesktopWindowTreeHostX11(native_widget_delegate, 2357 return new DesktopWindowTreeHostX11(native_widget_delegate,
2350 desktop_native_widget_aura); 2358 desktop_native_widget_aura);
2351 } 2359 }
2352 2360
2353 } // namespace views 2361 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698