Commit bd817bc4 authored by erg@chromium.org's avatar erg@chromium.org

linux_aura: Implement the static part of the dbus menu for Unity.

[Relands r215769, which was reverted in r215780. It passed trybots and
was landed by the CQ, and broke some chromeos configuration. This just
adds gyp exclude rules for the new files.]

BUG=265560
TBR=sky@chromium.org
NOTRY=true

Review URL: https://chromiumcodereview.appspot.com/22455002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215928 0039d316-1c4b-4281-b951-d872f2087c98
parent 5fcb31f5
...@@ -10,10 +10,12 @@ ...@@ -10,10 +10,12 @@
BrowserDesktopRootWindowHostX11::BrowserDesktopRootWindowHostX11( BrowserDesktopRootWindowHostX11::BrowserDesktopRootWindowHostX11(
views::internal::NativeWidgetDelegate* native_widget_delegate, views::internal::NativeWidgetDelegate* native_widget_delegate,
views::DesktopNativeWidgetAura* desktop_native_widget_aura, views::DesktopNativeWidgetAura* desktop_native_widget_aura,
const gfx::Rect& initial_bounds) const gfx::Rect& initial_bounds,
BrowserView* browser_view)
: DesktopRootWindowHostX11(native_widget_delegate, : DesktopRootWindowHostX11(native_widget_delegate,
desktop_native_widget_aura, desktop_native_widget_aura,
initial_bounds) { initial_bounds),
browser_view_(browser_view) {
} }
BrowserDesktopRootWindowHostX11::~BrowserDesktopRootWindowHostX11() { BrowserDesktopRootWindowHostX11::~BrowserDesktopRootWindowHostX11() {
...@@ -36,6 +38,28 @@ bool BrowserDesktopRootWindowHostX11::UsesNativeSystemMenu() const { ...@@ -36,6 +38,28 @@ bool BrowserDesktopRootWindowHostX11::UsesNativeSystemMenu() const {
return false; return false;
} }
////////////////////////////////////////////////////////////////////////////////
// BrowserDesktopRootWindowHostX11,
// views::DesktopRootWindowHostX11 implementation:
aura::RootWindow* BrowserDesktopRootWindowHostX11::Init(
aura::Window* content_window,
const views::Widget::InitParams& params) {
aura::RootWindow* root_window = views::DesktopRootWindowHostX11::Init(
content_window, params);
// We have now created our backing X11 window. We now need to (possibly)
// alert Unity that there's a menu bar attached to it.
global_menu_bar_x11_.reset(new GlobalMenuBarX11(browser_view_, this));
return root_window;
}
void BrowserDesktopRootWindowHostX11::CloseNow() {
global_menu_bar_x11_.reset();
DesktopRootWindowHostX11::CloseNow();
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// BrowserDesktopRootWindowHost, public: // BrowserDesktopRootWindowHost, public:
...@@ -48,6 +72,7 @@ BrowserDesktopRootWindowHost* ...@@ -48,6 +72,7 @@ BrowserDesktopRootWindowHost*
BrowserView* browser_view, BrowserView* browser_view,
BrowserFrame* browser_frame) { BrowserFrame* browser_frame) {
return new BrowserDesktopRootWindowHostX11(native_widget_delegate, return new BrowserDesktopRootWindowHostX11(native_widget_delegate,
desktop_native_widget_aura, desktop_native_widget_aura,
initial_bounds); initial_bounds,
browser_view);
} }
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "ui/views/widget/desktop_aura/desktop_root_window_host_x11.h" #include "ui/views/widget/desktop_aura/desktop_root_window_host_x11.h"
#include "chrome/browser/ui/views/frame/browser_desktop_root_window_host.h" #include "chrome/browser/ui/views/frame/browser_desktop_root_window_host.h"
#include "chrome/browser/ui/views/frame/global_menu_bar_x11.h"
class BrowserFrame; class BrowserFrame;
class BrowserView; class BrowserView;
...@@ -22,7 +23,8 @@ class BrowserDesktopRootWindowHostX11 ...@@ -22,7 +23,8 @@ class BrowserDesktopRootWindowHostX11
BrowserDesktopRootWindowHostX11( BrowserDesktopRootWindowHostX11(
views::internal::NativeWidgetDelegate* native_widget_delegate, views::internal::NativeWidgetDelegate* native_widget_delegate,
views::DesktopNativeWidgetAura* desktop_native_widget_aura, views::DesktopNativeWidgetAura* desktop_native_widget_aura,
const gfx::Rect& initial_bounds); const gfx::Rect& initial_bounds,
BrowserView* browser_view);
virtual ~BrowserDesktopRootWindowHostX11(); virtual ~BrowserDesktopRootWindowHostX11();
private: private:
...@@ -31,8 +33,20 @@ class BrowserDesktopRootWindowHostX11 ...@@ -31,8 +33,20 @@ class BrowserDesktopRootWindowHostX11
virtual int GetMinimizeButtonOffset() const OVERRIDE; virtual int GetMinimizeButtonOffset() const OVERRIDE;
virtual bool UsesNativeSystemMenu() const OVERRIDE; virtual bool UsesNativeSystemMenu() const OVERRIDE;
// Overridden from views::DesktopRootWindowHostX11:
virtual aura::RootWindow* Init(
aura::Window* content_window,
const views::Widget::InitParams& params) OVERRIDE;
virtual void CloseNow() OVERRIDE;
BrowserView* browser_view_;
// Each browser frame maintains its own menu bar object because the lower
// level dbus protocol associates a xid to a menu bar; we can't map multiple
// xids to the same menu bar.
scoped_ptr<GlobalMenuBarX11> global_menu_bar_x11_;
DISALLOW_COPY_AND_ASSIGN(BrowserDesktopRootWindowHostX11); DISALLOW_COPY_AND_ASSIGN(BrowserDesktopRootWindowHostX11);
}; };
#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_DESKTOP_ROOT_WINDOW_HOST_X11_H_ #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_DESKTOP_ROOT_WINDOW_HOST_X11_H_
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/views/frame/global_menu_bar_registrar_x11.h"
#include "base/bind.h"
#include "base/logging.h"
#include "chrome/browser/ui/views/frame/global_menu_bar_x11.h"
#include "content/public/browser/browser_thread.h"
using content::BrowserThread;
namespace {
const char kAppMenuRegistrarName[] = "com.canonical.AppMenu.Registrar";
const char kAppMenuRegistrarPath[] = "/com/canonical/AppMenu/Registrar";
} // namespace
// static
GlobalMenuBarRegistrarX11* GlobalMenuBarRegistrarX11::GetInstance() {
return Singleton<GlobalMenuBarRegistrarX11>::get();
}
void GlobalMenuBarRegistrarX11::OnWindowMapped(unsigned long xid) {
live_xids_.insert(xid);
if (registrar_proxy_)
RegisterXID(xid);
}
void GlobalMenuBarRegistrarX11::OnWindowUnmapped(unsigned long xid) {
if (registrar_proxy_)
UnregisterXID(xid);
live_xids_.erase(xid);
}
GlobalMenuBarRegistrarX11::GlobalMenuBarRegistrarX11()
: registrar_proxy_(NULL) {
// libdbusmenu uses the gio version of dbus; I tried using the code in dbus/,
// but it looks like that's isn't sharing the bus name with the gio version,
// even when |connection_type| is set to SHARED.
g_dbus_proxy_new_for_bus(
G_BUS_TYPE_SESSION,
static_cast<GDBusProxyFlags>(
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS |
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START),
NULL,
kAppMenuRegistrarName,
kAppMenuRegistrarPath,
kAppMenuRegistrarName,
NULL, // TODO: Probalby want a real cancelable.
static_cast<GAsyncReadyCallback>(OnProxyCreatedThunk),
this);
}
GlobalMenuBarRegistrarX11::~GlobalMenuBarRegistrarX11() {
if (registrar_proxy_) {
g_signal_handlers_disconnect_by_func(
registrar_proxy_,
reinterpret_cast<void*>(OnNameOwnerChangedThunk),
this);
g_object_unref(registrar_proxy_);
}
}
void GlobalMenuBarRegistrarX11::RegisterXID(unsigned long xid) {
DCHECK(registrar_proxy_);
std::string path = GlobalMenuBarX11::GetPathForWindow(xid);
// TODO(erg): The mozilla implementation goes to a lot of callback trouble
// just to make sure that they react to make sure there's some sort of
// cancelable object; including making a whole callback just to handle the
// cancelable.
//
// I don't see any reason why we should care if "RegisterWindow" completes or
// not.
g_dbus_proxy_call(registrar_proxy_,
"RegisterWindow",
g_variant_new("(uo)", xid, path.c_str()),
G_DBUS_CALL_FLAGS_NONE, -1,
NULL,
NULL,
NULL);
}
void GlobalMenuBarRegistrarX11::UnregisterXID(unsigned long xid) {
DCHECK(registrar_proxy_);
std::string path = GlobalMenuBarX11::GetPathForWindow(xid);
// TODO(erg): The mozilla implementation goes to a lot of callback trouble
// just to make sure that they react to make sure there's some sort of
// cancelable object; including making a whole callback just to handle the
// cancelable.
//
// I don't see any reason why we should care if "UnregisterWindow" completes
// or not.
g_dbus_proxy_call(registrar_proxy_,
"UnregisterWindow",
g_variant_new("(u)", xid),
G_DBUS_CALL_FLAGS_NONE, -1,
NULL,
NULL,
NULL);
}
void GlobalMenuBarRegistrarX11::OnProxyCreated(GObject* source,
GAsyncResult* result) {
GError* error = NULL;
GDBusProxy* proxy = g_dbus_proxy_new_for_bus_finish(result, &error);
if (error) {
g_error_free(error);
return;
}
// TODO(erg): Mozilla's implementation has a workaround for GDBus
// cancellation here. However, it's marked as fixed. If there's weird
// problems with cancelation, look at how they fixed their issues.
registrar_proxy_ = proxy;
g_signal_connect(registrar_proxy_, "notify::g-name-owner",
G_CALLBACK(OnNameOwnerChangedThunk), this);
OnNameOwnerChanged(NULL, NULL);
}
void GlobalMenuBarRegistrarX11::OnNameOwnerChanged(GObject* /* ignored */,
GParamSpec* /* ignored */) {
// If the name owner changed, we need to reregister all the live xids with
// the system.
for (std::set<unsigned long>::const_iterator it = live_xids_.begin();
it != live_xids_.end(); ++it) {
RegisterXID(*it);
}
}
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_VIEWS_FRAME_GLOBAL_MENU_BAR_REGISTRAR_X11_H_
#define CHROME_BROWSER_UI_VIEWS_FRAME_GLOBAL_MENU_BAR_REGISTRAR_X11_H_
#include <gio/gio.h>
#include <set>
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "base/memory/singleton.h"
#include "ui/base/glib/glib_signal.h"
// Advertises our menu bars to Unity.
//
// GlobalMenuBarX11 is responsible for managing the DbusmenuServer for each
// XID. We need a separate object to own the dbus channel to
// com.canonical.AppMenu.Registrar and to register/unregister the mapping
// between a XID and the DbusmenuServer instance we are offering.
class GlobalMenuBarRegistrarX11 {
public:
static GlobalMenuBarRegistrarX11* GetInstance();
void OnWindowMapped(unsigned long xid);
void OnWindowUnmapped(unsigned long xid);
private:
friend struct DefaultSingletonTraits<GlobalMenuBarRegistrarX11>;
GlobalMenuBarRegistrarX11();
~GlobalMenuBarRegistrarX11();
// Sends the actual message.
void RegisterXID(unsigned long xid);
void UnregisterXID(unsigned long xid);
CHROMEG_CALLBACK_1(GlobalMenuBarRegistrarX11, void, OnProxyCreated,
GObject*, GAsyncResult*);
CHROMEG_CALLBACK_1(GlobalMenuBarRegistrarX11, void, OnNameOwnerChanged,
GObject*, GParamSpec*);
GDBusProxy* registrar_proxy_;
// Window XIDs which want to be registered, but haven't yet been because
// we're waiting for the proxy to become available.
std::set<unsigned long> live_xids_;
DISALLOW_COPY_AND_ASSIGN(GlobalMenuBarRegistrarX11);
};
#endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLOBAL_MENU_BAR_REGISTRAR_X11_H_
This diff is collapsed.
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_VIEWS_FRAME_GLOBAL_MENU_BAR_X11_H_
#define CHROME_BROWSER_UI_VIEWS_FRAME_GLOBAL_MENU_BAR_X11_H_
#include <map>
#include <string>
#include "base/compiler_specific.h"
#include "base/prefs/pref_change_registrar.h"
#include "chrome/browser/command_observer.h"
#include "ui/base/glib/glib_signal.h"
#include "ui/views/widget/desktop_aura/desktop_root_window_host_observer_x11.h"
typedef struct _DbusmenuMenuitem DbusmenuMenuitem;
typedef struct _DbusmenuServer DbusmenuServer;
namespace ui {
class Accelerator;
}
class Browser;
class BrowserView;
class BrowserDesktopRootWindowHostX11;
struct GlobalMenuBarCommand;
// Controls the Mac style menu bar on Unity.
//
// Unity has an Apple-like menu bar at the top of the screen that changes
// depending on the active window. In the GTK port, we had a hidden GtkMenuBar
// object in each GtkWindow which existed only to be scrapped by the
// libdbusmenu-gtk code. Since we don't have GtkWindows anymore, we need to
// interface directly with the lower level libdbusmenu-glib, which we
// opportunistically dlopen() since not everyone is running Ubuntu.
class GlobalMenuBarX11 : public CommandObserver,
public views::DesktopRootWindowHostObserverX11 {
public:
GlobalMenuBarX11(BrowserView* browser_view,
BrowserDesktopRootWindowHostX11* host);
virtual ~GlobalMenuBarX11();
// Creates the object path for DbusemenuServer which is attached to |xid|.
static std::string GetPathForWindow(unsigned long xid);
private:
typedef std::map<int, DbusmenuMenuitem*> CommandIDMenuItemMap;
// Creates a DbusmenuServer, and attaches all the menu items.
void InitServer(unsigned long xid);
// Stops listening to enable state changed events.
void Disable();
// Creates a whole menu defined with |commands| and titled with the string
// |menu_str_id|. Then appends it to |parent|.
void BuildMenuFrom(DbusmenuMenuitem* parent,
int menu_str_id,
CommandIDMenuItemMap* id_to_menu_item,
GlobalMenuBarCommand* commands);
// Creates an individual menu item from a title and command, and subscribes
// to the activation signal.
DbusmenuMenuitem* BuildMenuItem(
int string_id,
int command_id,
int tag_id,
CommandIDMenuItemMap* id_to_menu_item);
// Sets the accelerator for |item|.
void RegisterAccelerator(DbusmenuMenuitem* item,
const ui::Accelerator& accelerator);
// Updates the visibility of the bookmark bar on pref changes.
void OnBookmarkBarVisibilityChanged();
// Overridden from CommandObserver:
virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE;
// Overridden from DesktopRootWindowHostObserverX11:
virtual void OnWindowMapped(unsigned long xid) OVERRIDE;
virtual void OnWindowUnmapped(unsigned long xid) OVERRIDE;
CHROMEG_CALLBACK_1(GlobalMenuBarX11, void, OnItemActivated, DbusmenuMenuitem*,
unsigned int);
Browser* browser_;
BrowserView* browser_view_;
BrowserDesktopRootWindowHostX11* host_;
// Maps command ids to DbusmenuMenuitems so we can modify their
// enabled/checked state in response to state change notifications.
CommandIDMenuItemMap id_to_menu_item_;
DbusmenuServer* server_;
DbusmenuMenuitem* root_item_;
// Tracks value of the kShowBookmarkBar preference.
PrefChangeRegistrar pref_change_registrar_;
DISALLOW_COPY_AND_ASSIGN(GlobalMenuBarX11);
};
#endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLOBAL_MENU_BAR_X11_H_
...@@ -1705,6 +1705,10 @@ ...@@ -1705,6 +1705,10 @@
'browser/ui/views/frame/browser_desktop_root_window_host_x11.h', 'browser/ui/views/frame/browser_desktop_root_window_host_x11.h',
'browser/ui/views/frame/glass_browser_frame_view.cc', 'browser/ui/views/frame/glass_browser_frame_view.cc',
'browser/ui/views/frame/glass_browser_frame_view.h', 'browser/ui/views/frame/glass_browser_frame_view.h',
'browser/ui/views/frame/global_menu_bar_x11.cc',
'browser/ui/views/frame/global_menu_bar_x11.h',
'browser/ui/views/frame/global_menu_bar_registrar_x11.cc',
'browser/ui/views/frame/global_menu_bar_registrar_x11.h',
'browser/ui/views/frame/immersive_mode_controller.cc', 'browser/ui/views/frame/immersive_mode_controller.cc',
'browser/ui/views/frame/immersive_mode_controller.h', 'browser/ui/views/frame/immersive_mode_controller.h',
'browser/ui/views/frame/immersive_mode_controller_ash.cc', 'browser/ui/views/frame/immersive_mode_controller_ash.cc',
...@@ -2574,12 +2578,16 @@ ...@@ -2574,12 +2578,16 @@
['exclude', 'browser/ui/ash/chrome_shell_delegate_views.cc'], ['exclude', 'browser/ui/ash/chrome_shell_delegate_views.cc'],
['exclude', 'browser/ui/ash/session_state_delegate_views.cc'], ['exclude', 'browser/ui/ash/session_state_delegate_views.cc'],
['exclude', 'browser/ui/screen_capture_notification_ui_stub.cc'], ['exclude', 'browser/ui/screen_capture_notification_ui_stub.cc'],
['exclude', 'browser/ui/views/frame/browser_desktop_root_window_host_x11.cc'],
['exclude', 'browser/ui/views/frame/browser_desktop_root_window_host_x11.h'],
['exclude', 'browser/ui/views/frame/desktop_browser_frame_aura.cc'], ['exclude', 'browser/ui/views/frame/desktop_browser_frame_aura.cc'],
['exclude', 'browser/ui/views/frame/desktop_browser_frame_aura.h'], ['exclude', 'browser/ui/views/frame/desktop_browser_frame_aura.h'],
['exclude', 'browser/ui/views/frame/desktop_user_action_handler_aura.cc'], ['exclude', 'browser/ui/views/frame/desktop_user_action_handler_aura.cc'],
['exclude', 'browser/ui/views/frame/desktop_user_action_handler_aura.h'], ['exclude', 'browser/ui/views/frame/desktop_user_action_handler_aura.h'],
['exclude', 'browser/ui/views/frame/browser_desktop_root_window_host_x11.cc'], ['exclude', 'browser/ui/views/frame/global_menu_bar_x11.cc'],
['exclude', 'browser/ui/views/frame/browser_desktop_root_window_host_x11.h'], ['exclude', 'browser/ui/views/frame/global_menu_bar_x11.h'],
['exclude', 'browser/ui/views/frame/global_menu_bar_registrar_x11.cc'],
['exclude', 'browser/ui/views/frame/global_menu_bar_registrar_x11.h'],
['exclude', 'browser/ui/views/screen_capture_notification_ui_views.cc'], ['exclude', 'browser/ui/views/screen_capture_notification_ui_views.cc'],
['exclude', 'browser/ui/webui/help/version_updater_basic.cc'], ['exclude', 'browser/ui/webui/help/version_updater_basic.cc'],
['exclude', 'browser/ui/webui/help/version_updater_basic.h'], ['exclude', 'browser/ui/webui/help/version_updater_basic.h'],
...@@ -2627,6 +2635,7 @@ ...@@ -2627,6 +2635,7 @@
# world. # world.
'browser/ui/libgtk2ui/libgtk2ui.gyp:gtk2ui', 'browser/ui/libgtk2ui/libgtk2ui.gyp:gtk2ui',
'../ui/linux_ui/linux_ui.gyp:linux_ui', '../ui/linux_ui/linux_ui.gyp:linux_ui',
'../build/linux/system.gyp:gio',
], ],
}], }],
['use_aura==0 or chromeos==1 or OS!="linux"', { ['use_aura==0 or chromeos==1 or OS!="linux"', {
......
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_OBSERVER_X11_H_
#define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_OBSERVER_X11_H_
#include "ui/views/views_export.h"
namespace views {
// Allows for the observation of lower level window events.
class VIEWS_EXPORT DesktopRootWindowHostObserverX11 {
public:
virtual ~DesktopRootWindowHostObserverX11() {}
// Called after we receive a MapNotify event (the X11 server has allocated
// resources for it).
virtual void OnWindowMapped(unsigned long xid) = 0;
// Called after we receive an UnmapNotify event (the X11 server has freed
// resources for it).
virtual void OnWindowUnmapped(unsigned long xid) = 0;
};
} // namespace views
#endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_OBSERVER_X11_H_
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "ui/aura/client/cursor_client.h" #include "ui/aura/client/cursor_client.h"
#include "ui/aura/root_window_host.h" #include "ui/aura/root_window_host.h"
#include "ui/base/cursor/cursor_loader_x11.h" #include "ui/base/cursor/cursor_loader_x11.h"
...@@ -32,6 +33,7 @@ class DesktopActivationClient; ...@@ -32,6 +33,7 @@ class DesktopActivationClient;
class DesktopCaptureClient; class DesktopCaptureClient;
class DesktopDragDropClientAuraX11; class DesktopDragDropClientAuraX11;
class DesktopDispatcherClient; class DesktopDispatcherClient;
class DesktopRootWindowHostObserverX11;
class X11DesktopWindowMoveClient; class X11DesktopWindowMoveClient;
class X11WindowEventFilter; class X11WindowEventFilter;
...@@ -64,42 +66,13 @@ class VIEWS_EXPORT DesktopRootWindowHostX11 : ...@@ -64,42 +66,13 @@ class VIEWS_EXPORT DesktopRootWindowHostX11 :
// has changed our activation. // has changed our activation.
void HandleNativeWidgetActivationChanged(bool active); void HandleNativeWidgetActivationChanged(bool active);
void AddObserver(views::DesktopRootWindowHostObserverX11* observer);
void RemoveObserver(views::DesktopRootWindowHostObserverX11* observer);
// Deallocates the internal list of open windows. // Deallocates the internal list of open windows.
static void CleanUpWindowList(); static void CleanUpWindowList();
private: protected:
// Initializes our X11 surface to draw on. This method performs all
// initialization related to talking to the X11 server.
void InitX11Window(const Widget::InitParams& params);
// Creates an aura::RootWindow to contain the |content_window|, along with
// all aura client objects that direct behavior.
aura::RootWindow* InitRootWindow(const Widget::InitParams& params);
// Returns true if there's an X window manager present... in most cases. Some
// window managers (notably, ion3) don't implement enough of ICCCM for us to
// detect that they're there.
bool IsWindowManagerPresent();
// Sends a message to the x11 window manager, enabling or disabling the
// states |state1| and |state2|.
void SetWMSpecState(bool enabled, ::Atom state1, ::Atom state2);
// Checks if the window manager has set a specific state.
bool HasWMSpecProperty(const char* property) const;
// Called when another DRWHL takes capture, or when capture is released
// entirely.
void OnCaptureReleased();
// Dispatches a mouse event, taking mouse capture into account. If a
// different host has capture, we translate the event to its coordinate space
// and dispatch it to that host instead.
void DispatchMouseEvent(ui::MouseEvent* event);
// See comment for variable open_windows_.
static std::list<XID>& open_windows();
// Overridden from DesktopRootWindowHost: // Overridden from DesktopRootWindowHost:
virtual aura::RootWindow* Init(aura::Window* content_window, virtual aura::RootWindow* Init(aura::Window* content_window,
const Widget::InitParams& params) OVERRIDE; const Widget::InitParams& params) OVERRIDE;
...@@ -180,6 +153,39 @@ class VIEWS_EXPORT DesktopRootWindowHostX11 : ...@@ -180,6 +153,39 @@ class VIEWS_EXPORT DesktopRootWindowHostX11 :
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
virtual void PrepareForShutdown() OVERRIDE; virtual void PrepareForShutdown() OVERRIDE;
private:
// Initializes our X11 surface to draw on. This method performs all
// initialization related to talking to the X11 server.
void InitX11Window(const Widget::InitParams& params);
// Creates an aura::RootWindow to contain the |content_window|, along with
// all aura client objects that direct behavior.
aura::RootWindow* InitRootWindow(const Widget::InitParams& params);
// Returns true if there's an X window manager present... in most cases. Some
// window managers (notably, ion3) don't implement enough of ICCCM for us to
// detect that they're there.
bool IsWindowManagerPresent();
// Sends a message to the x11 window manager, enabling or disabling the
// states |state1| and |state2|.
void SetWMSpecState(bool enabled, ::Atom state1, ::Atom state2);
// Checks if the window manager has set a specific state.
bool HasWMSpecProperty(const char* property) const;
// Called when another DRWHL takes capture, or when capture is released
// entirely.
void OnCaptureReleased();
// Dispatches a mouse event, taking mouse capture into account. If a
// different host has capture, we translate the event to its coordinate space
// and dispatch it to that host instead.
void DispatchMouseEvent(ui::MouseEvent* event);
// See comment for variable open_windows_.
static std::list<XID>& open_windows();
// Overridden from Dispatcher: // Overridden from Dispatcher:
virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE;
...@@ -245,6 +251,8 @@ class VIEWS_EXPORT DesktopRootWindowHostX11 : ...@@ -245,6 +251,8 @@ class VIEWS_EXPORT DesktopRootWindowHostX11 :
aura::RootWindowHostDelegate* root_window_host_delegate_; aura::RootWindowHostDelegate* root_window_host_delegate_;
aura::Window* content_window_; aura::Window* content_window_;
ObserverList<DesktopRootWindowHostObserverX11> observer_list_;
// The current root window host that has capture. While X11 has something // The current root window host that has capture. While X11 has something
// like Windows SetCapture()/ReleaseCapture(), it is entirely implicit and // like Windows SetCapture()/ReleaseCapture(), it is entirely implicit and
// there are no notifications when this changes. We need to track this so we // there are no notifications when this changes. We need to track this so we
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment