Changeset 1b443cc0 in mainline


Ignore:
Timestamp:
2020-04-07T18:17:15Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
71eff34
Parents:
76a02db
git-author:
Jiri Svoboda <jiri@…> (2020-04-07 18:08:49)
git-committer:
Jiri Svoboda <jiri@…> (2020-04-07 18:17:15)
Message:

Avoid artifacts when moving window

Location:
uspace/srv/hid/display
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/display/types/display/window.h

    r76a02db r1b443cc0  
    7070        /** Display position */
    7171        gfx_coord2_t dpos;
     72        /** Preview position */
     73        gfx_coord2_t preview_pos;
    7274        /** Minimum size */
    7375        gfx_coord2_t min_size;
  • uspace/srv/hid/display/window.c

    r76a02db r1b443cc0  
    409409static void ds_window_start_move(ds_window_t *wnd, gfx_coord2_t *pos)
    410410{
     411        gfx_color_t *color;
     412        gfx_context_t *gc;
     413        gfx_rect_t drect;
     414        errno_t rc;
     415
    411416        log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_start_move (%d, %d)",
    412417            (int) pos->x, (int) pos->y);
     
    417422        wnd->orig_pos = *pos;
    418423        wnd->state = dsw_moving;
     424        wnd->preview_pos = wnd->dpos;
     425
     426        rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color);
     427        if (rc != EOK)
     428                return;
     429
     430        gfx_rect_translate(&wnd->dpos, &wnd->rect, &drect);
     431
     432        gc = ds_display_get_gc(wnd->display); // XXX
     433        if (gc != NULL) {
     434                gfx_set_color(gc, color);
     435                gfx_fill_rect(gc, &drect);
     436        }
     437
     438        gfx_color_delete(color);
    419439}
    420440
     
    464484                return;
    465485
    466         gfx_rect_translate(&wnd->dpos, &wnd->rect, &drect);
    467 
    468         gc = ds_display_get_gc(wnd->display); // XXX
    469         if (gc != NULL) {
    470                 gfx_set_color(gc, wnd->display->bg_color);
    471                 gfx_fill_rect(gc, &drect);
    472         }
     486        gfx_rect_translate(&wnd->preview_pos, &wnd->rect, &drect);
     487        ds_display_paint(wnd->display, &drect);
    473488
    474489        gfx_coord2_subtract(pos, &wnd->orig_pos, &dmove);
    475490
    476491        gfx_coord2_add(&wnd->dpos, &dmove, &nwpos);
     492        wnd->preview_pos = nwpos;
     493
    477494        gfx_rect_translate(&nwpos, &wnd->rect, &drect);
    478 
    479         wnd->orig_pos = *pos;
    480         wnd->dpos = nwpos;
    481495
    482496        rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color);
Note: See TracChangeset for help on using the changeset viewer.