Skip to content

Commit 334e042

Browse files
committed
foreign-toplevel: adapt sending global menu info to the new interface
1 parent e2b059d commit 334e042

1 file changed

Lines changed: 22 additions & 11 deletions

File tree

plugins/protocols/foreign-toplevel.cpp

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,38 @@ class wayfire_foreign_toplevel
8181
}
8282

8383
void toplevel_send_gtk_shell1_dbus_properties(
84-
const char *application_id,
8584
const char *app_menu_path,
8685
const char *menubar_path,
8786
const char *window_object_path,
8887
const char *application_object_path,
8988
const char *unique_bus_name)
9089
{
91-
wlr_foreign_toplevel_handle_v1_set_gtk_shell1_dbus_properties(handle,
92-
application_id,
93-
app_menu_path,
94-
menubar_path,
95-
window_object_path,
96-
application_object_path,
97-
unique_bus_name);
90+
//!! TODO: app_menu_path (not sure which interface it corresponds to)
91+
92+
if (menubar_path && unique_bus_name)
93+
wlr_foreign_toplevel_handle_v1_add_surface_dbus_annotation(
94+
handle, "org.gtk.Menus", unique_bus_name, menubar_path);
95+
else wlr_foreign_toplevel_handle_v1_remove_surface_dbus_annotation(
96+
handle, "org.gtk.Menus");
97+
98+
if (window_object_path && unique_bus_name)
99+
wlr_foreign_toplevel_handle_v1_add_surface_dbus_annotation(
100+
handle, "org.gtk.Actions", unique_bus_name, window_object_path);
101+
else wlr_foreign_toplevel_handle_v1_remove_surface_dbus_annotation(
102+
handle, "org.gtk.Actions");
103+
104+
if (application_object_path && unique_bus_name)
105+
wlr_foreign_toplevel_handle_v1_add_client_dbus_annotation(
106+
handle, "org.gtk.Actions", unique_bus_name, application_object_path);
107+
else wlr_foreign_toplevel_handle_v1_remove_client_dbus_annotation(
108+
handle, "org.gtk.Actions");
98109
}
99110

100111
void toplevel_send_kde_appmenu_path(const char *service_name, const char *object_path)
101112
{
102-
wlr_foreign_toplevel_handle_v1_set_kde_appmenu_path(handle, service_name, object_path);
113+
if (service_name && object_path)
114+
wlr_foreign_toplevel_handle_v1_add_surface_dbus_annotation(
115+
handle, "com.canonical.dbusmenu", service_name, object_path);
103116
}
104117

105118
private:
@@ -322,7 +335,6 @@ class wayfire_foreign_toplevel_protocol_impl : public wf::plugin_interface_t
322335
if (auto props = toplevel->get_data<toplevel_gtk_shell1_dbus_properties_t>())
323336
{
324337
handle_for_view[toplevel]->toplevel_send_gtk_shell1_dbus_properties(
325-
nullptr, // !! TODO: application ID
326338
props->app_menu_path ? props->app_menu_path->c_str() : nullptr,
327339
props->menubar_path ? props->menubar_path->c_str() : nullptr,
328340
props->window_object_path ? props->window_object_path->c_str() : nullptr,
@@ -353,7 +365,6 @@ class wayfire_foreign_toplevel_protocol_impl : public wf::plugin_interface_t
353365
if (it != handle_for_view.end())
354366
{
355367
it->second->toplevel_send_gtk_shell1_dbus_properties(
356-
nullptr, // !! TODO: application ID
357368
ev->app_menu_path,
358369
ev->menubar_path,
359370
ev->window_object_path,

0 commit comments

Comments
 (0)