From 69f71de2def5d35c724006c7490b80bc72963c04 Mon Sep 17 00:00:00 2001 From: JosephMcc Date: Thu, 9 Feb 2017 10:30:52 -0800 Subject: [PATCH] xed-window: Fix getting the wrong window size when cloning a window This was mostly caused by a missing set of parens resulting in the wrong logic being used. Go ahead a clean things up just a bit while I'm here. --- xed/xed-window.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/xed/xed-window.c b/xed/xed-window.c index 293d51b..a378b01 100644 --- a/xed/xed-window.c +++ b/xed/xed-window.c @@ -268,7 +268,7 @@ xed_window_configure_event (GtkWidget *widget, XedWindow *window = XED_WINDOW (widget); if (gtk_widget_get_realized (widget) && - window->priv->state & (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN) == 0) + (window->priv->state & (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN)) == 0) { save_window_state (widget); } @@ -1805,20 +1805,18 @@ clone_window (XedWindow *origin) app = XED_APP (g_application_get_default ()); - screen = gtk_window_get_screen (GTK_WINDOW(origin)); + screen = gtk_window_get_screen (GTK_WINDOW (origin)); window = xed_app_create_window (app, screen); + gtk_window_set_default_size (GTK_WINDOW (window), origin->priv->width, origin->priv->height); + if ((origin->priv->window_state & GDK_WINDOW_STATE_MAXIMIZED) != 0) { - gint w, h; - _xed_window_get_default_size (&w, &h); - gtk_window_set_default_size (GTK_WINDOW(window), w, h); - gtk_window_maximize (GTK_WINDOW(window)); + gtk_window_maximize (GTK_WINDOW (window)); } else { - gtk_window_set_default_size (GTK_WINDOW(window), origin->priv->width, origin->priv->height); - gtk_window_unmaximize (GTK_WINDOW(window)); + gtk_window_unmaximize (GTK_WINDOW (window)); } if ((origin->priv->window_state & GDK_WINDOW_STATE_STICKY) != 0) @@ -3942,13 +3940,13 @@ _xed_window_move_tab_to_new_window (XedWindow *window, { XedWindow *new_window; - g_return_val_if_fail(XED_IS_WINDOW (window), NULL); - g_return_val_if_fail(XED_IS_TAB (tab), NULL); - g_return_val_if_fail(gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->priv->notebook)) > 1, NULL); + g_return_val_if_fail (XED_IS_WINDOW (window), NULL); + g_return_val_if_fail (XED_IS_TAB (tab), NULL); + g_return_val_if_fail (gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->priv->notebook)) > 1, NULL); new_window = clone_window (window); - xed_notebook_move_tab (XED_NOTEBOOK(window->priv->notebook), XED_NOTEBOOK(new_window->priv->notebook), tab, -1); - gtk_widget_show (GTK_WIDGET(new_window)); + xed_notebook_move_tab (XED_NOTEBOOK (window->priv->notebook), XED_NOTEBOOK (new_window->priv->notebook), tab, -1); + gtk_widget_show (GTK_WIDGET (new_window)); return new_window; }