summaryrefslogtreecommitdiff
path: root/src/user/raleigh/w/button.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/raleigh/w/button.cpp')
-rw-r--r--src/user/raleigh/w/button.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/user/raleigh/w/button.cpp b/src/user/raleigh/w/button.cpp
index 224b930..da88f6a 100644
--- a/src/user/raleigh/w/button.cpp
+++ b/src/user/raleigh/w/button.cpp
@@ -18,18 +18,22 @@ namespace raleigh {
}
void button::paint(_pixel_t *pixbuf, uint32_t pitch) {
+ if (next_paint_full) {
+ next_paint_full = false;
+ for (uint32_t x = window_offset.x; x < window_offset.x + size.x; ++x) {
+ pixbuf[window_offset.y * pitch + x] = border_color;
+ pixbuf[(window_offset.y + size.y - 1) * pitch + x] = border_color;
+ }
+ for (uint32_t y = window_offset.y + 1; y < window_offset.y + size.y - 1; ++y) {
+ pixbuf[y * pitch + window_offset.x] = border_color;
+ pixbuf[y * pitch + window_offset.x + size.x - 1] = border_color;
+ }
+ }
for (uint32_t y = window_offset.y + 1; y < window_offset.y + size.y - 1; ++y)
for (uint32_t x = window_offset.x + 1; x < window_offset.x + size.x - 1; ++x)
pixbuf[y * pitch + x] = is_pressed ? pressed_color : bg_color;
+ inner.next_paint_full = true;
inner.paint(pixbuf, pitch);
- for (uint32_t x = window_offset.x; x < window_offset.x + size.x; ++x) {
- pixbuf[window_offset.y * pitch + x] = border_color;
- pixbuf[(window_offset.y + size.y - 1) * pitch + x] = border_color;
- }
- for (uint32_t y = window_offset.y + 1; y < window_offset.y + size.y - 1; ++y) {
- pixbuf[y * pitch + window_offset.x] = border_color;
- pixbuf[y * pitch + window_offset.x + size.x - 1] = border_color;
- }
}
void button::handle_click(coord window_coords, enum mouse_packet::mouse_button click_type, bool up) {