2013-04-25 00:34:56 -07:00
|
|
|
#include "e.h"
|
|
|
|
#include "e_mod_main.h"
|
|
|
|
|
|
|
|
/* local function prototypes */
|
2013-06-10 06:52:17 -07:00
|
|
|
static Eina_Bool _output_init(E_Compositor_X11 *xcomp);
|
|
|
|
static Eina_Bool _output_init_shm(E_Compositor_X11 *xcomp, E_Output_X11 *output, Evas_Coord w, Evas_Coord h);
|
2013-05-02 01:10:56 -07:00
|
|
|
static void _output_shutdown(E_Output_X11 *output);
|
2013-06-13 04:04:38 -07:00
|
|
|
static Eina_Bool _input_init(E_Compositor_X11 *xcomp);
|
|
|
|
static void _input_shutdown(E_Compositor_X11 *xcomp);
|
2013-06-09 10:38:20 -07:00
|
|
|
|
2013-05-02 01:10:56 -07:00
|
|
|
static int _output_cb_frame(void *data);
|
2013-05-06 05:28:30 -07:00
|
|
|
static void _output_cb_repaint_start(E_Output *output);
|
2013-06-10 06:52:17 -07:00
|
|
|
static void _output_cb_repaint_shm(E_Output *output, pixman_region32_t *damage);
|
2013-05-02 01:10:56 -07:00
|
|
|
static void _output_cb_destroy(E_Output *output);
|
2013-06-10 06:52:17 -07:00
|
|
|
static Eina_Bool _output_cb_window_damage(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
|
2013-05-02 04:22:53 -07:00
|
|
|
static Eina_Bool _output_cb_window_destroy(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
|
2013-06-13 06:51:07 -07:00
|
|
|
static Eina_Bool _output_cb_window_mouse_move(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
|
2013-04-25 00:34:56 -07:00
|
|
|
|
|
|
|
/* local variables */
|
2013-05-03 02:31:26 -07:00
|
|
|
static E_Compositor_X11 *_e_x11_comp;
|
2013-05-02 04:22:53 -07:00
|
|
|
static Eina_List *_hdlrs = NULL;
|
2013-04-25 00:34:56 -07:00
|
|
|
|
|
|
|
EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_X11" };
|
|
|
|
|
|
|
|
EAPI void *
|
|
|
|
e_modapi_init(E_Module *m)
|
|
|
|
{
|
2013-06-11 08:43:09 -07:00
|
|
|
if (_e_x11_comp) return NULL;
|
|
|
|
|
2013-04-25 00:34:56 -07:00
|
|
|
/* try to allocate space for comp structure */
|
2013-05-03 02:31:26 -07:00
|
|
|
if (!(_e_x11_comp = E_NEW(E_Compositor_X11, 1)))
|
2013-04-25 00:34:56 -07:00
|
|
|
{
|
|
|
|
ERR("Could not allocate space for compositor: %m");
|
2013-05-02 01:10:56 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* try to init ecore_x */
|
|
|
|
if (!ecore_x_init(NULL))
|
|
|
|
{
|
|
|
|
ERR("Could not initialize ecore_x: %m");
|
|
|
|
goto x_err;
|
2013-04-25 00:34:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* get the X display */
|
2013-05-03 02:31:26 -07:00
|
|
|
_e_x11_comp->display = ecore_x_display_get();
|
2013-04-25 00:34:56 -07:00
|
|
|
|
|
|
|
/* try to initialize generic compositor */
|
2013-05-03 02:31:26 -07:00
|
|
|
if (!e_compositor_init(&_e_x11_comp->base, _e_x11_comp->display))
|
2013-04-25 00:34:56 -07:00
|
|
|
{
|
|
|
|
ERR("Could not initialize compositor: %m");
|
2013-05-02 01:10:56 -07:00
|
|
|
goto comp_err;
|
2013-04-25 00:34:56 -07:00
|
|
|
}
|
|
|
|
|
2013-06-09 10:38:20 -07:00
|
|
|
/* try to create a renderer */
|
2013-06-09 23:52:10 -07:00
|
|
|
if (!e_renderer_create(&_e_x11_comp->base))
|
|
|
|
{
|
|
|
|
ERR("Could not initialize renderer: %m");
|
2013-06-12 23:08:55 -07:00
|
|
|
goto renderer_err;
|
2013-06-09 23:52:10 -07:00
|
|
|
}
|
2013-06-09 10:38:20 -07:00
|
|
|
|
2013-06-13 04:04:38 -07:00
|
|
|
/* try to initialize input */
|
|
|
|
if (!_input_init(_e_x11_comp))
|
|
|
|
{
|
|
|
|
ERR("Could not initialize input: %m");
|
|
|
|
goto input_err;
|
|
|
|
}
|
|
|
|
|
2013-05-02 01:10:56 -07:00
|
|
|
/* try to initialize output */
|
2013-06-10 06:52:17 -07:00
|
|
|
if (!_output_init(_e_x11_comp))
|
2013-05-02 01:10:56 -07:00
|
|
|
{
|
|
|
|
ERR("Could not initialize output: %m");
|
|
|
|
goto output_err;
|
|
|
|
}
|
2013-04-25 00:34:56 -07:00
|
|
|
|
2013-06-10 06:52:17 -07:00
|
|
|
E_LIST_HANDLER_APPEND(_hdlrs, ECORE_X_EVENT_WINDOW_DAMAGE,
|
|
|
|
_output_cb_window_damage, NULL);
|
2013-05-02 04:22:53 -07:00
|
|
|
E_LIST_HANDLER_APPEND(_hdlrs, ECORE_X_EVENT_WINDOW_DELETE_REQUEST,
|
|
|
|
_output_cb_window_destroy, NULL);
|
2013-06-13 06:51:07 -07:00
|
|
|
E_LIST_HANDLER_APPEND(_hdlrs, ECORE_EVENT_MOUSE_MOVE,
|
|
|
|
_output_cb_window_mouse_move, NULL);
|
2013-05-02 04:22:53 -07:00
|
|
|
|
2013-04-25 05:59:13 -07:00
|
|
|
/* flush any pending events
|
|
|
|
*
|
|
|
|
* NB: This advertises out any globals so it needs to be deferred
|
|
|
|
* until after the module has finished initialize */
|
2013-05-03 02:31:26 -07:00
|
|
|
/* wl_event_loop_dispatch(_e_x11_comp->base.wl.loop, 0); */
|
2013-04-25 05:59:13 -07:00
|
|
|
|
2013-04-25 00:34:56 -07:00
|
|
|
return m;
|
|
|
|
|
2013-05-02 01:10:56 -07:00
|
|
|
output_err:
|
2013-06-13 04:04:38 -07:00
|
|
|
/* shutdown the inputs */
|
|
|
|
_input_shutdown(_e_x11_comp);
|
|
|
|
|
|
|
|
input_err:
|
2013-06-12 23:08:55 -07:00
|
|
|
/* shutdown the renderer */
|
|
|
|
e_renderer_destroy(&_e_x11_comp->base);
|
|
|
|
|
|
|
|
renderer_err:
|
2013-05-02 01:10:56 -07:00
|
|
|
/* shutdown the e_compositor */
|
2013-05-03 02:31:26 -07:00
|
|
|
e_compositor_shutdown(&_e_x11_comp->base);
|
2013-05-02 01:10:56 -07:00
|
|
|
|
|
|
|
comp_err:
|
2013-04-25 00:34:56 -07:00
|
|
|
/* shutdown ecore_x */
|
|
|
|
ecore_x_shutdown();
|
|
|
|
|
2013-05-02 01:10:56 -07:00
|
|
|
x_err:
|
2013-04-25 00:34:56 -07:00
|
|
|
/* free the structure */
|
2013-05-03 02:31:26 -07:00
|
|
|
E_FREE(_e_x11_comp);
|
2013-04-25 00:34:56 -07:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
2013-06-09 10:38:20 -07:00
|
|
|
e_modapi_shutdown(E_Module *m EINA_UNUSED)
|
2013-04-25 00:34:56 -07:00
|
|
|
{
|
2013-05-02 01:10:56 -07:00
|
|
|
E_Output_X11 *output;
|
|
|
|
|
2013-05-02 04:22:53 -07:00
|
|
|
/* destroy the list of handlers */
|
|
|
|
E_FREE_LIST(_hdlrs, ecore_event_handler_del);
|
|
|
|
|
2013-05-02 01:10:56 -07:00
|
|
|
/* destroy the outputs */
|
2013-05-03 02:31:26 -07:00
|
|
|
EINA_LIST_FREE(_e_x11_comp->base.outputs, output)
|
2013-05-02 01:10:56 -07:00
|
|
|
_output_shutdown(output);
|
2013-04-25 00:34:56 -07:00
|
|
|
|
2013-06-13 04:04:38 -07:00
|
|
|
/* shutdown the inputs */
|
|
|
|
_input_shutdown(_e_x11_comp);
|
|
|
|
|
|
|
|
/* shutdown the renderer */
|
|
|
|
e_renderer_destroy(&_e_x11_comp->base);
|
|
|
|
|
2013-04-25 00:34:56 -07:00
|
|
|
/* shutdown generic compositor */
|
2013-05-03 02:31:26 -07:00
|
|
|
if (&_e_x11_comp->base) e_compositor_shutdown(&_e_x11_comp->base);
|
2013-04-25 00:34:56 -07:00
|
|
|
|
|
|
|
/* shutdown ecore_x */
|
|
|
|
ecore_x_shutdown();
|
|
|
|
|
|
|
|
/* free the structure */
|
2013-05-03 02:31:26 -07:00
|
|
|
E_FREE(_e_x11_comp);
|
2013-04-25 00:34:56 -07:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2013-05-02 01:10:56 -07:00
|
|
|
|
|
|
|
/* local functions */
|
|
|
|
static Eina_Bool
|
2013-06-10 06:52:17 -07:00
|
|
|
_output_init(E_Compositor_X11 *xcomp)
|
2013-05-02 01:10:56 -07:00
|
|
|
{
|
|
|
|
E_Output_X11 *output;
|
|
|
|
struct wl_event_loop *loop;
|
|
|
|
|
|
|
|
/* try to allocate space for our output structure */
|
|
|
|
if (!(output = E_NEW(E_Output_X11, 1)))
|
|
|
|
{
|
|
|
|
ERR("Could not allocate space for output structure");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
output->mode.flags = (WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED);
|
|
|
|
output->mode.w = 1024;
|
|
|
|
output->mode.h = 768;
|
|
|
|
output->mode.refresh = 60;
|
|
|
|
|
2013-06-10 06:52:17 -07:00
|
|
|
output->base.original = output->base.current;
|
|
|
|
output->base.make = "X11_Wayland";
|
|
|
|
output->base.model = "none";
|
|
|
|
|
2013-05-02 01:10:56 -07:00
|
|
|
/* add this mode to the base outputs list of modes */
|
|
|
|
output->base.modes = eina_list_append(output->base.modes, &output->mode);
|
|
|
|
|
|
|
|
/* try to create the output window */
|
|
|
|
if (!(output->win =
|
|
|
|
ecore_x_window_new(0, 0, 0, output->mode.w, output->mode.h)))
|
|
|
|
{
|
|
|
|
ERR("Failed to create ecore_x_window");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set window background color */
|
|
|
|
ecore_x_window_background_color_set(output->win, 0, 0, 0);
|
|
|
|
|
2013-05-02 04:22:53 -07:00
|
|
|
ecore_x_icccm_protocol_set(output->win,
|
|
|
|
ECORE_X_WM_PROTOCOL_DELETE_REQUEST, EINA_TRUE);
|
|
|
|
|
2013-05-02 01:10:56 -07:00
|
|
|
/* set window to not maximize */
|
|
|
|
ecore_x_icccm_size_pos_hints_set(output->win, EINA_FALSE,
|
|
|
|
ECORE_X_GRAVITY_NW,
|
|
|
|
output->mode.w, output->mode.h,
|
|
|
|
output->mode.w, output->mode.h,
|
|
|
|
0, 0, 1, 1, 0.0, 0.0);
|
|
|
|
|
|
|
|
/* set window title */
|
|
|
|
ecore_x_icccm_title_set(output->win, "E_Wayland X11 Compositor");
|
|
|
|
ecore_x_icccm_name_class_set(output->win, "E_Wayland X11 Compositor",
|
|
|
|
"e_wayland/X11 Compositor");
|
|
|
|
|
|
|
|
/* show the window */
|
|
|
|
ecore_x_window_show(output->win);
|
|
|
|
|
|
|
|
output->base.current = &output->mode;
|
|
|
|
output->base.original = output->base.current;
|
|
|
|
output->base.make = "e_wayland";
|
|
|
|
output->base.model = "none";
|
|
|
|
output->base.cb_destroy = _output_cb_destroy;
|
2013-05-06 05:28:30 -07:00
|
|
|
output->base.cb_repaint_start = _output_cb_repaint_start;
|
|
|
|
|
|
|
|
/* FIXME: Change this based on software/gl */
|
2013-06-10 06:52:17 -07:00
|
|
|
output->base.cb_repaint = _output_cb_repaint_shm;
|
2013-05-02 01:10:56 -07:00
|
|
|
|
|
|
|
/* initialize base output */
|
2013-05-03 02:31:26 -07:00
|
|
|
e_output_init(&output->base, &_e_x11_comp->base, 0, 0,
|
2013-05-02 01:10:56 -07:00
|
|
|
output->mode.w, output->mode.h, output->mode.flags);
|
|
|
|
|
2013-06-10 06:52:17 -07:00
|
|
|
/* FIXME: deal with render based on software/gl */
|
|
|
|
if (!_output_init_shm(_e_x11_comp, output, output->mode.w, output->mode.h))
|
|
|
|
{
|
|
|
|
printf("Could not init shm\n");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!xcomp->base.renderer->output_create(&output->base, output->win))
|
|
|
|
{
|
|
|
|
printf("Renderer Could not create Output\n");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2013-05-02 01:10:56 -07:00
|
|
|
|
|
|
|
/* get the wl event loop */
|
2013-05-03 02:31:26 -07:00
|
|
|
loop = wl_display_get_event_loop(_e_x11_comp->base.wl.display);
|
2013-05-02 01:10:56 -07:00
|
|
|
|
|
|
|
/* add a timer to the event loop */
|
|
|
|
output->frame_timer =
|
|
|
|
wl_event_loop_add_timer(loop, _output_cb_frame, output);
|
|
|
|
|
|
|
|
/* add this output to the base compositors output list */
|
2013-06-09 10:38:20 -07:00
|
|
|
_e_x11_comp->base.outputs =
|
|
|
|
eina_list_append(_e_x11_comp->base.outputs, output);
|
2013-05-02 01:10:56 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2013-06-10 06:52:17 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_output_init_shm(E_Compositor_X11 *xcomp, E_Output_X11 *output, Evas_Coord w, Evas_Coord h)
|
|
|
|
{
|
2013-06-11 06:55:38 -07:00
|
|
|
int bpp = 0, depth = 0;
|
2013-06-10 06:52:17 -07:00
|
|
|
unsigned int *data;
|
|
|
|
Ecore_X_Visual vis;
|
|
|
|
|
|
|
|
vis = ecore_x_default_visual_get(xcomp->display,
|
|
|
|
ecore_x_default_screen_get());
|
|
|
|
|
2013-06-11 06:55:38 -07:00
|
|
|
depth = ecore_x_window_depth_get(output->win);
|
|
|
|
|
|
|
|
output->buffer = ecore_x_image_new(w, h, vis, depth);
|
2013-06-10 06:52:17 -07:00
|
|
|
|
|
|
|
data = ecore_x_image_data_get(output->buffer, NULL, NULL, &bpp);
|
|
|
|
|
|
|
|
output->hw_surface =
|
2013-06-11 01:22:11 -07:00
|
|
|
pixman_image_create_bits(PIXMAN_x8r8g8b8, w, h, data, w * bpp);
|
2013-06-10 06:52:17 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2013-05-02 01:10:56 -07:00
|
|
|
static void
|
|
|
|
_output_shutdown(E_Output_X11 *output)
|
|
|
|
{
|
|
|
|
E_FREE(output);
|
|
|
|
}
|
|
|
|
|
2013-06-13 04:04:38 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_input_init(E_Compositor_X11 *xcomp)
|
|
|
|
{
|
|
|
|
if (!e_input_init(&xcomp->base, &xcomp->seat, "default"))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
if (!e_input_pointer_init(&xcomp->seat))
|
|
|
|
{
|
|
|
|
e_input_shutdown(&xcomp->seat);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!e_input_keyboard_init(&xcomp->seat))
|
|
|
|
{
|
|
|
|
e_input_shutdown(&xcomp->seat);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_input_shutdown(E_Compositor_X11 *xcomp)
|
|
|
|
{
|
|
|
|
e_input_shutdown(&xcomp->seat);
|
|
|
|
}
|
|
|
|
|
2013-05-02 01:10:56 -07:00
|
|
|
static int
|
|
|
|
_output_cb_frame(void *data)
|
|
|
|
{
|
|
|
|
E_Output_X11 *output;
|
|
|
|
|
|
|
|
if (!(output = data)) return 1;
|
2013-05-06 05:28:30 -07:00
|
|
|
|
|
|
|
/* start the repaint loop */
|
2013-05-07 02:42:36 -07:00
|
|
|
_output_cb_repaint_start(&output->base);
|
2013-05-06 05:28:30 -07:00
|
|
|
|
2013-05-02 01:10:56 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2013-05-06 05:28:30 -07:00
|
|
|
static void
|
|
|
|
_output_cb_repaint_start(E_Output *output)
|
|
|
|
{
|
2013-05-07 04:29:32 -07:00
|
|
|
int fd = 0;
|
|
|
|
|
|
|
|
/* check for valid output */
|
|
|
|
if (!output) return;
|
|
|
|
|
|
|
|
/* if a repaint is needed, do it */
|
|
|
|
if (output->repaint.needed)
|
|
|
|
{
|
|
|
|
e_output_repaint(output, ecore_loop_time_get());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
output->repaint.scheduled = EINA_FALSE;
|
|
|
|
if (output->compositor->wl.input_loop_source) return;
|
|
|
|
|
|
|
|
fd = wl_event_loop_get_fd(output->compositor->wl.input_loop);
|
|
|
|
output->compositor->wl.input_loop_source =
|
|
|
|
wl_event_loop_add_fd(output->compositor->wl.loop, fd,
|
|
|
|
WL_EVENT_READABLE,
|
|
|
|
e_compositor_input_read, output->compositor);
|
2013-05-06 05:28:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-06-10 06:52:17 -07:00
|
|
|
_output_cb_repaint_shm(E_Output *output, pixman_region32_t *damage)
|
2013-05-06 05:28:30 -07:00
|
|
|
{
|
2013-06-10 06:52:17 -07:00
|
|
|
E_Output_X11 *xoutput;
|
2013-05-07 05:31:17 -07:00
|
|
|
E_Compositor *comp;
|
|
|
|
|
2013-06-10 06:52:17 -07:00
|
|
|
xoutput = (E_Output_X11 *)output;
|
2013-05-07 05:31:17 -07:00
|
|
|
comp = output->compositor;
|
|
|
|
|
2013-06-10 06:52:17 -07:00
|
|
|
comp->renderer->output_buffer_set(output, xoutput->hw_surface);
|
|
|
|
comp->renderer->output_repaint(output, damage);
|
|
|
|
|
|
|
|
pixman_region32_subtract(&comp->plane.damage, &comp->plane.damage, damage);
|
2013-05-07 05:31:17 -07:00
|
|
|
|
2013-06-10 06:52:17 -07:00
|
|
|
/* TODO: set clip for output */
|
2013-06-09 10:38:20 -07:00
|
|
|
|
2013-06-11 01:22:11 -07:00
|
|
|
ecore_x_image_put(xoutput->buffer, xoutput->win, 0,
|
2013-06-10 06:52:17 -07:00
|
|
|
0, 0, 0, 0, pixman_image_get_width(xoutput->hw_surface),
|
|
|
|
pixman_image_get_height(xoutput->hw_surface));
|
2013-06-09 10:38:20 -07:00
|
|
|
|
2013-06-10 06:52:17 -07:00
|
|
|
wl_event_source_timer_update(xoutput->frame_timer, 10);
|
2013-05-06 05:28:30 -07:00
|
|
|
}
|
|
|
|
|
2013-05-02 01:10:56 -07:00
|
|
|
static void
|
|
|
|
_output_cb_destroy(E_Output *output)
|
|
|
|
{
|
|
|
|
E_Output_X11 *xout;
|
|
|
|
|
|
|
|
xout = (E_Output_X11 *)output;
|
|
|
|
|
|
|
|
/* remove the frame timer */
|
|
|
|
wl_event_source_remove(xout->frame_timer);
|
|
|
|
|
2013-06-11 01:22:11 -07:00
|
|
|
/* destroy the output image */
|
2013-06-10 06:52:17 -07:00
|
|
|
if (xout->buffer) ecore_x_image_free(xout->buffer);
|
|
|
|
|
2013-05-02 01:10:56 -07:00
|
|
|
/* destroy the window */
|
|
|
|
if (xout->win) ecore_x_window_free(xout->win);
|
|
|
|
|
|
|
|
/* destroy the base output */
|
|
|
|
e_output_shutdown(&xout->base);
|
|
|
|
|
|
|
|
/* free the structure */
|
|
|
|
E_FREE(xout);
|
|
|
|
}
|
2013-05-02 04:22:53 -07:00
|
|
|
|
|
|
|
static Eina_Bool
|
2013-06-10 06:52:17 -07:00
|
|
|
_output_cb_window_damage(void *data, int type EINA_UNUSED, void *event)
|
2013-05-02 04:22:53 -07:00
|
|
|
{
|
2013-06-10 06:52:17 -07:00
|
|
|
Ecore_X_Event_Window_Damage *ev;
|
2013-05-02 04:22:53 -07:00
|
|
|
E_Output_X11 *output;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
ev = event;
|
|
|
|
|
2013-05-03 02:31:26 -07:00
|
|
|
EINA_LIST_FOREACH(_e_x11_comp->base.outputs, l, output)
|
2013-05-02 04:22:53 -07:00
|
|
|
{
|
|
|
|
if (ev->win == output->win)
|
|
|
|
{
|
2013-06-10 06:52:17 -07:00
|
|
|
e_output_repaint_schedule(&output->base);
|
2013-05-02 04:22:53 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
2013-05-06 05:28:30 -07:00
|
|
|
|
2013-06-10 06:52:17 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_output_cb_window_destroy(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
2013-05-06 05:28:30 -07:00
|
|
|
{
|
2013-06-10 06:52:17 -07:00
|
|
|
Ecore_X_Event_Window_Delete_Request *ev;
|
|
|
|
E_Output_X11 *output;
|
|
|
|
Eina_List *l;
|
2013-06-09 10:38:20 -07:00
|
|
|
|
2013-06-10 06:52:17 -07:00
|
|
|
ev = event;
|
2013-05-07 07:04:50 -07:00
|
|
|
|
2013-06-10 06:52:17 -07:00
|
|
|
/* loop the existing outputs */
|
|
|
|
EINA_LIST_FOREACH(_e_x11_comp->base.outputs, l, output)
|
2013-05-07 07:04:50 -07:00
|
|
|
{
|
2013-06-10 06:52:17 -07:00
|
|
|
/* try to match the output window */
|
|
|
|
if (ev->win == output->win)
|
|
|
|
{
|
|
|
|
/* output window being closed, quit */
|
|
|
|
/* NB: FIXME: This assumes we have only one output window */
|
|
|
|
ecore_main_loop_quit();
|
|
|
|
break;
|
|
|
|
}
|
2013-05-07 07:04:50 -07:00
|
|
|
}
|
|
|
|
|
2013-06-10 06:52:17 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2013-05-06 05:28:30 -07:00
|
|
|
}
|
2013-06-13 06:51:07 -07:00
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_output_cb_window_mouse_move(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Event_Mouse_Move *ev;
|
|
|
|
E_Output_X11 *output;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
ev = event;
|
|
|
|
|
|
|
|
/* loop the existing outputs */
|
|
|
|
EINA_LIST_FOREACH(_e_x11_comp->base.outputs, l, output)
|
|
|
|
{
|
|
|
|
/* try to match the output window */
|
|
|
|
if (ev->window == output->win)
|
|
|
|
{
|
|
|
|
e_input_mouse_move_send(&_e_x11_comp->seat, ev);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|