viking

webkit based web browser for Enlightenment
Log | Files | Refs | LICENSE

commit 3378961a00ec8fa78a1777efb315b4ca5984e5c5
parent 8842bcf47282aff863ddfb6fb80130c730ffcede
Author: Kyle Milz <kmilz@ucalgary.ca>
Date:   Thu, 27 Sep 2012 20:41:04 -0600

implement a close window call and use it

Diffstat:
Msrc/commands.c | 17+++++++++++------
Msrc/commands.h | 4+++-
Msrc/keymap.h | 3++-
Msrc/viking.h | 2++
4 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/commands.c b/src/commands.c @@ -1449,17 +1449,22 @@ toggle_cookies(const Arg *arg, void *data) } Eina_Bool -new_window(const Arg *arg, void *data) +window(const Arg *arg, void *data) { Window_Data *wd = data; Window_Data *new = window_add(wd->app); - Buffer_Data *bd = buffer_add(new); - buffer_current_set(bd); - elm_web_uri_set(bd->web, config_home_page_get(wd->app->config)); + if (arg->i & CreateWindow) { + Buffer_Data *bd = buffer_add(new); + buffer_current_set(bd); + elm_web_uri_set(bd->web, arg->s ? arg->s : config_home_page_get(wd->app->config)); - evas_object_resize(new->win, 480, 640); - evas_object_show(new->win); + evas_object_resize(new->win, 480, 640); + evas_object_show(new->win); + } + else if (arg->i & DeleteWindow) { + evas_object_del(wd->win); + } return EINA_TRUE; } diff --git a/src/commands.h b/src/commands.h @@ -30,7 +30,7 @@ Eina_Bool inspector(const Arg *, void *); Eina_Bool proxy(const Arg *, void *); Eina_Bool toggle_history(const Arg *, void *); Eina_Bool toggle_cookies(const Arg *, void *); -Eina_Bool new_window(const Arg *arg, void *data); +Eina_Bool window(const Arg *arg, void *data); // static Eina_Bool fake_key_event(const Arg *, void *); Eina_Bool process_set_line(char *line); @@ -83,6 +83,8 @@ static Command commands[COMMANDSIZE] = { { "scrollup", scroll, {ScrollMove | DirectionTop | UnitLine} }, { "scrolldown", scroll, {ScrollMove | DirectionBottom | UnitLine} }, { "ls", list, {0} }, + { "winopen", window, {CreateWindow} }, + { "winclose", window, {DeleteWindow} }, }; diff --git a/src/keymap.h b/src/keymap.h @@ -130,7 +130,8 @@ static Key keys[] = { { 0, 0, "u", revive, {} }, { 0, 0, "x", tab_quit, {0} }, - { 0, 0, "w", new_window, {0} }, + // { 0, 0, "w", input, { .s = ":winopen "} }, + { 0, 0, "w", window, { .i = CreateWindow} }, // { 0, 0, "X", revive_last_tab, {0} }, { 0, 0, "b", switch_buffer, {0}}, { 0, 0, "i", inspector, {0} }, diff --git a/src/viking.h b/src/viking.h @@ -90,6 +90,8 @@ enum { DirectionBackwards = DirectionAbsolute, DirectionForward = enum { CaseInsensitive, CaseSensitive = 1 << 2 }; enum { Wrapping = 1 << 3 }; +enum { CreateWindow = 1 << 1, DeleteWindow = 1 << 2}; + /* structs here */ typedef struct {