2012-02-28 13:55:51 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "ecore_wl_private.h"
|
|
|
|
|
2015-03-13 18:40:59 -07:00
|
|
|
static void
|
2014-08-26 08:07:02 -07:00
|
|
|
_ecore_wl_output_cb_geometry(void *data, struct wl_output *wl_output EINA_UNUSED, int x, int y, int w, int h, int subpixel EINA_UNUSED, const char *make EINA_UNUSED, const char *model EINA_UNUSED, int transform)
|
|
|
|
{
|
|
|
|
Ecore_Wl_Output *output;
|
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
output = data;
|
|
|
|
output->allocation.x = x;
|
|
|
|
output->allocation.y = y;
|
|
|
|
output->mw = w;
|
|
|
|
output->mh = h;
|
|
|
|
output->transform = transform;
|
|
|
|
}
|
|
|
|
|
2015-03-13 18:40:59 -07:00
|
|
|
static void
|
2014-08-26 08:07:02 -07:00
|
|
|
_ecore_wl_output_cb_mode(void *data, struct wl_output *wl_output EINA_UNUSED, unsigned int flags, int w, int h, int refresh EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Ecore_Wl_Output *output;
|
|
|
|
Ecore_Wl_Display *ewd;
|
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
output = data;
|
|
|
|
ewd = output->display;
|
|
|
|
if (flags & WL_OUTPUT_MODE_CURRENT)
|
|
|
|
{
|
|
|
|
output->allocation.w = w;
|
|
|
|
output->allocation.h = h;
|
|
|
|
_ecore_wl_disp->output = output;
|
|
|
|
if (ewd->output_configure) (*ewd->output_configure)(output, ewd->data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-13 18:40:59 -07:00
|
|
|
static void
|
2014-08-26 08:07:02 -07:00
|
|
|
_ecore_wl_output_cb_done(void *data EINA_UNUSED, struct wl_output *output EINA_UNUSED)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-03-13 18:40:59 -07:00
|
|
|
static void
|
2014-08-26 08:07:02 -07:00
|
|
|
_ecore_wl_output_cb_scale(void *data EINA_UNUSED, struct wl_output *output EINA_UNUSED, int scale EINA_UNUSED)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2012-02-28 13:55:51 -08:00
|
|
|
|
|
|
|
/* wayland listeners */
|
2015-03-13 18:40:59 -07:00
|
|
|
static const struct wl_output_listener _ecore_wl_output_listener =
|
2012-02-28 13:55:51 -08:00
|
|
|
{
|
|
|
|
_ecore_wl_output_cb_geometry,
|
2013-08-06 03:18:29 -07:00
|
|
|
_ecore_wl_output_cb_mode,
|
|
|
|
_ecore_wl_output_cb_done,
|
|
|
|
_ecore_wl_output_cb_scale
|
2012-02-28 13:55:51 -08:00
|
|
|
};
|
|
|
|
|
2012-04-10 10:00:56 -07:00
|
|
|
/* @since 1.2 */
|
2013-11-04 08:18:39 -08:00
|
|
|
EAPI Eina_Inlist *
|
2012-04-10 10:00:56 -07:00
|
|
|
ecore_wl_outputs_get(void)
|
|
|
|
{
|
2013-11-04 08:18:39 -08:00
|
|
|
return _ecore_wl_disp->outputs;
|
2012-04-10 10:00:56 -07:00
|
|
|
}
|
|
|
|
|
2015-03-13 18:40:59 -07:00
|
|
|
void
|
2012-02-28 13:55:51 -08:00
|
|
|
_ecore_wl_output_add(Ecore_Wl_Display *ewd, unsigned int id)
|
|
|
|
{
|
|
|
|
Ecore_Wl_Output *output;
|
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2015-03-17 17:30:32 -07:00
|
|
|
if (!(output = calloc(1, sizeof(Ecore_Wl_Output)))) return;
|
2012-02-28 13:55:51 -08:00
|
|
|
|
|
|
|
output->display = ewd;
|
|
|
|
|
2015-03-13 18:40:59 -07:00
|
|
|
output->output =
|
2013-08-06 03:18:29 -07:00
|
|
|
wl_registry_bind(ewd->wl.registry, id, &wl_output_interface, 2);
|
2012-10-16 04:57:13 -07:00
|
|
|
|
2013-11-04 08:18:39 -08:00
|
|
|
ewd->outputs = eina_inlist_append(ewd->outputs, EINA_INLIST_GET(output));
|
2012-02-28 13:55:51 -08:00
|
|
|
wl_output_add_listener(output->output, &_ecore_wl_output_listener, output);
|
|
|
|
}
|
|
|
|
|
2015-03-13 18:40:59 -07:00
|
|
|
void
|
|
|
|
_ecore_wl_output_del(Ecore_Wl_Output *output)
|
2012-02-28 13:55:51 -08:00
|
|
|
{
|
|
|
|
if (!output) return;
|
|
|
|
if (output->destroy) (*output->destroy)(output, output->data);
|
|
|
|
if (output->output) wl_output_destroy(output->output);
|
2015-03-13 18:40:59 -07:00
|
|
|
_ecore_wl_disp->outputs =
|
2014-08-26 08:01:22 -07:00
|
|
|
eina_inlist_remove(_ecore_wl_disp->outputs, EINA_INLIST_GET(output));
|
2012-02-28 13:55:51 -08:00
|
|
|
free(output);
|
|
|
|
}
|