fix the godawful accelerator pass-through option. Hopefully SCT will stop throwing chairs at my application...

This commit is contained in:
Hugh O. Brock 2006-10-18 14:44:08 -04:00
parent 706badc4e9
commit bfc4bf69b5
3 changed files with 38 additions and 33 deletions

View File

@ -8173,6 +8173,33 @@ TB</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="create-host-memory">
<property name="visible">True</property>
<property name="label" translatable="yes">2 GB</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">3</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment124">
<property name="visible">True</property>
@ -8281,33 +8308,6 @@ TB</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="create-host-memory">
<property name="visible">True</property>
<property name="label" translatable="yes">2 GB</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">3</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>

View File

@ -44,11 +44,10 @@ class vmmConsole(gobject.GObject):
topwin = self.window.get_widget("vmm-console")
topwin.hide()
topwin.set_title(vm.get_name() + " " + topwin.get_title())
self.window.get_widget("control-shutdown").set_icon_widget(gtk.Image())
self.window.get_widget("control-shutdown").get_icon_widget().set_from_file(config.get_icon_dir() + "/icon_shutdown.png")
self.vncViewer = GRFBViewer(autograbkey=True)
self.vncViewer = GRFBViewer(topwin, autograbkey=True)
self.window.get_widget("console-vnc-align").add(self.vncViewer)
self.vncViewer.connect("size-request", self.autosize)
self.vncViewer.show()

View File

@ -177,7 +177,7 @@ class GRFBViewer(gtk.DrawingArea):
"disconnected": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, [])
}
def __init__(self, autograbkey=False):
def __init__(self, topwin, autograbkey=False):
gtk.DrawingArea.__init__(self)
self.fb = GRFBFrameBuffer(self)
@ -185,6 +185,8 @@ class GRFBViewer(gtk.DrawingArea):
self.authenticated = False
self.needpw = True
self.autograbkey = autograbkey
self.topwin = topwin
self.accel_groups = gtk.accel_groups_from_object(topwin)
self.preferred_encoding = (rfb.ENCODING_RAW, rfb.ENCODING_DESKTOP_RESIZE)
# Current impl of draw_solid is *far* too slow to be practical
# for Hextile which likes lots of 1x1 pixels solid rectangles
@ -381,11 +383,15 @@ class GRFBViewer(gtk.DrawingArea):
return self.autograbkey
def grab_keyboard(self):
gtk.gdk.keyboard_grab(self.window, 1, long(0))
gtk.gdk.keyboard_grab(self.window, False, long(0))
for g in self.accel_groups:
self.topwin.remove_accel_group(g)
self.grabbedKeyboard = True
def ungrab_keyboard(self):
gtk.gdk.keyboard_ungrab()
for g in self.accel_groups:
self.topwin.add_accel_group(g)
self.grabbedKeyboard = False
def enter_notify(self, win, event):
@ -524,7 +530,7 @@ def main():
vp = gtk.Viewport()
pane.add(vp)
vnc = GRFBViewer(autograbkey=True)
vnc = GRFBViewer(win, autograbkey=True)
vp.add(vnc)
win.show_all()