Skip to content

Commit

Permalink
Use const char again for foreign toplevel functions
Browse files Browse the repository at this point in the history
  • Loading branch information
serebit committed Nov 26, 2023
1 parent 312b4f6 commit 8bbd05c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
12 changes: 6 additions & 6 deletions src/foreign_toplevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ ForeignToplevelHandle::~ForeignToplevelHandle() noexcept {
wl_list_remove(&listeners.set_rectangle.link);
}

void ForeignToplevelHandle::set_title(const std::string& title) const {
if (!title.empty()) {
wlr_foreign_toplevel_handle_v1_set_title(&handle, title.c_str());
void ForeignToplevelHandle::set_title(const char* title) const {
if (title != nullptr) {
wlr_foreign_toplevel_handle_v1_set_title(&handle, title);
}
}

void ForeignToplevelHandle::set_app_id(const std::string& app_id) const {
if (!app_id.empty()) {
wlr_foreign_toplevel_handle_v1_set_app_id(&handle, app_id.c_str());
void ForeignToplevelHandle::set_app_id(const char* app_id) const {
if (app_id != nullptr) {
wlr_foreign_toplevel_handle_v1_set_app_id(&handle, app_id);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/foreign_toplevel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class ForeignToplevelHandle {
explicit ForeignToplevelHandle(View& view) noexcept;
~ForeignToplevelHandle() noexcept;

void set_title(const std::string& title) const;
void set_app_id(const std::string& app_id) const;
void set_title(const char* title) const;
void set_app_id(const char* app_id) const;
void set_parent(std::optional<std::reference_wrapper<const ForeignToplevelHandle>> parent) const;
void set_placement(ViewPlacement placement) const;
void set_maximized(bool maximized) const;
Expand Down
8 changes: 2 additions & 6 deletions src/surface/xwayland_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,8 @@ void XWaylandView::map() {
xwayland_surface.surface->data = this;

toplevel_handle.emplace(*this);
if (xwayland_surface.title != nullptr) {
toplevel_handle->set_title(xwayland_surface.title);
}
if (xwayland_surface._class != nullptr) {
toplevel_handle->set_app_id(xwayland_surface._class);
}
toplevel_handle->set_title(xwayland_surface.title);
toplevel_handle->set_app_id(xwayland_surface._class);

wlr_scene_tree* scene_tree = wlr_scene_subsurface_tree_create(&server.scene->tree, xwayland_surface.surface);
scene_node = &scene_tree->node;
Expand Down

0 comments on commit 8bbd05c

Please sign in to comment.