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

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 (nits) Created 3 years, 12 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
« 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 // TODO(varkha, sadrul): Investigate removing this (and instead expecting the
1033 // swapable glass frame like on Windows, we still replace the frame because 1033 // NonClientView::UpdateFrame() to update the frame-view when theme changes,
1034 // the button assets don't update otherwise. 1034 // like all other views).
1035 native_widget_delegate_->AsWidget()->non_client_view()->UpdateFrame(); 1035 base::ThreadTaskRunnerHandle::Get()->PostTask(
1036 FROM_HERE, base::Bind(&DesktopWindowTreeHostX11::DelayedChangeFrameType,
1037 weak_factory_.GetWeakPtr(),
1038 new_type));
1036 } 1039 }
1037 1040
1038 void DesktopWindowTreeHostX11::SetFullscreen(bool fullscreen) { 1041 void DesktopWindowTreeHostX11::SetFullscreen(bool fullscreen) {
1039 if (is_fullscreen_ == fullscreen) 1042 if (is_fullscreen_ == fullscreen)
1040 return; 1043 return;
1041 is_fullscreen_ = fullscreen; 1044 is_fullscreen_ = fullscreen;
1042 if (is_fullscreen_) 1045 if (is_fullscreen_)
1043 delayed_resize_task_.Cancel(); 1046 delayed_resize_task_.Cancel();
1044 1047
1045 // Work around a bug where if we try to unfullscreen, metacity immediately 1048 // 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 } 2275 }
2273 return ui::POST_DISPATCH_STOP_PROPAGATION; 2276 return ui::POST_DISPATCH_STOP_PROPAGATION;
2274 } 2277 }
2275 2278
2276 void DesktopWindowTreeHostX11::DelayedResize(const gfx::Size& size_in_pixels) { 2279 void DesktopWindowTreeHostX11::DelayedResize(const gfx::Size& size_in_pixels) {
2277 OnHostResizedInPixels(size_in_pixels); 2280 OnHostResizedInPixels(size_in_pixels);
2278 ResetWindowRegion(); 2281 ResetWindowRegion();
2279 delayed_resize_task_.Cancel(); 2282 delayed_resize_task_.Cancel();
2280 } 2283 }
2281 2284
2285 void DesktopWindowTreeHostX11::DelayedChangeFrameType(Widget::FrameType type) {
2286 SetUseNativeFrame(type == Widget::FRAME_TYPE_FORCE_NATIVE);
2287 // Replace the frame and layout the contents. Even though we don't have a
2288 // swappable glass frame like on Windows, we still replace the frame because
2289 // the button assets don't update otherwise.
2290 native_widget_delegate_->AsWidget()->non_client_view()->UpdateFrame();
2291 }
2292
2282 gfx::Rect DesktopWindowTreeHostX11::GetWorkAreaBoundsInPixels() const { 2293 gfx::Rect DesktopWindowTreeHostX11::GetWorkAreaBoundsInPixels() const {
2283 std::vector<int> value; 2294 std::vector<int> value;
2284 if (ui::GetIntArrayProperty(x_root_window_, "_NET_WORKAREA", &value) && 2295 if (ui::GetIntArrayProperty(x_root_window_, "_NET_WORKAREA", &value) &&
2285 value.size() >= 4) { 2296 value.size() >= 4) {
2286 return gfx::Rect(value[0], value[1], value[2], value[3]); 2297 return gfx::Rect(value[0], value[1], value[2], value[3]);
2287 } 2298 }
2288 2299
2289 // Fetch the geometry of the root window. 2300 // Fetch the geometry of the root window.
2290 Window root; 2301 Window root;
2291 int x, y; 2302 int x, y;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2344 2355
2345 // static 2356 // static
2346 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( 2357 DesktopWindowTreeHost* DesktopWindowTreeHost::Create(
2347 internal::NativeWidgetDelegate* native_widget_delegate, 2358 internal::NativeWidgetDelegate* native_widget_delegate,
2348 DesktopNativeWidgetAura* desktop_native_widget_aura) { 2359 DesktopNativeWidgetAura* desktop_native_widget_aura) {
2349 return new DesktopWindowTreeHostX11(native_widget_delegate, 2360 return new DesktopWindowTreeHostX11(native_widget_delegate,
2350 desktop_native_widget_aura); 2361 desktop_native_widget_aura);
2351 } 2362 }
2352 2363
2353 } // namespace views 2364 } // 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