forked from AuroraMiddleware/gtk
Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master Closes #3282 See merge request GNOME/gtk!2755
This commit is contained in:
commit
d5b9489408
@ -113,12 +113,9 @@ apply_transform (CanvasItem *item)
|
|||||||
y = gtk_widget_get_allocated_height (item->label) / 2.0;
|
y = gtk_widget_get_allocated_height (item->label) / 2.0;
|
||||||
item->r = sqrt (x*x + y*y);
|
item->r = sqrt (x*x + y*y);
|
||||||
|
|
||||||
transform = gsk_transform_translate (
|
transform = gsk_transform_translate (NULL, &(graphene_point_t) { item->r, item->r });
|
||||||
gsk_transform_rotate (
|
transform = gsk_transform_rotate (transform, item->angle + item->delta);
|
||||||
gsk_transform_translate (NULL,
|
transform = gsk_transform_translate (transform, &(graphene_point_t) { -x, -y });
|
||||||
&(graphene_point_t) { item->r, item->r }),
|
|
||||||
item->angle + item->delta),
|
|
||||||
&(graphene_point_t) { - x, - y });
|
|
||||||
|
|
||||||
gtk_fixed_set_child_transform (GTK_FIXED (item->fixed), item->label, transform);
|
gtk_fixed_set_child_transform (GTK_FIXED (item->fixed), item->label, transform);
|
||||||
gsk_transform_unref (transform);
|
gsk_transform_unref (transform);
|
||||||
|
@ -1068,7 +1068,6 @@ update_font_variations (void)
|
|||||||
unsigned int length;
|
unsigned int length;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
child = gtk_widget_get_first_child (variations_grid);
|
|
||||||
while ((child = gtk_widget_get_first_child (variations_grid)))
|
while ((child = gtk_widget_get_first_child (variations_grid)))
|
||||||
gtk_grid_remove (GTK_GRID (variations_grid), child);
|
gtk_grid_remove (GTK_GRID (variations_grid), child);
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ save_file (GFile *save_filename)
|
|||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
|
|
||||||
if (error != NULL)
|
if (error == NULL)
|
||||||
{
|
{
|
||||||
if (save_filename != filename)
|
if (save_filename != filename)
|
||||||
{
|
{
|
||||||
|
@ -2051,6 +2051,9 @@ update_cursor (GdkDisplay *display,
|
|||||||
GdkDeviceGrabInfo *grab;
|
GdkDeviceGrabInfo *grab;
|
||||||
GdkCursor *cursor;
|
GdkCursor *cursor;
|
||||||
|
|
||||||
|
g_assert (display);
|
||||||
|
g_assert (device);
|
||||||
|
|
||||||
pointer_info = _gdk_display_get_pointer_info (display, device);
|
pointer_info = _gdk_display_get_pointer_info (display, device);
|
||||||
pointer_surface = pointer_info->surface_under_pointer;
|
pointer_surface = pointer_info->surface_under_pointer;
|
||||||
|
|
||||||
|
@ -1914,22 +1914,25 @@ blur_node (GskGLRenderer *self,
|
|||||||
texture_width = ceilf ((node->bounds.size.width + blur_extra));
|
texture_width = ceilf ((node->bounds.size.width + blur_extra));
|
||||||
texture_height = ceilf ((node->bounds.size.height + blur_extra));
|
texture_height = ceilf ((node->bounds.size.height + blur_extra));
|
||||||
|
|
||||||
if (!add_offscreen_ops (self, builder,
|
/* Only blur this if the out region has no texture id yet */
|
||||||
&GRAPHENE_RECT_INIT (node->bounds.origin.x - (blur_extra / 2.0),
|
if (out_region->texture_id == 0)
|
||||||
node->bounds.origin.y - (blur_extra /2.0),
|
{
|
||||||
texture_width, texture_height),
|
if (!add_offscreen_ops (self, builder,
|
||||||
node,
|
&GRAPHENE_RECT_INIT (node->bounds.origin.x - (blur_extra / 2.0),
|
||||||
®ion, &is_offscreen,
|
node->bounds.origin.y - (blur_extra / 2.0),
|
||||||
RESET_CLIP | RESET_OPACITY | FORCE_OFFSCREEN | extra_flags))
|
texture_width, texture_height),
|
||||||
g_assert_not_reached ();
|
node,
|
||||||
|
®ion, &is_offscreen,
|
||||||
|
RESET_CLIP | RESET_OPACITY | FORCE_OFFSCREEN | extra_flags))
|
||||||
|
g_assert_not_reached ();
|
||||||
|
|
||||||
blurred_texture_id = blur_texture (self, builder,
|
blurred_texture_id = blur_texture (self, builder,
|
||||||
®ion,
|
®ion,
|
||||||
texture_width * scale_x, texture_height * scale_y,
|
texture_width * scale_x, texture_height * scale_y,
|
||||||
blur_radius * scale_x,
|
blur_radius * scale_x,
|
||||||
blur_radius * scale_y);
|
blur_radius * scale_y);
|
||||||
|
init_full_texture_region (out_region, blurred_texture_id);
|
||||||
init_full_texture_region (out_region, blurred_texture_id);
|
}
|
||||||
|
|
||||||
if (out_vertex_data)
|
if (out_vertex_data)
|
||||||
{
|
{
|
||||||
@ -1949,6 +1952,7 @@ render_blur_node (GskGLRenderer *self,
|
|||||||
GskRenderNode *child = gsk_blur_node_get_child (node);
|
GskRenderNode *child = gsk_blur_node_get_child (node);
|
||||||
TextureRegion blurred_region;
|
TextureRegion blurred_region;
|
||||||
GskTextureKey key;
|
GskTextureKey key;
|
||||||
|
float min_x, max_x, min_y, max_y;
|
||||||
|
|
||||||
if (node_is_invisible (child))
|
if (node_is_invisible (child))
|
||||||
return;
|
return;
|
||||||
@ -1964,15 +1968,16 @@ render_blur_node (GskGLRenderer *self,
|
|||||||
key.scale = ops_get_scale (builder);
|
key.scale = ops_get_scale (builder);
|
||||||
key.filter = GL_NEAREST;
|
key.filter = GL_NEAREST;
|
||||||
blurred_region.texture_id = gsk_gl_driver_get_texture_for_key (self->gl_driver, &key);
|
blurred_region.texture_id = gsk_gl_driver_get_texture_for_key (self->gl_driver, &key);
|
||||||
if (blurred_region.texture_id == 0)
|
blur_node (self, child, builder, blur_radius, 0, &blurred_region,
|
||||||
blur_node (self, child, builder, blur_radius, 0, &blurred_region, NULL);
|
(float*[4]){&min_x, &max_x, &min_y, &max_y});
|
||||||
|
|
||||||
g_assert (blurred_region.texture_id != 0);
|
g_assert (blurred_region.texture_id != 0);
|
||||||
|
|
||||||
/* Draw the result */
|
/* Draw the result */
|
||||||
ops_set_program (builder, &self->programs->blit_program);
|
ops_set_program (builder, &self->programs->blit_program);
|
||||||
ops_set_texture (builder, blurred_region.texture_id);
|
ops_set_texture (builder, blurred_region.texture_id);
|
||||||
load_offscreen_vertex_data (ops_draw (builder, NULL), node, builder); /* Render result to screen */
|
fill_vertex_data (ops_draw (builder, NULL), min_x, min_y, max_x, max_y);
|
||||||
|
|
||||||
|
|
||||||
/* Add to cache for the blur node */
|
/* Add to cache for the blur node */
|
||||||
gsk_gl_driver_set_texture_for_key (self->gl_driver, &key, blurred_region.texture_id);
|
gsk_gl_driver_set_texture_for_key (self->gl_driver, &key, blurred_region.texture_id);
|
||||||
@ -2390,7 +2395,7 @@ render_outset_shadow_node (GskGLRenderer *self,
|
|||||||
if (slice_is_visible (&slices[NINE_SLICE_TOP_CENTER]))
|
if (slice_is_visible (&slices[NINE_SLICE_TOP_CENTER]))
|
||||||
{
|
{
|
||||||
x1 = min_x + (slices[NINE_SLICE_TOP_LEFT].width / scale_x);
|
x1 = min_x + (slices[NINE_SLICE_TOP_LEFT].width / scale_x);
|
||||||
x2 = max_x - (slices[NINE_SLICE_TOP_RIGHT].width / scale_y);
|
x2 = max_x - (slices[NINE_SLICE_TOP_RIGHT].width / scale_x);
|
||||||
y1 = min_y;
|
y1 = min_y;
|
||||||
y2 = min_y + (slices[NINE_SLICE_TOP_CENTER].height / scale_y);
|
y2 = min_y + (slices[NINE_SLICE_TOP_CENTER].height / scale_y);
|
||||||
|
|
||||||
@ -2487,7 +2492,7 @@ render_outset_shadow_node (GskGLRenderer *self,
|
|||||||
{
|
{
|
||||||
x1 = min_x;
|
x1 = min_x;
|
||||||
x2 = min_x + (slices[NINE_SLICE_LEFT_CENTER].width / scale_x);
|
x2 = min_x + (slices[NINE_SLICE_LEFT_CENTER].width / scale_x);
|
||||||
y1 = min_y + (slices[NINE_SLICE_TOP_LEFT].height / scale_x);
|
y1 = min_y + (slices[NINE_SLICE_TOP_LEFT].height / scale_y);
|
||||||
y2 = max_y - (slices[NINE_SLICE_BOTTOM_LEFT].height / scale_y);
|
y2 = max_y - (slices[NINE_SLICE_BOTTOM_LEFT].height / scale_y);
|
||||||
tx1 = tregs[NINE_SLICE_LEFT_CENTER].x;
|
tx1 = tregs[NINE_SLICE_LEFT_CENTER].x;
|
||||||
tx2 = tregs[NINE_SLICE_LEFT_CENTER].x2;
|
tx2 = tregs[NINE_SLICE_LEFT_CENTER].x2;
|
||||||
@ -2631,6 +2636,7 @@ render_shadow_node (GskGLRenderer *self,
|
|||||||
|
|
||||||
if (shadow->radius > 0)
|
if (shadow->radius > 0)
|
||||||
{
|
{
|
||||||
|
region.texture_id = 0;
|
||||||
blur_node (self, shadow_child, builder, shadow->radius, NO_CACHE_PLZ, ®ion,
|
blur_node (self, shadow_child, builder, shadow->radius, NO_CACHE_PLZ, ®ion,
|
||||||
(float*[4]){&min_x, &max_x, &min_y, &max_y});
|
(float*[4]){&min_x, &max_x, &min_y, &max_y});
|
||||||
is_offscreen = TRUE;
|
is_offscreen = TRUE;
|
||||||
|
@ -895,6 +895,7 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
|
|||||||
case GTK_ACCESSIBLE_TRISTATE_FALSE:
|
case GTK_ACCESSIBLE_TRISTATE_FALSE:
|
||||||
emit_state_changed (self, "checked", FALSE);
|
emit_state_changed (self, "checked", FALSE);
|
||||||
emit_state_changed (self, "indeterminate", FALSE);
|
emit_state_changed (self, "indeterminate", FALSE);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -930,6 +931,7 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
|
|||||||
break;
|
break;
|
||||||
case GTK_ACCESSIBLE_INVALID_FALSE:
|
case GTK_ACCESSIBLE_INVALID_FALSE:
|
||||||
emit_state_changed (self, "invalid", FALSE);
|
emit_state_changed (self, "invalid", FALSE);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -951,6 +953,7 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
|
|||||||
case GTK_ACCESSIBLE_TRISTATE_FALSE:
|
case GTK_ACCESSIBLE_TRISTATE_FALSE:
|
||||||
emit_state_changed (self, "pressed", FALSE);
|
emit_state_changed (self, "pressed", FALSE);
|
||||||
emit_state_changed (self, "indeterminate", FALSE);
|
emit_state_changed (self, "indeterminate", FALSE);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ gtk_text_view_add_default_attributes (GtkTextView *view,
|
|||||||
g_variant_builder_add (builder, "{ss}", "direction",
|
g_variant_builder_add (builder, "{ss}", "direction",
|
||||||
gtk_text_direction_to_string (text_attrs->direction));
|
gtk_text_direction_to_string (text_attrs->direction));
|
||||||
g_variant_builder_add (builder, "{ss}", "wrap-mode",
|
g_variant_builder_add (builder, "{ss}", "wrap-mode",
|
||||||
pango_wrap_mode_to_string (text_attrs->wrap_mode));
|
pango_wrap_mode_to_string ((PangoWrapMode)text_attrs->wrap_mode));
|
||||||
g_variant_builder_add (builder, "{ss}", "editable",
|
g_variant_builder_add (builder, "{ss}", "editable",
|
||||||
text_attrs->editable ? "true" : "false");
|
text_attrs->editable ? "true" : "false");
|
||||||
g_variant_builder_add (builder, "{ss}", "invisible",
|
g_variant_builder_add (builder, "{ss}", "invisible",
|
||||||
@ -256,7 +256,7 @@ gtk_text_buffer_get_run_attributes (GtkTextBuffer *buffer,
|
|||||||
"wrap-mode", &wrap_mode,
|
"wrap-mode", &wrap_mode,
|
||||||
NULL);
|
NULL);
|
||||||
if (val_set)
|
if (val_set)
|
||||||
g_variant_builder_add (builder, "{ss}", "wrap-mode", pango_wrap_mode_to_string (wrap_mode));
|
g_variant_builder_add (builder, "{ss}", "wrap-mode", pango_wrap_mode_to_string ((PangoWrapMode)wrap_mode));
|
||||||
temp_tags = temp_tags->next;
|
temp_tags = temp_tags->next;
|
||||||
}
|
}
|
||||||
val_set = FALSE;
|
val_set = FALSE;
|
||||||
|
@ -619,11 +619,11 @@ gtk_file_chooser_widget_finalize (GObject *object)
|
|||||||
static GtkWindow *
|
static GtkWindow *
|
||||||
get_toplevel (GtkWidget *widget)
|
get_toplevel (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
GtkWidget *toplevel;
|
GtkRoot *root;
|
||||||
|
|
||||||
toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
|
root = gtk_widget_get_root (widget);
|
||||||
if (GTK_IS_WINDOW (toplevel))
|
if (root && GTK_IS_WINDOW (root))
|
||||||
return GTK_WINDOW (toplevel);
|
return GTK_WINDOW (root);
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -5395,6 +5395,10 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
|
|||||||
if (impl->operation_mode == OPERATION_MODE_SEARCH)
|
if (impl->operation_mode == OPERATION_MODE_SEARCH)
|
||||||
return get_selected_files_as_model (impl);
|
return get_selected_files_as_model (impl);
|
||||||
|
|
||||||
|
info.impl = impl;
|
||||||
|
info.result = g_list_store_new (G_TYPE_FILE);
|
||||||
|
info.file_from_entry = NULL;
|
||||||
|
|
||||||
if (impl->operation_mode == OPERATION_MODE_RECENT)
|
if (impl->operation_mode == OPERATION_MODE_RECENT)
|
||||||
{
|
{
|
||||||
if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
|
if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
|
||||||
@ -5403,13 +5407,12 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
|
|||||||
goto file_entry;
|
goto file_entry;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return get_selected_files_as_model (impl);
|
{
|
||||||
|
g_object_unref (info.result);
|
||||||
|
return get_selected_files_as_model (impl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
info.impl = impl;
|
|
||||||
info.result = g_list_store_new (G_TYPE_FILE);
|
|
||||||
info.file_from_entry = NULL;
|
|
||||||
|
|
||||||
toplevel = get_toplevel (GTK_WIDGET (impl));
|
toplevel = get_toplevel (GTK_WIDGET (impl));
|
||||||
if (toplevel)
|
if (toplevel)
|
||||||
current_focus = gtk_root_get_focus (GTK_ROOT (toplevel));
|
current_focus = gtk_root_get_focus (GTK_ROOT (toplevel));
|
||||||
|
@ -2337,7 +2337,10 @@ no_uline:
|
|||||||
char *text_for_accel;
|
char *text_for_accel;
|
||||||
|
|
||||||
if (!pango_parse_markup (str_for_display, -1, 0, NULL, &text_for_accel, NULL, &error))
|
if (!pango_parse_markup (str_for_display, -1, 0, NULL, &text_for_accel, NULL, &error))
|
||||||
goto error_set;
|
{
|
||||||
|
g_free (new_text);
|
||||||
|
goto error_set;
|
||||||
|
}
|
||||||
|
|
||||||
extract_mnemonic_keyval (text_for_accel,
|
extract_mnemonic_keyval (text_for_accel,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -2165,6 +2165,9 @@ gtk_stack_snapshot_cube (GtkWidget *widget,
|
|||||||
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
|
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
|
||||||
double progress = gtk_progress_tracker_get_progress (&priv->tracker, FALSE);
|
double progress = gtk_progress_tracker_get_progress (&priv->tracker, FALSE);
|
||||||
|
|
||||||
|
g_assert (priv->active_transition_type == GTK_STACK_TRANSITION_TYPE_ROTATE_RIGHT ||
|
||||||
|
priv->active_transition_type == GTK_STACK_TRANSITION_TYPE_ROTATE_LEFT);
|
||||||
|
|
||||||
if (priv->active_transition_type == GTK_STACK_TRANSITION_TYPE_ROTATE_RIGHT)
|
if (priv->active_transition_type == GTK_STACK_TRANSITION_TYPE_ROTATE_RIGHT)
|
||||||
progress = 1 - progress;
|
progress = 1 - progress;
|
||||||
|
|
||||||
|
120
gtk/gtktext.c
120
gtk/gtktext.c
@ -329,8 +329,6 @@ static void gtk_text_size_allocate (GtkWidget *widget,
|
|||||||
int baseline);
|
int baseline);
|
||||||
static void gtk_text_snapshot (GtkWidget *widget,
|
static void gtk_text_snapshot (GtkWidget *widget,
|
||||||
GtkSnapshot *snapshot);
|
GtkSnapshot *snapshot);
|
||||||
static void gtk_text_focus_in (GtkWidget *widget);
|
|
||||||
static void gtk_text_focus_out (GtkWidget *widget);
|
|
||||||
static void gtk_text_focus_changed (GtkEventControllerFocus *focus,
|
static void gtk_text_focus_changed (GtkEventControllerFocus *focus,
|
||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
GtkWidget *widget);
|
GtkWidget *widget);
|
||||||
@ -341,7 +339,6 @@ static void gtk_text_direction_changed (GtkWidget *widget,
|
|||||||
GtkTextDirection previous_dir);
|
GtkTextDirection previous_dir);
|
||||||
static void gtk_text_state_flags_changed (GtkWidget *widget,
|
static void gtk_text_state_flags_changed (GtkWidget *widget,
|
||||||
GtkStateFlags previous_state);
|
GtkStateFlags previous_state);
|
||||||
static void gtk_text_root (GtkWidget *widget);
|
|
||||||
|
|
||||||
static gboolean gtk_text_drag_drop (GtkDropTarget *dest,
|
static gboolean gtk_text_drag_drop (GtkDropTarget *dest,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
@ -728,7 +725,6 @@ gtk_text_class_init (GtkTextClass *class)
|
|||||||
widget_class->css_changed = gtk_text_css_changed;
|
widget_class->css_changed = gtk_text_css_changed;
|
||||||
widget_class->direction_changed = gtk_text_direction_changed;
|
widget_class->direction_changed = gtk_text_direction_changed;
|
||||||
widget_class->state_flags_changed = gtk_text_state_flags_changed;
|
widget_class->state_flags_changed = gtk_text_state_flags_changed;
|
||||||
widget_class->root = gtk_text_root;
|
|
||||||
widget_class->mnemonic_activate = gtk_text_mnemonic_activate;
|
widget_class->mnemonic_activate = gtk_text_mnemonic_activate;
|
||||||
|
|
||||||
class->move_cursor = gtk_text_move_cursor;
|
class->move_cursor = gtk_text_move_cursor;
|
||||||
@ -3152,73 +3148,54 @@ gtk_text_key_controller_key_pressed (GtkEventControllerKey *controller,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_text_focus_in (GtkWidget *widget)
|
|
||||||
{
|
|
||||||
GtkText *self = GTK_TEXT (widget);
|
|
||||||
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
|
||||||
GdkSeat *seat = NULL;
|
|
||||||
GdkDevice *keyboard = NULL;
|
|
||||||
|
|
||||||
gtk_widget_queue_draw (widget);
|
|
||||||
|
|
||||||
seat = gdk_display_get_default_seat (gtk_widget_get_display (widget));
|
|
||||||
if (seat)
|
|
||||||
keyboard = gdk_seat_get_keyboard (seat);
|
|
||||||
if (keyboard)
|
|
||||||
g_signal_connect (keyboard, "notify::direction",
|
|
||||||
G_CALLBACK (direction_changed), self);
|
|
||||||
|
|
||||||
|
|
||||||
if (priv->editable)
|
|
||||||
{
|
|
||||||
gtk_text_schedule_im_reset (self);
|
|
||||||
gtk_im_context_focus_in (priv->im_context);
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_text_reset_blink_time (self);
|
|
||||||
gtk_text_check_cursor_blink (self);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_text_focus_out (GtkWidget *widget)
|
|
||||||
{
|
|
||||||
GtkText *self = GTK_TEXT (widget);
|
|
||||||
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
|
||||||
GdkSeat *seat = NULL;
|
|
||||||
GdkDevice *keyboard = NULL;
|
|
||||||
|
|
||||||
gtk_text_selection_bubble_popup_unset (self);
|
|
||||||
|
|
||||||
priv->text_handles_enabled = FALSE;
|
|
||||||
gtk_text_update_handles (self);
|
|
||||||
|
|
||||||
gtk_widget_queue_draw (widget);
|
|
||||||
|
|
||||||
seat = gdk_display_get_default_seat (gtk_widget_get_display (widget));
|
|
||||||
if (seat)
|
|
||||||
keyboard = gdk_seat_get_keyboard (seat);
|
|
||||||
if (keyboard)
|
|
||||||
g_signal_handlers_disconnect_by_func (keyboard, direction_changed, self);
|
|
||||||
|
|
||||||
if (priv->editable)
|
|
||||||
{
|
|
||||||
gtk_text_schedule_im_reset (self);
|
|
||||||
gtk_im_context_focus_out (priv->im_context);
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_text_check_cursor_blink (self);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_text_focus_changed (GtkEventControllerFocus *controller,
|
gtk_text_focus_changed (GtkEventControllerFocus *controller,
|
||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
GtkWidget *widget)
|
GtkWidget *widget)
|
||||||
{
|
{
|
||||||
|
GtkText *self = GTK_TEXT (widget);
|
||||||
|
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
||||||
|
GdkSeat *seat = NULL;
|
||||||
|
GdkDevice *keyboard = NULL;
|
||||||
|
|
||||||
|
seat = gdk_display_get_default_seat (gtk_widget_get_display (widget));
|
||||||
|
if (seat)
|
||||||
|
keyboard = gdk_seat_get_keyboard (seat);
|
||||||
|
|
||||||
|
gtk_widget_queue_draw (widget);
|
||||||
|
|
||||||
if (gtk_event_controller_focus_is_focus (controller))
|
if (gtk_event_controller_focus_is_focus (controller))
|
||||||
gtk_text_focus_in (widget);
|
{
|
||||||
else
|
if (keyboard)
|
||||||
gtk_text_focus_out (widget);
|
g_signal_connect (keyboard, "notify::direction",
|
||||||
|
G_CALLBACK (direction_changed), self);
|
||||||
|
|
||||||
|
if (priv->editable)
|
||||||
|
{
|
||||||
|
gtk_text_schedule_im_reset (self);
|
||||||
|
gtk_im_context_focus_in (priv->im_context);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_text_reset_blink_time (self);
|
||||||
|
}
|
||||||
|
else /* Focus out */
|
||||||
|
{
|
||||||
|
gtk_text_selection_bubble_popup_unset (self);
|
||||||
|
|
||||||
|
priv->text_handles_enabled = FALSE;
|
||||||
|
gtk_text_update_handles (self);
|
||||||
|
|
||||||
|
if (keyboard)
|
||||||
|
g_signal_handlers_disconnect_by_func (keyboard, direction_changed, self);
|
||||||
|
|
||||||
|
if (priv->editable)
|
||||||
|
{
|
||||||
|
gtk_text_schedule_im_reset (self);
|
||||||
|
gtk_im_context_focus_out (priv->im_context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_text_check_cursor_blink (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -3228,14 +3205,15 @@ gtk_text_grab_focus (GtkWidget *widget)
|
|||||||
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
||||||
gboolean select_on_focus;
|
gboolean select_on_focus;
|
||||||
GtkWidget *prev_focus;
|
GtkWidget *prev_focus;
|
||||||
|
gboolean prev_focus_was_child;
|
||||||
|
|
||||||
prev_focus = gtk_root_get_focus (gtk_widget_get_root (widget));
|
prev_focus = gtk_root_get_focus (gtk_widget_get_root (widget));
|
||||||
|
prev_focus_was_child = prev_focus && gtk_widget_is_ancestor (prev_focus, widget);
|
||||||
|
|
||||||
if (!GTK_WIDGET_CLASS (gtk_text_parent_class)->grab_focus (GTK_WIDGET (self)))
|
if (!GTK_WIDGET_CLASS (gtk_text_parent_class)->grab_focus (GTK_WIDGET (self)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (priv->editable && !priv->in_click &&
|
if (priv->editable && !priv->in_click && !prev_focus_was_child)
|
||||||
!(prev_focus && gtk_widget_is_ancestor (prev_focus, widget)))
|
|
||||||
{
|
{
|
||||||
g_object_get (gtk_widget_get_settings (widget),
|
g_object_get (gtk_widget_get_settings (widget),
|
||||||
"gtk-entry-select-on-focus",
|
"gtk-entry-select-on-focus",
|
||||||
@ -3256,7 +3234,7 @@ gtk_text_grab_focus (GtkWidget *widget)
|
|||||||
* Causes @self to have keyboard focus.
|
* Causes @self to have keyboard focus.
|
||||||
*
|
*
|
||||||
* It behaves like gtk_widget_grab_focus(),
|
* It behaves like gtk_widget_grab_focus(),
|
||||||
* except that it doesn't select the contents of the self.
|
* except that it doesn't select the contents of @self.
|
||||||
* You only want to call this on some special entries
|
* You only want to call this on some special entries
|
||||||
* which the user usually doesn't want to replace all text in,
|
* which the user usually doesn't want to replace all text in,
|
||||||
* such as search-as-you-type entries.
|
* such as search-as-you-type entries.
|
||||||
@ -3317,12 +3295,6 @@ gtk_text_state_flags_changed (GtkWidget *widget,
|
|||||||
gtk_text_update_cached_style_values (self);
|
gtk_text_update_cached_style_values (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_text_root (GtkWidget *widget)
|
|
||||||
{
|
|
||||||
GTK_WIDGET_CLASS (gtk_text_parent_class)->root (widget);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* GtkEditable method implementations
|
/* GtkEditable method implementations
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
|
@ -4742,15 +4742,9 @@ changed_handler (GtkTextLayout *layout,
|
|||||||
{
|
{
|
||||||
gtk_widget_queue_draw (widget);
|
gtk_widget_queue_draw (widget);
|
||||||
|
|
||||||
DV(g_print(" invalidated rect: %d,%d %d x %d\n",
|
|
||||||
redraw_rect.x,
|
|
||||||
redraw_rect.y,
|
|
||||||
redraw_rect.width,
|
|
||||||
redraw_rect.height));
|
|
||||||
|
|
||||||
queue_update_im_spot_location (text_view);
|
queue_update_im_spot_location (text_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old_height != new_height)
|
if (old_height != new_height)
|
||||||
{
|
{
|
||||||
const GList *iter;
|
const GList *iter;
|
||||||
@ -7226,8 +7220,10 @@ gtk_text_view_drag_gesture_update (GtkGestureDrag *gesture,
|
|||||||
data = g_object_get_qdata (G_OBJECT (gesture), quark_text_selection_data);
|
data = g_object_get_qdata (G_OBJECT (gesture), quark_text_selection_data);
|
||||||
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
|
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
|
||||||
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
|
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
|
||||||
drag_gesture_get_text_surface_coords (gesture, text_view,
|
|
||||||
&start_x, &start_y, &x, &y);
|
if (!drag_gesture_get_text_surface_coords (gesture, text_view,
|
||||||
|
&start_x, &start_y, &x, &y))
|
||||||
|
return;
|
||||||
|
|
||||||
device = gdk_event_get_device (event);
|
device = gdk_event_get_device (event);
|
||||||
|
|
||||||
@ -7347,8 +7343,11 @@ gtk_text_view_drag_gesture_end (GtkGestureDrag *gesture,
|
|||||||
|
|
||||||
priv = text_view->priv;
|
priv = text_view->priv;
|
||||||
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
|
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
|
||||||
drag_gesture_get_text_surface_coords (gesture, text_view,
|
|
||||||
&start_x, &start_y, &x, &y);
|
if (!drag_gesture_get_text_surface_coords (gesture, text_view,
|
||||||
|
&start_x, &start_y, &x, &y))
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
clicked_in_selection =
|
clicked_in_selection =
|
||||||
g_object_get_qdata (G_OBJECT (gesture), quark_text_selection_data) == NULL;
|
g_object_get_qdata (G_OBJECT (gesture), quark_text_selection_data) == NULL;
|
||||||
|
@ -172,7 +172,7 @@ main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bytes = g_bytes_new_take (contents, len);
|
bytes = g_bytes_new_take (contents, len);
|
||||||
GTK_NODE_VIEW (nodeview)->node = gsk_render_node_deserialize (bytes, deserialize_error_func, NULL);
|
GTK_NODE_VIEW (nodeview)->node = gsk_render_node_deserialize (bytes, deserialize_error_func, &error);
|
||||||
g_bytes_unref (bytes);
|
g_bytes_unref (bytes);
|
||||||
|
|
||||||
if (GTK_NODE_VIEW (nodeview)->node == NULL)
|
if (GTK_NODE_VIEW (nodeview)->node == NULL)
|
||||||
|
@ -26,6 +26,7 @@ check_sorted (GtkListBox *list)
|
|||||||
GtkWidget *row, *label;
|
GtkWidget *row, *label;
|
||||||
int res[100];
|
int res[100];
|
||||||
int index, value;
|
int index, value;
|
||||||
|
int n_rows = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (row = gtk_widget_get_first_child (GTK_WIDGET (list));
|
for (row = gtk_widget_get_first_child (GTK_WIDGET (list));
|
||||||
@ -39,10 +40,11 @@ check_sorted (GtkListBox *list)
|
|||||||
label = gtk_list_box_row_get_child (GTK_LIST_BOX_ROW (row));
|
label = gtk_list_box_row_get_child (GTK_LIST_BOX_ROW (row));
|
||||||
value = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (label), "data"));
|
value = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (label), "data"));
|
||||||
res[index] = value;
|
res[index] = value;
|
||||||
|
n_rows++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 1; i < 100; i++)
|
for (i = 1; i < n_rows; i++)
|
||||||
g_assert (res[i - 1] <= res[i]);
|
g_assert_cmpint (res[i - 1], <=, res[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user