move wl E_Client creation to same place as E_Pixmap creation

ensure that surface manipulation functions will succeed even with no shell surface
This commit is contained in:
Mike Blumenkrantz 2015-03-30 12:13:04 -04:00
parent 73abc46c61
commit 617c2d96ff
3 changed files with 28 additions and 46 deletions

View File

@ -1362,6 +1362,7 @@ _e_comp_wl_compositor_cb_surface_create(struct wl_client *client, struct wl_reso
{
struct wl_resource *res;
E_Pixmap *ep;
E_Client *ec;
uint64_t win;
pid_t pid;
@ -1392,9 +1393,14 @@ _e_comp_wl_compositor_cb_surface_create(struct wl_client *client, struct wl_reso
wl_client_post_no_memory(client);
return;
}
DBG("\tUsing Pixmap: %p", ep);
ec = e_client_new(ep, 0, 0);
ec->new_client = 0;
e_comp->new_clients--;
ec->client.w = ec->client.h = 1;
ec->ignored = 1;
/* set reference to pixmap so we can fetch it later */
wl_resource_set_user_data(res, ep);

View File

@ -34,6 +34,7 @@ _e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resou
pid_t pid;
E_Client *ec;
uint64_t sid;
Eina_List *l;
Eina_Bool got_mouse = EINA_FALSE;
/* get compositor data */
@ -56,20 +57,19 @@ _e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resou
}
wl_client_get_credentials(client, &pid, NULL, NULL);
sid = e_comp_wl_id_get(wl_resource_get_id(surface_resource), pid);
if (!(ec = e_pixmap_find_client(E_PIXMAP_TYPE_WL, sid)))
ec = e_pixmap_find_client(E_PIXMAP_TYPE_WL, sid);
if (!ec->re_manage)
{
Eina_List *l;
ec->re_manage = 1;
ec->ignored = 0;
ec = e_client_new(e_pixmap_new(E_PIXMAP_TYPE_WL, sid), 1, 0);
ec->lock_focus_out = ec->layer_block = ec->visible = ec->override = 1;
ec->new_client = 0;
e_comp->new_clients--;
ec->icccm.title = eina_stringshare_add("noshadow");
evas_object_pass_events_set(ec->frame, 1);
ec->client.w = ec->client.h = 1;
l = e_client_focus_stack_get();
e_client_focus_stack_set(eina_list_remove(l, ec));
e_client_focus_stack_set(eina_list_remove(e_client_focus_stack_get(), ec));
EC_CHANGED(ec);
}
/* ignore cursor changes during resize/move I guess */
if (e_client_action_get()) return;
e_pointer_object_set(e_comp->pointer, ec->frame, x, y);

View File

@ -566,16 +566,10 @@ _e_shell_cb_shell_surface_get(struct wl_client *client, struct wl_resource *reso
/* find the client for this pixmap */
ec = e_pixmap_client_get(ep);
if (ec && (!ec->internal))
e_pixmap_ref(ec->pixmap);
else if ((!ec) && (!(ec = e_client_new(ep, 0, 0))))
{
wl_resource_post_error(surface_resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
"No Client For Pixmap");
return;
}
ec->netwm.ping = EINA_TRUE;
EC_CHANGED(ec);
ec->new_client = ec->netwm.ping = EINA_TRUE;
e_comp->new_clients++;
ec->ignored = 0;
/* get the client data */
if (!(cdata = ec->comp_data))
@ -1008,7 +1002,6 @@ static void
_e_xdg_shell_surface_configure(struct wl_resource *resource, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
{
E_Client *ec;
Eina_Bool new_client;
/* DBG("XDG_SHELL: Surface Configure: %d \t%d %d %d %d", */
/* wl_resource_get_id(resource), x, y, w, h); */
@ -1033,11 +1026,7 @@ _e_xdg_shell_surface_configure(struct wl_resource *resource, Evas_Coord x, Evas_
}
}
/* ensure resize succeeds */
new_client = ec->new_client;
ec->new_client = 0;
e_client_util_move_resize_without_frame(ec, x, y, w, h);
ec->new_client = new_client;
/* TODO: ack configure ?? */
}
@ -1141,17 +1130,10 @@ _e_xdg_shell_cb_surface_get(struct wl_client *client, struct wl_resource *resour
/* find the client for this pixmap */
ec = e_pixmap_client_get(ep);
if (ec && (!ec->internal))
e_pixmap_ref(ec->pixmap);
else if ((!ec) && (!(ec = e_client_new(ep, 0, 0))))
{
wl_resource_post_error(surface_resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
"No Client For Pixmap");
return;
}
ec->netwm.ping = EINA_TRUE;
EC_CHANGED(ec);
ec->new_client = ec->netwm.ping = EINA_TRUE;
e_comp->new_clients++;
ec->ignored = 0;
/* get the client data */
if (!(cdata = ec->comp_data))
@ -1240,16 +1222,6 @@ _e_xdg_shell_cb_popup_get(struct wl_client *client, struct wl_resource *resource
/* find the client for this pixmap */
ec = e_pixmap_client_get(ep);
if (ec && (!ec->internal))
e_pixmap_ref(ec->pixmap);
else if ((!ec) && (!(ec = e_client_new(ep, 0, 0))))
{
wl_resource_post_error(surface_resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
"No Client For Pixmap");
return;
}
/* get the client data */
if (!(cdata = ec->comp_data))
{
@ -1296,7 +1268,11 @@ _e_xdg_shell_cb_popup_get(struct wl_client *client, struct wl_resource *resource
cdata->shell.map = _e_xdg_shell_surface_map;
cdata->shell.unmap = _e_xdg_shell_surface_unmap;
ec->override = 1;
EC_CHANGED(ec);
ec->new_client = ec->override = 1;
ec->ignored = 0;
e_comp->new_clients++;
e_client_focus_stack_set(eina_list_remove(e_client_focus_stack_get(), ec));
if (!ec->internal)
ec->borderless = !ec->internal_elm_win;
ec->lock_border = EINA_TRUE;