From: Ray Strode Date: Mon, 19 May 2008 02:57:15 +0000 (-0400) Subject: pass keyboard input on to plugins X-Git-Tag: 0.1.0~116 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea56f6e68cfc42ca165d1964e4410739b519879b;p=thirdparty%2Fplymouth.git pass keyboard input on to plugins --- diff --git a/src/ply-boot-splash-plugin.h b/src/ply-boot-splash-plugin.h index 789c4781..78fb3c56 100644 --- a/src/ply-boot-splash-plugin.h +++ b/src/ply-boot-splash-plugin.h @@ -46,6 +46,8 @@ typedef struct ply_event_loop_t *loop); char * (* ask_for_password) (ply_boot_splash_plugin_t *plugin); + void (* on_keyboard_input) (ply_boot_splash_plugin_t *plugin, + const char *keyboard_input); } ply_boot_splash_plugin_interface_t; diff --git a/src/ply-boot-splash.c b/src/ply-boot-splash.c index 9cc9ba5d..e17f204d 100644 --- a/src/ply-boot-splash.c +++ b/src/ply-boot-splash.c @@ -143,11 +143,20 @@ ply_boot_splash_unload_plugin (ply_boot_splash_t *splash) splash->module_handle = NULL; } +static void +on_keyboard_input (ply_boot_splash_t *splash, + const char *key) +{ + if (splash->plugin_interface->on_keyboard_input != NULL) + splash->plugin_interface->on_keyboard_input (splash->plugin, key); +} + static bool ply_boot_splash_create_window (ply_boot_splash_t *splash) { splash->window = ply_window_new ("/dev/tty1", - NULL, NULL); + (ply_window_keyboard_input_handler_t) + on_keyboard_input, splash); if (!ply_window_open (splash->window)) { diff --git a/src/splash-plugins/fedora-fade-in/fedora-fade-in.c b/src/splash-plugins/fedora-fade-in/fedora-fade-in.c index 4ca1859e..7d457006 100644 --- a/src/splash-plugins/fedora-fade-in/fedora-fade-in.c +++ b/src/splash-plugins/fedora-fade-in/fedora-fade-in.c @@ -462,6 +462,12 @@ attach_to_event_loop (ply_boot_splash_plugin_t *plugin, plugin); } +void +on_keyboard_input (ply_boot_splash_plugin_t *plugin, + const char *keyboard_input) +{ +} + ply_boot_splash_plugin_interface_t * ply_boot_splash_plugin_get_interface (void) { @@ -472,7 +478,8 @@ ply_boot_splash_plugin_get_interface (void) .show_splash_screen = show_splash_screen, .update_status = update_status, .hide_splash_screen = hide_splash_screen, - .attach_to_event_loop = attach_to_event_loop + .attach_to_event_loop = attach_to_event_loop, + .on_keyboard_input = on_keyboard_input }; return &plugin_interface; diff --git a/src/splash-plugins/text/text.c b/src/splash-plugins/text/text.c index c934c1b6..ad00bfa5 100644 --- a/src/splash-plugins/text/text.c +++ b/src/splash-plugins/text/text.c @@ -180,6 +180,12 @@ ask_for_password (ply_boot_splash_plugin_t *plugin) return strdup (answer); } +void +on_keyboard_input (ply_boot_splash_plugin_t *plugin, + const char *keyboard_input) +{ +} + ply_boot_splash_plugin_interface_t * ply_boot_splash_plugin_get_interface (void) { @@ -192,6 +198,7 @@ ply_boot_splash_plugin_get_interface (void) .hide_splash_screen = hide_splash_screen, .attach_to_event_loop = attach_to_event_loop, .ask_for_password = ask_for_password, + .on_keyboard_input = on_keyboard_input }; return &plugin_interface;