res = _e_info_client_eldbus_message_with_args("filter",
_e_info_client_cb_filter,
- "is",
+ "sis",
+ "0x0",
onoff,
argv[2]);
if (!res) printf("Error occured while sending message\n\n");
return;
}
+ else if (argc == 5)
+ {
+ EINA_SAFETY_ON_FALSE_GOTO((!strcmp(argv[3], "blur")) ||
+ (!strcmp(argv[3], "grayscale")) ||
+ (!strcmp(argv[3], "inverse_color")), usage);
+ EINA_SAFETY_ON_FALSE_GOTO((!strcmp(argv[4], "on")) ||
+ (!strcmp(argv[4], "off")) ||
+ (!strcmp(argv[4], "1")) ||
+ (!strcmp(argv[4], "0")), usage);
+
+ if (!strcmp(argv[4], "on") || !strcmp(argv[4], "1")) onoff = 1;
+ else onoff = 0;
+
+ res = _e_info_client_eldbus_message_with_args("filter",
+ _e_info_client_cb_filter,
+ "sis",
+ argv[2],
+ onoff,
+ argv[3]);
+ if (!res) printf("Error occured while sending message\n\n");
+ return;
+ }
usage:
printf("Usage: %s", USAGE_FILTER);
{
Eldbus_Message *reply;
int onoff = -1;
- const char *filter_name = NULL;
+ const char *filter_name = NULL, *win_str = NULL;
char msg_to_client[125] = {0};
+ unsigned long tmp = 0;
+ uint64_t win_number = 0;
+ Evas_Object *o;
+ E_Client *ec;
+ Ecore_Window win;
+ Eina_Bool res;
- if (!eldbus_message_arguments_get(msg, "is", &onoff, &filter_name))
+ if (!eldbus_message_arguments_get(msg, "sis", &win_str, &onoff, &filter_name))
{
return eldbus_message_error_new(msg, GET_CALL_MSG_ARG_ERR,
"filetr: failed to get arguments from method call message");
}
reply = eldbus_message_method_return_new(msg);
+ if (strlen(win_str) >= 2 && win_str[0] == '0' && win_str[1] == 'x')
+ res = e_util_string_to_ulong(win_str, &tmp, 16);
+ else
+ res = e_util_string_to_ulong(win_str, &tmp, 10);
+
+ if (!res)
+ {
+ snprintf(msg_to_client, sizeof(msg_to_client), "Invalid window id: %s\n", win_str);
+ goto reply;
+ }
+
+ win_number = (uint64_t)tmp;
+
+ if (win_number != 0x0)
+ {
+ for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
+ {
+ ec = evas_object_data_get(o, "E_Client");
+ if (!ec) continue;
+ win = e_client_util_win_get(ec);
+ if (win != win_number) continue;
+
+ if (onoff == 0)
+ {
+ e_comp_object_image_filter_set(ec->frame, E_COMP_IMAGE_FILTER_NONE);
+ snprintf(msg_to_client, sizeof(msg_to_client), "%s window filter has been unset.\n", win_str);
+ }
+ else
+ {
+ if (!strcmp(filter_name, "blur"))
+ {
+ e_comp_object_image_filter_set(ec->frame, E_COMP_IMAGE_FILTER_BLUR);
+ snprintf(msg_to_client, sizeof(msg_to_client), "%s window filter %s is set!", win_str, filter_name);
+ }
+ else if (!strcmp(filter_name, "grayscale"))
+ {
+ e_comp_object_image_filter_set(ec->frame, E_COMP_IMAGE_FILTER_GRAYSCALE);
+ snprintf(msg_to_client, sizeof(msg_to_client), "%s window filter %s is set!", win_str, filter_name);
+ }
+ else if (!strcmp(filter_name, "inverse_color"))
+ {
+ e_comp_object_image_filter_set(ec->frame, E_COMP_IMAGE_FILTER_INVERSE);
+ snprintf(msg_to_client, sizeof(msg_to_client), "%s window filter %s is set!", win_str, filter_name);
+ }
+ else
+ {
+ e_comp_object_image_filter_set(ec->frame, E_COMP_IMAGE_FILTER_NONE);
+ snprintf(msg_to_client, sizeof(msg_to_client), "%s window filter %s is NOT supported!", win_str, filter_name);
+ }
+ }
+
+ e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
+ e_comp_object_dirty(ec->frame);
+ e_comp_object_render(ec->frame);
+
+ goto reply;
+ }
+ snprintf(msg_to_client, sizeof(msg_to_client), "Invalid window id: %s\n", win_str);
+ goto reply;
+ }
+
if (onoff == -1)
{
char current_filter[15] = {0};
"Filter %s is set!\n", filter_name);
}
+reply:
eldbus_message_arguments_append(reply, "s", msg_to_client);
return reply;
{ "init_device", ELDBUS_ARGS({"us", "device information"}), ELDBUS_ARGS({"s", "result message"}), _e_info_server_cb_init_device, 0},
{ "deinit_device", NULL, NULL, _e_info_server_cb_deinit_device, 0},
{ "keygen", ELDBUS_ARGS({"sii", "key information"}), ELDBUS_ARGS({"s", "result message"}), _e_info_server_cb_keygen, 0},
- { "filter", ELDBUS_ARGS({"is", "on(1)/off(0), filter name"}), ELDBUS_ARGS({"s", "result of request"}), _e_info_server_cb_filter, 0},
+ { "filter", ELDBUS_ARGS({"sis", "win_id, on(1)/off(0), filter name"}), ELDBUS_ARGS({"s", "result of request"}), _e_info_server_cb_filter, 0},
{ NULL, NULL, NULL, NULL, 0 }
};