Commits

nakamura committed c686e7b

use correct padding value

  • Participants
  • Parent commits 683f3a0

Comments (0)

Files changed (1)

 
     @property
     def width(self):
-        # FIXME: how to get xpad?
-        xpad = 5
+        xpad, _ = get_xy_padding(self)
         x, _ = self._size
         return self.get_char_width() * x + xpad
 
     @property
     def height(self):
-        # FIXME: how to get ypad?
-        ypad = 5
+        _, ypad = get_xy_padding(self)
         _, y = self._size
         return self.get_char_height() * y + ypad
 
 
     @property
     def width(self):
-        xpad = 2 # border_width * 2
+        xpad, _ = get_xy_padding(self)
         return self.terminal.width + self.get_border_width() + xpad
 
     @property
     def height(self):
-        # FIXME: how to get ypad?
-        ypad = 19
+        _, ypad = get_xy_padding(self)
         return self.terminal.height + self.get_border_width() + ypad
 
     @property
             t.set_sync(is_synced)
 
 
+def get_xy_padding(widget):
+    padding = widget.get_style_context().get_padding(Gtk.StateFlags.NORMAL)
+    xpad = padding.left + padding.right
+    ypad = padding.top + padding.bottom
+    return (xpad, ypad)
+
+
 # for develop/debug
 def dump_props(widgets):
     print '------------------'