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.
This commit is contained in:
JosephMcc 2017-02-09 10:30:52 -08:00
parent 399fc81a41
commit 69f71de2de
1 changed files with 11 additions and 13 deletions

View File

@ -268,7 +268,7 @@ xed_window_configure_event (GtkWidget *widget,
XedWindow *window = XED_WINDOW (widget); XedWindow *window = XED_WINDOW (widget);
if (gtk_widget_get_realized (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); save_window_state (widget);
} }
@ -1805,20 +1805,18 @@ clone_window (XedWindow *origin)
app = XED_APP (g_application_get_default ()); 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); 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) if ((origin->priv->window_state & GDK_WINDOW_STATE_MAXIMIZED) != 0)
{ {
gint w, h; gtk_window_maximize (GTK_WINDOW (window));
_xed_window_get_default_size (&w, &h);
gtk_window_set_default_size (GTK_WINDOW(window), w, h);
gtk_window_maximize (GTK_WINDOW(window));
} }
else 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) 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; XedWindow *new_window;
g_return_val_if_fail(XED_IS_WINDOW (window), 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 (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 (gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->priv->notebook)) > 1, NULL);
new_window = clone_window (window); new_window = clone_window (window);
xed_notebook_move_tab (XED_NOTEBOOK(window->priv->notebook), XED_NOTEBOOK(new_window->priv->notebook), tab, -1); xed_notebook_move_tab (XED_NOTEBOOK (window->priv->notebook), XED_NOTEBOOK (new_window->priv->notebook), tab, -1);
gtk_widget_show (GTK_WIDGET(new_window)); gtk_widget_show (GTK_WIDGET (new_window));
return new_window; return new_window;
} }