2012-06-17 09:32:23 -07:00
|
|
|
#include "private.h"
|
2012-06-17 09:03:46 -07:00
|
|
|
|
|
|
|
#include <Ecore_Getopt.h>
|
2012-06-12 03:10:01 -07:00
|
|
|
#include <Elementary.h>
|
2012-06-13 08:10:18 -07:00
|
|
|
#include "main.h"
|
2012-06-12 03:10:01 -07:00
|
|
|
#include "win.h"
|
|
|
|
#include "termio.h"
|
2012-08-14 05:30:55 -07:00
|
|
|
#include "termcmd.h"
|
2012-06-12 03:10:01 -07:00
|
|
|
#include "config.h"
|
2012-06-23 23:39:54 -07:00
|
|
|
#include "controls.h"
|
2012-06-16 21:10:17 -07:00
|
|
|
#include "media.h"
|
2012-06-19 08:59:49 -07:00
|
|
|
#include "utils.h"
|
2012-06-12 03:10:01 -07:00
|
|
|
|
2012-06-17 09:32:23 -07:00
|
|
|
int _log_domain = -1;
|
|
|
|
|
2012-08-22 19:53:59 -07:00
|
|
|
static Evas_Object *win = NULL, *bg = NULL, *backbg = NULL, *term = NULL, *media = NULL;
|
2012-08-14 05:30:55 -07:00
|
|
|
static Evas_Object *cmdbox = NULL;
|
2012-07-04 07:44:43 -07:00
|
|
|
static Evas_Object *popmedia = NULL;
|
2012-07-01 19:52:48 -07:00
|
|
|
static Evas_Object *conform = NULL;
|
2012-06-16 19:35:07 -07:00
|
|
|
static Ecore_Timer *flush_timer = NULL;
|
2012-06-23 02:25:01 -07:00
|
|
|
static Eina_Bool focused = EINA_FALSE;
|
2012-08-05 02:38:58 -07:00
|
|
|
static Eina_Bool hold = EINA_FALSE;
|
2012-08-14 05:30:55 -07:00
|
|
|
static Eina_Bool cmdbox_up = EINA_FALSE;
|
2012-08-16 20:21:06 -07:00
|
|
|
static Ecore_Timer *_cmdbox_focus_timer = NULL;
|
2012-07-18 00:18:45 -07:00
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_del(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
|
|
|
{
|
2012-07-19 18:38:09 -07:00
|
|
|
win = NULL;
|
2012-07-18 00:18:45 -07:00
|
|
|
}
|
2012-06-12 03:10:01 -07:00
|
|
|
|
|
|
|
static void
|
2012-06-17 10:04:17 -07:00
|
|
|
_cb_focus_in(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
2012-06-12 03:10:01 -07:00
|
|
|
{
|
2012-06-23 02:25:01 -07:00
|
|
|
if (!focused) elm_win_urgent_set(win, EINA_FALSE);
|
|
|
|
focused = EINA_TRUE;
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_signal_emit(bg, "focus,in", "terminology");
|
2012-08-14 05:30:55 -07:00
|
|
|
if (cmdbox_up)
|
|
|
|
elm_object_focus_set(cmdbox, EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_object_focus_set(data, EINA_TRUE);
|
2012-06-12 03:10:01 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-06-17 10:04:17 -07:00
|
|
|
_cb_focus_out(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
2012-06-12 03:10:01 -07:00
|
|
|
{
|
2012-06-23 02:25:01 -07:00
|
|
|
focused = EINA_FALSE;
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_signal_emit(bg, "focus,out", "terminology");
|
2012-08-14 05:30:55 -07:00
|
|
|
if (cmdbox_up)
|
|
|
|
elm_object_focus_set(cmdbox, EINA_FALSE);
|
|
|
|
else
|
|
|
|
elm_object_focus_set(data, EINA_FALSE);
|
2012-06-16 19:35:07 -07:00
|
|
|
elm_cache_all_flush();
|
2012-06-12 03:10:01 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-06-17 10:04:17 -07:00
|
|
|
_cb_size_hint(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event __UNUSED__)
|
2012-06-12 03:10:01 -07:00
|
|
|
{
|
|
|
|
Evas_Coord mw, mh, rw, rh, w = 0, h = 0;
|
2012-06-12 17:26:00 -07:00
|
|
|
|
2012-06-12 03:10:01 -07:00
|
|
|
evas_object_size_hint_min_get(obj, &mw, &mh);
|
|
|
|
evas_object_size_hint_request_get(obj, &rw, &rh);
|
2012-06-12 17:26:00 -07:00
|
|
|
|
2012-06-12 03:10:01 -07:00
|
|
|
edje_object_size_min_calc(bg, &w, &h);
|
|
|
|
evas_object_size_hint_min_set(bg, w, h);
|
|
|
|
elm_win_size_base_set(win, w - mw, h - mh);
|
|
|
|
elm_win_size_step_set(win, mw, mh);
|
|
|
|
if (!evas_object_data_get(obj, "sizedone"))
|
|
|
|
{
|
|
|
|
evas_object_resize(win, w - mw + rw, h - mh + rh);
|
|
|
|
evas_object_data_set(obj, "sizedone", obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-12 06:08:09 -07:00
|
|
|
static void
|
2012-06-17 10:04:17 -07:00
|
|
|
_cb_options(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
2012-06-12 06:08:09 -07:00
|
|
|
{
|
2012-06-23 23:39:54 -07:00
|
|
|
controls_toggle(win, bg, term);
|
2012-06-12 06:08:09 -07:00
|
|
|
}
|
|
|
|
|
2012-06-16 19:35:07 -07:00
|
|
|
static Eina_Bool
|
2012-06-17 10:04:17 -07:00
|
|
|
_cb_flush(void *data __UNUSED__)
|
2012-06-16 19:35:07 -07:00
|
|
|
{
|
|
|
|
flush_timer = NULL;
|
|
|
|
elm_cache_all_flush();
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-06-17 10:04:17 -07:00
|
|
|
_cb_change(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
2012-06-16 19:35:07 -07:00
|
|
|
{
|
|
|
|
if (!flush_timer) flush_timer = ecore_timer_add(0.25, _cb_flush, NULL);
|
|
|
|
else ecore_timer_delay(flush_timer, 0.25);
|
|
|
|
}
|
|
|
|
|
2012-06-20 07:12:26 -07:00
|
|
|
static void
|
|
|
|
_cb_exited(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
|
|
|
{
|
2012-08-05 02:38:58 -07:00
|
|
|
if (!hold) elm_exit();
|
2012-06-20 07:12:26 -07:00
|
|
|
}
|
|
|
|
|
2012-06-23 02:25:01 -07:00
|
|
|
static void
|
|
|
|
_cb_bell(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
|
|
|
{
|
|
|
|
Config *config = termio_config_get(term);
|
2012-07-05 08:12:54 -07:00
|
|
|
|
2012-08-05 02:38:58 -07:00
|
|
|
if (!config->disable_visual_bell)
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_signal_emit(bg, "bell", "terminology");
|
2012-06-23 02:25:01 -07:00
|
|
|
if (!config) return;
|
|
|
|
if (config->urg_bell)
|
|
|
|
{
|
|
|
|
if (!focused) elm_win_urgent_set(win, EINA_TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-04 07:44:43 -07:00
|
|
|
static void
|
|
|
|
_cb_popmedia_done(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *src __UNUSED__)
|
|
|
|
{
|
|
|
|
if (popmedia)
|
|
|
|
{
|
|
|
|
evas_object_del(popmedia);
|
|
|
|
popmedia = NULL;
|
|
|
|
termio_mouseover_suspend_pushpop(term, -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-22 02:20:54 -07:00
|
|
|
static void
|
|
|
|
_cb_popmedia_del(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
|
|
|
|
{
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_signal_emit(bg, "popmedia,off", "terminology");
|
2012-08-22 02:20:54 -07:00
|
|
|
}
|
|
|
|
|
2012-07-04 07:44:43 -07:00
|
|
|
static void
|
|
|
|
_cb_popup(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
|
|
|
{
|
|
|
|
Evas_Object *o;
|
|
|
|
Config *config = termio_config_get(term);
|
|
|
|
const char *src;
|
|
|
|
int type = 0;
|
2012-07-05 08:12:54 -07:00
|
|
|
|
2012-07-04 07:44:43 -07:00
|
|
|
if (!config) return;
|
|
|
|
src = termio_link_get(term);
|
|
|
|
if (!src) return;
|
|
|
|
if (popmedia) evas_object_del(popmedia);
|
|
|
|
if (!popmedia) termio_mouseover_suspend_pushpop(term, 1);
|
|
|
|
popmedia = o = media_add(win, src, config, MEDIA_POP, &type);
|
2012-08-22 02:20:54 -07:00
|
|
|
evas_object_event_callback_add(o, EVAS_CALLBACK_DEL, _cb_popmedia_del, NULL);
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_part_swallow(bg, "terminology.popmedia", o);
|
2012-07-04 07:44:43 -07:00
|
|
|
evas_object_show(o);
|
|
|
|
if (type == TYPE_IMG)
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_signal_emit(bg, "popmedia,image", "terminology");
|
2012-07-04 07:44:43 -07:00
|
|
|
else if (type == TYPE_SCALE)
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_signal_emit(bg, "popmedia,scale", "terminology");
|
2012-07-04 07:44:43 -07:00
|
|
|
else if (type == TYPE_EDJE)
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_signal_emit(bg, "popmedia,edje", "terminology");
|
2012-07-04 07:44:43 -07:00
|
|
|
else if (type == TYPE_MOV)
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_signal_emit(bg, "popmedia,movie", "terminology");
|
2012-07-04 07:44:43 -07:00
|
|
|
}
|
|
|
|
|
2012-08-16 20:21:06 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_cb_cmd_focus(void *data)
|
|
|
|
{
|
|
|
|
_cmdbox_focus_timer = NULL;
|
|
|
|
elm_object_focus_set(data, EINA_TRUE);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-08-14 05:30:55 -07:00
|
|
|
static void
|
|
|
|
_cb_cmdbox(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
|
|
|
{
|
|
|
|
cmdbox_up = EINA_TRUE;
|
|
|
|
elm_object_focus_set(term, EINA_FALSE);
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_signal_emit(bg, "cmdbox,show", "terminology");
|
2012-08-14 05:30:55 -07:00
|
|
|
elm_entry_entry_set(cmdbox, "");
|
|
|
|
evas_object_show(cmdbox);
|
2012-08-16 20:21:06 -07:00
|
|
|
if (_cmdbox_focus_timer) ecore_timer_del(_cmdbox_focus_timer);
|
|
|
|
_cmdbox_focus_timer = ecore_timer_add(0.1, _cb_cmd_focus, cmdbox);
|
2012-08-14 05:30:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_cmd_activated(void *data __UNUSED__, Evas_Object *obj, void *event __UNUSED__)
|
|
|
|
{
|
|
|
|
char *cmd;
|
|
|
|
|
|
|
|
elm_object_focus_set(obj, EINA_FALSE);
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_signal_emit(bg, "cmdbox,hide", "terminology");
|
2012-08-14 05:30:55 -07:00
|
|
|
elm_object_focus_set(term, EINA_TRUE);
|
|
|
|
cmd = (char *)elm_entry_entry_get(obj);
|
|
|
|
if (cmd)
|
|
|
|
{
|
|
|
|
cmd = elm_entry_markup_to_utf8(cmd);
|
|
|
|
if (cmd)
|
|
|
|
{
|
|
|
|
termcmd_do(term, win, bg, cmd);
|
|
|
|
free(cmd);
|
|
|
|
}
|
|
|
|
}
|
2012-08-16 20:21:06 -07:00
|
|
|
if (_cmdbox_focus_timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(_cmdbox_focus_timer);
|
|
|
|
_cmdbox_focus_timer = NULL;
|
|
|
|
}
|
2012-08-14 05:30:55 -07:00
|
|
|
cmdbox_up = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_cmd_aborted(void *data __UNUSED__, Evas_Object *obj, void *event __UNUSED__)
|
|
|
|
{
|
|
|
|
elm_object_focus_set(obj, EINA_FALSE);
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_signal_emit(bg, "cmdbox,hide", "terminology");
|
2012-08-14 05:30:55 -07:00
|
|
|
elm_object_focus_set(term, EINA_TRUE);
|
2012-08-16 20:21:06 -07:00
|
|
|
if (_cmdbox_focus_timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(_cmdbox_focus_timer);
|
|
|
|
_cmdbox_focus_timer = NULL;
|
|
|
|
}
|
2012-08-14 05:30:55 -07:00
|
|
|
cmdbox_up = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_cmd_changed(void *data __UNUSED__, Evas_Object *obj, void *event __UNUSED__)
|
|
|
|
{
|
|
|
|
char *cmd;
|
|
|
|
|
|
|
|
cmd = (char *)elm_entry_entry_get(obj);
|
|
|
|
if (cmd)
|
|
|
|
{
|
|
|
|
cmd = elm_entry_markup_to_utf8(cmd);
|
|
|
|
if (cmd)
|
|
|
|
{
|
|
|
|
termcmd_watch(term, win, bg, cmd);
|
|
|
|
free(cmd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_cmd_hints_changed(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
|
|
|
{
|
|
|
|
evas_object_show(obj);
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_part_swallow(data, "terminology.cmdbox", obj);
|
2012-08-14 05:30:55 -07:00
|
|
|
}
|
|
|
|
|
2012-06-16 07:00:00 -07:00
|
|
|
void
|
2012-06-17 13:24:23 -07:00
|
|
|
main_trans_update(const Config *config)
|
2012-06-16 07:00:00 -07:00
|
|
|
{
|
|
|
|
if (config->translucent)
|
|
|
|
{
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_signal_emit(bg, "translucent,on", "terminology");
|
2012-06-16 07:00:00 -07:00
|
|
|
elm_win_alpha_set(win, EINA_TRUE);
|
2012-08-22 19:53:59 -07:00
|
|
|
evas_object_hide(backbg);
|
2012-06-16 07:00:00 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_signal_emit(bg, "translucent,off", "terminology");
|
2012-06-16 07:00:00 -07:00
|
|
|
elm_win_alpha_set(win, EINA_FALSE);
|
2012-08-22 19:53:59 -07:00
|
|
|
evas_object_show(backbg);
|
2012-06-16 07:00:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:15:44 -07:00
|
|
|
static void
|
|
|
|
_cb_media_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
|
|
|
{
|
|
|
|
Config *config = data;
|
|
|
|
media = NULL;
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_signal_emit(bg, "media,off", "terminology");
|
2012-08-22 19:15:44 -07:00
|
|
|
if (config->temporary) eina_stringshare_replace(&(config->background), NULL);
|
|
|
|
}
|
|
|
|
|
2012-06-16 21:10:17 -07:00
|
|
|
void
|
2012-06-17 13:24:23 -07:00
|
|
|
main_media_update(const Config *config)
|
2012-06-16 21:10:17 -07:00
|
|
|
{
|
|
|
|
Evas_Object *o;
|
2012-06-17 00:10:27 -07:00
|
|
|
int type = 0;
|
2012-07-05 08:12:54 -07:00
|
|
|
|
2012-06-16 22:41:02 -07:00
|
|
|
if ((config->background) && (config->background[0]))
|
2012-06-16 21:10:17 -07:00
|
|
|
{
|
2012-08-22 19:15:44 -07:00
|
|
|
if (media)
|
|
|
|
{
|
|
|
|
evas_object_event_callback_del(media, EVAS_CALLBACK_DEL,
|
|
|
|
_cb_media_del);
|
|
|
|
evas_object_del(media);
|
|
|
|
}
|
2012-06-17 13:24:23 -07:00
|
|
|
o = media = media_add(win, config->background, config, MEDIA_BG, &type);
|
2012-08-22 19:15:44 -07:00
|
|
|
evas_object_event_callback_add(media, EVAS_CALLBACK_DEL,
|
|
|
|
_cb_media_del, config);
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_part_swallow(bg, "terminology.background", o);
|
2012-07-04 07:44:43 -07:00
|
|
|
evas_object_show(o);
|
2012-06-17 00:10:27 -07:00
|
|
|
if (type == TYPE_IMG)
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_signal_emit(bg, "media,image", "terminology");
|
2012-06-17 00:10:27 -07:00
|
|
|
else if (type == TYPE_SCALE)
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_signal_emit(bg, "media,scale", "terminology");
|
2012-06-17 00:10:27 -07:00
|
|
|
else if (type == TYPE_EDJE)
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_signal_emit(bg, "media,edje", "terminology");
|
2012-06-17 00:10:27 -07:00
|
|
|
else if (type == TYPE_MOV)
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_signal_emit(bg, "media,movie", "terminology");
|
2012-06-16 21:10:17 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (media)
|
|
|
|
{
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_signal_emit(bg, "media,off", "terminology");
|
2012-06-16 21:10:17 -07:00
|
|
|
evas_object_del(media);
|
|
|
|
media = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-17 02:26:01 -07:00
|
|
|
void
|
2012-06-17 13:24:23 -07:00
|
|
|
main_media_mute_update(const Config *config)
|
2012-06-17 02:26:01 -07:00
|
|
|
{
|
|
|
|
if (media) media_mute_set(media, config->mute);
|
|
|
|
}
|
|
|
|
|
2012-06-17 09:03:46 -07:00
|
|
|
static const char *emotion_choices[] = {
|
|
|
|
"auto", "gstreamer", "xine", "generic",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
static const Ecore_Getopt options = {
|
|
|
|
PACKAGE_NAME,
|
|
|
|
"%prog [options]",
|
|
|
|
PACKAGE_VERSION,
|
2012-06-23 18:27:44 -07:00
|
|
|
"(C) 2012 Carsten Haitzler and others",
|
2012-06-18 07:22:15 -07:00
|
|
|
"BSD 2-Clause",
|
2012-06-17 09:03:46 -07:00
|
|
|
"Terminal emulator written with Enlightenment Foundation Libraries.",
|
|
|
|
EINA_TRUE,
|
|
|
|
{
|
2012-12-14 20:26:13 -08:00
|
|
|
#if (ECORE_VERSION_MAJOR >= 1) || (ECORE_VERSION_MINOR >= 8)
|
2012-12-10 13:52:39 -08:00
|
|
|
ECORE_GETOPT_BREAK_STR ('e', "exec",
|
2012-12-14 20:26:13 -08:00
|
|
|
#else
|
|
|
|
ECORE_GETOPT_STORE_STR ('e', "exec",
|
|
|
|
#endif
|
2012-07-05 03:04:39 -07:00
|
|
|
"command to execute. "
|
|
|
|
"Defaults to $SHELL (or passwd shel or /bin/sh)"),
|
2012-08-05 17:06:13 -07:00
|
|
|
ECORE_GETOPT_STORE_STR ('d', "current-directory",
|
2012-08-05 02:38:58 -07:00
|
|
|
"Change to directory for execution of terminal command."),
|
2012-07-05 03:04:39 -07:00
|
|
|
ECORE_GETOPT_STORE_STR ('t', "theme",
|
|
|
|
"Use the named edje theme or path to theme file."),
|
|
|
|
ECORE_GETOPT_STORE_STR ('b', "background",
|
|
|
|
"Use the named file as a background wallpaper."),
|
|
|
|
ECORE_GETOPT_STORE_STR ('g', "geometry",
|
|
|
|
"Terminal geometry to use (eg 80x24 or 80x24+50+20 etc.)."),
|
|
|
|
ECORE_GETOPT_STORE_STR ('n', "name",
|
|
|
|
"Set window name."),
|
|
|
|
ECORE_GETOPT_STORE_STR ('r', "role",
|
|
|
|
"Set window role."),
|
|
|
|
ECORE_GETOPT_STORE_STR ('T', "title",
|
|
|
|
"Set window title."),
|
|
|
|
ECORE_GETOPT_STORE_STR ('i', "icon-name",
|
|
|
|
"Set icon name."),
|
2012-08-05 02:38:58 -07:00
|
|
|
ECORE_GETOPT_STORE_STR ('f', "font",
|
|
|
|
"Set font (NAME/SIZE for scalable, NAME for bitmap."),
|
2012-07-05 03:04:39 -07:00
|
|
|
ECORE_GETOPT_CHOICE ('v', "video-module",
|
|
|
|
"Set emotion module to use.", emotion_choices),
|
2012-08-05 02:38:58 -07:00
|
|
|
|
2012-09-27 02:33:33 -07:00
|
|
|
ECORE_GETOPT_STORE_BOOL('l', "login",
|
|
|
|
"Run the shell as a login shell."),
|
2012-07-02 05:06:44 -07:00
|
|
|
ECORE_GETOPT_STORE_BOOL('m', "video-mute",
|
2012-06-17 09:03:46 -07:00
|
|
|
"Set mute mode for video playback."),
|
2012-08-05 02:38:58 -07:00
|
|
|
ECORE_GETOPT_STORE_BOOL('c', "cursor-blink",
|
|
|
|
"Set cursor blink mode."),
|
2012-08-05 17:06:13 -07:00
|
|
|
ECORE_GETOPT_STORE_BOOL('G', "visual-bell",
|
2012-08-05 02:38:58 -07:00
|
|
|
"Set visual bell mode."),
|
2012-07-05 08:11:30 -07:00
|
|
|
ECORE_GETOPT_STORE_TRUE('F', "fullscreen",
|
2012-07-05 03:04:39 -07:00
|
|
|
"Go into the fullscreen mode from start."),
|
2012-07-05 08:11:30 -07:00
|
|
|
ECORE_GETOPT_STORE_TRUE('I', "iconic",
|
2012-07-05 03:04:39 -07:00
|
|
|
"Go into an iconic state from the start."),
|
2012-07-05 08:11:30 -07:00
|
|
|
ECORE_GETOPT_STORE_TRUE('B', "borderless",
|
2012-07-05 03:04:39 -07:00
|
|
|
"Become a borderless managed window."),
|
2012-07-05 08:11:30 -07:00
|
|
|
ECORE_GETOPT_STORE_TRUE('O', "override",
|
2012-07-05 03:04:39 -07:00
|
|
|
"Become an override-redirect window."),
|
2012-07-05 08:11:30 -07:00
|
|
|
ECORE_GETOPT_STORE_TRUE('M', "maximized",
|
2012-07-05 03:04:39 -07:00
|
|
|
"Become maximized from the start."),
|
2012-07-05 12:19:21 -07:00
|
|
|
ECORE_GETOPT_STORE_TRUE('W', "nowm",
|
|
|
|
"Terminology is run without a wm."),
|
2012-08-05 02:38:58 -07:00
|
|
|
ECORE_GETOPT_STORE_TRUE('H', "hold",
|
|
|
|
"Don't exit when the command process exits."),
|
|
|
|
|
|
|
|
ECORE_GETOPT_VERSION ('V', "version"),
|
|
|
|
ECORE_GETOPT_COPYRIGHT ('C', "copyright"),
|
|
|
|
ECORE_GETOPT_LICENSE ('L', "license"),
|
|
|
|
ECORE_GETOPT_HELP ('h', "help"),
|
2012-06-17 09:03:46 -07:00
|
|
|
ECORE_GETOPT_SENTINEL
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-06-12 03:10:01 -07:00
|
|
|
EAPI_MAIN int
|
|
|
|
elm_main(int argc, char **argv)
|
|
|
|
{
|
2012-06-17 09:03:46 -07:00
|
|
|
char *cmd = NULL;
|
2012-08-05 02:38:58 -07:00
|
|
|
char *cd = NULL;
|
2012-06-17 09:03:46 -07:00
|
|
|
char *theme = NULL;
|
|
|
|
char *background = NULL;
|
2012-07-02 05:06:44 -07:00
|
|
|
char *geometry = NULL;
|
2012-07-05 03:04:39 -07:00
|
|
|
char *name = NULL;
|
|
|
|
char *role = NULL;
|
|
|
|
char *title = NULL;
|
|
|
|
char *icon_name = NULL;
|
2012-08-05 02:38:58 -07:00
|
|
|
char *font = NULL;
|
2012-06-17 09:03:46 -07:00
|
|
|
char *video_module = NULL;
|
2012-09-27 02:33:33 -07:00
|
|
|
Eina_Bool login_shell = 0xff; /* unset */
|
2012-06-17 09:03:46 -07:00
|
|
|
Eina_Bool video_mute = 0xff; /* unset */
|
2012-08-05 02:38:58 -07:00
|
|
|
Eina_Bool cursor_blink = 0xff; /* unset */
|
|
|
|
Eina_Bool visual_bell = 0xff; /* unset */
|
2012-07-05 08:11:30 -07:00
|
|
|
Eina_Bool fullscreen = EINA_FALSE;
|
|
|
|
Eina_Bool iconic = EINA_FALSE;
|
|
|
|
Eina_Bool borderless = EINA_FALSE;
|
|
|
|
Eina_Bool override = EINA_FALSE;
|
|
|
|
Eina_Bool maximized = EINA_FALSE;
|
2012-07-05 12:19:21 -07:00
|
|
|
Eina_Bool nowm = EINA_FALSE;
|
2012-06-17 09:03:46 -07:00
|
|
|
Eina_Bool quit_option = EINA_FALSE;
|
2012-12-14 20:26:13 -08:00
|
|
|
#if (ECORE_VERSION_MAJOR >= 1) || (ECORE_VERSION_MINOR >= 8)
|
2012-12-10 13:52:39 -08:00
|
|
|
Eina_Bool cmd_options = EINA_FALSE;
|
2012-12-14 20:26:13 -08:00
|
|
|
#endif
|
2012-06-17 09:03:46 -07:00
|
|
|
Ecore_Getopt_Value values[] = {
|
2012-12-14 20:26:13 -08:00
|
|
|
#if (ECORE_VERSION_MAJOR >= 1) || (ECORE_VERSION_MINOR >= 8)
|
2012-12-10 13:52:39 -08:00
|
|
|
ECORE_GETOPT_VALUE_BOOL(cmd_options),
|
2012-12-14 20:26:13 -08:00
|
|
|
#else
|
|
|
|
ECORE_GETOPT_VALUE_STR(cmd),
|
|
|
|
#endif
|
2012-08-05 02:38:58 -07:00
|
|
|
ECORE_GETOPT_VALUE_STR(cd),
|
2012-06-17 09:03:46 -07:00
|
|
|
ECORE_GETOPT_VALUE_STR(theme),
|
|
|
|
ECORE_GETOPT_VALUE_STR(background),
|
2012-07-02 05:06:44 -07:00
|
|
|
ECORE_GETOPT_VALUE_STR(geometry),
|
2012-07-05 03:04:39 -07:00
|
|
|
ECORE_GETOPT_VALUE_STR(name),
|
|
|
|
ECORE_GETOPT_VALUE_STR(role),
|
|
|
|
ECORE_GETOPT_VALUE_STR(title),
|
|
|
|
ECORE_GETOPT_VALUE_STR(icon_name),
|
2012-08-05 02:38:58 -07:00
|
|
|
ECORE_GETOPT_VALUE_STR(font),
|
2012-06-17 09:03:46 -07:00
|
|
|
ECORE_GETOPT_VALUE_STR(video_module),
|
2012-08-05 02:38:58 -07:00
|
|
|
|
2012-09-27 02:33:33 -07:00
|
|
|
ECORE_GETOPT_VALUE_BOOL(login_shell),
|
2012-06-17 09:03:46 -07:00
|
|
|
ECORE_GETOPT_VALUE_BOOL(video_mute),
|
2012-08-05 02:38:58 -07:00
|
|
|
ECORE_GETOPT_VALUE_BOOL(cursor_blink),
|
|
|
|
ECORE_GETOPT_VALUE_BOOL(visual_bell),
|
2012-07-02 05:06:44 -07:00
|
|
|
ECORE_GETOPT_VALUE_BOOL(fullscreen),
|
2012-07-05 03:04:39 -07:00
|
|
|
ECORE_GETOPT_VALUE_BOOL(iconic),
|
|
|
|
ECORE_GETOPT_VALUE_BOOL(borderless),
|
|
|
|
ECORE_GETOPT_VALUE_BOOL(override),
|
|
|
|
ECORE_GETOPT_VALUE_BOOL(maximized),
|
2012-07-05 12:19:21 -07:00
|
|
|
ECORE_GETOPT_VALUE_BOOL(nowm),
|
2012-08-05 02:38:58 -07:00
|
|
|
ECORE_GETOPT_VALUE_BOOL(hold),
|
|
|
|
|
2012-06-17 09:03:46 -07:00
|
|
|
ECORE_GETOPT_VALUE_BOOL(quit_option),
|
|
|
|
ECORE_GETOPT_VALUE_BOOL(quit_option),
|
|
|
|
ECORE_GETOPT_VALUE_BOOL(quit_option),
|
|
|
|
ECORE_GETOPT_VALUE_BOOL(quit_option),
|
2012-08-05 02:38:58 -07:00
|
|
|
|
2012-06-17 09:03:46 -07:00
|
|
|
ECORE_GETOPT_VALUE_NONE
|
|
|
|
};
|
|
|
|
int args, retval = EXIT_SUCCESS;
|
2012-06-17 13:24:23 -07:00
|
|
|
Config *config;
|
2012-06-12 03:10:01 -07:00
|
|
|
Evas_Object *o;
|
2012-07-02 05:06:44 -07:00
|
|
|
int pos_set = 0, size_set = 0;
|
|
|
|
int pos_x = 0, pos_y = 0;
|
|
|
|
int size_w = 1, size_h = 1;
|
2012-06-12 03:10:01 -07:00
|
|
|
|
2012-06-17 09:32:23 -07:00
|
|
|
_log_domain = eina_log_domain_register("terminology", NULL);
|
|
|
|
if (_log_domain < 0)
|
|
|
|
{
|
|
|
|
EINA_LOG_CRIT("could not create log domain 'terminology'.");
|
|
|
|
elm_shutdown();
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
2012-06-12 03:10:01 -07:00
|
|
|
config_init();
|
2012-06-17 13:24:23 -07:00
|
|
|
|
|
|
|
config = config_load("config");
|
|
|
|
|
2012-06-12 03:10:01 -07:00
|
|
|
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
|
|
|
elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
|
|
|
|
elm_app_compile_data_dir_set(PACKAGE_DATA_DIR);
|
|
|
|
elm_app_info_set(elm_main, "terminology", "themes/default.edj");
|
|
|
|
|
2012-06-17 09:03:46 -07:00
|
|
|
args = ecore_getopt_parse(&options, values, argc, argv);
|
|
|
|
if (args < 0)
|
2012-06-12 03:10:01 -07:00
|
|
|
{
|
2012-06-17 09:32:23 -07:00
|
|
|
ERR("Could not parse command line options.");
|
2012-06-17 09:03:46 -07:00
|
|
|
retval = EXIT_FAILURE;
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (quit_option) goto end;
|
|
|
|
|
2012-12-14 20:26:13 -08:00
|
|
|
#if (ECORE_VERSION_MAJOR >= 1) || (ECORE_VERSION_MINOR >= 8)
|
2012-12-10 13:52:39 -08:00
|
|
|
if (cmd_options)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Eina_Strbuf *strb;
|
|
|
|
|
|
|
|
if (args == argc)
|
|
|
|
{
|
|
|
|
fprintf(stdout, "ERROR: option %s requires an argument!\n", argv[args-1]);
|
|
|
|
fprintf(stdout, "ERROR: invalid options found. See --help.\n");
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
|
|
|
|
strb = eina_strbuf_new();
|
|
|
|
for(i = args; i < argc; i++)
|
|
|
|
{
|
|
|
|
eina_strbuf_append(strb, argv[i]);
|
|
|
|
eina_strbuf_append_char(strb, ' ');
|
|
|
|
}
|
|
|
|
cmd = eina_strbuf_string_steal(strb);
|
|
|
|
eina_strbuf_free(strb);
|
|
|
|
}
|
2012-12-14 20:26:13 -08:00
|
|
|
#endif
|
|
|
|
|
2012-06-17 09:03:46 -07:00
|
|
|
if (theme)
|
|
|
|
{
|
2012-06-17 11:03:33 -07:00
|
|
|
char path[PATH_MAX];
|
2012-07-05 03:04:39 -07:00
|
|
|
char nom[PATH_MAX];
|
2012-06-17 11:03:33 -07:00
|
|
|
|
2012-06-17 09:03:46 -07:00
|
|
|
if (eina_str_has_suffix(theme, ".edj"))
|
2012-07-05 03:04:39 -07:00
|
|
|
eina_strlcpy(nom, theme, sizeof(nom));
|
2012-06-17 09:03:46 -07:00
|
|
|
else
|
2012-07-05 03:04:39 -07:00
|
|
|
snprintf(nom, sizeof(nom), "%s.edj", theme);
|
2012-06-17 11:03:33 -07:00
|
|
|
|
2012-07-05 03:04:39 -07:00
|
|
|
if (strchr(nom, '/'))
|
|
|
|
eina_strlcpy(path, nom, sizeof(path));
|
2012-06-17 11:03:33 -07:00
|
|
|
else
|
|
|
|
snprintf(path, sizeof(path), "%s/themes/%s",
|
2012-07-05 03:04:39 -07:00
|
|
|
elm_app_data_dir_get(), nom);
|
2012-06-17 11:03:33 -07:00
|
|
|
|
|
|
|
eina_stringshare_replace(&(config->theme), path);
|
2012-06-17 13:24:23 -07:00
|
|
|
config->temporary = EINA_TRUE;
|
2012-06-17 09:03:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (background)
|
|
|
|
{
|
|
|
|
eina_stringshare_replace(&(config->background), background);
|
2012-06-17 13:24:23 -07:00
|
|
|
config->temporary = EINA_TRUE;
|
2012-06-17 09:03:46 -07:00
|
|
|
}
|
|
|
|
|
2012-08-05 02:38:58 -07:00
|
|
|
if (font)
|
|
|
|
{
|
|
|
|
if (strchr(font, '/'))
|
|
|
|
{
|
|
|
|
char *fname = alloca(strlen(font) + 1);
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
strcpy(fname, font);
|
|
|
|
p = strrchr(fname, '/');
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
int sz;
|
|
|
|
|
|
|
|
*p = 0;
|
|
|
|
p++;
|
|
|
|
sz = atoi(p);
|
|
|
|
if (sz > 0) config->font.size = sz;
|
|
|
|
eina_stringshare_replace(&(config->font.name), fname);
|
|
|
|
}
|
|
|
|
config->font.bitmap = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char buf[4096], *file;
|
|
|
|
Eina_List *files;
|
|
|
|
int n = strlen(font);
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "%s/fonts", elm_app_data_dir_get());
|
|
|
|
files = ecore_file_ls(buf);
|
|
|
|
EINA_LIST_FREE(files, file)
|
|
|
|
{
|
|
|
|
if (n > 0)
|
|
|
|
{
|
|
|
|
if (!strncasecmp(file, font, n))
|
|
|
|
{
|
|
|
|
n = -1;
|
|
|
|
eina_stringshare_replace(&(config->font.name), file);
|
|
|
|
config->font.bitmap = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
config->temporary = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2012-06-17 09:03:46 -07:00
|
|
|
if (video_module)
|
|
|
|
{
|
|
|
|
int i;
|
2012-06-17 10:04:17 -07:00
|
|
|
for (i = 0; i < (int)EINA_C_ARRAY_LENGTH(emotion_choices); i++)
|
2012-06-17 00:10:27 -07:00
|
|
|
{
|
2012-06-17 09:03:46 -07:00
|
|
|
if (video_module == emotion_choices[i])
|
|
|
|
break;
|
2012-06-17 00:10:27 -07:00
|
|
|
}
|
2012-06-17 09:03:46 -07:00
|
|
|
|
|
|
|
if (i == EINA_C_ARRAY_LENGTH(emotion_choices))
|
|
|
|
i = 0; /* ecore getopt shouldn't let this happen, but... */
|
|
|
|
config->vidmod = i;
|
2012-06-17 13:24:23 -07:00
|
|
|
config->temporary = EINA_TRUE;
|
2012-06-17 09:03:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (video_mute != 0xff)
|
|
|
|
{
|
|
|
|
config->mute = video_mute;
|
2012-06-17 13:24:23 -07:00
|
|
|
config->temporary = EINA_TRUE;
|
2012-06-12 03:10:01 -07:00
|
|
|
}
|
2012-08-05 02:38:58 -07:00
|
|
|
if (cursor_blink != 0xff)
|
|
|
|
{
|
|
|
|
config->disable_cursor_blink = !cursor_blink;
|
|
|
|
config->temporary = EINA_TRUE;
|
|
|
|
}
|
|
|
|
if (visual_bell != 0xff)
|
|
|
|
{
|
|
|
|
config->disable_visual_bell = !visual_bell;
|
|
|
|
config->temporary = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2012-07-02 05:06:44 -07:00
|
|
|
if (geometry)
|
|
|
|
{
|
|
|
|
if (sscanf(geometry,"%ix%i+%i+%i", &size_w, &size_h, &pos_x, &pos_y) == 4)
|
|
|
|
{
|
|
|
|
pos_set = 1;
|
|
|
|
size_set = 1;
|
|
|
|
}
|
|
|
|
else if (sscanf(geometry,"%ix%i-%i+%i", &size_w, &size_h, &pos_x, &pos_y) == 4)
|
|
|
|
{
|
2012-07-02 05:49:51 -07:00
|
|
|
pos_x = -pos_x;
|
2012-07-02 05:06:44 -07:00
|
|
|
pos_set = 1;
|
|
|
|
size_set = 1;
|
|
|
|
}
|
|
|
|
else if (sscanf(geometry,"%ix%i-%i-%i", &size_w, &size_h, &pos_x, &pos_y) == 4)
|
|
|
|
{
|
2012-07-02 05:49:51 -07:00
|
|
|
pos_x = -pos_x;
|
|
|
|
pos_y = -pos_y;
|
2012-07-02 05:06:44 -07:00
|
|
|
pos_set = 1;
|
|
|
|
size_set = 1;
|
|
|
|
}
|
|
|
|
else if (sscanf(geometry,"%ix%i+%i-%i", &size_w, &size_h, &pos_x, &pos_y) == 4)
|
|
|
|
{
|
2012-07-02 05:49:51 -07:00
|
|
|
pos_y = -pos_y;
|
2012-07-02 05:06:44 -07:00
|
|
|
pos_set = 1;
|
|
|
|
size_set = 1;
|
|
|
|
}
|
|
|
|
else if (sscanf(geometry,"%ix%i", &size_w, &size_h) == 2)
|
|
|
|
{
|
|
|
|
size_set = 1;
|
|
|
|
}
|
|
|
|
else if (sscanf(geometry,"+%i+%i", &pos_x, &pos_y) == 2)
|
|
|
|
{
|
|
|
|
pos_set = 1;
|
|
|
|
}
|
|
|
|
else if (sscanf(geometry,"-%i+%i", &pos_x, &pos_y) == 2)
|
|
|
|
{
|
2012-07-02 05:49:51 -07:00
|
|
|
pos_x = -pos_x;
|
2012-07-02 05:06:44 -07:00
|
|
|
pos_set = 1;
|
|
|
|
}
|
|
|
|
else if (sscanf(geometry,"+%i-%i", &pos_x, &pos_y) == 2)
|
|
|
|
{
|
2012-07-02 05:49:51 -07:00
|
|
|
pos_y = -pos_y;
|
2012-07-02 05:06:44 -07:00
|
|
|
pos_set = 1;
|
|
|
|
}
|
|
|
|
else if (sscanf(geometry,"-%i-%i", &pos_x, &pos_y) == 2)
|
|
|
|
{
|
2012-07-02 05:49:51 -07:00
|
|
|
pos_x = -pos_x;
|
|
|
|
pos_y = -pos_y;
|
2012-07-02 05:06:44 -07:00
|
|
|
pos_set = 1;
|
|
|
|
}
|
|
|
|
}
|
2012-09-27 02:33:33 -07:00
|
|
|
|
|
|
|
// later allow default size to be configured
|
2012-07-02 05:06:44 -07:00
|
|
|
if (!size_set)
|
|
|
|
{
|
|
|
|
size_w = 80;
|
|
|
|
size_h = 24;
|
|
|
|
}
|
2012-09-27 02:33:33 -07:00
|
|
|
|
|
|
|
// for now if not set - dont do login shell - later from config
|
|
|
|
if (login_shell == 0xff) login_shell = EINA_FALSE;
|
2012-07-05 08:12:54 -07:00
|
|
|
|
2012-06-23 18:27:44 -07:00
|
|
|
// set an env so terminal apps can detect they are in terminology :)
|
|
|
|
putenv("TERMINOLOGY=1");
|
2012-08-21 08:01:39 -07:00
|
|
|
unsetenv("DESKTOP_STARTUP_ID");
|
2012-06-23 18:27:44 -07:00
|
|
|
|
2012-07-05 03:04:39 -07:00
|
|
|
win = tg_win_add(name, role, title, icon_name);
|
2012-07-05 08:12:54 -07:00
|
|
|
|
2012-07-18 00:18:45 -07:00
|
|
|
evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _cb_del, NULL);
|
2012-07-02 05:06:44 -07:00
|
|
|
elm_win_conformant_set(win, EINA_TRUE);
|
|
|
|
|
2012-07-05 08:11:30 -07:00
|
|
|
if (fullscreen) elm_win_fullscreen_set(win, EINA_TRUE);
|
|
|
|
if (iconic) elm_win_iconified_set(win, EINA_TRUE);
|
|
|
|
if (borderless) elm_win_borderless_set(win, EINA_TRUE);
|
|
|
|
if (override) elm_win_override_set(win, EINA_TRUE);
|
|
|
|
if (maximized) elm_win_maximized_set(win, EINA_TRUE);
|
|
|
|
|
2012-08-22 19:53:59 -07:00
|
|
|
backbg = o = evas_object_rectangle_add(evas_object_evas_get(win));
|
|
|
|
evas_object_color_set(o, 0, 0, 0, 255);
|
|
|
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
elm_win_resize_object_add(win, o);
|
|
|
|
evas_object_show(o);
|
|
|
|
|
2012-07-01 19:52:48 -07:00
|
|
|
conform = o = elm_conformant_add(win);
|
|
|
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
elm_win_resize_object_add(win, o);
|
|
|
|
evas_object_show(o);
|
2012-06-12 03:10:01 -07:00
|
|
|
|
|
|
|
bg = o = edje_object_add(evas_object_evas_get(win));
|
|
|
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2012-06-19 08:59:49 -07:00
|
|
|
if (!theme_apply(o, config, "terminology/background"))
|
|
|
|
{
|
|
|
|
CRITICAL("Couldn't find terminology theme! Forgot 'make install'?");
|
|
|
|
retval = EXIT_FAILURE;
|
|
|
|
goto end;
|
|
|
|
}
|
2012-10-02 13:24:13 -07:00
|
|
|
|
2012-06-19 08:59:49 -07:00
|
|
|
theme_auto_reload_enable(o);
|
2012-07-01 19:52:48 -07:00
|
|
|
elm_object_content_set(conform, o);
|
2012-06-12 03:10:01 -07:00
|
|
|
evas_object_show(o);
|
2012-07-05 08:12:54 -07:00
|
|
|
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_signal_callback_add(o, "popmedia,done", "terminology",
|
|
|
|
_cb_popmedia_done, NULL);
|
2012-06-12 17:26:00 -07:00
|
|
|
|
2012-07-02 05:49:51 -07:00
|
|
|
if (pos_set)
|
|
|
|
{
|
|
|
|
int screen_w, screen_h;
|
|
|
|
elm_win_screen_size_get(win, NULL, NULL, &screen_w, &screen_h);
|
|
|
|
if (pos_x < 0) pos_x = screen_w + pos_x;
|
|
|
|
if (pos_y < 0) pos_y = screen_h + pos_y;
|
|
|
|
evas_object_move(win, pos_x, pos_y);
|
|
|
|
}
|
2012-08-14 05:30:55 -07:00
|
|
|
|
|
|
|
cmdbox = o = elm_entry_add(win);
|
|
|
|
elm_entry_single_line_set(o, EINA_TRUE);
|
|
|
|
elm_entry_scrollable_set(o, EINA_FALSE);
|
2012-09-09 15:57:55 -07:00
|
|
|
elm_scroller_policy_set(o, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
|
2012-08-14 05:30:55 -07:00
|
|
|
elm_entry_input_panel_layout_set(o, ELM_INPUT_PANEL_LAYOUT_TERMINAL);
|
|
|
|
elm_entry_autocapital_type_set(o, ELM_AUTOCAPITAL_TYPE_NONE);
|
|
|
|
elm_entry_input_panel_enabled_set(o, EINA_TRUE);
|
|
|
|
elm_entry_input_panel_language_set(o, ELM_INPUT_PANEL_LANG_ALPHABET);
|
|
|
|
elm_entry_input_panel_return_key_type_set(o, ELM_INPUT_PANEL_RETURN_KEY_TYPE_GO);
|
|
|
|
elm_entry_prediction_allow_set(o, EINA_FALSE);
|
|
|
|
evas_object_show(o);
|
|
|
|
evas_object_smart_callback_add(o, "activated", _cb_cmd_activated, bg);
|
|
|
|
evas_object_smart_callback_add(o, "aborted", _cb_cmd_aborted, bg);
|
|
|
|
evas_object_smart_callback_add(o, "changed,user", _cb_cmd_changed, bg);
|
|
|
|
evas_object_event_callback_add(o, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _cb_cmd_hints_changed, bg);
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_part_swallow(bg, "terminology.cmdbox", o);
|
2012-08-14 05:30:55 -07:00
|
|
|
|
2012-09-27 02:33:33 -07:00
|
|
|
term = o = termio_add(win, config, cmd, login_shell, cd, size_w, size_h);
|
2012-06-12 03:10:01 -07:00
|
|
|
termio_win_set(o, win);
|
2012-10-02 13:24:13 -07:00
|
|
|
termio_theme_set(o, bg);
|
2012-06-12 03:10:01 -07:00
|
|
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
evas_object_event_callback_add(o, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_cb_size_hint, win);
|
2012-10-21 19:12:55 -07:00
|
|
|
edje_object_part_swallow(bg, "terminology.content", o);
|
2012-06-12 06:08:09 -07:00
|
|
|
evas_object_smart_callback_add(o, "options", _cb_options, NULL);
|
2012-06-16 21:10:17 -07:00
|
|
|
evas_object_smart_callback_add(o, "change", _cb_change, NULL);
|
2012-06-20 07:12:26 -07:00
|
|
|
evas_object_smart_callback_add(o, "exited", _cb_exited, NULL);
|
2012-06-23 02:25:01 -07:00
|
|
|
evas_object_smart_callback_add(o, "bell", _cb_bell, NULL);
|
2012-07-04 07:44:43 -07:00
|
|
|
evas_object_smart_callback_add(o, "popup", _cb_popup, NULL);
|
2012-08-14 05:30:55 -07:00
|
|
|
evas_object_smart_callback_add(o, "cmdbox", _cb_cmdbox, NULL);
|
2012-06-12 03:10:01 -07:00
|
|
|
evas_object_show(o);
|
|
|
|
|
2012-06-17 13:24:23 -07:00
|
|
|
main_trans_update(config);
|
|
|
|
main_media_update(config);
|
2012-06-19 08:59:49 -07:00
|
|
|
|
2012-06-12 03:10:01 -07:00
|
|
|
evas_object_smart_callback_add(win, "focus,in", _cb_focus_in, term);
|
|
|
|
evas_object_smart_callback_add(win, "focus,out", _cb_focus_out, term);
|
|
|
|
_cb_size_hint(win, evas_object_evas_get(win), term, NULL);
|
2012-06-12 17:26:00 -07:00
|
|
|
|
2012-06-12 03:10:01 -07:00
|
|
|
evas_object_show(win);
|
2012-07-05 12:19:21 -07:00
|
|
|
if (nowm)
|
|
|
|
ecore_evas_focus_set(
|
|
|
|
ecore_evas_ecore_evas_get(evas_object_evas_get(win)), 1);
|
2012-06-12 17:26:00 -07:00
|
|
|
|
2012-06-12 03:10:01 -07:00
|
|
|
elm_run();
|
2012-06-17 09:03:46 -07:00
|
|
|
end:
|
2012-12-14 20:26:13 -08:00
|
|
|
#if (ECORE_VERSION_MAJOR >= 1) || (ECORE_VERSION_MINOR >= 8)
|
2012-12-10 13:52:39 -08:00
|
|
|
free(cmd);
|
2012-12-14 20:26:13 -08:00
|
|
|
#endif
|
|
|
|
|
2012-06-17 13:24:23 -07:00
|
|
|
config_del(config);
|
2012-06-12 03:10:01 -07:00
|
|
|
config_shutdown();
|
2012-06-17 09:32:23 -07:00
|
|
|
|
2012-07-19 18:38:09 -07:00
|
|
|
if (win) evas_object_del(win);
|
2012-07-04 21:36:47 -07:00
|
|
|
|
2012-06-17 09:32:23 -07:00
|
|
|
eina_log_domain_unregister(_log_domain);
|
|
|
|
_log_domain = -1;
|
|
|
|
|
2012-06-15 23:28:39 -07:00
|
|
|
elm_shutdown();
|
2012-06-17 09:03:46 -07:00
|
|
|
return retval;
|
2012-06-12 03:10:01 -07:00
|
|
|
}
|
|
|
|
ELM_MAIN()
|