-
Notifications
You must be signed in to change notification settings - Fork 221
Global menu support (via IPC) #2959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1dca423
object: add explicit API to remove a property
dkondor 586e040
KDE Appmenu: new protocol implementation
dkondor 442eb28
gtk-shell: store DBus properties
dkondor 0c30d3c
gtk-shell: optionally advertise the "global_menu_bar" capability
dkondor 86aceed
bump ABI version
dkondor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <?xml version="1.0"?> | ||
| <wayfire> | ||
| <plugin name="kde-appmenu"> | ||
| <_short>KDE Appmenu support</_short> | ||
| <_long>An implementation of the KDE Appmenu protocol for global menus.</_long> | ||
| <category>Utility</category> | ||
| </plugin> | ||
| </wayfire> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| #include "kde-appmenu-protocol.h" | ||
| #include "wayfire/core.hpp" | ||
| #include "wayfire/object.hpp" | ||
| #include <wayfire/plugin.hpp> | ||
| #include <wayfire/view.hpp> | ||
| #include <wayfire/toplevel-view.hpp> | ||
|
|
||
| #define KDE_APPMENU_VERSION 2 | ||
|
|
||
| struct wf_kde_appmenu_surface | ||
| { | ||
| wl_resource *resource; | ||
| wl_resource *wl_surface; | ||
| }; | ||
|
|
||
| static void handle_kde_appmenu_set_address(wl_client *client, | ||
| wl_resource *resource, const char *service_name, | ||
| const char *object_path) | ||
| { | ||
| auto surface = static_cast<wf_kde_appmenu_surface*>(wl_resource_get_user_data(resource)); | ||
| wayfire_view view = wf::wl_surface_to_wayfire_view(surface->wl_surface); | ||
| if (!view) | ||
| { | ||
| LOGE("Could not get view"); | ||
| return; | ||
| } else | ||
| { | ||
| if (service_name && *service_name) | ||
| { | ||
| view->set_property<std::string>("kde-appmenu-service-name", service_name); | ||
| } else | ||
| { | ||
| view->erase_property("kde-appmenu-service-name"); | ||
| } | ||
|
|
||
| if (object_path && *object_path) | ||
| { | ||
| view->set_property<std::string>("kde-appmenu-object-path", object_path); | ||
| } else | ||
| { | ||
| view->erase_property("kde-appmenu-object-path"); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| static void handle_kde_appmenu_release(wl_client*, wl_resource*) | ||
| { | ||
| /* no-op */ | ||
| } | ||
|
|
||
| static void handle_kde_appmenu_destroy(wl_resource *resource) | ||
| { | ||
| auto surface = static_cast<wf_kde_appmenu_surface*>(wl_resource_get_user_data(resource)); | ||
| delete surface; | ||
| } | ||
|
|
||
| const struct org_kde_kwin_appmenu_interface kde_appmenu_impl = { | ||
| .set_address = handle_kde_appmenu_set_address, | ||
| .release = handle_kde_appmenu_release | ||
| }; | ||
|
|
||
|
|
||
| static void handle_kde_appmenu_manager_create(wl_client *client, | ||
| wl_resource *resource, uint32_t id, wl_resource *surface) | ||
| { | ||
| wf_kde_appmenu_surface *kde_appmenu_surface = new wf_kde_appmenu_surface; | ||
| kde_appmenu_surface->resource = wl_resource_create(client, | ||
| &org_kde_kwin_appmenu_interface, wl_resource_get_version(resource), id); | ||
| kde_appmenu_surface->wl_surface = surface; | ||
| wl_resource_set_implementation(kde_appmenu_surface->resource, &kde_appmenu_impl, | ||
| kde_appmenu_surface, handle_kde_appmenu_destroy); | ||
| } | ||
|
|
||
| static void handle_kde_appmenu_manager_release(wl_client*, wl_resource*) | ||
| { | ||
| /* no-op */ | ||
| } | ||
|
|
||
| static void handle_kde_appmenu_manager_destroy(wl_resource*) | ||
| { | ||
| /* no-op */ | ||
| } | ||
|
|
||
| static const struct org_kde_kwin_appmenu_manager_interface kde_appmenu_manager_impl = { | ||
| .create = handle_kde_appmenu_manager_create, | ||
| .release = handle_kde_appmenu_manager_release | ||
| }; | ||
|
|
||
|
|
||
| static void bind_kde_appmenu(wl_client *client, void *data, uint32_t version, uint32_t id) | ||
| { | ||
| auto resource = wl_resource_create(client, &org_kde_kwin_appmenu_manager_interface, | ||
| KDE_APPMENU_VERSION, id); | ||
| wl_resource_set_implementation(resource, &kde_appmenu_manager_impl, | ||
| data, handle_kde_appmenu_manager_destroy); | ||
| } | ||
|
|
||
| class wayfire_kde_appmenu_impl : public wf::plugin_interface_t | ||
| { | ||
| public: | ||
| void init() override | ||
| { | ||
| auto display = wf::get_core().display; | ||
| wl_global_create(display, &org_kde_kwin_appmenu_manager_interface, | ||
| KDE_APPMENU_VERSION, NULL, bind_kde_appmenu); | ||
| } | ||
|
|
||
| bool is_unloadable() override | ||
| { | ||
| return false; | ||
| } | ||
| }; | ||
|
|
||
| DECLARE_WAYFIRE_PLUGIN(wayfire_kde_appmenu_impl); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <protocol name="appmenu"> | ||
| <copyright><![CDATA[ | ||
| SPDX-FileCopyrightText: 2017 David Edmundson | ||
|
|
||
| SPDX-License-Identifier: LGPL-2.1-or-later | ||
| ]]></copyright> | ||
| <interface name="org_kde_kwin_appmenu_manager" version="2"> | ||
| <description summary="appmenu dbus address interface"> | ||
| This interface allows a client to link a window (or wl_surface) to an com.canonical.dbusmenu | ||
| interface registered on DBus. | ||
| </description> | ||
| <request name="create"> | ||
| <arg name="id" type="new_id" interface="org_kde_kwin_appmenu"/> | ||
| <arg name="surface" type="object" interface="wl_surface"/> | ||
| </request> | ||
| <!-- version 2 additions--> | ||
| <request name="release" type="destructor" since="2"> | ||
| <description summary="destroy the org_kde_kwin_appmenu_manager object" /> | ||
| </request> | ||
| </interface> | ||
| <interface name="org_kde_kwin_appmenu" version="2"> | ||
| <description summary="appmenu dbus address interface"> | ||
| The DBus service name and object path where the appmenu interface is present | ||
| The object should be registered on the session bus before sending this request. | ||
| If not applicable, clients should remove this object. | ||
| </description> | ||
| <request name="set_address"> | ||
| <description summary="initialise or update the location of the AppMenu interface"> | ||
| Set or update the service name and object path. | ||
| Strings should be formatted in Latin-1 matching the relevant DBus specifications. | ||
| </description> | ||
| <arg name="service_name" type="string" /> | ||
| <arg name="object_path" type="string" /> | ||
| </request> | ||
| <request name="release" type="destructor"> | ||
| <description summary="release the appmenu object"/> | ||
| </request> | ||
| </interface> | ||
| </protocol> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.