Changeset 8b8f97d in pugl


Ignore:
Timestamp:
07/22/17 23:03:38 (5 weeks ago)
Author:
David Robillard <d@…>
Branches:
master
Parents:
adaf38d
Message:

Fix merging of expose events

Thanks JP Cimalando

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pugl/pugl_x11.c

    ra7a6fb7 r8b8f97d  
    596596 
    597597static void 
    598 merge_draw_events(PuglEvent* dst, const PuglEvent* src) 
     598merge_expose_events(PuglEvent* dst, const PuglEvent* src) 
    599599{ 
    600600    if (!dst->type) { 
    601601        *dst = *src; 
    602602    } else { 
    603         dst->expose.x      = MIN(dst->expose.x,      src->expose.x); 
    604         dst->expose.y      = MIN(dst->expose.y,      src->expose.y); 
    605         dst->expose.width  = MAX(dst->expose.width,  src->expose.width); 
    606         dst->expose.height = MAX(dst->expose.height, src->expose.height); 
     603        const double max_x = MAX(dst->expose.x + dst->expose.width, 
     604                                 src->expose.x + src->expose.width); 
     605        const double max_y = MAX(dst->expose.y + dst->expose.height, 
     606                                 src->expose.y + src->expose.height); 
     607 
     608        dst->expose.x      = MIN(dst->expose.x, src->expose.x); 
     609        dst->expose.y      = MIN(dst->expose.y, src->expose.y); 
     610        dst->expose.width  = max_x - dst->expose.x; 
     611        dst->expose.height = max_y - dst->expose.y; 
     612        dst->expose.count  = MIN(dst->expose.count, src->expose.count); 
    607613    } 
    608614} 
     
    643649        if (event.type == PUGL_EXPOSE) { 
    644650            // Expand expose event to be dispatched after loop 
    645             merge_draw_events(&expose_event, &event); 
     651            merge_expose_events(&expose_event, &event); 
    646652        } else if (event.type == PUGL_CONFIGURE) { 
    647653            // Expand configure event to be dispatched after loop 
    648             merge_draw_events(&config_event, &event); 
     654            config_event = event; 
    649655        } else { 
    650656            // Dispatch event to application immediately 
Note: See TracChangeset for help on using the changeset viewer.