commit db137f8

Michael Forney  ·  2015-03-12 03:38:21 +0000 UTC
parent 3cdce41
Use "app_id" instead of "class" in API

This way, C++ applications can use libswc.

Fixes #20.
5 files changed,  +13, -13
+1, -1
1@@ -195,7 +195,7 @@ static void set_class(struct wl_client * client, struct wl_resource * resource,
2 {
3     struct shell_surface * shell_surface = wl_resource_get_user_data(resource);
4 
5-    window_set_class(&shell_surface->window, class);
6+    window_set_app_id(&shell_surface->window, class);
7 }
8 
9 static const struct wl_shell_surface_interface shell_surface_implementation = {
+3, -3
 1@@ -108,9 +108,9 @@ struct swc_window_handler
 2     void (* title_changed)(void * data);
 3 
 4     /**
 5-     * Called when the window's class changes.
 6+     * Called when the window's application identifier changes.
 7      */
 8-    void (* class_changed)(void * data);
 9+    void (* app_id_changed)(void * data);
10 
11     /**
12      * Called when the window's parent changes.
13@@ -147,7 +147,7 @@ struct swc_window_handler
14 struct swc_window
15 {
16     char * title;
17-    char * class;
18+    char * app_id;
19 
20     struct swc_window * parent;
21 };
+7, -7
 1@@ -389,7 +389,7 @@ bool window_initialize(struct window * window, const struct window_impl * impl,
 2     DEBUG("Initializing window, %p\n", window);
 3 
 4     window->base.title = NULL;
 5-    window->base.class = NULL;
 6+    window->base.app_id = NULL;
 7     window->base.parent = NULL;
 8 
 9     if (!(window->view = swc_compositor_create_view(surface)))
10@@ -428,7 +428,7 @@ void window_finalize(struct window * window)
11     window_unmanage(window);
12     compositor_view_destroy(window->view);
13     free(window->base.title);
14-    free(window->base.class);
15+    free(window->base.app_id);
16 }
17 
18 void window_manage(struct window * window)
19@@ -460,13 +460,13 @@ void window_set_title(struct window * window, const char * title, size_t length)
20         window->handler->title_changed(window->handler_data);
21 }
22 
23-void window_set_class(struct window * window, const char * class)
24+void window_set_app_id(struct window * window, const char * app_id)
25 {
26-    free(window->base.class);
27-    window->base.class = strdup(class);
28+    free(window->base.app_id);
29+    window->base.app_id = strdup(app_id);
30 
31-    if (window->handler->class_changed)
32-        window->handler->class_changed(window->handler_data);
33+    if (window->handler->app_id_changed)
34+        window->handler->app_id_changed(window->handler_data);
35 }
36 
37 void window_set_parent(struct window * window, struct window * parent)
+1, -1
1@@ -103,7 +103,7 @@ void window_unmanage(struct window * window);
2 void window_set_title(struct window * window,
3                       const char * title, size_t length);
4 
5-void window_set_class(struct window * window, const char * class);
6+void window_set_app_id(struct window * window, const char * app_id);
7 
8 void window_set_parent(struct window * window, struct window * parent);
9 
+1, -1
1@@ -184,7 +184,7 @@ static void set_app_id(struct wl_client * client, struct wl_resource * resource,
2 {
3     struct xdg_surface * surface = wl_resource_get_user_data(resource);
4 
5-    window_set_class(&surface->window, app_id);
6+    window_set_app_id(&surface->window, app_id);
7 }
8 
9 static void show_window_menu(struct wl_client * client,