simulate netwm sync for xwl clients
blocks execution of resizes until the surface commit arrives. reduces the race condition between resize and render and eliminates frame drops during slow resizes
This commit is contained in:
parent
1c0a0ab00f
commit
17e878eca3
|
@ -1146,7 +1146,35 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
|
||||||
ec->comp_data->shell.configure(ec->comp_data->shell.surface,
|
ec->comp_data->shell.configure(ec->comp_data->shell.surface,
|
||||||
x, y, state->bw, state->bh);
|
x, y, state->bw, state->bh);
|
||||||
else
|
else
|
||||||
e_client_util_move_resize_without_frame(ec, x, y, state->bw, state->bh);
|
{
|
||||||
|
if (ec->netwm.sync.wait)
|
||||||
|
{
|
||||||
|
E_Client_Pending_Resize *pnd = NULL;
|
||||||
|
|
||||||
|
ec->netwm.sync.wait--;
|
||||||
|
|
||||||
|
/* skip pending for which we didn't get a reply */
|
||||||
|
while (ec->pending_resize)
|
||||||
|
{
|
||||||
|
pnd = eina_list_data_get(ec->pending_resize);
|
||||||
|
ec->pending_resize = eina_list_remove(ec->pending_resize, pnd);
|
||||||
|
|
||||||
|
if ((state->bw == pnd->w) && (state->bh == pnd->h))
|
||||||
|
break;
|
||||||
|
|
||||||
|
E_FREE(pnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pnd)
|
||||||
|
{
|
||||||
|
e_comp_object_frame_wh_adjust(ec->frame, pnd->w, pnd->h, &ec->w, &ec->h);
|
||||||
|
E_FREE(pnd);
|
||||||
|
}
|
||||||
|
ecore_evas_pointer_xy_get(e_comp->ee, &ec->mouse.current.mx, &ec->mouse.current.my);
|
||||||
|
ec->netwm.sync.send_time = ecore_loop_time_get();
|
||||||
|
}
|
||||||
|
e_client_util_move_resize_without_frame(ec, x, y, state->bw, state->bh);
|
||||||
|
}
|
||||||
|
|
||||||
if (ec->new_client)
|
if (ec->new_client)
|
||||||
ec->placed = placed;
|
ec->placed = placed;
|
||||||
|
|
|
@ -4460,10 +4460,12 @@ static void
|
||||||
_e_comp_x_hook_client_resize_end(void *d EINA_UNUSED, E_Client *ec)
|
_e_comp_x_hook_client_resize_end(void *d EINA_UNUSED, E_Client *ec)
|
||||||
{
|
{
|
||||||
E_COMP_X_PIXMAP_CHECK;
|
E_COMP_X_PIXMAP_CHECK;
|
||||||
if (!_e_comp_x_client_data_get(ec)->alarm) return;
|
if (_e_comp_x_client_data_get(ec)->alarm)
|
||||||
eina_hash_del_by_key(alarm_hash, &_e_comp_x_client_data_get(ec)->alarm);
|
{
|
||||||
ecore_x_sync_alarm_free(_e_comp_x_client_data_get(ec)->alarm);
|
eina_hash_del_by_key(alarm_hash, &_e_comp_x_client_data_get(ec)->alarm);
|
||||||
_e_comp_x_client_data_get(ec)->alarm = 0;
|
ecore_x_sync_alarm_free(_e_comp_x_client_data_get(ec)->alarm);
|
||||||
|
_e_comp_x_client_data_get(ec)->alarm = 0;
|
||||||
|
}
|
||||||
ec->netwm.sync.alarm = 0;
|
ec->netwm.sync.alarm = 0;
|
||||||
/* resize to last geometry if sync alarm for it was not yet handled */
|
/* resize to last geometry if sync alarm for it was not yet handled */
|
||||||
if (ec->pending_resize)
|
if (ec->pending_resize)
|
||||||
|
@ -4480,9 +4482,12 @@ static void
|
||||||
_e_comp_x_hook_client_resize_begin(void *d EINA_UNUSED, E_Client *ec)
|
_e_comp_x_hook_client_resize_begin(void *d EINA_UNUSED, E_Client *ec)
|
||||||
{
|
{
|
||||||
E_COMP_X_PIXMAP_CHECK;
|
E_COMP_X_PIXMAP_CHECK;
|
||||||
if ((!ec->netwm.sync.request) || (e_comp->comp_type != E_PIXMAP_TYPE_X)) return;
|
if (!ec->netwm.sync.request) return;
|
||||||
_e_comp_x_client_data_get(ec)->alarm = ecore_x_sync_alarm_new(_e_comp_x_client_data_get(ec)->sync_counter);
|
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
|
||||||
eina_hash_add(alarm_hash, &_e_comp_x_client_data_get(ec)->alarm, ec);
|
{
|
||||||
|
_e_comp_x_client_data_get(ec)->alarm = ecore_x_sync_alarm_new(_e_comp_x_client_data_get(ec)->sync_counter);
|
||||||
|
eina_hash_add(alarm_hash, &_e_comp_x_client_data_get(ec)->alarm, ec);
|
||||||
|
}
|
||||||
ec->netwm.sync.alarm = ec->netwm.sync.serial = 1;
|
ec->netwm.sync.alarm = ec->netwm.sync.serial = 1;
|
||||||
ec->netwm.sync.wait = 0;
|
ec->netwm.sync.wait = 0;
|
||||||
ec->netwm.sync.send_time = ecore_loop_time_get();
|
ec->netwm.sync.send_time = ecore_loop_time_get();
|
||||||
|
@ -5290,8 +5295,9 @@ e_comp_x_init(void)
|
||||||
_e_comp_x_move_resize_request, NULL);
|
_e_comp_x_move_resize_request, NULL);
|
||||||
E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_DESKTOP_CHANGE,
|
E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_DESKTOP_CHANGE,
|
||||||
_e_comp_x_desktop_change, NULL);
|
_e_comp_x_desktop_change, NULL);
|
||||||
E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_SYNC_ALARM,
|
if (e_comp->comp_type != E_PIXMAP_TYPE_WL)
|
||||||
_e_comp_x_sync_alarm, NULL);
|
E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_SYNC_ALARM,
|
||||||
|
_e_comp_x_sync_alarm, NULL);
|
||||||
|
|
||||||
E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_DOWN,
|
E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_DOWN,
|
||||||
_e_comp_x_mouse_down, NULL);
|
_e_comp_x_mouse_down, NULL);
|
||||||
|
@ -5434,6 +5440,7 @@ e_comp_x_xwayland_client_setup(E_Client *ec, E_Client *wc)
|
||||||
wc->w = ec->w, wc->h = ec->h;
|
wc->w = ec->w, wc->h = ec->h;
|
||||||
wc->client.w = ec->client.w, wc->client.h = ec->client.h;
|
wc->client.w = ec->client.w, wc->client.h = ec->client.h;
|
||||||
wc->layer = ec->layer;
|
wc->layer = ec->layer;
|
||||||
|
wc->netwm.sync.request = 1;
|
||||||
evas_object_layer_set(wc->frame, evas_object_layer_get(ec->frame));
|
evas_object_layer_set(wc->frame, evas_object_layer_get(ec->frame));
|
||||||
evas_object_geometry_set(wc->frame, ec->x, ec->y, ec->w, ec->h);
|
evas_object_geometry_set(wc->frame, ec->x, ec->y, ec->w, ec->h);
|
||||||
evas_object_show(wc->frame);
|
evas_object_show(wc->frame);
|
||||||
|
|
Loading…
Reference in New Issue