improve keyboard shortcuts.

previous handling of F5, F6 and F7 was from EWebLauncher, a test app
without any buttons, they make no sense for eve.

F5/Ctrl+R does reload, with shift doing full reload.

F11 toggles fullscreen

Alt+Home goes to home page

Ctrl+L goes to location bar

Ctrl+D adds a bookmark

Ctrl+[+=-0] changes zoom level.



SVN revision: 52794
master
Gustavo Sverzut Barbieri 12 years ago
parent 1861696118
commit 447dadb053
  1. 13
      data/themes/default.edc
  2. 79
      src/bin/chrome.c
  3. 1
      src/bin/private.h
  4. 20
      src/bin/view.c

@ -1018,6 +1018,11 @@ collections {
transition: ACCELERATE 0.2;
after: "restore-top-panel";
}
program { name: "set-top-panel-visible";
signal: "set,view,mask,visible";
after: "release-panel-top-triangle";
}
program { name: "hide-view-mask";
action: STATE_SET "hidden" 0.0;
target: "view-mask";
@ -1168,12 +1173,20 @@ collections {
}
program { name: "favorite-hilight";
signal: "favorite,hilight";
script { set_int(favorited, 1); }
after: "favorite-hilight-2";
}
program { name: "favorite-hilight-2";
action: STATE_SET "visible" 0.0;
target: "button-fav-selected";
transition: ACCELERATE 0.5;
}
program { name: "favorite-default";
signal: "favorite,default";
script { set_int(favorited, 0); }
after: "favorite-default-2";
}
program { name: "favorite-default-2";
action: STATE_SET "default" 0.0;
target: "button-fav-selected";
transition: DECELERATE 0.5;

@ -1866,29 +1866,100 @@ on_key_down(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__,
Evas_Object *view = win->current_view;
Evas_Object *frame = ewk_view_frame_main_get(view);
Evas_Event_Key_Down *ev = event_info;
Eina_Bool control, shift, alt;
const char *k = ev->keyname;
control = evas_key_modifier_is_set(ev->modifiers, "Control");
shift = evas_key_modifier_is_set(ev->modifiers, "Shift");
alt = evas_key_modifier_is_set(ev->modifiers, "Alt");
INF("keyname=%s, key=%s, string=%s\n", ev->keyname, ev->key, ev->string);
if ((strcmp(k, "Keycode-122") == 0) || (strcmp(k, "F5") == 0))
if (strcmp(k, "Keycode-122") == 0)
{
ev->event_flags &= EVAS_EVENT_FLAG_ON_HOLD;
ewk_frame_scroll_add(frame, 0, 50);
}
else if ((strcmp(k, "Keycode-123") == 0) || (strcmp(k, "F6") == 0))
else if (strcmp(k, "Keycode-123") == 0)
{
ev->event_flags &= EVAS_EVENT_FLAG_ON_HOLD;
ewk_frame_scroll_add(frame, 0, -50);
}
else if ((strcmp(k, "Keycode-185") == 0) || (strcmp(k, "F7") == 0))
else if ((strcmp(k, "Keycode-185") == 0) ||
(control && ((strcmp(k, "plus") == 0) || strcmp(k, "equal") == 0)))
{
ev->event_flags &= EVAS_EVENT_FLAG_ON_HOLD;
view_zoom_next_up(view);
}
else if ((strcmp(k, "Keycode-186") == 0) || (strcmp(k, "F8") == 0))
else if ((strcmp(k, "Keycode-186") == 0) ||
(control && (strcmp(k, "minus") == 0)))
{
ev->event_flags &= EVAS_EVENT_FLAG_ON_HOLD;
view_zoom_next_down(view);
}
else if ((strcmp(k, "Keycode-186") == 0) ||
(control && (strcmp(k, "minus") == 0)))
{
ev->event_flags &= EVAS_EVENT_FLAG_ON_HOLD;
view_zoom_next_down(view);
}
else if (control && (strcmp(k, "0") == 0))
view_zoom_reset(view);
else if (control && (strcmp(k, "d") == 0))
{
const char *url = ewk_view_uri_get(view);
if (url)
{
Evas_Object *ed = elm_layout_edje_get(win->current_chrome);
Fav_Item *item = fav_items_get(fav, url);
if (item)
{
unsigned int count = fav_item_visit_count_get(item);
fav_item_visit_count_set(item, count + 1);
}
else
{
const char *title = ewk_view_title_get(view);
fav_items_add(fav, url, fav_item_new(url, title, 1));
}
edje_object_signal_emit(ed, "favorite,hilight", "");
}
}
else if (control && (strcmp(k, "l") == 0))
{
Evas_Object *ed = elm_layout_edje_get(win->current_chrome);
edje_object_signal_emit(ed, "set,view,mask,visible", "");
}
else if (control && (strcmp(k, "r") == 0))
{
if (shift) ewk_view_reload_full(view);
else ewk_view_reload(view);
}
else if (strcmp(k, "F11") == 0)
{
Eina_Bool setting = !elm_win_fullscreen_get(win->win);
elm_win_fullscreen_set(win->win, setting);
if (setting)
{
Evas_Object *notify, *label;
// TODO: hint user with an elm_notify or theme signal
// theme signal is better, but we need a global elm_layout
label = elm_label_add(win->win);
elm_object_style_set(label, "ewebkit");
elm_label_label_set(label, "F11 to exit fullscreen");
evas_object_show(label);
notify = elm_notify_add(win->win);
elm_object_style_set(notify, "ewebkit");
elm_notify_content_set(notify, label);
elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_TOP);
elm_notify_timeout_set(notify, 1.0);
evas_object_show(notify);
}
}
else if (alt && (strcmp(k, "Home") == 0))
ewk_view_uri_set(view, config_home_page_get(config));
}
static char *

@ -82,6 +82,7 @@ void window_mouse_enabled_set(Evas_Object *win, Eina_Bool setti
void window_title_set(Browser_Window *win, const char *title);
Evas_Object * view_add(Evas_Object *parent);
void view_zoom_reset(Evas_Object *view);
void view_zoom_next_up(Evas_Object *view);
void view_zoom_next_down(Evas_Object *view);
Eina_Bool view_context_menu_set(Evas_Object *view, Evas_Object *widget, Ewk_Context_Menu *menu);

@ -1541,6 +1541,26 @@ view_add(Evas_Object *parent)
return view;
}
void view_zoom_reset(Evas_Object *view)
{
Evas_Coord w, h;
VIEW_SD_GET_OR_RETURN(view, sd);
if (sd->flags.animated_zoom || sd->animator.pan || sd->animator.zoom)
return;
if (sd->animator.kinetic)
{
ecore_animator_del(sd->animator.kinetic);
sd->animator.kinetic = NULL;
}
sd->flags.animated_zoom = EINA_TRUE;
ewk_frame_visible_content_geometry_get
(sd->base.main_frame, EINA_FALSE, NULL, NULL, &w, &h);
ewk_view_zoom_animated_set
(view, 1.0, ZOOM_AUTO_ANIMATION_DURATION, w / 2, h / 2);
}
void view_zoom_next_up(Evas_Object *view)
{
VIEW_SD_GET_OR_RETURN(view, sd);

Loading…
Cancel
Save