shell: Handle set_title and set_class
authorKristian Høgsberg <krh@bitplanet.net>
Wed, 2 May 2012 13:47:44 +0000 (09:47 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Wed, 2 May 2012 13:47:44 +0000 (09:47 -0400)
src/shell.c

index 6b2ccbc..8c35ae8 100644 (file)
@@ -116,6 +116,7 @@ struct shell_surface {
        struct desktop_shell *shell;
 
        enum shell_surface_type type, next_type;
+       char *title, *class;
        int32_t saved_x, saved_y;
        bool saved_position_valid;
        bool saved_rotation_valid;
@@ -476,6 +477,26 @@ shell_surface_pong(struct wl_client *client, struct wl_resource *resource,
        }
 }
 
+static void
+shell_surface_set_title(struct wl_client *client,
+                       struct wl_resource *resource, const char *title)
+{
+       struct shell_surface *shsurf = resource->data;
+
+       free(shsurf->title);
+       shsurf->title = strdup(title);
+}
+
+static void
+shell_surface_set_class(struct wl_client *client,
+                       struct wl_resource *resource, const char *class)
+{
+       struct shell_surface *shsurf = resource->data;
+
+       free(shsurf->class);
+       shsurf->class = strdup(class);
+}
+
 static int
 weston_surface_move(struct weston_surface *es,
                    struct weston_input_device *wd)
@@ -1137,7 +1158,9 @@ static const struct wl_shell_surface_interface shell_surface_implementation = {
        shell_surface_set_transient,
        shell_surface_set_fullscreen,
        shell_surface_set_popup,
-       shell_surface_set_maximized
+       shell_surface_set_maximized,
+       shell_surface_set_title,
+       shell_surface_set_class
 };
 
 static void