Skip to content

Commit 79f9f18

Browse files
committed
[Linux] implement destroy
The proposal is to force prevent_close=false and the close the window because calling `gtk_widget_destroy()` seems to be too intrusive: ** (window_manager_example:1388137): CRITICAL **: 21:09:18.736: gboolean fl_binary_messenger_send_response(FlBinaryMessenger *, FlBinaryMessengerResponseHandle *, GBytes *, GError **): assertion 'FL_IS_BINARY_MESSENGER(self)' failed
1 parent 75ae9d1 commit 79f9f18

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

linux/window_manager_plugin.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ static FlMethodResponse* set_as_frameless(WindowManagerPlugin* self,
7373
fl_method_success_response_new(fl_value_new_bool(true)));
7474
}
7575

76+
static FlMethodResponse* destroy(WindowManagerPlugin* self) {
77+
self->_is_prevent_close = false;
78+
gtk_window_close(get_window(self));
79+
return FL_METHOD_RESPONSE(
80+
fl_method_success_response_new(fl_value_new_bool(true)));
81+
}
82+
7683
static FlMethodResponse* close(WindowManagerPlugin* self) {
7784
gtk_window_close(get_window(self));
7885
return FL_METHOD_RESPONSE(
@@ -556,6 +563,8 @@ static void window_manager_plugin_handle_method_call(
556563
fl_method_success_response_new(fl_value_new_bool(true)));
557564
} else if (strcmp(method, "setAsFrameless") == 0) {
558565
response = set_as_frameless(self, args);
566+
} else if (strcmp(method, "destroy") == 0) {
567+
response = destroy(self);
559568
} else if (strcmp(method, "close") == 0) {
560569
response = close(self);
561570
} else if (strcmp(method, "setPreventClose") == 0) {

0 commit comments

Comments
 (0)