The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

c/main: Tidy target code [NFC]

authored by

Jakob Bornecrantz and committed by
Simon Zeni
4a2eebdc 7e7e011b

+59 -17
+19 -6
src/xrt/compositor/main/comp_window_direct_nvidia.c
··· 144 144 { 145 145 unsigned long wl_entry_length = strlen(wl_entry); 146 146 unsigned long disp_entry_length = strlen(disp->displayName); 147 - if (disp_entry_length < wl_entry_length) 147 + 148 + // If the entry is shorter then it will never match. 149 + if (disp_entry_length < wl_entry_length) { 148 150 return false; 151 + } 149 152 150 - if (strncmp(wl_entry, disp->displayName, wl_entry_length) != 0) 153 + // We only check the first part of the string, extra characters ignored. 154 + if (strncmp(wl_entry, disp->displayName, wl_entry_length) != 0) { 151 155 return false; 156 + } 157 + 158 + /* 159 + * We have a match with this allow list entry. 160 + */ 152 161 153 - // we have a match with this allowlist entry. 162 + // Make the compositor use this size. 154 163 w->base.base.c->settings.preferred.width = disp->physicalResolution.width; 155 164 w->base.base.c->settings.preferred.height = disp->physicalResolution.height; 156 - struct comp_window_direct_nvidia_display d = {.name = U_TYPED_ARRAY_CALLOC(char, disp_entry_length + 1), 157 - .display_properties = *disp, 158 - .display = disp->display}; 165 + 166 + // Create the entry. 167 + struct comp_window_direct_nvidia_display d = { 168 + .name = U_TYPED_ARRAY_CALLOC(char, disp_entry_length + 1), 169 + .display_properties = *disp, 170 + .display = disp->display, 171 + }; 159 172 160 173 memcpy(d.name, disp->displayName, disp_entry_length); 161 174 d.name[disp_entry_length] = '\0';
+14 -6
src/xrt/compositor/main/comp_window_direct_randr.c
··· 149 149 free(d->name); 150 150 } 151 151 152 - if (w_direct->displays != NULL) 152 + if (w_direct->displays != NULL) { 153 153 free(w_direct->displays); 154 + } 154 155 155 156 if (w_direct->dpy) { 156 157 XCloseDisplay(w_direct->dpy); ··· 220 221 } 221 222 222 223 struct comp_window_direct_randr_display *d = comp_window_direct_randr_current_display(w_direct); 224 + 225 + // Make the compositor use this size. 223 226 ct->c->settings.preferred.width = d->primary_mode.width; 224 227 ct->c->settings.preferred.height = d->primary_mode.height; 225 228 ··· 230 233 comp_window_direct_randr_current_display(struct comp_window_direct_randr *w) 231 234 { 232 235 int index = w->base.base.c->settings.display; 233 - if (index == -1) 236 + if (index == -1) { 234 237 index = 0; 238 + } 235 239 236 - if (w->display_count <= (uint32_t)index) 240 + if (w->display_count <= (uint32_t)index) { 237 241 return NULL; 242 + } 238 243 239 244 return &w->displays[index]; 240 245 } ··· 315 320 int n = xcb_randr_get_screen_resources_modes_length(resources_reply); 316 321 317 322 xcb_randr_mode_info_t *mode_info = NULL; 318 - for (int i = 0; i < n; i++) 319 - if (mode_infos[i].id == output_modes[0]) 323 + for (int i = 0; i < n; i++) { 324 + if (mode_infos[i].id == output_modes[0]) { 320 325 mode_info = &mode_infos[i]; 326 + } 327 + } 321 328 322 - if (mode_info == NULL) 329 + if (mode_info == NULL) { 323 330 COMP_ERROR(w->base.base.c, "No mode with id %d found??", output_modes[0]); 331 + } 324 332 325 333 326 334 struct comp_window_direct_randr_display d = {
+9 -2
src/xrt/compositor/main/comp_window_vk_display.c
··· 117 117 d->display = VK_NULL_HANDLE; 118 118 } 119 119 120 - if (w_direct->displays != NULL) 120 + if (w_direct->displays != NULL) { 121 121 free(w_direct->displays); 122 + } 122 123 123 124 free(ct); 124 125 } ··· 126 127 static bool 127 128 append_vk_display_entry(struct comp_window_vk_display *w, struct VkDisplayPropertiesKHR *disp) 128 129 { 130 + // Make the compositor use this size. 129 131 w->base.base.c->settings.preferred.width = disp->physicalResolution.width; 130 132 w->base.base.c->settings.preferred.height = disp->physicalResolution.height; 131 - struct vk_display d = {.display_properties = *disp, .display = disp->display}; 133 + 134 + // Create the entry. 135 + struct vk_display d = { 136 + .display_properties = *disp, 137 + .display = disp->display, 138 + }; 132 139 133 140 w->display_count += 1; 134 141
+17 -3
src/xrt/compositor/main/comp_window_xcb.c
··· 246 246 } 247 247 } 248 248 249 + // We can now create the window. 249 250 comp_window_xcb_create_window(w_xcb, ct->c->settings.preferred.width, ct->c->settings.preferred.height); 250 251 251 252 comp_window_xcb_connect_delete_event(w_xcb); 252 253 253 - if (ct->c->settings.fullscreen) 254 + if (ct->c->settings.fullscreen) { 254 255 comp_window_xcb_set_full_screen(w_xcb); 256 + } 255 257 256 258 xcb_map_window(w_xcb->connection, w_xcb->window); 257 259 ··· 306 308 307 309 uint32_t value_list = XCB_EVENT_MASK_STRUCTURE_NOTIFY; 308 310 309 - xcb_create_window(w->connection, XCB_COPY_FROM_PARENT, w->window, w->screen->root, x, y, width, height, 0, 310 - XCB_WINDOW_CLASS_INPUT_OUTPUT, w->screen->root_visual, XCB_CW_EVENT_MASK, &value_list); 311 + xcb_create_window( // 312 + w->connection, // conn 313 + XCB_COPY_FROM_PARENT, // depth 314 + w->window, // wid 315 + w->screen->root, // parent 316 + x, // x 317 + y, // y 318 + width, // width 319 + height, // height 320 + 0, // border_width 321 + XCB_WINDOW_CLASS_INPUT_OUTPUT, // _class 322 + w->screen->root_visual, // visual 323 + XCB_CW_EVENT_MASK, // value_mask 324 + &value_list); // value_list 311 325 } 312 326 313 327 static void