Skip to content

Commit f8ed4f8

Browse files
committed
Update window destruction to use hide and destroy APIs
Replaces window destruction via manager with direct calls to native_window_destroy and native_window_hide. This change improves resource cleanup and aligns with updated API usage in both C API bindings and example code.
1 parent bc0136f commit f8ed4f8

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

.cursor/rules/c-api-bindings.mdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ int main() {
542542

543543
// Cleanup
544544
native_window_manager_unregister_event_callback(callback_id);
545-
native_window_manager_destroy(window->GetId());
545+
native_window_destroy(window);
546546

547547
return 0;
548548
}

examples/window_c_example/main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,10 @@ void on_auto_theme_clicked(const void* event, void* user_data) {
149149

150150
void on_exit_clicked(const void* event, void* user_data) {
151151
printf("Exit clicked from context menu\n");
152-
// Get all windows and destroy them to trigger app exit
152+
// Hide all windows to trigger app exit
153153
native_window_list_t windows = native_window_manager_get_all();
154154
for (long i = 0; i < windows.count; i++) {
155-
native_window_id_t window_id = native_window_get_id(windows.windows[i]);
156-
native_window_manager_destroy(window_id);
155+
native_window_hide(windows.windows[i]);
157156
}
158157
native_window_list_free(&windows);
159158
}

0 commit comments

Comments
 (0)