[PATCH] Enable to send the mnemonic of the menu to the guest OS

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

 



We cannot send "Alt+M" and "Alt+V" and "Alt+H" to the guest OS because the
mnemonic of the menu of the graphical console is enabled.
So, I change the graphical console to be able to send these keys to the
guest OS.
This change is that the mnemonic of the menu is disabled when the graphical
console grabs the keyboard.

Moreover, the patch includes the bugfix of the following bugs.
1) Two times of _disable_modifiers() is called consecutively.
   In that case, the value of self.gtk_settings_accel is always "None", and the
   setting of the accelerator is not restored.
2) Because the information that self.accel_groups has is not updated in the
   latest state, the assertion occurs when the topwin.remove_accel_group()
   is called.

Thanks,
Signed-off-by: Hiroyuki Kaguchi <fj7025cf@xxxxxxxxxxxxxxxxx>
diff -r 31978f51485e src/virtManager/details.py
--- a/src/virtManager/details.py	Wed May 21 13:34:02 2008 -0400
+++ b/src/virtManager/details.py	Mon May 26 10:26:37 2008 +0900
@@ -164,8 +164,13 @@ class vmmDetails(gobject.GObject):
         self.window.get_widget("graph-table").attach(self.network_traffic_graph, 1, 2, 3, 4)
 
 
-        self.accel_groups = gtk.accel_groups_from_object(topwin)
+        self.accel_groups = []
         self.gtk_settings_accel = None
+
+        self.menubar3_origin_labels = {}
+        for menuitem in self.window.get_widget("menubar3").get_children():
+            label = menuitem.get_children()[0]
+            self.menubar3_origin_labels[label] = label.get_label()
 
         self.vncViewer = gtkvnc.Display()
         self.window.get_widget("console-vnc-viewport").add(self.vncViewer)
@@ -314,21 +319,26 @@ class vmmDetails(gobject.GObject):
 
     def _disable_modifiers(self, ignore=None):
         topwin = self.window.get_widget("vmm-details")
+        self.accel_groups = gtk.accel_groups_from_object(topwin)
         for g in self.accel_groups:
             topwin.remove_accel_group(g)
-        settings = gtk.settings_get_default()
-        self.gtk_settings_accel = settings.get_property('gtk-menu-bar-accel')
-        settings.set_property('gtk-menu-bar-accel', None)
+        if self.gtk_settings_accel is None:
+            settings = gtk.settings_get_default()
+            self.gtk_settings_accel = settings.get_property('gtk-menu-bar-accel')
+            settings.set_property('gtk-menu-bar-accel', None)
+        for label in self.menubar3_origin_labels.keys():
+            label.set_label(self.menubar3_origin_labels[label].replace('_', ''))
 
     def _enable_modifiers(self, ignore=None):
         topwin = self.window.get_widget("vmm-details")
-        if self.gtk_settings_accel is None:
-            return
-        settings = gtk.settings_get_default()
-        settings.set_property('gtk-menu-bar-accel', self.gtk_settings_accel)
-        self.gtk_settings_accel = None
         for g in self.accel_groups:
             topwin.add_accel_group(g)
+        if self.gtk_settings_accel is not None:
+            settings = gtk.settings_get_default()
+            settings.set_property('gtk-menu-bar-accel', self.gtk_settings_accel)
+            self.gtk_settings_accel = None
+        for label in self.menubar3_origin_labels.keys():
+            label.set_label(self.menubar3_origin_labels[label])
 
     def notify_grabbed(self, src):
         topwin = self.window.get_widget("vmm-details")
_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux