e: merge comp module into core

* Move compositor to core, but letting the configuration there
 * Rename all files and functions from e_mod_comp_* to e_comp_*
 * Move the config dialogs to a new module named conf_comp. It still
   uses a domain config, otherwise it would not pick the current
   user's configuration. Maybe it would be wise to later on move these
   options to e_config
 * Fixup the wizard mess linking the header in the build tree in order
   to be able to create the config. Since now it's in core, we don't
   need to play linking games in the build system

I'm not sure if the wayland part works. It was not even building
previously so I'll let for who cares about this to actually test and
report bugs.



SVN revision: 82454
This commit is contained in:
Lucas De Marchi 2013-01-09 11:34:07 +00:00
parent 8096505844
commit 8cacf8429d
47 changed files with 1932 additions and 1977 deletions

View File

@ -846,6 +846,7 @@ AC_E_OPTIONAL_MODULE([fileman_opinfo], true)
AC_E_OPTIONAL_MODULE([wizard], true)
AC_E_OPTIONAL_MODULE([conf], true)
AC_E_OPTIONAL_MODULE([conf2], $have_elementary)
AC_E_OPTIONAL_MODULE([conf_comp], true)
AC_E_OPTIONAL_MODULE([conf_wallpaper2], true)
AC_E_OPTIONAL_MODULE([conf_theme], true, true)
AC_E_OPTIONAL_MODULE([conf_intl], true)
@ -871,7 +872,6 @@ AC_E_OPTIONAL_MODULE([syscon], true)
AC_E_OPTIONAL_MODULE([everything], true)
AC_E_OPTIONAL_MODULE([systray], true)
AC_E_OPTIONAL_MODULE([appmenu], true)
AC_E_OPTIONAL_MODULE([comp], true)
AC_E_OPTIONAL_MODULE([physics], true, [CHECK_MODULE_PHYSICS])
AC_E_OPTIONAL_MODULE([quickaccess], true)
AC_E_OPTIONAL_MODULE([shot], true)
@ -981,7 +981,7 @@ src/modules/everything/module.desktop
src/modules/everything/everything.pc
src/modules/systray/module.desktop
src/modules/appmenu/module.desktop
src/modules/comp/module.desktop
src/modules/conf_comp/module.desktop
src/modules/physics/module.desktop
src/modules/quickaccess/module.desktop
src/modules/shot/module.desktop

View File

@ -136,12 +136,10 @@ src/modules/battery/e_mod_config.c
src/modules/battery/e_mod_main.c
src/modules/clock/e_mod_config.c
src/modules/clock/e_mod_main.c
src/modules/comp/e_mod_comp.c
src/modules/comp/e_mod_config.c
src/modules/comp/e_mod_main.c
src/modules/conf/e_conf.c
src/modules/conf/e_mod_config.c
src/modules/conf/e_mod_main.c
src/modules/conf_comp/e_mod_config.c
src/modules/conf_comp/e_mod_main.c
src/modules/conf_comp/e_mod_config.c
src/modules/conf_comp/e_mod_main.c
src/modules/conf_applications/e_int_config_apps.c
src/modules/conf_applications/e_int_config_apps_personal.c
src/modules/conf_applications/e_int_config_defapps.c

View File

@ -55,6 +55,9 @@ e_canvas.h \
e_color_class.h \
e_color_dialog.h \
e_color.h \
e_comp.h \
e_comp_cfdata.h \
e_comp_update.h \
e_config_data.h \
e_config_dialog.h \
e_config.h \
@ -199,6 +202,18 @@ e_xkb.h \
e_xsettings.h \
e_zone.h
if HAVE_WAYLAND_CLIENTS
ENLIGHTENMENTHEADERS += \
e_comp_wl.h \
e_comp_wl_buffer.h \
e_comp_wl_comp.h \
e_comp_wl_input.h \
e_comp_wl_output.h \
e_comp_wl_region.h \
e_comp_wl_shell.h \
e_comp_wl_surface.h
endif
enlightenment_src = \
e_about.c \
@ -215,6 +230,9 @@ e_canvas.c \
e_color.c \
e_color_class.c \
e_color_dialog.c \
e_comp.c \
e_comp_cfdata.c \
e_comp_update.c \
e_config.c \
e_config_data.c \
e_config_dialog.c \
@ -363,13 +381,26 @@ e_xsettings.c \
e_zone.c \
$(ENLIGHTENMENTHEADERS)
if HAVE_WAYLAND_CLIENTS
enlightenment_src += \
e_comp_wl.c \
e_comp_wl_buffer.c \
e_comp_wl_comp.c \
e_comp_wl_input.c \
e_comp_wl_output.c \
e_comp_wl_region.c \
e_comp_wl_shell.c \
e_comp_wl_surface.c
endif
enlightenment_CFLAGS = $(AM_CPPFLAGS) @WAYLAND_CFLAGS@
enlightenment_CPPFLAGS = $(AM_CPPFLAGS) -DE_LOGGING=1
enlightenment_SOURCES = \
e_main.c \
$(enlightenment_src)
enlightenment_LDFLAGS = -export-dynamic
enlightenment_LDADD = @e_libs@ @ELM_LIBS@ @EMOTION_LIBS@ @dlopen_libs@ @cf_libs@ @VALGRIND_LIBS@ -lm
enlightenment_LDADD = @e_libs@ @ELM_LIBS@ @EMOTION_LIBS@ @dlopen_libs@ @cf_libs@ @VALGRIND_LIBS@ @WAYLAND_LIBS@ -lm
enlightenment_imc_SOURCES = \
e.h \

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +1,19 @@
#ifdef E_TYPEDEFS
#else
#ifndef E_MOD_COMP_H
#define E_MOD_COMP_H
typedef struct _E_Comp E_Comp;
typedef struct _E_Comp_Win E_Comp_Win;
typedef struct _E_Comp_Zone E_Comp_Zone;
Eina_Bool e_mod_comp_init(void);
void e_mod_comp_shutdown(void);
#define E_COMP_ENGINE_SW 1
#define E_COMP_ENGINE_GL 2
void e_mod_comp_shadow_set(void);
#else
#ifndef E_MOD_COMP_H
#define E_MOD_COMP_H
Eina_Bool e_comp_init(void);
void e_comp_shutdown(void);
EAPI void e_comp_shadow_set(void);
#endif
#endif

View File

@ -1,14 +1,13 @@
#include "e.h"
#include "e_mod_main.h"
#include "e_mod_comp_cfdata.h"
#include "e_comp_cfdata.h"
EAPI void
e_mod_comp_cfdata_edd_init(E_Config_DD **conf_edd, E_Config_DD **match_edd)
e_comp_cfdata_edd_init(E_Config_DD **conf_edd, E_Config_DD **match_edd)
{
*match_edd = E_CONFIG_DD_NEW("Comp_Match", Match);
*match_edd = E_CONFIG_DD_NEW("Comp_Match", E_Comp_Match);
#undef T
#undef D
#define T Match
#define T E_Comp_Match
#define D *match_edd
E_CONFIG_VAL(D, T, title, STR);
E_CONFIG_VAL(D, T, name, STR);
@ -27,10 +26,10 @@ e_mod_comp_cfdata_edd_init(E_Config_DD **conf_edd, E_Config_DD **match_edd)
E_CONFIG_VAL(D, T, urgent, CHAR);
E_CONFIG_VAL(D, T, shadow_style, STR);
*conf_edd = E_CONFIG_DD_NEW("Comp_Config", Config);
*conf_edd = E_CONFIG_DD_NEW("Comp_Config", E_Comp_Config);
#undef T
#undef D
#define T Config
#define T E_Comp_Config
#define D *conf_edd
E_CONFIG_VAL(D, T, shadow_style, STR);
E_CONFIG_VAL(D, T, engine, INT);
@ -60,15 +59,15 @@ e_mod_comp_cfdata_edd_init(E_Config_DD **conf_edd, E_Config_DD **match_edd)
E_CONFIG_LIST(D, T, match.menus, *match_edd);
}
EAPI Config *
e_mod_comp_cfdata_config_new(void)
EAPI E_Comp_Config *
e_comp_cfdata_config_new(void)
{
Config *cfg;
Match *mat;
E_Comp_Config *cfg;
E_Comp_Match *mat;
cfg = E_NEW(Config, 1);
cfg = E_NEW(E_Comp_Config, 1);
cfg->shadow_style = eina_stringshare_add("default");
cfg->engine = ENGINE_SW;
cfg->engine = E_COMP_ENGINE_SW;
cfg->max_unmapped_pixels = 32 * 1024; // implement
cfg->max_unmapped_time = 10 * 3600; // implement
cfg->min_unmapped_time = 5 * 60; // implement
@ -96,79 +95,79 @@ e_mod_comp_cfdata_config_new(void)
cfg->match.popups = NULL;
mat = E_NEW(Match, 1);
mat = E_NEW(E_Comp_Match, 1);
cfg->match.popups = eina_list_append(cfg->match.popups, mat);
mat->name = eina_stringshare_add("shelf");
mat->shadow_style = eina_stringshare_add("popup");
mat = E_NEW(Match, 1);
mat = E_NEW(E_Comp_Match, 1);
cfg->match.popups = eina_list_append(cfg->match.popups, mat);
mat->name = eina_stringshare_add("_e_popup_desklock");
mat->shadow_style = eina_stringshare_add("still");
mat = E_NEW(Match, 1);
mat = E_NEW(E_Comp_Match, 1);
cfg->match.popups = eina_list_append(cfg->match.popups, mat);
mat->name = eina_stringshare_add("_e_popup_notification");
mat->shadow_style = eina_stringshare_add("still");
mat->focus = 1;
mat = E_NEW(Match, 1);
mat = E_NEW(E_Comp_Match, 1);
cfg->match.popups = eina_list_append(cfg->match.popups, mat);
mat->shadow_style = eina_stringshare_add("popup");
cfg->match.borders = NULL;
mat = E_NEW(Match, 1);
mat = E_NEW(E_Comp_Match, 1);
cfg->match.borders = eina_list_append(cfg->match.borders, mat);
mat->fullscreen = 1;
mat->shadow_style = eina_stringshare_add("fullscreen");
cfg->match.overrides = NULL;
mat = E_NEW(Match, 1);
mat = E_NEW(E_Comp_Match, 1);
cfg->match.overrides = eina_list_append(cfg->match.overrides, mat);
mat->name = eina_stringshare_add("E");
mat->clas = eina_stringshare_add("Background_Window");
mat->shadow_style = eina_stringshare_add("none");
mat = E_NEW(Match, 1);
mat = E_NEW(E_Comp_Match, 1);
cfg->match.overrides = eina_list_append(cfg->match.overrides, mat);
mat->name = eina_stringshare_add("E");
mat->clas = eina_stringshare_add("everything");
mat->shadow_style = eina_stringshare_add("everything");
mat = E_NEW(Match, 1);
mat = E_NEW(E_Comp_Match, 1);
cfg->match.overrides = eina_list_append(cfg->match.overrides, mat);
mat->name = eina_stringshare_add("E");
mat->clas = eina_stringshare_add("Init_Window");
mat->shadow_style = eina_stringshare_add("still");
mat = E_NEW(Match, 1);
mat = E_NEW(E_Comp_Match, 1);
cfg->match.overrides = eina_list_append(cfg->match.overrides, mat);
mat->primary_type = ECORE_X_WINDOW_TYPE_DROPDOWN_MENU;
mat->shadow_style = eina_stringshare_add("menu");
mat = E_NEW(Match, 1);
mat = E_NEW(E_Comp_Match, 1);
cfg->match.overrides = eina_list_append(cfg->match.overrides, mat);
mat->primary_type = ECORE_X_WINDOW_TYPE_POPUP_MENU;
mat->shadow_style = eina_stringshare_add("menu");
mat = E_NEW(Match, 1);
mat = E_NEW(E_Comp_Match, 1);
cfg->match.overrides = eina_list_append(cfg->match.overrides, mat);
mat->primary_type = ECORE_X_WINDOW_TYPE_COMBO;
mat->shadow_style = eina_stringshare_add("menu");
mat = E_NEW(Match, 1);
mat = E_NEW(E_Comp_Match, 1);
cfg->match.overrides = eina_list_append(cfg->match.overrides, mat);
mat->primary_type = ECORE_X_WINDOW_TYPE_TOOLTIP;
mat->shadow_style = eina_stringshare_add("menu");
mat = E_NEW(Match, 1);
mat = E_NEW(E_Comp_Match, 1);
cfg->match.overrides = eina_list_append(cfg->match.overrides, mat);
mat->shadow_style = eina_stringshare_add("popup");
cfg->match.menus = NULL;
mat = E_NEW(Match, 1);
mat = E_NEW(E_Comp_Match, 1);
cfg->match.menus = eina_list_append(cfg->match.menus, mat);
mat->shadow_style = eina_stringshare_add("menu");
@ -178,7 +177,7 @@ e_mod_comp_cfdata_config_new(void)
static void
_match_list_free(Eina_List *list)
{
Match *m;
E_Comp_Match *m;
EINA_LIST_FREE(list, m)
{
@ -192,7 +191,7 @@ _match_list_free(Eina_List *list)
}
EAPI void
e_mod_cfdata_config_free(Config *cfg)
e_comp_cfdata_config_free(E_Comp_Config *cfg)
{
if (!cfg) return;
eina_stringshare_del(cfg->shadow_style);
@ -204,4 +203,3 @@ e_mod_cfdata_config_free(Config *cfg)
free(cfg);
}

View File

@ -1,10 +1,10 @@
#ifndef E_MOD_COMP_CFDATA_H
#define E_MOD_COMP_CFDATA_H
typedef struct _Config Config;
typedef struct _Match Match;
struct _Config
#ifdef E_TYPEDEFS
typedef struct _E_Comp_Config E_Comp_Config;
typedef struct _E_Comp_Match E_Comp_Match;
#else
#ifndef E_COMP_CFDATA_H
#define E_COMP_CFDATA_H
struct _E_Comp_Config
{
const char *shadow_style;
int engine;
@ -38,7 +38,7 @@ struct _Config
} match;
};
struct _Match
struct _E_Comp_Match
{
const char *title; // glob - used for borders, NULL if not to be used
const char *name; // glob - used for borders, overrides, popups, NULL if not to be used
@ -60,8 +60,9 @@ struct _Match
char urgent; // used for setting urgent state (on popups): 1 is urgent, unset is use regular logic
};
EAPI void e_mod_comp_cfdata_edd_init(E_Config_DD **conf_edd, E_Config_DD **match_edd);
EAPI Config *e_mod_comp_cfdata_config_new(void);
EAPI void e_mod_cfdata_config_free(Config *cfg);
EAPI void e_comp_cfdata_edd_init(E_Config_DD **conf_edd, E_Config_DD **match_edd);
EAPI E_Comp_Config *e_comp_cfdata_config_new(void);
EAPI void e_comp_cfdata_config_free(E_Comp_Config *cfg);
#endif
#endif

View File

@ -1,11 +1,10 @@
#include "e.h"
#include "e_mod_main.h"
#include "e_mod_comp_update.h"
#include "e_comp_update.h"
//////////////////////////////////////////////////////////////////////////
static void
_e_mod_comp_tiles_alloc(E_Update *up)
_e_comp_tiles_alloc(E_Update *up)
{
if (up->tiles) return;
up->tiles = calloc(up->tw * up->th, sizeof(unsigned char));
@ -14,7 +13,7 @@ _e_mod_comp_tiles_alloc(E_Update *up)
//////////////////////////////////////////////////////////////////////////
E_Update *
e_mod_comp_update_new(void)
e_comp_update_new(void)
{
E_Update *up;
@ -26,32 +25,32 @@ e_mod_comp_update_new(void)
}
void
e_mod_comp_update_free(E_Update *up)
e_comp_update_free(E_Update *up)
{
free(up->tiles);
free(up);
}
void
e_mod_comp_update_policy_set(E_Update *up,
e_comp_update_policy_set(E_Update *up,
E_Update_Policy pol)
{
up->pol = pol;
}
void
e_mod_comp_update_tile_size_set(E_Update *up,
e_comp_update_tile_size_set(E_Update *up,
int tsw,
int tsh)
{
if ((up->tsw == tsw) && (up->tsh == tsh)) return;
up->tsw = tsw;
up->tsh = tsh;
e_mod_comp_update_clear(up);
e_comp_update_clear(up);
}
void
e_mod_comp_update_resize(E_Update *up,
e_comp_update_resize(E_Update *up,
int w,
int h)
{
@ -69,7 +68,7 @@ e_mod_comp_update_resize(E_Update *up,
up->tw = (up->w + up->tsw - 1) / up->tsw;
up->th = (up->h + up->tsh - 1) / up->tsh;
up->tiles = NULL;
_e_mod_comp_tiles_alloc(up);
_e_comp_tiles_alloc(up);
if ((ptiles) && (up->tiles))
{
if (pth <= up->th)
@ -105,7 +104,7 @@ e_mod_comp_update_resize(E_Update *up,
}
void
e_mod_comp_update_add(E_Update *up,
e_comp_update_add(E_Update *up,
int x,
int y,
int w,
@ -117,7 +116,7 @@ e_mod_comp_update_add(E_Update *up,
if ((w <= 0) || (h <= 0)) return;
if ((up->tw <= 0) || (up->th <= 0)) return;
_e_mod_comp_tiles_alloc(up);
_e_comp_tiles_alloc(up);
E_RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, up->w, up->h);
if ((w <= 0) || (h <= 0)) return;
@ -157,7 +156,7 @@ e_mod_comp_update_add(E_Update *up,
}
E_Update_Rect *
e_mod_comp_update_rects_get(E_Update *up)
e_comp_update_rects_get(E_Update *up)
{
E_Update_Rect *r;
int ri = 0;
@ -237,7 +236,7 @@ e_mod_comp_update_rects_get(E_Update *up)
}
void
e_mod_comp_update_clear(E_Update *up)
e_comp_update_clear(E_Update *up)
{
if (up->tiles)
{

46
src/bin/e_comp_update.h Normal file
View File

@ -0,0 +1,46 @@
#ifdef E_TYPEDEFS
typedef struct _E_Update E_Update;
typedef struct _E_Update_Rect E_Update_Rect;
typedef enum _E_Update_Policy
{
E_UPDATE_POLICY_RAW,
E_UPDATE_POLICY_HALF_WIDTH_OR_MORE_ROUND_UP_TO_FULL_WIDTH,
} E_Update_Policy;
#else
#ifndef E_COMP_UPDATE_H
#define E_COMP_UPDATE_H
struct _E_Update_Rect
{
int x, y, w, h;
};
struct _E_Update
{
int w, h;
int tw, th;
int tsw, tsh;
unsigned char *tiles;
E_Update_Policy pol;
};
E_Update *e_comp_update_new(void);
void e_comp_update_free(E_Update *up);
void e_comp_update_policy_set(E_Update *up,
E_Update_Policy pol);
void e_comp_update_tile_size_set(E_Update *up,
int tsw,
int tsh);
void e_comp_update_resize(E_Update *up,
int w,
int h);
void e_comp_update_add(E_Update *up,
int x,
int y,
int w,
int h);
E_Update_Rect *e_comp_update_rects_get(E_Update *up);
void e_comp_update_clear(E_Update *up);
#endif
#endif

View File

@ -1,16 +1,15 @@
#include "e.h"
#include "e_mod_main.h"
#ifdef HAVE_WAYLAND_CLIENTS
# include <xcb/xcb_image.h>
# include "e_mod_comp_wl.h"
# include "e_mod_comp_wl_comp.h"
# include "e_mod_comp_wl_output.h"
# include "e_mod_comp_wl_input.h"
# include "e_mod_comp_wl_shell.h"
# include "e_comp_wl.h"
# include "e_comp_wl_comp.h"
# include "e_comp_wl_output.h"
# include "e_comp_wl_input.h"
# include "e_comp_wl_shell.h"
#endif
/* local function prototypes */
static Eina_Bool _e_mod_comp_wl_fd_handle(void *data, Ecore_Fd_Handler *hdl);
static Eina_Bool _e_comp_wl_fd_handle(void *data, Ecore_Fd_Handler *hdl);
/* private variables */
static Ecore_Fd_Handler *_wl_fd_handler = NULL;
@ -19,7 +18,7 @@ static Ecore_Fd_Handler *_wl_fd_handler = NULL;
struct wl_display *_wl_disp;
Eina_Bool
e_mod_comp_wl_init(void)
e_comp_wl_init(void)
{
struct wl_event_loop *loop;
int fd = 0;
@ -41,7 +40,7 @@ e_mod_comp_wl_init(void)
}
/* init a wayland compositor ?? */
if (!e_mod_comp_wl_comp_init())
if (!e_comp_wl_comp_init())
{
wl_display_terminate(_wl_disp);
EINA_LOG_ERR("Failed to create wayland compositor\n");
@ -49,30 +48,30 @@ e_mod_comp_wl_init(void)
}
/* init output */
if (!e_mod_comp_wl_output_init())
if (!e_comp_wl_output_init())
{
e_mod_comp_wl_comp_shutdown();
e_comp_wl_comp_shutdown();
wl_display_terminate(_wl_disp);
EINA_LOG_ERR("Failed to create wayland output\n");
return EINA_FALSE;
}
/* init input */
if (!e_mod_comp_wl_input_init())
if (!e_comp_wl_input_init())
{
e_mod_comp_wl_output_shutdown();
e_mod_comp_wl_comp_shutdown();
e_comp_wl_output_shutdown();
e_comp_wl_comp_shutdown();
wl_display_terminate(_wl_disp);
EINA_LOG_ERR("Failed to create wayland input\n");
return EINA_FALSE;
}
/* init a wayland shell */
if (!e_mod_comp_wl_shell_init())
if (!e_comp_wl_shell_init())
{
e_mod_comp_wl_input_shutdown();
e_mod_comp_wl_output_shutdown();
e_mod_comp_wl_comp_shutdown();
e_comp_wl_input_shutdown();
e_comp_wl_output_shutdown();
e_comp_wl_comp_shutdown();
wl_display_terminate(_wl_disp);
EINA_LOG_ERR("Failed to create wayland shell\n");
return EINA_FALSE;
@ -83,7 +82,7 @@ e_mod_comp_wl_init(void)
_wl_fd_handler =
ecore_main_fd_handler_add(fd, ECORE_FD_READ,// | ECORE_FD_WRITE,
_e_mod_comp_wl_fd_handle, NULL, NULL, NULL);
_e_comp_wl_fd_handle, NULL, NULL, NULL);
wl_event_loop_dispatch(loop, 0);
@ -91,7 +90,7 @@ e_mod_comp_wl_init(void)
}
void
e_mod_comp_wl_shutdown(void)
e_comp_wl_shutdown(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -99,17 +98,17 @@ e_mod_comp_wl_shutdown(void)
ecore_main_fd_handler_del(_wl_fd_handler);
_wl_fd_handler = NULL;
e_mod_comp_wl_shell_shutdown();
e_mod_comp_wl_input_shutdown();
e_mod_comp_wl_output_shutdown();
e_mod_comp_wl_comp_shutdown();
e_comp_wl_shell_shutdown();
e_comp_wl_input_shutdown();
e_comp_wl_output_shutdown();
e_comp_wl_comp_shutdown();
if (_wl_disp) wl_display_terminate(_wl_disp);
_wl_disp = NULL;
}
uint32_t
e_mod_comp_wl_time_get(void)
e_comp_wl_time_get(void)
{
struct timeval tv;
@ -118,7 +117,7 @@ e_mod_comp_wl_time_get(void)
}
Ecore_X_Pixmap
e_mod_comp_wl_pixmap_get(Ecore_X_Window win)
e_comp_wl_pixmap_get(Ecore_X_Window win)
{
/* Wayland_Compositor *comp; */
/* Wayland_Surface *ws; */
@ -126,7 +125,7 @@ e_mod_comp_wl_pixmap_get(Ecore_X_Window win)
/* LOGFN(__FILE__, __LINE__, __FUNCTION__); */
/* comp = e_mod_comp_wl_comp_get(); */
/* comp = e_comp_wl_comp_get(); */
/* if (wl_list_empty(&comp->surfaces)) return 0; */
/* wl_list_for_each(ws, &comp->surfaces, link) */
@ -180,7 +179,7 @@ e_mod_comp_wl_pixmap_get(Ecore_X_Window win)
/* local functions */
static Eina_Bool
_e_mod_comp_wl_fd_handle(void *data __UNUSED__, Ecore_Fd_Handler *hdl)
_e_comp_wl_fd_handle(void *data __UNUSED__, Ecore_Fd_Handler *hdl)
{
struct wl_event_loop *loop;

View File

@ -1,7 +1,7 @@
#ifdef E_TYPEDEFS
#else
# ifndef E_MOD_COMP_WL_H
# define E_MOD_COMP_WL_H
# ifndef E_COMP_WL_H
# define E_COMP_WL_H
# include <pixman.h>
# include <GLES2/gl2.h>
@ -185,10 +185,10 @@ struct wl_shell
} child;
};
Eina_Bool e_mod_comp_wl_init(void);
void e_mod_comp_wl_shutdown(void);
uint32_t e_mod_comp_wl_time_get(void);
Ecore_X_Pixmap e_mod_comp_wl_pixmap_get(Ecore_X_Window win);
Eina_Bool e_comp_wl_init(void);
void e_comp_wl_shutdown(void);
uint32_t e_comp_wl_time_get(void);
Ecore_X_Pixmap e_comp_wl_pixmap_get(Ecore_X_Window win);
extern struct wl_display *_wl_disp;

View File

@ -1,14 +1,13 @@
#include "e.h"
#include "e_mod_main.h"
#include "e_mod_comp.h"
#include "e_comp.h"
#ifdef HAVE_WAYLAND_CLIENTS
# include "e_mod_comp_wl.h"
# include "e_mod_comp_wl_buffer.h"
# include "e_mod_comp_wl_comp.h"
# include "e_comp_wl.h"
# include "e_comp_wl_buffer.h"
# include "e_comp_wl_comp.h"
#endif
void
e_mod_comp_wl_buffer_post_release(struct wl_buffer *buffer)
e_comp_wl_buffer_post_release(struct wl_buffer *buffer)
{
if (--buffer->busy_count > 0) return;
if (buffer->resource.client)
@ -16,7 +15,7 @@ e_mod_comp_wl_buffer_post_release(struct wl_buffer *buffer)
}
void
e_mod_comp_wl_buffer_attach(struct wl_buffer *buffer, struct wl_surface *surface)
e_comp_wl_buffer_attach(struct wl_buffer *buffer, struct wl_surface *surface)
{
Wayland_Surface *ws;
@ -48,7 +47,7 @@ e_mod_comp_wl_buffer_attach(struct wl_buffer *buffer, struct wl_surface *surface
{
Wayland_Compositor *comp;
comp = e_mod_comp_wl_comp_get();
comp = e_comp_wl_comp_get();
if (ws->image != EGL_NO_IMAGE_KHR)
comp->destroy_image(comp->egl.display, ws->image);
ws->image = comp->create_image(comp->egl.display, NULL,

View File

@ -0,0 +1,10 @@
#ifdef E_TYPEDEFS
#else
# ifndef E_COMP_WL_BUFFER_H
# define E_COMP_WL_BUFFER_H
void e_comp_wl_buffer_post_release(struct wl_buffer *buffer);
void e_comp_wl_buffer_attach(struct wl_buffer *buffer, struct wl_surface *surface);
# endif
#endif

View File

@ -1,11 +1,10 @@
#include "e.h"
#include "e_mod_main.h"
#ifdef HAVE_WAYLAND_CLIENTS
# include "e_mod_comp_wl.h"
# include "e_mod_comp_wl_comp.h"
# include "e_mod_comp_wl_input.h"
# include "e_mod_comp_wl_surface.h"
# include "e_mod_comp_wl_region.h"
# include "e_comp_wl.h"
# include "e_comp_wl_comp.h"
# include "e_comp_wl_input.h"
# include "e_comp_wl_surface.h"
# include "e_comp_wl_region.h"
#endif
#ifdef __linux__
@ -25,47 +24,47 @@
#define MODIFIER_SUPER (1 << 10)
/* local function prototypes */
static Eina_Bool _e_mod_comp_wl_comp_egl_init(void);
static void _e_mod_comp_wl_comp_egl_shutdown(void);
static void _e_mod_comp_wl_comp_destroy(void);
static void _e_mod_comp_wl_comp_bind(struct wl_client *client, void *data, uint32_t version __UNUSED__, uint32_t id);
static void _e_mod_comp_wl_comp_surface_create(struct wl_client *client, struct wl_resource *resource, uint32_t id);
static void _e_mod_comp_wl_comp_region_create(struct wl_client *client, struct wl_resource *resource, unsigned int id);
static void _e_mod_comp_wl_comp_region_destroy(struct wl_resource *resource);
static Eina_Bool _e_mod_comp_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event);
static Eina_Bool _e_mod_comp_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__);
static Eina_Bool _e_mod_comp_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event);
static Eina_Bool _e_mod_comp_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
static Eina_Bool _e_mod_comp_wl_cb_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event);
static Eina_Bool _e_mod_comp_wl_cb_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event);
static Eina_Bool _e_mod_comp_wl_cb_mouse_up(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_comp_wl_comp_egl_init(void);
static void _e_comp_wl_comp_egl_shutdown(void);
static void _e_comp_wl_comp_destroy(void);
static void _e_comp_wl_comp_bind(struct wl_client *client, void *data, uint32_t version __UNUSED__, uint32_t id);
static void _e_comp_wl_comp_surface_create(struct wl_client *client, struct wl_resource *resource, uint32_t id);
static void _e_comp_wl_comp_region_create(struct wl_client *client, struct wl_resource *resource, unsigned int id);
static void _e_comp_wl_comp_region_destroy(struct wl_resource *resource);
static Eina_Bool _e_comp_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event);
static Eina_Bool _e_comp_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__);
static Eina_Bool _e_comp_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event);
static Eina_Bool _e_comp_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
static Eina_Bool _e_comp_wl_cb_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event);
static Eina_Bool _e_comp_wl_cb_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event);
static Eina_Bool _e_comp_wl_cb_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event);
static Eina_Bool _e_comp_wl_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event);
static Eina_Bool _e_comp_wl_cb_key_up(void *data __UNUSED__, int type __UNUSED__, void *event);
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 Wayland_Surface *_e_comp_wl_comp_pick_surface(int32_t x __UNUSED__, int32_t y __UNUSED__, int32_t *sx, int32_t *sy);
static void _e_comp_wl_comp_update_modifier(Wayland_Input *input, uint32_t key, uint32_t state);
/* wayland interfaces */
static const struct wl_compositor_interface _wl_comp_interface =
{
_e_mod_comp_wl_comp_surface_create,
_e_mod_comp_wl_comp_region_create
_e_comp_wl_comp_surface_create,
_e_comp_wl_comp_region_create
};
static const struct wl_surface_interface _wl_surface_interface =
{
e_mod_comp_wl_surface_destroy,
e_mod_comp_wl_surface_attach,
e_mod_comp_wl_surface_damage,
e_mod_comp_wl_surface_frame,
e_mod_comp_wl_surface_set_opaque_region,
e_mod_comp_wl_surface_set_input_region,
e_mod_comp_wl_surface_commit
e_comp_wl_surface_destroy,
e_comp_wl_surface_attach,
e_comp_wl_surface_damage,
e_comp_wl_surface_frame,
e_comp_wl_surface_set_opaque_region,
e_comp_wl_surface_set_input_region,
e_comp_wl_surface_commit
};
static const struct wl_region_interface _wl_region_interface =
{
e_mod_comp_wl_region_destroy,
e_mod_comp_wl_region_add,
e_mod_comp_wl_region_subtract
e_comp_wl_region_destroy,
e_comp_wl_region_add,
e_comp_wl_region_subtract
};
/* private variables */
@ -73,7 +72,7 @@ static Wayland_Compositor *_wl_comp;
static Eina_List *_wl_event_handlers = NULL;
Eina_Bool
e_mod_comp_wl_comp_init(void)
e_comp_wl_comp_init(void)
{
const char *extensions;
@ -87,17 +86,17 @@ e_mod_comp_wl_comp_init(void)
memset(_wl_comp, 0, sizeof(*_wl_comp));
if (!_e_mod_comp_wl_comp_egl_init())
if (!_e_comp_wl_comp_egl_init())
{
EINA_LOG_ERR("Could not initialize egl\n");
free(_wl_comp);
return EINA_FALSE;
}
_wl_comp->destroy = _e_mod_comp_wl_comp_destroy;
_wl_comp->destroy = _e_comp_wl_comp_destroy;
if (!wl_display_add_global(_wl_disp, &wl_compositor_interface, _wl_comp,
_e_mod_comp_wl_comp_bind))
_e_comp_wl_comp_bind))
{
EINA_LOG_ERR("Failed to add compositor to wayland\n");
free(_wl_comp);
@ -138,45 +137,45 @@ e_mod_comp_wl_comp_init(void)
_wl_event_handlers =
eina_list_append(_wl_event_handlers,
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN,
_e_mod_comp_wl_cb_focus_in, NULL));
_e_comp_wl_cb_focus_in, NULL));
_wl_event_handlers =
eina_list_append(_wl_event_handlers,
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT,
_e_mod_comp_wl_cb_focus_out, NULL));
_e_comp_wl_cb_focus_out, NULL));
_wl_event_handlers =
eina_list_append(_wl_event_handlers,
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_IN,
_e_mod_comp_wl_cb_mouse_in, NULL));
_e_comp_wl_cb_mouse_in, NULL));
_wl_event_handlers =
eina_list_append(_wl_event_handlers,
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_OUT,
_e_mod_comp_wl_cb_mouse_out, NULL));
_e_comp_wl_cb_mouse_out, NULL));
_wl_event_handlers =
eina_list_append(_wl_event_handlers,
ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
_e_mod_comp_wl_cb_mouse_move, NULL));
_e_comp_wl_cb_mouse_move, NULL));
_wl_event_handlers =
eina_list_append(_wl_event_handlers,
ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
_e_mod_comp_wl_cb_mouse_down, NULL));
_e_comp_wl_cb_mouse_down, NULL));
_wl_event_handlers =
eina_list_append(_wl_event_handlers,
ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
_e_mod_comp_wl_cb_mouse_up, NULL));
_e_comp_wl_cb_mouse_up, NULL));
_wl_event_handlers =
eina_list_append(_wl_event_handlers,
ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
_e_mod_comp_wl_cb_key_down, NULL));
_e_comp_wl_cb_key_down, NULL));
_wl_event_handlers =
eina_list_append(_wl_event_handlers,
ecore_event_handler_add(ECORE_EVENT_KEY_UP,
_e_mod_comp_wl_cb_key_up, NULL));
_e_comp_wl_cb_key_up, NULL));
return EINA_TRUE;
}
void
e_mod_comp_wl_comp_shutdown(void)
e_comp_wl_comp_shutdown(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -186,13 +185,13 @@ e_mod_comp_wl_comp_shutdown(void)
}
Wayland_Compositor *
e_mod_comp_wl_comp_get(void)
e_comp_wl_comp_get(void)
{
return _wl_comp;
}
void
e_mod_comp_wl_comp_repick(struct wl_seat *seat, uint32_t timestamp __UNUSED__)
e_comp_wl_comp_repick(struct wl_seat *seat, uint32_t timestamp __UNUSED__)
{
Wayland_Surface *ws, *focus;
struct wl_pointer *pointer;
@ -200,7 +199,7 @@ e_mod_comp_wl_comp_repick(struct wl_seat *seat, uint32_t timestamp __UNUSED__)
if (!(pointer = seat->pointer)) return;
ws =
_e_mod_comp_wl_comp_pick_surface(pointer->x, pointer->y,
_e_comp_wl_comp_pick_surface(pointer->x, pointer->y,
&pointer->current_x, &pointer->current_y);
if (!ws) return;
if (&ws->surface != pointer->current)
@ -222,7 +221,7 @@ e_mod_comp_wl_comp_repick(struct wl_seat *seat, uint32_t timestamp __UNUSED__)
/* local functions */
static Eina_Bool
_e_mod_comp_wl_comp_egl_init(void)
_e_comp_wl_comp_egl_init(void)
{
EGLint major, minor, n;
EGLint config_attribs[] =
@ -288,7 +287,7 @@ _e_mod_comp_wl_comp_egl_init(void)
}
static void
_e_mod_comp_wl_comp_egl_shutdown(void)
_e_comp_wl_comp_egl_shutdown(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -299,21 +298,21 @@ _e_mod_comp_wl_comp_egl_shutdown(void)
}
static void
_e_mod_comp_wl_comp_destroy(void)
_e_comp_wl_comp_destroy(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (_wl_comp->has_bind)
_wl_comp->unbind_display(_wl_comp->egl.display, _wl_disp);
_e_mod_comp_wl_comp_egl_shutdown();
_e_comp_wl_comp_egl_shutdown();
if (&_wl_comp->surfaces) wl_list_remove(&_wl_comp->surfaces);
free(_wl_comp);
}
static void
_e_mod_comp_wl_comp_bind(struct wl_client *client, void *data, uint32_t version __UNUSED__, uint32_t id)
_e_comp_wl_comp_bind(struct wl_client *client, void *data, uint32_t version __UNUSED__, uint32_t id)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -322,19 +321,19 @@ _e_mod_comp_wl_comp_bind(struct wl_client *client, void *data, uint32_t version
}
static void
_e_mod_comp_wl_comp_surface_create(struct wl_client *client, struct wl_resource *resource, uint32_t id)
_e_comp_wl_comp_surface_create(struct wl_client *client, struct wl_resource *resource, uint32_t id)
{
Wayland_Surface *ws;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!(ws = e_mod_comp_wl_surface_create(0, 0, 0, 0)))
if (!(ws = e_comp_wl_surface_create(0, 0, 0, 0)))
{
wl_resource_post_no_memory(resource);
return;
}
ws->surface.resource.destroy = e_mod_comp_wl_surface_destroy_surface;
ws->surface.resource.destroy = e_comp_wl_surface_destroy_surface;
ws->surface.resource.object.id = id;
ws->surface.resource.object.interface = &wl_surface_interface;
ws->surface.resource.object.implementation =
@ -345,7 +344,7 @@ _e_mod_comp_wl_comp_surface_create(struct wl_client *client, struct wl_resource
}
static void
_e_mod_comp_wl_comp_region_create(struct wl_client *client, struct wl_resource *resource, unsigned int id)
_e_comp_wl_comp_region_create(struct wl_client *client, struct wl_resource *resource, unsigned int id)
{
Wayland_Region *region;
@ -356,7 +355,7 @@ _e_mod_comp_wl_comp_region_create(struct wl_client *client, struct wl_resource *
return;
}
region->resource.destroy = _e_mod_comp_wl_comp_region_destroy;
region->resource.destroy = _e_comp_wl_comp_region_destroy;
region->resource.object.id = id;
region->resource.object.interface = &wl_region_interface;
region->resource.object.implementation =
@ -368,7 +367,7 @@ _e_mod_comp_wl_comp_region_create(struct wl_client *client, struct wl_resource *
}
static void
_e_mod_comp_wl_comp_region_destroy(struct wl_resource *resource)
_e_comp_wl_comp_region_destroy(struct wl_resource *resource)
{
Wayland_Region *region;
@ -378,7 +377,7 @@ _e_mod_comp_wl_comp_region_destroy(struct wl_resource *resource)
}
static Eina_Bool
_e_mod_comp_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
_e_comp_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Wayland_Input *input;
Wayland_Surface *ws;
@ -389,7 +388,7 @@ _e_mod_comp_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *eve
ev = event;
if (wl_list_empty(&_wl_comp->surfaces)) return ECORE_CALLBACK_PASS_ON;
input = e_mod_comp_wl_input_get();
input = e_comp_wl_input_get();
wl_list_for_each(ws, &_wl_comp->surfaces, link)
{
if (((ws->win) && (ws->win->border))
@ -405,7 +404,7 @@ _e_mod_comp_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *eve
}
static Eina_Bool
_e_mod_comp_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
_e_comp_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
Wayland_Input *input;
/* Ecore_X_Event_Window_Focus_Out *ev; */
@ -413,7 +412,7 @@ _e_mod_comp_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *ev
// LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* ev = event; */
input = e_mod_comp_wl_input_get();
input = e_comp_wl_input_get();
if ((!input) || (!input->seat.keyboard))
return ECORE_CALLBACK_PASS_ON;
wl_keyboard_set_focus(input->seat.keyboard, NULL);
@ -423,7 +422,7 @@ _e_mod_comp_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *ev
}
static Eina_Bool
_e_mod_comp_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
_e_comp_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Wayland_Input *input;
Ecore_X_Event_Mouse_In *ev;
@ -434,20 +433,20 @@ _e_mod_comp_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *eve
ev = event;
if (wl_list_empty(&_wl_comp->surfaces)) return ECORE_CALLBACK_PASS_ON;
input = e_mod_comp_wl_input_get();
input = e_comp_wl_input_get();
ptr = input->seat.pointer;
ptr->x = ev->x;
ptr->y = ev->y;
timestamp = e_mod_comp_wl_time_get();
e_mod_comp_wl_comp_repick(&input->seat, timestamp);
timestamp = e_comp_wl_time_get();
e_comp_wl_comp_repick(&input->seat, timestamp);
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_e_mod_comp_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
_e_comp_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Wayland_Input *input;
Ecore_X_Event_Mouse_Out *ev;
@ -457,16 +456,16 @@ _e_mod_comp_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *ev
ev = event;
if (wl_list_empty(&_wl_comp->surfaces)) return ECORE_CALLBACK_PASS_ON;
input = e_mod_comp_wl_input_get();
input = e_comp_wl_input_get();
timestamp = e_mod_comp_wl_time_get();
e_mod_comp_wl_comp_repick(&input->seat, timestamp);
timestamp = e_comp_wl_time_get();
e_comp_wl_comp_repick(&input->seat, timestamp);
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_e_mod_comp_wl_cb_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
_e_comp_wl_cb_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Wayland_Input *input;
Ecore_Event_Mouse_Move *ev;
@ -479,14 +478,14 @@ _e_mod_comp_wl_cb_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *e
ev = event;
if (wl_list_empty(&_wl_comp->surfaces)) return ECORE_CALLBACK_PASS_ON;
input = e_mod_comp_wl_input_get();
input = e_comp_wl_input_get();
ptr = input->seat.pointer;
ptr->x = ev->x;
ptr->y = ev->y;
timestamp = e_mod_comp_wl_time_get();
e_mod_comp_wl_comp_repick(&input->seat, timestamp);
timestamp = e_comp_wl_time_get();
e_comp_wl_comp_repick(&input->seat, timestamp);
interface = ptr->grab->interface;
interface->motion(ptr->grab, timestamp, ptr->grab->x, ptr->grab->y);
@ -497,7 +496,7 @@ _e_mod_comp_wl_cb_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *e
}
static Eina_Bool
_e_mod_comp_wl_cb_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event)
_e_comp_wl_cb_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Wayland_Input *input;
Ecore_Event_Mouse_Button *ev;
@ -525,9 +524,9 @@ _e_mod_comp_wl_cb_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *e
break;
}
input = e_mod_comp_wl_input_get();
input = e_comp_wl_input_get();
ptr = input->seat.pointer;
timestamp = e_mod_comp_wl_time_get();
timestamp = e_comp_wl_time_get();
if (ptr->button_count == 0)
{
ptr->grab_button = btn;
@ -549,7 +548,7 @@ _e_mod_comp_wl_cb_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *e
}
static Eina_Bool
_e_mod_comp_wl_cb_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event)
_e_comp_wl_cb_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Wayland_Input *input;
Ecore_Event_Mouse_Button *ev;
@ -577,12 +576,12 @@ _e_mod_comp_wl_cb_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *eve
break;
}
input = e_mod_comp_wl_input_get();
input = e_comp_wl_input_get();
ptr = input->seat.pointer;
ptr->button_count--;
/* TODO: Run binding ?? */
timestamp = e_mod_comp_wl_time_get();
timestamp = e_comp_wl_time_get();
ptr->grab->interface->button(ptr->grab, timestamp, btn, 0);
if (ptr->button_count == 1)
@ -592,7 +591,7 @@ _e_mod_comp_wl_cb_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *eve
}
static Eina_Bool
_e_mod_comp_wl_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
_e_comp_wl_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
{
/* Wayland_Input *input; */
/* Ecore_Event_Key *ev; */
@ -605,14 +604,14 @@ _e_mod_comp_wl_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *eve
/* ev = event; */
/* if (wl_list_empty(&_wl_comp->surfaces)) return ECORE_CALLBACK_PASS_ON; */
/* input = e_mod_comp_wl_input_get(); */
/* input = e_comp_wl_input_get(); */
/* kbd = input->seat.keyboard; */
/* timestamp = e_mod_comp_wl_time_get(); */
/* timestamp = e_comp_wl_time_get(); */
/* key = ecore_x_keysym_keycode_get(ev->key); */
/* input->modifier_state = 0; */
/* _e_mod_comp_wl_comp_update_modifier(input, key, 1); */
/* _e_comp_wl_comp_update_modifier(input, key, 1); */
/* end = kbd->keys.data + kbd->keys.size; */
/* for (k = kbd->keys.data; k < end; k++) */
@ -630,7 +629,7 @@ _e_mod_comp_wl_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *eve
}
static Eina_Bool
_e_mod_comp_wl_cb_key_up(void *data __UNUSED__, int type __UNUSED__, void *event)
_e_comp_wl_cb_key_up(void *data __UNUSED__, int type __UNUSED__, void *event)
{
/* Wayland_Input *input; */
/* Ecore_Event_Key *ev; */
@ -643,13 +642,13 @@ _e_mod_comp_wl_cb_key_up(void *data __UNUSED__, int type __UNUSED__, void *event
/* ev = event; */
/* if (wl_list_empty(&_wl_comp->surfaces)) return ECORE_CALLBACK_PASS_ON; */
/* input = e_mod_comp_wl_input_get(); */
/* input = e_comp_wl_input_get(); */
/* device = &input->input_device; */
/* timestamp = e_mod_comp_wl_time_get(); */
/* timestamp = e_comp_wl_time_get(); */
/* key = ecore_x_keysym_keycode_get(ev->key); */
/* _e_mod_comp_wl_comp_update_modifier(input, key, 0); */
/* _e_comp_wl_comp_update_modifier(input, key, 0); */
/* end = device->keys.data + device->keys.size; */
/* for (k = device->keys.data; k < end; k++) */
@ -667,7 +666,7 @@ _e_mod_comp_wl_cb_key_up(void *data __UNUSED__, int type __UNUSED__, void *event
}
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_comp_wl_comp_pick_surface(int32_t x __UNUSED__, int32_t y __UNUSED__, int32_t *sx, int32_t *sy)
{
Wayland_Surface *ws;
@ -684,7 +683,7 @@ _e_mod_comp_wl_comp_pick_surface(int32_t x __UNUSED__, int32_t y __UNUSED__, int
}
static void
_e_mod_comp_wl_comp_update_modifier(Wayland_Input *input, uint32_t key, uint32_t state)
_e_comp_wl_comp_update_modifier(Wayland_Input *input, uint32_t key, uint32_t state)
{
uint32_t mod;

12
src/bin/e_comp_wl_comp.h Normal file
View File

@ -0,0 +1,12 @@
#ifdef E_TYPEDEFS
#else
# ifndef E_COMP_WL_COMP_H
# define E_COMP_WL_COMP_H
Eina_Bool e_comp_wl_comp_init(void);
void e_comp_wl_comp_shutdown(void);
Wayland_Compositor *e_comp_wl_comp_get(void);
void e_comp_wl_comp_repick(struct wl_seat *seat, uint32_t timestamp);
# endif
#endif

View File

@ -1,36 +1,35 @@
#include "e.h"
#include "e_mod_main.h"
#ifdef HAVE_WAYLAND_CLIENTS
# include "e_mod_comp_wl.h"
# include "e_mod_comp_wl_input.h"
# include "e_comp_wl.h"
# include "e_comp_wl_input.h"
#endif
/* local function prototypes */
static void _e_mod_comp_wl_input_bind(struct wl_client *client, void *data, uint32_t version __UNUSED__, uint32_t id);
static void _e_mod_comp_wl_input_unbind(struct wl_resource *resource);
static void _e_mod_comp_wl_input_pointer_get(struct wl_client *client, struct wl_resource *resource, unsigned int id);
static void _e_mod_comp_wl_input_keyboard_get(struct wl_client *client, struct wl_resource *resource, unsigned int id);
static void _e_mod_comp_wl_input_touch_get(struct wl_client *client, struct wl_resource *resource, unsigned int id);
static void _e_mod_comp_wl_input_pointer_cursor_set(struct wl_client *client, struct wl_resource *resource, unsigned int serial, struct wl_resource *surface_resource, int x, int y);
static void _e_comp_wl_input_bind(struct wl_client *client, void *data, uint32_t version __UNUSED__, uint32_t id);
static void _e_comp_wl_input_unbind(struct wl_resource *resource);
static void _e_comp_wl_input_pointer_get(struct wl_client *client, struct wl_resource *resource, unsigned int id);
static void _e_comp_wl_input_keyboard_get(struct wl_client *client, struct wl_resource *resource, unsigned int id);
static void _e_comp_wl_input_touch_get(struct wl_client *client, struct wl_resource *resource, unsigned int id);
static void _e_comp_wl_input_pointer_cursor_set(struct wl_client *client, struct wl_resource *resource, unsigned int serial, struct wl_resource *surface_resource, int x, int y);
/* wayland interfaces */
static const struct wl_seat_interface _wl_seat_interface =
{
_e_mod_comp_wl_input_pointer_get,
_e_mod_comp_wl_input_keyboard_get,
_e_mod_comp_wl_input_touch_get
_e_comp_wl_input_pointer_get,
_e_comp_wl_input_keyboard_get,
_e_comp_wl_input_touch_get
};
static const struct wl_pointer_interface _wl_pointer_interface =
{
_e_mod_comp_wl_input_pointer_cursor_set
_e_comp_wl_input_pointer_cursor_set
};
/* private variables */
static Wayland_Input *_wl_input;
Eina_Bool
e_mod_comp_wl_input_init(void)
e_comp_wl_input_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -44,7 +43,7 @@ e_mod_comp_wl_input_init(void)
wl_seat_init(&_wl_input->seat);
if (!wl_display_add_global(_wl_disp, &wl_seat_interface, _wl_input,
_e_mod_comp_wl_input_bind))
_e_comp_wl_input_bind))
{
EINA_LOG_ERR("Failed to add input to wayland\n");
free(_wl_input);
@ -58,7 +57,7 @@ e_mod_comp_wl_input_init(void)
}
void
e_mod_comp_wl_input_shutdown(void)
e_comp_wl_input_shutdown(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -68,14 +67,14 @@ e_mod_comp_wl_input_shutdown(void)
}
Wayland_Input *
e_mod_comp_wl_input_get(void)
e_comp_wl_input_get(void)
{
return _wl_input;
}
/* local functions */
static void
_e_mod_comp_wl_input_bind(struct wl_client *client, void *data, uint32_t version __UNUSED__, uint32_t id)
_e_comp_wl_input_bind(struct wl_client *client, void *data, uint32_t version __UNUSED__, uint32_t id)
{
Wayland_Input *input;
struct wl_seat *device;
@ -91,7 +90,7 @@ _e_mod_comp_wl_input_bind(struct wl_client *client, void *data, uint32_t version
wl_client_add_object(client, &wl_seat_interface,
&_wl_seat_interface, id, data);
wl_list_insert(&device->base_resource_list, &resource->link);
resource->destroy = _e_mod_comp_wl_input_unbind;
resource->destroy = _e_comp_wl_input_unbind;
if (device->pointer) caps |= WL_SEAT_CAPABILITY_POINTER;
if (device->keyboard) caps |= WL_SEAT_CAPABILITY_KEYBOARD;
@ -101,7 +100,7 @@ _e_mod_comp_wl_input_bind(struct wl_client *client, void *data, uint32_t version
}
static void
_e_mod_comp_wl_input_unbind(struct wl_resource *resource)
_e_comp_wl_input_unbind(struct wl_resource *resource)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -110,7 +109,7 @@ _e_mod_comp_wl_input_unbind(struct wl_resource *resource)
}
static void
_e_mod_comp_wl_input_pointer_get(struct wl_client *client, struct wl_resource *resource, unsigned int id)
_e_comp_wl_input_pointer_get(struct wl_client *client, struct wl_resource *resource, unsigned int id)
{
Wayland_Input *wi;
struct wl_resource *res;
@ -123,7 +122,7 @@ _e_mod_comp_wl_input_pointer_get(struct wl_client *client, struct wl_resource *r
res = wl_client_add_object(client, &wl_pointer_interface,
&_wl_pointer_interface, id, wi);
wl_list_insert(&wi->seat.pointer->resource_list, &res->link);
res->destroy = _e_mod_comp_wl_input_unbind;
res->destroy = _e_comp_wl_input_unbind;
if ((wi->seat.pointer->focus) &&
(wi->seat.pointer->focus->resource.client == client))
@ -137,7 +136,7 @@ _e_mod_comp_wl_input_pointer_get(struct wl_client *client, struct wl_resource *r
}
static void
_e_mod_comp_wl_input_keyboard_get(struct wl_client *client, struct wl_resource *resource, unsigned int id)
_e_comp_wl_input_keyboard_get(struct wl_client *client, struct wl_resource *resource, unsigned int id)
{
Wayland_Input *wi;
struct wl_resource *res;
@ -149,7 +148,7 @@ _e_mod_comp_wl_input_keyboard_get(struct wl_client *client, struct wl_resource *
res = wl_client_add_object(client, &wl_keyboard_interface, NULL, id, wi);
wl_list_insert(&wi->seat.keyboard->resource_list, &res->link);
res->destroy = _e_mod_comp_wl_input_unbind;
res->destroy = _e_comp_wl_input_unbind;
/* TODO: wl_keyboard_send_keymap ?? */
@ -161,7 +160,7 @@ _e_mod_comp_wl_input_keyboard_get(struct wl_client *client, struct wl_resource *
}
static void
_e_mod_comp_wl_input_touch_get(struct wl_client *client, struct wl_resource *resource, unsigned int id)
_e_comp_wl_input_touch_get(struct wl_client *client, struct wl_resource *resource, unsigned int id)
{
Wayland_Input *wi;
struct wl_resource *res;
@ -173,11 +172,11 @@ _e_mod_comp_wl_input_touch_get(struct wl_client *client, struct wl_resource *res
res = wl_client_add_object(client, &wl_touch_interface, NULL, id, wi);
wl_list_insert(&wi->seat.touch->resource_list, &res->link);
res->destroy = _e_mod_comp_wl_input_unbind;
res->destroy = _e_comp_wl_input_unbind;
}
static void
_e_mod_comp_wl_input_pointer_cursor_set(struct wl_client *client, struct wl_resource *resource, unsigned int serial, struct wl_resource *surface_resource, int x, int y)
_e_comp_wl_input_pointer_cursor_set(struct wl_client *client, struct wl_resource *resource, unsigned int serial, struct wl_resource *surface_resource, int x, int y)
{
/* Wayland_Input *wi; */
/* Wayland_Surface *ws; */
@ -219,7 +218,7 @@ _e_mod_comp_wl_input_pointer_cursor_set(struct wl_client *client, struct wl_reso
}
/* static void */
/* _e_mod_comp_wl_input_attach(struct wl_client *client, struct wl_resource *resource, uint32_t serial, struct wl_resource *buffer_resource __UNUSED__, int32_t x, int32_t y) */
/* _e_comp_wl_input_attach(struct wl_client *client, struct wl_resource *resource, uint32_t serial, struct wl_resource *buffer_resource __UNUSED__, int32_t x, int32_t y) */
/* { */
/* Wayland_Input *wi; */

11
src/bin/e_comp_wl_input.h Normal file
View File

@ -0,0 +1,11 @@
#ifdef E_TYPEDEFS
#else
# ifndef E_COMP_WL_INPUT_H
# define E_COMP_WL_INPUT_H
Eina_Bool e_comp_wl_input_init(void);
void e_comp_wl_input_shutdown(void);
Wayland_Input *e_comp_wl_input_get(void);
# endif
#endif

View File

@ -1,20 +1,19 @@
#include "e.h"
#include "e_mod_main.h"
#ifdef HAVE_WAYLAND_CLIENTS
# include "e_mod_comp_wl.h"
# include "e_mod_comp_wl_output.h"
# include "e_comp_wl.h"
# include "e_comp_wl_output.h"
#endif
# define WL_OUTPUT_FLIPPED 0x01
/* local function prototypes */
static void _e_mod_comp_wl_output_bind(struct wl_client *client, void *data, uint32_t version __UNUSED__, uint32_t id);
static void _e_comp_wl_output_bind(struct wl_client *client, void *data, uint32_t version __UNUSED__, uint32_t id);
/* private variables */
static Wayland_Output *_wl_output;
Eina_Bool
e_mod_comp_wl_output_init(void)
e_comp_wl_output_init(void)
{
Ecore_X_Window *roots;
int num = 0, rw, rh;
@ -54,7 +53,7 @@ e_mod_comp_wl_output_init(void)
wl_list_init(&_wl_output->frame_callbacks);
if (!wl_display_add_global(_wl_disp, &wl_output_interface, _wl_output,
_e_mod_comp_wl_output_bind))
_e_comp_wl_output_bind))
{
EINA_LOG_ERR("Failed to add output to wayland\n");
free(_wl_output);
@ -65,7 +64,7 @@ e_mod_comp_wl_output_init(void)
}
void
e_mod_comp_wl_output_shutdown(void)
e_comp_wl_output_shutdown(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -76,14 +75,14 @@ e_mod_comp_wl_output_shutdown(void)
}
Wayland_Output *
e_mod_comp_wl_output_get(void)
e_comp_wl_output_get(void)
{
return _wl_output;
}
/* local functions */
static void
_e_mod_comp_wl_output_bind(struct wl_client *client, void *data, uint32_t version __UNUSED__, uint32_t id)
_e_comp_wl_output_bind(struct wl_client *client, void *data, uint32_t version __UNUSED__, uint32_t id)
{
Wayland_Output *output;
struct wl_resource *resource;

View File

@ -0,0 +1,11 @@
#ifdef E_TYPEDEFS
#else
# ifndef E_COMP_WL_OUTPUT_H
# define E_COMP_WL_OUTPUT_H
Eina_Bool e_comp_wl_output_init(void);
void e_comp_wl_output_shutdown(void);
Wayland_Output *e_comp_wl_output_get(void);
# endif
#endif

View File

@ -1,19 +1,18 @@
#include "e.h"
#include "e_mod_main.h"
#ifdef HAVE_WAYLAND_CLIENTS
# include "e_mod_comp_wl.h"
# include "e_mod_comp_wl_comp.h"
# include "e_mod_comp_wl_region.h"
# include "e_comp_wl.h"
# include "e_comp_wl_comp.h"
# include "e_comp_wl_region.h"
#endif
void
e_mod_comp_wl_region_destroy(struct wl_client *client __UNUSED__, struct wl_resource *resource)
e_comp_wl_region_destroy(struct wl_client *client __UNUSED__, struct wl_resource *resource)
{
wl_resource_destroy(resource);
}
void
e_mod_comp_wl_region_add(struct wl_client *client __UNUSED__, struct wl_resource *resource, int x, int y, int w, int h)
e_comp_wl_region_add(struct wl_client *client __UNUSED__, struct wl_resource *resource, int x, int y, int w, int h)
{
Wayland_Region *region;
@ -22,7 +21,7 @@ e_mod_comp_wl_region_add(struct wl_client *client __UNUSED__, struct wl_resource
}
void
e_mod_comp_wl_region_subtract(struct wl_client *client __UNUSED__, struct wl_resource *resource, int x, int y, int w, int h)
e_comp_wl_region_subtract(struct wl_client *client __UNUSED__, struct wl_resource *resource, int x, int y, int w, int h)
{
Wayland_Region *region;
pixman_region32_t rect;

View File

@ -0,0 +1,11 @@
#ifdef E_TYPEDEFS
#else
# ifndef E_COMP_WL_REGION_H
# define E_COMP_WL_REGION_H
void e_comp_wl_region_destroy(struct wl_client *client __UNUSED__, struct wl_resource *resource);
void e_comp_wl_region_add(struct wl_client *client __UNUSED__, struct wl_resource *resource, int x, int y, int w, int h);
void e_comp_wl_region_subtract(struct wl_client *client __UNUSED__, struct wl_resource *resource, int x, int y, int w, int h);
# endif
#endif

475
src/bin/e_comp_wl_shell.c Normal file
View File

@ -0,0 +1,475 @@
#include "e.h"
#ifdef HAVE_WAYLAND_CLIENTS
# include "e_comp_wl.h"
# include "e_comp_wl_comp.h"
# include "e_comp_wl_output.h"
# include "e_comp_wl_input.h"
# include "e_comp_wl_shell.h"
# include "e_comp_wl_surface.h"
#endif
/* local function prototypes */
static void _e_comp_wl_shell_bind(struct wl_client *client, void *data, uint32_t version __UNUSED__, uint32_t id);
static void _e_comp_wl_shell_lock(Wayland_Shell *base);
static void _e_comp_wl_shell_unlock(Wayland_Shell *base);
static void _e_comp_wl_shell_map(Wayland_Shell *base, Wayland_Surface *surface, int32_t width, int32_t height);
static void _e_comp_wl_shell_configure(Wayland_Shell *base, Wayland_Surface *surface, int32_t x, int32_t y, int32_t width, int32_t height);
static void _e_comp_wl_shell_destroy(Wayland_Shell *base);
static void _e_comp_wl_shell_activate(Wayland_Shell *base, Wayland_Surface *surface, uint32_t timestamp);
static void _e_comp_wl_shell_shell_surface_get(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface_resource);
static void _e_comp_wl_shell_surface_pong(struct wl_client *client __UNUSED__, struct wl_resource *resource, unsigned int serial);
static void _e_comp_wl_shell_surface_move(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource, uint32_t timestamp);
static void _e_comp_wl_shell_surface_resize(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource, uint32_t timestamp, uint32_t edges);
static void _e_comp_wl_shell_surface_set_toplevel(struct wl_client *client __UNUSED__, struct wl_resource *resource);
static void _e_comp_wl_shell_surface_set_transient(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *parent_resource, int32_t x, int32_t y, uint32_t flags __UNUSED__);
static void _e_comp_wl_shell_surface_set_fullscreen(struct wl_client *client __UNUSED__, struct wl_resource *resource, uint32_t method __UNUSED__, uint32_t framerate __UNUSED__, struct wl_resource *output_resource __UNUSED__);
static void _e_comp_wl_shell_surface_set_popup(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource __UNUSED__, uint32_t timestamp __UNUSED__, struct wl_resource *parent_resource, int32_t x, int32_t y, uint32_t flags __UNUSED__);
static void _e_comp_wl_shell_surface_set_maximized(struct wl_client *client, struct wl_resource *resource, struct wl_resource *output_resource __UNUSED__);
static void _e_comp_wl_shell_surface_set_title(struct wl_client *client, struct wl_resource *resource, const char *title);
static void _e_comp_wl_shell_surface_set_class(struct wl_client *client, struct wl_resource *resource, const char *clas);
static void _e_comp_wl_shell_surface_destroy_handle(struct wl_listener *listener, void *data __UNUSED__);
static Wayland_Shell_Surface *_e_comp_wl_shell_get_shell_surface(Wayland_Surface *ws);
static void _e_comp_wl_shell_surface_destroy(struct wl_resource *resource);
/* wayland interfaces */
static const struct wl_shell_interface _wl_shell_interface =
{
_e_comp_wl_shell_shell_surface_get
};
static const struct wl_shell_surface_interface _wl_shell_surface_interface =
{
_e_comp_wl_shell_surface_pong,
_e_comp_wl_shell_surface_move,
_e_comp_wl_shell_surface_resize,
_e_comp_wl_shell_surface_set_toplevel,
_e_comp_wl_shell_surface_set_transient,
_e_comp_wl_shell_surface_set_fullscreen,
_e_comp_wl_shell_surface_set_popup,
_e_comp_wl_shell_surface_set_maximized,
_e_comp_wl_shell_surface_set_title,
_e_comp_wl_shell_surface_set_class
};
/* private variables */
struct wl_shell *_wl_shell;
Eina_Bool
e_comp_wl_shell_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!(_wl_shell = malloc(sizeof(*_wl_shell))))
{
EINA_LOG_ERR("Could not allocate space for shell\n");
return EINA_FALSE;
}
memset(_wl_shell, 0, sizeof(*_wl_shell));
_wl_shell->shell.lock = _e_comp_wl_shell_lock;
_wl_shell->shell.unlock = _e_comp_wl_shell_unlock;
_wl_shell->shell.map = _e_comp_wl_shell_map;
_wl_shell->shell.configure = _e_comp_wl_shell_configure;
_wl_shell->shell.destroy = _e_comp_wl_shell_destroy;
if (!wl_display_add_global(_wl_disp, &wl_shell_interface, _wl_shell,
_e_comp_wl_shell_bind))
{
EINA_LOG_ERR("Could not create shell\n");
free(_wl_shell);
return EINA_FALSE;
}
return EINA_TRUE;
}
void
e_comp_wl_shell_shutdown(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (_wl_shell)
_wl_shell->shell.destroy(&_wl_shell->shell);
}
struct wl_shell *
e_comp_wl_shell_get(void)
{
return _wl_shell;
}
/* local functions */
static void
_e_comp_wl_shell_bind(struct wl_client *client, void *data, uint32_t version __UNUSED__, uint32_t id)
{
struct wl_shell *shell;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
shell = data;
wl_client_add_object(client, &wl_shell_interface, &_wl_shell_interface,
id, shell);
}
static void
_e_comp_wl_shell_lock(Wayland_Shell *base)
{
struct wl_shell *shell;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
shell = container_of(base, struct wl_shell, shell);
}
static void
_e_comp_wl_shell_unlock(Wayland_Shell *base)
{
struct wl_shell *shell;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
shell = container_of(base, struct wl_shell, shell);
}
static void
_e_comp_wl_shell_map(Wayland_Shell *base, Wayland_Surface *surface, int32_t width, int32_t height)
{
Wayland_Compositor *comp;
Wayland_Shell_Surface *wss;
struct wl_shell *shell;
struct wl_list *list;
uint32_t type;
Eina_Bool do_configure = EINA_FALSE;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
comp = e_comp_wl_comp_get();
type = SHELL_SURFACE_NONE;
shell = container_of(base, struct wl_shell, shell);
if ((wss = _e_comp_wl_shell_get_shell_surface(surface)))
type = wss->type;
if (shell->locked)
{
list = &shell->hidden_surfaces;
do_configure = EINA_FALSE;
}
else
{
list = &comp->surfaces;
do_configure = EINA_TRUE;
}
surface->w = width;
surface->h = height;
switch (type)
{
case SHELL_SURFACE_TOPLEVEL:
surface->x = 10 + random() % 400;
surface->y = 10 + random() % 400;
break;
default:
wl_list_insert(list, &surface->link);
break;
}
if (do_configure)
e_comp_wl_surface_configure(surface, surface->x, surface->y,
surface->w, surface->h);
switch (type)
{
case SHELL_SURFACE_TOPLEVEL:
case SHELL_SURFACE_TRANSIENT:
case SHELL_SURFACE_FULLSCREEN:
if (!shell->locked)
_e_comp_wl_shell_activate(base, surface, e_comp_wl_time_get());
break;
}
}
static void
_e_comp_wl_shell_configure(Wayland_Shell *base, Wayland_Surface *surface, int32_t x, int32_t y, int32_t width, int32_t height)
{
struct wl_shell *shell;
Wayland_Shell_Surface *wss;
Wayland_Shell_Surface_Type type;
Eina_Bool do_configure = EINA_FALSE;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
type = SHELL_SURFACE_NONE;
shell = container_of(base, struct wl_shell, shell);
do_configure = !shell->locked;
if ((wss = _e_comp_wl_shell_get_shell_surface(surface)))
type = wss->type;
surface->w = width;
surface->h = height;
switch (type)
{
case SHELL_SURFACE_SCREENSAVER:
do_configure = !do_configure;
case SHELL_SURFACE_FULLSCREEN:
break;
default:
break;
}
if (do_configure)
e_comp_wl_surface_configure(surface, x, y, width, height);
}
static void
_e_comp_wl_shell_destroy(Wayland_Shell *base)
{
struct wl_shell *shell;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
shell = container_of(base, struct wl_shell, shell);
if (shell->child.client) wl_client_destroy(shell->child.client);
free(shell);
}
static void
_e_comp_wl_shell_activate(Wayland_Shell *base, Wayland_Surface *surface, uint32_t timestamp)
{
struct wl_shell *shell;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
shell = container_of(base, struct wl_shell, shell);
e_comp_wl_surface_activate(surface, e_comp_wl_input_get(), timestamp);
}
static void
_e_comp_wl_shell_shell_surface_get(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface_resource)
{
Wayland_Surface *ws;
Wayland_Shell_Surface *wss;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ws = surface_resource->data;
if (_e_comp_wl_shell_get_shell_surface(ws))
{
wl_resource_post_error(surface_resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
"get_shell_surface already requested");
return;
}
if (!(wss = calloc(1, sizeof(*wss))))
{
wl_resource_post_no_memory(resource);
return;
}
wss->resource.destroy = _e_comp_wl_shell_surface_destroy;
wss->resource.object.id = id;
wss->resource.object.interface = &wl_shell_surface_interface;
wss->resource.object.implementation =
(void (* *)(void)) & _wl_shell_surface_interface;
wss->resource.data = wss;
wss->surface = ws;
wss->surface_destroy_listener.notify =
_e_comp_wl_shell_surface_destroy_handle;
wl_signal_add(&ws->surface.resource.destroy_signal,
&wss->surface_destroy_listener);
wl_list_init(&wss->link);
wss->type = SHELL_SURFACE_NONE;
wl_client_add_resource(client, &wss->resource);
}
static void
_e_comp_wl_shell_surface_pong(struct wl_client *client __UNUSED__, struct wl_resource *resource, unsigned int serial)
{
Wayland_Shell_Surface *wss;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
wss = resource->data;
/* TODO: handle ping timer */
}
static void
_e_comp_wl_shell_surface_move(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource, uint32_t timestamp)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
}
static void
_e_comp_wl_shell_surface_resize(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource, uint32_t timestamp, uint32_t edges)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
}
static void
_e_comp_wl_shell_surface_set_toplevel(struct wl_client *client __UNUSED__, struct wl_resource *resource)
{
Wayland_Shell_Surface *wss;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
wss = resource->data;
/* TODO: Surface type reset */
e_comp_wl_surface_damage_surface(wss->surface);
wss->type = SHELL_SURFACE_TOPLEVEL;
}
static void
_e_comp_wl_shell_surface_set_transient(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *parent_resource, int32_t x, int32_t y, uint32_t flags __UNUSED__)
{
Wayland_Shell_Surface *wss, *pss;
Wayland_Surface *ws, *pws;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
wss = resource->data;
pss = parent_resource->data;
ws = wss->surface;
pws = pss->surface;
/* TODO: Surface type reset */
ws->x = pws->x + x;
ws->y = pws->y + y;
e_comp_wl_surface_damage_surface(ws);
wss->type = SHELL_SURFACE_TRANSIENT;
}
static void
_e_comp_wl_shell_surface_set_fullscreen(struct wl_client *client __UNUSED__, struct wl_resource *resource, uint32_t method __UNUSED__, uint32_t framerate __UNUSED__, struct wl_resource *output_resource __UNUSED__)
{
Wayland_Shell_Surface *wss;
Wayland_Surface *ws;
Wayland_Output *output;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
wss = resource->data;
ws = wss->surface;
output = e_comp_wl_output_get();
wss->saved_x = ws->x;
wss->saved_y = ws->y;
ws->x = (output->w - ws->w) / 2;
ws->y = (output->h - ws->h) / 2;
e_comp_wl_surface_damage_surface(ws);
wss->type = SHELL_SURFACE_FULLSCREEN;
}
static void
_e_comp_wl_shell_surface_set_popup(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource __UNUSED__, uint32_t timestamp __UNUSED__, struct wl_resource *parent_resource, int32_t x, int32_t y, uint32_t flags __UNUSED__)
{
Wayland_Shell_Surface *wss;
Wayland_Surface *ws;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
wss = resource->data;
ws = wss->surface;
e_comp_wl_surface_damage_surface(ws);
wss->type = SHELL_SURFACE_POPUP;
wss->parent = parent_resource->data;
wss->popup.x = x;
wss->popup.y = y;
}
static void
_e_comp_wl_shell_surface_set_maximized(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *output_resource __UNUSED__)
{
Wayland_Shell_Surface *wss;
Wayland_Surface *ws;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
wss = resource->data;
ws = wss->surface;
/* FIXME: Implement */
}
static void
_e_comp_wl_shell_surface_set_title(struct wl_client *client, struct wl_resource *resource, const char *title)
{
Wayland_Shell_Surface *wss;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
wss = resource->data;
free(wss->title);
wss->title = strdup(title);
}
static void
_e_comp_wl_shell_surface_set_class(struct wl_client *client, struct wl_resource *resource, const char *clas)
{
Wayland_Shell_Surface *wss;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
wss = resource->data;
free(wss->clas);
wss->clas = strdup(clas);
}
static void
_e_comp_wl_shell_surface_destroy_handle(struct wl_listener *listener, void *data __UNUSED__)
{
Wayland_Shell_Surface *wss;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
wss = container_of(listener, Wayland_Shell_Surface, surface_destroy_listener);
wss->surface = NULL;
wl_resource_destroy(&wss->resource);
}
static Wayland_Shell_Surface *
_e_comp_wl_shell_get_shell_surface(Wayland_Surface *ws)
{
struct wl_listener *listener;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
listener =
wl_signal_get(&ws->surface.resource.destroy_signal,
_e_comp_wl_shell_surface_destroy_handle);
if (listener)
return container_of(listener, Wayland_Shell_Surface,
surface_destroy_listener);
return NULL;
}
static void
_e_comp_wl_shell_surface_destroy(struct wl_resource *resource)
{
Wayland_Shell_Surface *wss;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
wss = resource->data;
/* TODO: popup grab input */
if (wss->surface) wl_list_remove(&wss->surface_destroy_listener.link);
wl_list_remove(&wss->link);
free(wss);
}

11
src/bin/e_comp_wl_shell.h Normal file
View File

@ -0,0 +1,11 @@
#ifdef E_TYPEDEFS
#else
# ifndef E_COMP_WL_SHELL_H
# define E_COMP_WL_SHELL_H
Eina_Bool e_comp_wl_shell_init(void);
void e_comp_wl_shell_shutdown(void);
struct wl_shell *e_comp_wl_shell_get(void);
# endif
#endif

View File

@ -1,23 +1,22 @@
#include "e.h"
#include "e_mod_main.h"
#ifdef HAVE_WAYLAND_CLIENTS
# include "e_mod_comp_wl.h"
# include "e_mod_comp_wl_comp.h"
# include "e_mod_comp_wl_output.h"
# include "e_mod_comp_wl_input.h"
# include "e_mod_comp_wl_shell.h"
# include "e_mod_comp_wl_surface.h"
# include "e_mod_comp_wl_buffer.h"
# include "e_comp_wl.h"
# include "e_comp_wl_comp.h"
# include "e_comp_wl_output.h"
# include "e_comp_wl_input.h"
# include "e_comp_wl_shell.h"
# include "e_comp_wl_surface.h"
# include "e_comp_wl_buffer.h"
#endif
/* local function prototypes */
static void _e_mod_comp_wl_surface_buffer_destroy_handle(struct wl_listener *listener, void *data __UNUSED__);
static void _e_mod_comp_wl_surface_raise(Wayland_Surface *ws);
static void _e_mod_comp_wl_surface_damage_rectangle(Wayland_Surface *ws, int32_t x, int32_t y, int32_t width, int32_t height);
static void _e_mod_comp_wl_surface_frame_destroy_callback(struct wl_resource *resource);
static void _e_comp_wl_surface_buffer_destroy_handle(struct wl_listener *listener, void *data __UNUSED__);
static void _e_comp_wl_surface_raise(Wayland_Surface *ws);
static void _e_comp_wl_surface_damage_rectangle(Wayland_Surface *ws, int32_t x, int32_t y, int32_t width, int32_t height);
static void _e_comp_wl_surface_frame_destroy_callback(struct wl_resource *resource);
Wayland_Surface *
e_mod_comp_wl_surface_create(int32_t x, int32_t y, int32_t w, int32_t h)
e_comp_wl_surface_create(int32_t x, int32_t y, int32_t w, int32_t h)
{
Wayland_Surface *ws;
@ -52,7 +51,7 @@ e_mod_comp_wl_surface_create(int32_t x, int32_t y, int32_t w, int32_t h)
wl_list_init(&ws->frame_callbacks);
ws->buffer_destroy_listener.notify =
_e_mod_comp_wl_surface_buffer_destroy_handle;
_e_comp_wl_surface_buffer_destroy_handle;
/* ws->transform = NULL; */
@ -60,7 +59,7 @@ e_mod_comp_wl_surface_create(int32_t x, int32_t y, int32_t w, int32_t h)
}
void
e_mod_comp_wl_surface_destroy(struct wl_client *client __UNUSED__, struct wl_resource *resource)
e_comp_wl_surface_destroy(struct wl_client *client __UNUSED__, struct wl_resource *resource)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -68,7 +67,7 @@ e_mod_comp_wl_surface_destroy(struct wl_client *client __UNUSED__, struct wl_res
}
void
e_mod_comp_wl_surface_attach(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *buffer_resource, int32_t x, int32_t y)
e_comp_wl_surface_attach(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *buffer_resource, int32_t x, int32_t y)
{
Wayland_Surface *ws;
struct wl_buffer *buffer;
@ -78,13 +77,13 @@ e_mod_comp_wl_surface_attach(struct wl_client *client __UNUSED__, struct wl_reso
ws = resource->data;
buffer = buffer_resource->data;
shell = e_mod_comp_wl_shell_get();
shell = e_comp_wl_shell_get();
/* TODO: damage below ?? */
if (ws->buffer)
{
e_mod_comp_wl_buffer_post_release(ws->buffer);
e_comp_wl_buffer_post_release(ws->buffer);
wl_list_remove(&ws->buffer_destroy_listener.link);
}
@ -100,22 +99,22 @@ e_mod_comp_wl_surface_attach(struct wl_client *client __UNUSED__, struct wl_reso
shell->shell.configure(&shell->shell, ws, ws->x + x, ws->y + y,
buffer->width, buffer->height);
e_mod_comp_wl_buffer_attach(buffer, &ws->surface);
e_comp_wl_buffer_attach(buffer, &ws->surface);
}
void
e_mod_comp_wl_surface_damage(struct wl_client *client __UNUSED__, struct wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
e_comp_wl_surface_damage(struct wl_client *client __UNUSED__, struct wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
{
Wayland_Surface *ws;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ws = resource->data;
_e_mod_comp_wl_surface_damage_rectangle(ws, x, y, width, height);
_e_comp_wl_surface_damage_rectangle(ws, x, y, width, height);
}
void
e_mod_comp_wl_surface_frame(struct wl_client *client, struct wl_resource *resource, uint32_t callback)
e_comp_wl_surface_frame(struct wl_client *client, struct wl_resource *resource, uint32_t callback)
{
Wayland_Surface *ws;
Wayland_Frame_Callback *cb;
@ -131,7 +130,7 @@ e_mod_comp_wl_surface_frame(struct wl_client *client, struct wl_resource *resour
cb->resource.object.interface = &wl_callback_interface;
cb->resource.object.id = callback;
cb->resource.destroy = _e_mod_comp_wl_surface_frame_destroy_callback;
cb->resource.destroy = _e_comp_wl_surface_frame_destroy_callback;
cb->resource.client = client;
cb->resource.data = cb;
@ -140,7 +139,7 @@ e_mod_comp_wl_surface_frame(struct wl_client *client, struct wl_resource *resour
}
void
e_mod_comp_wl_surface_set_opaque_region(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *region_resource)
e_comp_wl_surface_set_opaque_region(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *region_resource)
{
Wayland_Surface *ws;
@ -161,7 +160,7 @@ e_mod_comp_wl_surface_set_opaque_region(struct wl_client *client __UNUSED__, str
}
void
e_mod_comp_wl_surface_set_input_region(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *region_resource)
e_comp_wl_surface_set_input_region(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *region_resource)
{
Wayland_Surface *ws;
Wayland_Input *input;
@ -180,12 +179,12 @@ e_mod_comp_wl_surface_set_input_region(struct wl_client *client __UNUSED__, stru
else
pixman_region32_init_rect(&ws->input, 0, 0, ws->w, ws->h);
input = e_mod_comp_wl_input_get();
e_mod_comp_wl_comp_repick(&input->seat, e_mod_comp_wl_time_get());
input = e_comp_wl_input_get();
e_comp_wl_comp_repick(&input->seat, e_comp_wl_time_get());
}
void
e_mod_comp_wl_surface_commit(struct wl_client *client, struct wl_resource *resource)
e_comp_wl_surface_commit(struct wl_client *client, struct wl_resource *resource)
{
Wayland_Surface *ws;
pixman_region32_t opaque;
@ -196,8 +195,8 @@ e_mod_comp_wl_surface_commit(struct wl_client *client, struct wl_resource *resou
/* TODO: handle 'pending' ?? */
e_mod_comp_wl_surface_configure(ws, ws->x, ws->y, ws->w, ws->h);
e_mod_comp_wl_surface_damage_surface(ws);
e_comp_wl_surface_configure(ws, ws->x, ws->y, ws->w, ws->h);
e_comp_wl_surface_damage_surface(ws);
pixman_region32_init_rect(&opaque, 0, 0, ws->w, ws->h);
pixman_region32_intersect(&opaque, &opaque, &ws->opaque);
@ -216,7 +215,7 @@ e_mod_comp_wl_surface_commit(struct wl_client *client, struct wl_resource *resou
}
void
e_mod_comp_wl_surface_destroy_surface(struct wl_resource *resource)
e_comp_wl_surface_destroy_surface(struct wl_resource *resource)
{
Wayland_Surface *ws;
Wayland_Input *input;
@ -228,13 +227,13 @@ e_mod_comp_wl_surface_destroy_surface(struct wl_resource *resource)
/* TODO: damage below */
/* TODO: flush damage */
input = e_mod_comp_wl_input_get();
input = e_comp_wl_input_get();
if (ws->win)
e_object_del(E_OBJECT(ws->win));
wl_list_remove(&ws->link);
e_mod_comp_wl_comp_repick(&input->seat, e_mod_comp_wl_time_get());
e_comp_wl_comp_repick(&input->seat, e_comp_wl_time_get());
if (ws->texture) glDeleteTextures(1, &ws->texture);
@ -245,7 +244,7 @@ e_mod_comp_wl_surface_destroy_surface(struct wl_resource *resource)
{
Wayland_Compositor *comp;
comp = e_mod_comp_wl_comp_get();
comp = e_comp_wl_comp_get();
comp->destroy_image(comp->egl.display, ws->image);
}
@ -258,7 +257,7 @@ e_mod_comp_wl_surface_destroy_surface(struct wl_resource *resource)
}
void
e_mod_comp_wl_surface_configure(Wayland_Surface *ws, int32_t x, int32_t y, int32_t width, int32_t height)
e_comp_wl_surface_configure(Wayland_Surface *ws, int32_t x, int32_t y, int32_t width, int32_t height)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -278,13 +277,13 @@ e_mod_comp_wl_surface_configure(Wayland_Surface *ws, int32_t x, int32_t y, int32
{
Wayland_Output *output;
output = e_mod_comp_wl_output_get();
output = e_comp_wl_output_get();
wl_list_insert_list(output->frame_callbacks.prev,
&ws->frame_callbacks);
wl_list_init(&ws->frame_callbacks);
}
e_mod_comp_wl_surface_damage_surface(ws);
e_comp_wl_surface_damage_surface(ws);
pixman_region32_fini(&ws->opaque);
if (ws->visual == WAYLAND_RGB_VISUAL)
@ -294,7 +293,7 @@ e_mod_comp_wl_surface_configure(Wayland_Surface *ws, int32_t x, int32_t y, int32
}
void
e_mod_comp_wl_surface_activate(Wayland_Surface *ws, Wayland_Input *wi, uint32_t timestamp __UNUSED__)
e_comp_wl_surface_activate(Wayland_Surface *ws, Wayland_Input *wi, uint32_t timestamp __UNUSED__)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -304,7 +303,7 @@ e_mod_comp_wl_surface_activate(Wayland_Surface *ws, Wayland_Input *wi, uint32_t
ws->win->border->borderless = EINA_TRUE;
}
_e_mod_comp_wl_surface_raise(ws);
_e_comp_wl_surface_raise(ws);
if (wi->seat.keyboard)
{
@ -316,16 +315,16 @@ e_mod_comp_wl_surface_activate(Wayland_Surface *ws, Wayland_Input *wi, uint32_t
}
void
e_mod_comp_wl_surface_damage_surface(Wayland_Surface *ws)
e_comp_wl_surface_damage_surface(Wayland_Surface *ws)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_e_mod_comp_wl_surface_damage_rectangle(ws, 0, 0, ws->w, ws->h);
_e_comp_wl_surface_damage_rectangle(ws, 0, 0, ws->w, ws->h);
}
/* local functions */
static void
_e_mod_comp_wl_surface_buffer_destroy_handle(struct wl_listener *listener, void *data __UNUSED__)
_e_comp_wl_surface_buffer_destroy_handle(struct wl_listener *listener, void *data __UNUSED__)
{
Wayland_Surface *ws;
@ -336,24 +335,24 @@ _e_mod_comp_wl_surface_buffer_destroy_handle(struct wl_listener *listener, void
}
static void
_e_mod_comp_wl_surface_raise(Wayland_Surface *ws)
_e_comp_wl_surface_raise(Wayland_Surface *ws)
{
Wayland_Compositor *comp;
Wayland_Input *input;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
comp = e_mod_comp_wl_comp_get();
input = e_mod_comp_wl_input_get();
comp = e_comp_wl_comp_get();
input = e_comp_wl_input_get();
wl_list_remove(&ws->link);
wl_list_insert(&comp->surfaces, &ws->link);
e_mod_comp_wl_comp_repick(&input->seat, e_mod_comp_wl_time_get());
e_mod_comp_wl_surface_damage_surface(ws);
e_comp_wl_comp_repick(&input->seat, e_comp_wl_time_get());
e_comp_wl_surface_damage_surface(ws);
}
static void
_e_mod_comp_wl_surface_damage_rectangle(Wayland_Surface *ws, int32_t x, int32_t y, int32_t width, int32_t height)
_e_comp_wl_surface_damage_rectangle(Wayland_Surface *ws, int32_t x, int32_t y, int32_t width, int32_t height)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -362,7 +361,7 @@ _e_mod_comp_wl_surface_damage_rectangle(Wayland_Surface *ws, int32_t x, int32_t
}
static void
_e_mod_comp_wl_surface_frame_destroy_callback(struct wl_resource *resource)
_e_comp_wl_surface_frame_destroy_callback(struct wl_resource *resource)
{
Wayland_Frame_Callback *cb;

View File

@ -0,0 +1,20 @@
#ifdef E_TYPEDEFS
#else
# ifndef E_COMP_WL_SURFACE_H
# define E_COMP_WL_SURFACE_H
Wayland_Surface *e_comp_wl_surface_create(int32_t x, int32_t y, int32_t w, int32_t h);
void e_comp_wl_surface_destroy(struct wl_client *client __UNUSED__, struct wl_resource *resource);
void e_comp_wl_surface_attach(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *buffer_resource, int32_t x, int32_t y);
void e_comp_wl_surface_damage(struct wl_client *client __UNUSED__, struct wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
void e_comp_wl_surface_frame(struct wl_client *client, struct wl_resource *resource, uint32_t callback);
void e_comp_wl_surface_set_opaque_region(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *region_resource);
void e_comp_wl_surface_set_input_region(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *region_resource);
void e_comp_wl_surface_commit(struct wl_client *client, struct wl_resource *resource);
void e_comp_wl_surface_destroy_surface(struct wl_resource *resource);
void e_comp_wl_surface_configure(Wayland_Surface *ws, int32_t x, int32_t y, int32_t width, int32_t height);
void e_comp_wl_surface_activate(Wayland_Surface *ws, Wayland_Input *wi, uint32_t timestamp);
void e_comp_wl_surface_damage_surface(Wayland_Surface *ws);
# endif
#endif

View File

@ -150,3 +150,6 @@
#include "e_widget_filepreview.h"
#include "e_dbusmenu.h"
#include "e_notification.h"
#include "e_comp.h"
#include "e_comp_cfdata.h"
#include "e_comp_update.h"

View File

@ -665,6 +665,11 @@ main(int argc, char **argv)
e_screensaver_preinit();
TS("E_Comp Init");
e_comp_init();
TS("E_Comp Init Done");
_e_main_shutdown_push(e_comp_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup Screens"));
TS("Screens Init");

View File

@ -94,6 +94,10 @@ if USE_MODULE_CONF2
include Makefile_conf2.am
endif
if USE_MODULE_CONF_COMP
include Makefile_conf_comp.am
endif
if USE_MODULE_CONF_WALLPAPER2
include Makefile_conf_wallpaper2.am
endif
@ -198,10 +202,6 @@ if USE_MODULE_APPMENU
include Makefile_appmenu.am
endif
if USE_MODULE_COMP
include Makefile_comp.am
endif
if USE_MODULE_PHYSICS
include Makefile_physics.am
endif

View File

@ -1,45 +0,0 @@
compdir = $(MDIR)/comp
comp_DATA = comp/e-module-comp.edj \
comp/module.desktop
EXTRA_DIST += $(comp_DATA)
comppkgdir = $(MDIR)/comp/$(MODULE_ARCH)
comppkg_LTLIBRARIES = comp/module.la
comp_module_la_SOURCES = comp/e_mod_main.h \
comp/e_mod_main.c \
comp/e_mod_config.c \
comp/e_mod_config.h \
comp/e_mod_comp.c \
comp/e_mod_comp.h \
comp/e_mod_comp_update.c \
comp/e_mod_comp_update.h \
comp/e_mod_comp_cfdata.c \
comp/e_mod_comp_cfdata.h
if HAVE_WAYLAND_CLIENTS
comp_module_la_SOURCES += comp/e_mod_comp_wl.h \
comp/e_mod_comp_wl.c \
comp/e_mod_comp_wl_comp.h \
comp/e_mod_comp_wl_comp.c \
comp/e_mod_comp_wl_output.h \
comp/e_mod_comp_wl_output.c \
comp/e_mod_comp_wl_input.h \
comp/e_mod_comp_wl_input.c \
comp/e_mod_comp_wl_shell.h \
comp/e_mod_comp_wl_shell.c \
comp/e_mod_comp_wl_surface.h \
comp/e_mod_comp_wl_surface.c \
comp/e_mod_comp_wl_buffer.h \
comp/e_mod_comp_wl_buffer.c \
comp/e_mod_comp_wl_region.h \
comp/e_mod_comp_wl_region.c
endif
comp_module_la_CFLAGS = $(AM_CFLAGS) @WAYLAND_CFLAGS@
comp_module_la_LIBADD = @WAYLAND_LIBS@
.PHONY: comp install-comp
comp: $(comppkg_LTLIBRARIES) $(comp_DATA)
install-comp: install-compDATA install-comppkgLTLIBRARIES

View File

@ -0,0 +1,17 @@
conf_compdir = $(MDIR)/conf_comp
conf_comp_DATA = conf_comp/e-module-comp.edj \
conf_comp/module.desktop
EXTRA_DIST += $(comp_DATA)
conf_comppkgdir = $(MDIR)/conf_comp/$(MODULE_ARCH)
conf_comppkg_LTLIBRARIES = conf_comp/module.la
conf_comp_module_la_SOURCES = conf_comp/e_mod_main.h \
conf_comp/e_mod_main.c \
conf_comp/e_mod_config.c \
conf_comp/e_mod_config.h
.PHONY: conf_comp install-conf_comp
conf_comp: $(conf_mppkg_LTLIBRARIES) $(conf_comp_DATA)
install-conf_comp: install-conf_compDATA install-conf_comppkgLTLIBRARIES

View File

@ -79,27 +79,7 @@ wizard_page_130_la_SOURCES = wizard/page_130.c
wizard_page_140_la_SOURCES = wizard/page_140.c
wizard/e_mod_comp_main.h: $(abs_top_srcdir)/src/modules/comp/e_mod_main.h
$(AM_V_GEN) $(LN_S) -f $< $@
wizard/e_mod_comp_cfdata.h: $(abs_top_srcdir)/src/modules/comp/e_mod_comp_cfdata.h
$(AM_V_GEN) $(LN_S) -f $< $@
wizard/e_mod_comp_cfdata.c: $(top_srcdir)/src/modules/comp/e_mod_comp_cfdata.c wizard/e_mod_comp_main.h wizard/e_mod_comp_cfdata.h
$(AM_V_GEN) $(SED) 's/e_mod_main\.h/e_mod_comp_main.h/g' $< > $@
$(wizard_page_150_la_OBJECTS): wizard/e_mod_comp_cfdata.c
CLEANFILES += wizard/e_mod_comp_cfdata.c \
wizard/e_mod_comp_cfdata.h \
wizard/e_mod_comp_main.h
wizard_page_150_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/wizard/
wizard_page_150_la_SOURCES = wizard/page_150.c
nodist_wizard_page_150_la_SOURCES = wizard/e_mod_comp_cfdata.c \
wizard/e_mod_comp_cfdata.h \
wizard/e_mod_comp_main.h
wizard_page_160_la_SOURCES = wizard/page_160.c

View File

@ -1,47 +0,0 @@
#ifdef E_TYPEDEFS
#else
#ifndef E_MOD_COMP_UPDATE_H
#define E_MOD_COMP_UPDATE_H
typedef struct _E_Update E_Update;
typedef struct _E_Update_Rect E_Update_Rect;
typedef enum _E_Update_Policy
{
E_UPDATE_POLICY_RAW,
E_UPDATE_POLICY_HALF_WIDTH_OR_MORE_ROUND_UP_TO_FULL_WIDTH,
} E_Update_Policy;
struct _E_Update_Rect
{
int x, y, w, h;
};
struct _E_Update
{
int w, h;
int tw, th;
int tsw, tsh;
unsigned char *tiles;
E_Update_Policy pol;
};
E_Update *e_mod_comp_update_new(void);
void e_mod_comp_update_free(E_Update *up);
void e_mod_comp_update_policy_set(E_Update *up,
E_Update_Policy pol);
void e_mod_comp_update_tile_size_set(E_Update *up,
int tsw,
int tsh);
void e_mod_comp_update_resize(E_Update *up,
int w,
int h);
void e_mod_comp_update_add(E_Update *up,
int x,
int y,
int w,
int h);
E_Update_Rect *e_mod_comp_update_rects_get(E_Update *up);
void e_mod_comp_update_clear(E_Update *up);
#endif
#endif

View File

@ -1,10 +0,0 @@
#ifdef E_TYPEDEFS
#else
# ifndef E_MOD_COMP_WL_BUFFER_H
# define E_MOD_COMP_WL_BUFFER_H
void e_mod_comp_wl_buffer_post_release(struct wl_buffer *buffer);
void e_mod_comp_wl_buffer_attach(struct wl_buffer *buffer, struct wl_surface *surface);
# endif
#endif

View File

@ -1,12 +0,0 @@
#ifdef E_TYPEDEFS
#else
# ifndef E_MOD_COMP_WL_COMP_H
# define E_MOD_COMP_WL_COMP_H
Eina_Bool e_mod_comp_wl_comp_init(void);
void e_mod_comp_wl_comp_shutdown(void);
Wayland_Compositor *e_mod_comp_wl_comp_get(void);
void e_mod_comp_wl_comp_repick(struct wl_seat *seat, uint32_t timestamp);
# endif
#endif

View File

@ -1,11 +0,0 @@
#ifdef E_TYPEDEFS
#else
# ifndef E_MOD_COMP_WL_INPUT_H
# define E_MOD_COMP_WL_INPUT_H
Eina_Bool e_mod_comp_wl_input_init(void);
void e_mod_comp_wl_input_shutdown(void);
Wayland_Input *e_mod_comp_wl_input_get(void);
# endif
#endif

View File

@ -1,11 +0,0 @@
#ifdef E_TYPEDEFS
#else
# ifndef E_MOD_COMP_WL_OUTPUT_H
# define E_MOD_COMP_WL_OUTPUT_H
Eina_Bool e_mod_comp_wl_output_init(void);
void e_mod_comp_wl_output_shutdown(void);
Wayland_Output *e_mod_comp_wl_output_get(void);
# endif
#endif

View File

@ -1,11 +0,0 @@
#ifdef E_TYPEDEFS
#else
# ifndef E_MOD_COMP_WL_REGION_H
# define E_MOD_COMP_WL_REGION_H
void e_mod_comp_wl_region_destroy(struct wl_client *client __UNUSED__, struct wl_resource *resource);
void e_mod_comp_wl_region_add(struct wl_client *client __UNUSED__, struct wl_resource *resource, int x, int y, int w, int h);
void e_mod_comp_wl_region_subtract(struct wl_client *client __UNUSED__, struct wl_resource *resource, int x, int y, int w, int h);
# endif
#endif

View File

@ -1,476 +0,0 @@
#include "e.h"
#include "e_mod_main.h"
#ifdef HAVE_WAYLAND_CLIENTS
# include "e_mod_comp_wl.h"
# include "e_mod_comp_wl_comp.h"
# include "e_mod_comp_wl_output.h"
# include "e_mod_comp_wl_input.h"
# include "e_mod_comp_wl_shell.h"
# include "e_mod_comp_wl_surface.h"
#endif
/* local function prototypes */
static void _e_mod_comp_wl_shell_bind(struct wl_client *client, void *data, uint32_t version __UNUSED__, uint32_t id);
static void _e_mod_comp_wl_shell_lock(Wayland_Shell *base);
static void _e_mod_comp_wl_shell_unlock(Wayland_Shell *base);
static void _e_mod_comp_wl_shell_map(Wayland_Shell *base, Wayland_Surface *surface, int32_t width, int32_t height);
static void _e_mod_comp_wl_shell_configure(Wayland_Shell *base, Wayland_Surface *surface, int32_t x, int32_t y, int32_t width, int32_t height);
static void _e_mod_comp_wl_shell_destroy(Wayland_Shell *base);
static void _e_mod_comp_wl_shell_activate(Wayland_Shell *base, Wayland_Surface *surface, uint32_t timestamp);
static void _e_mod_comp_wl_shell_shell_surface_get(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface_resource);
static void _e_mod_comp_wl_shell_surface_pong(struct wl_client *client __UNUSED__, struct wl_resource *resource, unsigned int serial);
static void _e_mod_comp_wl_shell_surface_move(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource, uint32_t timestamp);
static void _e_mod_comp_wl_shell_surface_resize(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource, uint32_t timestamp, uint32_t edges);
static void _e_mod_comp_wl_shell_surface_set_toplevel(struct wl_client *client __UNUSED__, struct wl_resource *resource);
static void _e_mod_comp_wl_shell_surface_set_transient(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *parent_resource, int32_t x, int32_t y, uint32_t flags __UNUSED__);
static void _e_mod_comp_wl_shell_surface_set_fullscreen(struct wl_client *client __UNUSED__, struct wl_resource *resource, uint32_t method __UNUSED__, uint32_t framerate __UNUSED__, struct wl_resource *output_resource __UNUSED__);
static void _e_mod_comp_wl_shell_surface_set_popup(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource __UNUSED__, uint32_t timestamp __UNUSED__, struct wl_resource *parent_resource, int32_t x, int32_t y, uint32_t flags __UNUSED__);
static void _e_mod_comp_wl_shell_surface_set_maximized(struct wl_client *client, struct wl_resource *resource, struct wl_resource *output_resource __UNUSED__);
static void _e_mod_comp_wl_shell_surface_set_title(struct wl_client *client, struct wl_resource *resource, const char *title);
static void _e_mod_comp_wl_shell_surface_set_class(struct wl_client *client, struct wl_resource *resource, const char *clas);
static void _e_mod_comp_wl_shell_surface_destroy_handle(struct wl_listener *listener, void *data __UNUSED__);
static Wayland_Shell_Surface *_e_mod_comp_wl_shell_get_shell_surface(Wayland_Surface *ws);
static void _e_mod_comp_wl_shell_surface_destroy(struct wl_resource *resource);
/* wayland interfaces */
static const struct wl_shell_interface _wl_shell_interface =
{
_e_mod_comp_wl_shell_shell_surface_get
};
static const struct wl_shell_surface_interface _wl_shell_surface_interface =
{
_e_mod_comp_wl_shell_surface_pong,
_e_mod_comp_wl_shell_surface_move,
_e_mod_comp_wl_shell_surface_resize,
_e_mod_comp_wl_shell_surface_set_toplevel,
_e_mod_comp_wl_shell_surface_set_transient,
_e_mod_comp_wl_shell_surface_set_fullscreen,
_e_mod_comp_wl_shell_surface_set_popup,
_e_mod_comp_wl_shell_surface_set_maximized,
_e_mod_comp_wl_shell_surface_set_title,
_e_mod_comp_wl_shell_surface_set_class
};
/* private variables */
struct wl_shell *_wl_shell;
Eina_Bool
e_mod_comp_wl_shell_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!(_wl_shell = malloc(sizeof(*_wl_shell))))
{
EINA_LOG_ERR("Could not allocate space for shell\n");
return EINA_FALSE;
}
memset(_wl_shell, 0, sizeof(*_wl_shell));
_wl_shell->shell.lock = _e_mod_comp_wl_shell_lock;
_wl_shell->shell.unlock = _e_mod_comp_wl_shell_unlock;
_wl_shell->shell.map = _e_mod_comp_wl_shell_map;
_wl_shell->shell.configure = _e_mod_comp_wl_shell_configure;
_wl_shell->shell.destroy = _e_mod_comp_wl_shell_destroy;
if (!wl_display_add_global(_wl_disp, &wl_shell_interface, _wl_shell,
_e_mod_comp_wl_shell_bind))
{
EINA_LOG_ERR("Could not create shell\n");
free(_wl_shell);
return EINA_FALSE;
}
return EINA_TRUE;
}
void
e_mod_comp_wl_shell_shutdown(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (_wl_shell)
_wl_shell->shell.destroy(&_wl_shell->shell);
}
struct wl_shell *
e_mod_comp_wl_shell_get(void)
{
return _wl_shell;
}
/* local functions */
static void
_e_mod_comp_wl_shell_bind(struct wl_client *client, void *data, uint32_t version __UNUSED__, uint32_t id)
{
struct wl_shell *shell;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
shell = data;
wl_client_add_object(client, &wl_shell_interface, &_wl_shell_interface,
id, shell);
}
static void
_e_mod_comp_wl_shell_lock(Wayland_Shell *base)
{
struct wl_shell *shell;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
shell = container_of(base, struct wl_shell, shell);
}
static void
_e_mod_comp_wl_shell_unlock(Wayland_Shell *base)
{
struct wl_shell *shell;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
shell = container_of(base, struct wl_shell, shell);
}
static void
_e_mod_comp_wl_shell_map(Wayland_Shell *base, Wayland_Surface *surface, int32_t width, int32_t height)
{
Wayland_Compositor *comp;
Wayland_Shell_Surface *wss;
struct wl_shell *shell;
struct wl_list *list;
uint32_t type;
Eina_Bool do_configure = EINA_FALSE;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
comp = e_mod_comp_wl_comp_get();
type = SHELL_SURFACE_NONE;
shell = container_of(base, struct wl_shell, shell);
if ((wss = _e_mod_comp_wl_shell_get_shell_surface(surface)))
type = wss->type;
if (shell->locked)
{
list = &shell->hidden_surfaces;
do_configure = EINA_FALSE;
}
else
{
list = &comp->surfaces;
do_configure = EINA_TRUE;
}
surface->w = width;
surface->h = height;
switch (type)
{
case SHELL_SURFACE_TOPLEVEL:
surface->x = 10 + random() % 400;
surface->y = 10 + random() % 400;
break;
default:
wl_list_insert(list, &surface->link);
break;
}
if (do_configure)
e_mod_comp_wl_surface_configure(surface, surface->x, surface->y,
surface->w, surface->h);
switch (type)
{
case SHELL_SURFACE_TOPLEVEL:
case SHELL_SURFACE_TRANSIENT:
case SHELL_SURFACE_FULLSCREEN:
if (!shell->locked)
_e_mod_comp_wl_shell_activate(base, surface, e_mod_comp_wl_time_get());
break;
}
}
static void
_e_mod_comp_wl_shell_configure(Wayland_Shell *base, Wayland_Surface *surface, int32_t x, int32_t y, int32_t width, int32_t height)
{
struct wl_shell *shell;
Wayland_Shell_Surface *wss;
Wayland_Shell_Surface_Type type;
Eina_Bool do_configure = EINA_FALSE;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
type = SHELL_SURFACE_NONE;
shell = container_of(base, struct wl_shell, shell);
do_configure = !shell->locked;
if ((wss = _e_mod_comp_wl_shell_get_shell_surface(surface)))
type = wss->type;
surface->w = width;
surface->h = height;
switch (type)
{
case SHELL_SURFACE_SCREENSAVER:
do_configure = !do_configure;
case SHELL_SURFACE_FULLSCREEN:
break;
default:
break;
}
if (do_configure)
e_mod_comp_wl_surface_configure(surface, x, y, width, height);
}
static void
_e_mod_comp_wl_shell_destroy(Wayland_Shell *base)
{
struct wl_shell *shell;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
shell = container_of(base, struct wl_shell, shell);
if (shell->child.client) wl_client_destroy(shell->child.client);
free(shell);
}
static void
_e_mod_comp_wl_shell_activate(Wayland_Shell *base, Wayland_Surface *surface, uint32_t timestamp)
{
struct wl_shell *shell;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
shell = container_of(base, struct wl_shell, shell);
e_mod_comp_wl_surface_activate(surface, e_mod_comp_wl_input_get(), timestamp);
}
static void
_e_mod_comp_wl_shell_shell_surface_get(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface_resource)
{
Wayland_Surface *ws;
Wayland_Shell_Surface *wss;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ws = surface_resource->data;
if (_e_mod_comp_wl_shell_get_shell_surface(ws))
{
wl_resource_post_error(surface_resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
"get_shell_surface already requested");
return;
}
if (!(wss = calloc(1, sizeof(*wss))))
{
wl_resource_post_no_memory(resource);
return;
}
wss->resource.destroy = _e_mod_comp_wl_shell_surface_destroy;
wss->resource.object.id = id;
wss->resource.object.interface = &wl_shell_surface_interface;
wss->resource.object.implementation =
(void (* *)(void)) & _wl_shell_surface_interface;
wss->resource.data = wss;
wss->surface = ws;
wss->surface_destroy_listener.notify =
_e_mod_comp_wl_shell_surface_destroy_handle;
wl_signal_add(&ws->surface.resource.destroy_signal,
&wss->surface_destroy_listener);
wl_list_init(&wss->link);
wss->type = SHELL_SURFACE_NONE;
wl_client_add_resource(client, &wss->resource);
}
static void
_e_mod_comp_wl_shell_surface_pong(struct wl_client *client __UNUSED__, struct wl_resource *resource, unsigned int serial)
{
Wayland_Shell_Surface *wss;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
wss = resource->data;
/* TODO: handle ping timer */
}
static void
_e_mod_comp_wl_shell_surface_move(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource, uint32_t timestamp)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
}
static void
_e_mod_comp_wl_shell_surface_resize(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource, uint32_t timestamp, uint32_t edges)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
}
static void
_e_mod_comp_wl_shell_surface_set_toplevel(struct wl_client *client __UNUSED__, struct wl_resource *resource)
{
Wayland_Shell_Surface *wss;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
wss = resource->data;
/* TODO: Surface type reset */
e_mod_comp_wl_surface_damage_surface(wss->surface);
wss->type = SHELL_SURFACE_TOPLEVEL;
}
static void
_e_mod_comp_wl_shell_surface_set_transient(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *parent_resource, int32_t x, int32_t y, uint32_t flags __UNUSED__)
{
Wayland_Shell_Surface *wss, *pss;
Wayland_Surface *ws, *pws;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
wss = resource->data;
pss = parent_resource->data;
ws = wss->surface;
pws = pss->surface;
/* TODO: Surface type reset */
ws->x = pws->x + x;
ws->y = pws->y + y;
e_mod_comp_wl_surface_damage_surface(ws);
wss->type = SHELL_SURFACE_TRANSIENT;
}
static void
_e_mod_comp_wl_shell_surface_set_fullscreen(struct wl_client *client __UNUSED__, struct wl_resource *resource, uint32_t method __UNUSED__, uint32_t framerate __UNUSED__, struct wl_resource *output_resource __UNUSED__)
{
Wayland_Shell_Surface *wss;
Wayland_Surface *ws;
Wayland_Output *output;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
wss = resource->data;
ws = wss->surface;
output = e_mod_comp_wl_output_get();
wss->saved_x = ws->x;
wss->saved_y = ws->y;
ws->x = (output->w - ws->w) / 2;
ws->y = (output->h - ws->h) / 2;
e_mod_comp_wl_surface_damage_surface(ws);
wss->type = SHELL_SURFACE_FULLSCREEN;
}
static void
_e_mod_comp_wl_shell_surface_set_popup(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource __UNUSED__, uint32_t timestamp __UNUSED__, struct wl_resource *parent_resource, int32_t x, int32_t y, uint32_t flags __UNUSED__)
{
Wayland_Shell_Surface *wss;
Wayland_Surface *ws;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
wss = resource->data;
ws = wss->surface;
e_mod_comp_wl_surface_damage_surface(ws);
wss->type = SHELL_SURFACE_POPUP;
wss->parent = parent_resource->data;
wss->popup.x = x;
wss->popup.y = y;
}
static void
_e_mod_comp_wl_shell_surface_set_maximized(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *output_resource __UNUSED__)
{
Wayland_Shell_Surface *wss;
Wayland_Surface *ws;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
wss = resource->data;
ws = wss->surface;
/* FIXME: Implement */
}
static void
_e_mod_comp_wl_shell_surface_set_title(struct wl_client *client, struct wl_resource *resource, const char *title)
{
Wayland_Shell_Surface *wss;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
wss = resource->data;
free(wss->title);
wss->title = strdup(title);
}
static void
_e_mod_comp_wl_shell_surface_set_class(struct wl_client *client, struct wl_resource *resource, const char *clas)
{
Wayland_Shell_Surface *wss;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
wss = resource->data;
free(wss->clas);
wss->clas = strdup(clas);
}
static void
_e_mod_comp_wl_shell_surface_destroy_handle(struct wl_listener *listener, void *data __UNUSED__)
{
Wayland_Shell_Surface *wss;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
wss = container_of(listener, Wayland_Shell_Surface, surface_destroy_listener);
wss->surface = NULL;
wl_resource_destroy(&wss->resource);
}
static Wayland_Shell_Surface *
_e_mod_comp_wl_shell_get_shell_surface(Wayland_Surface *ws)
{
struct wl_listener *listener;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
listener =
wl_signal_get(&ws->surface.resource.destroy_signal,
_e_mod_comp_wl_shell_surface_destroy_handle);
if (listener)
return container_of(listener, Wayland_Shell_Surface,
surface_destroy_listener);
return NULL;
}
static void
_e_mod_comp_wl_shell_surface_destroy(struct wl_resource *resource)
{
Wayland_Shell_Surface *wss;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
wss = resource->data;
/* TODO: popup grab input */
if (wss->surface) wl_list_remove(&wss->surface_destroy_listener.link);
wl_list_remove(&wss->link);
free(wss);
}

View File

@ -1,11 +0,0 @@
#ifdef E_TYPEDEFS
#else
# ifndef E_MOD_COMP_WL_SHELL_H
# define E_MOD_COMP_WL_SHELL_H
Eina_Bool e_mod_comp_wl_shell_init(void);
void e_mod_comp_wl_shell_shutdown(void);
struct wl_shell *e_mod_comp_wl_shell_get(void);
# endif
#endif

View File

@ -1,20 +0,0 @@
#ifdef E_TYPEDEFS
#else
# ifndef E_MOD_COMP_WL_SURFACE_H
# define E_MOD_COMP_WL_SURFACE_H
Wayland_Surface *e_mod_comp_wl_surface_create(int32_t x, int32_t y, int32_t w, int32_t h);
void e_mod_comp_wl_surface_destroy(struct wl_client *client __UNUSED__, struct wl_resource *resource);
void e_mod_comp_wl_surface_attach(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *buffer_resource, int32_t x, int32_t y);
void e_mod_comp_wl_surface_damage(struct wl_client *client __UNUSED__, struct wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
void e_mod_comp_wl_surface_frame(struct wl_client *client, struct wl_resource *resource, uint32_t callback);
void e_mod_comp_wl_surface_set_opaque_region(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *region_resource);
void e_mod_comp_wl_surface_set_input_region(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *region_resource);
void e_mod_comp_wl_surface_commit(struct wl_client *client, struct wl_resource *resource);
void e_mod_comp_wl_surface_destroy_surface(struct wl_resource *resource);
void e_mod_comp_wl_surface_configure(Wayland_Surface *ws, int32_t x, int32_t y, int32_t width, int32_t height);
void e_mod_comp_wl_surface_activate(Wayland_Surface *ws, Wayland_Input *wi, uint32_t timestamp);
void e_mod_comp_wl_surface_damage_surface(Wayland_Surface *ws);
# endif
#endif

View File

@ -1,7 +1,8 @@
#include "e.h"
#include "e_mod_main.h"
#include "e_mod_config.h"
#include "e_mod_comp.h"
#include "e_comp.h"
#include "e_comp_cfdata.h"
typedef struct _E_Demo_Style_Item
{
@ -15,7 +16,7 @@ typedef struct _E_Demo_Style_Item
typedef struct _Match_Config
{
Match match;
E_Comp_Match match;
E_Config_Dialog *cfd;
char *title, *name, *clas, *role;
int borderless, dialog, accepts_focus, vkbd;
@ -110,7 +111,7 @@ e_int_config_comp_module(E_Container *con,
}
static void
_match_dup(Match *m,
_match_dup(E_Comp_Match *m,
Match_Config *m2)
{
m2->match = *m;
@ -126,7 +127,7 @@ _create_data(E_Config_Dialog *cfd)
{
E_Config_Dialog_Data *cfdata;
Eina_List *l;
Match *m;
E_Comp_Match *m;
Match_Config *m2;
cfdata = E_NEW(E_Config_Dialog_Data, 1);
@ -678,7 +679,7 @@ _create_edit_frame(E_Config_Dialog *cfd,
evas_object_resize(o, w, h);
evas_object_show(o);
of = e_widget_frametable_add(evas, _("Edit Match"), 0);
of = e_widget_frametable_add(evas, _("Edit E_Comp_Match"), 0);
evas_object_data_set(of, "bg", o);
evas_object_data_set(of, "dia", cfd->dia->bg_object);
evas_object_move(of, x, y);
@ -1347,7 +1348,7 @@ _advanced_create_widgets(E_Config_Dialog *cfd,
static void
_match_list_free(Eina_List *list)
{
Match *m;
E_Comp_Match *m;
EINA_LIST_FREE(list, m)
{
@ -1362,7 +1363,7 @@ _match_list_free(Eina_List *list)
static void
_match_dup2(Match_Config *m2,
Match *m)
E_Comp_Match *m)
{
*m = m2->match;
if (m->title) m->title = eina_stringshare_add(m->title);
@ -1397,7 +1398,7 @@ _advanced_apply_data(E_Config_Dialog *cfd __UNUSED__,
if (cfdata->match.changed)
{
Eina_List *l;
Match *m;
E_Comp_Match *m;
Match_Config *m2;
_match_list_free(_comp_mod->conf->match.popups);
@ -1412,28 +1413,28 @@ _advanced_apply_data(E_Config_Dialog *cfd __UNUSED__,
EINA_LIST_FOREACH(cfdata->match.popups, l, m2)
{
m = E_NEW(Match, 1);
m = E_NEW(E_Comp_Match, 1);
_match_dup2(m2, m);
_comp_mod->conf->match.popups =
eina_list_append(_comp_mod->conf->match.popups, m);
}
EINA_LIST_FOREACH(cfdata->match.borders, l, m2)
{
m = E_NEW(Match, 1);
m = E_NEW(E_Comp_Match, 1);
_match_dup2(m2, m);
_comp_mod->conf->match.borders =
eina_list_append(_comp_mod->conf->match.borders, m);
}
EINA_LIST_FOREACH(cfdata->match.overrides, l, m2)
{
m = E_NEW(Match, 1);
m = E_NEW(E_Comp_Match, 1);
_match_dup2(m2, m);
_comp_mod->conf->match.overrides =
eina_list_append(_comp_mod->conf->match.overrides, m);
}
EINA_LIST_FOREACH(cfdata->match.menus, l, m2)
{
m = E_NEW(Match, 1);
m = E_NEW(E_Comp_Match, 1);
_match_dup2(m2, m);
_comp_mod->conf->match.menus =
eina_list_append(_comp_mod->conf->match.menus, m);
@ -1459,7 +1460,7 @@ _advanced_apply_data(E_Config_Dialog *cfd __UNUSED__,
_comp_mod->conf->shadow_style = NULL;
if (cfdata->shadow_style)
_comp_mod->conf->shadow_style = eina_stringshare_add(cfdata->shadow_style);
e_mod_comp_shadow_set();
e_comp_shadow_set();
}
if ((cfdata->engine != _comp_mod->conf->engine) ||
(cfdata->indirect != _comp_mod->conf->indirect) ||
@ -1481,8 +1482,6 @@ _advanced_apply_data(E_Config_Dialog *cfd __UNUSED__,
a = e_action_find("restart");
if ((a) && (a->func.go)) a->func.go(NULL, NULL);
// e_mod_comp_shutdown();
// e_mod_comp_init();
}
e_config_save_queue();
return 1;
@ -1578,7 +1577,7 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__,
if (cfdata->match.changed)
{
Eina_List *l;
Match *m;
E_Comp_Match *m;
Match_Config *m2;
_match_list_free(_comp_mod->conf->match.popups);
@ -1593,28 +1592,28 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__,
EINA_LIST_FOREACH(cfdata->match.popups, l, m2)
{
m = E_NEW(Match, 1);
m = E_NEW(E_Comp_Match, 1);
_match_dup2(m2, m);
_comp_mod->conf->match.popups =
eina_list_append(_comp_mod->conf->match.popups, m);
}
EINA_LIST_FOREACH(cfdata->match.borders, l, m2)
{
m = E_NEW(Match, 1);
m = E_NEW(E_Comp_Match, 1);
_match_dup2(m2, m);
_comp_mod->conf->match.borders =
eina_list_append(_comp_mod->conf->match.borders, m);
}
EINA_LIST_FOREACH(cfdata->match.overrides, l, m2)
{
m = E_NEW(Match, 1);
m = E_NEW(E_Comp_Match, 1);
_match_dup2(m2, m);
_comp_mod->conf->match.overrides =
eina_list_append(_comp_mod->conf->match.overrides, m);
}
EINA_LIST_FOREACH(cfdata->match.menus, l, m2)
{
m = E_NEW(Match, 1);
m = E_NEW(E_Comp_Match, 1);
_match_dup2(m2, m);
_comp_mod->conf->match.menus =
eina_list_append(_comp_mod->conf->match.menus, m);
@ -1640,7 +1639,7 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__,
_comp_mod->conf->shadow_style = NULL;
if (cfdata->shadow_style)
_comp_mod->conf->shadow_style = eina_stringshare_add(cfdata->shadow_style);
e_mod_comp_shadow_set();
e_comp_shadow_set();
}
if ((cfdata->engine != _comp_mod->conf->engine) ||
(cfdata->indirect != _comp_mod->conf->indirect) ||
@ -1660,8 +1659,6 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__,
a = e_action_find("restart");
if ((a) && (a->func.go)) a->func.go(NULL, NULL);
// e_mod_comp_shutdown();
// e_mod_comp_init();
}
e_config_save_queue();
return 1;

View File

@ -1,22 +1,10 @@
#include "e.h"
#include "e_mod_main.h"
#include "e_mod_config.h"
#include "e_mod_comp.h"
#include "e_comp.h"
#include "e_comp_cfdata.h"
static Eina_Inlist *cfg_opts = NULL;
//static Ecore_Event_Handler *init_done_handler = NULL;
//static int
//_e_init_done(void *data, int type, void *event)
//{
// ecore_event_handler_del(init_done_handler);
// init_done_handler = NULL;
// if (!e_mod_comp_init())
// {
// // FIXME: handle if comp init fails
// }
// return 1;
//}
/* module private routines */
Mod *_comp_mod = NULL;
@ -74,7 +62,7 @@ e_modapi_init(E_Module *m)
e_configure_registry_item_add("appearance/comp", 120, _("Composite"), NULL,
buf, e_int_config_comp_module);
e_mod_comp_cfdata_edd_init(&(mod->conf_edd),
e_comp_cfdata_edd_init(&(mod->conf_edd),
&(mod->conf_match_edd));
mod->conf = e_config_domain_load("module.comp", mod->conf_edd);
@ -95,11 +83,6 @@ e_modapi_init(E_Module *m)
_comp_mod = mod;
if (!e_mod_comp_init())
{
// FIXME: handle if comp init fails
}
e_module_delayed_set(m, 0);
e_module_priority_set(m, -1000);
@ -114,10 +97,10 @@ e_modapi_init(E_Module *m)
co->requires_restart = 1;
cfg_opts = eina_inlist_append(cfg_opts, EINA_INLIST_GET(co));
E_CONFIGURE_OPTION_ADD(co, BOOL, smooth_windows, mod->conf, _("Smooth scaling of composited window content"), _("composite"), _("border"));
co->funcs[1].none = co->funcs[0].none = e_mod_comp_shadow_set;
co->funcs[1].none = co->funcs[0].none = e_comp_shadow_set;
cfg_opts = eina_inlist_append(cfg_opts, EINA_INLIST_GET(co));
E_CONFIGURE_OPTION_ADD(co, BOOL, nocomp_fs, mod->conf, _("Don't composite fullscreen windows"), _("composite"), _("border"));
co->funcs[1].none = co->funcs[0].none = e_mod_comp_shadow_set;
co->funcs[1].none = co->funcs[0].none = e_comp_shadow_set;
cfg_opts = eina_inlist_append(cfg_opts, EINA_INLIST_GET(co));
E_CONFIGURE_OPTION_ADD(co, ENUM, engine, mod->conf, _("Compositing engine"), _("composite"), _("border"));
co->info_cb = _e_mod_engine_info_cb;
@ -137,7 +120,7 @@ _e_mod_config_new(E_Module *m)
{
Mod *mod = m->data;
mod->conf = e_mod_comp_cfdata_config_new();
mod->conf = e_comp_cfdata_config_new();
}
void
@ -145,7 +128,7 @@ _e_mod_config_free(E_Module *m)
{
Mod *mod = m->data;
e_mod_cfdata_config_free(mod->conf);
e_comp_cfdata_config_free(mod->conf);
mod->conf = NULL;
}
@ -154,8 +137,6 @@ e_modapi_shutdown(E_Module *m)
{
Mod *mod = m->data;
e_mod_comp_shutdown();
e_configure_registry_item_del("appearance/comp");
e_configure_registry_category_del("appearance");

View File

@ -1,7 +1,7 @@
#ifndef E_MOD_MAIN_H
#define E_MOD_MAIN_H
#include "e_mod_comp_cfdata.h"
#include "e_comp_cfdata.h"
typedef struct _Mod Mod;
@ -11,7 +11,7 @@ struct _Mod
E_Config_DD *conf_edd;
E_Config_DD *conf_match_edd;
Config *conf;
E_Comp_Config *conf;
E_Config_Dialog *config_dialog;
};

View File

@ -1,9 +1,7 @@
/* Ask about compositing */
#include "e_wizard.h"
#include "e_mod_comp_cfdata.h"
#define ENGINE_SW 1
#define ENGINE_GL 2
#include "e_comp.h"
#include "e_comp_cfdata.h"
static int do_gl = 0;
static int do_vsync = 0;
@ -101,20 +99,20 @@ wizard_page_hide(E_Wizard_Page *pg __UNUSED__)
{
E_Config_DD *conf_edd = NULL;
E_Config_DD *conf_match_edd = NULL;
Config *cfg = NULL;
E_Comp_Config *cfg = NULL;
e_mod_comp_cfdata_edd_init(&(conf_edd), &(conf_match_edd));
cfg = e_mod_comp_cfdata_config_new();
e_comp_cfdata_edd_init(&(conf_edd), &(conf_match_edd));
cfg = e_comp_cfdata_config_new();
if (do_gl)
{
cfg->engine = ENGINE_GL;
cfg->engine = E_COMP_ENGINE_GL;
cfg->smooth_windows = 1;
cfg->vsync = do_vsync;
}
else
{
cfg->engine = ENGINE_SW;
cfg->engine = E_COMP_ENGINE_SW;
cfg->smooth_windows = 0;
cfg->vsync = 0;
}
@ -122,7 +120,7 @@ wizard_page_hide(E_Wizard_Page *pg __UNUSED__)
e_config_domain_save("module.comp", conf_edd, cfg);
E_CONFIG_DD_FREE(conf_match_edd);
E_CONFIG_DD_FREE(conf_edd);
e_mod_cfdata_config_free(cfg);
e_comp_cfdata_config_free(cfg);
e_config_save_queue();