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

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

Issue 2108933003: Reorder browser list on workspace switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed endl Created 4 years, 5 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
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 82ba30c804f47a2689399431ec8be909a582cc4e..f1cc3f6323893dbdf784a7c9cc795b2d5a13d903 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
@@ -568,10 +568,20 @@ gfx::Rect DesktopWindowTreeHostX11::GetRestoredBounds() const {
}
std::string DesktopWindowTreeHostX11::GetWorkspace() const {
- int workspace_id;
- if (ui::GetIntProperty(xwindow_, "_NET_WM_DESKTOP", &workspace_id))
- return base::IntToString(workspace_id);
- return std::string();
+ if (workspace_.empty())
+ const_cast<DesktopWindowTreeHostX11*>(this)->UpdateWorkspace();
+ return workspace_;
+}
+
+bool DesktopWindowTreeHostX11::UpdateWorkspace() {
+ int workspace_int;
+ if (!ui::GetWindowDesktop(xwindow_, &workspace_int))
+ return false;
+ std::string workspace_str = base::IntToString(workspace_int);
+ if (workspace_ == workspace_str)
+ return false;
+ workspace_ = workspace_str;
+ return true;
}
gfx::Rect DesktopWindowTreeHostX11::GetWorkAreaBoundsInScreen() const {
@@ -1230,6 +1240,7 @@ void DesktopWindowTreeHostX11::InitX11Window(
if (is_always_on_top_)
state_atom_list.push_back(atom_cache_.GetAtom("_NET_WM_STATE_ABOVE"));
+ workspace_.clear();
if (params.visible_on_all_workspaces) {
state_atom_list.push_back(atom_cache_.GetAtom("_NET_WM_STATE_STICKY"));
ui::SetIntProperty(xwindow_, "_NET_WM_DESKTOP", "CARDINAL", kAllDesktops);
@@ -1996,12 +2007,14 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
}
case PropertyNotify: {
::Atom changed_atom = xev->xproperty.atom;
- if (changed_atom == atom_cache_.GetAtom("_NET_WM_STATE"))
+ if (changed_atom == atom_cache_.GetAtom("_NET_WM_STATE")) {
OnWMStateUpdated();
- else if (changed_atom == atom_cache_.GetAtom("_NET_FRAME_EXTENTS"))
+ } else if (changed_atom == atom_cache_.GetAtom("_NET_FRAME_EXTENTS")) {
OnFrameExtentsUpdated();
- else if (changed_atom == atom_cache_.GetAtom("_NET_WM_DESKTOP"))
- OnHostWorkspaceChanged();
+ } else if (changed_atom == atom_cache_.GetAtom("_NET_WM_DESKTOP")) {
+ if (UpdateWorkspace())
+ OnHostWorkspaceChanged();
+ }
break;
}
case SelectionNotify: {
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ('k') | ui/views/widget/desktop_aura/x11_desktop_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698