From b082f42494e8423f08f40addc833d7e9b0192cb6 Mon Sep 17 00:00:00 2001
From: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
Date: Tue, 4 Dec 2018 14:31:13 -0500
Subject: [PATCH 088/142] keyboard: add helper to get the keyboard's renderer,
 if applicable

Based on an original patch from Gert van de Kraats on Ubuntu's Launchpad:
https://bugs.launchpad.net/ubuntu/+source/plymouth/+bug/1794292

Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
---
 src/libply-splash-core/ply-keyboard.c | 16 ++++++++++++++++
 src/libply-splash-core/ply-keyboard.h |  1 +
 2 files changed, 17 insertions(+)

diff --git a/src/libply-splash-core/ply-keyboard.c b/src/libply-splash-core/ply-keyboard.c
index 80f7694..e11c093 100644
--- a/src/libply-splash-core/ply-keyboard.c
+++ b/src/libply-splash-core/ply-keyboard.c
@@ -587,4 +587,20 @@ ply_keyboard_remove_enter_handler (ply_keyboard_t              *keyboard,
         }
 }
 
+ply_renderer_t *
+ply_keyboard_get_renderer (ply_keyboard_t *keyboard)
+{
+        assert (keyboard != NULL);
+
+        switch (keyboard->provider_type) {
+        case PLY_KEYBOARD_PROVIDER_TYPE_RENDERER:
+                return keyboard->provider.if_renderer->renderer;
+
+        default:
+                break;
+        }
+
+        return NULL;
+}
+
 /* vim: set ts=4 sw=4 et ai ci cino={.5s,^-2,+.5s,t0,g0,e-2,n-2,p2s,(0,=.5s,:.5s */
diff --git a/src/libply-splash-core/ply-keyboard.h b/src/libply-splash-core/ply-keyboard.h
index 6147cc7..dd428c0 100644
--- a/src/libply-splash-core/ply-keyboard.h
+++ b/src/libply-splash-core/ply-keyboard.h
@@ -72,6 +72,7 @@ void ply_keyboard_remove_enter_handler (ply_keyboard_t              *keyboard,
 bool ply_keyboard_watch_for_input (ply_keyboard_t *keyboard);
 void ply_keyboard_stop_watching_for_input (ply_keyboard_t *keyboard);
 bool ply_keyboard_is_active (ply_keyboard_t *keyboard);
+ply_renderer_t *ply_keyboard_get_renderer (ply_keyboard_t *keyboard);
 
 #endif
 
-- 
2.7.4

