Skip to content

Commit

Permalink
Gtk UI: Add padding right to the pill (bug 1533)
Browse files Browse the repository at this point in the history
In recent versions of Ubuntu, the scroll bars are
drawn as overlays onto the content area, thereby
requiring a bit of padding on the right side of
the content area. It doesn't do much harm on other
distros, so we enable it in general.
  • Loading branch information
thp committed Jan 9, 2012
1 parent c0de335 commit 2417503
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/gpodder/gtkui/draw.py
Expand Up @@ -125,6 +125,9 @@ def draw_text_pill(left_text, right_text, x=0, y=0, border=2, radius=14, font_de
widget = gtk.Label()
style = widget.rc_get_style()

# Padding (in px) at the right edge of the image (for Ubuntu; bug 1533)
padding_right = 7

x_border = border*2

if font_desc is None:
Expand All @@ -145,11 +148,15 @@ def draw_text_pill(left_text, right_text, x=0, y=0, border=2, radius=14, font_de
text_height = max(height_left, height_right)

image_height = int(y+text_height+border*2)
image_width = int(x+width_left+width_right+x_border*4)
image_width = int(x+width_left+width_right+x_border*4+padding_right)
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, image_width, image_height)

ctx = pangocairo.CairoContext(cairo.Context(surface))

# Clip so as to not draw on the right padding (for Ubuntu; bug 1533)
ctx.rectangle(0, 0, image_width - padding_right, image_height)
ctx.clip()

if left_text == '0':
left_text = None
if right_text == '0':
Expand Down

0 comments on commit 2417503

Please sign in to comment.