[RFC PATCH 1/2] vbox: Register IKeyboard with the unified API.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The IKeyboard COM object is needed to implement virDomainSendKey and is
available in all supported VBOX versions.
---
 src/vbox/vbox_tmpl.c          | 27 +++++++++++++++++++++++++++
 src/vbox/vbox_uniformed_api.h |  8 ++++++++
 2 files changed, 35 insertions(+)

diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 37ec8e1..22eecd4 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -3437,6 +3437,12 @@ _consoleGetDisplay(IConsole *console, IDisplay **display)
 }
 
 static nsresult
+_consoleGetKeyboard(IConsole *console, IKeyboard **keyboard)
+{
+    return console->vtbl->GetKeyboard(console, keyboard);
+}
+
+static nsresult
 _progressWaitForCompletion(IProgress *progress, PRInt32 timeout)
 {
     return progress->vtbl->WaitForCompletion(progress, timeout);
@@ -4599,6 +4605,20 @@ _hardDiskGetFormat(IHardDisk *hardDisk, PRUnichar **format)
     return hardDisk->vtbl->GetFormat(hardDisk, format);
 }
 
+static nsresult
+_keyboardPutScancode(IKeyboard *keyboard, PRInt32 scancode)
+{
+    return keyboard->vtbl->PutScancode(keyboard, scancode);
+}
+
+static nsresult
+_keyboardPutScancodes(IKeyboard *keyboard, PRUint32 scancodesSize,
+                      PRInt32 *scanCodes, PRUint32 *codesStored)
+{
+    return keyboard->vtbl->PutScancodes(keyboard, scancodesSize, scanCodes,
+                                        codesStored);
+}
+
 static bool _machineStateOnline(PRUint32 state)
 {
     return ((state >= MachineState_FirstOnline) &&
@@ -4757,6 +4777,7 @@ static vboxUniformedIConsole _UIConsole = {
     .TakeSnapshot = _consoleTakeSnapshot,
     .DeleteSnapshot = _consoleDeleteSnapshot,
     .GetDisplay = _consoleGetDisplay,
+    .GetKeyboard = _consoleGetKeyboard,
 };
 
 static vboxUniformedIProgress _UIProgress = {
@@ -4951,6 +4972,11 @@ static vboxUniformedIHardDisk _UIHardDisk = {
     .GetFormat = _hardDiskGetFormat,
 };
 
+static vboxUniformedIKeyboard _UIKeyboard = {
+    .PutScancode = _keyboardPutScancode,
+    .PutScancodes = _keyboardPutScancodes,
+};
+
 static uniformedMachineStateChecker _machineStateChecker = {
     .Online = _machineStateOnline,
     .Inactive = _machineStateInactive,
@@ -5008,6 +5034,7 @@ void NAME(InstallUniformedAPI)(vboxUniformedAPI *pVBoxAPI)
     pVBoxAPI->UIHNInterface = _UIHNInterface;
     pVBoxAPI->UIDHCPServer = _UIDHCPServer;
     pVBoxAPI->UIHardDisk = _UIHardDisk;
+    pVBoxAPI->UIKeyboard = _UIKeyboard;
     pVBoxAPI->machineStateChecker = _machineStateChecker;
 
 #if VBOX_API_VERSION <= 2002000 || VBOX_API_VERSION >= 4000000
diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h
index babc1e6..5d190ce 100644
--- a/src/vbox/vbox_uniformed_api.h
+++ b/src/vbox/vbox_uniformed_api.h
@@ -286,6 +286,7 @@ typedef struct {
                              PRUnichar *description, IProgress **progress);
     nsresult (*DeleteSnapshot)(IConsole *console, vboxIIDUnion *iidu, IProgress **progress);
     nsresult (*GetDisplay)(IConsole *console, IDisplay **display);
+    nsresult (*GetKeyboard)(IConsole *console, IKeyboard **keyboard);
 } vboxUniformedIConsole;
 
 /* Functions for IProgress */
@@ -534,6 +535,12 @@ typedef struct {
 } vboxUniformedIHardDisk;
 
 typedef struct {
+    nsresult (*PutScancode)(IKeyboard *keyboard, PRInt32 scancode);
+    nsresult (*PutScancodes)(IKeyboard *keyboard, PRUint32 scancodesSize,
+                             PRInt32 *scanCodes, PRUint32 *codesStored);
+} vboxUniformedIKeyboard;
+
+typedef struct {
     bool (*Online)(PRUint32 state);
     bool (*Inactive)(PRUint32 state);
     bool (*NotStart)(PRUint32 state);
@@ -591,6 +598,7 @@ typedef struct {
     vboxUniformedIHNInterface UIHNInterface;
     vboxUniformedIDHCPServer UIDHCPServer;
     vboxUniformedIHardDisk UIHardDisk;
+    vboxUniformedIKeyboard UIKeyboard;
     uniformedMachineStateChecker machineStateChecker;
     /* vbox API features */
     bool domainEventCallbacks;
-- 
2.3.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]