add window maximize animation

this has been implemented and working well in desksanity for a couple years,
and it's a trivial thing to bring over now that efx is available
This commit is contained in:
Mike Blumenkrantz 2016-03-08 18:04:31 -05:00
parent aa024e0a4f
commit d44de2e192
4 changed files with 113 additions and 27 deletions

View File

@ -1544,11 +1544,18 @@ _e_client_cb_evas_restack(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA
////////////////////////////////////////////////
static void
_e_client_maximize_done(void *data, E_Efx_Map_Data *emd EINA_UNUSED, Evas_Object *obj EINA_UNUSED)
{
E_Client *ec = data;
ec->maximize_override = 0;
}
static void
_e_client_maximize(E_Client *ec, E_Maximize max)
{
int x1, yy1, x2, y2;
int w, h, pw, ph;
int x, y, w, h, pw, ph;
int zx, zy, zw, zh;
int ecx, ecy, ecw, ech;
Eina_Bool override = ec->maximize_override;
@ -1577,25 +1584,30 @@ _e_client_maximize(E_Client *ec, E_Maximize max)
switch (max & E_MAXIMIZE_DIRECTION)
{
case E_MAXIMIZE_BOTH:
evas_object_geometry_set(ec->frame, x1, yy1, w, h);
x = x1, y = yy1;
break;
case E_MAXIMIZE_VERTICAL:
evas_object_geometry_set(ec->frame, ec->x, yy1, ec->w, h);
x = ec->x, y = yy1, w = ec->w;
break;
case E_MAXIMIZE_HORIZONTAL:
evas_object_geometry_set(ec->frame, x1, ec->y, w, ec->h);
x = x1, y = ec->y, h = ec->h;
break;
case E_MAXIMIZE_LEFT:
evas_object_geometry_set(ec->frame, ec->zone->x, ec->zone->y, w / 2, h);
x = ec->zone->x, y = ec->zone->y, w /= 2;
break;
case E_MAXIMIZE_RIGHT:
evas_object_geometry_set(ec->frame, x1, ec->zone->y, w / 2, h);
x = x1, y = ec->zone->y, w /= 2;
break;
}
if (e_config->window_maximize_animate && (!starting) && (!ec->changes.need_maximize))
e_efx_resize(ec->frame, e_config->window_maximize_transition, E_EFX_POINT(x, y),
w, h, e_config->window_maximize_time, _e_client_maximize_done, ec);
else
evas_object_geometry_set(ec->frame, x, y, w, h);
break;
case E_MAXIMIZE_SMART:
@ -1642,26 +1654,30 @@ _e_client_maximize(E_Client *ec, E_Maximize max)
switch (max & E_MAXIMIZE_DIRECTION)
{
case E_MAXIMIZE_BOTH:
evas_object_geometry_set(ec->frame, zx, zy, zw, zh);
x = zx, y = zy, w = zw, h = zh;
break;
case E_MAXIMIZE_VERTICAL:
evas_object_geometry_set(ec->frame, ec->x, zy, ec->w, zh);
x = ec->x, y = zy, w = ec->w, h = zh;
break;
case E_MAXIMIZE_HORIZONTAL:
evas_object_geometry_set(ec->frame, zx, ec->y, zw, ec->h);
x = zx, y = ec->y, w = zw, h = ec->h;
break;
case E_MAXIMIZE_LEFT:
evas_object_geometry_set(ec->frame, zx, zy, zw / 2, zh);
x = zx, y = zy, w = zw / 2, h = zh;
break;
case E_MAXIMIZE_RIGHT:
evas_object_geometry_set(ec->frame, zx + zw / 2, zy, zw / 2, zh);
x = zx + zw / 2, y = zy, w = zw / 2, h = zh;
break;
}
if (e_config->window_maximize_animate && (!starting) && (!ec->changes.need_maximize))
e_efx_resize(ec->frame, e_config->window_maximize_transition, E_EFX_POINT(x, y),
w, h, e_config->window_maximize_time, _e_client_maximize_done, ec);
else
evas_object_geometry_set(ec->frame, x, y, w, h);
break;
case E_MAXIMIZE_FILL:
@ -1689,28 +1705,33 @@ _e_client_maximize(E_Client *ec, E_Maximize max)
switch (max & E_MAXIMIZE_DIRECTION)
{
case E_MAXIMIZE_BOTH:
evas_object_geometry_set(ec->frame, x1, yy1, w, h);
x = x1, y = yy1;
break;
case E_MAXIMIZE_VERTICAL:
evas_object_geometry_set(ec->frame, ec->x, yy1, ec->w, h);
x = ec->x, y = yy1, w = ec->w;
break;
case E_MAXIMIZE_HORIZONTAL:
evas_object_geometry_set(ec->frame, x1, ec->y, w, ec->h);
x = x1, y = ec->y, h = ec->h;
break;
case E_MAXIMIZE_LEFT:
evas_object_geometry_set(ec->frame, ec->zone->x, ec->zone->y, w / 2, h);
x = ec->zone->x, y = ec->zone->y, w /= 2;
break;
case E_MAXIMIZE_RIGHT:
evas_object_geometry_set(ec->frame, x1, ec->zone->y, w / 2, h);
x = x1, y = ec->zone->y, w /= 2;
break;
}
if (e_config->window_maximize_animate && (!starting) && (!ec->changes.need_maximize))
e_efx_resize(ec->frame, e_config->window_maximize_transition, E_EFX_POINT(x, y),
w, h, e_config->window_maximize_time, _e_client_maximize_done, ec);
else
evas_object_geometry_set(ec->frame, x, y, w, h);
break;
}
if (ec->maximize_override)
if (ec->maximize_override && (starting || ec->changes.need_maximize || (!e_config->window_maximize_animate)))
ec->maximize_override = override;
}
@ -3868,17 +3889,19 @@ e_client_unmaximize(E_Client *ec, E_Maximize max)
{
ec->maximized = E_MAXIMIZE_NONE;
_e_client_frame_update(ec);
evas_object_smart_callback_call(ec->frame, "unmaximize", NULL);
e_client_resize_limit(ec, &w, &h);
e_client_util_move_resize_without_frame(ec, x, y, w, h);
e_hints_window_size_unset(ec);
}
else if (e_config->window_maximize_animate)
ec->maximize_override = 1;
evas_object_smart_callback_call(ec->frame, "unmaximize", NULL);
e_client_resize_limit(ec, &w, &h);
e_comp_object_frame_xy_adjust(ec->frame, x, y, &x, &y);
e_comp_object_frame_wh_adjust(ec->frame, w, h, &w, &h);
if (e_config->window_maximize_animate && (!starting))
e_efx_resize(ec->frame, e_config->window_maximize_transition, E_EFX_POINT(x, y),
w, h, e_config->window_maximize_time, _e_client_maximize_done, ec);
else
{
evas_object_smart_callback_call(ec->frame, "unmaximize", NULL);
e_client_resize_limit(ec, &w, &h);
e_client_util_move_resize_without_frame(ec, x, y, w, h);
}
evas_object_geometry_set(ec->frame, x, y, w, h);
if (vert)
ec->saved.h = ec->saved.y = 0;
if (horiz)

View File

@ -469,6 +469,9 @@ _e_config_edd_init(Eina_Bool old)
E_CONFIG_VAL(D, T, menus_scroll_speed, DOUBLE); /**/
E_CONFIG_VAL(D, T, menus_fast_mouse_move_threshhold, DOUBLE); /**/
E_CONFIG_VAL(D, T, menus_click_drag_timeout, DOUBLE); /**/
E_CONFIG_VAL(D, T, window_maximize_animate, INT); /**/
E_CONFIG_VAL(D, T, window_maximize_transition, INT); /**/
E_CONFIG_VAL(D, T, window_maximize_time, DOUBLE); /**/
E_CONFIG_VAL(D, T, border_shade_animate, INT); /**/
E_CONFIG_VAL(D, T, border_shade_transition, INT); /**/
E_CONFIG_VAL(D, T, border_shade_speed, DOUBLE); /**/
@ -1432,6 +1435,15 @@ e_config_load(void)
}
}
}
CONFIG_VERSION_CHECK(21)
{
CONFIG_VERSION_UPDATE_INFO(21);
e_config->window_maximize_animate = 1;
e_config->window_maximize_transition = E_EFX_EFFECT_SPEED_SINUSOIDAL;
e_config->window_maximize_time = 0.15;
}
}
if (!e_config->remember_internal_fm_windows)
e_config->remember_internal_fm_windows = !!(e_config->remember_internal_windows & E_REMEMBER_INTERNAL_FM_WINS);
@ -1444,6 +1456,9 @@ e_config_load(void)
E_CONFIG_LIMIT(e_config->show_splash, 0, 1);
E_CONFIG_LIMIT(e_config->menus_fast_mouse_move_threshhold, 1.0, 2000.0);
E_CONFIG_LIMIT(e_config->menus_click_drag_timeout, 0.0, 10.0);
E_CONFIG_LIMIT(e_config->window_maximize_animate, 0, 1);
E_CONFIG_LIMIT(e_config->window_maximize_transition, 0, E_EFX_EFFECT_SPEED_SINUSOIDAL);
E_CONFIG_LIMIT(e_config->window_maximize_time, 0.0, 1.0);
E_CONFIG_LIMIT(e_config->border_shade_animate, 0, 1);
E_CONFIG_LIMIT(e_config->border_shade_transition, 0, 8);
E_CONFIG_LIMIT(e_config->border_shade_speed, 1.0, 20000.0);

View File

@ -46,7 +46,7 @@ typedef enum
/* increment this whenever a new set of config values are added but the users
* config doesn't need to be wiped - simply new values need to be put in
*/
#define E_CONFIG_FILE_GENERATION 20
#define E_CONFIG_FILE_GENERATION 21
#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH * 1000000) + E_CONFIG_FILE_GENERATION)
#define E_CONFIG_BINDINGS_VERSION 0 // DO NOT INCREMENT UNLESS YOU WANT TO WIPE ALL BINDINGS!!!!!
@ -63,6 +63,9 @@ struct _E_Config
double menus_scroll_speed; // GUI
double menus_fast_mouse_move_threshhold; // GUI
double menus_click_drag_timeout; // GUI
int window_maximize_animate; // GUI
int window_maximize_transition; // GUI
double window_maximize_time; // GUI
int border_shade_animate; // GUI
int border_shade_transition; // GUI
double border_shade_speed; // GUI

View File

@ -12,6 +12,9 @@ struct _E_Config_Dialog_Data
int move_info_follows;
int resize_info_visible;
int resize_info_follows;
int window_maximize_animate;
int window_maximize_transition;
double window_maximize_time;
int border_shade_animate;
int border_shade_transition;
double border_shade_speed;
@ -67,6 +70,10 @@ _create_data(E_Config_Dialog *cfd EINA_UNUSED)
cfdata->screen_limits = e_config->screen_limits;
cfdata->window_maximize_animate = e_config->window_maximize_animate;
cfdata->window_maximize_transition = e_config->window_maximize_transition;
cfdata->window_maximize_time = e_config->window_maximize_time;
cfdata->border_shade_animate = e_config->border_shade_animate;
cfdata->border_shade_transition = e_config->border_shade_transition;
cfdata->border_shade_speed = e_config->border_shade_speed;
@ -89,6 +96,9 @@ _basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
e_config->move_info_follows = cfdata->move_info_follows;
e_config->resize_info_visible = cfdata->resize_info_visible;
e_config->resize_info_follows = cfdata->resize_info_follows;
e_config->window_maximize_animate = cfdata->window_maximize_animate;
e_config->window_maximize_transition = cfdata->window_maximize_transition;
e_config->window_maximize_time = cfdata->window_maximize_time;
e_config->border_shade_animate = cfdata->border_shade_animate;
e_config->border_shade_transition = cfdata->border_shade_transition;
e_config->border_shade_speed = cfdata->border_shade_speed;
@ -112,6 +122,9 @@ _basic_check_changed(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfd
(e_config->border_shade_animate != cfdata->border_shade_animate) ||
(e_config->border_shade_transition != cfdata->border_shade_transition) ||
(e_config->border_shade_speed != cfdata->border_shade_speed) ||
(e_config->window_maximize_animate != cfdata->window_maximize_animate) ||
(e_config->window_maximize_transition != cfdata->window_maximize_transition) ||
(!dblequal(e_config->window_maximize_time, cfdata->window_maximize_time)) ||
(e_config->use_app_icon != cfdata->use_app_icon) ||
(e_config->desk_auto_switch != cfdata->desk_auto_switch) ||
(e_config->screen_limits != cfdata->screen_limits);
@ -238,6 +251,38 @@ _basic_create(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dialog_Data
e_widget_toolbook_page_append(otb, NULL, _("Shading"), ol,
1, 0, 1, 0, 0.5, 0.0);
/* Shading */
ol = e_widget_list_add(evas, 0, 0);
oc = e_widget_check_add(evas, _("Animate"),
&(cfdata->window_maximize_animate));
e_widget_list_object_append(ol, oc, 1, 1, 0.5);
ow = e_widget_slider_add(evas, 1, 0, _("%1.2f seconds"),
0.0, 1.0, 0.05, 0,
&(cfdata->window_maximize_time), NULL, 100);
e_widget_check_widget_disable_on_unchecked_add(oc, ow);
e_widget_list_object_append(ol, ow, 1, 1, 0.5);
rg = e_widget_radio_group_new(&(cfdata->border_shade_transition));
ow = e_widget_radio_add(evas, _("Linear"), E_EFX_EFFECT_SPEED_LINEAR, rg);
e_widget_check_widget_disable_on_unchecked_add(oc, ow);
e_widget_list_object_append(ol, ow, 1, 1, 0.5);
ow = e_widget_radio_add(evas, _("Accelerate"), E_EFX_EFFECT_SPEED_ACCELERATE, rg);
e_widget_check_widget_disable_on_unchecked_add(oc, ow);
e_widget_list_object_append(ol, ow, 1, 1, 0.5);
ow = e_widget_radio_add(evas, _("Decelerate"), E_EFX_EFFECT_SPEED_DECELERATE, rg);
e_widget_check_widget_disable_on_unchecked_add(oc, ow);
e_widget_list_object_append(ol, ow, 1, 1, 0.5);
ow = e_widget_radio_add(evas, _("Accelerate, then decelerate"), E_EFX_EFFECT_SPEED_SINUSOIDAL, rg);
e_widget_check_widget_disable_on_unchecked_add(oc, ow);
e_widget_list_object_append(ol, ow, 1, 1, 0.5);
e_widget_toolbook_page_append(otb, NULL, _("Maximizing"), ol,
1, 0, 1, 0, 0.5, 0.0);
/* Screen Limits */
ol = e_widget_list_add(evas, 0, 0);