From abd4754648d096f8c88251c29f64d3a4d1153ca9 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 28 Oct 2019 20:00:21 +0100 Subject: [PATCH 1/4] messagedialog: Remove useless GTK_TYPE_BUILDABLE interface It was just chaining up. --- gtk/gtkmessagedialog.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/gtk/gtkmessagedialog.c b/gtk/gtkmessagedialog.c index a74e00123c..b7e3161092 100644 --- a/gtk/gtkmessagedialog.c +++ b/gtk/gtkmessagedialog.c @@ -122,7 +122,6 @@ static void gtk_message_dialog_get_property (GObject *object, GParamSpec *pspec); static void gtk_message_dialog_add_buttons (GtkMessageDialog *message_dialog, GtkButtonsType buttons); -static void gtk_message_dialog_buildable_interface_init (GtkBuildableIface *iface); enum { PROP_0, @@ -136,20 +135,7 @@ enum { PROP_MESSAGE_AREA }; -G_DEFINE_TYPE_WITH_CODE (GtkMessageDialog, gtk_message_dialog, GTK_TYPE_DIALOG, - G_ADD_PRIVATE (GtkMessageDialog) - G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, - gtk_message_dialog_buildable_interface_init)) - -static GtkBuildableIface *parent_buildable_iface; - -static void -gtk_message_dialog_buildable_interface_init (GtkBuildableIface *iface) -{ - parent_buildable_iface = g_type_interface_peek_parent (iface); - iface->custom_tag_start = parent_buildable_iface->custom_tag_start; - iface->custom_finished = parent_buildable_iface->custom_finished; -} +G_DEFINE_TYPE_WITH_PRIVATE (GtkMessageDialog, gtk_message_dialog, GTK_TYPE_DIALOG) static void gtk_message_dialog_class_init (GtkMessageDialogClass *class) From 553a9c292d5b6de2f4c413dd74edd81183eff818 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 26 Oct 2019 07:00:24 +0200 Subject: [PATCH 2/4] togglebutton: Don't emit clicked during set_active() set_active() is meant to set the state of the property, which happens during setup. The clicked signal is emitting events from user actions. It is impossible to use Togglebuttons for MVC applications as long as it does that. --- gtk/gtkradiobutton.c | 25 +++++----------------- gtk/gtktogglebutton.c | 30 +++++++++------------------ gtk/gtktogglebuttonprivate.h | 40 ------------------------------------ 3 files changed, 15 insertions(+), 80 deletions(-) delete mode 100644 gtk/gtktogglebuttonprivate.h diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c index 313be232b7..344cde3b89 100644 --- a/gtk/gtkradiobutton.c +++ b/gtk/gtkradiobutton.c @@ -27,7 +27,6 @@ #include "gtkradiobutton.h" #include "gtkwidgetprivate.h" -#include "gtktogglebuttonprivate.h" #include "gtkcheckbuttonprivate.h" #include "gtklabel.h" #include "gtkmarshalers.h" @@ -242,7 +241,7 @@ gtk_radio_button_init (GtkRadioButton *radio_button) gtk_widget_set_receives_default (GTK_WIDGET (radio_button), FALSE); - _gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button), TRUE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button), TRUE); priv->group = g_slist_prepend (NULL, radio_button); @@ -729,9 +728,6 @@ gtk_radio_button_clicked (GtkButton *button) GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (button); GtkToggleButton *tmp_button; GSList *tmp_list; - gint toggled; - - toggled = FALSE; g_object_ref (GTK_WIDGET (button)); @@ -753,17 +749,13 @@ gtk_radio_button_clicked (GtkButton *button) } if (tmp_button) - { - toggled = TRUE; - _gtk_toggle_button_set_active (toggle_button, - !gtk_toggle_button_get_active (toggle_button)); - } + gtk_toggle_button_set_active (toggle_button, + !gtk_toggle_button_get_active (toggle_button)); } else { - toggled = TRUE; - _gtk_toggle_button_set_active (toggle_button, - !gtk_toggle_button_get_active (toggle_button)); + gtk_toggle_button_set_active (toggle_button, + !gtk_toggle_button_get_active (toggle_button)); tmp_list = priv->group; while (tmp_list) @@ -779,13 +771,6 @@ gtk_radio_button_clicked (GtkButton *button) } } - if (toggled) - { - gtk_toggle_button_toggled (toggle_button); - - g_object_notify (G_OBJECT (toggle_button), "active"); - } - gtk_widget_queue_draw (GTK_WIDGET (button)); g_object_unref (button); diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c index b9984aacbf..ad70b984ab 100644 --- a/gtk/gtktogglebutton.c +++ b/gtk/gtktogglebutton.c @@ -24,7 +24,7 @@ #include "config.h" -#include "gtktogglebuttonprivate.h" +#include "gtktogglebutton.h" #include "gtkbuttonprivate.h" #include "gtkintl.h" @@ -293,8 +293,9 @@ gtk_toggle_button_get_property (GObject *object, * * Sets the status of the toggle button. Set to %TRUE if you want the * GtkToggleButton to be “pressed in”, and %FALSE to raise it. - * This action causes the #GtkToggleButton::toggled signal and the - * #GtkButton::clicked signal to be emitted. + * + * If the status of the button changes, this action causes the + * #GtkToggleButton::toggled signal to be emitted. */ void gtk_toggle_button_set_active (GtkToggleButton *toggle_button, @@ -306,18 +307,8 @@ gtk_toggle_button_set_active (GtkToggleButton *toggle_button, is_active = is_active != FALSE; - if (priv->active != is_active) - { - g_signal_emit_by_name (toggle_button, "clicked"); - g_object_notify_by_pspec (G_OBJECT (toggle_button), toggle_button_props[PROP_ACTIVE]); - } -} - -void -_gtk_toggle_button_set_active (GtkToggleButton *toggle_button, - gboolean is_active) -{ - GtkToggleButtonPrivate *priv = gtk_toggle_button_get_instance_private (toggle_button); + if (priv->active == is_active) + return; priv->active = is_active; @@ -326,6 +317,9 @@ _gtk_toggle_button_set_active (GtkToggleButton *toggle_button, else gtk_widget_unset_state_flags (GTK_WIDGET (toggle_button), GTK_STATE_FLAG_CHECKED); + gtk_toggle_button_toggled (toggle_button); + + g_object_notify_by_pspec (G_OBJECT (toggle_button), toggle_button_props[PROP_ACTIVE]); } /** @@ -387,11 +381,7 @@ gtk_toggle_button_clicked (GtkButton *button) GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (button); GtkToggleButtonPrivate *priv = gtk_toggle_button_get_instance_private (toggle_button); - _gtk_toggle_button_set_active (toggle_button, !priv->active); - - gtk_toggle_button_toggled (toggle_button); - - g_object_notify_by_pspec (G_OBJECT (toggle_button), toggle_button_props[PROP_ACTIVE]); + gtk_toggle_button_set_active (toggle_button, !priv->active); if (GTK_BUTTON_CLASS (gtk_toggle_button_parent_class)->clicked) GTK_BUTTON_CLASS (gtk_toggle_button_parent_class)->clicked (button); diff --git a/gtk/gtktogglebuttonprivate.h b/gtk/gtktogglebuttonprivate.h deleted file mode 100644 index f487b54ead..0000000000 --- a/gtk/gtktogglebuttonprivate.h +++ /dev/null @@ -1,40 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright (C) 2014 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -/* - * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __GTK_TOGGLE_BUTTON_PRIVATE_H__ -#define __GTK_TOGGLE_BUTTON_PRIVATE_H__ - - -#include - - -G_BEGIN_DECLS - -void _gtk_toggle_button_set_active (GtkToggleButton *toggle_button, - gboolean is_active); - -G_END_DECLS - - -#endif /* __GTK_TOGGLE_BUTTON_PRIVATE_H__ */ From 4cca27a7af280e0553d94152f18ea7024f4edbc7 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 21 Oct 2019 04:57:03 +0200 Subject: [PATCH 3/4] builder: Allow parsing G_TYPE_BYTES from strings Just create a bytes containing the literal string. --- gtk/gtkbuilder.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gtk/gtkbuilder.c b/gtk/gtkbuilder.c index b3f27ade31..78f3fee3f8 100644 --- a/gtk/gtkbuilder.c +++ b/gtk/gtkbuilder.c @@ -2095,6 +2095,10 @@ gtk_builder_value_from_string_type (GtkBuilder *builder, gchar **vector = g_strsplit (string, "\n", 0); g_value_take_boxed (value, vector); } + else if (G_VALUE_HOLDS (value, G_TYPE_BYTES)) + { + g_value_take_boxed (value, g_bytes_new (string, strlen (string))); + } else { g_set_error (error, From 41beae19569509f81e9cbe3695c94e17e9616e00 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 1 Nov 2019 14:49:41 +0100 Subject: [PATCH 4/4] vulkan: Add missing enum value Also update comment to point to new header after Vulkan reorganized their repositories. --- gdk/gdkvulkancontext.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c index 7234421e1b..247e6e094f 100644 --- a/gdk/gdkvulkancontext.c +++ b/gdk/gdkvulkancontext.c @@ -104,7 +104,7 @@ gdk_vulkan_strerror (VkResult result) * Becuse the Vulkan people don't make adding this too easy, here's * the process to manage it: * 1. go to - * https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/blame/master/include/vulkan/vulkan.h + * https://github.com/KhronosGroup/Vulkan-Headers/blob/master/include/vulkan/vulkan_core.h * 2. Find the line where this enum value was added. * 3. Click the commit that added this line. * 4. The commit you're looking at now should also change @@ -201,6 +201,10 @@ gdk_vulkan_strerror (VkResult result) case VK_ERROR_INVALID_DEVICE_ADDRESS_EXT: return "Invalid device address"; #endif +#if VK_HEADER_VERSION >= 105 + case VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT: + return "An operation on a swapchain created with VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT failed as it did not have exlusive full-screen access."; +#endif case VK_RESULT_RANGE_SIZE: case VK_RESULT_MAX_ENUM: