E Comp (wayland): Add a surface repick when old surface gets
destroyed. Add a surface repick call when we raise an existing surface. Fix redraw for surfaces which use a gl texture. SVN revision: 67633
This commit is contained in:
parent
8e219d3455
commit
75b6d29ad6
|
@ -24,10 +24,23 @@ e_mod_comp_wl_buffer_attach(struct wl_buffer *buffer, struct wl_surface *surface
|
||||||
|
|
||||||
ws = (Wayland_Surface *)surface;
|
ws = (Wayland_Surface *)surface;
|
||||||
|
|
||||||
if (ws->saved_texture != 0)
|
if (!ws->texture)
|
||||||
ws->texture = ws->saved_texture;
|
{
|
||||||
|
glGenTextures(1, &ws->texture);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, ws->texture);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D,
|
||||||
|
GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D,
|
||||||
|
GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
// ws->shader = &ws->texture_shader;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
glBindTexture(GL_TEXTURE_2D, ws->texture);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, ws->texture);
|
/* if (ws->saved_texture != 0) */
|
||||||
|
/* ws->texture = ws->saved_texture; */
|
||||||
|
|
||||||
|
/* glBindTexture(GL_TEXTURE_2D, ws->texture); */
|
||||||
|
|
||||||
if (wl_buffer_is_shm(buffer))
|
if (wl_buffer_is_shm(buffer))
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,7 +40,6 @@ static Eina_Bool _e_mod_comp_wl_cb_mouse_up(void *data __UNUSED__, int type __UN
|
||||||
static Eina_Bool _e_mod_comp_wl_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event);
|
static Eina_Bool _e_mod_comp_wl_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event);
|
||||||
static Eina_Bool _e_mod_comp_wl_cb_key_up(void *data __UNUSED__, int type __UNUSED__, void *event);
|
static Eina_Bool _e_mod_comp_wl_cb_key_up(void *data __UNUSED__, int type __UNUSED__, void *event);
|
||||||
|
|
||||||
static void _e_mod_comp_wl_comp_repick(struct wl_input_device *device, uint32_t timestamp);
|
|
||||||
static Wayland_Surface *_e_mod_comp_wl_comp_pick_surface(int32_t x __UNUSED__, int32_t y __UNUSED__, int32_t *sx, int32_t *sy);
|
static Wayland_Surface *_e_mod_comp_wl_comp_pick_surface(int32_t x __UNUSED__, int32_t y __UNUSED__, int32_t *sx, int32_t *sy);
|
||||||
static void _e_mod_comp_wl_comp_update_modifier(Wayland_Input *input, uint32_t key, uint32_t state);
|
static void _e_mod_comp_wl_comp_update_modifier(Wayland_Input *input, uint32_t key, uint32_t state);
|
||||||
|
|
||||||
|
@ -180,6 +179,32 @@ e_mod_comp_wl_comp_get(void)
|
||||||
return _wl_comp;
|
return _wl_comp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
e_mod_comp_wl_comp_repick(struct wl_input_device *device, uint32_t timestamp)
|
||||||
|
{
|
||||||
|
Wayland_Surface *ws, *focus;
|
||||||
|
|
||||||
|
ws =
|
||||||
|
_e_mod_comp_wl_comp_pick_surface(device->x, device->y,
|
||||||
|
&device->current_x, &device->current_y);
|
||||||
|
if (!ws) return;
|
||||||
|
if (&ws->surface != device->current)
|
||||||
|
{
|
||||||
|
const struct wl_grab_interface *interface;
|
||||||
|
|
||||||
|
interface = device->grab->interface;
|
||||||
|
interface->focus(device->grab, timestamp, &ws->surface,
|
||||||
|
device->current_x, device->current_y);
|
||||||
|
device->current = &ws->surface;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((focus = (Wayland_Surface *)device->grab->focus))
|
||||||
|
{
|
||||||
|
device->grab->x = device->x - focus->x;
|
||||||
|
device->grab->y = device->y - focus->y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* local functions */
|
/* local functions */
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_e_mod_comp_wl_comp_egl_init(void)
|
_e_mod_comp_wl_comp_egl_init(void)
|
||||||
|
@ -378,7 +403,7 @@ _e_mod_comp_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *eve
|
||||||
input->input_device.y = ev->y;
|
input->input_device.y = ev->y;
|
||||||
|
|
||||||
timestamp = e_mod_comp_wl_time_get();
|
timestamp = e_mod_comp_wl_time_get();
|
||||||
_e_mod_comp_wl_comp_repick(&input->input_device, timestamp);
|
e_mod_comp_wl_comp_repick(&input->input_device, timestamp);
|
||||||
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
}
|
}
|
||||||
|
@ -397,7 +422,7 @@ _e_mod_comp_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *ev
|
||||||
input = e_mod_comp_wl_input_get();
|
input = e_mod_comp_wl_input_get();
|
||||||
|
|
||||||
timestamp = e_mod_comp_wl_time_get();
|
timestamp = e_mod_comp_wl_time_get();
|
||||||
_e_mod_comp_wl_comp_repick(&input->input_device, timestamp);
|
e_mod_comp_wl_comp_repick(&input->input_device, timestamp);
|
||||||
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
}
|
}
|
||||||
|
@ -422,7 +447,7 @@ _e_mod_comp_wl_cb_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *e
|
||||||
device->y = ev->y;
|
device->y = ev->y;
|
||||||
|
|
||||||
timestamp = e_mod_comp_wl_time_get();
|
timestamp = e_mod_comp_wl_time_get();
|
||||||
_e_mod_comp_wl_comp_repick(device, timestamp);
|
e_mod_comp_wl_comp_repick(device, timestamp);
|
||||||
|
|
||||||
interface = device->grab->interface;
|
interface = device->grab->interface;
|
||||||
interface->motion(device->grab, timestamp, device->grab->x, device->grab->y);
|
interface->motion(device->grab, timestamp, device->grab->x, device->grab->y);
|
||||||
|
@ -590,32 +615,6 @@ _e_mod_comp_wl_cb_key_up(void *data __UNUSED__, int type __UNUSED__, void *event
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_e_mod_comp_wl_comp_repick(struct wl_input_device *device, uint32_t timestamp)
|
|
||||||
{
|
|
||||||
Wayland_Surface *ws, *focus;
|
|
||||||
|
|
||||||
ws =
|
|
||||||
_e_mod_comp_wl_comp_pick_surface(device->x, device->y,
|
|
||||||
&device->current_x, &device->current_y);
|
|
||||||
if (!ws) return;
|
|
||||||
if (&ws->surface != device->current)
|
|
||||||
{
|
|
||||||
const struct wl_grab_interface *interface;
|
|
||||||
|
|
||||||
interface = device->grab->interface;
|
|
||||||
interface->focus(device->grab, timestamp, &ws->surface,
|
|
||||||
device->current_x, device->current_y);
|
|
||||||
device->current = &ws->surface;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((focus = (Wayland_Surface *)device->grab->focus))
|
|
||||||
{
|
|
||||||
device->grab->x = device->x - focus->x;
|
|
||||||
device->grab->y = device->y - focus->y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static Wayland_Surface *
|
static Wayland_Surface *
|
||||||
_e_mod_comp_wl_comp_pick_surface(int32_t x __UNUSED__, int32_t y __UNUSED__, int32_t *sx, int32_t *sy)
|
_e_mod_comp_wl_comp_pick_surface(int32_t x __UNUSED__, int32_t y __UNUSED__, int32_t *sx, int32_t *sy)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
Eina_Bool e_mod_comp_wl_comp_init(void);
|
Eina_Bool e_mod_comp_wl_comp_init(void);
|
||||||
void e_mod_comp_wl_comp_shutdown(void);
|
void e_mod_comp_wl_comp_shutdown(void);
|
||||||
Wayland_Compositor *e_mod_comp_wl_comp_get(void);
|
Wayland_Compositor *e_mod_comp_wl_comp_get(void);
|
||||||
|
void e_mod_comp_wl_comp_repick(struct wl_input_device *device, uint32_t timestamp);
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -143,6 +143,7 @@ void
|
||||||
e_mod_comp_wl_surface_destroy_surface(struct wl_resource *resource)
|
e_mod_comp_wl_surface_destroy_surface(struct wl_resource *resource)
|
||||||
{
|
{
|
||||||
Wayland_Surface *ws;
|
Wayland_Surface *ws;
|
||||||
|
Wayland_Input *input;
|
||||||
|
|
||||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||||
|
|
||||||
|
@ -151,15 +152,15 @@ e_mod_comp_wl_surface_destroy_surface(struct wl_resource *resource)
|
||||||
/* TODO: damage below */
|
/* TODO: damage below */
|
||||||
/* TODO: flush damage */
|
/* TODO: flush damage */
|
||||||
|
|
||||||
|
input = e_mod_comp_wl_input_get();
|
||||||
|
|
||||||
if (ws->win)
|
if (ws->win)
|
||||||
e_object_del(E_OBJECT(ws->win));
|
e_object_del(E_OBJECT(ws->win));
|
||||||
|
|
||||||
wl_list_remove(&ws->link);
|
wl_list_remove(&ws->link);
|
||||||
|
e_mod_comp_wl_comp_repick(&input->input_device, e_mod_comp_wl_time_get());
|
||||||
|
|
||||||
if (!ws->saved_texture)
|
if (ws->texture) glDeleteTextures(1, &ws->texture);
|
||||||
glDeleteTextures(1, &ws->texture);
|
|
||||||
else
|
|
||||||
glDeleteTextures(1, &ws->saved_texture);
|
|
||||||
|
|
||||||
if (ws->buffer)
|
if (ws->buffer)
|
||||||
wl_list_remove(&ws->buffer_destroy_listener.link);
|
wl_list_remove(&ws->buffer_destroy_listener.link);
|
||||||
|
@ -194,6 +195,9 @@ e_mod_comp_wl_surface_configure(Wayland_Surface *ws, int32_t x, int32_t y, int32
|
||||||
ws->w = width;
|
ws->w = width;
|
||||||
ws->h = height;
|
ws->h = height;
|
||||||
|
|
||||||
|
if (ws->win)
|
||||||
|
e_win_move_resize(ws->win, ws->x, ws->y, ws->w, ws->h);
|
||||||
|
|
||||||
if (!wl_list_empty(&ws->frame_callbacks))
|
if (!wl_list_empty(&ws->frame_callbacks))
|
||||||
{
|
{
|
||||||
Wayland_Output *output;
|
Wayland_Output *output;
|
||||||
|
@ -211,9 +215,6 @@ e_mod_comp_wl_surface_configure(Wayland_Surface *ws, int32_t x, int32_t y, int32
|
||||||
pixman_region32_init_rect(&ws->opaque, ws->x, ws->y, ws->w, ws->h);
|
pixman_region32_init_rect(&ws->opaque, ws->x, ws->y, ws->w, ws->h);
|
||||||
else
|
else
|
||||||
pixman_region32_init(&ws->opaque);
|
pixman_region32_init(&ws->opaque);
|
||||||
|
|
||||||
if (ws->win)
|
|
||||||
e_win_move_resize(ws->win, ws->x, ws->y, ws->w, ws->h);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -256,13 +257,16 @@ static void
|
||||||
_e_mod_comp_wl_surface_raise(Wayland_Surface *ws)
|
_e_mod_comp_wl_surface_raise(Wayland_Surface *ws)
|
||||||
{
|
{
|
||||||
Wayland_Compositor *comp;
|
Wayland_Compositor *comp;
|
||||||
|
Wayland_Input *input;
|
||||||
|
|
||||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||||
|
|
||||||
comp = e_mod_comp_wl_comp_get();
|
comp = e_mod_comp_wl_comp_get();
|
||||||
|
input = e_mod_comp_wl_input_get();
|
||||||
|
|
||||||
wl_list_remove(&ws->link);
|
wl_list_remove(&ws->link);
|
||||||
wl_list_insert(&comp->surfaces, &ws->link);
|
wl_list_insert(&comp->surfaces, &ws->link);
|
||||||
/* TODO: repick */
|
e_mod_comp_wl_comp_repick(&input->input_device, e_mod_comp_wl_time_get());
|
||||||
e_mod_comp_wl_surface_damage_surface(ws);
|
e_mod_comp_wl_surface_damage_surface(ws);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue