Big giant "e18-wayland-only starting to work" commit so I can continue

from home.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-06-11 14:54:50 +01:00
parent 90eb77b42e
commit 49ba7f2157
68 changed files with 23318 additions and 129 deletions

View File

@ -57,6 +57,34 @@ ENLIGHTENMENTHEADERS = \
e_canvas.h \
e_manager.h \
e_container.h \
e_zone.h \
e_desk.h \
e_bg.h \
e_box.h \
e_icon.h \
e_menu.h \
e_int_menus.h \
e_win.h \
e_dialog.h \
e_about.h \
e_theme_about.h \
e_actions.h \
e_acpi.h \
e_exec.h \
e_configure.h \
e_config_dialog.h \
e_thumb.h \
e_shelf.h \
e_gadcon.h \
e_popup.h \
e_obj_dialog.h \
e_border.h \
e_sys.h \
e_bindings.h \
e_ipc.h \
e_ipc_codec.h \
e_exehist.h \
e_alert.h \
e_output.h \
e_shader.h \
e_renderer.h
@ -89,6 +117,33 @@ enlightenment_wl_src = \
e_canvas.c \
e_manager.c \
e_container.c \
e_zone.c \
e_desk.c \
e_bg.c \
e_box.c \
e_icon.c \
e_menu.c \
e_int_menus.c \
e_win.c \
e_dialog.c \
e_about.c \
e_theme_about.c \
e_actions.c \
e_acpi.c \
e_exec.c \
e_configure.c \
e_config_dialog.c \
e_thumb.c \
e_shelf.c \
e_gadcon.c \
e_popup.c \
e_obj_dialog.c \
e_border.c \
e_sys.c \
e_bindings.c \
e_ipc.c \
e_ipc_codec.c \
e_exehist.c \
e_output.c \
e_renderer.c \
$(ENLIGHTENMENTHEADERS)

119
src/bin/e_wayland/e_about.c Normal file
View File

@ -0,0 +1,119 @@
#include "e.h"
/* local subsystem functions */
/* local subsystem globals */
/* externally accessible functions */
EAPI E_About *
e_about_new(E_Container *con)
{
E_Obj_Dialog *od;
char buf[16384];
FILE *f;
Eina_Strbuf *tbuf;
od = e_obj_dialog_new(con, _("About Enlightenment"), "E", "_about");
if (!od) return NULL;
e_obj_dialog_obj_theme_set(od, "base/theme/about", "e/widgets/about/main");
e_obj_dialog_obj_part_text_set(od, "e.text.label", _("Close"));
e_obj_dialog_obj_part_text_set(od, "e.text.title", _("Enlightenment"));
e_obj_dialog_obj_part_text_set(od, "e.text.version", VERSION);
snprintf
(buf, sizeof(buf), "%s%s",
_(
"<title>Copyright &copy; 2000-2013, by the Enlightenment "
"Development Team</><br>"
"<br>"
"We hope you enjoy using this software as much as we enjoyed "
"writing it.<br>"
"<br>"
"To contact us please visit:<br>"
"<hilight>http://www.enlightenment.org</><br>"
"<br>"
),
"All rights reserved.<br>"
"<br>"
"Redistribution and use in source and binary forms, with or without "
"modification, are permitted provided that the following conditions "
"are met:<br>"
"<br>"
"1. Redistributions of source code must retain the above copyright "
"notice, this list of conditions and the following disclaimer.<br>"
"2. Redistributions in binary form must reproduce the above copyright "
"notice, this list of conditions and the following disclaimer in the "
"documentation and/or other materials provided with the "
"distribution.<br>"
"<br>"
"<hilight>THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR "
"IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED "
"WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE "
"ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR "
"CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, "
"SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT "
"LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF "
"USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED "
"AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT "
"LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN "
"ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE "
"POSSIBILITY OF SUCH DAMAGE.</><br>"
);
e_obj_dialog_obj_part_text_set(od, "e.textblock.about", buf);
e_prefix_data_concat_static(buf, "AUTHORS");
f = fopen(buf, "r");
if (f)
{
tbuf = eina_strbuf_new();
eina_strbuf_append(tbuf, _("<title>The Team</><br><br>"));
while (fgets(buf, sizeof(buf), f))
{
int len;
len = strlen(buf);
if (len > 0)
{
if (buf[len - 1] == '\n')
{
buf[len - 1] = 0;
len--;
}
if (len > 0)
{
char *p;
do
{
p = strchr(buf, '<');
if (p) *p = 0;
}
while (p);
do
{
p = strchr(buf, '>');
if (p) *p = 0;
}
while (p);
eina_strbuf_append_printf(tbuf, "%s<br>", buf);
}
}
}
fclose(f);
if (tbuf)
{
e_obj_dialog_obj_part_text_set(od, "e.textblock.authors",
(char *)eina_strbuf_string_get(tbuf));
eina_strbuf_free(tbuf);
}
}
return (E_About *)od;
}
EAPI void
e_about_show(E_About *about)
{
e_obj_dialog_show((E_Obj_Dialog *)about);
e_obj_dialog_icon_set((E_Obj_Dialog *)about, "help-about");
}

View File

@ -0,0 +1,13 @@
#ifdef E_TYPEDEFS
typedef struct _E_Obj_Dialog E_About;
#else
#ifndef E_ABOUT_H
#define E_ABOUT_H
EAPI E_About *e_about_new (E_Container *con);
EAPI void e_about_show (E_About *about);
#endif
#endif

382
src/bin/e_wayland/e_acpi.c Normal file
View File

@ -0,0 +1,382 @@
#include "e.h"
/* TODO:
*
* Sanatize data received from acpi for message status into something
* meaningful (ie: 00000002 == LID_CLOSED, etc, etc).
*
* Find someone with a WIFI that actually emits ACPI events and add/debug the
* E_EVENT_ACPI for wifi.
*
*/
/* local structures */
/* for simple acpi device mapping */
typedef struct _E_ACPI_Device_Simple E_ACPI_Device_Simple;
typedef struct _E_ACPI_Device_Multiplexed E_ACPI_Device_Multiplexed;
struct _E_ACPI_Device_Simple
{
const char *name;
// ->
int type;
};
struct _E_ACPI_Device_Multiplexed
{
const char *name;
const char *bus;
int status;
// ->
int type;
};
/* local function prototypes */
static Eina_Bool _e_acpi_cb_server_del(void *data __UNUSED__, int type __UNUSED__, void *event);
static Eina_Bool _e_acpi_cb_server_data(void *data __UNUSED__, int type __UNUSED__, void *event);
static void _e_acpi_cb_event_free(void *data __UNUSED__, void *event);
static int _e_acpi_lid_status_get(const char *device, const char *bus);
static Eina_Bool _e_acpi_cb_event(void *data __UNUSED__, int type __UNUSED__, void *event);
/* local variables */
static int _e_acpi_events_frozen = 0;
static Ecore_Con_Server *_e_acpid = NULL;
static Eina_List *_e_acpid_hdls = NULL;
static Eina_Strbuf *acpibuf = NULL;
static E_ACPI_Device_Simple _devices_simple[] =
{
/* NB: DO NOT TRANSLATE THESE. */
{"ac_adapter", E_ACPI_TYPE_AC_ADAPTER},
{"battery", E_ACPI_TYPE_BATTERY},
{"button/lid", E_ACPI_TYPE_LID},
{"button/power", E_ACPI_TYPE_POWER},
{"button/sleep", E_ACPI_TYPE_SLEEP},
{"fan", E_ACPI_TYPE_FAN},
{"processor", E_ACPI_TYPE_PROCESSOR},
{"thermal_zone", E_ACPI_TYPE_THERMAL},
{"video", E_ACPI_TYPE_VIDEO},
{NULL, E_ACPI_TYPE_UNKNOWN}
};
static E_ACPI_Device_Multiplexed _devices_multiplexed[] =
{
/* NB: DO NOT TRANSLATE THESE. */
/* Sony VAIO - VPCF115FM / PCG-81114L - nvidia gfx */
{"sony/hotkey", NULL, 0x10, E_ACPI_TYPE_BRIGHTNESS_DOWN},
{"sony/hotkey", NULL, 0x11, E_ACPI_TYPE_BRIGHTNESS_UP},
{"sony/hotkey", NULL, 0x12, E_ACPI_TYPE_VIDEO},
{"sony/hotkey", NULL, 0x14, E_ACPI_TYPE_ZOOM_OUT},
{"sony/hotkey", NULL, 0x15, E_ACPI_TYPE_ZOOM_IN},
{"sony/hotkey", NULL, 0x17, E_ACPI_TYPE_HIBERNATE},
{"sony/hotkey", NULL, 0xa6, E_ACPI_TYPE_ASSIST},
{"sony/hotkey", NULL, 0x20, E_ACPI_TYPE_S1},
{"sony/hotkey", NULL, 0xa5, E_ACPI_TYPE_VAIO},
/* Sony VAIO - X505 - intel gfx */
{"sony/hotkey", NULL, 0x0e, E_ACPI_TYPE_MUTE},
{"sony/hotkey", NULL, 0x0f, E_ACPI_TYPE_VOLUME},
{"sony/hotkey", NULL, 0x10, E_ACPI_TYPE_BRIGHTNESS},
{"sony/hotkey", NULL, 0x12, E_ACPI_TYPE_VIDEO},
/* HP Compaq Presario - CQ61 - intel gfx */
/** interesting these get auto-mapped to keys in x11. here for documentation
** but not enabled as we can use regular keybinds for these
{"video", "DD03", 0x87, E_ACPI_TYPE_BRIGHTNESS_DOWN},
{"video", "DD03", 0x86, E_ACPI_TYPE_BRIGHTNESS_UP},
{"video", "OVGA", 0x80, E_ACPI_TYPE_VIDEO},
*/
/* END */
{NULL, NULL, 0x00, E_ACPI_TYPE_UNKNOWN}
};
/* public variables */
EAPI int E_EVENT_ACPI = 0;
/* public functions */
EINTERN int
e_acpi_init(void)
{
E_EVENT_ACPI = ecore_event_type_new();
/* check for running acpid */
if (!ecore_file_exists("/var/run/acpid.socket")) return 1;
/* try to connect to acpid socket */
_e_acpid = ecore_con_server_connect(ECORE_CON_LOCAL_SYSTEM,
"/var/run/acpid.socket", -1, NULL);
if (!_e_acpid) return 1;
/* setup handlers */
_e_acpid_hdls =
eina_list_append(_e_acpid_hdls,
ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL,
_e_acpi_cb_server_del, NULL));
_e_acpid_hdls =
eina_list_append(_e_acpid_hdls,
ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA,
_e_acpi_cb_server_data, NULL));
/* Add handlers for standard acpi events */
_e_acpid_hdls =
eina_list_append(_e_acpid_hdls,
ecore_event_handler_add(E_EVENT_ACPI,
_e_acpi_cb_event, NULL));
return 1;
}
EINTERN int
e_acpi_shutdown(void)
{
Ecore_Event_Handler *hdl;
/* cleanup event handlers */
EINA_LIST_FREE(_e_acpid_hdls, hdl)
ecore_event_handler_del(hdl);
/* kill the server if existing */
if (_e_acpid)
{
ecore_con_server_del(_e_acpid);
_e_acpid = NULL;
}
return 1;
}
EAPI void
e_acpi_events_freeze(void)
{
_e_acpi_events_frozen++;
}
EAPI void
e_acpi_events_thaw(void)
{
_e_acpi_events_frozen--;
if (_e_acpi_events_frozen < 0) _e_acpi_events_frozen = 0;
}
/* local functions */
static Eina_Bool
_e_acpi_cb_server_del(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Con_Event_Server_Del *ev;
Ecore_Event_Handler *hdl;
ev = event;
if (ev->server != _e_acpid) return ECORE_CALLBACK_PASS_ON;
/* cleanup event handlers */
EINA_LIST_FREE(_e_acpid_hdls, hdl)
ecore_event_handler_del(hdl);
/* kill the server if existing */
if (_e_acpid)
{
ecore_con_server_del(_e_acpid);
_e_acpid = NULL;
}
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_e_acpi_cb_server_data(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Con_Event_Server_Data *ev;
E_Event_Acpi *acpi_event;
int sig, status, i, done = 0;
char device[1024], bus[1024], *sdata;
const char *str, *p;
ev = event;
if ((!ev->data) || (ev->size < 1)) return ECORE_CALLBACK_PASS_ON;
/* write out actual acpi received data to stdout for debugging
res = fwrite(ev->data, ev->size, 1, stdout);
*/
/* data from a server isnt a string - its not 0 byte terminated. it's just
* a blob of data. copy to string and 0 byte terminate it so it can be
* string-swizzled/parsed etc. */
if (!acpibuf) acpibuf = eina_strbuf_new();
eina_strbuf_append_length(acpibuf, ev->data, ev->size);
str = eina_strbuf_string_get(acpibuf);
p = strchr(str, '\n');
if (!p) return ECORE_CALLBACK_PASS_ON;
while (p)
{
sdata = alloca(p - str + 1);
strncpy(sdata, str, (int)(p - str));
sdata[p - str] = 0;
/* parse out this acpi string into separate pieces */
if (sscanf(sdata, "%1023s %1023s %x %x",
device, bus, &sig, &status) != 4)
{
sig = -1;
status = -1;
if (sscanf(sdata, "%1023s %1023s", device, bus) != 2)
goto done_event;
}
/* create new event structure to raise */
acpi_event = E_NEW(E_Event_Acpi, 1);
acpi_event->bus_id = eina_stringshare_add(bus);
acpi_event->signal = sig;
acpi_event->status = status;
/* FIXME: add in a key faking layer */
if ((!done) && (sig >= 0) && (status >= 0))
{
for (i = 0; _devices_multiplexed[i].name; i++)
{
// if device name matches
if ((!strcmp(device, _devices_multiplexed[i].name)) &&
// AND busname not set OR device name matches
(!_devices_multiplexed[i].bus ||
(_devices_multiplexed[i].bus &&
(!strcmp(bus, _devices_multiplexed[i].bus)))) &&
// AND status matches
(_devices_multiplexed[i].status == status))
{
acpi_event->type = _devices_multiplexed[i].type;
done = 1;
break;
}
}
}
if (!done)
{
// if device name matches
for (i = 0; _devices_simple[i].name; i++)
{
if (!strcmp(device, _devices_simple[i].name))
{
acpi_event->type = _devices_simple[i].type;
done = 1;
break;
}
}
}
if (!done)
{
free(acpi_event);
acpi_event = NULL;
}
else
{
switch (acpi_event->type)
{
case E_ACPI_TYPE_LID:
acpi_event->status =
_e_acpi_lid_status_get(device, bus);
break;
default:
break;
}
/* actually raise the event */
ecore_event_add(E_EVENT_ACPI, acpi_event,
_e_acpi_cb_event_free, NULL);
}
done_event:
str = p + 1;
p = strchr(str, '\n');
}
if (str[0] == 0)
{
eina_strbuf_free(acpibuf);
acpibuf = NULL;
}
else
{
Eina_Strbuf *newbuf;
newbuf = eina_strbuf_new();
eina_strbuf_append(newbuf, str);
eina_strbuf_free(acpibuf);
acpibuf = newbuf;
}
return ECORE_CALLBACK_PASS_ON;
}
static void
_e_acpi_cb_event_free(void *data __UNUSED__, void *event)
{
E_Event_Acpi *ev;
if (!(ev = event)) return;
if (ev->device) eina_stringshare_del(ev->device);
if (ev->bus_id) eina_stringshare_del(ev->bus_id);
E_FREE(ev);
}
static int
_e_acpi_lid_status_get(const char *device, const char *bus)
{
FILE *f;
int i = 0;
char buff[PATH_MAX], *ret;
/* the acpi driver code in the kernel has a nice acpi function to return
* the lid status easily, but that function is not exposed for user_space
* so we need to check the proc fs to get the actual status */
/* make sure we have a device and bus */
if ((!device) || (!bus)) return E_ACPI_LID_UNKNOWN;
/* open the state file from /proc */
snprintf(buff, sizeof(buff), "/proc/acpi/%s/%s/state", device, bus);
if (!(f = fopen(buff, "r")))
{
/* hack around ppurka's Thinkpad (G460 + Linux) that reports lid
* state as "/proc/acpi/button/lid/LID0/state" but where the lid
* event says "button/lid LID close".
*
* so let's take the base device name "LID" and add a numeric like
* 0, 1, 2, 3 so we have LID0, LID1, LID2 etc. - try up to LID9
* and then give up.
*/
for (i = 0; i < 10; i++)
{
snprintf(buff, sizeof(buff), "/proc/acpi/%s/%s%i/state",
device, bus, i);
if ((f = fopen(buff, "r"))) break;
f = NULL;
}
if (!f) return E_ACPI_LID_UNKNOWN;
}
/* read the line from state file */
ret = fgets(buff, sizeof(buff), f);
fclose(f);
/* parse out state file */
i = 0;
while (buff[i] != ':')
i++;
while (!isalnum(buff[i]))
i++;
ret = &(buff[i]);
while (isalnum(buff[i]))
i++;
buff[i] = 0;
/* compare value from state file and return something sane */
if (!strcmp(ret, "open")) return E_ACPI_LID_OPEN;
else if (!strcmp(ret, "closed"))
return E_ACPI_LID_CLOSED;
else return E_ACPI_LID_UNKNOWN;
}
static Eina_Bool
_e_acpi_cb_event(void *data __UNUSED__, int type __UNUSED__, void *event)
{
E_Event_Acpi *ev;
ev = event;
if (_e_acpi_events_frozen > 0) return ECORE_CALLBACK_PASS_ON;
e_bindings_acpi_event_handle(E_BINDING_CONTEXT_NONE, NULL, ev);
return ECORE_CALLBACK_PASS_ON;
}

View File

@ -0,0 +1,72 @@
#ifdef E_TYPEDEFS
/* enum for various event types */
typedef enum _E_Acpi_Type
{
E_ACPI_TYPE_UNKNOWN = 0,
E_ACPI_TYPE_AC_ADAPTER, // 1
E_ACPI_TYPE_BATTERY, // 2
E_ACPI_TYPE_BUTTON, // 3
E_ACPI_TYPE_FAN, // 4
E_ACPI_TYPE_LID, // 5
E_ACPI_TYPE_POWER, // 6
E_ACPI_TYPE_PROCESSOR, // 7
E_ACPI_TYPE_SLEEP, // 8
E_ACPI_TYPE_THERMAL, // 9
E_ACPI_TYPE_VIDEO, // 10
E_ACPI_TYPE_WIFI, // 11
E_ACPI_TYPE_HIBERNATE, // 12
E_ACPI_TYPE_ZOOM_OUT, // 13
E_ACPI_TYPE_ZOOM_IN, // 14
E_ACPI_TYPE_BRIGHTNESS_DOWN, // 15
E_ACPI_TYPE_BRIGHTNESS_UP, // 16
E_ACPI_TYPE_ASSIST, // 17
E_ACPI_TYPE_S1, // 18
E_ACPI_TYPE_VAIO, // 19
E_ACPI_TYPE_MUTE, // 20
E_ACPI_TYPE_VOLUME, // 21
E_ACPI_TYPE_BRIGHTNESS // 22
} E_Acpi_Type;
/* enum for acpi signals */
typedef enum _E_Acpi_Device_Signal
{
E_ACPI_DEVICE_SIGNAL_UNKNOWN, // 0
E_ACPI_DEVICE_SIGNAL_NOTIFY = 80,
E_ACPI_DEVICE_SIGNAL_CHANGED = 82, // device added or removed
E_ACPI_DEVICE_SIGNAL_AWAKE = 83,
E_ACPI_DEVICE_SIGNAL_EJECT = 84
} E_Acpi_Device_Signal;
/* enum for lid status */
typedef enum _E_Acpi_Lid_Status
{
E_ACPI_LID_UNKNOWN, // 0
E_ACPI_LID_CLOSED, // 1
E_ACPI_LID_OPEN // 2
} E_Acpi_Lid_Status;
/* struct used to pass to event handlers */
typedef struct _E_Event_Acpi E_Event_Acpi;
#else
# ifndef E_ACPI_H
# define E_ACPI_H
struct _E_Event_Acpi
{
const char *device, *bus_id;
int type, signal, status;
};
EINTERN int e_acpi_init(void);
EINTERN int e_acpi_shutdown(void);
EAPI void e_acpi_events_freeze(void);
EAPI void e_acpi_events_thaw(void);
extern EAPI int E_EVENT_ACPI;
# endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,64 @@
#ifdef E_TYPEDEFS
typedef struct _E_Action E_Action;
typedef struct _E_Action_Description E_Action_Description;
typedef struct _E_Action_Group E_Action_Group;
#else
#ifndef E_ACTIONS_H
#define E_ACTIONS_H
#define E_ACTION_TYPE 0xE0b01010
struct _E_Action
{
E_Object e_obj_inherit;
const char *name;
struct
{
void (*go) (E_Object *obj, const char *params);
void (*go_mouse) (E_Object *obj, const char *params, Ecore_Event_Mouse_Button *ev);
void (*go_wheel) (E_Object *obj, const char *params, Ecore_Event_Mouse_Wheel *ev);
void (*go_edge) (E_Object *obj, const char *params, E_Event_Zone_Edge *ev);
void (*go_key) (E_Object *obj, const char *params, Ecore_Event_Key *ev);
void (*go_signal) (E_Object *obj, const char *params, const char *sig, const char *src);
void (*go_acpi) (E_Object *obj, const char *params, E_Event_Acpi *ev);
void (*end) (E_Object *obj, const char *params);
void (*end_mouse) (E_Object *obj, const char *params, Ecore_Event_Mouse_Button *ev);
void (*end_key) (E_Object *obj, const char *params, Ecore_Event_Key *ev);
} func;
};
struct _E_Action_Description
{
const char *act_name;
const char *act_cmd;
const char *act_params;
const char *param_example;
int editable;
};
struct _E_Action_Group
{
const char *act_grp;
Eina_List *acts;
};
EINTERN int e_actions_init(void);
EINTERN int e_actions_shutdown(void);
EAPI Eina_List *e_action_name_list(void);
EAPI E_Action *e_action_add(const char *name);
/* e_action_del allows, for example, modules to define their own actions dynamically. */
EAPI void e_action_del(const char *name);
EAPI E_Action *e_action_find(const char *name);
EAPI const char *e_action_predef_label_get(const char *action, const char *params);
EAPI void e_action_predef_name_set(const char *act_grp, const char *act_name, const char *act_cmd, const char *act_params, const char *param_example, int editable);
EAPI void e_action_predef_name_del(const char *act_grp, const char *act_name);
EAPI void e_action_predef_name_all_del(void);
EAPI Eina_List *e_action_groups_get(void);
#endif
#endif

View File

@ -0,0 +1,19 @@
#ifdef E_TYPEDEFS
typedef enum _E_Alert_Op_Type
{
E_ALERT_OP_RESTART = 0,
E_ALERT_OP_EXIT
} E_Alert_Op_Type;
#else
#ifndef E_ALERT_H
#define E_ALERT_H
EINTERN int e_alert_init(void);
EINTERN int e_alert_shutdown(void);
EAPI void e_alert_show(void);
#endif
#endif

412
src/bin/e_wayland/e_bg.c Normal file
View File

@ -0,0 +1,412 @@
#include "e.h"
/* local function prototypes */
static void _e_bg_signal(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__);
/* local variables */
EAPI int E_EVENT_BG_UPDATE = 0;
EINTERN int
e_bg_init(void)
{
Eina_List *l = NULL;
E_Config_Desktop_Background *cfbg = NULL;
if (e_config->desktop_default_background)
e_filereg_register(e_config->desktop_default_background);
EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
{
if (!cfbg) continue;
e_filereg_register(cfbg->file);
}
E_EVENT_BG_UPDATE = ecore_event_type_new();
return 1;
}
EINTERN int
e_bg_shutdown(void)
{
Eina_List *l = NULL;
E_Config_Desktop_Background *cfbg = NULL;
if (e_config->desktop_default_background)
e_filereg_deregister(e_config->desktop_default_background);
EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
{
if (!cfbg) continue;
e_filereg_deregister(cfbg->file);
}
return 1;
}
EAPI void
e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
{
const char *bgfile = "", *trans = "";
E_Desk *desk;
if (transition == E_BG_TRANSITION_START)
trans = e_config->transition_start;
else if (transition == E_BG_TRANSITION_DESK)
trans = e_config->transition_desk;
else if (transition == E_BG_TRANSITION_CHANGE)
trans = e_config->transition_change;
if ((!trans) || (!trans[0])) transition = E_BG_TRANSITION_NONE;
desk = e_desk_current_get(zone);
if (desk)
bgfile = e_bg_file_get(zone->container->num, zone->num, desk->x, desk->y);
else
bgfile = e_bg_file_get(zone->container->num, zone->num, -1, -1);
printf("Bg File: %s\n", bgfile);
if (zone->o_bg)
{
const char *pfile = "";
edje_object_file_get(zone->o_bg, &pfile, NULL);
if (!strcmp(pfile, bgfile)) return;
}
if (transition == E_BG_TRANSITION_NONE)
{
if (zone->o_bg)
{
evas_object_del(zone->o_bg);
zone->o_bg = NULL;
}
}
else
{
char buff[PATH_MAX];
if (zone->o_bg)
{
if (zone->o_prev_bg) evas_object_del(zone->o_prev_bg);
zone->o_prev_bg = zone->o_bg;
if (zone->o_trans) evas_object_del(zone->o_trans);
zone->o_trans = NULL;
zone->o_bg = NULL;
}
zone->o_trans = edje_object_add(zone->container->bg_evas);
evas_object_data_set(zone->o_trans, "e_zone", zone);
snprintf(buff, sizeof(buff), "e/transitions/%s", trans);
e_theme_edje_object_set(zone->o_trans, "base/theme/transitions", buff);
edje_object_signal_callback_add(zone->o_trans, "e,state,done", "*",
_e_bg_signal, zone);
evas_object_move(zone->o_trans, zone->x, zone->y);
evas_object_resize(zone->o_trans, zone->w, zone->h);
evas_object_layer_set(zone->o_trans, -1);
evas_object_clip_set(zone->o_trans, zone->o_bg_clip);
evas_object_show(zone->o_trans);
}
if (eina_str_has_extension(bgfile, ".edj"))
{
zone->o_bg = edje_object_add(zone->container->bg_evas);
evas_object_move(zone->o_bg, zone->x, zone->y);
evas_object_resize(zone->o_bg, zone->w, zone->h);
evas_object_data_set(zone->o_bg, "e_zone", zone);
edje_object_file_set(zone->o_bg, bgfile, "e/desktop/background");
}
else
{
/* TODO */
}
if (transition == E_BG_TRANSITION_NONE)
{
evas_object_move(zone->o_bg, zone->x, zone->y);
evas_object_resize(zone->o_bg, zone->w, zone->h);
evas_object_layer_set(zone->o_bg, -1);
}
evas_object_clip_set(zone->o_bg, zone->o_bg_clip);
evas_object_show(zone->o_bg);
if (transition != E_BG_TRANSITION_NONE)
{
edje_extern_object_max_size_set(zone->o_prev_bg, 65536, 65536);
edje_extern_object_min_size_set(zone->o_prev_bg, 0, 0);
edje_object_part_swallow(zone->o_trans, "e.swallow.bg.old",
zone->o_prev_bg);
edje_extern_object_max_size_set(zone->o_bg, 65536, 65536);
edje_extern_object_min_size_set(zone->o_bg, 0, 0);
edje_object_part_swallow(zone->o_trans, "e.swallow.bg.new",
zone->o_bg);
edje_object_signal_emit(zone->o_trans, "e,action,start", "e");
}
}
EAPI const char *
e_bg_file_get(int con_num, int zone_num, int desk_x, int desk_y)
{
const E_Config_Desktop_Background *cfbg;
Eina_List *l, *entries;
const char *bgfile = "";
char *entry;
Eina_Bool ok = EINA_FALSE;
cfbg = e_bg_config_get(con_num, zone_num, desk_x, desk_y);
/* fall back to default */
if (cfbg)
{
bgfile = cfbg->file;
if (bgfile)
{
if (bgfile[0] != '/')
{
const char *bf;
bf = e_path_find(path_backgrounds, bgfile);
if (bf) bgfile = bf;
}
}
}
else
{
bgfile = e_config->desktop_default_background;
if (bgfile)
{
if (bgfile[0] != '/')
{
const char *bf;
bf = e_path_find(path_backgrounds, bgfile);
if (bf) bgfile = bf;
}
}
if ((bgfile) && (eina_str_has_extension(bgfile, ".edj")))
{
entries = edje_file_collection_list(bgfile);
if (entries)
{
EINA_LIST_FOREACH(entries, l, entry)
{
if (!strcmp(entry, "e/desktop/background"))
{
ok = EINA_TRUE;
break;
}
}
edje_file_collection_list_free(entries);
}
}
else if ((bgfile) && (bgfile[0]))
ok = EINA_TRUE;
if (!ok)
bgfile = e_theme_edje_file_get("base/theme/background",
"e/desktop/background");
}
return bgfile;
}
EAPI const E_Config_Desktop_Background *
e_bg_config_get(int con_num, int zone_num, int desk_x, int desk_y)
{
Eina_List *l, *ll, *entries;
E_Config_Desktop_Background *bg = NULL, *cfbg = NULL;
const char *bgfile = "";
char *entry;
int current_spec = 0; /* how specific the setting is - we want the least general one that applies */
/* look for desk specific background. */
if ((con_num >= 0) || (zone_num >= 0) || (desk_x >= 0) || (desk_y >= 0))
{
EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
{
int spec;
if (!cfbg) continue;
spec = 0;
if (cfbg->container == con_num) spec++;
else if (cfbg->container >= 0) continue;
if (cfbg->zone == zone_num) spec++;
else if (cfbg->zone >= 0) continue;
if (cfbg->desk_x == desk_x) spec++;
else if (cfbg->desk_x >= 0) continue;
if (cfbg->desk_y == desk_y) spec++;
else if (cfbg->desk_y >= 0) continue;
if (spec <= current_spec) continue;
bgfile = cfbg->file;
if (bgfile)
{
if (bgfile[0] != '/')
{
const char *bf;
bf = e_path_find(path_backgrounds, bgfile);
if (bf) bgfile = bf;
}
}
if (eina_str_has_extension(bgfile, ".edj"))
{
entries = edje_file_collection_list(bgfile);
if (entries)
{
EINA_LIST_FOREACH(entries, ll, entry)
{
if (!strcmp(entry, "e/desktop/background"))
{
bg = cfbg;
current_spec = spec;
}
}
edje_file_collection_list_free(entries);
}
}
else
{
bg = cfbg;
current_spec = spec;
}
}
}
return bg;
}
EAPI void
e_bg_default_set(const char *file)
{
/* E_Event_Bg_Update *ev; */
Eina_Bool changed;
file = eina_stringshare_add(file);
changed = file != e_config->desktop_default_background;
if (!changed)
{
eina_stringshare_del(file);
return;
}
if (e_config->desktop_default_background)
{
e_filereg_deregister(e_config->desktop_default_background);
eina_stringshare_del(e_config->desktop_default_background);
}
if (file)
{
e_filereg_register(file);
e_config->desktop_default_background = file;
}
else
e_config->desktop_default_background = NULL;
/* ev = E_NEW(E_Event_Bg_Update, 1); */
/* ev->container = -1; */
/* ev->zone = -1; */
/* ev->desk_x = -1; */
/* ev->desk_y = -1; */
/* ecore_event_add(E_EVENT_BG_UPDATE, ev, _e_bg_event_bg_update_free, NULL); */
}
EAPI void
e_bg_add(int con, int zone, int dx, int dy, const char *file)
{
const Eina_List *l;
E_Config_Desktop_Background *cfbg;
file = eina_stringshare_add(file);
EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
{
if ((cfbg) && (cfbg->container == con) && (cfbg->zone == zone) &&
(cfbg->desk_x == dx) && (cfbg->desk_y == dy) &&
(cfbg->file == file))
{
eina_stringshare_del(file);
return;
}
}
e_bg_del(con, zone, dx, dy);
cfbg = E_NEW(E_Config_Desktop_Background, 1);
cfbg->container = con;
cfbg->zone = zone;
cfbg->desk_x = dx;
cfbg->desk_y = dy;
cfbg->file = file;
e_config->desktop_backgrounds =
eina_list_append(e_config->desktop_backgrounds, cfbg);
e_filereg_register(cfbg->file);
}
EAPI void
e_bg_del(int con, int zone, int dx, int dy)
{
Eina_List *l;
E_Config_Desktop_Background *cfbg;
EINA_LIST_FOREACH(e_config->desktop_backgrounds, l, cfbg)
{
if (!cfbg) continue;
if ((cfbg->container == con) && (cfbg->zone == zone) &&
(cfbg->desk_x == dx) && (cfbg->desk_y == dy))
{
e_config->desktop_backgrounds =
eina_list_remove_list(e_config->desktop_backgrounds, l);
e_filereg_deregister(cfbg->file);
if (cfbg->file) eina_stringshare_del(cfbg->file);
free(cfbg);
break;
}
}
}
EAPI void
e_bg_update(void)
{
Eina_List *l, *ll, *lll;
E_Manager *man;
E_Container *con;
E_Zone *zone;
EINA_LIST_FOREACH(e_manager_list(), l, man)
{
EINA_LIST_FOREACH(man->containers, ll, con)
{
EINA_LIST_FOREACH(con->zones, lll, zone)
{
e_zone_bg_reconfigure(zone);
}
}
}
}
/* local functions */
static void
_e_bg_signal(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
E_Zone *zone;
zone = data;
if (zone->o_prev_bg)
{
evas_object_del(zone->o_prev_bg);
zone->o_prev_bg = NULL;
}
if (zone->o_trans)
{
evas_object_del(zone->o_trans);
zone->o_trans = NULL;
}
evas_object_move(zone->o_bg, zone->x, zone->y);
evas_object_resize(zone->o_bg, zone->w, zone->h);
evas_object_layer_set(zone->o_bg, -1);
evas_object_clip_set(zone->o_bg, zone->o_bg_clip);
evas_object_show(zone->o_bg);
}

29
src/bin/e_wayland/e_bg.h Normal file
View File

@ -0,0 +1,29 @@
#ifdef E_TYPEDEFS
typedef enum
{
E_BG_TRANSITION_NONE,
E_BG_TRANSITION_START,
E_BG_TRANSITION_DESK,
E_BG_TRANSITION_CHANGE
} E_Bg_Transition;
#else
# ifndef E_BG_H
# define E_BG_H
extern EAPI int E_EVENT_BG_UPDATE;
EINTERN int e_bg_init(void);
EINTERN int e_bg_shutdown(void);
EAPI void e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition);
EAPI const char *e_bg_file_get(int con_num, int zone_num, int desk_x, int desk_y);
EAPI const E_Config_Desktop_Background *e_bg_config_get(int con_num, int zone_num, int desk_x, int desk_y);
EAPI void e_bg_default_set(const char *file);
EAPI void e_bg_add(int con, int zone, int dx, int dy, const char *file);
EAPI void e_bg_del(int con, int zone, int dx, int dy);
EAPI void e_bg_update(void);
# endif
#endif

View File

@ -0,0 +1,13 @@
#include "e.h"
EAPI E_Action *
e_bindings_acpi_event_handle(E_Binding_Context ctxt __UNUSED__, E_Object *obj __UNUSED__, E_Event_Acpi *ev __UNUSED__)
{
return NULL;
}
EAPI E_Action *
e_bindings_key_down_event_find(E_Binding_Context ctxt __UNUSED__, Ecore_Event_Key *ev)
{
return NULL;
}

View File

@ -0,0 +1,25 @@
#ifdef E_TYPEDEFS
typedef enum _E_Binding_Context
{
E_BINDING_CONTEXT_NONE,
E_BINDING_CONTEXT_UNKNOWN,
E_BINDING_CONTEXT_BORDER,
E_BINDING_CONTEXT_ZONE,
E_BINDING_CONTEXT_CONTAINER,
E_BINDING_CONTEXT_MANAGER,
E_BINDING_CONTEXT_MENU,
E_BINDING_CONTEXT_WINLIST,
E_BINDING_CONTEXT_POPUP,
E_BINDING_CONTEXT_ANY
} E_Binding_Context;
#else
# ifndef E_BINDINGS_H
# define E_BINDINGS_H
EAPI E_Action *e_bindings_acpi_event_handle(E_Binding_Context ctxt __UNUSED__, E_Object *obj __UNUSED__, E_Event_Acpi *ev __UNUSED__);
EAPI E_Action *e_bindings_key_down_event_find(E_Binding_Context ctxt __UNUSED__, Ecore_Event_Key *ev);
# endif
#endif

View File

@ -0,0 +1,31 @@
#include "e.h"
EAPI void
e_border_uniconify(void *bd)
{
}
EAPI void
e_border_unshade(void *bd, int dir)
{
}
EAPI void
e_border_focus_set(void *bd, int focus, int set)
{
}
EAPI void
e_border_desk_set(void *bd, E_Desk *desk)
{
}
EAPI Eina_List *
e_border_client_list(void)
{
return NULL;
}

View File

@ -11,8 +11,6 @@ typedef enum _E_Maximize
E_MAXIMIZE_VERTICAL = 0x00000010,
E_MAXIMIZE_HORIZONTAL = 0x00000020,
E_MAXIMIZE_BOTH = 0x00000030,
E_MAXIMIZE_LEFT = 0x00000070,
E_MAXIMIZE_RIGHT = 0x000000b0,
E_MAXIMIZE_DIRECTION = 0x000000f0
} E_Maximize;
@ -24,4 +22,28 @@ typedef enum _E_Window_Placement
E_WINDOW_PLACEMENT_MANUAL
} E_Window_Placement;
typedef struct _E_Border E_Border;
#else
# ifndef E_BORDER_H
# define E_BORDER_H
# define E_BORDER_TYPE 0xE0b01002
struct _E_Border
{
E_Object e_obj_inherit;
};
EAPI void e_border_uniconify(void *bd);
EAPI void e_border_unshade(void *bd, int dir);
EAPI void e_border_focus_set(void *bd, int focus, int set);
EAPI void e_border_desk_set(void *bd, E_Desk *desk);
EAPI Eina_List *e_border_client_list(void);
EAPI void e_border_activate(E_Border *bd, Eina_Bool just_do_it);
EAPI void e_border_raise(E_Border *bd);
# endif
#endif

901
src/bin/e_wayland/e_box.c Normal file
View File

@ -0,0 +1,901 @@
#include "e.h"
typedef struct _E_Smart_Data E_Smart_Data;
typedef struct _E_Box_Item E_Box_Item;
struct _E_Smart_Data
{
Evas_Coord x, y, w, h;
Evas_Object *obj;
Evas_Object *clip;
int frozen;
unsigned char changed : 1;
unsigned char horizontal : 1;
unsigned char homogenous : 1;
E_Box_Item *items;
unsigned int item_count;
struct
{
Evas_Coord w, h;
} min, max;
struct
{
double x, y;
} align;
};
struct _E_Box_Item
{
EINA_INLIST;
E_Smart_Data *sd;
unsigned char fill_w : 1;
unsigned char fill_h : 1;
unsigned char expand_w : 1;
unsigned char expand_h : 1;
struct
{
Evas_Coord w, h;
} min, max;
struct
{
double x, y;
} align;
int x, y, w, h;
Evas_Object *obj;
};
/* local subsystem functions */
static void _e_box_unpack_internal(E_Smart_Data *sd, E_Box_Item *bi);
static E_Box_Item *_e_box_smart_adopt(E_Smart_Data *sd, Evas_Object *obj);
static void _e_box_smart_disown(E_Box_Item *bi);
static void _e_box_smart_item_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_box_smart_reconfigure(E_Smart_Data *sd);
static void _e_box_smart_extents_calculate(E_Smart_Data *sd);
static void _e_box_smart_init(void);
static void _e_box_smart_add(Evas_Object *obj);
static void _e_box_smart_del(Evas_Object *obj);
static void _e_box_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
static void _e_box_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
static void _e_box_smart_show(Evas_Object *obj);
static void _e_box_smart_hide(Evas_Object *obj);
static void _e_box_smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
static void _e_box_smart_clip_set(Evas_Object *obj, Evas_Object *clip);
static void _e_box_smart_clip_unset(Evas_Object *obj);
/* local subsystem globals */
static Evas_Smart *_e_smart = NULL;
static inline Evas_Object *
_e_box_item_object_get(E_Box_Item *bi)
{
if (!bi) return NULL;
return bi->obj;
}
static inline Evas_Object *
_e_box_item_nth_get(E_Smart_Data *sd, unsigned int n)
{
unsigned int x;
E_Box_Item *bi;
if (!sd->items) return NULL;
if (n > sd->item_count / 2)
{
x = sd->item_count - 1;
EINA_INLIST_REVERSE_FOREACH(EINA_INLIST_GET(sd->items), bi)
{
if (n == x) return bi->obj;
x--;
}
return NULL;
}
x = 0;
EINA_INLIST_FOREACH(EINA_INLIST_GET(sd->items), bi)
{
if (n == x) return bi->obj;
x++;
}
return NULL;
}
/* externally accessible functions */
EAPI Evas_Object *
e_box_add(Evas *evas)
{
_e_box_smart_init();
return evas_object_smart_add(evas, _e_smart);
}
EAPI int
e_box_freeze(Evas_Object *obj)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR(0);
sd = evas_object_smart_data_get(obj);
if (!sd) return 0;
sd->frozen++;
return sd->frozen;
}
EAPI int
e_box_thaw(Evas_Object *obj)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR(0);
sd = evas_object_smart_data_get(obj);
if (!sd) return 0;
sd->frozen--;
if (sd->frozen <= 0) _e_box_smart_reconfigure(sd);
return sd->frozen;
}
EAPI void
e_box_orientation_set(Evas_Object *obj, int horizontal)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR();
sd = evas_object_smart_data_get(obj);
if (!sd) return;
if (sd->horizontal == horizontal) return;
sd->horizontal = horizontal;
sd->changed = 1;
if (sd->frozen <= 0) _e_box_smart_reconfigure(sd);
}
EAPI int
e_box_orientation_get(Evas_Object *obj)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR(0);
sd = evas_object_smart_data_get(obj);
if (!sd) return 0;
return sd->horizontal;
}
EAPI void
e_box_homogenous_set(Evas_Object *obj, int homogenous)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR();
sd = evas_object_smart_data_get(obj);
if (!sd) return;
if (sd->homogenous == homogenous) return;
sd->homogenous = homogenous;
sd->changed = 1;
if (sd->frozen <= 0) _e_box_smart_reconfigure(sd);
}
EAPI int
e_box_pack_start(Evas_Object *obj, Evas_Object *child)
{
E_Smart_Data *sd;
E_Box_Item *bi;
Eina_Inlist *l;
if (!child) return 0;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR(0);
sd = evas_object_smart_data_get(obj);
if (!sd) return 0;
bi = _e_box_smart_adopt(sd, child);
l = EINA_INLIST_GET(sd->items);
l = eina_inlist_prepend(l, EINA_INLIST_GET(bi));
sd->items = EINA_INLIST_CONTAINER_GET(l, E_Box_Item);
sd->item_count++;
sd->changed = 1;
if (sd->frozen <= 0) _e_box_smart_reconfigure(sd);
return 0;
}
EAPI int
e_box_pack_end(Evas_Object *obj, Evas_Object *child)
{
E_Smart_Data *sd;
E_Box_Item *bi;
Eina_Inlist *l;
if (!child) return 0;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR(0);
sd = evas_object_smart_data_get(obj);
if (!sd) return 0;
bi = _e_box_smart_adopt(sd, child);
l = EINA_INLIST_GET(sd->items);
l = eina_inlist_append(l, EINA_INLIST_GET(bi));
sd->items = EINA_INLIST_CONTAINER_GET(l, E_Box_Item);
sd->item_count++;
sd->changed = 1;
if (sd->frozen <= 0) _e_box_smart_reconfigure(sd);
return sd->item_count - 1;
}
EAPI int
e_box_pack_before(Evas_Object *obj, Evas_Object *child, Evas_Object *before)
{
E_Smart_Data *sd;
E_Box_Item *bi, *bi2;
int i = 0;
Eina_Inlist *l;
if (!child) return 0;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR(0);
sd = evas_object_smart_data_get(obj);
if (!sd) return 0;
bi2 = evas_object_data_get(before, "e_box_data");
if (!bi2) return 0;
bi = _e_box_smart_adopt(sd, child);
l = EINA_INLIST_GET(sd->items);
l = eina_inlist_prepend_relative(l, EINA_INLIST_GET(bi), EINA_INLIST_GET(bi2));
sd->items = EINA_INLIST_CONTAINER_GET(l, E_Box_Item);
sd->item_count++;
for (l = EINA_INLIST_GET(bi)->prev; l; l = l->prev)
i++;
sd->changed = 1;
if (sd->frozen <= 0) _e_box_smart_reconfigure(sd);
return i;
}
EAPI int
e_box_pack_after(Evas_Object *obj, Evas_Object *child, Evas_Object *after)
{
E_Smart_Data *sd;
E_Box_Item *bi, *bi2;
int i = 0;
Eina_Inlist *l;
if (!child) return 0;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR(0);
sd = evas_object_smart_data_get(obj);
if (!sd) return 0;
bi2 = evas_object_data_get(after, "e_box_data");
if (!bi2) return 0;
bi = _e_box_smart_adopt(sd, child);
l = EINA_INLIST_GET(sd->items);
l = eina_inlist_append_relative(l, EINA_INLIST_GET(bi), EINA_INLIST_GET(bi2));
sd->items = EINA_INLIST_CONTAINER_GET(l, E_Box_Item);
sd->item_count++;
for (l = EINA_INLIST_GET(bi)->prev; l; l = l->prev)
i++;
sd->changed = 1;
if (sd->frozen <= 0) _e_box_smart_reconfigure(sd);
return i;
}
EAPI int
e_box_pack_count_get(Evas_Object *obj)
{
E_Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR(0);
if (!sd) return 0;
return sd->item_count;
}
EAPI Evas_Object *
e_box_pack_object_nth(Evas_Object *obj, int n)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR(NULL);
sd = evas_object_smart_data_get(obj);
if (!sd) return NULL;
return _e_box_item_nth_get(sd, n);
}
EAPI Evas_Object *
e_box_pack_object_first(Evas_Object *obj)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR(NULL);
sd = evas_object_smart_data_get(obj);
if (!sd) return NULL;
return sd->items ? sd->items->obj : NULL;
}
EAPI Evas_Object *
e_box_pack_object_last(Evas_Object *obj)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR(NULL);
sd = evas_object_smart_data_get(obj);
if ((!sd) || (!sd->items)) return NULL;
return EINA_INLIST_CONTAINER_GET(EINA_INLIST_GET(sd->items)->last, E_Box_Item)->obj;
}
EAPI void
e_box_pack_options_set(Evas_Object *obj, int fill_w, int fill_h, int expand_w, int expand_h, double align_x, double align_y, Evas_Coord min_w, Evas_Coord min_h, Evas_Coord max_w, Evas_Coord max_h)
{
E_Box_Item *bi;
bi = evas_object_data_get(obj, "e_box_data");
if (!bi) return;
bi->fill_w = fill_w;
bi->fill_h = fill_h;
bi->expand_w = expand_w;
bi->expand_h = expand_h;
bi->align.x = align_x;
bi->align.y = align_y;
bi->min.w = min_w;
bi->min.h = min_h;
bi->max.w = max_w;
bi->max.h = max_h;
bi->sd->changed = 1;
if (bi->sd->frozen <= 0) _e_box_smart_reconfigure(bi->sd);
}
EAPI void
e_box_unpack(Evas_Object *obj)
{
E_Box_Item *bi;
E_Smart_Data *sd;
if (!obj) return;
bi = evas_object_data_get(obj, "e_box_data");
if (!bi) return;
sd = bi->sd;
if (!sd) return;
_e_box_unpack_internal(sd, bi);
}
EAPI void
e_box_size_min_get(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR();
sd = evas_object_smart_data_get(obj);
if (!sd) return;
if (sd->changed) _e_box_smart_extents_calculate(sd);
if (minw) *minw = sd->min.w;
if (minh) *minh = sd->min.h;
}
EAPI void
e_box_size_max_get(Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR();
sd = evas_object_smart_data_get(obj);
if (!sd) return;
if (sd->changed) _e_box_smart_extents_calculate(sd);
if (maxw) *maxw = sd->max.w;
if (maxh) *maxh = sd->max.h;
}
EAPI void
e_box_align_get(Evas_Object *obj, double *ax, double *ay)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR();
sd = evas_object_smart_data_get(obj);
if (!sd) return;
if (ax) *ax = sd->align.x;
if (ay) *ay = sd->align.y;
}
EAPI void
e_box_align_set(Evas_Object *obj, double ax, double ay)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR();
sd = evas_object_smart_data_get(obj);
if (!sd) return;
if ((sd->align.x == ax) && (sd->align.y == ay)) return;
sd->align.x = ax;
sd->align.y = ay;
sd->changed = 1;
if (sd->frozen <= 0) _e_box_smart_reconfigure(sd);
}
/*
* Returns the number of pixels that are hidden on the left/top side.
*/
EAPI void
e_box_align_pixel_offset_get(Evas_Object *obj, int *x, int *y)
{
E_Smart_Data *sd;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR();
sd = evas_object_smart_data_get(obj);
if (!sd) return;
if (x) *x = (sd->min.w - sd->w) * (1.0 - sd->align.x);
if (y) *y = (sd->min.h - sd->h) * (1.0 - sd->align.y);
}
EAPI Evas_Object *
e_box_item_at_xy_get(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{
E_Smart_Data *sd;
E_Box_Item *bi;
if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR() NULL;
sd = evas_object_smart_data_get(obj);
if (!sd) return NULL;
if (!E_INSIDE(x, y, sd->x, sd->y, sd->w, sd->h)) return NULL;
if (sd->horizontal)
{
if (x < sd->w / 2)
{
EINA_INLIST_FOREACH(EINA_INLIST_GET(sd->items), bi)
{
if (E_INSIDE(x, y, bi->x, bi->y, bi->w, bi->h)) return bi->obj;
}
return NULL;
}
EINA_INLIST_REVERSE_FOREACH(EINA_INLIST_GET(sd->items), bi)
{
if (E_INSIDE(x, y, bi->x, bi->y, bi->w, bi->h)) return bi->obj;
}
return NULL;
}
if (y < sd->h / 2)
{
EINA_INLIST_FOREACH(EINA_INLIST_GET(sd->items), bi)
{
if (E_INSIDE(x, y, bi->x, bi->y, bi->w, bi->h)) return bi->obj;
}
return NULL;
}
EINA_INLIST_REVERSE_FOREACH(EINA_INLIST_GET(sd->items), bi)
{
if (E_INSIDE(x, y, bi->x, bi->y, bi->w, bi->h)) return bi->obj;
}
return NULL;
}
EAPI Eina_Bool
e_box_item_size_get(Evas_Object *obj, int *w, int *h)
{
E_Box_Item *bi;
bi = evas_object_data_get(obj, "e_box_data");
EINA_SAFETY_ON_NULL_RETURN_VAL(bi, EINA_FALSE);
if (w) *w = bi->w;
if (h) *h = bi->h;
return EINA_TRUE;
}
/* local subsystem functions */
static void
_e_box_unpack_internal(E_Smart_Data *sd, E_Box_Item *bi)
{
Eina_Inlist *l;
l = EINA_INLIST_GET(sd->items);
l = eina_inlist_remove(l, EINA_INLIST_GET(bi));
sd->items = EINA_INLIST_CONTAINER_GET(l, E_Box_Item);
sd->item_count--;
_e_box_smart_disown(bi);
sd->changed = 1;
if (sd->frozen <= 0) _e_box_smart_reconfigure(sd);
}
static E_Box_Item *
_e_box_smart_adopt(E_Smart_Data *sd, Evas_Object *obj)
{
E_Box_Item *bi;
bi = calloc(1, sizeof(E_Box_Item));
if (!bi) return NULL;
bi->sd = sd;
bi->obj = obj;
/* defaults */
bi->fill_w = 0;
bi->fill_h = 0;
bi->expand_w = 0;
bi->expand_h = 0;
bi->align.x = 0.5;
bi->align.y = 0.5;
bi->min.w = 0;
bi->min.h = 0;
bi->max.w = 0;
bi->max.h = 0;
evas_object_clip_set(obj, sd->clip);
evas_object_smart_member_add(obj, bi->sd->obj);
evas_object_data_set(obj, "e_box_data", bi);
evas_object_event_callback_add(obj, EVAS_CALLBACK_FREE,
_e_box_smart_item_del_hook, NULL);
if ((!evas_object_visible_get(sd->clip)) &&
(evas_object_visible_get(sd->obj)))
evas_object_show(sd->clip);
return bi;
}
static void
_e_box_smart_disown(E_Box_Item *bi)
{
if (!bi) return;
if (!bi->sd->items)
{
if (evas_object_visible_get(bi->sd->clip))
evas_object_hide(bi->sd->clip);
}
evas_object_event_callback_del(bi->obj,
EVAS_CALLBACK_FREE,
_e_box_smart_item_del_hook);
evas_object_smart_member_del(bi->obj);
evas_object_clip_unset(bi->obj);
evas_object_data_del(bi->obj, "e_box_data");
free(bi);
}
static void
_e_box_smart_item_del_hook(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
e_box_unpack(obj);
}
static void
_e_box_smart_reconfigure(E_Smart_Data *sd)
{
Evas_Coord x, y, w, h, xx, yy;
E_Box_Item *bi;
int minw, minh, wdif, hdif;
int count, expand;
if (!sd->changed) return;
x = sd->x;
y = sd->y;
w = sd->w;
h = sd->h;
_e_box_smart_extents_calculate(sd);
minw = sd->min.w;
minh = sd->min.h;
count = sd->item_count;
expand = 0;
if (w < minw)
{
x = x + ((w - minw) * (1.0 - sd->align.x));
w = minw;
}
if (h < minh)
{
y = y + ((h - minh) * (1.0 - sd->align.y));
h = minh;
}
EINA_INLIST_FOREACH(EINA_INLIST_GET(sd->items), bi)
{
if (sd->horizontal)
{
if (bi->expand_w) expand++;
}
else
{
if (bi->expand_h) expand++;
}
}
if (expand == 0)
{
if (sd->horizontal)
{
x += (double)(w - minw) * sd->align.x;
w = minw;
}
else
{
y += (double)(h - minh) * sd->align.y;
h = minh;
}
}
wdif = w - minw;
hdif = h - minh;
xx = x;
yy = y;
EINA_INLIST_FOREACH(EINA_INLIST_GET(sd->items), bi)
{
if (sd->horizontal)
{
if (sd->homogenous)
{
Evas_Coord ww, hh, ow, oh;
ww = (w / (Evas_Coord)count);
hh = h;
ow = bi->min.w;
if (bi->fill_w) ow = ww;
if ((bi->max.w >= 0) && (bi->max.w < ow))
ow = bi->max.w;
oh = bi->min.h;
if (bi->fill_h) oh = hh;
if ((bi->max.h >= 0) && (bi->max.h < oh))
oh = bi->max.h;
bi->x = xx + (Evas_Coord)(((double)(ww - ow)) * bi->align.x);
bi->y = yy + (Evas_Coord)(((double)(hh - oh)) * bi->align.y);
evas_object_move(bi->obj, bi->x, bi->y);
evas_object_resize(bi->obj, bi->w = ow, bi->h = oh);
xx += ww;
}
else
{
Evas_Coord ww, hh, ow, oh;
ww = bi->min.w;
if ((expand > 0) && (bi->expand_w))
{
if (expand == 1) ow = wdif;
else ow = (w - minw) / expand;
wdif -= ow;
ww += ow;
}
hh = h;
ow = bi->min.w;
if (bi->fill_w) ow = ww;
if ((bi->max.w >= 0) && (bi->max.w < ow)) ow = bi->max.w;
oh = bi->min.h;
if (bi->fill_h) oh = hh;
if ((bi->max.h >= 0) && (bi->max.h < oh)) oh = bi->max.h;
bi->x = xx + (Evas_Coord)(((double)(ww - ow)) * bi->align.x);
bi->y = yy + (Evas_Coord)(((double)(hh - oh)) * bi->align.y);
evas_object_move(bi->obj, bi->x, bi->y);
evas_object_resize(bi->obj, bi->w = ow, bi->h = oh);
xx += ww;
}
}
else
{
if (sd->homogenous)
{
Evas_Coord ww, hh, ow, oh;
ww = w;
hh = (h / (Evas_Coord)count);
ow = bi->min.w;
if (bi->fill_w) ow = ww;
if ((bi->max.w >= 0) && (bi->max.w < ow)) ow = bi->max.w;
oh = bi->min.h;
if (bi->fill_h) oh = hh;
if ((bi->max.h >= 0) && (bi->max.h < oh)) oh = bi->max.h;
bi->x = xx + (Evas_Coord)(((double)(ww - ow)) * bi->align.x);
bi->y = yy + (Evas_Coord)(((double)(hh - oh)) * bi->align.y);
evas_object_move(bi->obj, bi->x, bi->y);
evas_object_resize(bi->obj, bi->w = ow, bi->h = oh);
yy += hh;
}
else
{
Evas_Coord ww, hh, ow, oh;
ww = w;
hh = bi->min.h;
if ((expand > 0) && (bi->expand_h))
{
if (expand == 1) oh = hdif;
else oh = (h - minh) / expand;
hdif -= oh;
hh += oh;
}
ow = bi->min.w;
if (bi->fill_w) ow = ww;
if ((bi->max.w >= 0) && (bi->max.w < ow)) ow = bi->max.w;
oh = bi->min.h;
if (bi->fill_h) oh = hh;
if ((bi->max.h >= 0) && (bi->max.h < oh)) oh = bi->max.h;
bi->x = xx + (Evas_Coord)(((double)(ww - ow)) * bi->align.x);
bi->y = yy + (Evas_Coord)(((double)(hh - oh)) * bi->align.y);
evas_object_move(bi->obj, bi->x, bi->y);
evas_object_resize(bi->obj, bi->w = ow, bi->h = oh);
yy += hh;
}
}
}
sd->changed = 0;
}
static void
_e_box_smart_extents_calculate(E_Smart_Data *sd)
{
E_Box_Item *bi;
int minw, minh;
/* FIXME: need to calc max */
sd->max.w = -1; /* max < 0 == unlimited */
sd->max.h = -1;
minw = 0;
minh = 0;
if (sd->homogenous)
{
EINA_INLIST_FOREACH(EINA_INLIST_GET(sd->items), bi)
{
if (minh < bi->min.h) minh = bi->min.h;
if (minw < bi->min.w) minw = bi->min.w;
}
if (sd->horizontal)
minw *= sd->item_count;
else
minh *= sd->item_count;
}
else
{
EINA_INLIST_FOREACH(EINA_INLIST_GET(sd->items), bi)
{
if (sd->horizontal)
{
if (minh < bi->min.h) minh = bi->min.h;
minw += bi->min.w;
}
else
{
if (minw < bi->min.w) minw = bi->min.w;
minh += bi->min.h;
}
}
}
sd->min.w = minw;
sd->min.h = minh;
}
static void
_e_box_smart_init(void)
{
if (_e_smart) return;
{
static const Evas_Smart_Class sc =
{
"e_box",
EVAS_SMART_CLASS_VERSION,
_e_box_smart_add,
_e_box_smart_del,
_e_box_smart_move,
_e_box_smart_resize,
_e_box_smart_show,
_e_box_smart_hide,
_e_box_smart_color_set,
_e_box_smart_clip_set,
_e_box_smart_clip_unset,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
};
_e_smart = evas_smart_class_new(&sc);
}
}
static void
_e_box_smart_add(Evas_Object *obj)
{
E_Smart_Data *sd;
sd = calloc(1, sizeof(E_Smart_Data));
if (!sd) return;
sd->obj = obj;
sd->x = 0;
sd->y = 0;
sd->w = 0;
sd->h = 0;
sd->align.x = 0.5;
sd->align.y = 0.5;
sd->clip = evas_object_rectangle_add(evas_object_evas_get(obj));
evas_object_smart_member_add(sd->clip, obj);
evas_object_move(sd->clip, -100004, -100004);
evas_object_resize(sd->clip, 200008, 200008);
evas_object_color_set(sd->clip, 255, 255, 255, 255);
evas_object_smart_data_set(obj, sd);
}
static void
_e_box_smart_del(Evas_Object *obj)
{
E_Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
/* FIXME: this gets into an infinite loop when changin basic->advanced on
* ibar config dialog
*/
e_box_freeze(obj);
while (sd->items)
e_box_unpack(sd->items->obj);
e_box_thaw(obj);
evas_object_del(sd->clip);
free(sd);
evas_object_smart_data_set(obj, NULL);
}
static void
_e_box_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{
E_Smart_Data *sd;
E_Box_Item *bi;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
if ((x == sd->x) && (y == sd->y)) return;
{
Evas_Coord dx, dy;
dx = x - sd->x;
dy = y - sd->y;
EINA_INLIST_FOREACH(EINA_INLIST_GET(sd->items), bi)
{
bi->x += dx;
bi->y += dy;
evas_object_move(bi->obj, bi->x, bi->y);
}
}
sd->x = x;
sd->y = y;
}
static void
_e_box_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
{
E_Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
if ((w == sd->w) && (h == sd->h)) return;
sd->w = w;
sd->h = h;
sd->changed = 1;
_e_box_smart_reconfigure(sd);
}
static void
_e_box_smart_show(Evas_Object *obj)
{
E_Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
if (sd->items) evas_object_show(sd->clip);
}
static void
_e_box_smart_hide(Evas_Object *obj)
{
E_Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
evas_object_hide(sd->clip);
}
static void
_e_box_smart_color_set(Evas_Object *obj, int r, int g, int b, int a)
{
E_Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
evas_object_color_set(sd->clip, r, g, b, a);
}
static void
_e_box_smart_clip_set(Evas_Object *obj, Evas_Object *clip)
{
E_Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
evas_object_clip_set(sd->clip, clip);
}
static void
_e_box_smart_clip_unset(Evas_Object *obj)
{
E_Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
evas_object_clip_unset(sd->clip);
}

30
src/bin/e_wayland/e_box.h Normal file
View File

@ -0,0 +1,30 @@
#ifdef E_TYPEDEFS
#else
#ifndef E_BOX_H
#define E_BOX_H
EAPI Evas_Object *e_box_add (Evas *evas);
EAPI int e_box_freeze (Evas_Object *obj);
EAPI int e_box_thaw (Evas_Object *obj);
EAPI void e_box_orientation_set (Evas_Object *obj, int horizontal);
EAPI int e_box_orientation_get (Evas_Object *obj);
EAPI void e_box_homogenous_set (Evas_Object *obj, int homogenous);
EAPI int e_box_pack_start (Evas_Object *obj, Evas_Object *child);
EAPI int e_box_pack_end (Evas_Object *obj, Evas_Object *child);
EAPI int e_box_pack_before (Evas_Object *obj, Evas_Object *child, Evas_Object *before);
EAPI int e_box_pack_after (Evas_Object *obj, Evas_Object *child, Evas_Object *after);
EAPI int e_box_pack_count_get (Evas_Object *obj);
EAPI Evas_Object *e_box_pack_object_nth (Evas_Object *obj, int n);
EAPI Evas_Object *e_box_pack_object_first (Evas_Object *obj);
EAPI Evas_Object *e_box_pack_object_last (Evas_Object *obj);
EAPI void e_box_pack_options_set (Evas_Object *obj, int fill_w, int fill_h, int expand_w, int expand_h, double align_x, double align_y, Evas_Coord min_w, Evas_Coord min_h, Evas_Coord max_w, Evas_Coord max_h);
EAPI void e_box_unpack (Evas_Object *obj);
EAPI void e_box_size_min_get (Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh);
EAPI void e_box_size_max_get (Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh);
EAPI void e_box_align_get (Evas_Object *obj, double *ax, double *ay);
EAPI void e_box_align_set (Evas_Object *obj, double ax, double ay);
EAPI void e_box_align_pixel_offset_get (Evas_Object *obj, int *x, int *y);
EAPI Evas_Object *e_box_item_at_xy_get(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
EAPI Eina_Bool e_box_item_size_get(Evas_Object *obj, int *w, int *h);
#endif
#endif

View File

@ -2,7 +2,7 @@
/* local function prototypes */
static void _e_comp_cb_bind(struct wl_client *client, void *data, unsigned int version EINA_UNUSED, unsigned int id);
static void _e_comp_cb_bind_manager(struct wl_client *client, void *data, unsigned int version, unsigned int id);
static void _e_comp_cb_bind_manager(struct wl_client *client, void *data EINA_UNUSED, unsigned int version EINA_UNUSED, unsigned int id);
static void _e_comp_cb_surface_create(struct wl_client *client, struct wl_resource *resource, unsigned int id);
static void _e_comp_cb_surface_destroy(struct wl_resource *resource);
static void _e_comp_cb_region_create(struct wl_client *client, struct wl_resource *resource, unsigned int id);
@ -289,8 +289,6 @@ e_compositor_damage_calculate(E_Compositor *comp)
Eina_List *l;
pixman_region32_t clip, opaque;
printf("E_Comp Damage Calculate\n");
/* check for valid compositor */
if (!comp) return;
@ -324,10 +322,13 @@ e_compositor_damage_calculate(E_Compositor *comp)
}
}
EAPI void
e_compositor_damage_flush(E_Compositor *comp, E_Surface *es)
EAPI unsigned int
e_compositor_get_time(void)
{
struct timeval tv;
gettimeofday(&tv, NULL);
return (tv.tv_sec * 1000 + tv.tv_usec / 1000);
}
/* local functions */
@ -344,7 +345,7 @@ _e_comp_cb_bind(struct wl_client *client, void *data, unsigned int version EINA_
}
static void
_e_comp_cb_bind_manager(struct wl_client *client, void *data, unsigned int version, unsigned int id)
_e_comp_cb_bind_manager(struct wl_client *client, void *data EINA_UNUSED, unsigned int version EINA_UNUSED, unsigned int id)
{
/* add the data device manager to the client */
wl_client_add_object(client, &wl_data_device_manager_interface,

View File

@ -66,7 +66,7 @@ EAPI E_Compositor *e_compositor_get(void);
EAPI void e_compositor_plane_stack(E_Compositor *comp, E_Plane *plane, E_Plane *above);
EAPI int e_compositor_input_read(int fd EINA_UNUSED, unsigned int mask EINA_UNUSED, void *data);
EAPI void e_compositor_damage_calculate(E_Compositor *comp);
EAPI void e_compositor_damage_flush(E_Compositor *comp, E_Surface *es);
EAPI unsigned int e_compositor_get_time(void);
# endif
#endif

View File

@ -0,0 +1,19 @@
#include "e.h"
EAPI E_Config_Dialog *
e_config_dialog_new(E_Container *con, const char *title, const char *name, const char *class, const char *icon, int icon_size, E_Config_Dialog_View *view, void *data)
{
return NULL;
}
EAPI int
e_config_dialog_find(const char *name, const char *class)
{
return 0;
}
EAPI E_Config_Dialog *
e_config_dialog_get(const char *name, const char *class)
{
return NULL;
}

View File

@ -0,0 +1,66 @@
#ifdef E_TYPEDEFS
typedef enum _E_Config_Dialog_CFData_Type
{
E_CONFIG_DIALOG_CFDATA_TYPE_BASIC,
E_CONFIG_DIALOG_CFDATA_TYPE_ADVANCED,
E_CONFIG_DIALOG_CFDATA_TYPE_NORMAL_WINDOW
} E_Config_Dialog_CFData_Type;
typedef struct _E_Config_Dialog E_Config_Dialog;
typedef struct _E_Config_Dialog_View E_Config_Dialog_View;
typedef struct _E_Config_Dialog_Data E_Config_Dialog_Data;
#else
#ifndef E_CONFIG_DIALOG_H
#define E_CONFIG_DIALOG_H
#define E_CONFIG_DIALOG_TYPE 0xE0b01017
struct _E_Config_Dialog_View
{
unsigned char override_auto_apply : 1;
unsigned char basic_only : 1;
unsigned char normal_win : 1;
unsigned char scroll : 1;
void *(*create_cfdata) (E_Config_Dialog *cfd);
void (*free_cfdata) (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
int (*close_cfdata) (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
struct {
int (*apply_cfdata) (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
Evas_Object *(*create_widgets) (E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
int (*check_changed) (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
} basic, advanced;
};
struct _E_Config_Dialog
{
E_Object e_obj_inherit;
E_Config_Dialog_CFData_Type view_type;
E_Config_Dialog_View *view;
E_Config_Dialog_Data *cfdata;
E_Container *con;
const char *title;
const char *icon;
const char *name;
const char *class;
int icon_size;
E_Dialog *dia;
void *data;
Ecore_Timer *auto_apply_timer;
unsigned char hide_buttons : 1;
unsigned char cfg_changed : 1;
unsigned char cfg_changed_auto : 1;
};
EAPI E_Config_Dialog *e_config_dialog_new(E_Container *con, const char *title, const char *name, const char *class, const char *icon, int icon_size, E_Config_Dialog_View *view, void *data);
EAPI int e_config_dialog_find(const char *name, const char *class);
EAPI E_Config_Dialog *e_config_dialog_get(const char *name, const char *class);
EAPI void e_config_dialog_changed_auto_set(E_Config_Dialog *cfd, unsigned char value);
EAPI void e_config_dialog_changed_set(E_Config_Dialog *cfd, unsigned char value);
#endif
#endif

View File

@ -0,0 +1,517 @@
#include "e.h"
static void _e_configure_menu_module_item_cb(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_configure_menu_add(void *data, E_Menu *m);
static void _e_configure_efreet_desktop_cleanup(void);
static void _e_configure_efreet_desktop_update(void);
static Eina_Bool _e_configure_cb_efreet_desktop_cache_update(void *data, int type, void *event);
static void _e_configure_registry_item_full_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, E_Config_Dialog *(*func)(E_Container * con, const char *params), void (*generic_func)(E_Container *con, const char *params), Efreet_Desktop *desktop, const char *params);
static void _e_configure_registry_item_free(E_Configure_It *eci);
static void _configure_job(void *data);
static Eina_Bool _configure_init_timer(void *data);
EAPI Eina_List *e_configure_registry = NULL;
static Eina_List *handlers = NULL;
static E_Int_Menu_Augmentation *maug = NULL;
static Ecore_Job *update_job = NULL;
static struct
{
void (*func)(const void *data, E_Container *con, const char *params, Efreet_Desktop *desktop);
const char *data;
} custom_desktop_exec = { NULL, NULL };
EINTERN void
e_configure_init(void)
{
e_configure_registry_category_add("extensions", 90, _("Extensions"), NULL, "preferences-extensions");
/* e_configure_registry_item_add("extensions/modules", 10, _("Modules"), NULL, "preferences-plugin", e_int_config_modules); */
maug = e_int_menus_menu_augmentation_add_sorted
("config/1", _("Modules"), _e_configure_menu_add, NULL, NULL, NULL);
if (update_job)
{
ecore_job_del(update_job);
update_job = NULL;
}
ecore_timer_add(0.0, _configure_init_timer, NULL);
}
EAPI void
e_configure_registry_call(const char *path, E_Container *con, const char *params)
{
E_Configure_Cat *ecat;
Eina_List *l;
char *cat;
const char *item;
/* path is "category/item" */
cat = ecore_file_dir_get(path);
if (!cat) return;
item = ecore_file_file_get(path);
if (!con) con = e_container_current_get(e_manager_current_get());
EINA_LIST_FOREACH(e_configure_registry, l, ecat)
if (!strcmp(cat, ecat->cat))
{
E_Configure_It *eci;
Eina_List *ll;
EINA_LIST_FOREACH(ecat->items, ll, eci)
if (!strcmp(item, eci->item))
{
if (!params) params = eci->params;
if (eci->func) eci->func(con, params);
else if (eci->generic_func)
eci->generic_func(con, params);
else if (eci->desktop)
{
if (custom_desktop_exec.func)
custom_desktop_exec.func(custom_desktop_exec.data,
con, params, eci->desktop);
else
e_exec(e_util_zone_current_get(con->man),
eci->desktop, NULL, NULL, "config");
}
break;
}
break;
}
free(cat);
}
EAPI void
e_configure_registry_item_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, E_Config_Dialog *(*func)(E_Container * con, const char *params))
{
_e_configure_registry_item_full_add(path, pri, label, icon_file, icon, func, NULL, NULL, NULL);
}
EAPI void
e_configure_registry_generic_item_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, void (*generic_func)(E_Container *con, const char *params))
{
_e_configure_registry_item_full_add(path, pri, label, icon_file, icon, NULL, generic_func, NULL, NULL);
}
EAPI void
e_configure_registry_item_params_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, E_Config_Dialog *(*func)(E_Container * con, const char *params), const char *params)
{
_e_configure_registry_item_full_add(path, pri, label, icon_file, icon, func, NULL, NULL, params);
}
/**
* Delete an item in the configuration panel.
*
* @param path location the item to delete
*/
EAPI void
e_configure_registry_item_del(const char *path)
{
E_Configure_Cat *ecat;
Eina_List *l;
const char *item;
char *cat;
/* path is "category/item" */
cat = ecore_file_dir_get(path);
if (!cat) return;
item = ecore_file_file_get(path);
EINA_LIST_FOREACH(e_configure_registry, l, ecat)
if (!strcmp(cat, ecat->cat))
{
E_Configure_It *eci;
Eina_List *ll;
EINA_LIST_FOREACH(ecat->items, ll, eci)
if (!strcmp(item, eci->item))
{
ecat->items = eina_list_remove_list(ecat->items, ll);
_e_configure_registry_item_free(eci);
break;
}
break;
}
free(cat);
}
/**
* Add a category to the configuration panel.
*
* @param path location the new category
* @param pri the priority for sorting the category in the category list
* @param label the name the user will see in configuration panel
* @param icon_file the edje file that holds the icon for the category.
* Can be null to use current theme.
* @param icon the name of the edje group to use as icon
*/
static int
_E_configure_category_pri_cb(E_Configure_Cat *ecat, E_Configure_Cat *ecat2)
{
if (ecat->pri == ecat2->pri)
return strcmp(ecat->label, ecat2->label);
return ecat->pri - ecat2->pri;
}
EAPI void
e_configure_registry_category_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon)
{
E_Configure_Cat *ecat2;
E_Configure_Cat *ecat;
Eina_List *l;
/* if it exists - ignore this */
EINA_LIST_FOREACH(e_configure_registry, l, ecat2)
if (!strcmp(ecat2->cat, path)) return;
ecat = E_NEW(E_Configure_Cat, 1);
if (!ecat) return;
ecat->cat = eina_stringshare_add(path);
ecat->pri = pri;
ecat->label = eina_stringshare_add(label);
if (icon_file) ecat->icon_file = eina_stringshare_add(icon_file);
if (icon) ecat->icon = eina_stringshare_add(icon);
e_configure_registry = eina_list_sorted_insert(e_configure_registry,
EINA_COMPARE_CB(_E_configure_category_pri_cb),
ecat);
}
/**
* Delete a category in the configuration panel.
*
* @param path location the category to delete
*/
EAPI void
e_configure_registry_category_del(const char *path)
{
E_Configure_Cat *ecat;
Eina_List *l;
char *cat;
cat = ecore_file_dir_get(path);
if (!cat) return;
EINA_LIST_FOREACH(e_configure_registry, l, ecat)
if (!strcmp(cat, ecat->cat))
{
if (ecat->items) break;
e_configure_registry = eina_list_remove_list(e_configure_registry, l);
eina_stringshare_del(ecat->cat);
eina_stringshare_del(ecat->label);
if (ecat->icon) eina_stringshare_del(ecat->icon);
if (ecat->icon_file) eina_stringshare_del(ecat->icon_file);
free(ecat);
break;
}
free(cat);
}
/**
* Add a item to the configuration panel.
*
* @param path location the location to place configuration item
* @param pri the priority for sorting the item in the category list
* @param label the name the user will see in configuration panel
* @param icon_file the edje file that holds the icon for the category.
* Can be null to use current theme.
* @param icon the name of the edje group to use as icon
* @param func the callback to use when the configuration item is clicked
*/
EAPI void
e_configure_registry_custom_desktop_exec_callback_set(void (*func)(const void *data, E_Container *con, const char *params, Efreet_Desktop *desktop), const void *data)
{
custom_desktop_exec.func = func;
custom_desktop_exec.data = data;
}
EAPI int
e_configure_registry_exists(const char *path)
{
E_Configure_Cat *ecat;
Eina_List *l;
char *cat;
const char *item;
int ret = 0;
/* path is "category/item" */
cat = ecore_file_dir_get(path);
if (!cat) return 0;
item = ecore_file_file_get(path);
EINA_LIST_FOREACH(e_configure_registry, l, ecat)
if (!strcmp(cat, ecat->cat))
{
E_Configure_It *eci;
Eina_List *ll;
if (!item)
{
ret = 1;
break;
}
EINA_LIST_FOREACH(ecat->items, ll, eci)
if (!strcmp(item, eci->item))
{
ret = 1;
break;
}
break;
}
free(cat);
return ret;
}
static void
_e_configure_menu_module_item_cb(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__)
{
/* e_int_config_modules(m->zone->container, NULL); */
}
static void
_e_configure_menu_add(void *data __UNUSED__, E_Menu *m)
{
E_Menu_Item *mi;
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, _("Modules"));
e_util_menu_item_theme_icon_set(mi, "preferences-plugin");
e_menu_item_callback_set(mi, _e_configure_menu_module_item_cb, NULL);
}
static void
_configure_job(void *data __UNUSED__)
{
_e_configure_efreet_desktop_update();
update_job = NULL;
}
static Eina_Bool
_configure_init_timer(void *data __UNUSED__)
{
handlers = eina_list_append
(handlers, ecore_event_handler_add
(EFREET_EVENT_DESKTOP_CACHE_UPDATE, _e_configure_cb_efreet_desktop_cache_update, NULL));
if (update_job) ecore_job_del(update_job);
update_job = ecore_job_add(_configure_job, NULL);
return EINA_FALSE;
}
static void
_e_configure_efreet_desktop_cleanup(void)
{
Eina_List *l;
E_Configure_Cat *ecat;
// printf("_e_configure_efreet_desktop_cleanup\n");
/* remove anything with a desktop entry */
EINA_LIST_FOREACH(e_configure_registry, l, ecat)
{
E_Configure_It *eci;
Eina_List *ll, *ln;
EINA_LIST_FOREACH_SAFE(ecat->items, ll, ln, eci)
if (eci->desktop)
{
_e_configure_registry_item_free(eci);
ecat->items = eina_list_remove_list(ecat->items, ll);
}
}
}
static void
_e_configure_efreet_desktop_update(void)
{
Eina_List *settings_desktops, *system_desktops;
Efreet_Desktop *desktop;
Eina_List *l;
char buf[1024];
/* get desktops */
settings_desktops = efreet_util_desktop_category_list("Settings");
system_desktops = efreet_util_desktop_category_list("System");
if ((!settings_desktops) || (!system_desktops))
{
EINA_LIST_FREE(settings_desktops, desktop)
efreet_desktop_free(desktop);
EINA_LIST_FREE(system_desktops, desktop)
efreet_desktop_free(desktop);
return;
}
/* get ones in BOTH lists */
EINA_LIST_FOREACH(settings_desktops, l, desktop)
{
char *s;
char *cfg_cat_name;
const char *cfg_cat_icon;
char *cfg_cat;
char *cfg_cat_cfg;
const char *cfg_icon;
char *label;
int cfg_pri;
int dopref;
dopref = 0;
cfg_cat = NULL;
cfg_icon = NULL;
cfg_cat_cfg = NULL;
cfg_pri = 1000;
cfg_cat_name = NULL;
cfg_cat_icon = NULL;
label = NULL;
if (!eina_list_data_find(system_desktops, desktop))
{
/* settings desktop but not in system -> put in preferences */
dopref = 1;
}
if (desktop->x)
{
cfg_cat_cfg = eina_hash_find(desktop->x, "X-Enlightenment-Config-Category");
s = eina_hash_find(desktop->x, "X-Enlightenment-Config-Priority");
if (s) cfg_pri = atoi(s);
cfg_cat_name = eina_hash_find(desktop->x, "X-Enlightenment-Config-Category-Name");
cfg_cat_icon = eina_hash_find(desktop->x, "X-Enlightenment-Config-Category-Icon");
if ((cfg_cat_icon) && (cfg_cat_icon[0] != '/'))
cfg_cat_icon = efreet_icon_path_find(e_config->icon_theme,
cfg_cat_icon, 64);
}
if (desktop->icon)
{
if (desktop->icon[0] == '/')
cfg_icon = desktop->icon;
else
cfg_icon = efreet_icon_path_find(e_config->icon_theme,
desktop->icon, 64);
}
if (desktop->name) label = desktop->name;
else if (desktop->generic_name)
label = desktop->generic_name;
else label = "???";
if (!cfg_cat_cfg)
{
const char *ic = cfg_cat_icon;
if (dopref)
{
snprintf(buf, sizeof(buf), "preferences/%s", label);
if (!ic) ic = "preferences-preferences";
e_configure_registry_category_add("preferences", 900,
_("Preferences"),
NULL, ic);
}
else
{
snprintf(buf, sizeof(buf), "system/%s", label);
if (!ic) ic = "preferences-system";
e_configure_registry_category_add("system", 1000,
_("System"),
NULL, ic);
}
cfg_cat_cfg = buf;
}
else
{
cfg_cat = ecore_file_dir_get(cfg_cat_cfg);
if (!cfg_cat) cfg_cat = strdup(cfg_cat_cfg);
if (cfg_cat)
{
if (!cfg_cat_name) cfg_cat_name = cfg_cat;
e_configure_registry_category_add(cfg_cat,
1000, cfg_cat_name,
NULL, cfg_cat_icon);
free(cfg_cat);
cfg_cat = NULL;
}
}
_e_configure_registry_item_full_add(cfg_cat_cfg, cfg_pri, label,
NULL, cfg_icon,
NULL, NULL, desktop, NULL);
}
EINA_LIST_FREE(settings_desktops, desktop)
efreet_desktop_free(desktop);
EINA_LIST_FREE(system_desktops, desktop)
efreet_desktop_free(desktop);
}
static Eina_Bool
_e_configure_cb_efreet_desktop_cache_update(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
_e_configure_efreet_desktop_cleanup();
if (update_job) ecore_job_del(update_job);
update_job = ecore_job_add(_configure_job, NULL);
return 1;
}
static int
_e_configure_compare_cb(E_Configure_It *eci, E_Configure_It *eci2)
{
return e_util_strcasecmp(eci->label, eci2->label);
}
static int
_e_configure_compare_pri_cb(E_Configure_It *eci, E_Configure_It *eci2)
{
if (eci->pri == eci2->pri)
return strcmp(eci->label, eci2->label);
return eci->pri - eci2->pri;
}
static void
_e_configure_registry_item_full_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, E_Config_Dialog *(*func)(E_Container * con, const char *params), void (*generic_func)(E_Container *con, const char *params), Efreet_Desktop *desktop, const char *params)
{
Eina_List *l;
char *cat;
const char *item;
E_Configure_It *eci;
E_Configure_Cat *ecat;
Eina_Bool external;
EINA_SAFETY_ON_NULL_RETURN(path);
EINA_SAFETY_ON_NULL_RETURN(label);
/* path is "category/item" */
cat = ecore_file_dir_get(path);
if (!cat) return;
EINA_LIST_FOREACH(e_configure_registry, l, ecat)
{
if (strcmp(cat, ecat->cat)) continue;
item = ecore_file_file_get(path);
eci = E_NEW(E_Configure_It, 1);
eci->item = eina_stringshare_add(item);
eci->pri = pri;
eci->label = eina_stringshare_add(label);
if (icon_file) eci->icon_file = eina_stringshare_add(icon_file);
if (icon) eci->icon = eina_stringshare_add(icon);
if (params) eci->params = eina_stringshare_add(params);
eci->func = func;
eci->generic_func = generic_func;
eci->desktop = desktop;
if (eci->desktop) efreet_desktop_ref(eci->desktop);
external = !strncmp(path, "preferences/", sizeof("preferences/") - 1);
if (!external) external = !strncmp(path, "system/", sizeof("system/") - 1);
if (external)
ecat->items = eina_list_sorted_insert(ecat->items, EINA_COMPARE_CB(_e_configure_compare_cb), eci);
else
ecat->items = eina_list_sorted_insert(ecat->items, EINA_COMPARE_CB(_e_configure_compare_pri_cb), eci);
break;
}
free(cat);
}
static void
_e_configure_registry_item_free(E_Configure_It *eci)
{
eina_stringshare_del(eci->item);
eina_stringshare_del(eci->label);
eina_stringshare_del(eci->icon);
if (eci->icon_file) eina_stringshare_del(eci->icon_file);
if (eci->desktop) efreet_desktop_free(eci->desktop);
if (eci->params) eina_stringshare_del(eci->params);
free(eci);
}

View File

@ -0,0 +1,47 @@
#ifdef E_TYPEDEFS
typedef struct _E_Configure_Cat E_Configure_Cat;
typedef struct _E_Configure_It E_Configure_It;
#else
#ifndef E_CONFIGURE_H
#define E_CONFIGURE_H
struct _E_Configure_Cat
{
const char *cat;
int pri;
const char *label;
const char *icon_file;
const char *icon;
Eina_List *items;
};
struct _E_Configure_It
{
const char *item;
int pri;
const char *label;
const char *icon_file;
const char *icon;
const char *params;
E_Config_Dialog *(*func) (E_Container *con, const char *params);
void (*generic_func) (E_Container *con, const char *params);
Efreet_Desktop *desktop;
};
EAPI void e_configure_registry_item_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, E_Config_Dialog *(*func) (E_Container *con, const char *params));
EAPI void e_configure_registry_item_params_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, E_Config_Dialog *(*func) (E_Container *con, const char *params), const char *params);
EAPI void e_configure_registry_generic_item_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon, void (*generic_func) (E_Container *con, const char *params));
EAPI void e_configure_registry_item_del(const char *path);
EAPI void e_configure_registry_category_add(const char *path, int pri, const char *label, const char *icon_file, const char *icon);
EAPI void e_configure_registry_category_del(const char *path);
EAPI void e_configure_registry_call(const char *path, E_Container *con, const char *params);
EAPI int e_configure_registry_exists(const char *path);
EAPI void e_configure_registry_custom_desktop_exec_callback_set(void (*func) (const void *data, E_Container *con, const char *params, Efreet_Desktop *desktop), const void *data);
EINTERN void e_configure_init(void);
extern EAPI Eina_List *e_configure_registry;
#endif
#endif

View File

@ -3,6 +3,7 @@
/* local function prototypes */
static void _e_container_cb_free(E_Container *con);
static Eina_Bool _e_container_cb_mouse_in(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
static E_Container *_e_container_find_by_event_window(unsigned int win);
/* local variables */
static Eina_List *_hdlrs = NULL;
@ -28,7 +29,10 @@ EAPI E_Container *
e_container_new(E_Manager *man)
{
E_Container *con;
static unsigned int num = 0;
E_Output *output;
Eina_List *l;
static unsigned int con_num = 0;
int num = 0;
/* check for valid manager */
E_OBJECT_CHECK_RETURN(man, NULL);
@ -45,8 +49,8 @@ e_container_new(E_Manager *man)
con->y = man->y;
con->w = man->w;
con->h = man->h;
con->num = num;
num++;
con->num = con_num;
con_num++;
/* add this container to the managers list */
man->containers = eina_list_append(man->containers, con);
@ -67,16 +71,21 @@ e_container_new(E_Manager *man)
/* get the background canvas */
con->bg_evas = ecore_evas_get(con->bg_ee);
Evas_Object *o;
o = evas_object_rectangle_add(con->bg_evas);
evas_object_color_set(o, 255, 0, 0, 255);
evas_object_move(o, 0, 0);
evas_object_resize(o, con->w, con->h);
evas_object_show(o);
ecore_evas_object_associate(con->bg_ee, o,
ECORE_EVAS_OBJECT_ASSOCIATE_BASE);
con->o_blank = evas_object_rectangle_add(con->bg_evas);
evas_object_layer_set(con->o_blank, -100);
evas_object_move(con->o_blank, con->x, con->y);
evas_object_resize(con->o_blank, con->w, con->h);
evas_object_color_set(con->o_blank, 255, 0, 0, 255);
evas_object_name_set(con->o_blank, "e/desktop/background");
evas_object_data_set(con->o_blank, "e_container", con);
evas_object_show(con->o_blank);
/* TODO: create zones */
EINA_LIST_FOREACH(_e_comp->outputs, l, output)
{
e_zone_new(con, num, output->x, output->y,
output->current->w, output->current->h);
num++;
}
return con;
}
@ -84,6 +93,9 @@ e_container_new(E_Manager *man)
EAPI void
e_container_show(E_Container *con)
{
E_Zone *zone;
Eina_List *l;
/* check for valid container */
E_OBJECT_CHECK(con);
E_OBJECT_TYPE_CHECK(con, E_CONTAINER_TYPE);
@ -94,7 +106,9 @@ e_container_show(E_Container *con)
/* show the ecore_evas */
ecore_evas_show(con->bg_ee);
/* TODO: show zones */
/* show zones */
EINA_LIST_FOREACH(con->zones, l, zone)
e_zone_show(zone);
/* check for valid pointer */
if (!con->ptr)
@ -109,6 +123,9 @@ e_container_show(E_Container *con)
EAPI void
e_container_hide(E_Container *con)
{
E_Zone *zone;
Eina_List *l;
/* check for valid container */
E_OBJECT_CHECK(con);
E_OBJECT_TYPE_CHECK(con, E_CONTAINER_TYPE);
@ -116,7 +133,9 @@ e_container_hide(E_Container *con)
/* check for already invisible */
if (!con->visible) return;
/* TODO: hide zones */
/* hide zones */
EINA_LIST_FOREACH(con->zones, l, zone)
e_zone_hide(zone);
/* hide the ecore_evas */
ecore_evas_hide(con->bg_ee);
@ -162,6 +181,57 @@ e_container_all_thaw(void)
}
}
EAPI E_Container *
e_container_current_get(E_Manager *man)
{
Eina_List *l;
E_Container *con;
E_OBJECT_CHECK_RETURN(man, NULL);
E_OBJECT_TYPE_CHECK_RETURN(man, E_MANAGER_TYPE, NULL);
EINA_LIST_FOREACH(man->containers, l, con)
{
if (!con) continue;
if (con->visible) return con;
}
if (!man->containers) return NULL;
l = man->containers;
return (E_Container *)eina_list_data_get(l);
}
EAPI E_Container *
e_container_number_get(E_Manager *man, int num)
{
Eina_List *l;
E_Container *con;
E_OBJECT_CHECK_RETURN(man, NULL);
E_OBJECT_TYPE_CHECK_RETURN(man, E_MANAGER_TYPE, NULL);
EINA_LIST_FOREACH(man->containers, l, con)
if ((int)con->num == num) return con;
return NULL;
}
EAPI E_Zone *
e_container_zone_number_get(E_Container *con, int num)
{
Eina_List *l;
E_Zone *zone;
E_OBJECT_CHECK_RETURN(con, NULL);
E_OBJECT_TYPE_CHECK_RETURN(con, E_CONTAINER_TYPE, NULL);
EINA_LIST_FOREACH(con->zones, l, zone)
if (((int)zone->num == num)) return zone;
return NULL;
}
/* local functions */
static void
_e_container_cb_free(E_Container *con)
@ -191,10 +261,38 @@ static Eina_Bool
_e_container_cb_mouse_in(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
Ecore_Wl_Event_Mouse_In *ev;
E_Container *con;
ev = event;
/* TODO: code me */
if (!(con = _e_container_find_by_event_window(ev->window)))
return ECORE_CALLBACK_PASS_ON;
if (con->ptr)
{
E_Pointer *ptr;
struct wl_surface *surf;
ptr = con->ptr;
surf = ecore_wl_window_surface_get(ptr->win);
ecore_wl_window_pointer_set(ptr->win, surf, ptr->hot.x, ptr->hot.y);
}
return ECORE_CALLBACK_PASS_ON;
}
static E_Container *
_e_container_find_by_event_window(unsigned int win)
{
Eina_List *l, *ll;
E_Manager *man;
E_Container *con;
EINA_LIST_FOREACH(e_manager_list(), l, man)
{
EINA_LIST_FOREACH(man->containers, ll, con)
if (con->win->id == (int)win) return con;
}
return NULL;
}

View File

@ -18,8 +18,11 @@ struct _E_Container
Ecore_Wl_Window *win;
E_Manager *man;
Ecore_Evas *bg_ee;
Evas *bg_evas;
Evas_Object *o_blank;
E_Pointer *ptr;
Eina_List *zones;
@ -33,6 +36,9 @@ EAPI void e_container_show(E_Container *con);
EAPI void e_container_hide(E_Container *con);
EAPI void e_container_all_freeze(void);
EAPI void e_container_all_thaw(void);
EAPI E_Container *e_container_current_get(E_Manager *man);
EAPI E_Container *e_container_number_get(E_Manager *man, int num);
EAPI E_Zone *e_container_zone_number_get(E_Container *con, int num);
# endif
#endif

View File

@ -0,0 +1,93 @@
#include "e.h"
/* local function prototypes */
static void _e_desk_cb_free(E_Desk *desk);
EINTERN int
e_desk_init(void)
{
return 1;
}
EINTERN int
e_desk_shutdown(void)
{
return 1;
}
EAPI E_Desk *
e_desk_new(E_Zone *zone, int x, int y)
{
E_Desk *desk;
E_OBJECT_CHECK_RETURN(zone, NULL);
E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, NULL);
desk = E_OBJECT_ALLOC(E_Desk, E_DESK_TYPE, _e_desk_cb_free);
if (!desk)
{
printf("FAILED TO ALLOCATE DESK\n");
return NULL;
}
printf("Created New Desktop: %d %d\n", x, y);
desk->zone = zone;
desk->x = x;
desk->y = y;
return desk;
}
EAPI void
e_desk_show(E_Desk *desk)
{
E_OBJECT_CHECK(desk);
E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
if (desk->visible) return;
desk->visible = EINA_TRUE;
e_bg_zone_update(desk->zone, E_BG_TRANSITION_START);
}
EAPI void
e_desk_hide(E_Desk *desk)
{
E_OBJECT_CHECK(desk);
E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
if (!desk->visible) return;
desk->visible = EINA_FALSE;
}
EAPI E_Desk *
e_desk_current_get(E_Zone *zone)
{
E_OBJECT_CHECK_RETURN(zone, NULL);
E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, NULL);
return e_desk_at_xy_get(zone, zone->desk_x_current, zone->desk_y_current);
}
EAPI E_Desk *
e_desk_at_xy_get(E_Zone *zone, int x, int y)
{
E_OBJECT_CHECK_RETURN(zone, NULL);
E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, NULL);
if ((x >= zone->desk_x_count) || (y >= zone->desk_y_count))
return NULL;
else if ((x < 0) || (y < 0))
return NULL;
return zone->desks[x + (y * zone->desk_x_count)];
}
/* local functions */
static void
_e_desk_cb_free(E_Desk *desk)
{
free(desk);
}

View File

@ -0,0 +1,40 @@
#ifdef E_TYPEDEFS
typedef struct _E_Desk E_Desk;
typedef struct _E_Event_Desk_Show E_Event_Desk_Show;
#else
# ifndef E_DESK_H
# define E_DESK_H
# define E_DESK_TYPE 0xE0b01005
struct _E_Desk
{
E_Object e_obj_inherit;
E_Zone *zone;
int x, y;
const char *name;
Eina_Bool visible : 1;
Evas_Object *o_bg;
};
struct _E_Event_Desk_Show
{
E_Desk *desk;
};
extern EAPI int E_EVENT_DESK_SHOW;
EINTERN int e_desk_init(void);
EINTERN int e_desk_shutdown(void);
EAPI E_Desk *e_desk_new(E_Zone *zone, int x, int y);
EAPI void e_desk_show(E_Desk *desk);
EAPI void e_desk_hide(E_Desk *desk);
EAPI E_Desk *e_desk_current_get(E_Zone *zone);
EAPI E_Desk *e_desk_at_xy_get(E_Zone *zone, int x, int y);
# endif
#endif

View File

@ -0,0 +1,219 @@
#include "e.h"
/* local function prototypes */
static E_Dialog *_e_dialog_internal_new(E_Container *con, const char *name, const char *class, Eina_Bool dialog);
static void _e_dialog_cb_free(E_Dialog *dia);
EAPI E_Dialog *
e_dialog_new(E_Container *con, const char *name, const char *class)
{
return _e_dialog_internal_new(con, name, class, EINA_TRUE);
}
EAPI E_Dialog *
e_dialog_normal_win_new(E_Container *con, const char *name, const char *class)
{
return _e_dialog_internal_new(con, name, class, EINA_FALSE);
}
EAPI void
e_dialog_button_add(E_Dialog *dia, const char *label, const char *icon, void (*func) (void *data, E_Dialog *dia), void *data)
{
E_OBJECT_CHECK(dia);
E_OBJECT_TYPE_CHECK(dia, E_DIALOG_TYPE);
/* Evas_Object *o; */
/* if (!func) func = _e_dialog_cb_delete; */
/* TODO: e_widgets */
}
EAPI int
e_dialog_button_focus_num(E_Dialog *dia, int button)
{
E_OBJECT_CHECK(dia);
E_OBJECT_TYPE_CHECK(dia, E_DIALOG_TYPE);
return 0;
}
EAPI int
e_dialog_button_disable_num_set(E_Dialog *dia, int button, int disabled)
{
E_OBJECT_CHECK(dia);
E_OBJECT_TYPE_CHECK(dia, E_DIALOG_TYPE);
return 0;
}
EAPI int
e_dialog_button_disable_num_get(E_Dialog *dia, int button)
{
E_OBJECT_CHECK(dia);
E_OBJECT_TYPE_CHECK(dia, E_DIALOG_TYPE);
return 0;
}
EAPI void
e_dialog_title_set(E_Dialog *dia, const char *title)
{
E_OBJECT_CHECK(dia);
E_OBJECT_TYPE_CHECK(dia, E_DIALOG_TYPE);
e_win_title_set(dia->win, title);
}
EAPI void
e_dialog_text_set(E_Dialog *dia, const char *text)
{
E_OBJECT_CHECK(dia);
E_OBJECT_TYPE_CHECK(dia, E_DIALOG_TYPE);
if (!dia->o_text)
{
dia->o_text = edje_object_add(dia->win->evas);
e_theme_edje_object_set(dia->o_text, "base/theme/dialog",
"e/widgets/dialog/text");
edje_object_part_swallow(dia->o_bg, "e.swallow.content", dia->o_text);
evas_object_show(dia->o_text);
}
edje_object_part_text_set(dia->o_text, "e.textblock.message", text);
}
EAPI void
e_dialog_icon_set(E_Dialog *dia, const char *icon, Evas_Coord size)
{
E_OBJECT_CHECK(dia);
E_OBJECT_TYPE_CHECK(dia, E_DIALOG_TYPE);
/* TODO: e_icon */
}
EAPI void
e_dialog_border_icon_set(E_Dialog *dia, const char *icon)
{
E_OBJECT_CHECK(dia);
E_OBJECT_TYPE_CHECK(dia, E_DIALOG_TYPE);
}
EAPI void
e_dialog_content_set(E_Dialog *dia, Evas_Object *obj, Evas_Coord minw, Evas_Coord minh)
{
E_OBJECT_CHECK(dia);
E_OBJECT_TYPE_CHECK(dia, E_DIALOG_TYPE);
dia->o_content = obj;
/* TODO: e_widget on focus_hook */
edje_extern_object_min_size_set(obj, minw, minh);
edje_object_part_swallow(dia->o_bg, "e.swallow.content", obj);
evas_object_show(obj);
}
EAPI void
e_dialog_resizable_set(E_Dialog *dia, int resizable)
{
E_OBJECT_CHECK(dia);
E_OBJECT_TYPE_CHECK(dia, E_DIALOG_TYPE);
dia->resizable = resizable;
if (dia->win)
{
/* TODO: Finish */
/* if (resizable) */
/* { */
/* } */
/* else */
/* { */
/* } */
}
}
EAPI void
e_dialog_show(E_Dialog *dia)
{
Evas_Coord mw, mh;
E_OBJECT_CHECK(dia);
E_OBJECT_TYPE_CHECK(dia, E_DIALOG_TYPE);
if (dia->o_text)
{
edje_object_size_min_calc(dia->o_text, &mw, &mh);
edje_extern_object_min_size_set(dia->o_text, mw, mh);
edje_object_part_swallow(dia->o_bg, "e.swallow.content", dia->o_text);
}
/* TODO: e_widget_size_min_get */
e_win_show(dia->win);
}
/* local functions */
static E_Dialog *
_e_dialog_internal_new(E_Container *con, const char *name, const char *class, Eina_Bool dialog)
{
E_Dialog *dia;
if (!con)
{
E_Manager *man;
if (!(man = e_manager_current_get())) return NULL;
if (!(con = e_container_current_get(man)))
con = e_container_number_get(man, 0);
if (!con) return NULL;
}
dia = E_OBJECT_ALLOC(E_Dialog, E_DIALOG_TYPE, _e_dialog_cb_free);
if (!dia) return NULL;
if (!(dia->win = e_win_new(con)))
{
free(dia);
return NULL;
}
/* TODO: e_win callbacks */
dia->win->data = dia;
e_win_dialog_set(dia->win, dialog);
e_win_name_class_set(dia->win, name, class);
dia->o_bg = edje_object_add(dia->win->evas);
e_theme_edje_object_set(dia->o_bg, "base/theme/dialog",
"e/widgets/dialog/main");
evas_object_move(dia->o_bg, 0, 0);
evas_object_show(dia->o_bg);
/* TODO: box object & event object */
return dia;
}
static void
_e_dialog_cb_free(E_Dialog *dia)
{
if (dia->buttons)
{
E_FREE_LIST(dia->buttons, evas_object_del);
/* Eina_List *l; */
/* Evas_Object *o; */
/* EINA_LIST_FOREACH(dia->buttons, l, o) */
/* evas_object_del(o); */
/* eina_list_free(dia->buttons); */
}
if (dia->o_text) evas_object_del(dia->o_text);
if (dia->o_icon) evas_object_del(dia->o_icon);
if (dia->o_box) evas_object_del(dia->o_box);
if (dia->o_bg) evas_object_del(dia->o_bg);
if (dia->o_content) evas_object_del(dia->o_content);
if (dia->o_event) evas_object_del(dia->o_event);
e_object_del(E_OBJECT(dia->win));
free(dia);
}

View File

@ -0,0 +1,40 @@
#ifdef E_TYPEDEFS
typedef struct _E_Dialog E_Dialog;
#else
# ifndef E_DIALOG_H
# define E_DIALOG_H
# define E_DIALOG_TYPE 0xE0b01012
struct _E_Dialog
{
E_Object e_obj_inherit;
E_Win *win;
Evas_Object *o_bg, *o_box;
Evas_Object *o_text, *o_content;
Evas_Object *o_icon, *o_event;
Eina_List *buttons;
void *data;
int min_w, min_h;
Eina_Bool resizable : 1;
};
EAPI E_Dialog *e_dialog_new(E_Container *con, const char *name, const char *class);
EAPI E_Dialog *e_dialog_normal_win_new(E_Container *con, const char *name, const char *class);
EAPI void e_dialog_button_add(E_Dialog *dia, const char *label, const char *icon, void (*func) (void *data, E_Dialog *dia), void *data);
EAPI int e_dialog_button_focus_num(E_Dialog *dia, int button);
EAPI int e_dialog_button_disable_num_set(E_Dialog *dia, int button, int disabled);
EAPI int e_dialog_button_disable_num_get(E_Dialog *dia, int button);
EAPI void e_dialog_title_set(E_Dialog *dia, const char *title);
EAPI void e_dialog_text_set(E_Dialog *dia, const char *text);
EAPI void e_dialog_icon_set(E_Dialog *dia, const char *icon, Evas_Coord size);
EAPI void e_dialog_border_icon_set(E_Dialog *dia, const char *icon);
EAPI void e_dialog_content_set(E_Dialog *dia, Evas_Object *obj, Evas_Coord minw, Evas_Coord minh);
EAPI void e_dialog_resizable_set(E_Dialog *dia, int resizable);
EAPI void e_dialog_show(E_Dialog *dia);
# endif
#endif

View File

@ -0,0 +1,64 @@
#include "e.h"
#define MAX_OUTPUT_CHARACTERS 5000
/* externally accessible functions */
EINTERN int
e_exec_init(void)
{
return 1;
}
EINTERN int
e_exec_shutdown(void)
{
return 1;
}
EAPI void
e_exec_executor_set(E_Exec_Instance *(*func)(void *data, E_Zone * zone, Efreet_Desktop * desktop, const char *exec, Eina_List *files, const char *launch_method), const void *data)
{
}
EAPI E_Exec_Instance *
e_exec(E_Zone *zone, Efreet_Desktop *desktop, const char *exec, Eina_List *files, const char *launch_method)
{
return NULL;
}
EAPI E_Exec_Instance *
e_exec_startup_id_pid_instance_find(int id, pid_t pid)
{
return NULL;
}
EAPI Efreet_Desktop *
e_exec_startup_id_pid_find(int id, pid_t pid)
{
return NULL;
}
EAPI E_Exec_Instance *
e_exec_startup_desktop_instance_find(Efreet_Desktop *desktop)
{
return NULL;
}
EAPI void
e_exec_instance_found(E_Exec_Instance *inst)
{
}
EAPI void
e_exec_instance_watcher_add(E_Exec_Instance *inst, void (*func)(void *data, E_Exec_Instance *inst, E_Exec_Watch_Type type), const void *data)
{
}
EAPI void
e_exec_instance_watcher_del(E_Exec_Instance *inst, void (*func)(void *data, E_Exec_Instance *inst, E_Exec_Watch_Type type), const void *data)
{
}

View File

@ -0,0 +1,43 @@
#ifdef E_TYPEDEFS
typedef struct _E_Exec_Instance E_Exec_Instance;
#else
#ifndef E_EXEC_H
#define E_EXEC_H
struct _E_Exec_Instance
{
Efreet_Desktop *desktop;
const char *key;
Ecore_Exe *exe;
int startup_id;
double launch_time;
Ecore_Timer *expire_timer;
int screen;
int desk_x, desk_y;
int used;
int walking;
Eina_List *watchers;
};
typedef enum
{
E_EXEC_WATCH_STARTED,
E_EXEC_WATCH_STOPPED,
E_EXEC_WATCH_TIMEOUT
} E_Exec_Watch_Type;
EINTERN int e_exec_init(void);
EINTERN int e_exec_shutdown(void);
EAPI void e_exec_executor_set(E_Exec_Instance *(*func) (void *data, E_Zone *zone, Efreet_Desktop *desktop, const char *exec, Eina_List *files, const char *launch_method), const void *data);
EAPI E_Exec_Instance *e_exec(E_Zone *zone, Efreet_Desktop *desktop, const char *exec, Eina_List *files, const char *launch_method);
EAPI E_Exec_Instance *e_exec_startup_id_pid_instance_find(int id, pid_t pid);
EAPI Efreet_Desktop *e_exec_startup_id_pid_find(int startup_id, pid_t pid);
EAPI E_Exec_Instance *e_exec_startup_desktop_instance_find(Efreet_Desktop *desktop);
EAPI void e_exec_instance_found(E_Exec_Instance *inst);
EAPI void e_exec_instance_watcher_add(E_Exec_Instance *inst, void (*func) (void *data, E_Exec_Instance *inst, E_Exec_Watch_Type type), const void *data);
EAPI void e_exec_instance_watcher_del(E_Exec_Instance *inst, void (*func) (void *data, E_Exec_Instance *inst, E_Exec_Watch_Type type), const void *data);
#endif
#endif

View File

@ -0,0 +1,539 @@
#include "e.h"
#include <libgen.h>
EAPI int E_EVENT_EXEHIST_UPDATE = 0;
/* local subsystem functions */
typedef struct _E_Exehist E_Exehist;
typedef struct _E_Exehist_Item E_Exehist_Item;
struct _E_Exehist
{
Eina_List *history;
Eina_List *mimes;
};
struct _E_Exehist_Item
{
const char *exe;
const char *normalized_exe;
const char *launch_method;
double exetime;
unsigned int count;
};
static void _e_exehist_unload_queue(void);
static void _e_exehist_load(void);
static void _e_exehist_clear(void);
static void _e_exehist_unload(void);
static void _e_exehist_limit(void);
static const char *_e_exehist_normalize_exe(const char *exe);
static void _e_exehist_cb_unload(void *data);
static int _e_exehist_sort_exe_cb(const void *d1, const void *d2);
static int _e_exehist_sort_pop_cb(const void *d1, const void *d2);
/* local subsystem globals */
static E_Config_DD *_e_exehist_config_edd = NULL;
static E_Config_DD *_e_exehist_config_item_edd = NULL;
static E_Exehist *_e_exehist = NULL;
static E_Powersave_Deferred_Action *_e_exehist_unload_defer = NULL;
static int _e_exehist_changes = 0;
/* externally accessible functions */
EINTERN int
e_exehist_init(void)
{
_e_exehist_config_item_edd = E_CONFIG_DD_NEW("E_Exehist_Item", E_Exehist_Item);
#undef T
#undef D
#define T E_Exehist_Item
#define D _e_exehist_config_item_edd
E_CONFIG_VAL(D, T, exe, STR);
E_CONFIG_VAL(D, T, normalized_exe, STR);
E_CONFIG_VAL(D, T, launch_method, STR);
E_CONFIG_VAL(D, T, exetime, DOUBLE);
_e_exehist_config_edd = E_CONFIG_DD_NEW("E_Exehist", E_Exehist);
#undef T
#undef D
#define T E_Exehist
#define D _e_exehist_config_edd
E_CONFIG_LIST(D, T, history, _e_exehist_config_item_edd);
E_CONFIG_LIST(D, T, mimes, _e_exehist_config_item_edd);
E_EVENT_EXEHIST_UPDATE = ecore_event_type_new();
return 1;
}
EINTERN int
e_exehist_shutdown(void)
{
if (_e_exehist_unload_defer)
{
e_powersave_deferred_action_del(_e_exehist_unload_defer);
_e_exehist_unload_defer = NULL;
}
_e_exehist_cb_unload(NULL);
E_CONFIG_DD_FREE(_e_exehist_config_item_edd);
E_CONFIG_DD_FREE(_e_exehist_config_edd);
return 1;
}
EAPI void
e_exehist_add(const char *launch_method, const char *exe)
{
E_Exehist_Item *ei;
_e_exehist_load();
if (!_e_exehist) return;
ei = E_NEW(E_Exehist_Item, 1);
if (!ei)
{
_e_exehist_unload_queue();
return;
}
ei->launch_method = eina_stringshare_add(launch_method);
ei->exe = eina_stringshare_add(exe);
ei->normalized_exe = _e_exehist_normalize_exe(exe);
ei->exetime = ecore_time_unix_get();
_e_exehist->history = eina_list_append(_e_exehist->history, ei);
_e_exehist_limit();
_e_exehist_changes++;
ecore_event_add(E_EVENT_EXEHIST_UPDATE, NULL, NULL, NULL);
_e_exehist_unload_queue();
}
EAPI void
e_exehist_del(const char *exe)
{
E_Exehist_Item *ei;
Eina_List *l;
Eina_Bool ok = EINA_FALSE;
_e_exehist_load();
if (!_e_exehist) return;
EINA_LIST_FOREACH(_e_exehist->history, l, ei)
{
if ((ei->exe) && (!strcmp(exe, ei->exe)))
{
eina_stringshare_del(ei->exe);
eina_stringshare_del(ei->normalized_exe);
eina_stringshare_del(ei->launch_method);
free(ei);
_e_exehist->history = eina_list_remove_list(_e_exehist->history,
l);
_e_exehist_changes++;
_e_exehist_unload_queue();
ok = EINA_TRUE;
}
}
if (ok)
ecore_event_add(E_EVENT_EXEHIST_UPDATE, NULL, NULL, NULL);
}
EAPI void
e_exehist_clear(void)
{
_e_exehist_load();
if (!_e_exehist) return;
_e_exehist_clear();
_e_exehist_changes++;
ecore_event_add(E_EVENT_EXEHIST_UPDATE, NULL, NULL, NULL);
_e_exehist_unload_queue();
}
EAPI int
e_exehist_popularity_get(const char *exe)
{
Eina_List *l;
E_Exehist_Item *ei;
const char *normal;
int count = 0;
_e_exehist_load();
if (!_e_exehist) return 0;
normal = _e_exehist_normalize_exe(exe);
if (!normal) return 0;
EINA_LIST_FOREACH(_e_exehist->history, l, ei)
{
if ((ei->normalized_exe) && (!strcmp(normal, ei->normalized_exe)))
count++;
}
eina_stringshare_del(normal);
_e_exehist_unload_queue();
return count;
}
EAPI double
e_exehist_newest_run_get(const char *exe)
{
Eina_List *l;
E_Exehist_Item *ei;
const char *normal;
_e_exehist_load();
if (!_e_exehist) return 0.0;
normal = _e_exehist_normalize_exe(exe);
if (!normal) return 0.0;
EINA_LIST_REVERSE_FOREACH(_e_exehist->history, l, ei)
{
if ((ei->normalized_exe) && (!strcmp(normal, ei->normalized_exe)))
{
eina_stringshare_del(normal);
_e_exehist_unload_queue();
return ei->exetime;
}
}
eina_stringshare_del(normal);
_e_exehist_unload_queue();
return 0.0;
}
EAPI Eina_List *
e_exehist_list_get(void)
{
return e_exehist_sorted_list_get(E_EXEHIST_SORT_BY_DATE, 0);
}
EAPI Eina_List *
e_exehist_sorted_list_get(E_Exehist_Sort sort_type, int max)
{
Eina_List *list = NULL, *pop = NULL, *l = NULL, *m;
Eina_Iterator *iter;
E_Exehist_Item *ei;
int count = 1;
E_Exehist_Item *prev = NULL;
if (!max) max = 20;
_e_exehist_load();
switch (sort_type)
{
case E_EXEHIST_SORT_BY_EXE:
case E_EXEHIST_SORT_BY_POPULARITY:
l = eina_list_clone(_e_exehist->history);
l = eina_list_sort(l, 0, _e_exehist_sort_exe_cb);
iter = eina_list_iterator_new(l);
break;
default:
iter = eina_list_iterator_reversed_new(_e_exehist->history);
break;
}
EINA_ITERATOR_FOREACH(iter, ei)
{
int bad = 0;
if (!(ei->normalized_exe)) continue;
if (sort_type == E_EXEHIST_SORT_BY_POPULARITY)
{
if (!prev || (strcmp(prev->normalized_exe, ei->normalized_exe)))
{
prev = ei;
pop = eina_list_append(pop, ei);
}
prev->count++;
}
else
{
const char *exe;
EINA_LIST_FOREACH(list, m, exe)
{
if (!exe) continue;
if (!strcmp(exe, ei->exe))
{
bad = 1;
break;
}
}
if (!(bad))
{
list = eina_list_append(list, ei->exe);
count++;
}
}
if (count > max) break;
}
if (sort_type == E_EXEHIST_SORT_BY_POPULARITY)
{
count = 1;
pop = eina_list_sort(pop, 0, _e_exehist_sort_pop_cb);
EINA_LIST_FOREACH(pop, l, prev)
{
list = eina_list_append(list, prev->exe);
count++;
if (count > max) break;
}
eina_list_free(pop);
}
eina_list_free(l);
eina_iterator_free(iter);
_e_exehist_unload_queue();
return list;
}
EAPI void
e_exehist_mime_desktop_add(const char *mime, Efreet_Desktop *desktop)
{
const char *f;
E_Exehist_Item *ei;
Eina_List *l;
char buf[PATH_MAX];
Efreet_Ini *ini;
if ((!mime) || (!desktop)) return;
if (!desktop->orig_path) return;
_e_exehist_load();
if (!_e_exehist) return;
f = efreet_util_path_to_file_id(desktop->orig_path);
if (!f) return;
snprintf(buf, sizeof(buf), "%s/applications/defaults.list",
efreet_data_home_get());
ini = efreet_ini_new(buf);
//fprintf(stderr, "try open %s = %p\n", buf, ini);
if (ini)
{
//fprintf(stderr, "SAVE mime %s with %s\n", mime, desktop->orig_path);
if (!efreet_ini_section_set(ini, "Default Applications"))
{
efreet_ini_section_add(ini, "Default Applications");
efreet_ini_section_set(ini, "Default Applications");
}
if (desktop->orig_path)
efreet_ini_string_set(ini, mime, ecore_file_file_get(desktop->orig_path));
efreet_ini_save(ini, buf);
efreet_ini_free(ini);
}
EINA_LIST_FOREACH(_e_exehist->mimes, l, ei)
{
if ((ei->launch_method) && (!strcmp(mime, ei->launch_method)))
{
if ((ei->exe) && (!strcmp(f, ei->exe)))
{
_e_exehist_unload_queue();
return;
}
if (ei->exe) eina_stringshare_del(ei->exe);
if (ei->launch_method) eina_stringshare_del(ei->launch_method);
free(ei);
_e_exehist->mimes = eina_list_remove_list(_e_exehist->mimes, l);
_e_exehist_changes++;
break;
}
}
ei = E_NEW(E_Exehist_Item, 1);
if (!ei)
{
_e_exehist_unload_queue();
return;
}
ei->launch_method = eina_stringshare_add(mime);
ei->exe = eina_stringshare_add(f);
ei->exetime = ecore_time_unix_get();
_e_exehist->mimes = eina_list_append(_e_exehist->mimes, ei);
_e_exehist_limit();
_e_exehist_changes++;
_e_exehist_unload_queue();
}
EAPI Efreet_Desktop *
e_exehist_mime_desktop_get(const char *mime)
{
Efreet_Desktop *desktop;
E_Exehist_Item *ei;
Eina_List *l;
//fprintf(stderr, "e_exehist_mime_desktop_get(%s)\n", mime);
if (!mime) return NULL;
_e_exehist_load();
//fprintf(stderr, "x\n");
if (!_e_exehist) return NULL;
EINA_LIST_FOREACH(_e_exehist->mimes, l, ei)
{
//fprintf(stderr, "look for %s == %s\n", mime, ei->launch_method);
if ((ei->launch_method) && (!strcmp(mime, ei->launch_method)))
{
desktop = NULL;
if (ei->exe) desktop = efreet_util_desktop_file_id_find(ei->exe);
//fprintf(stderr, " desk = %p\n", desktop);
if (desktop)
{
_e_exehist_unload_queue();
return desktop;
}
}
}
_e_exehist_unload_queue();
return NULL;
}
/* local subsystem functions */
static void
_e_exehist_unload_queue(void)
{
if (_e_exehist_unload_defer)
e_powersave_deferred_action_del(_e_exehist_unload_defer);
_e_exehist_unload_defer =
e_powersave_deferred_action_add(_e_exehist_cb_unload, NULL);
}
static void
_e_exehist_load(void)
{
if (!_e_exehist)
_e_exehist = e_config_domain_load("exehist", _e_exehist_config_edd);
if (!_e_exehist)
_e_exehist = E_NEW(E_Exehist, 1);
}
static void
_e_exehist_clear(void)
{
if (_e_exehist)
{
E_Exehist_Item *ei;
EINA_LIST_FREE(_e_exehist->history, ei)
{
eina_stringshare_del(ei->exe);
eina_stringshare_del(ei->normalized_exe);
eina_stringshare_del(ei->launch_method);
free(ei);
}
EINA_LIST_FREE(_e_exehist->mimes, ei)
{
eina_stringshare_del(ei->exe);
eina_stringshare_del(ei->launch_method);
free(ei);
}
}
}
static void
_e_exehist_unload(void)
{
_e_exehist_clear();
E_FREE(_e_exehist);
}
static void
_e_exehist_limit(void)
{
/* go from first item in hist on and either delete all items before a
* specific timestamp, or if the list count > limit then delete items
*
* for now - limit to 500
*/
if (_e_exehist)
{
while (eina_list_count(_e_exehist->history) > 500)
{
E_Exehist_Item *ei;
ei = eina_list_data_get(_e_exehist->history);
eina_stringshare_del(ei->exe);
eina_stringshare_del(ei->normalized_exe);
eina_stringshare_del(ei->launch_method);
free(ei);
_e_exehist->history = eina_list_remove_list(_e_exehist->history, _e_exehist->history);
}
while (eina_list_count(_e_exehist->mimes) > 500)
{
E_Exehist_Item *ei;
ei = eina_list_data_get(_e_exehist->mimes);
eina_stringshare_del(ei->exe);
eina_stringshare_del(ei->launch_method);
free(ei);
_e_exehist->mimes = eina_list_remove_list(_e_exehist->mimes, _e_exehist->mimes);
}
}
}
static const char *
_e_exehist_normalize_exe(const char *exe)
{
char *base, *buf, *cp, *space = NULL;
const char *ret;
Eina_Bool flag = EINA_FALSE;
buf = strdup(exe);
base = basename(buf);
if ((base[0] == '.') && (base[1] == '\0'))
{
free(buf);
return NULL;
}
cp = base;
while (*cp)
{
if (isspace(*cp))
{
if (!space) space = cp;
if (flag) flag = EINA_FALSE;
}
else if (!flag)
{
/* usually a variable in the desktop exe field */
if (space && *cp == '%')
flag = EINA_TRUE;
else
{
char lower = tolower(*cp);
space = NULL;
if (lower != *cp) *cp = lower;
}
}
cp++;
}
if (space) *space = '\0';
ret = eina_stringshare_add(base);
free(buf);
return ret;
}
static void
_e_exehist_cb_unload(void *data __UNUSED__)
{
if (_e_exehist_changes)
{
e_config_domain_save("exehist", _e_exehist_config_edd, _e_exehist);
_e_exehist_changes = 0;
}
_e_exehist_unload();
_e_exehist_unload_defer = NULL;
}
static int
_e_exehist_sort_exe_cb(const void *d1, const void *d2)
{
const E_Exehist_Item *ei1, *ei2;
ei1 = d1;
ei2 = d2;
if ((!ei1) || (!ei1->normalized_exe)) return 1;
if ((!ei2) || (!ei2->normalized_exe)) return -1;
return strcmp(ei1->normalized_exe, ei2->normalized_exe);
}
static int
_e_exehist_sort_pop_cb(const void *d1, const void *d2)
{
const E_Exehist_Item *ei1, *ei2;
if (!(ei1 = d1)) return 1;
if (!(ei2 = d2)) return -1;
return ei2->count - ei1->count;
}

View File

@ -0,0 +1,30 @@
#ifdef E_TYPEDEFS
#else
#ifndef E_EXEHIST_H
#define E_EXEHIST_H
typedef enum _E_Exehist_Sort
{
E_EXEHIST_SORT_BY_DATE,
E_EXEHIST_SORT_BY_EXE,
E_EXEHIST_SORT_BY_POPULARITY
} E_Exehist_Sort;
EINTERN int e_exehist_init(void);
EINTERN int e_exehist_shutdown(void);
EAPI void e_exehist_add(const char *launch_method, const char *exe);
EAPI void e_exehist_del(const char *exe);
EAPI void e_exehist_clear(void);
EAPI int e_exehist_popularity_get(const char *exe);
EAPI double e_exehist_newest_run_get(const char *exe);
EAPI Eina_List *e_exehist_list_get(void);
EAPI Eina_List *e_exehist_sorted_list_get(E_Exehist_Sort sort_type, int max);
EAPI void e_exehist_mime_desktop_add(const char *mime, Efreet_Desktop *desktop);
EAPI Efreet_Desktop *e_exehist_mime_desktop_get(const char *mime);
extern EAPI int E_EVENT_EXEHIST_UPDATE;
#endif
#endif

5140
src/bin/e_wayland/e_gadcon.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,343 @@
#ifdef E_TYPEDEFS
#define E_GADCON_CLIENT(x) ((E_Gadcon_Client *)(x))
/* different layout policies - only 1 supported for now */
typedef enum _E_Gadcon_Layout_Policy
{
E_GADCON_LAYOUT_POLICY_PANEL
} E_Gadcon_Layout_Policy;
typedef enum _E_Gadcon_Orient
{
/* generic orientations */
E_GADCON_ORIENT_FLOAT,
E_GADCON_ORIENT_HORIZ,
E_GADCON_ORIENT_VERT,
E_GADCON_ORIENT_LEFT,
E_GADCON_ORIENT_RIGHT,
E_GADCON_ORIENT_TOP,
E_GADCON_ORIENT_BOTTOM,
E_GADCON_ORIENT_CORNER_TL,
E_GADCON_ORIENT_CORNER_TR,
E_GADCON_ORIENT_CORNER_BL,
E_GADCON_ORIENT_CORNER_BR,
E_GADCON_ORIENT_CORNER_LT,
E_GADCON_ORIENT_CORNER_RT,
E_GADCON_ORIENT_CORNER_LB,
E_GADCON_ORIENT_CORNER_RB
} E_Gadcon_Orient;
typedef enum _E_Gadcon_Site
{
E_GADCON_SITE_UNKNOWN = 0, // when target site is unknown
/* generic sities */
E_GADCON_SITE_SHELF,
E_GADCON_SITE_DESKTOP,
E_GADCON_SITE_TOOLBAR, // generic toolbar
E_GADCON_SITE_EFM_TOOLBAR // filemanager window toolbar
} E_Gadcon_Site;
#define E_GADCON_CLIENT_STYLE_PLAIN "plain"
#define E_GADCON_CLIENT_STYLE_INSET "inset"
typedef struct _E_Gadcon E_Gadcon;
typedef struct _E_Gadcon_Client E_Gadcon_Client;
typedef struct _E_Gadcon_Client_Class E_Gadcon_Client_Class;
typedef struct _E_Gadcon_Location E_Gadcon_Location;
#else
#ifndef E_GADCON_H
#define E_GADCON_H
#define E_GADCON_TYPE 0xE0b01006
#define E_GADCON_CLIENT_TYPE 0xE0b01007
struct _E_Gadcon
{
E_Object e_obj_inherit;
const char *name;
int id;
E_Gadcon_Layout_Policy layout_policy;
struct
{
Evas_Object *o_parent;
const char *swallow_name;
} edje;
Ecore_Evas *ecore_evas;
E_Zone *zone;
E_Gadcon_Orient orient;
Evas *evas;
Evas_Object *o_container;
Eina_List *clients;
struct
{
void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
void *data;
} resize_request, min_size_request;
struct
{
Evas_Object *(*func) (void *data, E_Gadcon_Client *gcc, const char *style);
void *data;
} frame_request;
struct
{
void (*func) (void *data, E_Gadcon_Client *gcc, E_Menu *menu);
void *data;
} menu_attach;
struct
{
void (*func) (void *data, E_Gadcon *gc, const E_Gadcon_Client_Class *cc);
void *data;
} populate_class;
struct
{
void (*func) (void *data, int lock);
void *data;
} locked_set;
struct
{
void (*func) (void *data);
void *data;
} urgent_show;
E_Config_Dialog *config_dialog;
unsigned char editing : 1;
// Ecore_X_Window dnd_win, xdnd_win;
E_Shelf *shelf;
// E_Toolbar *toolbar;
E_Gadcon_Location *location;
// E_Drop_Handler *drop_handler;
E_Config_Gadcon *cf;
unsigned char instant_edit : 1;
};
#define GADCON_CLIENT_CLASS_VERSION 3
/* Version 3 add the *client_class param to icon(),label(),id_new(), id_del() */
/* and the *orient param to orient() */
struct _E_Gadcon_Client_Class
{
int version;
/* All members below are part of version 1 */
const char *name;
struct
{
E_Gadcon_Client *(*init) (E_Gadcon *gc, const char *name, const char *id, const char *style);
void (*shutdown) (E_Gadcon_Client *gcc);
void (*orient) (E_Gadcon_Client *gcc, E_Gadcon_Orient orient);
const char *(*label) (E_Gadcon_Client_Class *client_class);
Evas_Object *(*icon) (E_Gadcon_Client_Class *client_class, Evas *evas);
/* All members below are part of version 2 */
/* Create new id, so that the gadcon client can refer to a config set inside the module */
const char *(*id_new) (E_Gadcon_Client_Class *client_class);
/* Del an id when a gadcon client is removed from the system */
void (*id_del) (E_Gadcon_Client_Class *client_class, const char *id);
/* All members below are part of version 3 */
Eina_Bool (*is_site) (E_Gadcon_Site site);
} func;
char *default_style;
};
struct _E_Gadcon_Client
{
E_Object e_obj_inherit;
E_Gadcon *gadcon;
const char *name;
int id;
Evas_Object *o_base;
Evas_Object *o_box;
Evas_Object *o_frame;
Evas_Object *o_control;
Evas_Object *o_event;
const E_Gadcon_Client_Class *client_class;
void *data;
struct
{
int pos, size, res; //gadcon
double pos_x, pos_y, size_w, size_h; //gadman
} config;
struct
{
int seq, flags; /* goes to save */
int state, resist;
int prev_pos, prev_size;
int want_save : 1;
} state_info;
struct
{
Evas_Coord w, h;
} pad, min, aspect;
Ecore_Timer *scroll_timer;
Ecore_Timer *instant_edit_timer;
Ecore_Animator *scroll_animator;
double scroll_pos, scroll_wanted;
struct
{
void *data;
void (*func) (void *data);
} scroll_cb;
E_Menu *menu;
const char *style;
unsigned char autoscroll : 1;
unsigned char resizable : 1;
unsigned char moving : 1;
unsigned char resizing : 1;
unsigned char autoscroll_set : 1;
Evas_Coord dx, dy;
struct
{
int x, y;
} drag;
unsigned char hidden : 1;
E_Config_Gadcon_Client *cf;
};
/* defines usable gadget placements such as Desktop, Shelf #, etc */
/* next fields are mandatory (not NULL): name, add_gadget.func, remove_gadget.func */
struct _E_Gadcon_Location
{
/* location name */
const char * name;
/* icon related to location, such as "preferences-desktop-shelf" for shelves, "preferences-desktop" for menus */
const char * icon_name;
E_Gadcon_Site site;
/* adds gadcon client to location. Returns nonzero on success */
struct
{
int (*func) (void *data, const E_Gadcon_Client_Class *cc);
void *data;
} gadget_add;
/* removes existing gadcon client from location */
struct
{
void (*func) (void *data, E_Gadcon_Client *gcc);
void *data;
} gadget_remove;
};
EINTERN int e_gadcon_init(void);
EINTERN int e_gadcon_shutdown(void);
EAPI void e_gadcon_provider_register(const E_Gadcon_Client_Class *cc);
EAPI void e_gadcon_provider_unregister(const E_Gadcon_Client_Class *cc);
EAPI Eina_List *e_gadcon_provider_list(void);
EAPI E_Gadcon *e_gadcon_swallowed_new(const char *name, int id, Evas_Object *obj, const char *swallow_name);
EAPI void e_gadcon_custom_new(E_Gadcon *gc);
EAPI void e_gadcon_custom_del(E_Gadcon *gc);
EAPI void e_gadcon_swallowed_min_size_set(E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
EAPI void e_gadcon_min_size_request_callback_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data);
EAPI void e_gadcon_size_request_callback_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data);
EAPI void e_gadcon_frame_request_callback_set(E_Gadcon *gc, Evas_Object *(*func) (void *data, E_Gadcon_Client *gcc, const char *style), void *data);
EAPI void e_gadcon_populate_callback_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon *gc, const E_Gadcon_Client_Class *cc), void *data);
EAPI void e_gadcon_layout_policy_set(E_Gadcon *gc, E_Gadcon_Layout_Policy layout_policy);
EAPI void e_gadcon_populate(E_Gadcon *gc);
EAPI void e_gadcon_unpopulate(E_Gadcon *gc);
EAPI void e_gadcon_populate_class(E_Gadcon *gc, const E_Gadcon_Client_Class *cc);
EAPI void e_gadcon_orient(E_Gadcon *gc, E_Gadcon_Orient orient);
EAPI void e_gadcon_edit_begin(E_Gadcon *gc);
EAPI void e_gadcon_edit_end(E_Gadcon *gc);
EAPI void e_gadcon_all_edit_begin(void);
EAPI void e_gadcon_all_edit_end(void);
EAPI void e_gadcon_zone_set(E_Gadcon *gc, E_Zone *zone);
EAPI E_Zone *e_gadcon_zone_get(E_Gadcon *gc);
EAPI void e_gadcon_ecore_evas_set(E_Gadcon *gc, Ecore_Evas *ee);
EAPI int e_gadcon_canvas_zone_geometry_get(E_Gadcon *gc, int *x, int *y, int *w, int *h);
EAPI void e_gadcon_util_menu_attach_func_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon_Client *gcc, E_Menu *menu), void *data);
EAPI void e_gadcon_util_lock_func_set(E_Gadcon *gc, void (*func) (void *data, int lock), void *data);
EAPI void e_gadcon_util_urgent_show_func_set(E_Gadcon *gc, void (*func) (void *data), void *data);
EAPI void e_gadcon_dnd_window_set(E_Gadcon *gc, Ecore_X_Window win);
EAPI Ecore_X_Window e_gadcon_dnd_window_get(E_Gadcon *gc);
EAPI void e_gadcon_xdnd_window_set(E_Gadcon *gc, Ecore_X_Window win);
EAPI Ecore_X_Window e_gadcon_xdnd_window_get(E_Gadcon *gc);
EAPI void e_gadcon_shelf_set(E_Gadcon *gc, E_Shelf *shelf);
EAPI E_Shelf *e_gadcon_shelf_get(E_Gadcon *gc);
/* EAPI void e_gadcon_toolbar_set(E_Gadcon *gc, E_Toolbar *toolbar); */
/* EAPI E_Toolbar *e_gadcon_toolbar_get(E_Gadcon *gc); */
EAPI E_Config_Gadcon_Client *e_gadcon_client_config_new(E_Gadcon *gc, const char *name);
EAPI void e_gadcon_client_config_del(E_Config_Gadcon *cf_gc, E_Config_Gadcon_Client *cf_gcc);
EAPI E_Gadcon_Client *e_gadcon_client_new(E_Gadcon *gc, const char *name, const char *id, const char *style, Evas_Object *base_obj);
EAPI void e_gadcon_client_edit_begin(E_Gadcon_Client *gcc);
EAPI void e_gadcon_client_edit_end(E_Gadcon_Client *gcc);
EAPI void e_gadcon_client_show(E_Gadcon_Client *gcc);
EAPI void e_gadcon_client_hide(E_Gadcon_Client *gcc);
EAPI void e_gadcon_client_size_request(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h);
EAPI void e_gadcon_client_min_size_set(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h);
EAPI void e_gadcon_client_aspect_set(E_Gadcon_Client *gcc, int w, int h);
EAPI void e_gadcon_client_autoscroll_set(E_Gadcon_Client *gcc, int autoscroll);
EAPI void e_gadcon_client_autoscroll_update(E_Gadcon_Client *gcc, int mx, int my);
EAPI void e_gadcon_client_autoscroll_cb_set(E_Gadcon_Client *gcc, void (*func)(void *data), void *data);
EAPI void e_gadcon_client_resizable_set(E_Gadcon_Client *gcc, int resizable);
EAPI int e_gadcon_client_geometry_get(E_Gadcon_Client *gcc, int *x, int *y, int *w, int *h);
EAPI int e_gadcon_client_viewport_geometry_get(E_Gadcon_Client *gcc, int *x, int *y, int *w, int *h);
EAPI E_Zone *e_gadcon_client_zone_get(E_Gadcon_Client *gcc);
EAPI E_Menu *e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu_gadget, int flags);
EAPI void e_gadcon_client_util_menu_attach(E_Gadcon_Client *gcc);
EAPI void e_gadcon_locked_set(E_Gadcon *gc, int lock);
EAPI void e_gadcon_urgent_show(E_Gadcon *gc);
/* site helpers */
EAPI Eina_Bool e_gadcon_site_is_shelf(E_Gadcon_Site site);
EAPI Eina_Bool e_gadcon_site_is_desktop(E_Gadcon_Site site);
EAPI Eina_Bool e_gadcon_site_is_efm_toolbar(E_Gadcon_Site site);
EAPI Eina_Bool e_gadcon_site_is_any_toolbar(E_Gadcon_Site site); // all toolbar sities
EAPI Eina_Bool e_gadcon_site_is_not_toolbar(E_Gadcon_Site site); // all non-toolbar sities
/* location helpers */
EAPI E_Gadcon_Location *
e_gadcon_location_new(const char * name, E_Gadcon_Site site,
int (*add_func) (void *data, const E_Gadcon_Client_Class *cc),
void *add_data,
void (*remove_func) (void *data, E_Gadcon_Client *cc),
void *remove_data);
EAPI void e_gadcon_location_free(E_Gadcon_Location *loc);
EAPI void e_gadcon_location_register (E_Gadcon_Location *loc);
EAPI void e_gadcon_location_unregister (E_Gadcon_Location *loc);
EAPI void e_gadcon_location_set_icon_name(E_Gadcon_Location *loc, const char *name);
EAPI void e_gadcon_client_add_location_menu(E_Gadcon_Client *gcc, E_Menu *menu);
#define GADCON_CLIENT_CONFIG_GET(_type, _items, _gc_class, _id) \
if (!_id) \
{ \
char buf[128]; \
int num = 0; \
_type *ci; \
if (_items) \
{ \
const char *p; \
ci = eina_list_last(_items)->data; \
p = strrchr (ci->id, '.'); \
if (p) num = atoi (p + 1) + 1; \
} \
snprintf (buf, sizeof (buf), "%s.%d", _gc_class.name, num); \
_id = buf; \
} \
else \
{ \
Eina_List *l; \
_type *ci; \
EINA_LIST_FOREACH(_items, l, ci) \
if ((ci->id) && (!strcmp(ci->id, id))) return ci; \
}
#endif
#endif

1243
src/bin/e_wayland/e_icon.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
#ifdef E_TYPEDEFS
#else
#ifndef E_ICON_H
#define E_ICON_H
EINTERN int e_icon_init(void);
EINTERN int e_icon_shutdown(void);
EAPI Evas_Object *e_icon_add (Evas *evas);
EAPI Eina_Bool e_icon_file_set (Evas_Object *obj, const char *file);
EAPI Eina_Bool e_icon_file_key_set (Evas_Object *obj, const char *file, const char *key);
EAPI Eina_Bool e_icon_file_edje_set (Evas_Object *obj, const char *file, const char *part);
EAPI Eina_Bool e_icon_fdo_icon_set (Evas_Object *obj, const char *icon);
EAPI void e_icon_edje_object_set(Evas_Object *obj, Evas_Object *edje);
EAPI void e_icon_object_set (Evas_Object *obj, Evas_Object *o) EINA_DEPRECATED;
EAPI Eina_Bool e_icon_file_get(const Evas_Object *obj, const char **file, const char **group);
EAPI void e_icon_smooth_scale_set (Evas_Object *obj, Eina_Bool smooth);
EAPI Eina_Bool e_icon_smooth_scale_get (const Evas_Object *obj);
EAPI void e_icon_alpha_set (Evas_Object *obj, Eina_Bool smooth);
EAPI Eina_Bool e_icon_alpha_get (const Evas_Object *obj);
EAPI void e_icon_preload_set (Evas_Object *obj, Eina_Bool preload);
EAPI Eina_Bool e_icon_preload_get (const Evas_Object *obj);
EAPI void e_icon_size_get (const Evas_Object *obj, int *w, int *h);
EAPI Eina_Bool e_icon_fill_inside_get (const Evas_Object *obj);
EAPI void e_icon_fill_inside_set (Evas_Object *obj, Eina_Bool fill_inside);
EAPI Eina_Bool e_icon_scale_up_get (const Evas_Object *obj);
EAPI void e_icon_scale_up_set (Evas_Object *obj, Eina_Bool scale_up);
EAPI void e_icon_data_set (Evas_Object *obj, void *data, int w, int h);
EAPI void *e_icon_data_get (const Evas_Object *obj, int *w, int *h);
EAPI void e_icon_scale_size_set (Evas_Object *obj, int size);
EAPI int e_icon_scale_size_get (const Evas_Object *obj);
EAPI void e_icon_selected_set (const Evas_Object *obj, Eina_Bool selected);
#endif
#endif

View File

@ -31,6 +31,33 @@
#include "e_canvas.h"
#include "e_manager.h"
#include "e_container.h"
#include "e_zone.h"
#include "e_desk.h"
#include "e_bg.h"
#include "e_box.h"
#include "e_icon.h"
#include "e_menu.h"
#include "e_win.h"
#include "e_dialog.h"
#include "e_about.h"
#include "e_theme_about.h"
#include "e_actions.h"
#include "e_acpi.h"
#include "e_exec.h"
#include "e_configure.h"
#include "e_config_dialog.h"
#include "e_thumb.h"
#include "e_shelf.h"
#include "e_gadcon.h"
#include "e_popup.h"
#include "e_obj_dialog.h"
#include "e_sys.h"
#include "e_bindings.h"
#include "e_ipc.h"
#include "e_ipc_codec.h"
#include "e_exehist.h"
#include "e_alert.h"
#include "e_output.h"
#include "e_shader.h"
#include "e_renderer.h"

File diff suppressed because it is too large Load Diff

View File

@ -1,39 +1,66 @@
#ifdef E_TYPEDEFS
typedef struct _E_Int_Menu_Augmentation E_Int_Menu_Augmentation;
#else
# ifndef E_INT_MENUS_H
# define E_INT_MENUS_H
#ifndef E_INT_MENUS_H
#define E_INT_MENUS_H
typedef enum
#define E_CLIENTLIST_GROUP_NONE 0
#define E_CLIENTLIST_GROUP_DESK 1
#define E_CLIENTLIST_GROUP_CLASS 2
#define E_CLIENTLIST_GROUP_SEP_NONE 0
#define E_CLIENTLIST_GROUP_SEP_BAR 1
#define E_CLIENTLIST_GROUP_SEP_MENU 2
#define E_CLIENTLIST_SORT_NONE 0
#define E_CLIENTLIST_SORT_ALPHA 1
#define E_CLIENTLIST_SORT_ZORDER 2
#define E_CLIENTLIST_SORT_MOST_RECENT 3
#define E_CLIENTLIST_GROUPICONS_OWNER 0
#define E_CLIENTLIST_GROUPICONS_CURRENT 1
#define E_CLIENTLIST_GROUPICONS_SEP 2
#define E_CLIENTLIST_MAX_CAPTION_LEN 256
struct _E_Int_Menu_Augmentation
{
E_CLIENTLIST_GROUP_NONE,
E_CLIENTLIST_GROUP_DESK,
E_CLIENTLIST_GROUP_CLASS
} E_Clientlist_Group_Type;
const char *sort_key;
struct
{
void (*func) (void *data, E_Menu *m);
void *data;
} add, del;
};
typedef enum
{
E_CLIENTLIST_GROUP_SEP_NONE,
E_CLIENTLIST_GROUP_SEP_BAR,
E_CLIENTLIST_GROUP_SEP_MENU
} E_Clientlist_Group_Sep_Type;
EAPI E_Menu *e_int_menus_main_new(void);
EAPI E_Menu *e_int_menus_desktops_new(void);
EAPI E_Menu *e_int_menus_clients_new(void);
EAPI E_Menu *e_int_menus_apps_new(const char *dir);
EAPI E_Menu *e_int_menus_favorite_apps_new(void);
EAPI E_Menu *e_int_menus_all_apps_new(void);
EAPI E_Menu *e_int_menus_config_new(void);
EAPI E_Menu *e_int_menus_lost_clients_new(void);
EAPI E_Menu *e_int_menus_shelves_new(void);
typedef enum
{
E_CLIENTLIST_SORT_NONE,
E_CLIENTLIST_SORT_ALPHA,
E_CLIENTLIST_SORT_ZORDER,
E_CLIENTLIST_SORT_MOST_RECENT
} E_Clientlist_Group_Sort_Type;
EAPI E_Int_Menu_Augmentation *e_int_menus_menu_augmentation_add(const char *menu,
void (*func_add) (void *data, E_Menu *m),
void *data_add,
void (*func_del) (void *data, E_Menu *m),
void *data_del);
EAPI E_Int_Menu_Augmentation *e_int_menus_menu_augmentation_add_sorted(const char *menu,
const char *sort_key,
void (*func_add) (void *data, E_Menu *m),
void *data_add,
void (*func_del) (void *data, E_Menu *m),
void *data_del);
EAPI void e_int_menus_menu_augmentation_del(const char *menu,
E_Int_Menu_Augmentation *maug);
typedef enum
{
E_CLIENTLIST_GROUPICONS_OWNER,
E_CLIENTLIST_GROUPICONS_CURRENT,
E_CLIENTLIST_GROUPICONS_SEP,
} E_Clientlist_Groupicons_Type;
# define E_CLIENTLIST_MAX_CAPTION_LEN 256
# endif
EAPI void e_int_menus_menu_augmentation_point_disabled_set(const char *menu,
Eina_Bool disabled);
#endif
#endif

229
src/bin/e_wayland/e_ipc.c Normal file
View File

@ -0,0 +1,229 @@
#include "e.h"
#ifdef USE_IPC
/* local subsystem functions */
static Eina_Bool _e_ipc_cb_client_add(void *data __UNUSED__, int type __UNUSED__, void *event);
static Eina_Bool _e_ipc_cb_client_del(void *data __UNUSED__, int type __UNUSED__, void *event);
static Eina_Bool _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event);
/* local subsystem globals */
static Ecore_Ipc_Server *_e_ipc_server = NULL;
#endif
/* externally accessible functions */
EINTERN int
e_ipc_init(void)
{
#ifdef USE_IPC
char buf[4096], buf2[128], buf3[4096];
char *tmp, *user, *disp, *base;
int pid, trynum = 0;
tmp = getenv("TMPDIR");
if (!tmp) tmp = "/tmp";
base = tmp;
tmp = getenv("XDG_RUNTIME_DIR");
if (tmp) base = tmp;
tmp = getenv("SD_USER_SOCKETS_DIR");
if (tmp) base = tmp;
user = getenv("USER");
if (!user)
{
int uidint;
user = "__unknown__";
uidint = getuid();
if (uidint >= 0)
{
snprintf(buf2, sizeof(buf2), "%i", uidint);
user = buf2;
}
}
disp = getenv("DISPLAY");
if (!disp) disp = ":0";
e_util_env_set("E_IPC_SOCKET", "");
pid = (int)getpid();
for (trynum = 0; trynum <= 4096; trynum++)
{
struct stat st;
int id1 = 0;
snprintf(buf, sizeof(buf), "%s/e-%s@%x",
base, user, id1);
mkdir(buf, S_IRWXU);
if (stat(buf, &st) == 0)
{
if ((st.st_uid == getuid()) &&
((st.st_mode & (S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO)) ==
(S_IRWXU | S_IFDIR)))
{
snprintf(buf3, sizeof(buf3), "%s/%s-%i",
buf, disp, pid);
_e_ipc_server = ecore_ipc_server_add
(ECORE_IPC_LOCAL_SYSTEM, buf3, 0, NULL);
if (_e_ipc_server) break;
}
}
id1 = rand();
}
if (!_e_ipc_server) return 0;
e_util_env_set("E_IPC_SOCKET", buf3);
ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD,
_e_ipc_cb_client_add, NULL);
ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL,
_e_ipc_cb_client_del, NULL);
ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA,
_e_ipc_cb_client_data, NULL);
e_ipc_codec_init();
#endif
return 1;
}
EINTERN int
e_ipc_shutdown(void)
{
#ifdef USE_IPC
e_ipc_codec_shutdown();
if (_e_ipc_server)
{
ecore_ipc_server_del(_e_ipc_server);
_e_ipc_server = NULL;
}
#endif
return 1;
}
#ifdef USE_IPC
/* local subsystem globals */
static Eina_Bool
_e_ipc_cb_client_add(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Ipc_Event_Client_Add *e;
e = event;
if (ecore_ipc_client_server_get(e->client) != _e_ipc_server)
return ECORE_CALLBACK_PASS_ON;
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_e_ipc_cb_client_del(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Ipc_Event_Client_Del *e;
e = event;
if (ecore_ipc_client_server_get(e->client) != _e_ipc_server)
return ECORE_CALLBACK_PASS_ON;
/* delete client sruct */
e_thumb_client_del(e);
/* e_fm2_client_del(e); */
ecore_ipc_client_del(e->client);
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Ipc_Event_Client_Data *e;
e = event;
if (ecore_ipc_client_server_get(e->client) != _e_ipc_server)
return ECORE_CALLBACK_PASS_ON;
switch (e->major)
{
case E_IPC_DOMAIN_SETUP:
case E_IPC_DOMAIN_REQUEST:
case E_IPC_DOMAIN_REPLY:
case E_IPC_DOMAIN_EVENT:
switch (e->minor)
{
case E_IPC_OP_EXEC_ACTION:
{
E_Ipc_2Str *req = NULL;
if (e_ipc_codec_2str_dec(e->data, e->size, &req))
{
Eina_List *m = e_manager_list();
int len, ok = 0;
void *d;
if (m)
{
E_Manager *man = eina_list_data_get(m);
if (man)
{
E_Action *act = e_action_find(req->str1);
if ((act) && (act->func.go))
{
act->func.go(E_OBJECT(man), req->str2);
ok = 1;
}
}
}
d = e_ipc_codec_int_enc(ok, &len);
if (d)
{
ecore_ipc_client_send(e->client,
E_IPC_DOMAIN_REPLY,
E_IPC_OP_EXEC_ACTION_REPLY,
0, 0, 0, d, len);
free(d);
}
if (req)
{
E_FREE(req->str1);
E_FREE(req->str2);
E_FREE(req);
}
}
}
break;
default:
break;
}
break;
case E_IPC_DOMAIN_THUMB:
e_thumb_client_data(e);
break;
case E_IPC_DOMAIN_FM:
/* e_fm2_client_data(e); */
break;
case E_IPC_DOMAIN_ALERT:
{
switch (e->minor)
{
case E_ALERT_OP_RESTART:
if (getenv("E_START_MTRACK"))
e_util_env_set("MTRACK", "track");
ecore_app_restart();
break;
case E_ALERT_OP_EXIT:
exit(-11);
break;
}
}
break;
default:
break;
}
return ECORE_CALLBACK_PASS_ON;
}
#endif

32
src/bin/e_wayland/e_ipc.h Normal file
View File

@ -0,0 +1,32 @@
#ifdef E_TYPEDEFS
#ifdef USE_IPC
#define E_IPC_OP_EXEC_ACTION 386
#define E_IPC_OP_EXEC_ACTION_REPLY 387
typedef enum _E_Ipc_Domain
{
E_IPC_DOMAIN_NONE,
E_IPC_DOMAIN_SETUP,
E_IPC_DOMAIN_REQUEST,
E_IPC_DOMAIN_REPLY,
E_IPC_DOMAIN_EVENT,
E_IPC_DOMAIN_THUMB,
E_IPC_DOMAIN_FM,
E_IPC_DOMAIN_ALERT,
E_IPC_DOMAIN_LAST
} E_Ipc_Domain;
typedef int E_Ipc_Op;
#endif
#else
#ifndef E_IPC_H
#define E_IPC_H
EINTERN int e_ipc_init(void);
EINTERN int e_ipc_shutdown(void);
#endif
#endif

View File

@ -0,0 +1,667 @@
#include "e.h"
#ifdef USE_IPC
/* local subsystem functions */
/* encode functions, Should these be global? */
/* local subsystem globals */
static Eet_Data_Descriptor *_e_ipc_int_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_double_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_2int_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_str_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_str_list_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_2str_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_2str_list_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_str_int_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_str_int_list_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_2str_int_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_2str_int_list_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_4int_2str_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_4int_2str_list_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_5int_2str_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_5int_2str_list_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_3int_4str_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_3int_4str_list_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_3int_3str_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_3int_3str_list_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_str_4int_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_str_4int_list_edd = NULL;
#define E_IPC_DD(Edd, Eddc, Name, Type) \
Eddc.name = Name; \
Eddc.size = sizeof (Type); \
Edd = eet_data_descriptor_stream_new(&Eddc);
/* externally accessible functions */
EINTERN int
e_ipc_codec_init(void)
{
Eet_Data_Descriptor_Class eddc;
if (!eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "int", sizeof (E_Ipc_Int)))
return 0;
_e_ipc_int_edd = eet_data_descriptor_stream_new(&eddc);
E_CONFIG_VAL(_e_ipc_int_edd, E_Ipc_Int, val, INT);
E_IPC_DD(_e_ipc_double_edd, eddc, "double", E_Ipc_Double);
E_CONFIG_VAL(_e_ipc_double_edd, E_Ipc_Double, val, DOUBLE);
E_IPC_DD(_e_ipc_2int_edd, eddc, "2int", E_Ipc_2Int);
E_CONFIG_VAL(_e_ipc_2int_edd, E_Ipc_2Int, val1, INT);
E_CONFIG_VAL(_e_ipc_2int_edd, E_Ipc_2Int, val2, INT);
E_IPC_DD(_e_ipc_str_edd, eddc, "str", E_Ipc_Str);
E_CONFIG_VAL(_e_ipc_str_edd, E_Ipc_Str, str, STR);
E_IPC_DD(_e_ipc_str_list_edd, eddc, "str_list", E_Ipc_List);
E_CONFIG_LIST(_e_ipc_str_list_edd, E_Ipc_List, list, _e_ipc_str_edd);
E_IPC_DD(_e_ipc_2str_edd, eddc, "2str", E_Ipc_2Str);
E_CONFIG_VAL(_e_ipc_2str_edd, E_Ipc_2Str, str1, STR);
E_CONFIG_VAL(_e_ipc_2str_edd, E_Ipc_2Str, str2, STR);
E_IPC_DD(_e_ipc_2str_list_edd, eddc, "2str_list", E_Ipc_List);
E_CONFIG_LIST(_e_ipc_2str_list_edd, E_Ipc_List, list, _e_ipc_2str_edd);
E_IPC_DD(_e_ipc_str_int_edd, eddc, "str_int", E_Ipc_Str_Int);
E_CONFIG_VAL(_e_ipc_str_int_edd, E_Ipc_Str_Int, str, STR);
E_CONFIG_VAL(_e_ipc_str_int_edd, E_Ipc_Str_Int, val, INT);
E_IPC_DD(_e_ipc_str_int_list_edd, eddc, "str_int_list", E_Ipc_List);
E_CONFIG_LIST(_e_ipc_str_int_list_edd, E_Ipc_List, list, _e_ipc_str_int_edd);
E_IPC_DD(_e_ipc_2str_int_edd, eddc, "2str_int", E_Ipc_2Str_Int);
E_CONFIG_VAL(_e_ipc_2str_int_edd, E_Ipc_2Str_Int, str1, STR);
E_CONFIG_VAL(_e_ipc_2str_int_edd, E_Ipc_2Str_Int, str2, STR);
E_CONFIG_VAL(_e_ipc_2str_int_edd, E_Ipc_2Str_Int, val, INT);
E_IPC_DD(_e_ipc_2str_int_list_edd, eddc, "2str_int_list", E_Ipc_List);
E_CONFIG_LIST(_e_ipc_2str_int_list_edd, E_Ipc_List, list, _e_ipc_2str_int_edd);
E_IPC_DD(_e_ipc_4int_2str_edd, eddc, "4int_2str", E_Ipc_4Int_2Str);
E_CONFIG_VAL(_e_ipc_4int_2str_edd, E_Ipc_4Int_2Str, val1, INT);
E_CONFIG_VAL(_e_ipc_4int_2str_edd, E_Ipc_4Int_2Str, val2, INT);
E_CONFIG_VAL(_e_ipc_4int_2str_edd, E_Ipc_4Int_2Str, val3, INT);
E_CONFIG_VAL(_e_ipc_4int_2str_edd, E_Ipc_4Int_2Str, val4, INT);
E_CONFIG_VAL(_e_ipc_4int_2str_edd, E_Ipc_4Int_2Str, str1, STR);
E_CONFIG_VAL(_e_ipc_4int_2str_edd, E_Ipc_4Int_2Str, str2, STR);
E_IPC_DD(_e_ipc_4int_2str_list_edd, eddc, "4int_2str_list", E_Ipc_List);
E_CONFIG_LIST(_e_ipc_4int_2str_list_edd, E_Ipc_List, list, _e_ipc_4int_2str_edd);
E_IPC_DD(_e_ipc_5int_2str_edd, eddc, "5int_2str", E_Ipc_5Int_2Str);
E_CONFIG_VAL(_e_ipc_5int_2str_edd, E_Ipc_5Int_2Str, val1, INT);
E_CONFIG_VAL(_e_ipc_5int_2str_edd, E_Ipc_5Int_2Str, val2, INT);
E_CONFIG_VAL(_e_ipc_5int_2str_edd, E_Ipc_5Int_2Str, val3, INT);
E_CONFIG_VAL(_e_ipc_5int_2str_edd, E_Ipc_5Int_2Str, val4, INT);
E_CONFIG_VAL(_e_ipc_5int_2str_edd, E_Ipc_5Int_2Str, val5, INT);
E_CONFIG_VAL(_e_ipc_5int_2str_edd, E_Ipc_5Int_2Str, str1, STR);
E_CONFIG_VAL(_e_ipc_5int_2str_edd, E_Ipc_5Int_2Str, str2, STR);
E_IPC_DD(_e_ipc_5int_2str_list_edd, eddc, "5int_2str_list", E_Ipc_List);
E_CONFIG_LIST(_e_ipc_5int_2str_list_edd, E_Ipc_List, list, _e_ipc_5int_2str_edd);
E_IPC_DD(_e_ipc_3int_4str_edd, eddc, "3int_4str", E_Ipc_3Int_4Str);
E_CONFIG_VAL(_e_ipc_3int_4str_edd, E_Ipc_3Int_4Str, val1, INT);
E_CONFIG_VAL(_e_ipc_3int_4str_edd, E_Ipc_3Int_4Str, val2, INT);
E_CONFIG_VAL(_e_ipc_3int_4str_edd, E_Ipc_3Int_4Str, val3, INT);
E_CONFIG_VAL(_e_ipc_3int_4str_edd, E_Ipc_3Int_4Str, str1, STR);
E_CONFIG_VAL(_e_ipc_3int_4str_edd, E_Ipc_3Int_4Str, str2, STR);
E_CONFIG_VAL(_e_ipc_3int_4str_edd, E_Ipc_3Int_4Str, str3, STR);
E_CONFIG_VAL(_e_ipc_3int_4str_edd, E_Ipc_3Int_4Str, str4, STR);
E_IPC_DD(_e_ipc_3int_4str_list_edd, eddc, "3int_4str_list", E_Ipc_List);
E_CONFIG_LIST(_e_ipc_3int_4str_list_edd, E_Ipc_List, list, _e_ipc_3int_4str_edd);
E_IPC_DD(_e_ipc_3int_3str_edd, eddc, "3int_3str", E_Ipc_3Int_3Str);
E_CONFIG_VAL(_e_ipc_3int_3str_edd, E_Ipc_3Int_3Str, val1, INT);
E_CONFIG_VAL(_e_ipc_3int_3str_edd, E_Ipc_3Int_3Str, val2, INT);
E_CONFIG_VAL(_e_ipc_3int_3str_edd, E_Ipc_3Int_3Str, val3, INT);
E_CONFIG_VAL(_e_ipc_3int_3str_edd, E_Ipc_3Int_3Str, str1, STR);
E_CONFIG_VAL(_e_ipc_3int_3str_edd, E_Ipc_3Int_3Str, str2, STR);
E_CONFIG_VAL(_e_ipc_3int_3str_edd, E_Ipc_3Int_3Str, str3, STR);
E_IPC_DD(_e_ipc_3int_3str_list_edd, eddc, "3int_3str_list", E_Ipc_List);
E_CONFIG_LIST(_e_ipc_3int_3str_list_edd, E_Ipc_List, list, _e_ipc_3int_3str_edd);
E_IPC_DD(_e_ipc_str_4int_edd, eddc, "str_4int", E_Ipc_Str_4Int);
E_CONFIG_VAL(_e_ipc_str_4int_edd, E_Ipc_Str_4Int, str, STR);
E_CONFIG_VAL(_e_ipc_str_4int_edd, E_Ipc_Str_4Int, val1, INT);
E_CONFIG_VAL(_e_ipc_str_4int_edd, E_Ipc_Str_4Int, val2, INT);
E_CONFIG_VAL(_e_ipc_str_4int_edd, E_Ipc_Str_4Int, val3, INT);
E_CONFIG_VAL(_e_ipc_str_4int_edd, E_Ipc_Str_4Int, val4, INT);
E_IPC_DD(_e_ipc_str_4int_list_edd, eddc, "str_4int_list", E_Ipc_List);
E_CONFIG_LIST(_e_ipc_str_4int_list_edd, E_Ipc_List, list, _e_ipc_str_4int_edd);
return 1;
}
EINTERN void
e_ipc_codec_shutdown(void)
{
E_CONFIG_DD_FREE(_e_ipc_int_edd);
E_CONFIG_DD_FREE(_e_ipc_double_edd);
E_CONFIG_DD_FREE(_e_ipc_2int_edd);
E_CONFIG_DD_FREE(_e_ipc_str_edd);
E_CONFIG_DD_FREE(_e_ipc_str_list_edd);
E_CONFIG_DD_FREE(_e_ipc_2str_edd);
E_CONFIG_DD_FREE(_e_ipc_2str_list_edd);
E_CONFIG_DD_FREE(_e_ipc_str_int_edd);
E_CONFIG_DD_FREE(_e_ipc_str_int_list_edd);
E_CONFIG_DD_FREE(_e_ipc_2str_int_edd);
E_CONFIG_DD_FREE(_e_ipc_2str_int_list_edd);
E_CONFIG_DD_FREE(_e_ipc_4int_2str_edd);
E_CONFIG_DD_FREE(_e_ipc_4int_2str_list_edd);
E_CONFIG_DD_FREE(_e_ipc_5int_2str_edd);
E_CONFIG_DD_FREE(_e_ipc_5int_2str_list_edd);
E_CONFIG_DD_FREE(_e_ipc_3int_4str_edd);
E_CONFIG_DD_FREE(_e_ipc_3int_4str_list_edd);
E_CONFIG_DD_FREE(_e_ipc_3int_3str_edd);
E_CONFIG_DD_FREE(_e_ipc_3int_3str_list_edd);
E_CONFIG_DD_FREE(_e_ipc_str_4int_edd);
E_CONFIG_DD_FREE(_e_ipc_str_4int_list_edd);
}
EAPI int
e_ipc_codec_int_dec(char *data, int bytes, int *dest)
{
E_Ipc_Int *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_int_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat->val;
free(dat);
return 1;
}
EAPI void *
e_ipc_codec_int_enc(int val, int *size_ret)
{
E_Ipc_Int dat;
dat.val = val;
return eet_data_descriptor_encode(_e_ipc_int_edd, &dat, size_ret);
}
EAPI int
e_ipc_codec_double_dec(char *data, int bytes, double *dest)
{
E_Ipc_Double *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_double_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat->val;
free(dat);
return 1;
}
EAPI void *
e_ipc_codec_double_enc(double val, int *size_ret)
{
E_Ipc_Double dat;
dat.val = val;
return eet_data_descriptor_encode(_e_ipc_double_edd, &dat, size_ret);
}
EAPI int
e_ipc_codec_2int_dec(char *data, int bytes, int *dest, int *dest2)
{
E_Ipc_2Int *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_2int_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat->val1;
if (dest2) *dest2 = dat->val2;
free(dat);
return 1;
}
EAPI void *
e_ipc_codec_2int_enc(int val1, int val2, int *size_ret)
{
E_Ipc_2Int dat;
dat.val1 = val1;
dat.val2 = val2;
return eet_data_descriptor_encode(_e_ipc_2int_edd, &dat, size_ret);
}
EAPI int
e_ipc_codec_str_dec(char *data, int bytes, char **dest)
{
E_Ipc_Str *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_str_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat->str;
free(dat);
return 1;
}
EAPI void *
e_ipc_codec_str_enc(const char *str, int *size_ret)
{
E_Ipc_Str dat;
dat.str = (char *)str;
return eet_data_descriptor_encode(_e_ipc_str_edd, &dat, size_ret);
}
EAPI int
e_ipc_codec_2str_dec(char *data, int bytes, E_Ipc_2Str **dest)
{
E_Ipc_2Str *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_2str_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat;
return 1;
}
EAPI void *
e_ipc_codec_2str_enc(const char *str1, const char *str2, int *size_ret)
{
E_Ipc_2Str dat;
dat.str1 = (char *)str1;
dat.str2 = (char *)str2;
return eet_data_descriptor_encode(_e_ipc_2str_edd, &dat, size_ret);
}
EAPI int
e_ipc_codec_2str_list_dec(char *data, int bytes, Eina_List **dest)
{
E_Ipc_List *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_2str_list_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat->list;
free(dat);
return 1;
}
EAPI void *
e_ipc_codec_2str_list_enc(Eina_List *list, int *size_ret)
{
E_Ipc_List dat;
dat.list = list;
return eet_data_descriptor_encode(_e_ipc_2str_list_edd, &dat, size_ret);
}
EAPI int
e_ipc_codec_str_list_dec(char *data, int bytes, Eina_List **dest)
{
E_Ipc_List *dat;
Eina_List *list = NULL, *l;
E_Ipc_Str *str_node;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_str_list_edd, data, bytes);
if (!dat) return 0;
EINA_LIST_FOREACH(dat->list, l, str_node)
{
list = eina_list_append(list, str_node->str);
}
if (dest) *dest = list;
E_FREE_LIST(dat->list, free);
free(dat);
return 1;
}
EAPI void *
e_ipc_codec_str_list_enc(Eina_List *list, int *size_ret)
{
E_Ipc_List dat;
Eina_List *l;
E_Ipc_Str *str_node;
char *str;
void *data;
dat.list = NULL;
EINA_LIST_FOREACH(list, l, str)
{
str_node = malloc(sizeof(E_Ipc_Str));
str_node->str = str;
dat.list = eina_list_append(dat.list, str_node);
}
data = eet_data_descriptor_encode(_e_ipc_str_list_edd, &dat, size_ret);
E_FREE_LIST(dat.list, free);
return data;
}
EAPI int
e_ipc_codec_str_int_dec(char *data, int bytes, E_Ipc_Str_Int **dest)
{
E_Ipc_Str_Int *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_str_int_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat;
return 1;
}
EAPI void *
e_ipc_codec_str_int_enc(const char *str, int val, int *size_ret)
{
E_Ipc_Str_Int dat;
dat.str = (char *)str;
dat.val = val;
return eet_data_descriptor_encode(_e_ipc_str_int_edd, &dat, size_ret);
}
EAPI int
e_ipc_codec_str_int_list_dec(char *data, int bytes, Eina_List **dest)
{
E_Ipc_List *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_str_int_list_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat->list;
free(dat);
return 1;
}
EAPI void *
e_ipc_codec_str_int_list_enc(Eina_List *list, int *size_ret)
{
E_Ipc_List dat;
dat.list = list;
return eet_data_descriptor_encode(_e_ipc_str_int_list_edd, &dat, size_ret);
}
EAPI int
e_ipc_codec_2str_int_dec(char *data, int bytes, E_Ipc_2Str_Int **dest)
{
E_Ipc_2Str_Int *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_2str_int_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat;
return 1;
}
EAPI void *
e_ipc_codec_2str_int_enc(const char *str1, const char *str2, int val, int *size_ret)
{
E_Ipc_2Str_Int dat;
dat.str1 = (char *)str1;
dat.str2 = (char *)str2;
dat.val = val;
return eet_data_descriptor_encode(_e_ipc_2str_int_edd, &dat, size_ret);
}
EAPI int
e_ipc_codec_2str_int_list_dec(char *data, int bytes, Eina_List **dest)
{
E_Ipc_List *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_2str_int_list_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat->list;
free(dat);
return 1;
}
EAPI void *
e_ipc_codec_2str_int_list_enc(Eina_List *list, int *size_ret)
{
E_Ipc_List dat;
dat.list = list;
return eet_data_descriptor_encode(_e_ipc_2str_int_list_edd, &dat, size_ret);
}
EAPI int
e_ipc_codec_4int_2str_dec(char *data, int bytes, E_Ipc_4Int_2Str **dest)
{
E_Ipc_4Int_2Str *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_4int_2str_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat;
return 1;
}
EAPI void *
e_ipc_codec_4int_2str_enc(int val1, int val2, int val3, int val4, const char *str1, const char *str2, int *size_ret)
{
E_Ipc_4Int_2Str dat;
dat.val1 = val1;
dat.val2 = val2;
dat.val3 = val3;
dat.val4 = val4;
dat.str1 = (char *)str1;
dat.str2 = (char *)str2;
return eet_data_descriptor_encode(_e_ipc_4int_2str_edd, &dat, size_ret);
}
EAPI int
e_ipc_codec_4int_2str_list_dec(char *data, int bytes, Eina_List **dest)
{
E_Ipc_List *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_4int_2str_list_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat->list;
free(dat);
return 1;
}
EAPI void *
e_ipc_codec_4int_2str_list_enc(Eina_List *list, int *size_ret)
{
E_Ipc_List dat;
dat.list = list;
return eet_data_descriptor_encode(_e_ipc_4int_2str_list_edd, &dat, size_ret);
}
EAPI int
e_ipc_codec_5int_2str_dec(char *data, int bytes, E_Ipc_5Int_2Str **dest)
{
E_Ipc_5Int_2Str *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_5int_2str_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat;
return 1;
}
EAPI void *
e_ipc_codec_5int_2str_enc(int val1, int val2, int val3, int val4, int val5, const char *str1, const char *str2, int *size_ret)
{
E_Ipc_5Int_2Str dat;
dat.val1 = val1;
dat.val2 = val2;
dat.val3 = val3;
dat.val4 = val4;
dat.val5 = val5;
dat.str1 = (char *)str1;
dat.str2 = (char *)str2;
return eet_data_descriptor_encode(_e_ipc_5int_2str_edd, &dat, size_ret);
}
EAPI int
e_ipc_codec_5int_2str_list_dec(char *data, int bytes, Eina_List **dest)
{
E_Ipc_List *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_5int_2str_list_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat->list;
free(dat);
return 1;
}
EAPI void *
e_ipc_codec_5int_2str_list_enc(Eina_List *list, int *size_ret)
{
E_Ipc_List dat;
dat.list = list;
return eet_data_descriptor_encode(_e_ipc_5int_2str_list_edd, &dat, size_ret);
}
EAPI int
e_ipc_codec_3int_4str_dec(char *data, int bytes, E_Ipc_3Int_4Str **dest)
{
E_Ipc_3Int_4Str *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_3int_4str_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat;
return 1;
}
EAPI void *
e_ipc_codec_3int_4str_enc(int val1, int val2, int val3, const char *str1, const char *str2, const char *str3, const char *str4, int *size_ret)
{
E_Ipc_3Int_4Str dat;
dat.val1 = val1;
dat.val2 = val2;
dat.val3 = val3;
dat.str1 = (char *)str1;
dat.str2 = (char *)str2;
dat.str3 = (char *)str3;
dat.str4 = (char *)str4;
return eet_data_descriptor_encode(_e_ipc_3int_4str_edd, &dat, size_ret);
}
EAPI int
e_ipc_codec_3int_4str_list_dec(char *data, int bytes, Eina_List **dest)
{
E_Ipc_List *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_3int_4str_list_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat->list;
free(dat);
return 1;
}
EAPI void *
e_ipc_codec_3int_4str_list_enc(Eina_List *list, int *size_ret)
{
E_Ipc_List dat;
dat.list = list;
return eet_data_descriptor_encode(_e_ipc_3int_4str_list_edd, &dat, size_ret);
}
EAPI int
e_ipc_codec_3int_3str_dec(char *data, int bytes, E_Ipc_3Int_3Str **dest)
{
E_Ipc_3Int_3Str *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_3int_3str_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat;
return 1;
}
EAPI void *
e_ipc_codec_3int_3str_enc(int val1, int val2, int val3, const char *str1, const char *str2, const char *str3, int *size_ret)
{
E_Ipc_3Int_3Str dat;
dat.val1 = val1;
dat.val2 = val2;
dat.val3 = val3;
dat.str1 = (char *)str1;
dat.str2 = (char *)str2;
dat.str3 = (char *)str3;
return eet_data_descriptor_encode(_e_ipc_3int_3str_edd, &dat, size_ret);
}
EAPI int
e_ipc_codec_3int_3str_list_dec(char *data, int bytes, Eina_List **dest)
{
E_Ipc_List *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_3int_3str_list_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat->list;
free(dat);
return 1;
}
EAPI void *
e_ipc_codec_3int_3str_list_enc(Eina_List *list, int *size_ret)
{
E_Ipc_List dat;
dat.list = list;
return eet_data_descriptor_encode(_e_ipc_3int_3str_list_edd, &dat, size_ret);
}
EAPI int
e_ipc_codec_str_4int_dec(char *data, int bytes, E_Ipc_Str_4Int **dest)
{
E_Ipc_Str_4Int *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_str_4int_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat;
return 1;
}
EAPI void *
e_ipc_codec_str_4int_enc(const char *str1, int val1, int val2, int val3, int val4, int *size_ret)
{
E_Ipc_Str_4Int dat;
dat.str = (char *)str1;
dat.val1 = val1;
dat.val2 = val2;
dat.val3 = val3;
dat.val4 = val4;
return eet_data_descriptor_encode(_e_ipc_str_4int_edd, &dat, size_ret);
}
EAPI int
e_ipc_codec_str_4int_list_dec(char *data, int bytes, Eina_List **dest)
{
E_Ipc_List *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_str_4int_list_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat->list;
free(dat);
return 1;
}
EAPI void *
e_ipc_codec_str_4int_list_enc(Eina_List *list, int *size_ret)
{
E_Ipc_List dat;
dat.list = list;
return eet_data_descriptor_encode(_e_ipc_str_4int_list_edd, &dat, size_ret);
}
/* local subsystem globals */
#endif

View File

@ -0,0 +1,155 @@
#ifdef E_TYPEDEFS
#ifdef USE_IPC
typedef struct _E_Ipc_Int E_Ipc_Int;
typedef struct _E_Ipc_Double E_Ipc_Double;
typedef struct _E_Ipc_2Int E_Ipc_2Int;
typedef struct _E_Ipc_List E_Ipc_List;
typedef struct _E_Ipc_Str E_Ipc_Str;
typedef struct _E_Ipc_2Str E_Ipc_2Str;
typedef struct _E_Ipc_Str_Int E_Ipc_Str_Int;
typedef struct _E_Ipc_Str_Int_List E_Ipc_Str_Int_List;
typedef struct _E_Ipc_2Str_Int E_Ipc_2Str_Int;
typedef struct _E_Ipc_2Str_Int_List E_Ipc_2Str_Int_List;
typedef struct _E_Ipc_4Int_2Str E_Ipc_4Int_2Str;
typedef struct _E_Ipc_5Int_2Str E_Ipc_5Int_2Str;
typedef struct _E_Ipc_3Int_4Str E_Ipc_3Int_4Str;
typedef struct _E_Ipc_3Int_3Str E_Ipc_3Int_3Str;
typedef struct _E_Ipc_Str_4Int E_Ipc_Str_4Int;
#endif
#else
#ifndef E_IPC_CODEC_H
#define E_IPC_CODEC_H
#ifdef USE_IPC
struct _E_Ipc_Int
{
int val;
};
struct _E_Ipc_Double
{
double val;
};
struct _E_Ipc_2Int
{
int val1, val2;
};
struct _E_Ipc_List
{
Eina_List *list;
};
struct _E_Ipc_Str
{
char *str;
};
struct _E_Ipc_2Str
{
char *str1, *str2;
};
struct _E_Ipc_Str_Int
{
char *str;
int val;
};
struct _E_Ipc_2Str_Int
{
char *str1, *str2;
int val;
};
struct _E_Ipc_4Int_2Str
{
int val1, val2, val3, val4;
char *str1, *str2;
};
struct _E_Ipc_5Int_2Str
{
int val1, val2, val3, val4, val5;
char *str1, *str2;
};
struct _E_Ipc_3Int_4Str
{
int val1, val2, val3;
char *str1, *str2, *str3, *str4;
};
struct _E_Ipc_3Int_3Str
{
int val1, val2, val3;
char *str1, *str2, *str3;
};
struct _E_Ipc_Str_4Int
{
char *str;
int val1, val2, val3, val4;
};
EINTERN int e_ipc_codec_init(void);
EINTERN void e_ipc_codec_shutdown(void);
EAPI int e_ipc_codec_int_dec(char *data, int bytes, int *dest);
EAPI void *e_ipc_codec_int_enc(int val, int *size_ret);
EAPI int e_ipc_codec_double_dec(char *data, int bytes, double *dest);
EAPI void *e_ipc_codec_double_enc(double val, int *size_ret);
EAPI int e_ipc_codec_2int_dec(char *data, int bytes, int *dest, int *dest2x);
EAPI void *e_ipc_codec_2int_enc(int val1, int val2, int *size_ret);
EAPI int e_ipc_codec_str_dec(char *data, int bytes, char **dest);
EAPI void *e_ipc_codec_str_enc(const char *str, int *size_ret);
EAPI int e_ipc_codec_str_list_dec(char *data, int bytes, Eina_List **dest);
EAPI void *e_ipc_codec_str_list_enc(Eina_List *list, int *size_ret);
EAPI int e_ipc_codec_2str_dec(char *data, int bytes, E_Ipc_2Str **dest);
EAPI void *e_ipc_codec_2str_enc(const char *str1, const char *str2, int *size_ret);
EAPI int e_ipc_codec_2str_list_dec(char *data, int bytes, Eina_List **dest);
EAPI void *e_ipc_codec_2str_list_enc(Eina_List *list, int *size_ret);
EAPI int e_ipc_codec_str_int_dec(char *data, int bytes, E_Ipc_Str_Int **dest);
EAPI void *e_ipc_codec_str_int_enc(const char *str, int val, int *size_ret);
EAPI int e_ipc_codec_str_int_list_dec(char *data, int bytes, Eina_List **dest);
EAPI void *e_ipc_codec_str_int_list_enc(Eina_List *list, int *size_ret);
EAPI int e_ipc_codec_2str_int_dec(char *data, int bytes, E_Ipc_2Str_Int **dest);
EAPI void *e_ipc_codec_2str_int_enc(const char *str1, const char *str2, int val, int *size_ret);
EAPI int e_ipc_codec_2str_int_list_dec(char *data, int bytes, Eina_List **dest);
EAPI void *e_ipc_codec_2str_int_list_enc(Eina_List *list, int *size_ret);
EAPI int e_ipc_codec_4int_2str_dec(char *data, int bytes, E_Ipc_4Int_2Str **dest);
EAPI void *e_ipc_codec_4int_2str_enc(int val1, int val2, int val3, int val4, const char *str1, const char *str2, int *size_ret);
EAPI int e_ipc_codec_4int_2str_list_dec(char *data, int bytes, Eina_List **dest);
EAPI void *e_ipc_codec_4int_2str_list_enc(Eina_List *list, int *size_ret);
EAPI int e_ipc_codec_5int_2str_dec(char *data, int bytes, E_Ipc_5Int_2Str **dest);
EAPI void *e_ipc_codec_5int_2str_enc(int val1, int val2, int val3, int val4, int val5, const char *str1, const char *str2, int *size_ret);
EAPI int e_ipc_codec_5int_2str_list_dec(char *data, int bytes, Eina_List **dest);
EAPI void *e_ipc_codec_5int_2str_list_enc(Eina_List *list, int *size_ret);
EAPI int e_ipc_codec_3int_4str_dec(char *data, int bytes, E_Ipc_3Int_4Str **dest);
EAPI void *e_ipc_codec_3int_4str_enc(int val1, int val2, int val3, const char *str1, const char *str2, const char *str3, const char *str4, int *size_ret);
EAPI int e_ipc_codec_3int_4str_list_dec(char *data, int bytes, Eina_List **dest);
EAPI void *e_ipc_codec_3int_4str_list_enc(Eina_List *list, int *size_ret);
EAPI int e_ipc_codec_3int_3str_dec(char *data, int bytes, E_Ipc_3Int_3Str **dest);
EAPI void *e_ipc_codec_3int_3str_enc(int val1, int val2, int val3, const char *str1, const char *str2, const char *str3, int *size_ret);
EAPI int e_ipc_codec_3int_3str_list_dec(char *data, int bytes, Eina_List **dest);
EAPI void *e_ipc_codec_3int_3str_list_enc(Eina_List *list, int *size_ret);
EAPI int e_ipc_codec_str_4int_dec(char *data, int bytes, E_Ipc_Str_4Int **dest);
EAPI void *e_ipc_codec_str_4int_enc(const char *str1, int val1, int val2, int val3, int val4, int *size_ret);
EAPI int e_ipc_codec_str_4int_list_dec(char *data, int bytes, Eina_List **dest);
EAPI void *e_ipc_codec_str_4int_list_enc(Eina_List *list, int *size_ret);
#endif
#endif
#endif

View File

@ -45,12 +45,15 @@ static Eina_Bool _e_main_cb_idle_before(void *data EINA_UNUSED);
static Eina_Bool _e_main_cb_idle_after(void *data EINA_UNUSED);
static Eina_Bool _e_main_cb_idle_flush(void *data EINA_UNUSED);
static Eina_Bool _e_main_cb_bound(void *data, int type EINA_UNUSED, void *event);
static Eina_Bool _e_main_cb_timer(void *data EINA_UNUSED);
static void _e_main_modules_load(Eina_Bool safe_mode);
/* local variables */
static Eina_Bool really_know = EINA_FALSE;
static Eina_Bool locked = EINA_FALSE;
static Eina_Bool inloop = EINA_FALSE;
static Eina_Bool bound = EINA_FALSE;
static Eina_Bool safe_mode = EINA_FALSE;
static jmp_buf wl_fatal_buff;
static int _e_main_lvl = 0;
static int (*_e_main_shutdown_func[MAX_LEVEL])(void);
@ -75,7 +78,6 @@ int
main(int argc, char **argv)
{
Eina_Bool nostartup = EINA_FALSE;
Eina_Bool safe_mode = EINA_FALSE;
Eina_Bool after_restart = EINA_FALSE;
Eina_Bool waslocked = EINA_FALSE;
double t = 0.0, tstart = 0.0;
@ -489,6 +491,33 @@ main(int argc, char **argv)
e_container_all_freeze();
TS("E_Container Freeze Done");
TS("E_Bg Init");
if (!e_bg_init())
{
e_error_message_show(_("Enlightenment cannot setup its background subsystem"));
_e_main_shutdown(-1);
}
TS("E_Bg Init Done");
_e_main_shutdown_push(e_bg_shutdown);
TS("E_Popup Init");
if (!e_popup_init())
{
e_error_message_show(_("Enlightenment cannot setup its popup subsystem"));
_e_main_shutdown(-1);
}
TS("E_Popup Init Done");
_e_main_shutdown_push(e_popup_shutdown);
TS("E_Shelf Init");
if (!e_shelf_init())
{
e_error_message_show(_("Enlightenment cannot setup its shelf subsystem"));
_e_main_shutdown(-1);
}
TS("E_Shelf Init Done");
_e_main_shutdown_push(e_shelf_shutdown);
/* TODO: init other stuff */
_idle_flush = ecore_idle_enterer_add(_e_main_cb_idle_flush, NULL);
@ -497,6 +526,10 @@ main(int argc, char **argv)
e_container_all_thaw();
TS("E_Container Thaw Done");
TS("E_Shelf Config Update");
e_shelf_config_update();
TS("E_Shelf Config Update Done");
_idle_after = ecore_idle_enterer_add(_e_main_cb_idle_after, NULL);
/*** Main Loop ***/
@ -504,6 +537,8 @@ main(int argc, char **argv)
starting = EINA_FALSE;
inloop = EINA_TRUE;
ecore_timer_add(0.25, _e_main_cb_timer, NULL);
e_util_env_set("E_RESTART", "1");
/* TODO: set callback for fatal wayland errors */
@ -705,17 +740,17 @@ _e_main_parse_arguments(int argc, char **argv)
static Eina_Bool
_e_main_cb_signal_exit(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *ev EINA_UNUSED)
{
ecore_main_loop_quit();
/* ecore_main_loop_quit(); */
/* called on ctrl-c, kill (pid) (also SIGINT, SIGTERM and SIGQIT) */
/* e_sys_action_do(E_SYS_EXIT, NULL); */
e_sys_action_do(E_SYS_EXIT, NULL);
return ECORE_CALLBACK_RENEW;
}
static Eina_Bool
_e_main_cb_signal_hup(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *ev EINA_UNUSED)
{
/* e_sys_action_do(E_SYS_RESTART, NULL); */
e_sys_action_do(E_SYS_RESTART, NULL);
return ECORE_CALLBACK_RENEW;
}
@ -1007,9 +1042,16 @@ _e_main_screens_init(void)
if (!e_container_init()) return 0;
TS("\tScreens: zone");
if (!e_zone_init()) return 0;
TS("\tScreens: desk");
if (!e_desk_init()) return 0;
TS("\tScreens: menu");
/* TODO: exehist */
if (!e_menu_init()) return 0;
TS("\tScreens: exehist");
if (!e_exehist_init()) return 0;
EINA_LIST_FOREACH(comp->outputs, l, output)
{
@ -1031,8 +1073,6 @@ _e_main_screens_init(void)
return 0;
}
e_container_show(con);
i++;
}
@ -1042,9 +1082,10 @@ _e_main_screens_init(void)
static int
_e_main_screens_shutdown(void)
{
/* e_menu_shutdown(); */
/* e_desk_shutdown(); */
/* e_zone_shutdown(); */
e_exehist_shutdown();
e_menu_shutdown();
e_desk_shutdown();
e_zone_shutdown();
e_container_shutdown();
e_manager_shutdown();
return 1;
@ -1054,8 +1095,8 @@ static Eina_Bool
_e_main_cb_idle_before(void *data EINA_UNUSED)
{
/* TODO: finish */
e_menu_idler_before();
e_pointer_idler_before();
edje_thaw();
return ECORE_CALLBACK_RENEW;
@ -1082,3 +1123,28 @@ _e_main_cb_bound(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_
bound = EINA_TRUE;
return ECORE_CALLBACK_CANCEL;
}
static Eina_Bool
_e_main_cb_timer(void *data EINA_UNUSED)
{
E_Manager *man;
Eina_List *l;
EINA_LIST_FOREACH(e_manager_list(), l, man)
e_manager_show(man);
_e_main_modules_load(safe_mode);
return EINA_FALSE;
}
static void
_e_main_modules_load(Eina_Bool safe_mode)
{
if (!safe_mode)
e_module_all_load();
else
{
}
}

1759
src/bin/e_wayland/e_menu.c Normal file

File diff suppressed because it is too large Load Diff

167
src/bin/e_wayland/e_menu.h Normal file
View File

@ -0,0 +1,167 @@
#ifdef E_TYPEDEFS
typedef enum _E_Menu_Pop_Direction E_Menu_Pop_Direction;
typedef struct _E_Menu E_Menu;
typedef struct _E_Menu_Item E_Menu_Item;
typedef struct _E_Menu_Category_Callback E_Menu_Category_Callback;
#else
# ifndef E_MENU_H
# define E_MENU_H
# define E_MENU_TYPE 0xE0b01009
# define E_MENU_ITEM_TYPE 0xE0b0100a
enum _E_Menu_Pop_Direction
{
E_MENU_POP_DIRECTION_NONE,
E_MENU_POP_DIRECTION_LEFT,
E_MENU_POP_DIRECTION_RIGHT,
E_MENU_POP_DIRECTION_UP,
E_MENU_POP_DIRECTION_DOWN,
E_MENU_POP_DIRECTION_AUTO,
E_MENU_POP_DIRECTION_LAST
};
typedef void (*E_Menu_Cb) (void *data, E_Menu *m, E_Menu_Item *mi);
struct _E_Menu
{
E_Object e_obj_inherit;
Ecore_Evas *ee;
Evas *evas;
Evas_Object *o_bg, *o_con;
E_Zone *zone;
E_Menu_Item *parent_item;
Eina_List *items;
unsigned int id;
const char *category;
struct
{
int x, y, w, h;
Eina_Bool visible : 1;
} cur, prev;
int frozen;
int cx, cy, cw, ch;
struct
{
const char *title, *icon_file;
Evas_Object *icon;
} header;
struct
{
void *data;
void (*func) (void *data, E_Menu *m);
} pre_activate_cb, post_deactivate_cb;
Eina_Bool fast_mouse : 1;
Eina_Bool shaped : 1;
Eina_Bool realized : 1;
Eina_Bool active : 1;
Eina_Bool changed : 1;
Eina_Bool have_submenu : 1;
Eina_Bool pending_new_submenu : 1;
};
struct _E_Menu_Item
{
E_Object e_obj_inherit;
E_Menu *menu, *submenu;
Evas_Object *o_bg, *o_con;
Evas_Object *o_separator;
Evas_Object *o_icon_bg, *o_icon;
Evas_Object *o_lbl, *o_toggle;
Evas_Object *o_submenu, *o_event;
int x, y, w, h;
const char *icon, *icon_key;
const char *label;
int lw, lh, iw, ih;
int sepw, seph, subw, subh;
int tw, th;
struct
{
void *data;
E_Menu_Cb func;
} cb, realize_cb;
struct
{
void *data;
E_Menu_Cb func;
} submenu_pre_cb, submenu_post_cb;
Eina_Bool separator : 1;
Eina_Bool radio : 1;
Eina_Bool radio_group : 1;
Eina_Bool check : 1;
Eina_Bool toggle : 1;
Eina_Bool changed : 1;
Eina_Bool active : 1;
Eina_Bool disabled : 1;
};
struct _E_Menu_Category_Callback
{
const char *category;
void *data;
void (*create) (E_Menu *m, void *category_data, void *data);
void (*free) (void *data);
};
EINTERN int e_menu_init(void);
EINTERN int e_menu_shutdown(void);
EAPI E_Menu *e_menu_new(void);
EAPI void e_menu_activate_key(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir);
EAPI void e_menu_activate_mouse(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir, unsigned int activate_time);
EAPI void e_menu_activate(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir);
EAPI void e_menu_deactivate(E_Menu *m);
EAPI int e_menu_freeze(E_Menu *m);
EAPI int e_menu_thaw(E_Menu *m);
EAPI void e_menu_title_set(E_Menu *m, char *title);
EAPI void e_menu_icon_file_set(E_Menu *m, char *icon);
EAPI void e_menu_category_set(E_Menu *m, char *category);
EAPI void e_menu_category_data_set(char *category, void *data);
EAPI E_Menu_Category_Callback *e_menu_category_callback_add(char *category, void (*create) (E_Menu *m, void *category_data, void *data), void (free) (void *data), void *data);
EAPI void e_menu_category_callback_del(E_Menu_Category_Callback *cb);
EAPI void e_menu_pre_activate_callback_set(E_Menu *m, void (*func) (void *data, E_Menu *m), void *data);
EAPI void e_menu_post_deactivate_callback_set(E_Menu *m, void (*func) (void *data, E_Menu *m), void *data);
EAPI E_Menu *e_menu_root_get(E_Menu *m);
EAPI void e_menu_idler_before(void);
EAPI E_Menu_Item *e_menu_item_new(E_Menu *m);
EAPI E_Menu_Item *e_menu_item_new_relative(E_Menu *m, E_Menu_Item *rel);
EAPI E_Menu_Item *e_menu_item_nth(E_Menu *m, int n);
EAPI int e_menu_item_num_get(const E_Menu_Item *mi);
EAPI void e_menu_item_icon_file_set(E_Menu_Item *mi, const char *icon);
EAPI void e_menu_item_icon_edje_set(E_Menu_Item *mi, const char *icon, const char *key);
EAPI void e_menu_item_label_set(E_Menu_Item *mi, const char *label);
EAPI void e_menu_item_submenu_set(E_Menu_Item *mi, E_Menu *sub);
EAPI void e_menu_item_separator_set(E_Menu_Item *mi, int sep);
EAPI void e_menu_item_check_set(E_Menu_Item *mi, int chk);
EAPI void e_menu_item_radio_set(E_Menu_Item *mi, int rad);
EAPI void e_menu_item_radio_group_set(E_Menu_Item *mi, int radg);
EAPI void e_menu_item_toggle_set(E_Menu_Item *mi, int tog);
EAPI int e_menu_item_toggle_get(E_Menu_Item *mi);
EAPI void e_menu_item_callback_set(E_Menu_Item *mi, E_Menu_Cb func, void *data);
EAPI void e_menu_item_realize_callback_set(E_Menu_Item *mi, E_Menu_Cb func, void *data);
EAPI void e_menu_item_submenu_pre_callback_set(E_Menu_Item *mi, E_Menu_Cb func, void *data);
EAPI void e_menu_item_submenu_post_callback_set(E_Menu_Item *mi, E_Menu_Cb func, void *data);
EAPI void e_menu_item_drag_callback_set(E_Menu_Item *mi, E_Menu_Cb func, void *data);
EAPI void e_menu_item_active_set(E_Menu_Item *mi, int active);
EAPI void e_menu_item_disabled_set(E_Menu_Item *mi, int disable);
# endif
#endif

View File

@ -239,11 +239,15 @@ e_module_all_load(void)
e_util_env_set("E_MODULE_LOAD", em->name);
snprintf(buf, sizeof(buf), _("Loading Module: %s"), em->name);
/* FIXME: Wayland */
/* e_init_status_set(buf); */
m = e_module_new(em->name);
if (m) e_module_enable(m);
if (!(m = e_module_find(em->name)))
{
if ((m = e_module_new(em->name)))
e_module_enable(m);
}
}
}

View File

@ -0,0 +1,163 @@
#include "e.h"
/* local function prototypes */
static void _e_obj_dialog_cb_free(E_Obj_Dialog *od);
static void _e_obj_dialog_cb_delete(E_Win *win);
static void _e_obj_dialog_cb_close(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _e_obj_dialog_cb_resize(E_Win *win);
EAPI E_Obj_Dialog *
e_obj_dialog_new(E_Container *con, char *title, char *class_name, char *class_class)
{
E_Obj_Dialog *od;
E_Manager *man;
Evas_Object *o;
if (!con)
{
man = e_manager_current_get();
if (!man) return NULL;
con = e_container_current_get(man);
if (!con) con = e_container_number_get(man, 0);
if (!con) return NULL;
}
od = E_OBJECT_ALLOC(E_Obj_Dialog, E_OBJ_DIALOG_TYPE, _e_obj_dialog_cb_free);
if (!od) return NULL;
od->win = e_win_new(con);
if (!od->win)
{
free(od);
return NULL;
}
e_win_delete_callback_set(od->win, _e_obj_dialog_cb_delete);
e_win_resize_callback_set(od->win, _e_obj_dialog_cb_resize);
od->win->data = od;
e_win_dialog_set(od->win, 1);
e_win_name_class_set(od->win, class_name, class_class);
e_win_title_set(od->win, title);
o = edje_object_add(e_win_evas_get(od->win));
od->o_bg = o;
e_win_centered_set(od->win, 1);
od->cb_delete = NULL;
return od;
}
EAPI void
e_obj_dialog_cb_delete_set(E_Obj_Dialog *od, void (*func)(E_Obj_Dialog *od))
{
od->cb_delete = func;
}
EAPI void
e_obj_dialog_icon_set(E_Obj_Dialog *od __UNUSED__, char *icon __UNUSED__)
{
/* E_OBJECT_CHECK(od); */
/* E_OBJECT_TYPE_CHECK(od, E_OBJ_DIALOG_TYPE); */
/* if (od->win->border->internal_icon) */
/* { */
/* eina_stringshare_del(od->win->border->internal_icon); */
/* od->win->border->internal_icon = NULL; */
/* } */
/* if (icon) */
/* od->win->border->internal_icon = eina_stringshare_add(icon); */
}
EAPI void
e_obj_dialog_show(E_Obj_Dialog *od)
{
Evas_Coord w, h, mw, mh;
const char *s;
E_OBJECT_CHECK(od);
E_OBJECT_TYPE_CHECK(od, E_OBJ_DIALOG_TYPE);
edje_object_size_min_get(od->o_bg, &mw, &mh);
edje_object_size_min_restricted_calc(od->o_bg, &mw, &mh, mw, mh);
evas_object_resize(od->o_bg, mw, mh);
e_win_resize(od->win, mw, mh);
e_win_size_min_set(od->win, mw, mh);
edje_object_size_max_get(od->o_bg, &w, &h);
if ((w > 0) && (h > 0))
{
if (w < mw) w = mw;
if (h < mh) h = mh;
e_win_size_max_set(od->win, w, h);
}
s = edje_object_data_get(od->o_bg, "borderless");
if (s && (!strcmp(s, "1")))
e_win_borderless_set(od->win, 1);
s = edje_object_data_get(od->o_bg, "shaped");
if (s && (!strcmp(s, "1")))
e_win_shaped_set(od->win, 1);
e_win_show(od->win);
}
EAPI void
e_obj_dialog_obj_part_text_set(E_Obj_Dialog *od, char *part, char *text)
{
E_OBJECT_CHECK(od);
E_OBJECT_TYPE_CHECK(od, E_OBJ_DIALOG_TYPE);
edje_object_part_text_set(od->o_bg, part, text);
}
EAPI void
e_obj_dialog_obj_theme_set(E_Obj_Dialog *od, char *theme_cat, char *theme_obj)
{
E_OBJECT_CHECK(od);
E_OBJECT_TYPE_CHECK(od, E_OBJ_DIALOG_TYPE);
e_theme_edje_object_set(od->o_bg, theme_cat, theme_obj);
evas_object_move(od->o_bg, 0, 0);
evas_object_show(od->o_bg);
edje_object_signal_callback_add(od->o_bg, "e,action,close", "",
_e_obj_dialog_cb_close, od);
}
/* local subsystem functions */
static void
_e_obj_dialog_cb_free(E_Obj_Dialog *od)
{
if (od->o_bg) evas_object_del(od->o_bg);
e_object_del(E_OBJECT(od->win));
free(od);
}
static void
_e_obj_dialog_cb_delete(E_Win *win)
{
E_Obj_Dialog *od;
od = win->data;
if (od->cb_delete)
od->cb_delete(od);
e_object_del(E_OBJECT(od));
}
static void
_e_obj_dialog_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
E_Obj_Dialog *od;
od = data;
if (od->cb_delete)
od->cb_delete(od);
e_util_defer_object_del(E_OBJECT(od));
}
static void
_e_obj_dialog_cb_resize(E_Win *win)
{
E_Obj_Dialog *od;
od = win->data;
evas_object_resize(od->o_bg, od->win->w, od->win->h);
}

View File

@ -0,0 +1,29 @@
#ifdef E_TYPEDEFS
typedef struct _E_Obj_Dialog E_Obj_Dialog;
#else
# ifndef E_OBJ_DIALOG_H
# define E_OBJ_DIALOG_H
# define E_OBJ_DIALOG_TYPE 0xE0b0101b
struct _E_Obj_Dialog
{
E_Object e_obj_inherit;
E_Win *win;
Evas_Object *o_bg;
void *data;
void (*cb_delete)(E_Obj_Dialog *od);
};
EAPI E_Obj_Dialog *e_obj_dialog_new(E_Container *con, char *title, char *class_name, char *class_class);
EAPI void e_obj_dialog_icon_set(E_Obj_Dialog *od __UNUSED__, char *icon __UNUSED__);
EAPI void e_obj_dialog_show(E_Obj_Dialog *od);
EAPI void e_obj_dialog_obj_part_text_set(E_Obj_Dialog *od, char *part, char *text);
EAPI void e_obj_dialog_obj_theme_set(E_Obj_Dialog *od, char *theme_cat, char *theme_obj);
EAPI void e_obj_dialog_cb_delete_set(E_Obj_Dialog *od, void (*func)(E_Obj_Dialog *od));
#endif
#endif

View File

@ -68,8 +68,6 @@ e_output_repaint(E_Output *output, unsigned int secs)
Eina_List *l;
struct wl_list frames;
printf("Output Repaint\n");
comp = output->compositor;
EINA_LIST_FOREACH(comp->surfaces, l, es)
@ -118,8 +116,6 @@ e_output_repaint_schedule(E_Output *output)
E_Compositor *comp;
struct wl_event_loop *loop;
printf("Output Repaint Schedule\n");
comp = output->compositor;
loop = wl_display_get_event_loop(comp->wl.display);

195
src/bin/e_wayland/e_popup.c Normal file
View File

@ -0,0 +1,195 @@
#include "e.h"
/* local function prototypes */
static void _e_popup_cb_free(E_Popup *pop);
/* local variables */
static Eina_Hash *_popups = NULL;
EINTERN int
e_popup_init(void)
{
if (!_popups) _popups = eina_hash_string_superfast_new(NULL);
return 1;
}
EINTERN int
e_popup_shutdown(void)
{
if (_popups) eina_hash_free(_popups);
_popups = NULL;
return 1;
}
EAPI E_Popup *
e_popup_new(E_Zone *zone, int x, int y, int w, int h)
{
E_Popup *p;
Ecore_Wl_Window *win = NULL;
unsigned int parent = 0;
p = E_OBJECT_ALLOC(E_Popup, E_POPUP_TYPE, _e_popup_cb_free);
if (!p) return NULL;
p->zone = zone;
p->x = x;
p->y = y;
p->w = w;
p->h = h;
if (p->zone->container)
{
if ((win = ecore_evas_wayland_window_get(zone->container->bg_ee)))
parent = win->id;
}
p->ee =
e_canvas_new(parent, zone->x + p->x, zone->y + p->y,
p->w, p->h, EINA_TRUE, EINA_FALSE, NULL);
if (!p->ee)
{
free(p);
return NULL;
}
e_canvas_add(p->ee);
p->evas = ecore_evas_get(p->ee);
/* TODO: window raise ? */
ecore_evas_name_class_set(p->ee, "E", "_e_popup_window");
ecore_evas_title_set(p->ee, "E Popup");
e_object_ref(E_OBJECT(p->zone));
zone->popups = eina_list_append(zone->popups, p);
win = ecore_evas_wayland_window_get(p->ee);
eina_hash_add(_popups, e_util_winid_str_get(win), p);
return p;
}
EAPI void
e_popup_show(E_Popup *pop)
{
if (pop->visible) return;
pop->visible = EINA_TRUE;
ecore_evas_show(pop->ee);
}
EAPI void
e_popup_hide(E_Popup *pop)
{
if (!pop->visible) return;
pop->visible = EINA_FALSE;
ecore_evas_hide(pop->ee);
}
EAPI void
e_popup_move(E_Popup *pop, int x, int y)
{
if ((pop->x == x) && (pop->y == y)) return;
pop->x = x;
pop->y = y;
ecore_evas_move(pop->ee, pop->zone->x + x, pop->zone->y + y);
}
EAPI void
e_popup_resize(E_Popup *pop, int w, int h)
{
if ((pop->w == w) && (pop->h == h)) return;
pop->w = w;
pop->h = h;
ecore_evas_resize(pop->ee, w, h);
}
EAPI void
e_popup_move_resize(E_Popup *pop, int x, int y, int w, int h)
{
if ((pop->x == x) && (pop->y == y) && (pop->w == w) && (pop->h == h))
return;
pop->x = x;
pop->y = y;
pop->w = w;
pop->h = h;
ecore_evas_move_resize(pop->ee, pop->zone->x + x, pop->zone->y + y, w, h);
}
EAPI void
e_popup_layer_set(E_Popup *pop, int layer)
{
pop->layer = layer;
}
EAPI void
e_popup_name_set(E_Popup *pop, const char *name)
{
if (eina_stringshare_replace(&pop->name, name))
ecore_evas_name_class_set(pop->ee, "E", pop->name);
}
EAPI void
e_popup_ignore_events_set(E_Popup *pop, Eina_Bool ignore)
{
ecore_evas_ignore_events_set(pop->ee, ignore);
}
EAPI void
e_popup_edje_bg_object_set(E_Popup *pop, Evas_Object *obj)
{
const char *shaped;
if ((shaped = edje_object_data_get(obj, "shaped")))
{
if (!strcmp(shaped, "1"))
pop->shaped = EINA_TRUE;
else
pop->shaped = EINA_FALSE;
ecore_evas_alpha_set(pop->ee, pop->shaped);
}
else
ecore_evas_shaped_set(pop->ee, pop->shaped);
}
EAPI void
e_popup_idler_before(void)
{
}
EAPI E_Popup *
e_popup_find_by_window(Ecore_Wl_Window *win)
{
E_Popup *pop;
if ((pop = eina_hash_find(_popups, e_util_winid_str_get(win))))
{
Ecore_Wl_Window *w;
if ((w = ecore_evas_wayland_window_get(pop->ee)))
if (w != win)
return NULL;
}
return pop;
}
/* local functions */
static void
_e_popup_cb_free(E_Popup *pop)
{
Ecore_Wl_Window *win;
win = ecore_evas_wayland_window_get(pop->ee);
e_canvas_del(pop->ee);
ecore_evas_free(pop->ee);
e_object_unref(E_OBJECT(pop->zone));
pop->zone->popups = eina_list_remove(pop->zone->popups, pop);
eina_hash_del(_popups, e_util_winid_str_get(win), pop);
if (pop->name) eina_stringshare_del(pop->name);
pop->name = NULL;
free(pop);
}

View File

@ -0,0 +1,44 @@
#ifdef E_TYPEDEFS
typedef struct _E_Popup E_Popup;
#else
# ifndef E_POPUP_H
# define E_POPUP_H
# define E_POPUP_TYPE 0xE0b0100e
struct _E_Popup
{
E_Object e_obj_inherit;
int x, y, w, h;
int layer;
const char *name;
Ecore_Evas *ee;
Evas *evas;
E_Zone *zone;
Eina_Bool visible : 1;
Eina_Bool shaped : 1;
};
EINTERN int e_popup_init(void);
EINTERN int e_popup_shutdown(void);
EAPI E_Popup *e_popup_new(E_Zone *zone, int x, int y, int w, int h);
EAPI void e_popup_show(E_Popup *pop);
EAPI void e_popup_hide(E_Popup *pop);
EAPI void e_popup_move(E_Popup *pop, int x, int y);
EAPI void e_popup_resize(E_Popup *pop, int w, int h);
EAPI void e_popup_move_resize(E_Popup *pop, int x, int y, int w, int h);
EAPI void e_popup_layer_set(E_Popup *pop, int layer);
EAPI void e_popup_name_set(E_Popup *pop, const char *name);
EAPI void e_popup_ignore_events_set(E_Popup *pop, Eina_Bool ignore);
EAPI void e_popup_edje_bg_object_set(E_Popup *pop, Evas_Object *obj);
EAPI void e_popup_idler_before(void);
EAPI E_Popup *e_popup_find_by_window(Ecore_Wl_Window *win);
# endif
#endif

View File

@ -89,11 +89,7 @@ _e_renderer_region_repaint(E_Surface *surface, E_Output *output, pixman_region32
E_Renderer_Surface_State *surf_state;
pixman_region32_t fregion;
pixman_box32_t *ext;
// pixman_fixed_t fw = 0, fh = 0;
printf("E_Renderer Region Repaint\n");
// rend = output->compositor->renderer;
out_state = output->state;
surf_state = surface->state;
@ -109,9 +105,9 @@ _e_renderer_region_repaint(E_Surface *surface, E_Output *output, pixman_region32
pixman_region32_copy(&fregion, region);
ext = pixman_region32_extents(&fregion);
printf("\tRepainting Region: %d %d %d %d\n",
ext->x1, ext->y1, (ext->x2 - ext->x1),
(ext->y2 - ext->y1));
/* printf("\tRepainting Region: %d %d %d %d\n", */
/* ext->x1, ext->y1, (ext->x2 - ext->x1), */
/* (ext->y2 - ext->y1)); */
/* global to output ? */
@ -133,16 +129,11 @@ _e_renderer_surfaces_repaint(E_Output *output, pixman_region32_t *damage)
Eina_List *l;
E_Surface *es;
printf("E_Renderer Surfaces Repaint\n");
comp = output->compositor;
EINA_LIST_FOREACH(comp->surfaces, l, es)
{
if (es->plane == &comp->plane)
{
printf("\tDraw Surface: %p\n", es);
_e_renderer_surface_draw(es, output, damage);
}
_e_renderer_surface_draw(es, output, damage);
}
}
@ -169,8 +160,6 @@ _e_renderer_surface_draw(E_Surface *surface, E_Output *output, pixman_region32_t
return;
}
printf("E_Renderer Surface Draw: %p\n", surface);
/* TODO: handle transforms ? */
pixman_region32_init_rect(&blend, 0, 0,
@ -195,8 +184,6 @@ _e_renderer_cb_pixels_read(E_Output *output, int format, void *pixels, Evas_Coor
E_Renderer_Output_State *state;
pixman_image_t *buffer;
printf("E_Renderer Pixels Read\n");
if (!(state = output->state)) return EINA_FALSE;
if (!state->hw_buffer) return EINA_FALSE;
@ -219,8 +206,6 @@ _e_renderer_cb_output_buffer_set(E_Output *output, pixman_image_t *buffer)
{
E_Renderer_Output_State *state;
printf("E_Renderer Output Buffer Set\n");
state = output->state;
if (state->hw_buffer) pixman_image_unref(state->hw_buffer);
state->hw_buffer = buffer;
@ -237,8 +222,6 @@ _e_renderer_cb_output_repaint(E_Output *output, pixman_region32_t *damage)
E_Renderer_Output_State *state;
pixman_region32_t region;
printf("E_Renderer Output Repaint\n");
state = output->state;
if (!state->hw_buffer) return;
@ -265,7 +248,7 @@ _e_renderer_cb_output_repaint(E_Output *output, pixman_region32_t *damage)
static void
_e_renderer_cb_damage_flush(E_Surface *surface)
{
printf("E_Renderer Damage Flush\n");
}
static void
@ -286,8 +269,6 @@ _e_renderer_cb_attach(E_Surface *surface, struct wl_buffer *buffer)
if (!buffer) return;
printf("E_Renderer Attach\n");
switch (wl_shm_buffer_get_format(buffer))
{
case WL_SHM_FORMAT_XRGB8888:
@ -340,7 +321,7 @@ _e_renderer_cb_output_create(E_Output *output, unsigned int window)
static void
_e_renderer_cb_output_destroy(E_Output *output)
{
printf("E_Renderer Output Destroy\n");
}
static Eina_Bool
@ -381,5 +362,5 @@ _e_renderer_cb_surface_color_set(E_Surface *surface, int r, int g, int b, int a)
static void
_e_renderer_cb_destroy(E_Compositor *comp)
{
printf("E_Renderer Destroy\n");
}

1029
src/bin/e_wayland/e_shelf.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,57 @@
#ifdef E_TYPEDEFS
typedef struct _E_Shelf E_Shelf;
#else
# ifndef E_SHELF_H
# define E_SHELF_H
# define E_SHELF_TYPE 0xE0b0101e
struct _E_Shelf
{
E_Object e_obj_inherit;
int id;
int x, y, w, h;
int layer, size;
const char *name, *style;
E_Popup *popup;
E_Zone *zone;
E_Gadcon *gadcon;
Ecore_Evas *ee;
Evas *evas;
Evas_Object *o_base, *o_event;
E_Config_Shelf *cfg;
Eina_Bool fit_along : 1;
Eina_Bool fit_size : 1;
Eina_Bool hidden : 1;
Eina_Bool toggle : 1;
Eina_Bool edge : 1;
Eina_Bool urgent_show : 1;
Eina_Bool locked : 1;
};
EINTERN int e_shelf_init(void);
EINTERN int e_shelf_shutdown(void);
EAPI void e_shelf_config_update(void);
EAPI E_Shelf *e_shelf_config_new(E_Zone *zone, E_Config_Shelf *cfg);
EAPI E_Shelf *e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, int layer, int id);
EAPI void e_shelf_show(E_Shelf *es);
EAPI void e_shelf_hide(E_Shelf *es);
EAPI void e_shelf_toggle(E_Shelf *es, Eina_Bool show);
EAPI void e_shelf_populate(E_Shelf *es);
EAPI void e_shelf_position_calc(E_Shelf *es);
EAPI void e_shelf_move_resize(E_Shelf *es, int x, int y, int w, int h);
EAPI Eina_List *e_shelf_list(void);
EAPI const char *e_shelf_orient_string_get(E_Shelf *es);
EAPI void e_shelf_orient(E_Shelf *es, E_Gadcon_Orient orient);
# endif
#endif

View File

@ -179,15 +179,10 @@ e_surface_repaint_schedule(E_Surface *es)
E_Output *output;
Eina_List *l;
printf("E_Surface Repaint Schedule\n");
EINA_LIST_FOREACH(_e_comp->outputs, l, output)
{
if ((es->output == output) || (es->output_mask & (1 << output->id)))
{
printf("\tSchedule Output Repaint\n");
e_output_repaint_schedule(output);
}
e_output_repaint_schedule(output);
}
}

701
src/bin/e_wayland/e_sys.c Normal file
View File

@ -0,0 +1,701 @@
#include "e.h"
/* local subsystem functions */
static Eina_Bool _e_sys_cb_timer(void *data);
static Eina_Bool _e_sys_cb_exit(void *data, int type, void *event);
static void _e_sys_cb_logout_logout(void *data, E_Dialog *dia);
static void _e_sys_cb_logout_wait(void *data, E_Dialog *dia);
static void _e_sys_cb_logout_abort(void *data, E_Dialog *dia);
static Eina_Bool _e_sys_cb_logout_timer(void *data);
static void _e_sys_logout_after(void);
static void _e_sys_logout_begin(E_Sys_Action a_after);
static void _e_sys_current_action(void);
static void _e_sys_action_failed(void);
static int _e_sys_action_do(E_Sys_Action a, char *param);
static void _e_sys_dialog_cb_delete(E_Obj_Dialog * od);
static Ecore_Event_Handler *_e_sys_exe_exit_handler = NULL;
static Ecore_Exe *_e_sys_halt_check_exe = NULL;
static Ecore_Exe *_e_sys_reboot_check_exe = NULL;
static Ecore_Exe *_e_sys_suspend_check_exe = NULL;
static Ecore_Exe *_e_sys_hibernate_check_exe = NULL;
static int _e_sys_can_halt = 0;
static int _e_sys_can_reboot = 0;
static int _e_sys_can_suspend = 0;
static int _e_sys_can_hibernate = 0;
static E_Sys_Action _e_sys_action_current = E_SYS_NONE;
static E_Sys_Action _e_sys_action_after = E_SYS_NONE;
static Ecore_Exe *_e_sys_exe = NULL;
static double _e_sys_begin_time = 0.0;
static double _e_sys_logout_begin_time = 0.0;
static Ecore_Timer *_e_sys_logout_timer = NULL;
static E_Obj_Dialog *_e_sys_dialog = NULL;
static E_Dialog *_e_sys_logout_confirm_dialog = NULL;
static const int E_LOGOUT_AUTO_TIME = 60;
static const int E_LOGOUT_WAIT_TIME = 15;
/* externally accessible functions */
EINTERN int
e_sys_init(void)
{
/* this is not optimal - but it does work cleanly */
_e_sys_exe_exit_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
_e_sys_cb_exit, NULL);
/* delay this for 1.0 seconds while the rest of e starts up */
ecore_timer_add(1.0, _e_sys_cb_timer, NULL);
return 1;
}
EINTERN int
e_sys_shutdown(void)
{
if (_e_sys_exe_exit_handler)
ecore_event_handler_del(_e_sys_exe_exit_handler);
_e_sys_exe_exit_handler = NULL;
_e_sys_halt_check_exe = NULL;
_e_sys_reboot_check_exe = NULL;
_e_sys_suspend_check_exe = NULL;
_e_sys_hibernate_check_exe = NULL;
return 1;
}
EAPI int
e_sys_action_possible_get(E_Sys_Action a)
{
switch (a)
{
case E_SYS_EXIT:
case E_SYS_RESTART:
case E_SYS_EXIT_NOW:
return 1;
case E_SYS_LOGOUT:
return 1;
case E_SYS_HALT:
case E_SYS_HALT_NOW:
return _e_sys_can_halt;
case E_SYS_REBOOT:
return _e_sys_can_reboot;
case E_SYS_SUSPEND:
return _e_sys_can_suspend;
case E_SYS_HIBERNATE:
return _e_sys_can_hibernate;
default:
return 0;
}
return 0;
}
EAPI int
e_sys_action_do(E_Sys_Action a, char *param)
{
int ret = 0;
if (_e_sys_action_current != E_SYS_NONE)
{
_e_sys_current_action();
return 0;
}
switch (a)
{
case E_SYS_EXIT:
case E_SYS_RESTART:
case E_SYS_EXIT_NOW:
case E_SYS_LOGOUT:
case E_SYS_SUSPEND:
case E_SYS_HIBERNATE:
case E_SYS_HALT_NOW:
ret = _e_sys_action_do(a, param);
break;
case E_SYS_HALT:
case E_SYS_REBOOT:
if (!e_util_immortal_check()) _e_sys_logout_begin(a);
return 1;
break;
default:
break;
}
if (ret) _e_sys_action_current = a;
else _e_sys_action_current = E_SYS_NONE;
return ret;
}
static Eina_List *extra_actions = NULL;
EAPI E_Sys_Con_Action *
e_sys_con_extra_action_register(const char *label,
const char *icon_group,
const char *button_name,
void (*func) (void *data),
const void *data)
{
E_Sys_Con_Action *sca;
sca = E_NEW(E_Sys_Con_Action, 1);
if (label)
sca->label = eina_stringshare_add(label);
if (icon_group)
sca->icon_group = eina_stringshare_add(icon_group);
if (button_name)
sca->button_name = eina_stringshare_add(button_name);
sca->func = func;
sca->data = data;
extra_actions = eina_list_append(extra_actions, sca);
return sca;
}
EAPI void
e_sys_con_extra_action_unregister(E_Sys_Con_Action *sca)
{
extra_actions = eina_list_remove(extra_actions, sca);
if (sca->label) eina_stringshare_del(sca->label);
if (sca->icon_group) eina_stringshare_del(sca->icon_group);
if (sca->button_name) eina_stringshare_del(sca->button_name);
free(sca);
}
EAPI const Eina_List *
e_sys_con_extra_action_list_get(void)
{
return extra_actions;
}
/* local subsystem functions */
static Eina_Bool
_e_sys_cb_timer(void *data __UNUSED__)
{
/* exec out sys helper and ask it to test if we are allowed to do these
* things
*/
char buf[PATH_MAX];
// e_init_status_set(_("Checking System Permissions"));
snprintf(buf, sizeof(buf),
"%s/enlightenment/utils/enlightenment_sys -t halt",
e_prefix_lib_get());
_e_sys_halt_check_exe = ecore_exe_run(buf, NULL);
snprintf(buf, sizeof(buf),
"%s/enlightenment/utils/enlightenment_sys -t reboot",
e_prefix_lib_get());
_e_sys_reboot_check_exe = ecore_exe_run(buf, NULL);
snprintf(buf, sizeof(buf),
"%s/enlightenment/utils/enlightenment_sys -t suspend",
e_prefix_lib_get());
_e_sys_suspend_check_exe = ecore_exe_run(buf, NULL);
snprintf(buf, sizeof(buf),
"%s/enlightenment/utils/enlightenment_sys -t hibernate",
e_prefix_lib_get());
_e_sys_hibernate_check_exe = ecore_exe_run(buf, NULL);
return ECORE_CALLBACK_CANCEL;
}
static Eina_Bool
_e_sys_cb_exit(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Exe_Event_Del *ev;
ev = event;
if ((_e_sys_exe) && (ev->exe == _e_sys_exe))
{
if (ev->exit_code != 0) _e_sys_action_failed();
if (((_e_sys_action_current != E_SYS_HALT) &&
(_e_sys_action_current != E_SYS_HALT_NOW) &&
(_e_sys_action_current != E_SYS_REBOOT)) ||
(ev->exit_code != 0))
{
if (_e_sys_dialog)
{
e_object_del(E_OBJECT(_e_sys_dialog));
_e_sys_dialog = NULL;
}
}
_e_sys_action_current = E_SYS_NONE;
_e_sys_exe = NULL;
return ECORE_CALLBACK_RENEW;
}
if ((_e_sys_halt_check_exe) && (ev->exe == _e_sys_halt_check_exe))
{
// e_init_status_set(_("System Check Done"));
/* exit_code: 0 == OK, 5 == suid root removed, 7 == group id error
* 10 == permission denied, 20 == action undefined */
if (ev->exit_code == 0)
{
_e_sys_can_halt = 1;
_e_sys_halt_check_exe = NULL;
}
}
else if ((_e_sys_reboot_check_exe) && (ev->exe == _e_sys_reboot_check_exe))
{
// e_init_status_set(_("System Check Done"));
if (ev->exit_code == 0)
{
_e_sys_can_reboot = 1;
_e_sys_reboot_check_exe = NULL;
}
}
else if ((_e_sys_suspend_check_exe) && (ev->exe == _e_sys_suspend_check_exe))
{
// e_init_status_set(_("System Check Done"));
if (ev->exit_code == 0)
{
_e_sys_can_suspend = 1;
_e_sys_suspend_check_exe = NULL;
}
}
else if ((_e_sys_hibernate_check_exe) && (ev->exe == _e_sys_hibernate_check_exe))
{
// e_init_status_set(_("System Check Done"));
if (ev->exit_code == 0)
{
_e_sys_can_hibernate = 1;
_e_sys_hibernate_check_exe = NULL;
}
}
return ECORE_CALLBACK_RENEW;
}
static void
_e_sys_cb_logout_logout(void *data __UNUSED__, E_Dialog *dia)
{
if (_e_sys_logout_timer)
{
ecore_timer_del(_e_sys_logout_timer);
_e_sys_logout_timer = NULL;
}
_e_sys_logout_begin_time = 0.0;
_e_sys_logout_after();
e_object_del(E_OBJECT(dia));
_e_sys_logout_confirm_dialog = NULL;
}
static void
_e_sys_cb_logout_wait(void *data __UNUSED__, E_Dialog *dia)
{
if (_e_sys_logout_timer) ecore_timer_del(_e_sys_logout_timer);
_e_sys_logout_timer = ecore_timer_add(0.5, _e_sys_cb_logout_timer, NULL);
_e_sys_logout_begin_time = ecore_time_get();
e_object_del(E_OBJECT(dia));
_e_sys_logout_confirm_dialog = NULL;
}
static void
_e_sys_cb_logout_abort(void *data __UNUSED__, E_Dialog *dia)
{
if (_e_sys_logout_timer)
{
ecore_timer_del(_e_sys_logout_timer);
_e_sys_logout_timer = NULL;
}
_e_sys_logout_begin_time = 0.0;
e_object_del(E_OBJECT(dia));
_e_sys_logout_confirm_dialog = NULL;
_e_sys_action_current = E_SYS_NONE;
_e_sys_action_after = E_SYS_NONE;
if (_e_sys_dialog)
{
e_object_del(E_OBJECT(_e_sys_dialog));
_e_sys_dialog = NULL;
}
}
static void
_e_sys_logout_confirm_dialog_update(int remaining)
{
char txt[PATH_MAX];
if (!_e_sys_logout_confirm_dialog)
{
fputs("ERROR: updating logout confirm dialog, but none exists!\n",
stderr);
return;
}
snprintf(txt, sizeof(txt),
_("Logout is taking too long.<br>"
"Some applications refuse to close.<br>"
"Do you want to finish the logout<br>"
"anyway without closing these<br>"
"applications first?<br><br>"
"Auto logout in %d seconds."), remaining);
e_dialog_text_set(_e_sys_logout_confirm_dialog, txt);
}
static Eina_Bool
_e_sys_cb_logout_timer(void *data __UNUSED__)
{
/* Eina_List *l; */
/* E_Border *bd; */
int pending = 0;
/* EINA_LIST_FOREACH(e_border_client_list(), l, bd) */
/* { */
/* if (!bd->internal) pending++; */
/* } */
if (pending == 0) goto after;
else if (_e_sys_logout_confirm_dialog)
{
int remaining;
remaining = E_LOGOUT_AUTO_TIME -
round(ecore_loop_time_get() - _e_sys_logout_begin_time);
/* it has taken 60 (E_LOGOUT_AUTO_TIME) seconds of waiting the
* confirm dialog and we still have apps that will not go
* away. Do the action as user may be far away or forgot it.
*
* NOTE: this is the behavior for many operating systems and I
* guess the reason is people that hit "shutdown" and
* put their laptops in their backpacks in the hope
* everything will be turned off properly.
*/
if (remaining > 0)
{
_e_sys_logout_confirm_dialog_update(remaining);
return ECORE_CALLBACK_RENEW;
}
else
{
_e_sys_cb_logout_logout(NULL, _e_sys_logout_confirm_dialog);
return ECORE_CALLBACK_CANCEL;
}
}
else
{
/* it has taken 15 seconds of waiting and we still have apps that
* will not go away
*/
double now = ecore_loop_time_get();
if ((now - _e_sys_logout_begin_time) > E_LOGOUT_WAIT_TIME)
{
E_Dialog *dia;
dia = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", "_sys_error_logout_slow");
if (dia)
{
_e_sys_logout_confirm_dialog = dia;
e_dialog_title_set(dia, _("Logout problems"));
e_dialog_icon_set(dia, "system-log-out", 64);
e_dialog_button_add(dia, _("Logout now"), NULL,
_e_sys_cb_logout_logout, NULL);
e_dialog_button_add(dia, _("Wait longer"), NULL,
_e_sys_cb_logout_wait, NULL);
e_dialog_button_add(dia, _("Cancel Logout"), NULL,
_e_sys_cb_logout_abort, NULL);
e_dialog_button_focus_num(dia, 1);
_e_sys_logout_confirm_dialog_update(E_LOGOUT_AUTO_TIME);
e_win_centered_set(dia->win, 1);
e_dialog_show(dia);
_e_sys_logout_begin_time = now;
}
return ECORE_CALLBACK_RENEW;
}
}
return ECORE_CALLBACK_RENEW;
after:
_e_sys_logout_after();
_e_sys_logout_timer = NULL;
return ECORE_CALLBACK_CANCEL;
}
static void
_e_sys_logout_after(void)
{
if (_e_sys_dialog)
{
e_object_del(E_OBJECT(_e_sys_dialog));
_e_sys_dialog = NULL;
}
_e_sys_action_current = _e_sys_action_after;
_e_sys_action_do(_e_sys_action_after, NULL);
_e_sys_action_after = E_SYS_NONE;
}
static void
_e_sys_logout_begin(E_Sys_Action a_after)
{
/* Eina_List *l; */
/* E_Border *bd; */
E_Obj_Dialog *od;
/* start logout - at end do the e_after action */
od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
_("Logout in progress"), "E", "_sys_logout");
e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/logout");
e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
_("Logout in progress.<br>"
"<hilight>Please wait.</hilight>"));
e_obj_dialog_show(od);
e_obj_dialog_icon_set(od, "system-log-out");
if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
_e_sys_dialog = od;
_e_sys_action_after = a_after;
/* EINA_LIST_FOREACH(e_border_client_list(), l, bd) */
/* { */
/* e_border_act_close_begin(bd); */
/* } */
/* and poll to see if all pending windows are gone yet every 0.5 sec */
_e_sys_logout_begin_time = ecore_time_get();
if (_e_sys_logout_timer) ecore_timer_del(_e_sys_logout_timer);
_e_sys_logout_timer = ecore_timer_add(0.5, _e_sys_cb_logout_timer, NULL);
}
static void
_e_sys_current_action(void)
{
/* display dialog that currently an action is in progress */
E_Dialog *dia;
dia = e_dialog_new(e_container_current_get(e_manager_current_get()),
"E", "_sys_error_action_busy");
if (!dia) return;
e_dialog_title_set(dia, _("Enlightenment is busy with another request"));
e_dialog_icon_set(dia, "enlightenment/sys", 64);
switch (_e_sys_action_current)
{
case E_SYS_LOGOUT:
e_dialog_text_set(dia, _("Logging out.<br>"
"You cannot perform other system actions<br>"
"once a logout has begun."));
break;
case E_SYS_HALT:
case E_SYS_HALT_NOW:
e_dialog_text_set(dia, _("Powering off.<br>"
"You cannot do any other system actions<br>"
"once a shutdown has been started."));
break;
case E_SYS_REBOOT:
e_dialog_text_set(dia, _("Resetting.<br>"
"You cannot do any other system actions<br>"
"once a reboot has begun."));
break;
case E_SYS_SUSPEND:
e_dialog_text_set(dia, _("Suspending.<br>"
"Until suspend is complete you cannot perform<br>"
"any other system actions."));
break;
case E_SYS_HIBERNATE:
e_dialog_text_set(dia, _("Hibernating.<br>"
"You cannot perform any other system actions<br>"
"until this is complete."));
break;
default:
e_dialog_text_set(dia, _("EEK! This should not happen"));
break;
}
e_dialog_button_add(dia, _("OK"), NULL, NULL, NULL);
e_dialog_button_focus_num(dia, 0);
e_win_centered_set(dia->win, 1);
e_dialog_show(dia);
}
static void
_e_sys_action_failed(void)
{
/* display dialog that the current action failed */
E_Dialog *dia;
dia = e_dialog_new(e_container_current_get(e_manager_current_get()),
"E", "_sys_error_action_failed");
if (!dia) return;
e_dialog_title_set(dia, _("Enlightenment is busy with another request"));
e_dialog_icon_set(dia, "enlightenment/sys", 64);
switch (_e_sys_action_current)
{
case E_SYS_HALT:
case E_SYS_HALT_NOW:
e_dialog_text_set(dia, _("Power off failed."));
break;
case E_SYS_REBOOT:
e_dialog_text_set(dia, _("Reset failed."));
break;
case E_SYS_SUSPEND:
e_dialog_text_set(dia, _("Suspend failed."));
break;
case E_SYS_HIBERNATE:
e_dialog_text_set(dia, _("Hibernate failed."));
break;
default:
e_dialog_text_set(dia, _("EEK! This should not happen"));
break;
}
e_dialog_button_add(dia, _("OK"), NULL, NULL, NULL);
e_dialog_button_focus_num(dia, 0);
e_win_centered_set(dia->win, 1);
e_dialog_show(dia);
}
static int
_e_sys_action_do(E_Sys_Action a, char *param __UNUSED__)
{
char buf[PATH_MAX];
E_Obj_Dialog *od;
switch (a)
{
case E_SYS_EXIT:
// XXX TODO: check for e_fm_op_registry entries and confirm
if (!e_util_immortal_check())
ecore_main_loop_quit();
else
return 0;
break;
case E_SYS_RESTART:
// XXX TODO: check for e_fm_op_registry entries and confirm
// FIXME: we dont share out immortal info to restarted e. :(
// if (!e_util_immortal_check())
{
restart = 1;
ecore_main_loop_quit();
}
// else
// return 0;
break;
case E_SYS_EXIT_NOW:
exit(0);
break;
case E_SYS_LOGOUT:
// XXX TODO: check for e_fm_op_registry entries and confirm
_e_sys_logout_begin(E_SYS_EXIT);
break;
case E_SYS_HALT:
case E_SYS_HALT_NOW:
/* shutdown -h now */
if (e_util_immortal_check()) return 0;
snprintf(buf, sizeof(buf),
"%s/enlightenment/utils/enlightenment_sys halt",
e_prefix_lib_get());
if (_e_sys_exe)
{
if ((ecore_time_get() - _e_sys_begin_time) > 2.0)
_e_sys_current_action();
return 0;
}
else
{
_e_sys_begin_time = ecore_time_get();
_e_sys_exe = ecore_exe_run(buf, NULL);
od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
_("Power off"), "E", "_sys_halt");
e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/halt");
e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
_("Power off.<br>"
"<hilight>Please wait.</hilight>"));
e_obj_dialog_show(od);
e_obj_dialog_icon_set(od, "system-shutdown");
if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
e_obj_dialog_cb_delete_set(od, _e_sys_dialog_cb_delete);
_e_sys_dialog = od;
/* FIXME: display halt status */
}
break;
case E_SYS_REBOOT:
/* shutdown -r now */
if (e_util_immortal_check()) return 0;
snprintf(buf, sizeof(buf),
"%s/enlightenment/utils/enlightenment_sys reboot",
e_prefix_lib_get());
if (_e_sys_exe)
{
if ((ecore_time_get() - _e_sys_begin_time) > 2.0)
_e_sys_current_action();
return 0;
}
else
{
_e_sys_begin_time = ecore_time_get();
_e_sys_exe = ecore_exe_run(buf, NULL);
od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
_("Resetting"), "E", "_sys_reboot");
e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/reboot");
e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
_("Resetting.<br>"
"<hilight>Please wait.</hilight>"));
e_obj_dialog_show(od);
e_obj_dialog_icon_set(od, "system-restart");
if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
e_obj_dialog_cb_delete_set(od, _e_sys_dialog_cb_delete);
_e_sys_dialog = od;
/* FIXME: display reboot status */
}
break;
case E_SYS_SUSPEND:
/* /etc/acpi/sleep.sh force */
snprintf(buf, sizeof(buf),
"%s/enlightenment/utils/enlightenment_sys suspend",
e_prefix_lib_get());
if (_e_sys_exe)
{
if ((ecore_time_get() - _e_sys_begin_time) > 2.0)
_e_sys_current_action();
return 0;
}
else
{
/* if (e_config->desklock_on_suspend) e_desklock_show(); */
_e_sys_begin_time = ecore_time_get();
_e_sys_exe = ecore_exe_run(buf, NULL);
od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
_("Suspending"), "E", "_sys_suspend");
e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/suspend");
e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
_("Suspending.<br>"
"<hilight>Please wait.</hilight>"));
e_obj_dialog_show(od);
e_obj_dialog_icon_set(od, "system-suspend");
if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
e_obj_dialog_cb_delete_set(od, _e_sys_dialog_cb_delete);
_e_sys_dialog = od;
/* FIXME: display suspend status */
}
break;
case E_SYS_HIBERNATE:
/* /etc/acpi/hibernate.sh force */
snprintf(buf, sizeof(buf),
"%s/enlightenment/utils/enlightenment_sys hibernate",
e_prefix_lib_get());
if (_e_sys_exe)
{
if ((ecore_time_get() - _e_sys_begin_time) > 2.0)
_e_sys_current_action();
return 0;
}
else
{
/* if (e_config->desklock_on_suspend) e_desklock_show(); */
_e_sys_begin_time = ecore_time_get();
_e_sys_exe = ecore_exe_run(buf, NULL);
od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
_("Hibernating"), "E", "_sys_hibernate");
e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/hibernate");
e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
_("Hibernating.<br>"
"<hilight>Please wait.</hilight>"));
e_obj_dialog_show(od);
e_obj_dialog_icon_set(od, "system-suspend-hibernate");
if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
_e_sys_dialog = od;
e_obj_dialog_cb_delete_set(od, _e_sys_dialog_cb_delete);
/* FIXME: display hibernate status */
}
break;
default:
return 0;
}
return 1;
}
static void
_e_sys_dialog_cb_delete(E_Obj_Dialog *od __UNUSED__)
{
/* If we don't NULL out the _e_sys_dialog, then the
* ECORE_EXE_EVENT_DEL callback will trigger and segv if the window
* is deleted in some other way. */
_e_sys_dialog = NULL;
}

48
src/bin/e_wayland/e_sys.h Normal file
View File

@ -0,0 +1,48 @@
#ifdef E_TYPEDEFS
typedef struct _E_Sys_Con_Action E_Sys_Con_Action;
typedef enum _E_Sys_Action E_Sys_Action;
enum _E_Sys_Action
{
E_SYS_NONE,
E_SYS_EXIT,
E_SYS_RESTART,
E_SYS_EXIT_NOW,
E_SYS_LOGOUT,
E_SYS_HALT,
E_SYS_HALT_NOW,
E_SYS_REBOOT,
E_SYS_SUSPEND,
E_SYS_HIBERNATE
};
struct _E_Sys_Con_Action
{
const char *label;
const char *icon_group;
const char *button_name;
void (*func) (void *data);
const void *data;
Eina_Bool disabled : 1;
};
#else
#ifndef E_SYS_H
#define E_SYS_H
EINTERN int e_sys_init(void);
EINTERN int e_sys_shutdown(void);
EAPI int e_sys_action_possible_get(E_Sys_Action a);
EAPI int e_sys_action_do(E_Sys_Action a, char *param);
EAPI E_Sys_Con_Action *e_sys_con_extra_action_register(const char *label,
const char *icon_group,
const char *button_name,
void (*func) (void *data),
const void *data);
EAPI void e_sys_con_extra_action_unregister(E_Sys_Con_Action *sca);
EAPI const Eina_List *e_sys_con_extra_action_list_get(void);
#endif
#endif

View File

@ -0,0 +1,38 @@
#include "e.h"
/* local subsystem functions */
static void
_cb_settings_theme(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
E_Obj_Dialog *od = data;
e_configure_registry_call("appearance/theme", od->win->con, NULL);
}
/* local subsystem globals */
/* externally accessible functions */
EAPI E_Theme_About *
e_theme_about_new(E_Container *con)
{
E_Obj_Dialog *od;
od = e_obj_dialog_new(con, _("About Theme"), "E", "_theme_about");
if (!od) return NULL;
e_obj_dialog_obj_theme_set(od, "base/theme", "e/theme/about");
e_obj_dialog_obj_part_text_set(od, "e.text.label", _("Close"));
e_obj_dialog_obj_part_text_set(od, "e.text.theme", _("Select Theme"));
edje_object_signal_callback_add(od->o_bg,
"e,action,settings,theme", "",
_cb_settings_theme, od);
return (E_Theme_About *)od;
}
EAPI void
e_theme_about_show(E_Theme_About *about)
{
e_obj_dialog_show((E_Obj_Dialog *)about);
e_obj_dialog_icon_set((E_Obj_Dialog *)about, "preferences-desktop-theme");
}

View File

@ -0,0 +1,13 @@
#ifdef E_TYPEDEFS
typedef struct _E_Obj_Dialog E_Theme_About;
#else
#ifndef E_THEME_ABOUT_H
#define E_THEME_ABOUT_H
EAPI E_Theme_About *e_theme_about_new (E_Container *con);
EAPI void e_theme_about_show (E_Theme_About *about);
#endif
#endif

435
src/bin/e_wayland/e_thumb.c Normal file
View File

@ -0,0 +1,435 @@
#include "e.h"
typedef struct _E_Thumb E_Thumb;
struct _E_Thumb
{
int objid;
int w, h;
const char *file;
const char *key;
char *sort_id;
unsigned char queued : 1;
unsigned char busy : 1;
unsigned char done : 1;
};
/* local subsystem functions */
static void _e_thumb_gen_begin(int objid, const char *file, const char *key, int w, int h);
static void _e_thumb_gen_end(int objid);
static void _e_thumb_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_thumb_hash_add(int objid, Evas_Object *obj);
static void _e_thumb_hash_del(int objid);
static Evas_Object *_e_thumb_hash_find(int objid);
static void _e_thumb_thumbnailers_kill(void);
static void _e_thumb_thumbnailers_kill_cancel(void);
static Eina_Bool _e_thumb_cb_kill(void *data);
static Eina_Bool _e_thumb_cb_exe_event_del(void *data, int type, void *event);
/* local subsystem globals */
static Eina_List *_thumbnailers = NULL;
static Eina_List *_thumbnailers_exe = NULL;
static Eina_List *_thumb_queue = NULL;
static int _objid = 0;
static Eina_Hash *_thumbs = NULL;
static int _pending = 0;
static int _num_thumbnailers = 1;
static Ecore_Event_Handler *_exe_del_handler = NULL;
static Ecore_Timer *_kill_timer = NULL;
/* externally accessible functions */
EINTERN int
e_thumb_init(void)
{
_exe_del_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
_e_thumb_cb_exe_event_del,
NULL);
_thumbs = eina_hash_string_superfast_new(NULL);
return 1;
}
EINTERN int
e_thumb_shutdown(void)
{
_e_thumb_thumbnailers_kill_cancel();
_e_thumb_cb_kill(NULL);
if (_exe_del_handler) ecore_event_handler_del(_exe_del_handler);
_exe_del_handler = NULL;
_thumbnailers = eina_list_free(_thumbnailers);
E_FREE_LIST(_thumbnailers_exe, ecore_exe_free);
_thumb_queue = eina_list_free(_thumb_queue);
_objid = 0;
eina_hash_free(_thumbs);
_thumbs = NULL;
_pending = 0;
return 1;
}
static void
_thumb_preloaded(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
evas_object_smart_callback_call(data, "e_thumb_gen", NULL);
}
EAPI Evas_Object *
e_thumb_icon_add(Evas *evas)
{
Evas_Object *obj;
E_Thumb *eth;
obj = e_icon_add(evas);
evas_object_smart_callback_add(obj, "preloaded", _thumb_preloaded, obj);
_objid++;
eth = E_NEW(E_Thumb, 1);
eth->objid = _objid;
eth->w = 64;
eth->h = 64;
evas_object_data_set(obj, "e_thumbdata", eth);
evas_object_event_callback_add(obj, EVAS_CALLBACK_FREE,
_e_thumb_del_hook, NULL);
_e_thumb_hash_add(eth->objid, obj);
return obj;
}
EAPI void
e_thumb_icon_file_set(Evas_Object *obj, const char *file, const char *key)
{
E_Thumb *eth;
eth = evas_object_data_get(obj, "e_thumbdata");
if (!eth) return;
eina_stringshare_replace(&eth->file, file);
eina_stringshare_replace(&eth->key, key);
E_FREE(eth->sort_id);
}
EAPI void
e_thumb_icon_size_set(Evas_Object *obj, int w, int h)
{
E_Thumb *eth;
eth = evas_object_data_get(obj, "e_thumbdata");
if (!eth) return;
if ((w < 1) || (h < 1)) return;
eth->w = w;
eth->h = h;
}
EAPI void
e_thumb_icon_begin(Evas_Object *obj)
{
E_Thumb *eth, *eth2;
char buf[4096];
eth = evas_object_data_get(obj, "e_thumbdata");
if (!eth) return;
if (eth->queued) return;
if (eth->busy) return;
if (eth->done) return;
if (!eth->file) return;
if (!_thumbnailers)
{
while ((int)eina_list_count(_thumbnailers_exe) < _num_thumbnailers)
{
Ecore_Exe *exe;
snprintf(buf, sizeof(buf), "%s/enlightenment/utils/enlightenment_thumb --nice=%d", e_prefix_lib_get(),
e_config->thumb_nice);
exe = ecore_exe_run(buf, NULL);
_thumbnailers_exe = eina_list_append(_thumbnailers_exe, exe);
}
_thumb_queue = eina_list_append(_thumb_queue, eth);
eth->queued = 1;
return;
}
EINA_LIST_FREE(_thumb_queue, eth2)
{
eth2->queued = 0;
eth2->busy = 1;
_pending++;
if (_pending == 1) _e_thumb_thumbnailers_kill_cancel();
_e_thumb_gen_begin(eth2->objid, eth2->file, eth2->key, eth2->w, eth2->h);
}
eth->busy = 1;
_pending++;
if (_pending == 1) _e_thumb_thumbnailers_kill_cancel();
_e_thumb_gen_begin(eth->objid, eth->file, eth->key, eth->w, eth->h);
}
EAPI void
e_thumb_icon_end(Evas_Object *obj)
{
E_Thumb *eth;
eth = evas_object_data_get(obj, "e_thumbdata");
if (!eth) return;
if (eth->queued)
{
_thumb_queue = eina_list_remove(_thumb_queue, eth);
eth->queued = 0;
}
if (eth->busy)
{
_e_thumb_gen_end(eth->objid);
eth->busy = 0;
_pending--;
if (_pending == 0) _e_thumb_thumbnailers_kill();
}
}
EAPI void
e_thumb_icon_rethumb(Evas_Object *obj)
{
E_Thumb *eth;
eth = evas_object_data_get(obj, "e_thumbdata");
if (!eth) return;
if (eth->done) eth->done = 0;
else e_thumb_icon_end(obj);
e_thumb_icon_begin(obj);
}
#define A(v) (((v) >> 24) & 0xff)
#define R(v) (((v) >> 16) & 0xff)
#define G(v) (((v) >> 8) & 0xff)
#define B(v) (((v)) & 0xff)
#define PIX(p, x, y) p[((y) << 2) + (x)]
#define PIX2(p, x, y) p[((y) << 1) + (x)]
static void
_e_thumb_key_load(E_Thumb *eth, const char *icon)
{
Eet_File *ef;
int size = 0;
ef = eet_open(icon, EET_FILE_MODE_READ);
if (!ef) return;
eth->sort_id = eet_read(ef, "/thumbnail/sort_id", &size);
if (eth->sort_id)
{
if (size > 0) eth->sort_id[size - 1] = 0;
else
{
free(eth->sort_id);
eth->sort_id = NULL;
}
}
eet_close(ef);
}
EAPI const char *
e_thumb_sort_id_get(Evas_Object *obj)
{
E_Thumb *eth;
eth = evas_object_data_get(obj, "e_thumbdata");
if (!eth) return "";
if (!eth->sort_id) return "";
return eth->sort_id;
}
EAPI void
e_thumb_client_data(Ecore_Ipc_Event_Client_Data *e)
{
int objid;
char *icon;
E_Thumb *eth;
Evas_Object *obj;
if (!eina_list_data_find(_thumbnailers, e->client))
_thumbnailers = eina_list_prepend(_thumbnailers, e->client);
if (e->minor == 2)
{
objid = e->ref;
icon = e->data;
if ((icon) && (e->size > 1) && (icon[e->size - 1] == 0))
{
obj = _e_thumb_hash_find(objid);
if (obj)
{
eth = evas_object_data_get(obj, "e_thumbdata");
if (eth)
{
eth->busy = 0;
_pending--;
eth->done = 1;
if (_pending == 0) _e_thumb_thumbnailers_kill();
if (ecore_file_exists(icon))
{
e_icon_file_key_set(obj, icon, "/thumbnail/data");
_e_thumb_key_load(eth, icon);
e_icon_preload_set(obj, 1);
}
evas_object_smart_callback_call(obj, "e_thumb_gen", NULL);
}
}
}
}
if (e->minor == 1)
{
/* hello message */
EINA_LIST_FREE(_thumb_queue, eth)
{
eth->queued = 0;
eth->busy = 1;
_pending++;
if (_pending == 1) _e_thumb_thumbnailers_kill_cancel();
_e_thumb_gen_begin(eth->objid, eth->file, eth->key, eth->w, eth->h);
}
}
}
EAPI void
e_thumb_client_del(Ecore_Ipc_Event_Client_Del *e)
{
if (!eina_list_data_find(_thumbnailers, e->client)) return;
_thumbnailers = eina_list_remove(_thumbnailers, e->client);
if ((!_thumbs) && (!_thumbnailers)) _objid = 0;
}
/* local subsystem functions */
static void
_e_thumb_gen_begin(int objid, const char *file, const char *key, int w, int h)
{
char *buf;
int l1, l2;
Ecore_Ipc_Client *cli;
/* send thumb req */
l1 = strlen(file);
l2 = 0;
if (key) l2 = strlen(key);
buf = alloca(l1 + 1 + l2 + 1);
strcpy(buf, file);
if (key) strcpy(buf + l1 + 1, key);
else buf[l1 + 1] = 0;
cli = eina_list_data_get(_thumbnailers);
if (!cli) return;
_thumbnailers = eina_list_remove_list(_thumbnailers, _thumbnailers);
_thumbnailers = eina_list_append(_thumbnailers, cli);
ecore_ipc_client_send(cli, E_IPC_DOMAIN_THUMB, 1, objid, w, h, buf, l1 + 1 + l2 + 1);
}
static void
_e_thumb_gen_end(int objid)
{
Eina_List *l;
Ecore_Ipc_Client *cli;
/* send thumb cancel */
EINA_LIST_FOREACH(_thumbnailers, l, cli)
{
ecore_ipc_client_send(cli, E_IPC_DOMAIN_THUMB, 2, objid, 0, 0, NULL, 0);
}
}
static void
_e_thumb_del_hook(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
E_Thumb *eth;
eth = evas_object_data_get(obj, "e_thumbdata");
if (!eth) return;
evas_object_data_del(obj, "e_thumbdata");
_e_thumb_hash_del(eth->objid);
if (eth->busy)
{
_e_thumb_gen_end(eth->objid);
eth->busy = 0;
_pending--;
if (_pending == 0) _e_thumb_thumbnailers_kill();
}
if (eth->queued)
_thumb_queue = eina_list_remove(_thumb_queue, eth);
if (eth->file) eina_stringshare_del(eth->file);
if (eth->key) eina_stringshare_del(eth->key);
free(eth->sort_id);
free(eth);
}
static void
_e_thumb_hash_add(int objid, Evas_Object *obj)
{
char buf[32];
snprintf(buf, sizeof(buf), "%i", objid);
eina_hash_add(_thumbs, buf, obj);
}
static void
_e_thumb_hash_del(int objid)
{
char buf[32];
snprintf(buf, sizeof(buf), "%i", objid);
if (_thumbs) eina_hash_del(_thumbs, buf, NULL);
if ((!_thumbs) && (!_thumbnailers)) _objid = 0;
}
static Evas_Object *
_e_thumb_hash_find(int objid)
{
char buf[32];
snprintf(buf, sizeof(buf), "%i", objid);
return eina_hash_find(_thumbs, buf);
}
static void
_e_thumb_thumbnailers_kill(void)
{
if (_kill_timer) ecore_timer_del(_kill_timer);
_kill_timer = ecore_timer_add(1.0, _e_thumb_cb_kill, NULL);
}
static void
_e_thumb_thumbnailers_kill_cancel(void)
{
if (_kill_timer) ecore_timer_del(_kill_timer);
_kill_timer = NULL;
}
static Eina_Bool
_e_thumb_cb_kill(void *data __UNUSED__)
{
Eina_List *l;
Ecore_Exe *exe;
EINA_LIST_FOREACH(_thumbnailers_exe, l, exe)
ecore_exe_terminate(exe);
_kill_timer = NULL;
return ECORE_CALLBACK_DONE;
}
static Eina_Bool
_e_thumb_cb_exe_event_del(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Exe_Event_Del *ev;
Ecore_Exe *exe;
Eina_List *l;
ev = event;
EINA_LIST_FOREACH(_thumbnailers_exe, l, exe)
{
if (exe == ev->exe)
{
_thumbnailers_exe = eina_list_remove_list(_thumbnailers_exe, l);
break;
}
}
if ((!_thumbnailers_exe) && (_thumb_queue))
{
while ((int)eina_list_count(_thumbnailers_exe) < _num_thumbnailers)
{
Ecore_Exe *exe_thumb;
char buf[4096];
snprintf(buf, sizeof(buf), "%s/enlightenment/utils/enlightenment_thumb --nice=%d", e_prefix_lib_get(),
e_config->thumb_nice);
exe_thumb = ecore_exe_run(buf, NULL);
_thumbnailers_exe = eina_list_append(_thumbnailers_exe, exe_thumb);
}
}
return ECORE_CALLBACK_PASS_ON;
}

View File

@ -0,0 +1,23 @@
#ifdef E_TYPEDEFS
#else
#ifndef E_THUMB_H
#define E_THUMB_H
EINTERN int e_thumb_init(void);
EINTERN int e_thumb_shutdown(void);
EAPI Evas_Object *e_thumb_icon_add(Evas *evas);
EAPI void e_thumb_icon_file_set(Evas_Object *obj, const char *file, const char *key);
EAPI void e_thumb_icon_size_set(Evas_Object *obj, int w, int h);
EAPI void e_thumb_icon_begin(Evas_Object *obj);
EAPI void e_thumb_icon_end(Evas_Object *obj);
EAPI void e_thumb_icon_rethumb(Evas_Object *obj);
EAPI const char *e_thumb_sort_id_get(Evas_Object *obj);
EAPI void e_thumb_client_data(Ecore_Ipc_Event_Client_Data *e);
EAPI void e_thumb_client_del(Ecore_Ipc_Event_Client_Del *e);
#endif
#endif

View File

@ -1,10 +1,19 @@
#include "e.h"
/* local function prototypes */
static Eina_Bool _e_util_cb_delayed_del(void *data);
static Eina_Bool _e_util_wakeup_cb(void *data);
static int _e_util_menu_item_fdo_icon_set(E_Menu_Item *mi, const char *icon);
static int _e_util_menu_item_edje_icon_set(E_Menu_Item *mi, const char *name, Eina_Bool fallback);
static Evas_Object *_e_util_icon_add(const char *path, Evas *evas, int size);
static int _e_util_icon_fdo_set(Evas_Object *obj, const char *icon);
static int _e_util_icon_theme_set(Evas_Object *obj, const char *icon, Eina_Bool fallback);
static Efreet_Desktop *_e_util_default_terminal_get(const char *defaults_list);
/* local variables */
static Ecore_Timer *_e_util_dummy_timer = NULL;
/* local function prototypes */
static Eina_Bool _e_util_wakeup_cb(void *data);
static char *prev_ld_library_path = NULL;
static char *prev_path = NULL;
/* external variables */
EAPI E_Path *path_data = NULL;
@ -16,45 +25,613 @@ EAPI E_Path *path_modules = NULL;
EAPI E_Path *path_backgrounds = NULL;
EAPI E_Path *path_messages = NULL;
EAPI void
e_util_wakeup(void)
{
if (_e_util_dummy_timer) return;
_e_util_dummy_timer = ecore_timer_add(0.0, _e_util_wakeup_cb, NULL);
}
EAPI void
e_util_env_set(const char *var, const char *val)
{
if (val)
{
#ifdef HAVE_SETENV
setenv(var, val, 1);
setenv(var, val, 1);
#else
char buf[8192];
char buf[8192];
snprintf(buf, sizeof(buf), "%s=%s", var, val);
if (getenv(var))
putenv(buf);
else
putenv(strdup(buf));
snprintf(buf, sizeof(buf), "%s=%s", var, val);
if (getenv(var))
putenv(buf);
else
putenv(strdup(buf));
#endif
}
else
{
#ifdef HAVE_UNSETENV
unsetenv(var);
unsetenv(var);
#else
if (getenv(var)) putenv(var);
if (getenv(var)) putenv(var);
#endif
}
}
EAPI int
EAPI void
e_util_dialog_internal(const char *title, const char *txt)
{
E_Dialog *dia;
dia =
e_dialog_new(e_container_current_get(e_manager_current_get()),
"E", "_error_dialog");
if (!dia) return;
e_dialog_title_set(dia, title);
e_dialog_text_set(dia, txt);
e_dialog_icon_set(dia, "dialog-error", 64);
e_dialog_button_add(dia, _("OK"), NULL, NULL, NULL);
e_dialog_button_focus_num(dia, 0);
e_win_centered_set(dia->win, EINA_TRUE);
e_dialog_show(dia);
}
EAPI int
e_util_strcmp(const char *s1, const char *s2)
{
if ((s1) && (s2))
{
if (s1 == s2) return 0;
return strcmp(s1, s2);
}
if ((s1) && (s2)) return strcmp(s1, s2);
return 0x7fffffff;
}
EAPI int
e_util_immortal_check(void)
{
return 0;
}
EAPI const char *
e_util_filename_escape(const char *filename)
{
const char *p;
char *q;
static char buf[PATH_MAX];
if (!filename) return NULL;
p = filename;
q = buf;
while (*p)
{
if ((q - buf) > 4090) return NULL;
if (
(*p == ' ') || (*p == '\t') || (*p == '\n') ||
(*p == '\\') || (*p == '\'') || (*p == '\"') ||
(*p == ';') || (*p == '!') || (*p == '#') ||
(*p == '$') || (*p == '%') || (*p == '&') ||
(*p == '*') || (*p == '(') || (*p == ')') ||
(*p == '[') || (*p == ']') || (*p == '{') ||
(*p == '}') || (*p == '|') || (*p == '<') ||
(*p == '>') || (*p == '?')
)
{
*q = '\\';
q++;
}
*q = *p;
q++;
p++;
}
*q = 0;
return buf;
}
EAPI void
e_util_defer_object_del(E_Object *obj)
{
if (stopping)
e_object_del(obj);
else
ecore_idle_enterer_before_add(_e_util_cb_delayed_del, obj);
}
EAPI Evas_Object *
e_util_icon_add(const char *path, Evas *evas)
{
Evas_Object *o = NULL;
const char *ext;
int size = 64;
if (!path) return NULL;
if (!ecore_file_exists(path)) return NULL;
o = e_icon_add(evas);
e_icon_scale_size_set(o, size);
e_icon_preload_set(o, 1);
ext = strrchr(path, '.');
if (ext)
{
if (!strcmp(ext, ".edj"))
e_icon_file_edje_set(o, path, "icon");
else
e_icon_file_set(o, path);
}
else
e_icon_file_set(o, path);
e_icon_fill_inside_set(o, 1);
return o;
}
EAPI Evas_Object *
e_util_icon_theme_icon_add(const char *name, unsigned int size, Evas *evas)
{
if (!name) return NULL;
if (name[0] == '/') return _e_util_icon_add(name, evas, size);
else
{
Evas_Object *obj;
const char *path;
path = efreet_icon_path_find(e_config->icon_theme, name, size);
if (path)
{
obj = _e_util_icon_add(path, evas, size);
return obj;
}
}
return NULL;
}
EAPI unsigned int
e_util_icon_size_normalize(unsigned int desired)
{
const unsigned int *itr, known_sizes[] =
{
16, 22, 24, 32, 36, 48, 64, 72, 96, 128, 192, 256, -1
};
for (itr = known_sizes; *itr > 0; itr++)
if (*itr >= desired)
return *itr;
return 256; /* largest know size? */
}
EAPI int
e_util_menu_item_theme_icon_set(E_Menu_Item *mi, const char *icon)
{
if (e_config->icon_theme_overrides)
{
if (_e_util_menu_item_fdo_icon_set(mi, icon))
return 1;
if (_e_util_menu_item_edje_icon_set(mi, icon, EINA_FALSE))
return 1;
return _e_util_menu_item_edje_icon_set(mi, icon, EINA_TRUE);
}
else
{
if (_e_util_menu_item_edje_icon_set(mi, icon, EINA_FALSE))
return 1;
if (_e_util_menu_item_fdo_icon_set(mi, icon))
return 1;
return _e_util_menu_item_edje_icon_set(mi, icon, EINA_TRUE);
}
}
EAPI const char *
e_util_winid_str_get(Ecore_Wl_Window *win)
{
const char *vals = "qWeRtYuIoP5-$&<~";
static char id[9];
unsigned int val;
val = (unsigned int)win->id;
id[0] = vals[(val >> 28) & 0xf];
id[1] = vals[(val >> 24) & 0xf];
id[2] = vals[(val >> 20) & 0xf];
id[3] = vals[(val >> 16) & 0xf];
id[4] = vals[(val >> 12) & 0xf];
id[5] = vals[(val >> 8) & 0xf];
id[6] = vals[(val >> 4) & 0xf];
id[7] = vals[(val) & 0xf];
id[8] = 0;
return id;
}
EAPI E_Container *
e_util_container_number_get(int num)
{
Eina_List *l;
E_Manager *man;
EINA_LIST_FOREACH(e_manager_list(), l, man)
{
E_Container *con;
if ((con = e_container_number_get(man, num)))
return con;
}
return NULL;
}
EAPI E_Zone *
e_util_container_zone_number_get(int con, int zone)
{
E_Container *c;
if (!(c = e_util_container_number_get(con)))
return NULL;
return e_container_zone_number_get(c, zone);
}
EAPI E_Zone *
e_util_zone_current_get(E_Manager *man)
{
E_Container *con;
E_OBJECT_CHECK_RETURN(man, NULL);
E_OBJECT_TYPE_CHECK_RETURN(man, E_MANAGER_TYPE, NULL);
if ((con = e_container_current_get(man)))
{
E_Zone *zone;
zone = e_zone_current_get(con);
return zone;
}
return NULL;
}
EAPI int
e_util_glob_match(const char *str, const char *glob)
{
if ((!str) || (!glob)) return 0;
if (glob[0] == 0)
{
if (str[0] == 0) return 1;
return 0;
}
if (!strcmp(glob, "*")) return 1;
if (!fnmatch(glob, str, 0)) return 1;
return 0;
}
EAPI int
e_util_glob_case_match(const char *str, const char *glob)
{
const char *p;
char *tstr, *tglob, *tp;
if (glob[0] == 0)
{
if (str[0] == 0) return 1;
return 0;
}
if (!strcmp(glob, "*")) return 1;
tstr = alloca(strlen(str) + 1);
for (tp = tstr, p = str; *p != 0; p++, tp++) *tp = tolower(*p);
*tp = 0;
tglob = alloca(strlen(glob) + 1);
for (tp = tglob, p = glob; *p != 0; p++, tp++) *tp = tolower(*p);
*tp = 0;
if (!fnmatch(tglob, tstr, 0)) return 1;
return 0;
}
EAPI int
e_util_edje_icon_set(Evas_Object *obj, const char *name)
{
const char *file;
char buf[PATH_MAX];
if ((!name) || (!name[0])) return 0;
snprintf(buf, sizeof(buf), "e/icons/%s", name);
file = e_theme_edje_file_get("base/theme/icons", buf);
if (file[0])
{
edje_object_file_set(obj, file, buf);
return 1;
}
return 0;
}
EAPI int
e_util_icon_theme_set(Evas_Object *obj, const char *icon)
{
if (e_config->icon_theme_overrides)
{
if (_e_util_icon_fdo_set(obj, icon))
return 1;
if (_e_util_icon_theme_set(obj, icon, EINA_FALSE))
return 1;
return _e_util_icon_theme_set(obj, icon, EINA_TRUE);
}
else
{
if (_e_util_icon_theme_set(obj, icon, EINA_FALSE))
return 1;
if (_e_util_icon_fdo_set(obj, icon))
return 1;
return _e_util_icon_theme_set(obj, icon, EINA_TRUE);
}
}
EAPI char *
e_util_size_string_get(off_t size)
{
double dsize;
char buf[256];
dsize = (double)size;
if (dsize < 1024.0) snprintf(buf, sizeof(buf), _("%'.0f Bytes"), dsize);
else
{
dsize /= 1024.0;
if (dsize < 1024) snprintf(buf, sizeof(buf), _("%'.0f KB"), dsize);
else
{
dsize /= 1024.0;
if (dsize < 1024) snprintf(buf, sizeof(buf), _("%'.0f MB"), dsize);
else
{
dsize /= 1024.0;
snprintf(buf, sizeof(buf), _("%'.1f GB"), dsize);
}
}
}
return strdup(buf);
}
EAPI char *
e_util_file_time_get(time_t ftime)
{
time_t diff;
time_t ltime;
char buf[256];
char *s = NULL;
ltime = time(NULL);
diff = ltime - ftime;
buf[0] = 0;
if (ftime > ltime)
snprintf(buf, sizeof(buf), _("In the Future"));
else
{
if (diff <= 60)
snprintf(buf, sizeof(buf), _("In the last Minute"));
else if (diff >= 31526000)
snprintf(buf, sizeof(buf), _("%li Years ago"), (diff / 31526000));
else if (diff >= 2592000)
snprintf(buf, sizeof(buf), _("%li Months ago"), (diff / 2592000));
else if (diff >= 604800)
snprintf(buf, sizeof(buf), _("%li Weeks ago"), (diff / 604800));
else if (diff >= 86400)
snprintf(buf, sizeof(buf), _("%li Days ago"), (diff / 86400));
else if (diff >= 3600)
snprintf(buf, sizeof(buf), _("%li Hours ago"), (diff / 3600));
else if (diff > 60)
snprintf(buf, sizeof(buf), _("%li Minutes ago"), (diff / 60));
}
if (buf[0])
s = strdup(buf);
else
s = strdup(_("Unknown"));
return s;
}
EAPI void
e_util_library_path_strip(void)
{
char *p, *p2;
p = getenv("LD_LIBRARY_PATH");
E_FREE(prev_ld_library_path);
if (p)
{
prev_ld_library_path = strdup(p);
p2 = strchr(p, ':');
if (p2) p2++;
e_util_env_set("LD_LIBRARY_PATH", p2);
}
p = getenv("PATH");
E_FREE(prev_path);
if (p)
{
prev_path = strdup(p);
p2 = strchr(p, ':');
if (p2) p2++;
e_util_env_set("PATH", p2);
}
}
EAPI void
e_util_library_path_restore(void)
{
if (prev_ld_library_path)
{
e_util_env_set("LD_LIBRARY_PATH", prev_ld_library_path);
E_FREE(prev_ld_library_path);
}
if (prev_path)
{
e_util_env_set("PATH", prev_path);
E_FREE(prev_path);
}
}
EAPI void
e_util_win_auto_resize_fill(E_Win *win)
{
}
EAPI Evas_Object *
e_util_desktop_icon_add(Efreet_Desktop *desktop, unsigned int size, Evas *evas)
{
if ((!desktop) || (!desktop->icon)) return NULL;
return e_util_icon_theme_icon_add(desktop->icon, size, evas);
}
EAPI char *
e_util_shell_env_path_eval(const char *path)
{
/* evaluate things like:
* $HOME/bling -> /home/user/bling
* $HOME/bin/$HOSTNAME/blah -> /home/user/bin/localhost/blah
* etc. etc.
*/
const char *p, *v2, *v1 = NULL;
char buf[PATH_MAX], *pd, *s, *vp;
char *v = NULL;
int esc = 0, invar = 0;
for (p = path, pd = buf; (pd < (buf + sizeof(buf) - 1)); p++)
{
if (invar)
{
if (!((isalnum(*p)) || (*p == '_')))
{
v2 = p;
invar = 0;
if ((v2 - v1) > 1)
{
s = alloca(v2 - v1);
strncpy(s, v1 + 1, v2 - v1 - 1);
s[v2 - v1 - 1] = 0;
if (strncmp(s, "XDG", 3))
v = getenv(s);
else
{
if (!strcmp(s, "XDG_CONFIG_HOME"))
v = (char *)efreet_config_home_get();
else if (!strcmp(s, "XDG_CACHE_HOME"))
v = (char *)efreet_cache_home_get();
else if (!strcmp(s, "XDG_DATA_HOME"))
v = (char *)efreet_data_home_get();
}
if (v)
{
vp = v;
while ((*vp) && (pd < (buf + sizeof(buf) - 1)))
{
*pd = *vp;
vp++;
pd++;
}
}
}
if (pd < (buf + sizeof(buf) - 1))
{
*pd = *p;
pd++;
}
}
}
else
{
if (esc)
{
*pd = *p;
pd++;
}
else
{
if (*p == '\\') esc = 1;
else if (*p == '$')
{
invar = 1;
v1 = p;
}
else
{
*pd = *p;
pd++;
}
}
}
if (*p == 0) break;
}
*pd = 0;
return strdup(buf);
}
EAPI int
e_util_edje_collection_exists(const char *file, const char *coll)
{
Eina_List *clist, *l;
char *str;
clist = edje_file_collection_list(file);
EINA_LIST_FOREACH(clist, l, str)
{
if (!strcmp(coll, str))
{
edje_file_collection_list_free(clist);
return 1;
}
}
edje_file_collection_list_free(clist);
return 0;
}
EAPI void
e_util_desktop_menu_item_icon_add(Efreet_Desktop *desktop, unsigned int size, E_Menu_Item *mi)
{
const char *path = NULL;
if ((!desktop) || (!desktop->icon)) return;
if (desktop->icon[0] == '/') path = desktop->icon;
else path = efreet_icon_path_find(e_config->icon_theme, desktop->icon, size);
if (path)
{
const char *ext;
ext = strrchr(path, '.');
if (ext)
{
if (strcmp(ext, ".edj") == 0)
e_menu_item_icon_edje_set(mi, path, "icon");
else
e_menu_item_icon_file_set(mi, path);
}
else
e_menu_item_icon_file_set(mi, path);
}
}
EAPI int
e_util_container_desk_count_get(E_Container *con)
{
Eina_List *zl;
E_Zone *zone;
int count = 0;
E_OBJECT_CHECK_RETURN(con, 0);
E_OBJECT_TYPE_CHECK_RETURN(con, E_CONTAINER_TYPE, 0);
EINA_LIST_FOREACH(con->zones, zl, zone)
{
int x, y;
int cx = 0, cy = 0;
e_zone_desk_count_get(zone, &cx, &cy);
for (x = 0; x < cx; x++)
{
for (y = 0; y < cy; y++)
count += 1;
}
}
return count;
}
EAPI int
e_util_strcasecmp(const char *s1, const char *s2)
{
if ((!s1) && (!s2)) return 0;
@ -63,17 +640,200 @@ e_util_strcasecmp(const char *s1, const char *s2)
return strcasecmp(s1, s2);
}
EAPI void
e_util_wakeup(void)
EAPI Efreet_Desktop *
e_util_terminal_desktop_get(void)
{
if (_e_util_dummy_timer) return;
_e_util_dummy_timer = ecore_timer_add(0.0, _e_util_wakeup_cb, NULL);
const char *terms[] =
{
"terminology.desktop",
"xterm.desktop",
"rxvt.desktop",
"gnome-terminal.desktop",
"konsole.desktop",
NULL
};
const char *s;
char buf[PATH_MAX];
Efreet_Desktop *tdesktop = NULL, *td;
Eina_List *l;
int i;
s = efreet_data_home_get();
if (s)
{
snprintf(buf, sizeof(buf), "%s/applications/defaults.list", s);
tdesktop = _e_util_default_terminal_get(buf);
}
if (tdesktop) return tdesktop;
EINA_LIST_FOREACH(efreet_data_dirs_get(), l, s)
{
snprintf(buf, sizeof(buf), "%s/applications/defaults.list", s);
tdesktop = _e_util_default_terminal_get(buf);
if (tdesktop) return tdesktop;
}
for (i = 0; terms[i]; i++)
{
tdesktop = efreet_util_desktop_file_id_find(terms[i]);
if (tdesktop) return tdesktop;
}
if (!tdesktop)
{
l = efreet_util_desktop_category_list("TerminalEmulator");
if (l)
{
// just take first one since above list doesn't work.
tdesktop = l->data;
EINA_LIST_FREE(l, td)
{
// free/unref the desktosp we are not going to use
if (td != tdesktop) efreet_desktop_free(td);
}
}
}
return tdesktop;
}
/* local functions */
static Eina_Bool
_e_util_wakeup_cb(void *data EINA_UNUSED)
_e_util_cb_delayed_del(void *data)
{
e_object_del(E_OBJECT(data));
return ECORE_CALLBACK_CANCEL;
}
static Eina_Bool
_e_util_wakeup_cb(void *data __UNUSED__)
{
_e_util_dummy_timer = NULL;
return ECORE_CALLBACK_CANCEL;
}
static int
_e_util_menu_item_fdo_icon_set(E_Menu_Item *mi, const char *icon)
{
const char *path = NULL;
unsigned int size;
if ((!icon) || (!icon[0])) return 0;
size = e_util_icon_size_normalize(24 * e_scale);
path = efreet_icon_path_find(e_config->icon_theme, icon, size);
if (!path) return 0;
e_menu_item_icon_file_set(mi, path);
return 1;
}
static int
_e_util_menu_item_edje_icon_set(E_Menu_Item *mi, const char *name, Eina_Bool fallback)
{
const char *file;
char buf[PATH_MAX];
if ((!name) || (!name[0])) return 0;
if ((!fallback) && (name[0]=='/') && ecore_file_exists(name))
{
e_menu_item_icon_edje_set(mi, name, "icon");
return 1;
}
snprintf(buf, sizeof(buf), "e/icons/%s", name);
if (fallback)
file = e_theme_edje_icon_fallback_file_get(buf);
else
file = e_theme_edje_file_get("base/theme/icons", buf);
if (file[0])
{
e_menu_item_icon_edje_set(mi, file, buf);
return 1;
}
return 0;
}
static Evas_Object *
_e_util_icon_add(const char *path, Evas *evas, int size)
{
Evas_Object *o = NULL;
const char *ext;
if (!path) return NULL;
if (!ecore_file_exists(path)) return NULL;
o = e_icon_add(evas);
e_icon_scale_size_set(o, size);
e_icon_preload_set(o, 1);
ext = strrchr(path, '.');
if (ext)
{
if (!strcmp(ext, ".edj"))
e_icon_file_edje_set(o, path, "icon");
else
e_icon_file_set(o, path);
}
else
e_icon_file_set(o, path);
e_icon_fill_inside_set(o, 1);
return o;
}
static int
_e_util_icon_fdo_set(Evas_Object *obj, const char *icon)
{
const char *path = NULL;
unsigned int size;
if ((!icon) || (!icon[0])) return 0;
size = e_icon_scale_size_get(obj);
if (size < 16) size = 16;
size = e_util_icon_size_normalize(size * e_scale);
path = efreet_icon_path_find(e_config->icon_theme, icon, size);
if (!path) return 0;
e_icon_file_set(obj, path);
return 1;
}
static int
_e_util_icon_theme_set(Evas_Object *obj, const char *icon, Eina_Bool fallback)
{
const char *file;
char buf[PATH_MAX];
if ((!icon) || (!icon[0])) return 0;
snprintf(buf, sizeof(buf), "e/icons/%s", icon);
if (fallback)
file = e_theme_edje_icon_fallback_file_get(buf);
else
file = e_theme_edje_file_get("base/theme/icons", buf);
if (file[0])
{
e_icon_file_edje_set(obj, file, buf);
return 1;
}
return 0;
}
static Efreet_Desktop *
_e_util_default_terminal_get(const char *defaults_list)
{
Efreet_Desktop *tdesktop = NULL;
Efreet_Ini *ini;
const char *s;
ini = efreet_ini_new(defaults_list);
if ((ini) && (ini->data) &&
(efreet_ini_section_set(ini, "Default Applications")) &&
(ini->section))
{
s = efreet_ini_string_get(ini, "x-scheme-handler/terminal");
if (s) tdesktop = efreet_util_desktop_file_id_find(s);
}
if (ini) efreet_ini_free(ini);
return tdesktop;
}

View File

@ -3,10 +3,45 @@
# ifndef E_UTILS_H
# define E_UTILS_H
EAPI void e_util_env_set(const char *var, const char *val);
EAPI int e_util_strcmp(const char *s1, const char *s2);
EAPI int e_util_strcasecmp(const char *s1, const char *s2);
#define e_util_dialog_show(title, args...) \
{ \
char __tmpbuf[PATH_MAX]; \
\
snprintf(__tmpbuf, sizeof(__tmpbuf), ##args); \
e_util_dialog_internal(title, __tmpbuf); \
}
EAPI void e_util_wakeup(void);
EAPI void e_util_env_set(const char *var, const char *val);
EAPI void e_util_dialog_internal(const char *title, const char *txt);
EAPI int e_util_strcmp(const char *s1, const char *s2);
EAPI int e_util_immortal_check(void);
EAPI const char *e_util_filename_escape(const char *filename);
EAPI void e_util_defer_object_del(E_Object *obj);
EAPI Evas_Object *e_util_icon_add(const char *path, Evas *evas);
EAPI Evas_Object *e_util_icon_theme_icon_add(const char *name, unsigned int size, Evas *evas);
EAPI unsigned int e_util_icon_size_normalize(unsigned int desired);
EAPI int e_util_menu_item_theme_icon_set(E_Menu_Item *mi, const char *icon);
EAPI const char *e_util_winid_str_get(Ecore_Wl_Window *win);
EAPI E_Container *e_util_container_number_get(int num);
EAPI E_Zone *e_util_container_zone_number_get(int con, int zone);
EAPI E_Zone *e_util_zone_current_get(E_Manager *man);
EAPI int e_util_glob_match(const char *str, const char *glob);
EAPI int e_util_glob_case_match(const char *str, const char *glob);
EAPI int e_util_edje_icon_set(Evas_Object *obj, const char *name);
EAPI int e_util_icon_theme_set(Evas_Object *obj, const char *icon);
EAPI char *e_util_size_string_get(off_t size);
EAPI char *e_util_file_time_get(time_t ftime);
EAPI void e_util_library_path_strip(void);
EAPI void e_util_library_path_restore(void);
EAPI void e_util_win_auto_resize_fill(E_Win *win);
EAPI Evas_Object *e_util_desktop_icon_add(Efreet_Desktop *desktop, unsigned int size, Evas *evas);
EAPI char *e_util_shell_env_path_eval(const char *path);
EAPI int e_util_edje_collection_exists(const char *file, const char *coll);
EAPI void e_util_desktop_menu_item_icon_add(Efreet_Desktop *desktop, unsigned int size, E_Menu_Item *mi);
EAPI int e_util_container_desk_count_get(E_Container *con);
EAPI int e_util_strcasecmp(const char *s1, const char *s2);
EAPI Efreet_Desktop *e_util_terminal_desktop_get(void);
# endif
#endif

338
src/bin/e_wayland/e_win.c Normal file
View File

@ -0,0 +1,338 @@
#include "e.h"
/* local function prototypes */
static void _e_win_cb_free(E_Win *win);
static void _e_win_cb_move(Ecore_Evas *ee);
static void _e_win_cb_resize(Ecore_Evas *ee);
static void _e_win_cb_delete(Ecore_Evas *ee);
static void _e_win_prop_update(E_Win *win);
EAPI E_Win *
e_win_new(E_Container *con)
{
E_Win *win;
unsigned int parent = 0;
E_OBJECT_CHECK_RETURN(con, NULL);
E_OBJECT_TYPE_CHECK_RETURN(con, E_CONTAINER_TYPE, NULL);
win = E_OBJECT_ALLOC(E_Win, E_WIN_TYPE, _e_win_cb_free);
if (!win) return NULL;
win->x = 0;
win->y = 0;
win->w = 1;
win->h = 1;
win->placed = EINA_FALSE;
win->min.w = 0;
win->min.h = 0;
win->max.w = 9999;
win->max.h = 9999;
win->base.w = 0;
win->base.h = 0;
win->step_x = 1;
win->step_y = 1;
win->aspect.min = 0.0;
win->aspect.max = 0.0;
win->con = con;
win->state.centered = EINA_FALSE;
/* FIXME: Ideally, frame should be false and e_border should handle
* adding the frame */
parent = ecore_evas_wayland_window_get(con->bg_ee)->id;
win->ee = e_canvas_new(parent, win->x, win->y, win->w, win->h,
EINA_FALSE, EINA_TRUE, NULL);
e_canvas_add(win->ee);
ecore_evas_data_set(win->ee, "E_Win", win);
ecore_evas_callback_move_set(win->ee, _e_win_cb_move);
ecore_evas_callback_resize_set(win->ee, _e_win_cb_resize);
ecore_evas_callback_delete_request_set(win->ee, _e_win_cb_delete);
win->evas = ecore_evas_get(win->ee);
ecore_evas_name_class_set(win->ee, "E", "_e_internal_window");
ecore_evas_title_set(win->ee, "E");
/* TODO: create pointer */
return win;
}
EAPI void
e_win_show(E_Win *win)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
/* TODO: create e_border ? */
_e_win_prop_update(win);
ecore_evas_show(win->ee);
}
EAPI void
e_win_hide(E_Win *win)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
/* TODO: hide border ? */
ecore_evas_hide(win->ee);
}
EAPI void
e_win_centered_set(E_Win *win, int centered)
{
E_Zone *zone;
int x, y, w, h;
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
if ((win->state.centered) && (!centered))
{
win->state.centered = EINA_FALSE;
}
else if ((!win->state.centered) && (centered))
{
win->state.centered = EINA_TRUE;
}
if (!win->state.centered) return;
zone = e_zone_current_get(win->con);
e_zone_useful_geometry_get(zone, &x, &y, &w, &h);
printf("Center Window: %d %d\n",
x + (w - win->w) / 2, y + (h - win->h) / 2);
ecore_evas_move(win->ee, x + (w - win->w) / 2, y + (h - win->h) / 2);
}
EAPI void
e_win_title_set(E_Win *win, const char *title)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
ecore_evas_title_set(win->ee, title);
}
EAPI void
e_win_move(E_Win *win, int x, int y)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
/* FIXME: e_border ? */
win->x = x;
win->y = y;
ecore_evas_move(win->ee, x, y);
}
EAPI void
e_win_resize(E_Win *win, int w, int h)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
/* FIXME: e_border */
win->w = w;
win->h = h;
ecore_evas_resize(win->ee, w, h);
}
EAPI void
e_win_name_class_set(E_Win *win, const char *name, const char *class)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
ecore_evas_name_class_set(win->ee, name, class);
}
EAPI void
e_win_dialog_set(E_Win *win, int dialog)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
if (win->state.dialog == dialog) return;
win->state.dialog = dialog;
_e_win_prop_update(win);
}
EAPI void
e_win_move_callback_set(E_Win *win, void (*func)(E_Win *win))
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
win->cb_move = func;
}
EAPI void
e_win_resize_callback_set(E_Win *win, void (*func)(E_Win *win))
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
win->cb_resize = func;
}
EAPI void
e_win_delete_callback_set(E_Win *win, void (*func)(E_Win *win))
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
win->cb_delete = func;
}
EAPI Evas *
e_win_evas_get(E_Win *win)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
return win->evas;
}
EAPI void
e_win_size_min_set(E_Win *win, int w, int h)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
win->min.w = w;
win->min.h = h;
}
EAPI void
e_win_size_max_set(E_Win *win, int w, int h)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
win->max.w = w;
win->max.h = h;
}
EAPI void
e_win_size_base_set(E_Win *win, int w, int h)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
win->base.w = w;
win->base.h = h;
}
EAPI void
e_win_step_set(E_Win *win, int x, int y)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
win->step_x = x;
win->step_y = y;
}
EAPI void
e_win_borderless_set(E_Win *win, int borderless)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
ecore_evas_borderless_set(win->ee, borderless);
}
EAPI void
e_win_shaped_set(E_Win *win, int shaped)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
ecore_evas_shaped_set(win->ee, shaped);
}
EAPI void
e_win_raise(E_Win *win)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
ecore_evas_raise(win->ee);
}
EAPI void
e_win_border_icon_set(E_Win *win, const char *icon)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
}
EAPI E_Win *
e_win_evas_object_win_get(Evas_Object *obj)
{
Evas *evas;
Evas_Object *wobj;
E_Win *win;
if (!obj) return NULL;
evas = evas_object_evas_get(obj);
wobj = evas_object_name_find(evas, "E_Win");
if (!wobj) return NULL;
win = evas_object_data_get(wobj, "E_Win");
return win;
}
/* local functions */
static void
_e_win_cb_free(E_Win *win)
{
if (win->ee)
{
e_canvas_del(win->ee);
ecore_evas_free(win->ee);
}
}
static void
_e_win_cb_move(Ecore_Evas *ee)
{
E_Win *win;
if (!(win = ecore_evas_data_get(ee, "E_Win"))) return;
ecore_evas_geometry_get(win->ee, &win->x, &win->y, &win->w, &win->h);
if (win->cb_move) win->cb_move(win);
}
static void
_e_win_cb_resize(Ecore_Evas *ee)
{
E_Win *win;
if (!(win = ecore_evas_data_get(ee, "E_Win"))) return;
ecore_evas_geometry_get(win->ee, &win->x, &win->y, &win->w, &win->h);
if (win->cb_resize) win->cb_resize(win);
}
static void
_e_win_cb_delete(Ecore_Evas *ee)
{
E_Win *win;
if (!(win = ecore_evas_data_get(ee, "E_Win"))) return;
if (win->cb_delete) win->cb_delete(win);
}
static void
_e_win_prop_update(E_Win *win)
{
if (win->state.dialog)
ecore_evas_wayland_type_set(win->ee, ECORE_WL_WINDOW_TYPE_TRANSIENT);
else
ecore_evas_wayland_type_set(win->ee, ECORE_WL_WINDOW_TYPE_TOPLEVEL);
}

72
src/bin/e_wayland/e_win.h Normal file
View File

@ -0,0 +1,72 @@
#ifdef E_TYPEDEFS
typedef struct _E_Win E_Win;
#else
# ifndef E_WIN_H
# define E_WIN_H
# define E_WIN_TYPE 0xE0b01011
struct _E_Win
{
E_Object e_obj_inherit;
int x, y, w, h;
E_Container *con;
Ecore_Evas *ee;
Evas *evas;
E_Border *border;
Eina_Bool placed : 1;
struct
{
int w, h;
} min, max, base;
int step_x, step_y;
struct
{
double min, max;
} aspect;
void (*cb_move) (E_Win *win);
void (*cb_resize) (E_Win *win);
void (*cb_delete) (E_Win *win);
void *data;
struct
{
Eina_Bool centered : 1;
Eina_Bool dialog : 1;
Eina_Bool no_remember : 1;
} state;
};
EAPI E_Win *e_win_new(E_Container *con);
EAPI void e_win_show(E_Win *win);
EAPI void e_win_hide(E_Win *win);
EAPI void e_win_centered_set(E_Win *win, int centered);
EAPI void e_win_title_set(E_Win *win, const char *title);
EAPI void e_win_move(E_Win *win, int x, int y);
EAPI void e_win_resize(E_Win *win, int w, int h);
EAPI void e_win_name_class_set(E_Win *win, const char *name, const char *class);
EAPI void e_win_dialog_set(E_Win *win, int dialog);
EAPI void e_win_move_callback_set(E_Win *win, void (*func)(E_Win *win));
EAPI void e_win_resize_callback_set(E_Win *win, void (*func)(E_Win *win));
EAPI void e_win_delete_callback_set(E_Win *win, void (*func)(E_Win *win));
EAPI Evas *e_win_evas_get(E_Win *win);
EAPI void e_win_size_min_set(E_Win *win, int w, int h);
EAPI void e_win_size_max_set(E_Win *win, int w, int h);
EAPI void e_win_size_base_set(E_Win *win, int w, int h);
EAPI void e_win_step_set(E_Win *win, int x, int y);
EAPI void e_win_borderless_set(E_Win *win, int borderless);
EAPI void e_win_shaped_set(E_Win *win, int shaped);
EAPI void e_win_raise(E_Win *win);
EAPI void e_win_border_icon_set(E_Win *win, const char *icon);
EAPI E_Win *e_win_evas_object_win_get(Evas_Object *obj);
# endif
#endif

306
src/bin/e_wayland/e_zone.c Normal file
View File

@ -0,0 +1,306 @@
#include "e.h"
/* local function prototypes */
static void _e_zone_cb_free(E_Zone *zone);
static void _e_zone_cb_bg_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED);
static void _e_zone_cb_bg_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event);
static void _e_zone_cb_menu_deactivate(void *data EINA_UNUSED, E_Menu *m);
EINTERN int
e_zone_init(void)
{
return 1;
}
EINTERN int
e_zone_shutdown(void)
{
return 1;
}
EAPI E_Zone *
e_zone_new(E_Container *con, int num, int x, int y, int w, int h)
{
E_Zone *zone;
char name[40];
E_OBJECT_CHECK_RETURN(con, NULL);
E_OBJECT_TYPE_CHECK_RETURN(con, E_CONTAINER_TYPE, NULL);
zone = E_OBJECT_ALLOC(E_Zone, E_ZONE_TYPE, _e_zone_cb_free);
if (!zone)
{
printf("FAILED TO ALLOCATE ZONE\n");
return NULL;
}
zone->container = con;
zone->x = x;
zone->y = y;
zone->w = w;
zone->h = h;
zone->num = num;
zone->desk_x_count = 0;
zone->desk_y_count = 0;
zone->desk_x_current = 0;
zone->desk_y_current = 0;
zone->o_bg_clip = evas_object_rectangle_add(zone->container->bg_evas);
evas_object_move(zone->o_bg_clip, zone->x, zone->y);
evas_object_resize(zone->o_bg_clip, zone->w, zone->h);
evas_object_color_set(zone->o_bg_clip, 255, 255, 255, 255);
zone->o_bg_event = evas_object_rectangle_add(zone->container->bg_evas);
evas_object_clip_set(zone->o_bg_event, zone->o_bg_clip);
evas_object_move(zone->o_bg_event, zone->x, zone->y);
evas_object_resize(zone->o_bg_event, zone->w, zone->h);
evas_object_color_set(zone->o_bg_event, 0, 0, 0, 0);
evas_object_repeat_events_set(zone->o_bg_event, 1);
evas_object_event_callback_add(zone->o_bg_event, EVAS_CALLBACK_MOUSE_DOWN,
_e_zone_cb_bg_mouse_down, zone);
evas_object_event_callback_add(zone->o_bg_event, EVAS_CALLBACK_MOUSE_UP,
_e_zone_cb_bg_mouse_up, zone);
e_zone_desk_count_set(zone, e_config->zone_desks_x_count,
e_config->zone_desks_y_count);
/* TODO: add event handlers */
snprintf(name, sizeof(name), "Zone %d", zone->num);
zone->name = eina_stringshare_add(name);
con->zones = eina_list_append(con->zones, zone);
return zone;
}
EAPI void
e_zone_desk_count_set(E_Zone *zone, int x, int y)
{
E_Desk **new_desks;
E_Desk *desk;
int xx = 0, yy = 0, nx = 0, ny = 0;
Eina_Bool moved = EINA_FALSE;
E_OBJECT_CHECK(zone);
E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
xx = x;
if (xx < 1) xx = 1;
yy = y;
if (yy < 1) yy = 1;
if (zone->desk_x_current >= xx) moved = EINA_TRUE;
if (zone->desk_y_current >= yy) moved = EINA_TRUE;
if (moved)
{
nx = zone->desk_x_current;
ny = zone->desk_y_current;
if (zone->desk_x_current >= xx) nx = xx - 1;
if (zone->desk_y_current >= yy) ny = yy - 1;
if (zone->visible)
e_desk_show(e_desk_at_xy_get(zone, nx, ny));
}
new_desks = malloc(xx * yy * sizeof(E_Desk *));
for (x = 0; x < xx; x++)
{
for (y = 0; y < yy; y++)
{
if ((x < zone->desk_x_count) && (y < zone->desk_y_count))
desk = zone->desks[x + (y * zone->desk_x_count)];
else
desk = e_desk_new(zone, x, y);
new_desks[x + (y * xx)] = desk;
}
}
if (zone->desks) free(zone->desks);
zone->desks = new_desks;
zone->desk_x_count = xx;
zone->desk_y_count = yy;
e_config->zone_desks_x_count = xx;
e_config->zone_desks_y_count = yy;
e_config_save_queue();
/* Cannot call desk_current_get until the zone desk counts have been set
* or else we end up with a "white background" because desk_current_get will
* return NULL.
*/
desk = e_desk_current_get(zone);
if (desk)
{
desk->visible = 0;
if (zone->visible) e_desk_show(desk);
}
}
EAPI void
e_zone_show(E_Zone *zone)
{
int x = 0, y = 0;
E_OBJECT_CHECK(zone);
E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
if (zone->visible) return;
evas_object_show(zone->o_bg_clip);
evas_object_show(zone->o_bg_event);
if (zone->o_bg) evas_object_show(zone->o_bg);
for (x = 0; x < zone->desk_x_count; x++)
{
for (y = 0; y < zone->desk_y_count; y++)
e_desk_show(zone->desks[x + (y * zone->desk_x_count)]);
}
zone->visible = EINA_TRUE;
}
EAPI void
e_zone_hide(E_Zone *zone)
{
int x = 0, y = 0;
E_OBJECT_CHECK(zone);
E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
if (!zone->visible) return;
for (x = 0; x < zone->desk_x_count; x++)
{
for (y = 0; y < zone->desk_y_count; y++)
e_desk_hide(zone->desks[x + (y * zone->desk_x_count)]);
}
evas_object_hide(zone->o_bg_event);
evas_object_hide(zone->o_bg_clip);
if (zone->o_bg) evas_object_hide(zone->o_bg);
zone->visible = EINA_FALSE;
}
EAPI E_Zone *
e_zone_current_get(E_Container *con)
{
Eina_List *l = NULL;
E_Zone *zone;
E_OBJECT_CHECK_RETURN(con, NULL);
E_OBJECT_TYPE_CHECK_RETURN(con, E_CONTAINER_TYPE, NULL);
if (!starting)
{
int x, y;
ecore_wl_pointer_xy_get(&x, &y);
EINA_LIST_FOREACH(con->zones, l, zone)
{
if (E_INSIDE(x, y, zone->x, zone->y, zone->w, zone->h))
return zone;
}
}
if (!con->zones) return NULL;
return (E_Zone *)eina_list_data_get(con->zones);
}
EAPI void
e_zone_bg_reconfigure(E_Zone *zone)
{
E_OBJECT_CHECK(zone);
E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
e_bg_zone_update(zone, E_BG_TRANSITION_CHANGE);
}
EAPI void
e_zone_useful_geometry_get(E_Zone *zone, int *x, int *y, int *w, int *h)
{
E_OBJECT_CHECK(zone);
E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
if (x) *x = zone->x;
if (y) *y = zone->y;
if (w) *w = zone->w;
if (h) *h = zone->h;
}
EAPI void
e_zone_desk_count_get(E_Zone *zone, int *x, int *y)
{
E_OBJECT_CHECK(zone);
E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
if (x) *x = zone->desk_x_count;
if (y) *y = zone->desk_y_count;
}
/* local functions */
static void
_e_zone_cb_free(E_Zone *zone)
{
E_Container *con;
int x = 0, y = 0;
if (zone->name) eina_stringshare_del(zone->name);
evas_object_event_callback_del(zone->o_bg_event, EVAS_CALLBACK_MOUSE_DOWN,
_e_zone_cb_bg_mouse_down);
evas_object_event_callback_del(zone->o_bg_event, EVAS_CALLBACK_MOUSE_UP,
_e_zone_cb_bg_mouse_up);
con = zone->container;
con->zones = eina_list_remove(con->zones, zone);
evas_object_del(zone->o_bg_event);
evas_object_del(zone->o_bg_clip);
evas_object_del(zone->o_bg);
if (zone->o_prev_bg) evas_object_del(zone->o_prev_bg);
if (zone->o_trans) evas_object_del(zone->o_trans);
for (x = 0; x < zone->desk_x_count; x++)
{
for (y = 0; y < zone->desk_y_count; y++)
e_object_del(E_OBJECT(zone->desks[x + (y * zone->desk_x_count)]));
}
free(zone->desks);
free(zone);
}
static void
_e_zone_cb_bg_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
{
E_Zone *zone;
if (!(zone = data)) return;
printf("Zone Mouse Down\n");
}
static void
_e_zone_cb_bg_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event)
{
E_Zone *zone;
E_Menu *m;
int x, y;
if (!(zone = data)) return;
if (!(m = e_int_menus_main_new())) return;
m->zone = zone;
ecore_wl_pointer_xy_get(&x, &y);
printf("Zone Mouse Up: %d %d\n", x, y);
e_menu_post_deactivate_callback_set(m, _e_zone_cb_menu_deactivate, NULL);
e_menu_activate_mouse(m, zone, x, y, 1, 1, E_MENU_POP_DIRECTION_AUTO, 0);
}
static void
_e_zone_cb_menu_deactivate(void *data EINA_UNUSED, E_Menu *m)
{
e_object_del(E_OBJECT(m));
}

View File

@ -0,0 +1,67 @@
#ifdef E_TYPEDEFS
typedef enum _E_Zone_Edge
{
E_ZONE_EDGE_NONE,
E_ZONE_EDGE_LEFT,
E_ZONE_EDGE_RIGHT,
E_ZONE_EDGE_TOP,
E_ZONE_EDGE_BOTTOM,
E_ZONE_EDGE_TOP_LEFT,
E_ZONE_EDGE_TOP_RIGHT,
E_ZONE_EDGE_BOTTOM_RIGHT,
E_ZONE_EDGE_BOTTOM_LEFT
} E_Zone_Edge;
typedef struct _E_Zone E_Zone;
typedef struct _E_Event_Zone_Edge E_Event_Zone_Edge;
#else
# ifndef E_ZONE_H
# define E_ZONE_H
# define E_ZONE_TYPE 0xE0b0100d
struct _E_Zone
{
E_Object e_obj_inherit;
E_Container *container;
int x, y, w, h;
unsigned int num;
const char *name;
Evas_Object *o_bg, *o_prev_bg, *o_bg_clip, *o_bg_event;
Evas_Object *o_trans;
E_Desk **desks;
Eina_Bool visible : 1;
int desk_x_count, desk_y_count;
int desk_x_current, desk_y_current;
Eina_List *popups;
};
struct _E_Event_Zone_Edge
{
E_Zone *zone;
E_Zone_Edge edge;
int x, y, modifiers;
};
EINTERN int e_zone_init(void);
EINTERN int e_zone_shutdown(void);
EAPI E_Zone *e_zone_new(E_Container *con, int num, int x, int y, int w, int h);
EAPI void e_zone_desk_count_set(E_Zone *zone, int x, int y);
EAPI void e_zone_show(E_Zone *zone);
EAPI void e_zone_hide(E_Zone *zone);
EAPI E_Zone *e_zone_current_get(E_Container *con);
EAPI void e_zone_bg_reconfigure(E_Zone *zone);
EAPI void e_zone_useful_geometry_get(E_Zone *zone, int *x, int *y, int *w, int *h);
EAPI void e_zone_desk_count_get(E_Zone *zone, int *x, int *y);
# endif
#endif