Skip to content

Commit 83314c4

Browse files
committed
Fix background rectangle coordinates
marginX()/marginY() return unsigned values, so negating them caused unsigned wraparound and passed huge coordinates to cairo_rectangle(). Cast them to signed/double before negation.
1 parent ce35534 commit 83314c4

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/virtualkeyboard.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,11 @@ void VirtualKeyboard::paint(cairo_t *cr, unsigned int offsetX, unsigned int offs
264264
void VirtualKeyboard::paintBackground(cairo_t *cr) {
265265
auto [keyboardWidth, keyboardHeight] = size();
266266
cairo_set_source_rgb(cr, 0.95, 0.95, 0.95);
267-
cairo_rectangle(cr, -marginX(), -marginY(),
268-
keyboardWidth + 2 * marginX(), keyboardHeight + 2 * marginY());
267+
cairo_rectangle(cr,
268+
-static_cast<double>(marginX()),
269+
-static_cast<double?(marginY()),
270+
keyboardWidth + 2 * marginX(),
271+
keyboardHeight + 2 * marginY());
269272
cairo_fill(cr);
270273
}
271274

0 commit comments

Comments
 (0)