summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Lynch <rusty.lynch@intel.com>2012-08-24 16:30:39 -0700
committerRusty Lynch <rusty.lynch@intel.com>2012-08-24 16:30:39 -0700
commit22fe7be4c50ce8184ea40c208d28cedcb7e3a117 (patch)
treeacd5dd2ecec7ce70a0a581a2d7f90aaf1fa781e3
parent6a077083720f9974990c25c1e0e03d5ed6aae92a (diff)
downloadwebskeleton-22fe7be4c50ce8184ea40c208d28cedcb7e3a117.tar.gz
webskeleton-22fe7be4c50ce8184ea40c208d28cedcb7e3a117.tar.bz2
webskeleton-22fe7be4c50ce8184ea40c208d28cedcb7e3a117.zip
Add the normal keybindings provided in most web browsing environments,
including alt-left, alt-right, F11 for fullscreen, and then an extra escape to cause the app to exit
-rw-r--r--webskeleton.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/webskeleton.c b/webskeleton.c
index 0915009..eac0c3b 100644
--- a/webskeleton.c
+++ b/webskeleton.c
@@ -31,6 +31,7 @@ static const char DEFAULT_URL[] = "http://www.linuxfoundation.org/";
static const char APP_NAME[] = "WebSkeleton";
static int width = 800;
static int height = 600;
+Eina_Bool fullscreen = EINA_FALSE;
#define info(format, args...) \
do { \
@@ -74,20 +75,32 @@ static void
on_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Key_Down *ev = (Evas_Event_Key_Down*) event_info;
- if (!strcmp(ev->key, "F1")) {
- info("Back (F1) was pressed\n");
+ Context *app = (Context *)data;
+ const Evas_Modifier *modifier = evas_key_modifier_get(e);
+
+ if (!strcmp(ev->key, "Left") && evas_key_modifier_is_set(modifier, "Alt")) {
+ info("Alt-Left was pressed, moving back in history\n");
if (!ewk_view_back(obj))
info("Back ignored: No back history\n");
- } else if (!strcmp(ev->key, "F2")) {
- info("Forward (F2) was pressed\n");
+ } else if (!strcmp(ev->key, "Right") &&
+ evas_key_modifier_is_set(modifier, "Alt")) {
+ info("Alt-Right was pressed, moving forward in history\n");
if (!ewk_view_forward(obj))
info("Forward ignored: No forward history\n");
- } else if (!strcmp(ev->key, "F5")) {
- info("Reload (F5) was pressed, reloading.\n");
+ } else if (!strcmp(ev->key, "r") &&
+ evas_key_modifier_is_set(modifier, "Control")) {
+ info("Control-r was pressed, reloading.\n");
ewk_view_reload(obj);
} else if (!strcmp(ev->key, "F6")) {
info("Stop (F6) was pressed, stop loading.\n");
ewk_view_stop(obj);
+ } else if (!strcmp(ev->key, "F11")) {
+ info("Fullscreen (F12) was pressed, toggling fullscreen view.\n");
+ fullscreen = !fullscreen;
+ ecore_evas_fullscreen_set(app->ee, fullscreen);
+ } else if (!strcmp(ev->key, "Escape")) {
+ info("Escape was pressed, exiting....\n");
+ exit(0);
}
}