mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
view: store title/app_id in view
This simplifies our codes and eliminates duplicated
`view.events.new_{title,app_id}` events. This should not change any
behaviors.
This commit is contained in:
parent
27cc738985
commit
babd7af8f8
13 changed files with 87 additions and 155 deletions
|
|
@ -94,13 +94,8 @@ handle_new_app_id(struct wl_listener *listener, void *data)
|
|||
wl_container_of(listener, wlr_toplevel, on_view.new_app_id);
|
||||
assert(wlr_toplevel->handle);
|
||||
|
||||
const char *app_id = view_get_string_prop(wlr_toplevel->view, "app_id");
|
||||
const char *wlr_app_id = wlr_toplevel->handle->app_id;
|
||||
if (app_id && wlr_app_id && !strcmp(app_id, wlr_app_id)) {
|
||||
/* Don't send app_id if they are the same */
|
||||
return;
|
||||
}
|
||||
wlr_foreign_toplevel_handle_v1_set_app_id(wlr_toplevel->handle, app_id);
|
||||
wlr_foreign_toplevel_handle_v1_set_app_id(wlr_toplevel->handle,
|
||||
wlr_toplevel->view->app_id);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -110,13 +105,8 @@ handle_new_title(struct wl_listener *listener, void *data)
|
|||
wl_container_of(listener, wlr_toplevel, on_view.new_title);
|
||||
assert(wlr_toplevel->handle);
|
||||
|
||||
const char *title = view_get_string_prop(wlr_toplevel->view, "title");
|
||||
const char *wlr_title = wlr_toplevel->handle->title;
|
||||
if (title && wlr_title && !strcmp(title, wlr_title)) {
|
||||
/* Don't send title if they are the same */
|
||||
return;
|
||||
}
|
||||
wlr_foreign_toplevel_handle_v1_set_title(wlr_toplevel->handle, title);
|
||||
wlr_foreign_toplevel_handle_v1_set_title(wlr_toplevel->handle,
|
||||
wlr_toplevel->view->title);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -202,7 +192,7 @@ wlr_foreign_toplevel_init(struct wlr_foreign_toplevel *wlr_toplevel,
|
|||
view->server->foreign_toplevel_manager);
|
||||
if (!wlr_toplevel->handle) {
|
||||
wlr_log(WLR_ERROR, "cannot create wlr foreign toplevel handle for (%s)",
|
||||
view_get_string_prop(view, "title"));
|
||||
view->title);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue