 Chromium Code Reviews
 Chromium Code Reviews Issue 1927203003:
  Add support for X11 workspaces  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1927203003:
  Add support for X11 workspaces  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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 effa86484cfe77eed5aa00794ace06f8a866a8a6..75c0a2cd608cdd814122abdcd3c9239316cbd9a6 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 | 
| @@ -14,6 +14,7 @@ | 
| #include "base/command_line.h" | 
| #include "base/memory/ptr_util.h" | 
| +#include "base/strings/string_number_conversions.h" | 
| #include "base/strings/stringprintf.h" | 
| #include "base/strings/utf_string_conversions.h" | 
| #include "base/trace_event/trace_event.h" | 
| @@ -564,6 +565,13 @@ gfx::Rect DesktopWindowTreeHostX11::GetRestoredBounds() const { | 
| return GetWindowBoundsInScreen(); | 
| } | 
| +std::string DesktopWindowTreeHostX11::GetWorkspace() const { | 
| + int workspace_id; | 
| + if (ui::GetIntProperty(xwindow_, "_NET_WM_DESKTOP", &workspace_id)) | 
| + return base::IntToString(workspace_id); | 
| + return ""; | 
| 
sky
2016/05/03 17:40:53
std::string()
 
Tom (Use chromium acct)
2016/05/03 19:38:39
Done.
 | 
| +} | 
| + | 
| gfx::Rect DesktopWindowTreeHostX11::GetWorkAreaBoundsInScreen() const { | 
| return ToDIPRect(GetWorkAreaBoundsInPixels()); | 
| } | 
| @@ -1226,6 +1234,10 @@ void DesktopWindowTreeHostX11::InitX11Window( | 
| 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); | 
| + } else if (params.workspace.size()) { | 
| 
sky
2016/05/03 17:40:53
!params.workspace.empty()
 
Tom (Use chromium acct)
2016/05/03 19:38:39
Done.
 | 
| + int workspace; | 
| + if (base::StringToInt(params.workspace, &workspace)) | 
| + ui::SetIntProperty(xwindow_, "_NET_WM_DESKTOP", "CARDINAL", workspace); | 
| } | 
| // Setting _NET_WM_STATE by sending a message to the root_window (with | 
| @@ -1990,10 +2002,13 @@ 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")) { | 
| 
sky
2016/05/03 17:40:53
nit: no {} here as all branches are a single line.
 
Tom (Use chromium acct)
2016/05/03 19:38:39
Done.
 | 
| 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(); | 
| + } | 
| break; | 
| } | 
| case SelectionNotify: { |