add wl surface -> e_border mapping

This commit is contained in:
Mike Blumenkrantz 2013-09-11 09:01:18 +01:00
parent 3b539d4a0f
commit bdd0bc624d
4 changed files with 49 additions and 1 deletions

View File

@ -1,4 +1,7 @@
#include "e.h"
#ifdef HAVE_WAYLAND_CLIENTS
#include "e_comp_wl.h"
#endif
//#define INOUTDEBUG_MOUSE 1
//#define INOUTDEBUG_FOCUS 1
@ -3207,6 +3210,10 @@ e_border_find_by_client_window(Ecore_X_Window win)
if ((bd) && (!e_object_is_del(E_OBJECT(bd))) &&
(bd->client.win == win))
return bd;
#ifdef HAVE_WAYLAND_CLIENTS
bd = e_comp_wl_border_surface_find(win);
if (bd && (!e_object_is_del(E_OBJECT(bd)))) return bd;
#endif
return NULL;
}
@ -3218,6 +3225,9 @@ e_border_find_all_by_client_window(Ecore_X_Window win)
bd = eina_hash_find(borders_hash, e_util_winid_str_get(win));
if ((bd) && (bd->client.win == win))
return bd;
#ifdef HAVE_WAYLAND_CLIENTS
return e_comp_wl_border_surface_find(win);
#endif
return NULL;
}

View File

@ -208,6 +208,8 @@ static const struct wl_pointer_grab_interface _e_drag_grab_interface =
/* local variables */
static Ecore_Idler *_module_idler = NULL;
static Eina_Hash *_e_wl_border_hash = NULL;
/* external variables */
EAPI E_Wayland_Compositor *_e_wl_comp;
@ -433,6 +435,8 @@ e_comp_wl_shutdown(void)
E_FREE(_e_wl_comp);
}
E_FREE_FUNC(_e_wl_border_hash, eina_hash_free);
/* disable the loaded shell module */
/* TODO: we should have a config variable somewhere to store which
* shell we want to unload (tablet, mobile, etc) */
@ -440,6 +444,28 @@ e_comp_wl_shutdown(void)
e_module_disable(mod);
}
EAPI void
e_comp_wl_border_surface_add(Ecore_Window win, const E_Border *bd)
{
if (!_e_wl_border_hash)
_e_wl_border_hash = eina_hash_int32_new(NULL);
eina_hash_add(_e_wl_border_hash, &win, bd);
}
EAPI void
e_comp_wl_border_surface_del(Ecore_Window win)
{
if (!_e_wl_border_hash) return;
eina_hash_del_by_key(_e_wl_border_hash, &win);
}
EAPI E_Border *
e_comp_wl_border_surface_find(Ecore_Window win)
{
if (!_e_wl_border_hash) return NULL;
return eina_hash_find(_e_wl_border_hash, &win);
}
EAPI void
wl_seat_init(struct wl_seat *seat)
{
@ -1615,6 +1641,7 @@ _e_comp_wl_cb_surface_create(struct wl_client *client, struct wl_resource *resou
wl_resource_post_no_memory(resource);
return;
}
ews->id = id;
/* initialize the destroy signal */
wl_signal_init(&ews->wl.destroy_signal);

View File

@ -279,6 +279,7 @@ struct _E_Wayland_Buffer_Reference
struct _E_Wayland_Surface
{
EINA_INLIST;
Ecore_Window id;
struct
{
struct wl_resource *surface;
@ -588,6 +589,10 @@ extern EAPI E_Wayland_Compositor *_e_wl_comp;
EINTERN Eina_Bool e_comp_wl_init(void);
EINTERN void e_comp_wl_shutdown(void);
EAPI void e_comp_wl_border_surface_add(Ecore_Window win, const E_Border *bd);
EAPI void e_comp_wl_border_surface_del(Ecore_Window win);
EAPI E_Border *e_comp_wl_border_surface_find(Ecore_Window win);
EAPI void wl_seat_init(struct wl_seat *seat);
EAPI void wl_seat_release(struct wl_seat *seat);

View File

@ -910,6 +910,8 @@ _e_wl_shell_shell_surface_map(E_Wayland_Surface *ews, Evas_Coord x, Evas_Coord y
default:
break;
}
if (ews->bd)
e_comp_wl_border_surface_add(ews->id, ews->bd);
}
static void
@ -962,7 +964,11 @@ _e_wl_shell_shell_surface_unmap(E_Wayland_Surface *ews)
evas_object_del(ews->obj);
}
if (ews->bd) e_object_del(E_OBJECT(ews->bd));
if (ews->bd)
{
e_comp_wl_border_surface_del(ews->id);
e_object_del(E_OBJECT(ews->bd));
}
ews->mapped = EINA_FALSE;
}