swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit db137f8355e2a898788c90efb33ec300a628763a
parent 3cdce41c4757de8a039314a0a4a0eed1b210a153
Author: Michael Forney <mforney@mforney.org>
Date:   Thu, 12 Mar 2015 03:38:21 +0000

Use "app_id" instead of "class" in API

This way, C++ applications can use libswc.

Fixes #20.

Diffstat:
Mlibswc/shell_surface.c | 2+-
Mlibswc/swc.h | 6+++---
Mlibswc/window.c | 14+++++++-------
Mlibswc/window.h | 2+-
Mlibswc/xdg_surface.c | 2+-
5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/libswc/shell_surface.c b/libswc/shell_surface.c @@ -195,7 +195,7 @@ static void set_class(struct wl_client * client, struct wl_resource * resource, { struct shell_surface * shell_surface = wl_resource_get_user_data(resource); - window_set_class(&shell_surface->window, class); + window_set_app_id(&shell_surface->window, class); } static const struct wl_shell_surface_interface shell_surface_implementation = { diff --git a/libswc/swc.h b/libswc/swc.h @@ -108,9 +108,9 @@ struct swc_window_handler void (* title_changed)(void * data); /** - * Called when the window's class changes. + * Called when the window's application identifier changes. */ - void (* class_changed)(void * data); + void (* app_id_changed)(void * data); /** * Called when the window's parent changes. @@ -147,7 +147,7 @@ struct swc_window_handler struct swc_window { char * title; - char * class; + char * app_id; struct swc_window * parent; }; diff --git a/libswc/window.c b/libswc/window.c @@ -389,7 +389,7 @@ bool window_initialize(struct window * window, const struct window_impl * impl, DEBUG("Initializing window, %p\n", window); window->base.title = NULL; - window->base.class = NULL; + window->base.app_id = NULL; window->base.parent = NULL; if (!(window->view = swc_compositor_create_view(surface))) @@ -428,7 +428,7 @@ void window_finalize(struct window * window) window_unmanage(window); compositor_view_destroy(window->view); free(window->base.title); - free(window->base.class); + free(window->base.app_id); } void window_manage(struct window * window) @@ -460,13 +460,13 @@ void window_set_title(struct window * window, const char * title, size_t length) window->handler->title_changed(window->handler_data); } -void window_set_class(struct window * window, const char * class) +void window_set_app_id(struct window * window, const char * app_id) { - free(window->base.class); - window->base.class = strdup(class); + free(window->base.app_id); + window->base.app_id = strdup(app_id); - if (window->handler->class_changed) - window->handler->class_changed(window->handler_data); + if (window->handler->app_id_changed) + window->handler->app_id_changed(window->handler_data); } void window_set_parent(struct window * window, struct window * parent) diff --git a/libswc/window.h b/libswc/window.h @@ -103,7 +103,7 @@ void window_unmanage(struct window * window); void window_set_title(struct window * window, const char * title, size_t length); -void window_set_class(struct window * window, const char * class); +void window_set_app_id(struct window * window, const char * app_id); void window_set_parent(struct window * window, struct window * parent); diff --git a/libswc/xdg_surface.c b/libswc/xdg_surface.c @@ -184,7 +184,7 @@ static void set_app_id(struct wl_client * client, struct wl_resource * resource, { struct xdg_surface * surface = wl_resource_get_user_data(resource); - window_set_class(&surface->window, app_id); + window_set_app_id(&surface->window, app_id); } static void show_window_menu(struct wl_client * client,