Remove deprecated geometry handling
This commit is contained in:
parent
7138bc4949
commit
8f6ce5239f
31
termite.cc
31
termite.cc
|
@ -160,9 +160,9 @@ static void overlay_show(search_panel_info *info, overlay_mode mode, VteTerminal
|
||||||
static void get_vte_padding(VteTerminal *vte, int *left, int *top, int *right, int *bottom);
|
static void get_vte_padding(VteTerminal *vte, int *left, int *top, int *right, int *bottom);
|
||||||
static char *check_match(VteTerminal *vte, GdkEventButton *event);
|
static char *check_match(VteTerminal *vte, GdkEventButton *event);
|
||||||
static void load_config(GtkWindow *window, VteTerminal *vte, GtkWidget *scrollbar, GtkWidget *hbox,
|
static void load_config(GtkWindow *window, VteTerminal *vte, GtkWidget *scrollbar, GtkWidget *hbox,
|
||||||
config_info *info, char **geometry, char **icon, bool *show_scrollbar);
|
config_info *info, char **icon, bool *show_scrollbar);
|
||||||
static void set_config(GtkWindow *window, VteTerminal *vte, GtkWidget *scrollbar, GtkWidget *hbox,
|
static void set_config(GtkWindow *window, VteTerminal *vte, GtkWidget *scrollbar, GtkWidget *hbox,
|
||||||
config_info *info, char **geometry, char **icon, bool *show_scrollbar,
|
config_info *info, char **icon, bool *show_scrollbar,
|
||||||
GKeyFile *config);
|
GKeyFile *config);
|
||||||
static long first_row(VteTerminal *vte);
|
static long first_row(VteTerminal *vte);
|
||||||
|
|
||||||
|
@ -1417,7 +1417,7 @@ static void load_theme(GtkWindow *window, VteTerminal *vte, GKeyFile *config, hi
|
||||||
}
|
}
|
||||||
|
|
||||||
static void load_config(GtkWindow *window, VteTerminal *vte, GtkWidget *scrollbar,
|
static void load_config(GtkWindow *window, VteTerminal *vte, GtkWidget *scrollbar,
|
||||||
GtkWidget *hbox, config_info *info, char **geometry, char **icon,
|
GtkWidget *hbox, config_info *info, char **icon,
|
||||||
bool *show_scrollbar) {
|
bool *show_scrollbar) {
|
||||||
const std::string default_path = "/termite/config";
|
const std::string default_path = "/termite/config";
|
||||||
GKeyFile *config = g_key_file_new();
|
GKeyFile *config = g_key_file_new();
|
||||||
|
@ -1453,19 +1453,14 @@ static void load_config(GtkWindow *window, VteTerminal *vte, GtkWidget *scrollba
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loaded) {
|
if (loaded) {
|
||||||
set_config(window, vte, scrollbar, hbox, info, geometry, icon, show_scrollbar, config);
|
set_config(window, vte, scrollbar, hbox, info, icon, show_scrollbar, config);
|
||||||
}
|
}
|
||||||
g_key_file_free(config);
|
g_key_file_free(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_config(GtkWindow *window, VteTerminal *vte, GtkWidget *scrollbar, GtkWidget *hbox,
|
static void set_config(GtkWindow *window, VteTerminal *vte, GtkWidget *scrollbar, GtkWidget *hbox,
|
||||||
config_info *info, char **geometry, char **icon, bool *show_scrollbar_ptr,
|
config_info *info, char **icon, bool *show_scrollbar_ptr,
|
||||||
GKeyFile *config) {
|
GKeyFile *config) {
|
||||||
if (geometry) {
|
|
||||||
if (auto s = get_config_string(config, "options", "geometry")) {
|
|
||||||
*geometry = *s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto cfg_bool = [config](const char *key, gboolean value) {
|
auto cfg_bool = [config](const char *key, gboolean value) {
|
||||||
return get_config<gboolean>(g_key_file_get_boolean,
|
return get_config<gboolean>(g_key_file_get_boolean,
|
||||||
|
@ -1624,7 +1619,7 @@ int main(int argc, char **argv) {
|
||||||
gboolean version = FALSE, hold = FALSE;
|
gboolean version = FALSE, hold = FALSE;
|
||||||
|
|
||||||
GOptionContext *context = g_option_context_new(nullptr);
|
GOptionContext *context = g_option_context_new(nullptr);
|
||||||
char *role = nullptr, *geometry = nullptr, *execute = nullptr, *config_file = nullptr;
|
char *role = nullptr, *execute = nullptr, *config_file = nullptr;
|
||||||
char *title = nullptr, *icon = nullptr;
|
char *title = nullptr, *icon = nullptr;
|
||||||
bool show_scrollbar = false;
|
bool show_scrollbar = false;
|
||||||
const GOptionEntry entries[] = {
|
const GOptionEntry entries[] = {
|
||||||
|
@ -1633,7 +1628,6 @@ int main(int argc, char **argv) {
|
||||||
{"role", 'r', 0, G_OPTION_ARG_STRING, &role, "The role to use", "ROLE"},
|
{"role", 'r', 0, G_OPTION_ARG_STRING, &role, "The role to use", "ROLE"},
|
||||||
{"title", 't', 0, G_OPTION_ARG_STRING, &title, "Window title", "TITLE"},
|
{"title", 't', 0, G_OPTION_ARG_STRING, &title, "Window title", "TITLE"},
|
||||||
{"directory", 'd', 0, G_OPTION_ARG_STRING, &directory, "Change to directory", "DIRECTORY"},
|
{"directory", 'd', 0, G_OPTION_ARG_STRING, &directory, "Change to directory", "DIRECTORY"},
|
||||||
{"geometry", 0, 0, G_OPTION_ARG_STRING, &geometry, "Window geometry", "GEOMETRY"},
|
|
||||||
{"hold", 0, 0, G_OPTION_ARG_NONE, &hold, "Remain open after child process exits", nullptr},
|
{"hold", 0, 0, G_OPTION_ARG_NONE, &hold, "Remain open after child process exits", nullptr},
|
||||||
{"config", 'c', 0, G_OPTION_ARG_STRING, &config_file, "Path of config file", "CONFIG"},
|
{"config", 'c', 0, G_OPTION_ARG_STRING, &config_file, "Path of config file", "CONFIG"},
|
||||||
{"icon", 'i', 0, G_OPTION_ARG_STRING, &icon, "Icon", "ICON"},
|
{"icon", 'i', 0, G_OPTION_ARG_STRING, &icon, "Icon", "ICON"},
|
||||||
|
@ -1713,11 +1707,11 @@ int main(int argc, char **argv) {
|
||||||
};
|
};
|
||||||
|
|
||||||
load_config(GTK_WINDOW(window), vte, scrollbar, hbox, &info.config,
|
load_config(GTK_WINDOW(window), vte, scrollbar, hbox, &info.config,
|
||||||
geometry ? nullptr : &geometry, icon ? nullptr : &icon, &show_scrollbar);
|
icon ? nullptr : &icon, &show_scrollbar);
|
||||||
|
|
||||||
reload_config = [&]{
|
reload_config = [&]{
|
||||||
load_config(GTK_WINDOW(window), vte, scrollbar, hbox, &info.config,
|
load_config(GTK_WINDOW(window), vte, scrollbar, hbox, &info.config,
|
||||||
nullptr, nullptr, nullptr);
|
nullptr, nullptr);
|
||||||
};
|
};
|
||||||
signal(SIGUSR1, [](int){ reload_config(); });
|
signal(SIGUSR1, [](int){ reload_config(); });
|
||||||
|
|
||||||
|
@ -1779,15 +1773,6 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (geometry) {
|
|
||||||
gtk_widget_show_all(panel_overlay);
|
|
||||||
gtk_widget_show_all(info.panel.entry);
|
|
||||||
if (!gtk_window_parse_geometry(GTK_WINDOW(window), geometry)) {
|
|
||||||
g_printerr("invalid geometry string: %s\n", geometry);
|
|
||||||
}
|
|
||||||
g_free(geometry);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (icon) {
|
if (icon) {
|
||||||
gtk_window_set_icon_name(GTK_WINDOW(window), icon);
|
gtk_window_set_icon_name(GTK_WINDOW(window), icon);
|
||||||
g_free(icon);
|
g_free(icon);
|
||||||
|
|
Loading…
Reference in New Issue