sugarlabs / sugar-artwork

Sugar icons and themes
Apache License 2.0
11 stars 33 forks source link

Normalize gtkmenu #65

Closed samdroid-apps closed 9 years ago

samdroid-apps commented 9 years ago

Fixes bugs with GtkMenu based palettes.

Requires https://github.com/sugarlabs/sugar-toolkit-gtk3/pull/233

Before After
before after
samdroid-apps commented 9 years ago

By fixing the padding at the bottom of the menu (edbf7ddf462c7d008924d0b703cbd0db1df7806d), it also fixes another bug:

Before After
before after
godiard commented 9 years ago

@samdroid-apps, on my system (F22, Gnome 3.16.2), testing this pr and https://github.com/sugarlabs/sugar-toolkit-gtk3/pull/233 I found the following issues:

(main.py:30411): Gtk-WARNING **: SugarPaletteHeaderSeparator 0x1ef4de0 is mapped but not visible
(main.py:30411): Gtk-WARNING **: SugarPaletteHeaderSeparator 0x1ef4de0 is mapped but visible=0 child_visible=1 parent SugarPaletteMenuWidget 0x2287220 mapped=1

Maybe we should avoid adding the widget instead of hide it?

--- a/src/sugar3/graphics/palette.py
+++ b/src/sugar3/graphics/palette.py
@@ -79,13 +79,6 @@ class _HeaderSeparator(Gtk.SeparatorMenuItem):
     def __init__(self):
         Gtk.SeparatorMenuItem.__init__(self)

-    def do_realize(self):
-        Gtk.SeparatorMenuItem.do_realize(self)
-        if isinstance(self.get_parent(), _PaletteMenuWidget):
-            # Add the border through CSS so we go all the way across
-            # the palette
-            self.hide()
-

 class Palette(PaletteWindow):
     """Floating palette implementation.
@@ -465,9 +458,10 @@ class Palette(PaletteWindow):
             self._label_menuitem.show()
             self._widget.append(self._label_menuitem)

-            separator = _HeaderSeparator()
-            self._widget.append(separator)
-            separator.show()
+            if not isinstance(self._widget, _PaletteMenuWidget):
+                separator = _HeaderSeparator()
+                self._widget.append(separator)
+                separator.show()

             self._setup_widget()
GtkMenuItem:hover {
    background-color: @button_grey;
}

works in the object inspector, but not in our css. Looks like the GtkMenuItem rendering is broken in some way, or the rules changed.

.menuitem:prelight {
background-color: @button_grey;
+    padding: $(subcell_size)px $((subcell_size * 3 - font_height) / 2)px;
     background-color: @button_grey;
 }

Or the menuitems will change height when the user move the mouse over them, making the unusable. This show the rule is detected and used, no idea why the background color is ignored.

Resume: I have tried a lot of different options, but none solve all the problems

godiard commented 9 years ago

Tested this, but didn't worked on my system http://stackoverflow.com/questions/11381401/set-the-hover-background-color-of-a-gtk3-menuitem

samdroid-apps commented 9 years ago

I made a patch for the size changing a while ago: https://github.com/sugarlabs/sugar-artwork/pull/57/files

I thought it was just a rawhide bug, but it must have shipped with fedora

  1. Luckily, the bug has fixed itself upstream in fedora 23/rawhide.

On Tue, 30 Jun 2015 7:17 am Gonzalo Odiard notifications@github.com wrote:

Tested this, but didn't worked on my system http://stackoverflow.com/questions/11381401/set-the-hover-background-color-of-a-gtk3-menuitem

— Reply to this email directly or view it on GitHub https://github.com/sugarlabs/sugar-artwork/pull/65#issuecomment-116849075 .

tchx84 commented 9 years ago

Merged Gonzalo's version.