We add a new feature that the window is resized based on the ppu.
If a user sets the ppu value to window and requests to resize window by display server,
e adjusts the window's size according to the ppu value.
Change-Id: Idb7c3d77b9760ca60c4a3d57028af7e53ddb15bd
}
}
+static int
+_e_client_adjust_size_by_ppu(int size, int start_size, unsigned int ppu)
+{
+ if (ppu <= 1) return size;
+
+ unsigned int remainder = size % ppu;
+ if (remainder == 0) return size;
+
+ int gap = size - start_size;
+ int new_size = size;
+ if (gap > 0)
+ new_size = size + remainder;
+ else
+ new_size = size - remainder;
+
+ return new_size;
+}
+
+static int
+_e_client_adjust_position_by_ppu(int pos, int size, int prev_pos, int prev_size)
+{
+ int new_pos = 0;
+
+ if (prev_pos == pos)
+ new_pos = pos;
+ else
+ new_pos = (prev_pos + prev_size) - size;
+
+ return new_pos;
+}
+
+static void
+_e_client_adjust_geometry_by_resize_ppu(E_Client *ec)
+{
+ if (ec->manage_resize.unit_size <= 1) return;
+
+ ec->manage_resize.w = _e_client_adjust_size_by_ppu(ec->manage_resize.w, ec->w, ec->manage_resize.unit_size);
+ ec->manage_resize.h = _e_client_adjust_size_by_ppu(ec->manage_resize.h, ec->h, ec->manage_resize.unit_size);
+
+ ec->manage_resize.x = _e_client_adjust_position_by_ppu(ec->manage_resize.x, ec->manage_resize.w, ec->x, ec->w);
+ ec->manage_resize.y = _e_client_adjust_position_by_ppu(ec->manage_resize.y, ec->manage_resize.h, ec->y, ec->h);
+}
+
static int
_e_client_resize_end(E_Client *ec)
{
{
if (ec->manage_resize.resize_obj)
{
+ if (ec->manage_resize.unit_size > 1)
+ _e_client_adjust_geometry_by_resize_ppu(ec);
+
e_client_frame_geometry_set(ec,
ec->manage_resize.x,
ec->manage_resize.y,
_e_client_resize_object_create_cb = cb;
}
+E_API void
+e_client_resize_unit_size_set(E_Client *ec, unsigned int unit_size)
+{
+ if (!ec) return;
+
+ // FYI, we consider 0 and 1 to be the same value as a default unit size.
+ ec->manage_resize.unit_size = unit_size;
+}
+
EINTERN void
e_client_desk_zoom_enable_set(E_Client *ec, Eina_Bool enable)
{
Evas_Object *resize_obj;
float aw, ah;
int header_h, footer_h;
+ unsigned int unit_size;
} manage_resize;
Eina_Bool move_after_resize;
E_API E_Transient e_client_transient_policy_get(E_Client *ec);
E_API void e_client_resize_object_create_cb_set(E_Client_Resize_Object_Create_Cb cb);
+E_API void e_client_resize_unit_size_set(E_Client *ec, unsigned int unit_size);
EINTERN void e_client_desk_zoom_enable_set(E_Client *ec, Eina_Bool enable);
EINTERN Eina_Bool e_client_desk_zoom_enable_get(E_Client *ec);
}
}
+static void
+_e_info_client_proc_resize_ppu_set(int argc, char **argv)
+{
+ uint32_t ppu;
+
+ if (argc < 4)
+ {
+ printf("Error Check Args: enlightenment_info -resize_ppu window_ID value[0~32]\n");
+ return;
+ }
+
+ ppu = atoi(argv[3]);
+
+ if (!_e_info_client_eldbus_message_with_args("resize_ppu_set", NULL, "si", argv[2], ppu))
+ {
+ printf("_e_info_client_eldbus_message_with_args error");
+ return;
+ }
+}
+
typedef struct _ProcInfo
{
const char *option;
"Set input device's seat name",
_e_info_client_proc_input_seat_set
},
+ {
+ "resize_ppu",
+ "[windowID ppu_value]",
+ "Set resize ppu value",
+ _e_info_client_proc_resize_ppu_set
+ },
};
ProcInfo procs_to_input[] =
return reply;
}
+static Eldbus_Message *
+e_info_server_cb_resize_ppu_set(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+ Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+ unsigned long tmp = 0;
+ const char *win_id_str = NULL;
+ uint64_t win_id = 0;
+ Evas_Object *o = NULL;
+ E_Client *ec = NULL;
+ uint32_t ppu = 0;
+ Eina_Bool res = EINA_FALSE;
+
+ if (!eldbus_message_arguments_get(msg, "si", &win_id_str, &ppu))
+ {
+ ERR("Error getting arguments.");
+ return reply;
+ }
+
+ if (strlen(win_id_str) >= 2 && win_id_str[0] == '0' && win_id_str[1] == 'x')
+ res = e_util_string_to_ulong(win_id_str, &tmp, 16);
+ else
+ res = e_util_string_to_ulong(win_id_str, &tmp, 10);
+
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(res, reply);
+
+ win_id = (uint64_t)tmp;
+
+ for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
+ {
+ ec = evas_object_data_get(o, "E_Client");
+ Ecore_Window win;
+
+ if (!ec) continue;
+
+ win = e_client_util_win_get(ec);
+ if (win != win_id) continue;
+
+ e_client_resize_unit_size_set(ec, ppu);
+
+ break;
+ }
+
+ return reply;
+}
+
//{ "method_name", arguments_from_client, return_values_to_client, _method_cb, ELDBUS_METHOD_FLAG },
static const Eldbus_Method methods[] = {
{ "get_window_info", NULL, ELDBUS_ARGS({"iiiiisiiia("VALUE_TYPE_FOR_TOPVWINS")", "array of ec"}), _e_info_server_cb_window_info_get, 0 },
{ "zone_set", ELDBUS_ARGS({"si", "zone set"}), NULL, _e_info_server_cb_zone_set, 0 },
{ "input_output_set", ELDBUS_ARGS({"ss", "set input device's output name"}), NULL, _e_info_server_cb_input_output_set, 0 },
{ "input_seat_set", ELDBUS_ARGS({"ss", "set input device's seat"}), NULL, _e_info_server_cb_input_seat_set, 0 },
+ { "resize_ppu_set", ELDBUS_ARGS({"si", "set resize ppu"}), NULL, e_info_server_cb_resize_ppu_set, 0},
{ NULL, NULL, NULL, NULL, 0 }
};