From 17710709f98731d9d70ec63f9162292fa5f3fcc7 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 10 Aug 2020 10:51:47 -0400 Subject: [PATCH 1/3] window: Fix an oversight Commit 658719a205bfcf moved the call to gtk_window_compute_default_size() outside the if (priv->needs_default_size) but unfortunately, that function cleared that field, so we never entered the branch. Keep the setting of priv->needs_default_size in the branch, where it belongs. --- gtk/gtkwindow.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index d84729442f..031a280b19 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -4222,7 +4222,6 @@ gtk_window_compute_default_size (GtkWindow *window, int *width, int *height) { - GtkWindowPrivate *priv = gtk_window_get_instance_private (window); GtkWidget *widget = GTK_WIDGET (window); *width = max_width; @@ -4257,9 +4256,6 @@ gtk_window_compute_default_size (GtkWindow *window, NULL, NULL); *height = MAX (minimum, MIN (*height, natural)); } - - /* No longer use the default settings */ - priv->need_default_size = FALSE; } static void @@ -4288,6 +4284,10 @@ toplevel_compute_size (GdkToplevel *toplevel, { int remembered_width; int remembered_height; + + /* No longer use the default settings */ + priv->need_default_size = FALSE; + gtk_window_get_remembered_size (window, &remembered_width, &remembered_height); width = MAX (default_width, remembered_width); From 091289a85d4826684673643cfec3a7c9b75f15e7 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 9 Aug 2020 22:27:32 -0400 Subject: [PATCH 2/3] gtk-demo: Add a file filter for the video player We are only interested in video files here. --- demos/gtk-demo/video_player.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/demos/gtk-demo/video_player.c b/demos/gtk-demo/video_player.c index 1dd38645da..3dbbe4a592 100644 --- a/demos/gtk-demo/video_player.c +++ b/demos/gtk-demo/video_player.c @@ -31,6 +31,7 @@ open_clicked_cb (GtkWidget *button, GtkWidget *video) { GtkWidget *dialog; + GtkFileFilter *filter; dialog = gtk_file_chooser_dialog_new ("Select a video", GTK_WINDOW (gtk_widget_get_root (button)), @@ -38,6 +39,11 @@ open_clicked_cb (GtkWidget *button, "_Cancel", GTK_RESPONSE_CANCEL, "_Open", GTK_RESPONSE_ACCEPT, NULL); + filter = gtk_file_filter_new (); + gtk_file_filter_add_mime_type (filter, "video/*"); + gtk_file_filter_set_name (filter, "Video"); + gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter); + g_object_unref (filter); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); g_signal_connect (dialog, "response", G_CALLBACK (open_dialog_response_cb), video); From be5b03224c9dc1c7821612437f604da833f17ba3 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 9 Aug 2020 22:34:17 -0400 Subject: [PATCH 3/3] gtk-demo: Give the video player a default size --- demos/gtk-demo/video_player.c | 1 + 1 file changed, 1 insertion(+) diff --git a/demos/gtk-demo/video_player.c b/demos/gtk-demo/video_player.c index 3dbbe4a592..d84bc123b5 100644 --- a/demos/gtk-demo/video_player.c +++ b/demos/gtk-demo/video_player.c @@ -73,6 +73,7 @@ do_video_player (GtkWidget *do_widget) gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget)); gtk_window_set_title (GTK_WINDOW (window), "Video Player"); + gtk_window_set_default_size (GTK_WINDOW (window), 600, 400); g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); video = gtk_video_new ();