Changeset b5416c3 in mainline
- Timestamp:
- 2012-08-18T18:36:55Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d17a4a9
- Parents:
- beb5683
- Location:
- uspace/srv/hid/compositor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/compositor/compositor.c
rbeb5683 rb5416c3 92 92 sysarg_t id; 93 93 uint8_t state; 94 sysarg_t hpos; 95 sysarg_t vpos; 94 desktop_point_t pos; 96 95 sysarg_t btn_num; 97 sysarg_t btn_hpos; 98 sysarg_t btn_vpos; 99 int accum_dx; 100 int accum_dy; 96 desktop_point_t btn_pos; 97 desktop_vector_t accum; 101 98 sysarg_t grab_flags; 102 99 bool pressed; … … 135 132 vslmode_t mode; 136 133 async_sess_t *sess; 137 sysarg_t hpos; 138 sysarg_t vpos; 134 desktop_point_t pos; 139 135 surface_t *surface; 140 136 } viewport_t; … … 174 170 175 171 link_initialize(&p->link); 176 p-> hpos= coord_origin;177 p-> vpos= coord_origin;172 p->pos.x = coord_origin; 173 p->pos.y = coord_origin; 178 174 p->btn_num = 1; 179 p->btn_hpos = p->hpos; 180 p->btn_vpos = p->vpos; 181 p->accum_dx = 0; 182 p->accum_dy = 0; 175 p->btn_pos = p->pos; 176 p->accum.x = 0; 177 p->accum.y = 0; 183 178 p->grab_flags = GF_EMPTY; 184 179 p->pressed = false; … … 307 302 bool isec_vp = rectangle_intersect( 308 303 x_dmg_glob, y_dmg_glob, w_dmg_glob, h_dmg_glob, 309 vp-> hpos, vp->vpos, w_dmg_vp, h_dmg_vp,304 vp->pos.x, vp->pos.y, w_dmg_vp, h_dmg_vp, 310 305 &x_dmg_vp, &y_dmg_vp, &w_dmg_vp, &h_dmg_vp); 311 306 … … 313 308 314 309 /* Paint background color. */ 315 for (sysarg_t y = y_dmg_vp - vp-> vpos; y < y_dmg_vp - vp->vpos+ h_dmg_vp; ++y) {316 for (sysarg_t x = x_dmg_vp - vp-> hpos; x < x_dmg_vp - vp->hpos+ w_dmg_vp; ++x) {310 for (sysarg_t y = y_dmg_vp - vp->pos.y; y < y_dmg_vp - vp->pos.y + h_dmg_vp; ++y) { 311 for (sysarg_t x = x_dmg_vp - vp->pos.x; x < x_dmg_vp - vp->pos.x + w_dmg_vp; ++x) { 317 312 surface_put_pixel(vp->surface, x, y, bg_color); 318 313 } … … 352 347 * coordinates. */ 353 348 transform = win->transform; 354 double hpos = vp->hpos; 355 double vpos = vp->vpos; 356 transform_translate(&transform, -hpos, -vpos); 349 double_point_t pos; 350 pos.x = vp->pos.x; 351 pos.y = vp->pos.y; 352 transform_translate(&transform, -pos.x, -pos.y); 357 353 358 354 source_set_transform(&source, transform); … … 361 357 362 358 drawctx_transfer(&context, 363 x_dmg_win - vp-> hpos, y_dmg_win - vp->vpos, w_dmg_win, h_dmg_win);359 x_dmg_win - vp->pos.x, y_dmg_win - vp->pos.y, w_dmg_win, h_dmg_win); 364 360 } 365 361 } … … 375 371 bool isec_ptr = rectangle_intersect( 376 372 x_dmg_vp, y_dmg_vp, w_dmg_vp, h_dmg_vp, 377 ptr-> hpos, ptr->vpos, w_dmg_ptr, h_dmg_ptr,373 ptr->pos.x, ptr->pos.y, w_dmg_ptr, h_dmg_ptr, 378 374 &x_dmg_ptr, &y_dmg_ptr, &w_dmg_ptr, &h_dmg_ptr); 379 375 … … 386 382 387 383 pixel_t pix = 0; 388 sysarg_t x_vp = x_dmg_ptr - vp-> hpos;389 sysarg_t y_vp = y_dmg_ptr - vp-> vpos;390 sysarg_t x_ptr = x_dmg_ptr - ptr-> hpos;391 sysarg_t y_ptr = y_dmg_ptr - ptr-> vpos;384 sysarg_t x_vp = x_dmg_ptr - vp->pos.x; 385 sysarg_t y_vp = y_dmg_ptr - vp->pos.y; 386 sysarg_t x_ptr = x_dmg_ptr - ptr->pos.x; 387 sysarg_t y_ptr = y_dmg_ptr - ptr->pos.y; 392 388 393 389 for (sysarg_t y = 0; y < h_dmg_ptr; ++y) { … … 901 897 902 898 link_initialize(&vp->link); 903 vp-> hpos= coord_origin;904 vp-> vpos= coord_origin;899 vp->pos.x = coord_origin; 900 vp->pos.y = coord_origin; 905 901 906 902 /* Establish output bidirectional connection. */ … … 1002 998 /* window_list_mtx locked by caller */ 1003 999 1004 int dx = pointer->accum _dx;1005 int dy = pointer->accum _dy;1006 pointer->accum _dx = 0;1007 pointer->accum _dy = 0;1000 int dx = pointer->accum.x; 1001 int dy = pointer->accum.y; 1002 pointer->accum.x = 0; 1003 pointer->accum.y = 0; 1008 1004 1009 1005 bool move = (pointer->grab_flags & GF_MOVE_X) || (pointer->grab_flags & GF_MOVE_Y); … … 1089 1085 /* Update pointer position. */ 1090 1086 fibril_mutex_lock(&pointer_list_mtx); 1091 sysarg_t old_hpos = pointer->hpos; 1092 sysarg_t old_vpos = pointer->vpos; 1087 desktop_point_t old_pos = pointer->pos; 1093 1088 sysarg_t cursor_width; 1094 1089 sysarg_t cursor_height; 1095 1090 surface_get_resolution(pointer->cursor.states[pointer->state], 1096 1091 &cursor_width, &cursor_height); 1097 pointer-> hpos+= dx;1098 pointer-> vpos+= dy;1092 pointer->pos.x += dx; 1093 pointer->pos.y += dy; 1099 1094 fibril_mutex_unlock(&pointer_list_mtx); 1100 comp_damage(old_ hpos, old_vpos, cursor_width, cursor_height);1101 comp_damage(old_ hpos + dx, old_vpos+ dy, cursor_width, cursor_height);1095 comp_damage(old_pos.x, old_pos.y, cursor_width, cursor_height); 1096 comp_damage(old_pos.x + dx, old_pos.y + dy, cursor_width, cursor_height); 1102 1097 1103 1098 fibril_mutex_lock(&window_list_mtx); … … 1111 1106 sysarg_t width, height; 1112 1107 surface_get_resolution(top->surface, &width, &height); 1113 within_client = comp_coord_to_client(pointer-> hpos, pointer->vpos,1108 within_client = comp_coord_to_client(pointer->pos.x, pointer->pos.y, 1114 1109 top->transform, width, height, &point_x, &point_y); 1115 1110 fibril_mutex_unlock(&window_list_mtx); … … 1130 1125 } else { 1131 1126 /* Pointer is grabbed by top-level window action. */ 1132 pointer->accum _dx += dx;1133 pointer->accum _dy += dy;1127 pointer->accum.x += dx; 1128 pointer->accum.y += dy; 1134 1129 #if ANIMATE_WINDOW_TRANSFORMS == 1 1135 1130 sysarg_t x, y, width, height; … … 1153 1148 1154 1149 if (bpress) { 1155 pointer->btn_hpos = pointer->hpos; 1156 pointer->btn_vpos = pointer->vpos; 1150 pointer->btn_pos = pointer->pos; 1157 1151 pointer->btn_num = bnum; 1158 1152 pointer->pressed = true; … … 1167 1161 sysarg_t x, y, width, height; 1168 1162 surface_get_resolution(win->surface, &width, &height); 1169 bool within_client = comp_coord_to_client(pointer-> hpos, pointer->vpos,1163 bool within_client = comp_coord_to_client(pointer->pos.x, pointer->pos.y, 1170 1164 win->transform, width, height, &x, &y); 1171 1165 fibril_mutex_unlock(&window_list_mtx); … … 1202 1196 if (win->surface) { 1203 1197 surface_get_resolution(win->surface, &width, &height); 1204 within_client = comp_coord_to_client(pointer-> hpos, pointer->vpos,1198 within_client = comp_coord_to_client(pointer->pos.x, pointer->pos.y, 1205 1199 win->transform, width, height, &point_x, &point_y); 1206 1200 } … … 1518 1512 switch (key) { 1519 1513 case KC_I: 1520 vp-> hpos+= 0;1521 vp-> vpos+= -20;1514 vp->pos.x += 0; 1515 vp->pos.y += -20; 1522 1516 break; 1523 1517 case KC_K: 1524 vp-> hpos+= 0;1525 vp-> vpos+= 20;1518 vp->pos.x += 0; 1519 vp->pos.y += 20; 1526 1520 break; 1527 1521 case KC_J: 1528 vp-> hpos+= -20;1529 vp-> vpos+= 0;1522 vp->pos.x += -20; 1523 vp->pos.y += 0; 1530 1524 break; 1531 1525 case KC_L: 1532 vp-> hpos+= 20;1533 vp-> vpos+= 0;1526 vp->pos.x += 20; 1527 vp->pos.y += 0; 1534 1528 break; 1535 1529 default: 1536 vp-> hpos+= 0;1537 vp-> vpos+= 0;1530 vp->pos.x += 0; 1531 vp->pos.y += 0; 1538 1532 break; 1539 1533 } 1540 1534 1541 sysarg_t x = vp-> hpos;1542 sysarg_t y = vp-> vpos;1535 sysarg_t x = vp->pos.x; 1536 sysarg_t y = vp->pos.y; 1543 1537 sysarg_t width, height; 1544 1538 surface_get_resolution(vp->surface, &width, &height); -
uspace/srv/hid/compositor/compositor.h
rbeb5683 rb5416c3 36 36 #define COMPOSITOR_COMPOSITOR_H_ 37 37 38 typedef native_t desktop_coord_t; 39 typedef struct { 40 desktop_coord_t x; 41 desktop_coord_t y; 42 } desktop_point_t; 43 typedef desktop_point_t desktop_vector_t; 44 45 /* TODO remove? */ 46 typedef struct { 47 double x; 48 double y; 49 } double_point_t; 50 typedef double_point_t double_vector_t; 51 38 52 #endif 39 53
Note:
See TracChangeset
for help on using the changeset viewer.