Changeset 1215db9 in mainline for uspace/lib/ui/src/window.c


Ignore:
Timestamp:
2021-06-26T23:30:18Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e87415e6
Parents:
bb14312
Message:

Memory GC needs to be able to forward cursor control

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/src/window.c

    rbb14312 r1215db9  
    3939#include <gfx/bitmap.h>
    4040#include <gfx/context.h>
     41#include <gfx/cursor.h>
    4142#include <gfx/render.h>
    4243#include <io/kbd_event.h>
     
    8889static void ui_window_invalidate(void *, gfx_rect_t *);
    8990static void ui_window_update(void *);
     91static errno_t ui_window_cursor_get_pos(void *, gfx_coord2_t *);
     92static errno_t ui_window_cursor_set_pos(void *, gfx_coord2_t *);
     93static errno_t ui_window_cursor_set_visible(void *, bool);
     94
     95/** Window memory GC callbacks */
     96static mem_gc_cb_t ui_window_mem_gc_cb = {
     97        .invalidate = ui_window_invalidate,
     98        .update = ui_window_update,
     99        .cursor_get_pos = ui_window_cursor_get_pos,
     100        .cursor_set_pos = ui_window_cursor_set_pos,
     101        .cursor_set_visible = ui_window_cursor_set_visible
     102};
     103
    90104static void ui_window_app_invalidate(void *, gfx_rect_t *);
    91105static void ui_window_app_update(void *);
     106
     107/** Application area memory GC callbacks */
     108static mem_gc_cb_t ui_window_app_mem_gc_cb = {
     109        .invalidate = ui_window_app_invalidate,
     110        .update = ui_window_app_update
     111};
     112
    92113static void ui_window_expose_cb(void *);
    93114
     
    255276        }
    256277
    257         rc = mem_gc_create(&bparams.rect, &alloc, ui_window_invalidate,
    258             ui_window_update, (void *) window, &memgc);
     278        rc = mem_gc_create(&bparams.rect, &alloc, &ui_window_mem_gc_cb,
     279            (void *) window, &memgc);
    259280        if (rc != EOK) {
    260281                gfx_bitmap_destroy(window->app_bmp);
     
    267288        window->realgc = gc;
    268289#else
    269         (void) ui_window_update;
    270         (void) ui_window_invalidate;
     290        (void) ui_window_mem_gc_cb;
    271291        (void) alloc;
    272292        (void) bparams;
     
    618638                }
    619639
    620                 rc = mem_gc_create(&params.rect, &alloc, ui_window_app_invalidate,
    621                     ui_window_app_update, (void *) window, &memgc);
     640                rc = mem_gc_create(&params.rect, &alloc,
     641                    &ui_window_app_mem_gc_cb, (void *) window, &memgc);
    622642                if (rc != EOK) {
    623643                        gfx_bitmap_destroy(window->app_bmp);
     
    10031023}
    10041024
     1025/** Window cursor get position callback
     1026 *
     1027 * @param arg Argument (ui_window_t *)
     1028 * @param pos Place to store position
     1029 */
     1030static errno_t ui_window_cursor_get_pos(void *arg, gfx_coord2_t *pos)
     1031{
     1032        ui_window_t *window = (ui_window_t *) arg;
     1033
     1034        return gfx_cursor_get_pos(window->realgc, pos);
     1035}
     1036
     1037/** Window cursor set position callback
     1038 *
     1039 * @param arg Argument (ui_window_t *)
     1040 * @param pos New position
     1041 */
     1042static errno_t ui_window_cursor_set_pos(void *arg, gfx_coord2_t *pos)
     1043{
     1044        ui_window_t *window = (ui_window_t *) arg;
     1045
     1046        return gfx_cursor_set_pos(window->realgc, pos);
     1047}
     1048
     1049/** Window cursor set visibility callback
     1050 *
     1051 * @param arg Argument (ui_window_t *)
     1052 * @param visible @c true iff cursor is to be made visible
     1053 */
     1054static errno_t ui_window_cursor_set_visible(void *arg, bool visible)
     1055{
     1056        ui_window_t *window = (ui_window_t *) arg;
     1057
     1058        return gfx_cursor_set_visible(window->realgc, visible);
     1059}
     1060
    10051061/** Application area invalidate callback
    10061062 *
Note: See TracChangeset for help on using the changeset viewer.