Allow to toggle fullsceen.
authorDaniel Carl <danielcarl@gmx.de>
Fri, 18 Apr 2014 21:45:20 +0000 (23:45 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Fri, 18 Apr 2014 21:46:50 +0000 (23:46 +0200)
doc/vimb.1
src/main.h
src/setting.c

index 9cb624d..268312a 100644 (file)
@@ -708,6 +708,9 @@ the download is started '~/', '~user', '$VAR' and '${VAR}'.
 Command with placeholder '%s' called if form filed is opened with editor to
 spawn the editor like `x-terminal-emulator -e vi %s'.
 .TP
+.B fullscreen (bool)
+Show the current window full-screen.
+.TP
 .B header (string)
 Comma separated list of headers that replaces default header sent by webkit or
 new headers. The format for the header list elements is `name[=[value]]'.
index 5609edd..db1cf64 100644 (file)
@@ -300,6 +300,7 @@ typedef struct {
     char         *cafile;         /* path to the ca file */
     GTlsDatabase *tls_db;         /* tls database */
     float        default_zoom;    /* default zoomlevel that is applied on zz zoom reset */
+    gboolean     fullscreen;      /* indicates if full screen mode is on */
 } Config;
 
 typedef struct {
index b732e92..09a357c 100644 (file)
@@ -53,6 +53,7 @@ static SettingStatus editor_command(const Setting *s, const SettingType type);
 static SettingStatus timeoutlen(const Setting *s, const SettingType type);
 static SettingStatus headers(const Setting *s, const SettingType type);
 static SettingStatus nextpattern(const Setting *s, const SettingType type);
+static SettingStatus fullscreen(const Setting *s, const SettingType type);
 
 static gboolean validate_js_regexp_list(const char *pattern);
 
@@ -125,6 +126,7 @@ static Setting default_settings[] = {
     {NULL, "header", TYPE_CHAR, headers, {.s = ""}},
     {NULL, "nextpattern", TYPE_CHAR, nextpattern, {.s = "/\\bnext\\b/i,/^(>\\|>>\\|»)$/,/^(>\\|>>\\|»)/,/(>\\|>>\\|»)$/,/\\bmore\\b/i"}},
     {NULL, "previouspattern", TYPE_CHAR, nextpattern, {.s = "/\\bprev\\|previous\\b/i,/^(<\\|<<\\|«)$/,/^(<\\|<<\\|«)/,/(<\\|<<\\|«)$/"}},
+    {NULL, "fullscreen", TYPE_BOOLEAN, fullscreen, {.i = 0}},
 };
 
 void setting_init(void)
@@ -896,6 +898,31 @@ static SettingStatus nextpattern(const Setting *s, const SettingType type)
     return SETTING_ERROR | SETTING_USER_NOTIFIED;
 }
 
+static SettingStatus fullscreen(const Setting *s, const SettingType type)
+{
+    if (type == SETTING_GET) {
+        print_value(s, &vb.config.fullscreen);
+
+        return SETTING_OK;
+    }
+
+    if (type == SETTING_SET) {
+        vb.config.fullscreen = s->arg.i ? true : false;
+    } else {
+        vb.config.fullscreen = !vb.config.fullscreen;
+        print_value(s, &vb.config.fullscreen);
+    }
+
+    /* apply the new set or toggled value */
+    if (vb.config.fullscreen) {
+        gtk_window_fullscreen(GTK_WINDOW(vb.gui.window));
+    } else {
+        gtk_window_unfullscreen(GTK_WINDOW(vb.gui.window));
+    }
+
+    return SETTING_OK;
+}
+
 /**
  * Validated syntax given list of JavaScript RegExp patterns.
  * If validation fails, the error is shown to the user.