Changes in uspace/srv/hid/display/seat.c [ca9aa89:8edec53] in mainline
- File:
-
- 1 edited
-
uspace/srv/hid/display/seat.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/seat.c
rca9aa89 r8edec53 1 1 /* 2 * Copyright (c) 202 3Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 90 90 void ds_seat_set_focus(ds_seat_t *seat, ds_window_t *wnd) 91 91 { 92 errno_t rc;93 94 92 if (wnd == seat->focus) { 95 93 /* Focus is not changing */ 96 94 return; 97 }98 99 if (wnd != NULL) {100 rc = ds_window_unminimize(wnd);101 if (rc != EOK)102 return;103 95 } 104 96 … … 138 130 /** Evacuate seat references to window. 139 131 * 140 * If seat's focus is @a wnd, it will be set to NULL.132 * If seat's focus is @a wnd, it will be set to a different window. 141 133 * If seat's popup window is @a wnd, it will be set to NULL. 142 134 * 143 135 * @param seat Seat 144 * @param wnd Window to evacuate references from136 * @param wnd Window to evacuate focus from 145 137 */ 146 138 void ds_seat_evac_wnd_refs(ds_seat_t *seat, ds_window_t *wnd) 147 139 { 148 if (seat->focus == wnd) 149 ds_seat_set_focus(seat, NULL); 140 ds_window_t *nwnd; 141 142 if (seat->focus == wnd) { 143 nwnd = ds_display_prev_window(wnd); 144 if (nwnd == NULL) 145 nwnd = ds_display_last_window(wnd->display); 146 if (nwnd == wnd) 147 nwnd = NULL; 148 149 ds_seat_set_focus(seat, nwnd); 150 } 150 151 151 152 if (seat->popup == wnd) … … 153 154 } 154 155 155 /** Unfocus window. 156 * 157 * If seat's focus is @a wnd, it will be set to a different window 158 * that is not minimized, preferably not a system window. 159 * 160 * @param seat Seat 161 * @param wnd Window to remove focus from 162 */ 163 void ds_seat_unfocus_wnd(ds_seat_t *seat, ds_window_t *wnd) 156 /** Switch focus to another window. 157 * 158 * @param seat Seat 159 * @param wnd Window to evacuate focus from 160 */ 161 void ds_seat_switch_focus(ds_seat_t *seat) 164 162 { 165 163 ds_window_t *nwnd; 166 164 167 if (seat->focus != wnd) 168 return; 169 170 /* Find alternate window that is neither system nor minimized */ 171 nwnd = ds_window_find_alt(wnd, ~(wndf_minimized | wndf_system)); 172 173 if (nwnd == NULL) { 174 /* Find alternate window that is not minimized */ 175 nwnd = ds_window_find_alt(wnd, ~wndf_minimized); 176 } 177 178 ds_seat_set_focus(seat, nwnd); 179 } 180 181 /** Switch focus to another window. 182 * 183 * @param seat Seat 184 * @param wnd Window to evacuate focus from 185 */ 186 void ds_seat_switch_focus(ds_seat_t *seat) 187 { 188 ds_window_t *nwnd; 189 190 /* Find alternate window that is not a system window */ 191 nwnd = ds_window_find_alt(seat->focus, ~wndf_system); 192 193 /* Only switch focus if there is another window */ 165 if (seat->focus != NULL) 166 nwnd = ds_display_prev_window(seat->focus); 167 else 168 nwnd = NULL; 169 170 if (nwnd == NULL) 171 nwnd = ds_display_last_window(seat->display); 172 194 173 if (nwnd != NULL) 195 174 ds_seat_set_focus(seat, nwnd); … … 385 364 if (event->type == PTD_PRESS || event->type == PTD_RELEASE || 386 365 event->type == PTD_DCLICK) { 387 pevent.pos_id = event->pos_id;366 pevent.pos_id = 0; 388 367 switch (event->type) { 389 368 case PTD_PRESS: … … 416 395 seat->pntpos = npos; 417 396 418 pevent.pos_id = event->pos_id;397 pevent.pos_id = 0; 419 398 pevent.type = POS_UPDATE; 420 399 pevent.btn_num = 0; … … 444 423 seat->pntpos = npos; 445 424 446 pevent.pos_id = event->pos_id;425 pevent.pos_id = 0; 447 426 pevent.type = POS_UPDATE; 448 427 pevent.btn_num = 0;
Note:
See TracChangeset
for help on using the changeset viewer.
