Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set correct sidebar/message window positions before showing the… #576

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 2 additions & 11 deletions src/keyfile.c
Expand Up @@ -105,8 +105,6 @@ static gchar *scribble_text = NULL;
static gint scribble_pos = -1;
static GPtrArray *session_files = NULL;
static gint session_notebook_page;
static gint hpan_position;
static gint vpan_position;
static const gchar atomic_file_saving_key[] = "use_atomic_file_saving";

static GPtrArray *keyfile_groups = NULL;
Expand Down Expand Up @@ -1047,8 +1045,8 @@ static void load_ui_prefs(GKeyFile *config)
ui_prefs.geometry[3] = MAX(-1, geo[3]);
ui_prefs.geometry[4] = geo[4] != 0;
}
hpan_position = utils_get_setting_integer(config, PACKAGE, "treeview_position", 156);
vpan_position = utils_get_setting_integer(config, PACKAGE, "msgwindow_position", (geo) ?
ui_prefs.treeview_position = utils_get_setting_integer(config, PACKAGE, "treeview_position", 156);
ui_prefs.msgwindow_position = utils_get_setting_integer(config, PACKAGE, "msgwindow_position", (geo) ?
(GEANY_MSGWIN_HEIGHT + geo[3] - 440) :
(GEANY_MSGWIN_HEIGHT + GEANY_WINDOW_DEFAULT_HEIGHT - 440));

Expand Down Expand Up @@ -1287,13 +1285,6 @@ void configuration_apply_settings(void)
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part works also before main window realisation but there's no problem having it here.

g_free(scribble_text);

/* set the position of the hpaned and vpaned */
if (prefs.save_winpos)
{
gtk_paned_set_position(GTK_PANED(ui_lookup_widget(main_widgets.window, "hpaned1")), hpan_position);
gtk_paned_set_position(GTK_PANED(ui_lookup_widget(main_widgets.window, "vpaned1")), vpan_position);
}

/* set fullscreen after initial draw so that returning to normal view is the right size.
* fullscreen mode is disabled by default, so act only if it is true */
if (ui_prefs.fullscreen)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only part of the function that really needs to be applied after window realisation otherwise we get incorrect sizes after un-fullscreening the window.

Expand Down
5 changes: 5 additions & 0 deletions src/libmain.c
Expand Up @@ -161,6 +161,11 @@ static void setup_window_position(void)

if (ui_prefs.geometry[4] == 1)
gtk_window_maximize(GTK_WINDOW(main_widgets.window));

gtk_paned_set_position(GTK_PANED(ui_lookup_widget(main_widgets.window, "hpaned1")),
ui_prefs.treeview_position);
gtk_paned_set_position(GTK_PANED(ui_lookup_widget(main_widgets.window, "vpaned1")),
ui_prefs.msgwindow_position);
}


Expand Down
2 changes: 2 additions & 0 deletions src/ui_utils.h
Expand Up @@ -162,6 +162,8 @@ typedef struct UIPrefs
gboolean allow_always_save; /* if set, files can always be saved, even if unchanged */
gchar *statusbar_template;
gboolean new_document_after_close;
gint treeview_position;
gint msgwindow_position;

/* Menu-item related data */
GQueue *recent_queue;
Expand Down