void
set_shsurf_to_surface(pepper_surface_t *surface, shell_surface_t *shsurf);
+pepper_bool_t
+shell_surface_set_title(shell_surface_t *shsurf, const char* title);
+
+pepper_bool_t
+shell_surface_set_class(shell_surface_t *shsurf, const char* class_);
+
void
shell_surface_set_toplevel(shell_surface_t *shsurf);
wl_list_insert(&parent_shsurf->child_list, &shsurf->parent_link);
}
}
+
+pepper_bool_t
+shell_surface_set_title(shell_surface_t *shsurf, const char* title)
+{
+ if (shsurf->title)
+ free(shsurf->title);
+
+ shsurf->title = strdup(title);
+
+ if (!shsurf->title)
+ return PEPPER_FALSE;
+
+ return PEPPER_TRUE;
+}
+
+pepper_bool_t
+shell_surface_set_class(shell_surface_t *shsurf, const char* class_)
+{
+ if (shsurf->class_)
+ free(shsurf->class_);
+
+ shsurf->class_ = strdup(class_);
+
+ if (!shsurf->class_)
+ return PEPPER_FALSE;
+
+ return PEPPER_TRUE;
+}
{
shell_surface_t *shsurf = wl_resource_get_user_data(resource);
- if (shsurf->title)
- free(shsurf->title);
-
- shsurf->title = strdup(title);
-
- if (!shsurf->title)
- wl_client_post_no_memory(client);
+ shell_surface_set_title(shsurf, title);
}
static void
{
shell_surface_t *shsurf = wl_resource_get_user_data(resource);
- if (shsurf->class_)
- free(shsurf->class_);
-
- shsurf->class_ = strdup(class_);
-
- if (!shsurf->class_)
- wl_client_post_no_memory(client);
+ shell_surface_set_class(shsurf, class_);
}
static const struct wl_shell_surface_interface shell_surface_implementation =
struct wl_resource *resource,
const char *app_id)
{
- /* TODO: */
+ shell_surface_t *shsurf = wl_resource_get_user_data(resource);
+
+ shell_surface_set_class(shsurf, app_id);
}
static void
struct wl_resource *resource,
const char *title)
{
- /* TODO: */
+ shell_surface_t *shsurf = wl_resource_get_user_data(resource);
+
+ shell_surface_set_title(shsurf, title);
}
static void