Changeset 24cf391a in mainline for uspace/srv/hid/display/display.c
- Timestamp:
- 2019-12-03T10:59:47Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 973efd36
- Parents:
- 79949f3
- git-author:
- Jiri Svoboda <jiri@…> (2019-11-02 18:59:43)
- git-committer:
- Jiri Svoboda <jiri@…> (2019-12-03 10:59:47)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/display.c
r79949f3 r24cf391a 164 164 } 165 165 166 /** Find window by display position. 167 * 168 * @param display Display 169 * @param pos Display position 170 */ 171 ds_window_t *ds_display_window_by_pos(ds_display_t *display, gfx_coord2_t *pos) 172 { 173 ds_window_t *wnd; 174 175 wnd = ds_display_first_window(display); 176 while (wnd != NULL) { 177 // XXX Need to know window dimensions 178 if (pos->x >= wnd->dpos.x && pos->y >= wnd->dpos.y && 179 pos->x <= wnd->dpos.x + 100 && pos->y <= wnd->dpos.y + 100) { 180 return wnd; 181 } 182 183 wnd = ds_display_next_window(wnd); 184 } 185 186 return NULL; 187 } 188 166 189 /** Add window to display. 167 190 * … … 239 262 } 240 263 264 /** Post position event to a display. 265 * 266 * @param display Display 267 * @param event Event 268 */ 269 errno_t ds_display_post_pos_event(ds_display_t *display, pos_event_t *event) 270 { 271 gfx_coord2_t pos; 272 ds_window_t *wnd; 273 ds_seat_t *seat; 274 275 /* Focus window on button press */ 276 if (event->type == POS_PRESS) { 277 printf("Button press\n"); 278 pos.x = event->hpos; 279 pos.y = event->vpos; 280 281 wnd = ds_display_window_by_pos(display, &pos); 282 if (wnd != NULL) { 283 seat = ds_display_first_seat(display); 284 if (seat == NULL) 285 return EOK; 286 287 ds_seat_set_focus(seat, wnd); 288 return EOK; 289 } 290 } 291 292 return EOK; 293 } 294 241 295 /** Add seat to display. 242 296 *
Note:
See TracChangeset
for help on using the changeset viewer.