Addapt to DWL new tag system

- tagscount is being used instead of tag array
pull/2103/head
David Delarosa 2023-04-13 03:58:57 +03:00
parent 60cdf10e64
commit 731eaeb0be
2 changed files with 1 additions and 27 deletions

View File

@ -48,7 +48,7 @@ I would probably just submit raphi's patchset but I don't think that would be po
This event is sent after binding. This event is sent after binding.
A roundtrip after binding guarantees the client recieved all tags. A roundtrip after binding guarantees the client recieved all tags.
</description> </description>
<arg name="name" type="string"/> <arg name="tag" type="int"/>
</event> </event>
<event name="layout"> <event name="layout">

View File

@ -66,37 +66,11 @@ static const zdwl_output_v1_listener output_status_listener_impl {
.frame = dwl_frame, .frame = dwl_frame,
}; };
void add_layout(void* data, zdwl_manager_v1* zdwl_manager_v1, const char* name) {
void* temp = wl_array_add(&layouts, sizeof(char**));
if (!temp)
return;
char* dup = strdup(name);
memcpy(temp, &dup, sizeof(char**));
}
void add_tag(void* data, zdwl_manager_v1* zdwl_manager_v1, const char* name) {
void* temp = wl_array_add(&tags, sizeof(char**));
if (!temp)
return;
char* dup = strdup(name); /* Gain ownership of name */
memcpy(temp, &dup, sizeof(char**)); /* Copy a pointer of it into the array */;
}
static const struct zdwl_manager_v1_listener dwl_listener = {
.tag = add_tag,
.layout = add_layout,
};
static void handle_global(void *data, struct wl_registry *registry, uint32_t name, static void handle_global(void *data, struct wl_registry *registry, uint32_t name,
const char *interface, uint32_t version) { const char *interface, uint32_t version) {
if (std::strcmp(interface, zdwl_manager_v1_interface.name) == 0) { if (std::strcmp(interface, zdwl_manager_v1_interface.name) == 0) {
static_cast<Tags *>(data)->status_manager_ = static_cast<struct zdwl_manager_v1 *>( static_cast<Tags *>(data)->status_manager_ = static_cast<struct zdwl_manager_v1 *>(
(zdwl_manager_v1*)wl_registry_bind(registry, name, &zdwl_manager_v1_interface, 3)); (zdwl_manager_v1*)wl_registry_bind(registry, name, &zdwl_manager_v1_interface, 3));
zdwl_manager_v1_add_listener(static_cast<Tags *>(data)->status_manager_, &dwl_listener, NULL);
} }
if (std::strcmp(interface, wl_seat_interface.name) == 0) { if (std::strcmp(interface, wl_seat_interface.name) == 0) {
version = std::min<uint32_t>(version, 1); version = std::min<uint32_t>(version, 1);