Add the normal keybindings provided in most web browsing environments,
authorRusty Lynch <rusty.lynch@intel.com>
Fri, 24 Aug 2012 23:30:39 +0000 (16:30 -0700)
committerRusty Lynch <rusty.lynch@intel.com>
Fri, 24 Aug 2012 23:30:39 +0000 (16:30 -0700)
including alt-left, alt-right, F11 for fullscreen, and then an extra
escape to cause the app to exit

webskeleton.c

index 0915009..eac0c3b 100644 (file)
@@ -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);
     }
 }