Embed/unembed the menu on state changes, keeping it around
cause some weird drawing issues. Redraw on palette size changes (patch by Benzea).
This commit is contained in:
@@ -44,6 +44,12 @@
|
||||
)
|
||||
)
|
||||
|
||||
(define-method unembed
|
||||
(of-object "SugarMenu")
|
||||
(c-name "sugar_menu_unembed")
|
||||
(return-type "none")
|
||||
)
|
||||
|
||||
;; From sugar-key-grabber.h
|
||||
|
||||
(define-function sugar_key_grabber_get_type
|
||||
|
||||
@@ -138,9 +138,9 @@ class Palette(gtk.Window):
|
||||
self._separator = gtk.HSeparator()
|
||||
self._secondary_box.pack_start(self._separator)
|
||||
|
||||
menu_box = gtk.VBox()
|
||||
self._secondary_box.pack_start(menu_box)
|
||||
menu_box.show()
|
||||
self._menu_box = gtk.VBox()
|
||||
self._secondary_box.pack_start(self._menu_box)
|
||||
self._menu_box.show()
|
||||
|
||||
self._content = gtk.VBox()
|
||||
self._secondary_box.pack_start(self._content)
|
||||
@@ -154,7 +154,6 @@ class Palette(gtk.Window):
|
||||
vbox.show()
|
||||
|
||||
self.menu = _Menu(self)
|
||||
self.menu.embed(menu_box)
|
||||
self.menu.show()
|
||||
|
||||
self.connect('enter-notify-event',
|
||||
@@ -223,6 +222,10 @@ class Palette(gtk.Window):
|
||||
else:
|
||||
raise AssertionError
|
||||
|
||||
def do_size_allocate(self, allocation):
|
||||
gtk.Window.do_size_allocate(self, allocation)
|
||||
self.queue_draw()
|
||||
|
||||
def do_expose_event(self, event):
|
||||
# We want to draw a border with a beautiful gap
|
||||
if self._draw_gap:
|
||||
@@ -428,8 +431,10 @@ class Palette(gtk.Window):
|
||||
return
|
||||
|
||||
if state == self._PRIMARY:
|
||||
self.menu.unembed()
|
||||
self._secondary_box.hide()
|
||||
elif state == self._SECONDARY:
|
||||
self.menu.embed(self._menu_box)
|
||||
self._secondary_box.show()
|
||||
|
||||
self._state = state
|
||||
|
||||
Reference in New Issue
Block a user