Hi Would you give me a comment on this patch? If not, please apply it. > Virt-manager does not have a function to send [Ctrl+Alt+Del] and [F8] > which general VNC Viewer has. > Therefore, I add a function to send [Ctrl+Alt+Del] and [F8] to > virt-manager. > > When a user passes plural VNC, I think that this function is useful. Signed-off-by: Masayuki Sunou <fj1826dm@xxxxxxxxxxxxxxxxx> Thanks, Masayuki Sunou ------------------------------------------------------------------------------- diff -r 58c0f8ae6fb8 src/virtManager/console.py --- a/src/virtManager/console.py Mon Apr 23 15:26:46 2007 -0400 +++ b/src/virtManager/console.py Thu Apr 19 11:26:59 2007 +0900 @@ -92,6 +92,8 @@ class vmmConsole(gobject.GObject): "on_menu_view_details_activate": self.control_vm_details, "on_menu_view_fullscreen_activate": self.toggle_fullscreen, "on_menu_view_toolbar_activate": self.toggle_toolbar, + "on_menu-view-send-cad_activate": self.send_ctrl_alt_del, + "on_menu-view-send-f8_activate": self.send_f8, "on_menu_vm_close_activate": self.close, @@ -271,14 +273,20 @@ class vmmConsole(gobject.GObject): def activate_unavailable_page(self): self.window.get_widget("console-pages").set_current_page(0) self.window.get_widget("menu-vm-screenshot").set_sensitive(False) + self.window.get_widget("menu-view-send-cad").set_sensitive(False) + self.window.get_widget("menu-view-send-f8").set_sensitive(False) def activate_screenshot_page(self): self.window.get_widget("console-pages").set_current_page(1) self.window.get_widget("menu-vm-screenshot").set_sensitive(True) + self.window.get_widget("menu-view-send-cad").set_sensitive(False) + self.window.get_widget("menu-view-send-f8").set_sensitive(False) def activate_auth_page(self): pw = self.config.get_console_password(self.vm) self.window.get_widget("menu-vm-screenshot").set_sensitive(False) + self.window.get_widget("menu-view-send-cad").set_sensitive(False) + self.window.get_widget("menu-view-send-f8").set_sensitive(False) self.window.get_widget("console-auth-password").set_text(pw) self.window.get_widget("console-auth-password").grab_focus() if self.config.has_keyring(): @@ -294,6 +302,8 @@ class vmmConsole(gobject.GObject): def activate_viewer_page(self): self.window.get_widget("console-pages").set_current_page(3) self.window.get_widget("menu-vm-screenshot").set_sensitive(True) + self.window.get_widget("menu-view-send-cad").set_sensitive(True) + self.window.get_widget("menu-view-send-f8").set_sensitive(True) self.vncViewer.grab_focus() def control_vm_screenshot(self, src): @@ -447,6 +457,8 @@ class vmmConsole(gobject.GObject): if status in [ libvirt.VIR_DOMAIN_SHUTOFF ,libvirt.VIR_DOMAIN_CRASHED ] or vm.is_management_domain(): self.window.get_widget("console-pages").set_current_page(0) + self.window.get_widget("menu-view-send-cad").set_sensitive(False) + self.window.get_widget("menu-view-send-f8").set_sensitive(False) else: if status == libvirt.VIR_DOMAIN_PAUSED: screenshot = None @@ -486,4 +498,10 @@ class vmmConsole(gobject.GObject): self.ignorePause = False self.ignorePause = False + def send_ctrl_alt_del(self, src): + self.vncViewer.send_ctrl_alt_del() + + def send_f8(self, src): + self.vncViewer.send_f8() + gobject.type_register(vmmConsole) diff -r 58c0f8ae6fb8 src/vmm-console.glade --- a/src/vmm-console.glade Mon Apr 23 15:26:46 2007 -0400 +++ b/src/vmm-console.glade Thu Apr 19 09:12:27 2007 +0900 @@ -162,6 +162,30 @@ <child> <widget class="GtkSeparatorMenuItem" id="separator5"> + <property name="visible">True</property> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="menu-view-send-cad"> + <property name="visible">True</property> + <property name="label" translatable="yes">Send Ctrl+Alt+Del</property> + <property name="use_underline">True</property> + <signal name="activate" handler="on_menu-view-send-cad_activate" last_modification_time="Tue, 17 Apr 2007 08:28:05 GMT"/> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="menu-view-send-f8"> + <property name="visible">True</property> + <property name="label" translatable="yes">Send F8</property> + <property name="use_underline">True</property> + <signal name="activate" handler="on_menu-view-send-f8_activate" last_modification_time="Thu, 19 Apr 2007 00:12:14 GMT"/> + </widget> + </child> + + <child> + <widget class="GtkSeparatorMenuItem" id="separator8"> <property name="visible">True</property> </widget> </child> diff -r 58c0f8ae6fb8 src/vncViewer/vnc.py --- a/src/vncViewer/vnc.py Mon Apr 23 15:26:46 2007 -0400 +++ b/src/vncViewer/vnc.py Thu Apr 19 11:27:41 2007 +0900 @@ -598,6 +598,20 @@ class GRFBViewer(gtk.DrawingArea): gc = self.window.new_gc() self.window.draw_drawable(gc, self.fb.get_pixmap(), event.area.x, event.area.y, event.area.x, event.area.y, event.area.width, event.area.height) + def send_ctrl_alt_del(self): + if self.client != None: + self.client.update_key(1, gtk.gdk.keyval_from_name("Control_L")) + self.client.update_key(1, gtk.gdk.keyval_from_name("Alt_L")) + self.client.update_key(1, gtk.gdk.keyval_from_name("Delete")) + self.client.update_key(0, gtk.gdk.keyval_from_name("Control_L")) + self.client.update_key(0, gtk.gdk.keyval_from_name("Alt_L")) + self.client.update_key(0, gtk.gdk.keyval_from_name("Delete")) + + def send_f8(self): + if self.client != None: + self.client.update_key(1, gtk.gdk.keyval_from_name("F8")) + self.client.update_key(0, gtk.gdk.keyval_from_name("F8")) + gobject.type_register(GRFBViewer)