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

Unified Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc

Issue 944763002: Make Page Visibility API work when the browser window is visible or not Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use of SetWindowVisibility message Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
index 1316b8b2d0eb80567429451e029ab661e111ce14..3219a52268b8d09a9ea92c974312523eb898fdd5 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
@@ -1751,8 +1751,21 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
previous_bounds_in_pixels_ = bounds_in_pixels_;
bounds_in_pixels_ = bounds_in_pixels;
- if (origin_changed)
+ if (origin_changed) {
OnHostMoved(bounds_in_pixels_.origin());
+ // Allows visibilityChange events to be triggered while switching
+ // between workspaces.
+ ::Screen* screen = DefaultScreenOfDisplay(xdisplay_);
+ int screen_width = WidthOfScreen(screen);
+ int screen_height = HeightOfScreen(screen);
+
+ if (translated_x_in_pixels < 0 || translated_x_in_pixels > screen_width
+ || translated_y_in_pixels < 0 ||
+ translated_y_in_pixels > screen_height)
+ OnHostSetWindowVisibility(false);
+ else
+ OnHostSetWindowVisibility(true);
+ }
if (size_changed) {
delayed_resize_task_.Reset(base::Bind(
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698