Skip to content

Commit

Permalink
wayfire-shell: Bump version for new toggle_menu event
Browse files Browse the repository at this point in the history
  • Loading branch information
soreau committed Jan 16, 2024
1 parent d3308e6 commit d6e778f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
19 changes: 14 additions & 5 deletions plugins/protocols/wayfire-shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ struct wayfire_shell_toggle_menu_signal
class wfs_output
{
uint32_t num_inhibits = 0;
wl_resource *shell_resource;
wl_resource *resource;
wf::output_t *output;

Expand Down Expand Up @@ -237,15 +238,23 @@ class wfs_output

wf::signal::connection_t<wayfire_shell_toggle_menu_signal> on_toggle_menu = [=] (auto)
{
if (wl_resource_get_version(shell_resource) < ZWF_OUTPUT_V2_TOGGLE_MENU_SINCE_VERSION)
{
return;
}

zwf_output_v2_send_toggle_menu(resource);
};

public:
wfs_output(wf::output_t *output, wl_client *client, int id)
wfs_output(wf::output_t *output, wl_resource *shell_resource, wl_client *client, int id)
{
this->output = output;
this->shell_resource = shell_resource;

resource = wl_resource_create(client, &zwf_output_v2_interface, 1, id);
resource =
wl_resource_create(client, &zwf_output_v2_interface,
std::min(wl_resource_get_version(shell_resource), 2), id);
wl_resource_set_implementation(resource, &zwf_output_impl, this, handle_output_destroy);
output->connect(&on_fullscreen_layer_focused);
output->connect(&on_toggle_menu);
Expand Down Expand Up @@ -398,7 +407,7 @@ static void zwf_shell_manager_get_wf_output(wl_client *client,
if (wo)
{
// will be deleted when the resource is destroyed
new wfs_output(wo, client, id);
new wfs_output(wo, resource, client, id);
}
}

Expand All @@ -423,7 +432,7 @@ void bind_zwf_shell_manager(wl_client *client, void *data,
uint32_t version, uint32_t id)
{
auto resource =
wl_resource_create(client, &zwf_shell_manager_v2_interface, 1, id);
wl_resource_create(client, &zwf_shell_manager_v2_interface, version, id);
wl_resource_set_implementation(resource,
&zwf_shell_manager_v2_impl, NULL, NULL);
}
Expand All @@ -438,7 +447,7 @@ wayfire_shell *wayfire_shell_create(wl_display *display)
wayfire_shell *ws = new wayfire_shell;

ws->shell_manager = wl_global_create(display,
&zwf_shell_manager_v2_interface, 1, NULL, bind_zwf_shell_manager);
&zwf_shell_manager_v2_interface, 2, NULL, bind_zwf_shell_manager);

if (ws->shell_manager == NULL)
{
Expand Down
9 changes: 5 additions & 4 deletions proto/wayfire-shell-unstable-v2.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="wayfire_shell_unstable_v2">
<interface name="zwf_shell_manager_v2" version="1">
<interface name="zwf_shell_manager_v2" version="2">
<description summary="DE integration">
This protocol provides additional events and requests for special DE
clients like panels, docks, etc.
Expand All @@ -21,7 +21,7 @@
</request>
</interface>

<interface name="zwf_output_v2" version="1">
<interface name="zwf_output_v2" version="2">
<description summary="A wrapper for wl_output">
Represents a single output.
Each output is managed independently from the others.
Expand Down Expand Up @@ -88,9 +88,10 @@
<arg name="id" type="new_id" interface="zwf_hotspot_v2"/>
</request>

<event name="toggle_menu">
<!-- Version 2 additions -->
<event name="toggle_menu" since="2">
<description summary="Toggle menu event">
Tells the menu to open.
Tells the menu to toggle open or close.

Emitted using an activator binding.
</description>
Expand Down

0 comments on commit d6e778f

Please sign in to comment.