Skip to content

Commit fdb1a99

Browse files
authored
Merge pull request #157 from jpnurmi/opacity
[Linux] implement get/SetOpacity
2 parents deab7e8 + 8099704 commit fdb1a99

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

linux/window_manager_plugin.cc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,16 @@ static FlMethodResponse* set_skip_taskbar(WindowManagerPlugin* self,
421421
}
422422

423423
static FlMethodResponse* get_opacity(WindowManagerPlugin* self) {
424+
gdouble opacity = gtk_widget_get_opacity(GTK_WIDGET(get_window(self)));
424425
return FL_METHOD_RESPONSE(
425-
fl_method_success_response_new(fl_value_new_float(1)));
426+
fl_method_success_response_new(fl_value_new_float(opacity)));
427+
}
428+
429+
static FlMethodResponse* set_opacity(WindowManagerPlugin* self, FlValue* args) {
430+
gdouble opacity = fl_value_get_float(fl_value_lookup_string(args, "opacity"));
431+
gtk_widget_set_opacity(GTK_WIDGET(get_window(self)), opacity);
432+
return FL_METHOD_RESPONSE(
433+
fl_method_success_response_new(fl_value_new_bool(true)));
426434
}
427435

428436
static FlMethodResponse* pop_up_window_menu(WindowManagerPlugin* self) {
@@ -619,6 +627,8 @@ static void window_manager_plugin_handle_method_call(
619627
response = set_skip_taskbar(self, args);
620628
} else if (strcmp(method, "getOpacity") == 0) {
621629
response = get_opacity(self);
630+
} else if (strcmp(method, "setOpacity") == 0) {
631+
response = set_opacity(self, args);
622632
} else if (strcmp(method, "popUpWindowMenu") == 0) {
623633
response = pop_up_window_menu(self);
624634
} else if (strcmp(method, "startDragging") == 0) {

0 commit comments

Comments
 (0)