Skip to content

Commit

Permalink
Allow to not maximize window via option --no-maximize #483.
Browse files Browse the repository at this point in the history
  • Loading branch information
fanglingsu committed Mar 12, 2019
1 parent a884a81 commit b871419
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions doc/vimb.1
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ Configuration data for the profile is stored in a directory named
.B "\-v, \-\-version"
Print build and version information and then quit.
.TP
.B "\-\-no-maximize"
Do no attempt to maximize window.
.TP
.B "\-\-bug-info"
Prints information about used libraries for bug reports and then quit.
.SH MODES
Expand Down
13 changes: 10 additions & 3 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,9 @@ static GtkWidget *create_window(Client *c)
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_role(GTK_WINDOW(window), PROJECT_UCFIRST);
gtk_window_set_default_size(GTK_WINDOW(window), WIN_WIDTH, WIN_HEIGHT);
gtk_window_maximize(GTK_WINDOW(window));
if (!vb.no_maximize) {
gtk_window_maximize(GTK_WINDOW(window));
}
}

g_object_connect(
Expand Down Expand Up @@ -985,7 +987,8 @@ static void spawn_new_instance(const char *uri)
#ifndef FEATURE_NO_XEMBED
+ (vb.embed ? 2 : 0)
#endif
+ (vb.profile ? 2 : 0),
+ (vb.profile ? 2 : 0)
+ (vb.no_maximize ? 1 : 0),
sizeof(char *)
);

Expand All @@ -1007,6 +1010,9 @@ static void spawn_new_instance(const char *uri)
cmd[i++] = "-p";
cmd[i++] = vb.profile;
}
if (vb.no_maximize) {
cmd[i++] = "--no-maximize";
}
cmd[i++] = (char*)uri;
cmd[i++] = NULL;

Expand Down Expand Up @@ -1933,10 +1939,11 @@ int main(int argc, char* argv[])
gboolean ver = FALSE, buginfo = FALSE;

GOptionEntry opts[] = {
{"embed", 'e', 0, G_OPTION_ARG_STRING, &winid, "Reparents to window specified by xid", NULL},
{"config", 'c', 0, G_OPTION_ARG_FILENAME, &vb.configfile, "Custom configuration file", NULL},
{"embed", 'e', 0, G_OPTION_ARG_STRING, &winid, "Reparents to window specified by xid", NULL},
{"profile", 'p', 0, G_OPTION_ARG_CALLBACK, (GOptionArgFunc*)profileOptionArgFunc, "Profile name", NULL},
{"version", 'v', 0, G_OPTION_ARG_NONE, &ver, "Print version", NULL},
{"no-maximize", 0, 0, G_OPTION_ARG_NONE, &vb.no_maximize, "Do no attempt to maximize window", NULL},
{"bug-info", 0, 0, G_OPTION_ARG_NONE, &buginfo, "Print used library versions", NULL},
{NULL}
};
Expand Down
1 change: 1 addition & 0 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ struct Vimb {
guint closed_max;
} config;
GtkCssProvider *style_provider;
gboolean no_maximize;
};

gboolean vb_download_set_destination(Client *c, WebKitDownload *download,
Expand Down

0 comments on commit b871419

Please sign in to comment.