Changes in uspace/srv/hid/display/seat.c [8edec53:ca9aa89] in mainline
- File:
-
- 1 edited
-
uspace/srv/hid/display/seat.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/seat.c
r8edec53 rca9aa89 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2023 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 92 94 if (wnd == seat->focus) { 93 95 /* Focus is not changing */ 94 96 return; 97 } 98 99 if (wnd != NULL) { 100 rc = ds_window_unminimize(wnd); 101 if (rc != EOK) 102 return; 95 103 } 96 104 … … 130 138 /** Evacuate seat references to window. 131 139 * 132 * If seat's focus is @a wnd, it will be set to a different window.140 * If seat's focus is @a wnd, it will be set to NULL. 133 141 * If seat's popup window is @a wnd, it will be set to NULL. 134 142 * 135 143 * @param seat Seat 136 * @param wnd Window to evacuate focus from144 * @param wnd Window to evacuate references from 137 145 */ 138 146 void ds_seat_evac_wnd_refs(ds_seat_t *seat, ds_window_t *wnd) 139 147 { 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 } 148 if (seat->focus == wnd) 149 ds_seat_set_focus(seat, NULL); 151 150 152 151 if (seat->popup == wnd) … … 154 153 } 155 154 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) 164 { 165 ds_window_t *nwnd; 166 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 156 181 /** Switch focus to another window. 157 182 * … … 163 188 ds_window_t *nwnd; 164 189 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 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 */ 173 194 if (nwnd != NULL) 174 195 ds_seat_set_focus(seat, nwnd); … … 364 385 if (event->type == PTD_PRESS || event->type == PTD_RELEASE || 365 386 event->type == PTD_DCLICK) { 366 pevent.pos_id = 0;387 pevent.pos_id = event->pos_id; 367 388 switch (event->type) { 368 389 case PTD_PRESS: … … 395 416 seat->pntpos = npos; 396 417 397 pevent.pos_id = 0;418 pevent.pos_id = event->pos_id; 398 419 pevent.type = POS_UPDATE; 399 420 pevent.btn_num = 0; … … 423 444 seat->pntpos = npos; 424 445 425 pevent.pos_id = 0;446 pevent.pos_id = event->pos_id; 426 447 pevent.type = POS_UPDATE; 427 448 pevent.btn_num = 0;
Note:
See TracChangeset
for help on using the changeset viewer.
