Skip to content

Commit

Permalink
core: add explicit casts to wl_proxy* for clang
Browse files Browse the repository at this point in the history
fixes #261
  • Loading branch information
vaxerski committed Sep 20, 2024
1 parent 73b8c4f commit ac1b8c3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
19 changes: 9 additions & 10 deletions src/core/PortalManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,24 @@ void CPortalManager::onGlobal(uint32_t name, const char* interface, uint32_t ver
Debug::log(LOG, " | Got interface: {} (ver {})", INTERFACE, version);

if (INTERFACE == zwlr_screencopy_manager_v1_interface.name && m_sPipewire.loop) {
m_sPortals.screencopy = std::make_unique<CScreencopyPortal>(
makeShared<CCZwlrScreencopyManagerV1>(wl_registry_bind((wl_registry*)m_sWaylandConnection.registry->resource(), name, &zwlr_screencopy_manager_v1_interface, version)));
m_sPortals.screencopy = std::make_unique<CScreencopyPortal>(makeShared<CCZwlrScreencopyManagerV1>(
(wl_proxy*)wl_registry_bind((wl_registry*)m_sWaylandConnection.registry->resource(), name, &zwlr_screencopy_manager_v1_interface, version)));
}

if (INTERFACE == hyprland_global_shortcuts_manager_v1_interface.name) {
m_sPortals.globalShortcuts = std::make_unique<CGlobalShortcutsPortal>(makeShared<CCHyprlandGlobalShortcutsManagerV1>(
wl_registry_bind((wl_registry*)m_sWaylandConnection.registry->resource(), name, &hyprland_global_shortcuts_manager_v1_interface, version)));
(wl_proxy*)wl_registry_bind((wl_registry*)m_sWaylandConnection.registry->resource(), name, &hyprland_global_shortcuts_manager_v1_interface, version)));
}

else if (INTERFACE == hyprland_toplevel_export_manager_v1_interface.name) {
m_sWaylandConnection.hyprlandToplevelMgr = makeShared<CCHyprlandToplevelExportManagerV1>(
wl_registry_bind((wl_registry*)m_sWaylandConnection.registry->resource(), name, &hyprland_toplevel_export_manager_v1_interface, version));
(wl_proxy*)wl_registry_bind((wl_registry*)m_sWaylandConnection.registry->resource(), name, &hyprland_toplevel_export_manager_v1_interface, version));
}

else if (INTERFACE == wl_output_interface.name) {
const auto POUTPUT = m_vOutputs
.emplace_back(std::make_unique<SOutput>(
makeShared<CCWlOutput>(wl_registry_bind((wl_registry*)m_sWaylandConnection.registry->resource(), name, &wl_output_interface, version))))
.emplace_back(std::make_unique<SOutput>(makeShared<CCWlOutput>(
(wl_proxy*)wl_registry_bind((wl_registry*)m_sWaylandConnection.registry->resource(), name, &wl_output_interface, version))))
.get();
POUTPUT->id = name;
}
Expand All @@ -82,7 +82,7 @@ void CPortalManager::onGlobal(uint32_t name, const char* interface, uint32_t ver
}

m_sWaylandConnection.linuxDmabuf =
makeShared<CCZwpLinuxDmabufV1>(wl_registry_bind((wl_registry*)m_sWaylandConnection.registry->resource(), name, &zwp_linux_dmabuf_v1_interface, version));
makeShared<CCZwpLinuxDmabufV1>((wl_proxy*)wl_registry_bind((wl_registry*)m_sWaylandConnection.registry->resource(), name, &zwp_linux_dmabuf_v1_interface, version));
m_sWaylandConnection.linuxDmabufFeedback = makeShared<CCZwpLinuxDmabufFeedbackV1>(m_sWaylandConnection.linuxDmabuf->sendGetDefaultFeedback());

m_sWaylandConnection.linuxDmabufFeedback->setMainDevice([this](CCZwpLinuxDmabufFeedbackV1* r, wl_array* device_arr) {
Expand Down Expand Up @@ -180,9 +180,8 @@ void CPortalManager::onGlobal(uint32_t name, const char* interface, uint32_t ver

}

else if (INTERFACE == wl_shm_interface.name) {
m_sWaylandConnection.shm = makeShared<CCWlShm>(wl_registry_bind((wl_registry*)m_sWaylandConnection.registry->resource(), name, &wl_shm_interface, version));
}
else if (INTERFACE == wl_shm_interface.name)
m_sWaylandConnection.shm = makeShared<CCWlShm>((wl_proxy*)wl_registry_bind((wl_registry*)m_sWaylandConnection.registry->resource(), name, &wl_shm_interface, version));

else if (INTERFACE == zwlr_foreign_toplevel_manager_v1_interface.name) {
m_sHelpers.toplevel = std::make_unique<CToplevelManager>(name, version);
Expand Down
5 changes: 3 additions & 2 deletions src/shared/ToplevelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ void CToplevelManager::activate() {
if (m_pManager || m_iActivateLocks < 1)
return;

m_pManager = makeShared<CCZwlrForeignToplevelManagerV1>(wl_registry_bind((wl_registry*)g_pPortalManager->m_sWaylandConnection.registry->resource(), m_sWaylandConnection.name,
&zwlr_foreign_toplevel_manager_v1_interface, m_sWaylandConnection.version));
m_pManager =
makeShared<CCZwlrForeignToplevelManagerV1>((wl_proxy*)wl_registry_bind((wl_registry*)g_pPortalManager->m_sWaylandConnection.registry->resource(), m_sWaylandConnection.name,
&zwlr_foreign_toplevel_manager_v1_interface, m_sWaylandConnection.version));

m_pManager->setToplevel([this](CCZwlrForeignToplevelManagerV1* r, wl_proxy* newHandle) {
Debug::log(TRACE, "[toplevel] New toplevel at {}", (void*)newHandle);
Expand Down

0 comments on commit ac1b8c3

Please sign in to comment.