Listen for button-press in the hippo.Canvas, not on the gtk.Window.

This commit is contained in:
Tomeu Vizoso 2007-02-03 21:51:39 +01:00
parent 15c4843bbb
commit 1fb786f843
2 changed files with 9 additions and 6 deletions

View File

@ -26,15 +26,15 @@ class PanelWindow(gtk.Window):
self.set_decorated(False)
self.connect('realize', self._realize_cb)
canvas = hippo.Canvas()
self._canvas = hippo.Canvas()
self._bg = hippo.CanvasBox(background_color=0x414141ff)
canvas.set_root(self._bg)
self._canvas.set_root(self._bg)
self.add(canvas)
canvas.show()
self.add(self._canvas)
self._canvas.show()
self._menu_shell = MenuShell(canvas)
self._menu_shell = MenuShell(self._canvas)
self.resize(width, height)
@ -44,6 +44,9 @@ class PanelWindow(gtk.Window):
def get_root(self):
return self._bg
def get_canvas(self):
return self._canvas
def _realize_cb(self, widget):
self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
self.window.set_accept_focus(False)

View File

@ -34,7 +34,7 @@ class ClipboardPanelWindow(PanelWindow):
self.add_events(gtk.gdk.BUTTON_PRESS_MASK |
gtk.gdk.POINTER_MOTION_HINT_MASK)
self.connect("motion_notify_event", box.motion_notify_event_cb)
self.connect("button_press_event", box.button_press_event_cb)
self.get_canvas().connect("button_press_event", box.button_press_event_cb)
self.connect("drag_end", box.drag_end_cb)
self.connect("drag_data_get", box.drag_data_get_cb)