Changeset acd7ac2 in mainline
- Timestamp:
- 2023-08-09T11:27:03Z (17 months ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 24be331e
- Parents:
- a77c722
- git-author:
- Jiri Svoboda <jiri@…> (2023-08-08 17:26:15)
- git-committer:
- Jiri Svoboda <jiri@…> (2023-08-09 11:27:03)
- Location:
- uspace/srv/hid/display
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/seat.c
ra77c722 racd7ac2 204 204 205 205 /* Find alternate window that is neither system nor minimized */ 206 nwnd = ds_window_find_ alt(wnd, ~(wndf_minimized | wndf_system));206 nwnd = ds_window_find_prev(wnd, ~(wndf_minimized | wndf_system)); 207 207 208 208 if (nwnd == NULL) { 209 209 /* Find alternate window that is not minimized */ 210 nwnd = ds_window_find_ alt(wnd, ~wndf_minimized);210 nwnd = ds_window_find_prev(wnd, ~wndf_minimized); 211 211 } 212 212 … … 224 224 225 225 /* Find alternate window that is not a system window */ 226 nwnd = ds_window_find_ alt(seat->focus, ~wndf_system);226 nwnd = ds_window_find_next(seat->focus, ~wndf_system); 227 227 228 228 /* Only switch focus if there is another window */ -
uspace/srv/hid/display/test/seat.c
ra77c722 racd7ac2 212 212 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 213 213 214 /* w0 is at the top, then w1, then w2 */ 215 214 216 PCUT_ASSERT_EQUALS(w0, seat->focus); 215 217 216 218 ds_window_unfocus(w0); 217 219 218 /* The previous window, w 2, should be focused now */219 PCUT_ASSERT_EQUALS(w 2, seat->focus);220 /* The previous window, w1, should be focused now */ 221 PCUT_ASSERT_EQUALS(w1, seat->focus); 220 222 221 223 ds_window_destroy(w0); -
uspace/srv/hid/display/test/window.c
ra77c722 racd7ac2 1169 1169 } 1170 1170 1171 /** ds_window_find_ alt() finds alternatewindow by flags */1172 PCUT_TEST(window_find_ alt)1171 /** ds_window_find_next() finds next window by flags */ 1172 PCUT_TEST(window_find_next) 1173 1173 { 1174 1174 gfx_context_t *gc; … … 1210 1210 w2->flags |= wndf_system; 1211 1211 1212 wnd = ds_window_find_ alt(w0, wndf_minimized);1212 wnd = ds_window_find_next(w0, wndf_minimized); 1213 1213 PCUT_ASSERT_EQUALS(w1, wnd); 1214 1214 1215 wnd = ds_window_find_ alt(w0, wndf_system);1215 wnd = ds_window_find_next(w0, wndf_system); 1216 1216 PCUT_ASSERT_EQUALS(w2, wnd); 1217 1217 1218 wnd = ds_window_find_alt(w0, wndf_maximized); 1218 wnd = ds_window_find_next(w0, wndf_maximized); 1219 PCUT_ASSERT_NULL(wnd); 1220 1221 ds_window_destroy(w0); 1222 ds_window_destroy(w1); 1223 ds_window_destroy(w2); 1224 ds_seat_destroy(seat); 1225 ds_client_destroy(client); 1226 ds_display_destroy(disp); 1227 } 1228 1229 /** ds_window_find_prev() finds previous window by flags */ 1230 PCUT_TEST(window_find_prev) 1231 { 1232 gfx_context_t *gc; 1233 ds_display_t *disp; 1234 ds_client_t *client; 1235 ds_seat_t *seat; 1236 ds_window_t *w0; 1237 ds_window_t *w1; 1238 ds_window_t *w2; 1239 ds_window_t *wnd; 1240 display_wnd_params_t params; 1241 errno_t rc; 1242 1243 rc = gfx_context_new(&dummy_ops, NULL, &gc); 1244 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1245 1246 rc = ds_display_create(gc, df_none, &disp); 1247 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1248 1249 rc = ds_client_create(disp, NULL, NULL, &client); 1250 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1251 1252 rc = ds_seat_create(disp, "Alice", &seat); 1253 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1254 1255 display_wnd_params_init(¶ms); 1256 params.rect.p0.x = params.rect.p0.y = 0; 1257 params.rect.p1.x = params.rect.p1.y = 1; 1258 1259 rc = ds_window_create(client, ¶ms, &w2); 1260 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1261 w2->flags |= wndf_system; 1262 1263 rc = ds_window_create(client, ¶ms, &w1); 1264 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1265 w1->flags |= wndf_minimized; 1266 1267 rc = ds_window_create(client, ¶ms, &w0); 1268 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1269 1270 wnd = ds_window_find_prev(w0, wndf_minimized); 1271 PCUT_ASSERT_EQUALS(w1, wnd); 1272 1273 wnd = ds_window_find_prev(w0, wndf_system); 1274 PCUT_ASSERT_EQUALS(w2, wnd); 1275 1276 wnd = ds_window_find_prev(w0, wndf_maximized); 1219 1277 PCUT_ASSERT_NULL(wnd); 1220 1278 -
uspace/srv/hid/display/window.c
ra77c722 racd7ac2 1092 1092 * @return Alternate window matching the criteria or @c NULL if there is none 1093 1093 */ 1094 ds_window_t *ds_window_find_alt(ds_window_t *wnd, 1094 ds_window_t *ds_window_find_prev(ds_window_t *wnd, 1095 display_wnd_flags_t allowed_flags) 1096 { 1097 ds_window_t *nwnd; 1098 1099 /* Try preceding windows in display order */ 1100 nwnd = ds_display_next_window(wnd); 1101 while (nwnd != NULL && (nwnd->flags & ~allowed_flags) != 0) { 1102 nwnd = ds_display_next_window(nwnd); 1103 } 1104 1105 /* Do we already have a matching window? */ 1106 if (nwnd != NULL && (nwnd->flags & ~allowed_flags) == 0) { 1107 return nwnd; 1108 } 1109 1110 /* Try succeeding windows in display order */ 1111 nwnd = ds_display_first_window(wnd->display); 1112 while (nwnd != NULL && nwnd != wnd && 1113 (nwnd->flags & ~allowed_flags) != 0) { 1114 nwnd = ds_display_next_window(nwnd); 1115 } 1116 1117 if (nwnd == wnd) 1118 return NULL; 1119 1120 return nwnd; 1121 } 1122 1123 /** Find alternate window with the allowed flags. 1124 * 1125 * An alternate window is a *different* window that is preferably previous 1126 * in the display order and only has the @a allowed flags. 1127 * 1128 * @param wnd Window 1129 * @param allowed_flags Bitmask of flags that the window is allowed to have 1130 * 1131 * @return Alternate window matching the criteria or @c NULL if there is none 1132 */ 1133 ds_window_t *ds_window_find_next(ds_window_t *wnd, 1095 1134 display_wnd_flags_t allowed_flags) 1096 1135 { -
uspace/srv/hid/display/window.h
ra77c722 racd7ac2 78 78 extern errno_t ds_window_set_cursor(ds_window_t *, display_stock_cursor_t); 79 79 extern errno_t ds_window_set_caption(ds_window_t *, const char *); 80 extern ds_window_t *ds_window_find_alt(ds_window_t *, display_wnd_flags_t); 80 extern ds_window_t *ds_window_find_next(ds_window_t *, display_wnd_flags_t); 81 extern ds_window_t *ds_window_find_prev(ds_window_t *, display_wnd_flags_t); 81 82 extern void ds_window_unfocus(ds_window_t *); 82 83 extern bool ds_window_orig_seat(ds_window_t *, sysarg_t);
Note:
See TracChangeset
for help on using the changeset viewer.