updating padding
Browse files
+4 −4 src/bar/bar.rs
| @@ -161,8 +161,9 @@ impl Bar { | |||
| 161 | let bottom_margin = 4; | 161 | let bottom_margin = 4; |
| 162 | let underline_y = self.height as i16 - underline_height as i16 - bottom_margin; | 162 | let underline_y = self.height as i16 - underline_height as i16 - bottom_margin; |
| 163 | 163 | ||
| 164 | - let underline_padding = 4; | 164 | + let text_width = self.font.text_width(tag); |
| 165 | - let underline_width = tag_width - underline_padding; | 165 | + let underline_width = text_width + 4; |
| 166 | + let underline_x = x_position + ((tag_width - underline_width) / 2) as i16; | ||
| 166 | 167 | ||
| 167 | connection.change_gc( | 168 | connection.change_gc( |
| 168 | self.graphics_context, | 169 | self.graphics_context, |
| @@ -172,14 +173,13 @@ impl Bar { | |||
| 172 | self.window, | 173 | self.window, |
| 173 | self.graphics_context, | 174 | self.graphics_context, |
| 174 | &[Rectangle { | 175 | &[Rectangle { |
| 175 | - x: x_position + (underline_padding / 2) as i16, | 176 | + x: underline_x, |
| 176 | y: underline_y, | 177 | y: underline_y, |
| 177 | width: underline_width, | 178 | width: underline_width, |
| 178 | height: underline_height, | 179 | height: underline_height, |
| 179 | }], | 180 | }], |
| 180 | )?; | 181 | )?; |
| 181 | } | 182 | } |
| 182 | - | ||
| 183 | x_position += tag_width as i16; | 183 | x_position += tag_width as i16; |
| 184 | } | 184 | } |
| 185 | connection.flush()?; | 185 | connection.flush()?; |