summaryrefslogtreecommitdiffstats
path: root/src/splash-plugins/spinfinity/plugin.c
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2008-05-29 00:02:22 -0400
committerRay Strode <rstrode@redhat.com>2008-05-29 00:02:22 -0400
commitdd3e2229d73f1f264cb07aab4765196307ac9e97 (patch)
tree18d039aeef54648af0b149d2152a8d437f4214e4 /src/splash-plugins/spinfinity/plugin.c
parentd76fcfed45401305fbb728d5bdd708df4364b313 (diff)
downloadplymouth-dd3e2229d73f1f264cb07aab4765196307ac9e97.tar.gz
plymouth-dd3e2229d73f1f264cb07aab4765196307ac9e97.tar.xz
plymouth-dd3e2229d73f1f264cb07aab4765196307ac9e97.zip
Drop line editing plugin vtable functions. Use window directly.
There was a sort useless layer of indirection between the window object and splash plugins. It ended up with functions like: void on_backspace (ply_splash_plugin_t *plugin) { plugin->interface->on_backspace (plugin); } Since the individual plugins are aware of the window object anyway, they can register their own on_backspace et al handlers without going through the ply_splash_plugin_t layer.
Diffstat (limited to 'src/splash-plugins/spinfinity/plugin.c')
-rw-r--r--src/splash-plugins/spinfinity/plugin.c95
1 files changed, 53 insertions, 42 deletions
diff --git a/src/splash-plugins/spinfinity/plugin.c b/src/splash-plugins/spinfinity/plugin.c
index f1e9c11..62701b3 100644
--- a/src/splash-plugins/spinfinity/plugin.c
+++ b/src/splash-plugins/spinfinity/plugin.c
@@ -241,6 +241,45 @@ detach_from_event_loop (ply_boot_splash_plugin_t *plugin)
ply_window_set_mode (plugin->window, PLY_WINDOW_MODE_TEXT);
}
+void
+on_keyboard_input (ply_boot_splash_plugin_t *plugin,
+ const char *keyboard_input,
+ size_t character_size)
+{
+ if (plugin->password_answer_handler == NULL)
+ return;
+
+ plugin->entry->number_of_bullets++;
+ draw_password_entry (plugin);
+}
+
+void
+on_backspace (ply_boot_splash_plugin_t *plugin)
+{
+ plugin->entry->number_of_bullets--;
+ draw_password_entry (plugin);
+}
+
+void
+on_enter (ply_boot_splash_plugin_t *plugin,
+ const char *text)
+{
+ if (plugin->password_answer_handler == NULL)
+ return;
+
+ plugin->password_answer_handler (plugin->password_answer_data,
+ text);
+
+ if (plugin->entry != NULL)
+ {
+ plugin->entry->number_of_bullets = 0;
+ entry_free (plugin->entry);
+ plugin->entry = NULL;
+ }
+
+ start_animation (plugin);
+}
+
bool
show_splash_screen (ply_boot_splash_plugin_t *plugin,
ply_event_loop_t *loop,
@@ -251,6 +290,16 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin,
assert (plugin->logo_image != NULL);
assert (plugin->frame_buffer != NULL);
+ ply_window_set_keyboard_input_handler (window,
+ (ply_window_keyboard_input_handler_t)
+ on_keyboard_input, plugin);
+ ply_window_set_backspace_handler (window,
+ (ply_window_backspace_handler_t)
+ on_backspace, plugin);
+ ply_window_set_enter_handler (window,
+ (ply_window_enter_handler_t)
+ on_enter, plugin);
+
plugin->loop = loop;
ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
detach_from_event_loop,
@@ -315,6 +364,10 @@ hide_splash_screen (ply_boot_splash_plugin_t *plugin,
{
assert (plugin != NULL);
+ ply_window_set_keyboard_input_handler (window, NULL, NULL);
+ ply_window_set_backspace_handler (window, NULL, NULL);
+ ply_window_set_enter_handler (window, NULL, NULL);
+
if (plugin->loop != NULL)
{
stop_animation (plugin);
@@ -418,45 +471,6 @@ ask_for_password (ply_boot_splash_plugin_t *plugin,
show_password_entry (plugin);
}
-void
-on_keyboard_input (ply_boot_splash_plugin_t *plugin,
- const char *keyboard_input,
- size_t character_size)
-{
- if (plugin->password_answer_handler == NULL)
- return;
-
- plugin->entry->number_of_bullets++;
- draw_password_entry (plugin);
-}
-
-void
-on_backspace (ply_boot_splash_plugin_t *plugin)
-{
- plugin->entry->number_of_bullets--;
- draw_password_entry (plugin);
-}
-
-void
-on_enter (ply_boot_splash_plugin_t *plugin,
- const char *text)
-{
- if (plugin->password_answer_handler == NULL)
- return;
-
- plugin->password_answer_handler (plugin->password_answer_data,
- text);
-
- if (plugin->entry != NULL)
- {
- plugin->entry->number_of_bullets = 0;
- entry_free (plugin->entry);
- plugin->entry = NULL;
- }
-
- start_animation (plugin);
-}
-
ply_boot_splash_plugin_interface_t *
ply_boot_splash_plugin_get_interface (void)
{
@@ -468,9 +482,6 @@ ply_boot_splash_plugin_get_interface (void)
.update_status = update_status,
.hide_splash_screen = hide_splash_screen,
.ask_for_password = ask_for_password,
- .on_keyboard_input = on_keyboard_input,
- .on_backspace = on_backspace,
- .on_enter = on_enter
};
return &plugin_interface;