Merge branch 'matthiasc/for-main' into 'main'

textview: Respect editability for Emoji

Closes #4479 and #4503

See merge request GNOME/gtk!4204
This commit is contained in:
Matthias Clasen 2021-12-01 01:13:48 +00:00
commit bfd3d714b9
3 changed files with 24 additions and 15 deletions

View File

@ -410,8 +410,8 @@ have been removed. Update your code accordingly.
Any APIs that deal with global (or root) coordinates have been Any APIs that deal with global (or root) coordinates have been
removed in GTK 4, since not all backends support them. You should removed in GTK 4, since not all backends support them. You should
replace your use of such APIs with surface-relative equivalents. replace your use of such APIs with surface-relative equivalents.
Examples of this are `gdk_surface_get_origin()`, `gdk_surface_move()` Examples of such removed APIs are `gdk_window_get_origin()`,
or `gdk_event_get_root_coords()`. `gdk_window_move()` or `gdk_event_get_root_coords()`.
### Adapt to `GdkKeymap` API changes ### Adapt to `GdkKeymap` API changes

View File

@ -1863,13 +1863,13 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
NULL); NULL);
/* Emoji */ /* Emoji */
gtk_widget_class_add_binding_signal (widget_class, gtk_widget_class_add_binding_action (widget_class,
GDK_KEY_period, GDK_CONTROL_MASK, GDK_KEY_period, GDK_CONTROL_MASK,
"insert-emoji", "misc.insert-emoji",
NULL); NULL);
gtk_widget_class_add_binding_signal (widget_class, gtk_widget_class_add_binding_action (widget_class,
GDK_KEY_semicolon, GDK_CONTROL_MASK, GDK_KEY_semicolon, GDK_CONTROL_MASK,
"insert-emoji", "misc.insert-emoji",
NULL); NULL);
/* Caret mode */ /* Caret mode */
@ -10012,6 +10012,10 @@ gtk_text_view_insert_emoji (GtkTextView *text_view)
gtk_text_buffer_get_insert (buffer)); gtk_text_buffer_get_insert (buffer));
gtk_text_view_get_iter_location (text_view, &iter, (GdkRectangle *) &rect); gtk_text_view_get_iter_location (text_view, &iter, (GdkRectangle *) &rect);
rect.width = MAX (rect.width, 1);
rect.height = MAX (rect.height, 1);
gtk_text_view_buffer_to_window_coords (text_view, GTK_TEXT_WINDOW_TEXT, gtk_text_view_buffer_to_window_coords (text_view, GTK_TEXT_WINDOW_TEXT,
rect.x, rect.y, &rect.x, &rect.y); rect.x, rect.y, &rect.x, &rect.y);
_text_window_to_widget_coords (text_view, &rect.x, &rect.y); _text_window_to_widget_coords (text_view, &rect.x, &rect.y);

View File

@ -221,7 +221,7 @@ static void
int_modified (GtkAdjustment *adj, ObjectProperty *p) int_modified (GtkAdjustment *adj, ObjectProperty *p)
{ {
GValue val = G_VALUE_INIT; GValue val = G_VALUE_INIT;
g_value_init (&val, G_TYPE_INT); g_value_init (&val, G_TYPE_INT);
g_value_set_int (&val, (int) gtk_adjustment_get_value (adj)); g_value_set_int (&val, (int) gtk_adjustment_get_value (adj));
set_property_value (p->obj, p->spec, &val); set_property_value (p->obj, p->spec, &val);
@ -250,7 +250,7 @@ static void
uint_modified (GtkAdjustment *adj, ObjectProperty *p) uint_modified (GtkAdjustment *adj, ObjectProperty *p)
{ {
GValue val = G_VALUE_INIT; GValue val = G_VALUE_INIT;
g_value_init (&val, G_TYPE_UINT); g_value_init (&val, G_TYPE_UINT);
g_value_set_uint (&val, (guint) gtk_adjustment_get_value (adj)); g_value_set_uint (&val, (guint) gtk_adjustment_get_value (adj));
set_property_value (p->obj, p->spec, &val); set_property_value (p->obj, p->spec, &val);
@ -280,7 +280,7 @@ static void
float_modified (GtkAdjustment *adj, ObjectProperty *p) float_modified (GtkAdjustment *adj, ObjectProperty *p)
{ {
GValue val = G_VALUE_INIT; GValue val = G_VALUE_INIT;
g_value_init (&val, G_TYPE_FLOAT); g_value_init (&val, G_TYPE_FLOAT);
g_value_set_float (&val, (float) gtk_adjustment_get_value (adj)); g_value_set_float (&val, (float) gtk_adjustment_get_value (adj));
set_property_value (p->obj, p->spec, &val); set_property_value (p->obj, p->spec, &val);
@ -310,7 +310,7 @@ static void
double_modified (GtkAdjustment *adj, ObjectProperty *p) double_modified (GtkAdjustment *adj, ObjectProperty *p)
{ {
GValue val = G_VALUE_INIT; GValue val = G_VALUE_INIT;
g_value_init (&val, G_TYPE_DOUBLE); g_value_init (&val, G_TYPE_DOUBLE);
g_value_set_double (&val, gtk_adjustment_get_value (adj)); g_value_set_double (&val, gtk_adjustment_get_value (adj));
set_property_value (p->obj, p->spec, &val); set_property_value (p->obj, p->spec, &val);
@ -340,7 +340,7 @@ static void
string_modified (GtkEntry *entry, ObjectProperty *p) string_modified (GtkEntry *entry, ObjectProperty *p)
{ {
GValue val = G_VALUE_INIT; GValue val = G_VALUE_INIT;
g_value_init (&val, G_TYPE_STRING); g_value_init (&val, G_TYPE_STRING);
g_value_set_static_string (&val, gtk_editable_get_text (GTK_EDITABLE (entry))); g_value_set_static_string (&val, gtk_editable_get_text (GTK_EDITABLE (entry)));
set_property_value (p->obj, p->spec, &val); set_property_value (p->obj, p->spec, &val);
@ -1072,7 +1072,12 @@ property_editor (GObject *object,
} }
if (j >= 10) if (j >= 10)
g_object_set (sw, "vscrollbar-policy", GTK_POLICY_AUTOMATIC, NULL); {
g_object_set (sw,
"vscrollbar-policy", GTK_POLICY_AUTOMATIC,
"min-content-height", 250,
NULL);
}
g_type_class_unref (fclass); g_type_class_unref (fclass);
@ -1208,7 +1213,7 @@ gtk_cell_layout_get_model (GtkCellLayout *layout)
return gtk_tree_view_get_model (GTK_TREE_VIEW (gtk_tree_view_column_get_tree_view (GTK_TREE_VIEW_COLUMN (layout)))); return gtk_tree_view_get_model (GTK_TREE_VIEW (gtk_tree_view_column_get_tree_view (GTK_TREE_VIEW_COLUMN (layout))));
else if (GTK_IS_ICON_VIEW (layout)) else if (GTK_IS_ICON_VIEW (layout))
return gtk_icon_view_get_model (GTK_ICON_VIEW (layout)); return gtk_icon_view_get_model (GTK_ICON_VIEW (layout));
else if (GTK_IS_COMBO_BOX (layout)) else if (GTK_IS_COMBO_BOX (layout))
return gtk_combo_box_get_model (GTK_COMBO_BOX (layout)); return gtk_combo_box_get_model (GTK_COMBO_BOX (layout));
else else
return NULL; return NULL;
@ -1350,7 +1355,7 @@ attribute_editor (GObject *object,
{ {
area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (layout)); area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (layout));
col = gtk_cell_area_attribute_get_column (area, col = gtk_cell_area_attribute_get_column (area,
GTK_CELL_RENDERER (object), GTK_CELL_RENDERER (object),
self->name); self->name);
model = gtk_cell_layout_get_model (GTK_CELL_LAYOUT (layout)); model = gtk_cell_layout_get_model (GTK_CELL_LAYOUT (layout));
} }
@ -1702,7 +1707,7 @@ set_property (GObject *object,
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
break; break;
} }
} }
static void static void