Changeset 9901f267 in mainline for uspace/srv/hid/display/seat.c
- Timestamp:
- 2020-05-22T10:38:52Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ef20a91
- Parents:
- 9242ad9
- git-author:
- Jiri Svoboda <jiri@…> (2020-05-21 17:38:41)
- git-committer:
- Jiri Svoboda <jiri@…> (2020-05-22 10:38:52)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/seat.c
r9242ad9 r9901f267 45 45 #include "window.h" 46 46 47 static errno_t ds_seat_clear_pointer(ds_seat_t *); 48 static errno_t ds_seat_draw_pointer(ds_seat_t *); 49 47 50 /** Create seat. 48 51 * … … 63 66 seat->pntpos.y = 0; 64 67 65 seat->cursor = display->cursor[dcurs_arrow]; 68 seat->client_cursor = display->cursor[dcurs_arrow]; 69 seat->wm_cursor = NULL; 66 70 67 71 *rseat = seat; … … 145 149 } 146 150 151 /** Get current cursor used by seat. 152 * 153 * @param wmcurs WM curor 154 * @param ccurs Client cursor 155 * @return 156 */ 157 static ds_cursor_t *ds_seat_compute_cursor(ds_cursor_t *wmcurs, ds_cursor_t *ccurs) 158 { 159 if (wmcurs != NULL) 160 return wmcurs; 161 162 return ccurs; 163 } 164 165 /** Get current cursor used by seat. 166 * 167 * @param seat Seat 168 * @return Current cursor 169 */ 170 static ds_cursor_t *ds_seat_get_cursor(ds_seat_t *seat) 171 { 172 return ds_seat_compute_cursor(seat->wm_cursor, seat->client_cursor); 173 } 174 175 /** Set client cursor. 176 * 177 * Set cursor selected by client. This may update the actual cursor 178 * if WM is not overriding the cursor. 179 * 180 * @param seat Seat 181 * @param cursor Client cursor 182 */ 183 static void ds_seat_set_client_cursor(ds_seat_t *seat, ds_cursor_t *cursor) 184 { 185 ds_cursor_t *old_cursor; 186 ds_cursor_t *new_cursor; 187 188 old_cursor = ds_seat_get_cursor(seat); 189 new_cursor = ds_seat_compute_cursor(seat->wm_cursor, cursor); 190 191 if (new_cursor != old_cursor) 192 ds_seat_clear_pointer(seat); 193 194 seat->client_cursor = cursor; 195 196 if (new_cursor != old_cursor) 197 ds_seat_draw_pointer(seat); 198 } 199 200 /** Set WM cursor. 201 * 202 * Set cursor override for window management. 203 * 204 * @param seat Seat 205 * @param cursor WM cursor override or @c NULL not to override the cursor 206 */ 207 void ds_seat_set_wm_cursor(ds_seat_t *seat, ds_cursor_t *cursor) 208 { 209 ds_cursor_t *old_cursor; 210 ds_cursor_t *new_cursor; 211 212 old_cursor = ds_seat_get_cursor(seat); 213 new_cursor = ds_seat_compute_cursor(cursor, seat->client_cursor); 214 215 if (new_cursor != old_cursor) 216 ds_seat_clear_pointer(seat); 217 218 seat->wm_cursor = cursor; 219 220 if (new_cursor != old_cursor) 221 ds_seat_draw_pointer(seat); 222 } 223 147 224 /** Draw seat pointer 148 225 * … … 153 230 static errno_t ds_seat_draw_pointer(ds_seat_t *seat) 154 231 { 155 return ds_cursor_paint(seat->cursor, &seat->pntpos); 232 ds_cursor_t *cursor; 233 234 cursor = ds_seat_get_cursor(seat); 235 return ds_cursor_paint(cursor, &seat->pntpos); 156 236 } 157 237 … … 165 245 { 166 246 gfx_rect_t rect; 247 ds_cursor_t *cursor; 248 249 cursor = ds_seat_get_cursor(seat); 167 250 168 251 /* Get rectangle covered by cursor */ 169 ds_cursor_get_rect( seat->cursor, &seat->pntpos, &rect);252 ds_cursor_get_rect(cursor, &seat->pntpos, &rect); 170 253 171 254 /* Repaint it */ … … 182 265 * @return EOK on success or an error code 183 266 */ 184 #include <stdio.h>185 267 errno_t ds_seat_post_ptd_event(ds_seat_t *seat, ptd_event_t *event) 186 268 { … … 279 361 if (wnd != NULL) { 280 362 /* Moving over a window */ 281 seat->cursor = wnd->cursor;363 ds_seat_set_client_cursor(seat, wnd->cursor); 282 364 283 365 rc = ds_window_post_pos_event(wnd, event); … … 286 368 } else { 287 369 /* Not over a window */ 288 seat->cursor = seat->display->cursor[dcurs_arrow];370 ds_seat_set_client_cursor(seat, seat->display->cursor[dcurs_arrow]); 289 371 } 290 372
Note:
See TracChangeset
for help on using the changeset viewer.