forked from mirrors/gecko-dev
Bug 1883254 - Fix dbus-disabled build after bug 1883184. r=stransky
Ugh Differential Revision: https://phabricator.services.mozilla.com/D203487
This commit is contained in:
parent
0553a60afb
commit
bcc968a60b
6 changed files with 23 additions and 8 deletions
|
|
@ -444,6 +444,8 @@ void NativeMenuGtk::CloseSubmenu(dom::Element*) {
|
|||
// TODO: For testing mostly.
|
||||
}
|
||||
|
||||
#ifdef MOZ_ENABLE_DBUS
|
||||
|
||||
class MenubarModelDBus final : public MenuModel {
|
||||
public:
|
||||
explicit MenubarModelDBus(dom::Element* aElement) : MenuModel(aElement) {
|
||||
|
|
@ -517,7 +519,7 @@ static uint32_t KeyFrom(const dom::Element* aElement) {
|
|||
return ParseKey(key, keycode);
|
||||
}
|
||||
|
||||
// TODO(emilio): Unifiy with nsMenuUtilsX::GeckoModifiersForNodeAttribute (or
|
||||
// TODO(emilio): Unify with nsMenuUtilsX::GeckoModifiersForNodeAttribute (or
|
||||
// at least switch to strtok_r).
|
||||
static uint32_t ParseModifiers(const nsAString& aModifiers) {
|
||||
if (aModifiers.IsEmpty()) {
|
||||
|
|
@ -730,7 +732,7 @@ void DBusMenuBar::OnNameOwnerChanged() {
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_WAYLAND
|
||||
# ifdef MOZ_WAYLAND
|
||||
if (auto* display = widget::WaylandDisplayGet()) {
|
||||
xdg_dbus_annotation_manager_v1* annotationManager =
|
||||
display->GetXdgDbusAnnotationManager();
|
||||
|
|
@ -757,8 +759,8 @@ void DBusMenuBar::OnNameOwnerChanged() {
|
|||
mObjectPath.get());
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#ifdef MOZ_X11
|
||||
# endif
|
||||
# ifdef MOZ_X11
|
||||
// legacy path
|
||||
auto xid = GDK_WINDOW_XID(gdkWin);
|
||||
widget::DBusProxyCall(mProxy, "RegisterWindow",
|
||||
|
|
@ -774,7 +776,7 @@ void DBusMenuBar::OnNameOwnerChanged() {
|
|||
aError->message);
|
||||
self->mMenuModel->Element()->SetBoolAttr(nsGkAtoms::hidden, false);
|
||||
});
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
static unsigned sID = 0;
|
||||
|
|
@ -812,5 +814,6 @@ RefPtr<DBusMenuBar> DBusMenuBar::Create(dom::Element* aElement) {
|
|||
}
|
||||
|
||||
DBusMenuBar::~DBusMenuBar() = default;
|
||||
#endif
|
||||
|
||||
} // namespace mozilla::widget
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ class NativeMenuGtk : public NativeMenu {
|
|||
nsTArray<NativeMenu::Observer*> mObservers;
|
||||
};
|
||||
|
||||
#ifdef MOZ_ENABLE_DBUS
|
||||
|
||||
class DBusMenuBar final : public RefCounted<DBusMenuBar> {
|
||||
public:
|
||||
MOZ_DECLARE_REFCOUNTED_TYPENAME(DBusMenuBar)
|
||||
|
|
@ -77,11 +79,13 @@ class DBusMenuBar final : public RefCounted<DBusMenuBar> {
|
|||
RefPtr<MenubarModelDBus> mMenuModel;
|
||||
RefPtr<DbusmenuServer> mServer;
|
||||
RefPtr<GDBusProxy> mProxy;
|
||||
#ifdef MOZ_WAYLAND
|
||||
# ifdef MOZ_WAYLAND
|
||||
xdg_dbus_annotation_v1* mAnnotation = nullptr;
|
||||
#endif
|
||||
# endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
|||
|
|
@ -18,11 +18,13 @@ void NativeMenuSupport::CreateNativeMenuBar(nsIWidget* aParent,
|
|||
MOZ_RELEASE_ASSERT(NS_IsMainThread(),
|
||||
"Attempting to create native menu bar on wrong thread!");
|
||||
|
||||
#ifdef MOZ_ENABLE_DBUS
|
||||
if (aMenuBarElement && StaticPrefs::widget_gtk_global_menu_enabled() &&
|
||||
DBusMenuFunctions::Init()) {
|
||||
static_cast<nsWindow*>(aParent)->SetDBusMenuBar(
|
||||
DBusMenuBar::Create(aMenuBarElement));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
already_AddRefed<NativeMenu> NativeMenuSupport::CreateNativeContextMenu(
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ UNIFIED_SOURCES += [
|
|||
"AsyncGtkClipboardRequest.cpp",
|
||||
"CompositorWidgetChild.cpp",
|
||||
"CompositorWidgetParent.cpp",
|
||||
"DBusMenu.cpp",
|
||||
"DMABufLibWrapper.cpp",
|
||||
"DMABufSurface.cpp",
|
||||
"GfxInfo.cpp",
|
||||
|
|
@ -174,6 +173,7 @@ if CONFIG["MOZ_ENABLE_DBUS"]:
|
|||
]
|
||||
UNIFIED_SOURCES += [
|
||||
"AsyncDBus.cpp",
|
||||
"DBusMenu.cpp",
|
||||
]
|
||||
CXXFLAGS += CONFIG["MOZ_DBUS_CFLAGS"]
|
||||
|
||||
|
|
|
|||
|
|
@ -6984,10 +6984,12 @@ void nsWindow::UpdateWindowDraggingRegion(
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_ENABLE_DBUS
|
||||
void nsWindow::SetDBusMenuBar(
|
||||
RefPtr<mozilla::widget::DBusMenuBar> aDbusMenuBar) {
|
||||
mDBusMenuBar = std::move(aDbusMenuBar);
|
||||
}
|
||||
#endif
|
||||
|
||||
LayoutDeviceIntCoord nsWindow::GetTitlebarRadius() {
|
||||
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
||||
|
|
|
|||
|
|
@ -374,7 +374,9 @@ class nsWindow final : public nsBaseWidget {
|
|||
void UpdateWindowDraggingRegion(
|
||||
const LayoutDeviceIntRegion& aRegion) override;
|
||||
|
||||
#ifdef MOZ_ENABLE_DBUS
|
||||
void SetDBusMenuBar(RefPtr<mozilla::widget::DBusMenuBar> aDbusMenuBar);
|
||||
#endif
|
||||
|
||||
// HiDPI scale conversion
|
||||
gint GdkCeiledScaleFactor();
|
||||
|
|
@ -908,7 +910,9 @@ class nsWindow final : public nsBaseWidget {
|
|||
RefPtr<nsWindow> mWaylandPopupNext;
|
||||
RefPtr<nsWindow> mWaylandPopupPrev;
|
||||
|
||||
#ifdef MOZ_ENABLE_DBUS
|
||||
RefPtr<mozilla::widget::DBusMenuBar> mDBusMenuBar;
|
||||
#endif
|
||||
|
||||
// When popup is resized by Gtk by move-to-rect callback,
|
||||
// we store final popup size here. Then we use mMoveToRectPopupSize size
|
||||
|
|
|
|||
Loading…
Reference in a new issue