From 5196374218519f54561198e704c79dc21b398e1f Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Fri, 10 Aug 2012 16:47:20 +0200 Subject: [PATCH] text: Rename text_model_manager to factory The text_model_manager interface is just used to create text_model instances. It is more a factory than a manager so rename it to text_model_factory. --- clients/editor.c | 12 +++++++----- protocol/text.xml | 2 +- src/text-backend.c | 22 +++++++++++----------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/clients/editor.c b/clients/editor.c index 392edda4..8f0e9d88 100644 --- a/clients/editor.c +++ b/clients/editor.c @@ -40,7 +40,7 @@ struct text_entry { }; struct editor { - struct text_model_manager *text_model_manager; + struct text_model_factory *text_model_factory; struct display *display; struct window *window; struct widget *widget; @@ -130,7 +130,7 @@ text_entry_create(struct editor *editor, const char *text) entry->widget = editor->widget; entry->text = strdup(text); entry->active = 0; - entry->model = text_model_manager_create_text_model(editor->text_model_manager, surface); + entry->model = text_model_factory_create_text_model(editor->text_model_factory, surface); text_model_add_listener(entry->model, &text_model_listener, entry); return entry; @@ -311,9 +311,11 @@ global_handler(struct wl_display *display, uint32_t id, { struct editor *editor = data; - if (!strcmp(interface, "text_model_manager")) { - editor->text_model_manager = wl_display_bind(display, id, - &text_model_manager_interface); + if (!strcmp(interface, "text_model_factory")) { + editor->text_model_factory = wl_display_bind(display, id, + &text_model_factory_interface); + } else if (!strcmp(interface, "wl_seat")) { + fprintf(stderr, "wl_seat added\n"); } } diff --git a/protocol/text.xml b/protocol/text.xml index a14277a5..54866e15 100644 --- a/protocol/text.xml +++ b/protocol/text.xml @@ -36,7 +36,7 @@ - + diff --git a/src/text-backend.c b/src/text-backend.c index 353a9830..bed3f777 100644 --- a/src/text-backend.c +++ b/src/text-backend.c @@ -38,7 +38,7 @@ struct text_model { struct input_method { struct wl_resource *input_method_binding; struct wl_global *input_method_global; - struct wl_global *text_model_manager_global; + struct wl_global *text_model_factory_global; struct wl_listener destroy_listener; struct weston_compositor *ec; @@ -145,7 +145,7 @@ struct text_model_interface text_model_implementation = { text_model_set_content_type }; -static void text_model_manager_create_text_model(struct wl_client *client, +static void text_model_factory_create_text_model(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface) @@ -170,12 +170,12 @@ static void text_model_manager_create_text_model(struct wl_client *client, wl_list_insert(&input_method->models, &text_model->link); }; -static const struct text_model_manager_interface text_model_manager_implementation = { - text_model_manager_create_text_model +static const struct text_model_factory_interface text_model_factory_implementation = { + text_model_factory_create_text_model }; static void -bind_text_model_manager(struct wl_client *client, +bind_text_model_factory(struct wl_client *client, void *data, uint32_t version, uint32_t id) @@ -184,8 +184,8 @@ bind_text_model_manager(struct wl_client *client, /* No checking for duplicate binding necessary. * No events have to be sent, so we don't need the return value. */ - wl_client_add_object(client, &text_model_manager_interface, - &text_model_manager_implementation, + wl_client_add_object(client, &text_model_factory_interface, + &text_model_factory_implementation, id, input_method); } @@ -248,7 +248,7 @@ input_method_notifier_destroy(struct wl_listener *listener, void *data) wl_display_remove_global(input_method->ec->wl_display, input_method->input_method_global); wl_display_remove_global(input_method->ec->wl_display, - input_method->text_model_manager_global); + input_method->text_model_factory_global); free(input_method); } @@ -269,10 +269,10 @@ input_method_create(struct weston_compositor *ec) &input_method_interface, input_method, bind_input_method); - input_method->text_model_manager_global = + input_method->text_model_factory_global = wl_display_add_global(ec->wl_display, - &text_model_manager_interface, - input_method, bind_text_model_manager); + &text_model_factory_interface, + input_method, bind_text_model_factory); input_method->destroy_listener.notify = input_method_notifier_destroy; wl_signal_add(&ec->destroy_signal, &input_method->destroy_listener);