summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2015-03-17 18:46:39 +0100
committerBoris Faure <billiob@gmail.com>2015-03-17 18:46:39 +0100
commit33322d04af384c98b6f98117c3d55dbe833a3e2b (patch)
tree03c96a478c131182ebee2df40f9c295731e2f268 /src
parent7edeea350332427b1045e79a457cddb2e6f812bc (diff)
toggle fullscreen by pressing F11
Diffstat (limited to 'src')
-rw-r--r--src/bin/config.c31
-rw-r--r--src/bin/keyin.c14
2 files changed, 38 insertions, 7 deletions
diff --git a/src/bin/config.c b/src/bin/config.c
index 0f4e7cb..b98dce5 100644
--- a/src/bin/config.c
+++ b/src/bin/config.c
@@ -7,7 +7,7 @@
7#include "col.h" 7#include "col.h"
8#include "utils.h" 8#include "utils.h"
9 9
10#define CONF_VER 4 10#define CONF_VER 5
11 11
12#define LIM(v, min, max) {if (v >= max) v = max; else if (v <= min) v = min;} 12#define LIM(v, min, max) {if (v >= max) v = max; else if (v <= min) v = min;}
13 13
@@ -280,10 +280,6 @@ _config_upgrade_to_v2(Config *config)
280 config->version = 2; 280 config->version = 2;
281} 281}
282 282
283static void
284_add_default_keys(Config *config)
285{
286 Config_Keys *kb;
287#define ADD_KB(Name, Ctrl, Alt, Shift, Win, Cb) \ 283#define ADD_KB(Name, Ctrl, Alt, Shift, Win, Cb) \
288 kb = calloc(1, sizeof(Config_Keys)); \ 284 kb = calloc(1, sizeof(Config_Keys)); \
289 if (!kb) return; \ 285 if (!kb) return; \
@@ -295,6 +291,24 @@ _add_default_keys(Config *config)
295 kb->cb = eina_stringshare_add_length(Cb, strlen(Cb)); \ 291 kb->cb = eina_stringshare_add_length(Cb, strlen(Cb)); \
296 config->keys = eina_list_append(config->keys, kb) 292 config->keys = eina_list_append(config->keys, kb)
297 293
294static void
295_config_upgrade_to_v4(Config *config)
296{
297 Config_Keys *kb;
298
299 ADD_KB("F11", 0, 0, 0, 0, "win_fullscreen");
300
301 config->version = 4;
302}
303
304static void
305_add_default_keys(Config *config)
306{
307 Config_Keys *kb;
308
309 ADD_KB("F11", 0, 0, 0, 0, "win_fullscreen");
310
311 /* Ctrl- */
298 ADD_KB("Prior", 1, 0, 0, 0, "term_prev"); 312 ADD_KB("Prior", 1, 0, 0, 0, "term_prev");
299 ADD_KB("Next", 1, 0, 0, 0, "term_next"); 313 ADD_KB("Next", 1, 0, 0, 0, "term_next");
300 ADD_KB("0", 1, 0, 0, 0, "tab_10"); 314 ADD_KB("0", 1, 0, 0, 0, "tab_10");
@@ -340,9 +354,9 @@ _add_default_keys(Config *config)
340 ADD_KB("KP_Subtract", 0, 0, 1, 0, "decrease_font_size"); 354 ADD_KB("KP_Subtract", 0, 0, 1, 0, "decrease_font_size");
341 ADD_KB("KP_Multiply", 0, 0, 1, 0, "reset_font_size"); 355 ADD_KB("KP_Multiply", 0, 0, 1, 0, "reset_font_size");
342 ADD_KB("KP_Divide", 0, 0, 1, 0, "copy_clipboard"); 356 ADD_KB("KP_Divide", 0, 0, 1, 0, "copy_clipboard");
357}
343 358
344#undef ADD_KB 359#undef ADD_KB
345}
346 360
347 361
348void 362void
@@ -459,7 +473,10 @@ config_load(const char *key)
459 } 473 }
460 config->gravatar = EINA_TRUE; 474 config->gravatar = EINA_TRUE;
461 /*pass through*/ 475 /*pass through*/
462 case CONF_VER: /* 4 */ 476 case 4:
477 _config_upgrade_to_v4(config);
478 /*pass through*/
479 case CONF_VER: /* 5 */
463 config->version = CONF_VER; 480 config->version = CONF_VER;
464 break; 481 break;
465 default: 482 default:
diff --git a/src/bin/keyin.c b/src/bin/keyin.c
index c3c0442..2473f54 100644
--- a/src/bin/keyin.c
+++ b/src/bin/keyin.c
@@ -449,6 +449,19 @@ cb_miniview(Evas_Object *term)
449} 449}
450 450
451static Eina_Bool 451static Eina_Bool
452cb_win_fullscreen(Evas_Object *term)
453{
454 Evas_Object *win = termio_win_get(term);
455 Eina_Bool fullscreen;
456
457 if (!win)
458 return EINA_FALSE;
459 fullscreen = elm_win_fullscreen_get(win);
460 elm_win_fullscreen_set(win, !fullscreen);
461 return EINA_TRUE;
462}
463
464static Eina_Bool
452cb_increase_font_size(Evas_Object *term) 465cb_increase_font_size(Evas_Object *term)
453{ 466{
454 termcmd_do(term, NULL, NULL, "f+"); 467 termcmd_do(term, NULL, NULL, "f+");
@@ -565,6 +578,7 @@ static Shortcut_Action _actions[] =
565 {"reset_font_size", gettext_noop("Reset font size"), cb_reset_font_size}, 578 {"reset_font_size", gettext_noop("Reset font size"), cb_reset_font_size},
566 579
567 {"group", gettext_noop("Actions"), NULL}, 580 {"group", gettext_noop("Actions"), NULL},
581 {"win_fullscreen", gettext_noop("Toggle Fullscreen of the window"), cb_win_fullscreen},
568 {"miniview", gettext_noop("Display the history miniview"), cb_miniview}, 582 {"miniview", gettext_noop("Display the history miniview"), cb_miniview},
569 {"cmd_box", gettext_noop("Display the command box"), cb_cmd_box}, 583 {"cmd_box", gettext_noop("Display the command box"), cb_cmd_box},
570 584