Changeset b5c7cee in mainline for uspace/srv/hid/display/window.c


Ignore:
Timestamp:
2020-03-16T13:23:13Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1a1271d
Parents:
b3825aa
git-author:
Jiri Svoboda <jiri@…> (2020-03-15 20:22:57)
git-committer:
Jiri Svoboda <jiri@…> (2020-03-16 13:23:13)
Message:

Bring focused window to top and handle overlapping windows

When rendering changes to overlapping windows, properly repaint
that area of display instead of blindly rendering just that change.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/display/window.c

    rb3825aa rb5c7cee  
    108108        gfx_rect_translate(&wnd->dpos, &crect, &drect);
    109109
    110         /* Render a copy to the backbuffer */
     110        /* Render into the backbuffer */
    111111        for (y = crect.p0.y; y < crect.p1.y; y++) {
    112112                for (x = crect.p0.x; x < crect.p1.x; x++) {
     
    116116        }
    117117
    118         return gfx_fill_rect(ds_display_get_gc(wnd->display), &drect);
     118        /* Repaint this area of the display */
     119        return ds_display_paint(wnd->display, &drect);
    119120}
    120121
     
    183184        gfx_rect_t swrect;
    184185        gfx_rect_t crect;
     186        gfx_rect_t drect;
    185187        gfx_coord_t x, y;
    186188        pixelmap_t pixelmap;
     
    212214        /* Offset for rendering on screen = window pos + offs */
    213215        gfx_coord2_add(&cbm->wnd->dpos, &offs, &doffs);
     216
     217        /* Resulting rectangle on the screen we are drawing into */
     218        gfx_rect_translate(&doffs, &crect, &drect);
    214219
    215220        rc = gfx_bitmap_get_alloc(cbm->bitmap, &alloc);
     
    233238        }
    234239
    235         return gfx_bitmap_render(cbm->bitmap, &crect, &doffs);
     240        /* Repaint this area of the display */
     241        return ds_display_paint(cbm->wnd->display, &drect);
    236242}
    237243
     
    394400}
    395401
     402void ds_window_bring_to_top(ds_window_t *wnd)
     403{
     404        ds_display_t *disp = wnd->display;
     405
     406        ds_display_remove_window(wnd);
     407        ds_display_add_window(disp, wnd);
     408}
     409
    396410/** Get generic graphic context from window.
    397411 *
Note: See TracChangeset for help on using the changeset viewer.