Changeset d17a4a9 in mainline


Ignore:
Timestamp:
2012-08-18T18:37:50Z (11 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade
Children:
dd13349
Parents:
b5416c3
Message:

Implement absolute move events in compositor in a simple way.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/compositor/compositor.c

    rb5416c3 rd17a4a9  
    10751075    unsigned max_x, unsigned max_y)
    10761076{
    1077         /* XXX TODO */
    1078         return EOK;
     1077        /* XXX TODO Use absolute coordinates directly */
     1078       
     1079        pointer_t *pointer = input_pointer(input);
     1080       
     1081        sysarg_t width, height;
     1082       
     1083        fibril_mutex_lock(&viewport_list_mtx);
     1084        if (list_empty(&viewport_list)) {
     1085                printf("No viewport found\n");
     1086                fibril_mutex_unlock(&viewport_list_mtx);
     1087                return EOK; /* XXX */
     1088        }
     1089        link_t *link = list_first(&viewport_list);
     1090        viewport_t *vp = list_get_instance(link, viewport_t, link);
     1091        surface_get_resolution(vp->surface, &width, &height);
     1092        desktop_point_t vp_pos = vp->pos;
     1093        fibril_mutex_unlock(&viewport_list_mtx);
     1094
     1095        desktop_point_t pos_in_viewport;
     1096        pos_in_viewport.x = x * width / max_x;
     1097        pos_in_viewport.y = y * height / max_y;
     1098       
     1099        /* Calculate offset from pointer */
     1100        fibril_mutex_lock(&pointer_list_mtx);
     1101        desktop_vector_t delta;
     1102        delta.x = (vp_pos.x + pos_in_viewport.x) - pointer->pos.x;
     1103        delta.y = (vp_pos.y + pos_in_viewport.y) - pointer->pos.y;
     1104        fibril_mutex_unlock(&pointer_list_mtx);
     1105       
     1106        return comp_mouse_move(input, delta.x, delta.y);
    10791107}
    10801108
Note: See TracChangeset for help on using the changeset viewer.