mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-24 06:59:45 -05:00
xdg-toplevel: check that title provided actually is UTF-8
While the xdg-shell protocol requires this, it does not yet have a dedicated error code for invalid titles; this commit makes wlroots send a generic error instead.
This commit is contained in:
parent
41494244df
commit
a3d22dbe97
4 changed files with 85 additions and 0 deletions
|
|
@ -5,6 +5,7 @@
|
|||
#include <wlr/util/log.h>
|
||||
#include <wlr/util/edges.h>
|
||||
#include "types/wlr_xdg_shell.h"
|
||||
#include "util/utf8.h"
|
||||
|
||||
void handle_xdg_toplevel_ack_configure(
|
||||
struct wlr_xdg_toplevel *toplevel,
|
||||
|
|
@ -224,6 +225,12 @@ static void xdg_toplevel_handle_set_title(struct wl_client *client,
|
|||
wlr_xdg_toplevel_from_resource(resource);
|
||||
char *tmp;
|
||||
|
||||
if (!is_utf8(title)) {
|
||||
// TODO: update when xdg_toplevel has a dedicated error code for this
|
||||
wl_resource_post_error(resource, (uint32_t)-1, "xdg_toplevel title is not valid UTF-8");
|
||||
return;
|
||||
}
|
||||
|
||||
tmp = strdup(title);
|
||||
if (tmp == NULL) {
|
||||
wl_resource_post_no_memory(resource);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue