Changeset ededdc4 in mainline
- Timestamp:
- 2023-01-05T20:17:32Z (2 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ca9aa89
- Parents:
- 17c0f5d
- Location:
- uspace/srv/hid/display
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/seat.c
r17c0f5d rededdc4 138 138 /** Evacuate seat references to window. 139 139 * 140 * 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. 141 141 * If seat's popup window is @a wnd, it will be set to NULL. 142 142 * … … 146 146 void ds_seat_evac_wnd_refs(ds_seat_t *seat, ds_window_t *wnd) 147 147 { 148 ds_window_t *nwnd; 149 150 if (seat->focus == wnd) { 151 nwnd = ds_display_prev_window(wnd); 152 if (nwnd == NULL) 153 nwnd = ds_display_last_window(wnd->display); 154 if (nwnd == wnd) 155 nwnd = NULL; 156 157 ds_seat_set_focus(seat, nwnd); 158 } 148 if (seat->focus == wnd) 149 ds_seat_set_focus(seat, NULL); 159 150 160 151 if (seat->popup == wnd) -
uspace/srv/hid/display/test/seat.c
r17c0f5d rededdc4 90 90 } 91 91 92 /** Evacuate focus when another window is available. */ 93 PCUT_TEST(evac_focus_two_windows) 94 { 95 ds_display_t *disp; 96 ds_client_t *client; 97 ds_seat_t *seat; 98 ds_window_t *w0; 99 ds_window_t *w1; 100 display_wnd_params_t params; 101 bool called_cb = false; 102 errno_t rc; 103 104 rc = ds_display_create(NULL, df_none, &disp); 105 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 106 107 rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client); 108 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 109 110 rc = ds_seat_create(disp, &seat); 111 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 112 113 display_wnd_params_init(¶ms); 114 params.rect.p0.x = params.rect.p0.y = 0; 115 params.rect.p1.x = params.rect.p1.y = 1; 116 117 rc = ds_window_create(client, ¶ms, &w1); 118 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 119 120 rc = ds_window_create(client, ¶ms, &w0); 121 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 122 123 ds_seat_set_focus(seat, w1); 124 PCUT_ASSERT_EQUALS(w1, seat->focus); 125 PCUT_ASSERT_TRUE(called_cb); 126 called_cb = false; 127 128 ds_seat_evac_wnd_refs(seat, w1); 129 PCUT_ASSERT_EQUALS(w0, seat->focus); 130 PCUT_ASSERT_TRUE(called_cb); 131 132 ds_window_destroy(w0); 133 ds_window_destroy(w1); 134 ds_seat_destroy(seat); 135 ds_client_destroy(client); 136 ds_display_destroy(disp); 137 } 138 139 /** Evacuate focus from the only existing window. 92 /** Evacuate focus from window. 140 93 * 141 94 * After evacuating no window should be focused -
uspace/srv/hid/display/window.c
r17c0f5d rededdc4 183 183 disp = wnd->display; 184 184 185 ds_window_unfocus(wnd); 186 185 187 ds_client_remove_window(wnd); 186 188 ds_display_remove_window(wnd);
Note:
See TracChangeset
for help on using the changeset viewer.