140 lines
5.3 KiB
Diff
140 lines
5.3 KiB
Diff
|
Note: This is a reverse patch of the original commit
|
||
|
See bnc#877907 - when starting guest in virt--manager with details
|
||
|
pane open, keyboard is grabbed erroneously
|
||
|
|
||
|
Subject: Add a gsetting key to disable keyboard grabbing
|
||
|
From: Kjö Hansi Glaz kjo@a4nancy.net.eu.org Mon Mar 10 18:07:15 2014 +0100
|
||
|
Date: Mon Mar 10 14:54:58 2014 -0400:
|
||
|
Git: 66d146aceec7d6b4301f1795d8bea25d2d8306b8
|
||
|
|
||
|
Add a gsetting key to disable keyboard grabbing that works the same way
|
||
|
as spicy when unchecking "Options" > "Grab keyboard when active and
|
||
|
focused".
|
||
|
|
||
|
diff --git b/data/org.virt-manager.virt-manager.gschema.xml a/data/org.virt-manager.virt-manager.gschema.xml
|
||
|
index 2fede6c..d755f6e 100644
|
||
|
--- b/data/org.virt-manager.virt-manager.gschema.xml
|
||
|
+++ a/data/org.virt-manager.virt-manager.gschema.xml
|
||
|
@@ -188,13 +188,6 @@
|
||
|
<description>Grab keyboard sequence for the graphical console</description>
|
||
|
</key>
|
||
|
|
||
|
- <!--This key is not intended to be exposed in the UI yet-->
|
||
|
- <key name="grab-keyboard" type="b">
|
||
|
- <default>true</default>
|
||
|
- <summary>Enable grab keyboard when active and focused</summary>
|
||
|
- <description>Enable grab keyboard when active and focused</description>
|
||
|
- </key>
|
||
|
-
|
||
|
<key name="auto-redirect" type="b">
|
||
|
<default>true</default>
|
||
|
<summary>Enable SPICE Auto USB redirection in console window</summary>
|
||
|
diff --git b/virtManager/config.py a/virtManager/config.py
|
||
|
index 5c9c127..dd624e9 100644
|
||
|
--- b/virtManager/config.py
|
||
|
+++ a/virtManager/config.py
|
||
|
@@ -286,14 +286,6 @@ class vmmConfig(object):
|
||
|
def on_keys_combination_changed(self, cb):
|
||
|
return self.conf.notify_add("/console/grab-keys", cb)
|
||
|
|
||
|
- # This key is not intended to be exposed in the UI yet
|
||
|
- def get_grab_keyboard(self):
|
||
|
- return self.conf.get("/console/grab-keyboard")
|
||
|
- def set_grab_keyboard(self, val):
|
||
|
- self.conf.set("/console/grab-keyboard", val)
|
||
|
- def on_grab_keyboard_changed(self, cb):
|
||
|
- return self.conf.notify_add("/console/grab-keyboard", cb)
|
||
|
-
|
||
|
# Confirmation preferences
|
||
|
def get_confirm_forcepoweroff(self):
|
||
|
return self.conf.get("/confirm/forcepoweroff")
|
||
|
diff --git b/virtManager/console.py a/virtManager/console.py
|
||
|
index ee12390..6513645 100644
|
||
|
--- b/virtManager/console.py
|
||
|
+++ a/virtManager/console.py
|
||
|
@@ -360,9 +360,6 @@ class Viewer(vmmGObject):
|
||
|
def send_keys(self, keys):
|
||
|
raise NotImplementedError()
|
||
|
|
||
|
- def set_grab_keyboard(self):
|
||
|
- raise NotImplementedError()
|
||
|
-
|
||
|
def open_host(self, ginfo):
|
||
|
raise NotImplementedError()
|
||
|
|
||
|
@@ -397,7 +394,6 @@ class VNCViewer(Viewer):
|
||
|
|
||
|
def init_widget(self):
|
||
|
self.set_grab_keys()
|
||
|
- self.set_grab_keyboard()
|
||
|
|
||
|
self.display.realize()
|
||
|
|
||
|
@@ -407,6 +403,7 @@ class VNCViewer(Viewer):
|
||
|
self.console.sync_scaling_with_display()
|
||
|
self.console.refresh_resizeguest_from_settings()
|
||
|
|
||
|
+ self.display.set_keyboard_grab(True)
|
||
|
self.display.set_pointer_grab(True)
|
||
|
|
||
|
self.display.connect("size-allocate",
|
||
|
@@ -464,10 +461,6 @@ class VNCViewer(Viewer):
|
||
|
def send_keys(self, keys):
|
||
|
return self.display.send_keys([Gdk.keyval_from_name(k) for k in keys])
|
||
|
|
||
|
- def set_grab_keyboard(self):
|
||
|
- self.display.set_keyboard_grab(self.config.get_grab_keyboard())
|
||
|
- self.display.force_grab(self.config.get_grab_keyboard())
|
||
|
-
|
||
|
def _desktop_resize(self, src_ignore, w, h):
|
||
|
self.desktop_resolution = (w, h)
|
||
|
self.console.widget("console-gfx-scroll").queue_resize()
|
||
|
@@ -578,7 +571,6 @@ class SpiceViewer(Viewer):
|
||
|
|
||
|
def _init_widget(self):
|
||
|
self.set_grab_keys()
|
||
|
- self.set_grab_keyboard()
|
||
|
self.console.sync_scaling_with_display()
|
||
|
self.console.refresh_resizeguest_from_settings()
|
||
|
|
||
|
@@ -625,9 +617,6 @@ class SpiceViewer(Viewer):
|
||
|
return self.display.send_keys([Gdk.keyval_from_name(k) for k in keys],
|
||
|
SpiceClientGtk.DisplayKeyEvent.CLICK)
|
||
|
|
||
|
- def set_grab_keyboard(self):
|
||
|
- self.display.set_property("grab-keyboard", self.config.get_grab_keyboard())
|
||
|
-
|
||
|
def close(self):
|
||
|
if self.spice_session is not None:
|
||
|
self.spice_session.disconnect()
|
||
|
@@ -886,8 +875,6 @@ class vmmConsolePages(vmmGObjectUI):
|
||
|
self.config.on_console_accels_changed(self.set_enable_accel))
|
||
|
self.add_gconf_handle(
|
||
|
self.config.on_keys_combination_changed(self.grab_keys_changed))
|
||
|
- self.add_gconf_handle(
|
||
|
- self.config.on_grab_keyboard_changed(self.grab_keyboard_changed))
|
||
|
|
||
|
self.page_changed()
|
||
|
|
||
|
@@ -1040,9 +1027,6 @@ class vmmConsolePages(vmmGObjectUI):
|
||
|
def pointer_grabbed(self, src_ignore):
|
||
|
self.pointer_is_grabbed = True
|
||
|
self.change_title()
|
||
|
- if not self.config.get_grab_keyboard():
|
||
|
- self.viewer.display.force_grab(False)
|
||
|
- self.viewer.display.set_keyboard_grab(self.config.get_grab_keyboard())
|
||
|
|
||
|
def pointer_ungrabbed(self, src_ignore):
|
||
|
self.pointer_is_grabbed = False
|
||
|
@@ -1083,10 +1067,6 @@ class vmmConsolePages(vmmGObjectUI):
|
||
|
if self.viewer:
|
||
|
self.viewer.set_grab_keys()
|
||
|
|
||
|
- def grab_keyboard_changed(self):
|
||
|
- if self.viewer:
|
||
|
- self.viewer.set_grab_keyboard()
|
||
|
-
|
||
|
def set_enable_accel(self):
|
||
|
# Make sure modifiers are up to date
|
||
|
self.viewer_focus_changed()
|