[gtk+] menu: Fix up new properties
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] menu: Fix up new properties
- Date: Wed, 3 Aug 2016 03:58:47 +0000 (UTC)
commit 2de6b0800d88702d3e4208defb6136fa635b7143
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Aug 2 23:42:11 2016 -0400
menu: Fix up new properties
The new positioning-related properties had some quality of
implementation issues, such as incorrect initial values and
excessive change notification. This broke the notify test.
gtk/gtkmenu.c | 41 +++++++++++++++++++++++++++++++++--------
1 files changed, 33 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 238c27e..aa11036 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -784,7 +784,8 @@ gtk_menu_class_init (GtkMenuClass *class)
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_NAME |
G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB));
+ G_PARAM_STATIC_BLURB |
+ G_PARAM_EXPLICIT_NOTIFY));
/**
* GtkMenu:rect-anchor-dx:
@@ -811,7 +812,8 @@ gtk_menu_class_init (GtkMenuClass *class)
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_NAME |
G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB));
+ G_PARAM_STATIC_BLURB |
+ G_PARAM_EXPLICIT_NOTIFY));
/**
* GtkMenu:rect-anchor-dy:
@@ -837,7 +839,8 @@ gtk_menu_class_init (GtkMenuClass *class)
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_NAME |
G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB));
+ G_PARAM_STATIC_BLURB |
+ G_PARAM_EXPLICIT_NOTIFY));
/**
* GtkMenu:menu-type-hint:
@@ -862,7 +865,8 @@ gtk_menu_class_init (GtkMenuClass *class)
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_NAME |
G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB));
+ G_PARAM_STATIC_BLURB |
+ G_PARAM_EXPLICIT_NOTIFY));
/**
* GtkMenu:horizontal-padding:
@@ -1136,16 +1140,32 @@ G_GNUC_END_IGNORE_DEPRECATIONS;
gtk_menu_set_reserve_toggle_size (menu, g_value_get_boolean (value));
break;
case PROP_ANCHOR_HINTS:
- menu->priv->anchor_hints = g_value_get_flags (value);
+ if (menu->priv->anchor_hints != g_value_get_flags (value))
+ {
+ menu->priv->anchor_hints = g_value_get_flags (value);
+ g_object_notify_by_pspec (object, pspec);
+ }
break;
case PROP_RECT_ANCHOR_DX:
- menu->priv->rect_anchor_dx = g_value_get_int (value);
+ if (menu->priv->rect_anchor_dx != g_value_get_int (value))
+ {
+ menu->priv->rect_anchor_dx = g_value_get_int (value);
+ g_object_notify_by_pspec (object, pspec);
+ }
break;
case PROP_RECT_ANCHOR_DY:
- menu->priv->rect_anchor_dy = g_value_get_int (value);
+ if (menu->priv->rect_anchor_dy != g_value_get_int (value))
+ {
+ menu->priv->rect_anchor_dy = g_value_get_int (value);
+ g_object_notify_by_pspec (object, pspec);
+ }
break;
case PROP_MENU_TYPE_HINT:
- menu->priv->menu_type_hint = g_value_get_enum (value);
+ if (menu->priv->menu_type_hint != g_value_get_enum (value))
+ {
+ menu->priv->menu_type_hint = g_value_get_enum (value);
+ g_object_notify_by_pspec (object, pspec);
+ }
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -1340,6 +1360,11 @@ gtk_menu_init (GtkMenu *menu)
priv->monitor_num = -1;
priv->drag_start_y = -1;
+ priv->anchor_hints = GDK_ANCHOR_FLIP | GDK_ANCHOR_SLIDE | GDK_ANCHOR_RESIZE;
+ priv->rect_anchor_dx = 0;
+ priv->rect_anchor_dy = 0;
+ priv->menu_type_hint = GDK_WINDOW_TYPE_HINT_POPUP_MENU;
+
_gtk_widget_set_captured_event_handler (GTK_WIDGET (menu), gtk_menu_captured_event);
widget_node = gtk_widget_get_css_node (GTK_WIDGET (menu));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]