mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-09 10:20:07 +00:00
Merge branch 'gtk-4-14-backports' into 'gtk-4-14'
[GTK 4.14] Various backports See merge request GNOME/gtk!7707
This commit is contained in:
commit
7778609305
@ -649,7 +649,7 @@ void
|
|||||||
gdk_monitor_set_scale (GdkMonitor *monitor,
|
gdk_monitor_set_scale (GdkMonitor *monitor,
|
||||||
double scale)
|
double scale)
|
||||||
{
|
{
|
||||||
g_return_if_fail (scale >= 1.);
|
g_return_if_fail (scale > 0.);
|
||||||
|
|
||||||
monitor->scale_set = TRUE;
|
monitor->scale_set = TRUE;
|
||||||
|
|
||||||
|
@ -250,8 +250,7 @@ typedef NSString *CALayerContentsGravity;
|
|||||||
|
|
||||||
-(BOOL)canBecomeKeyWindow
|
-(BOOL)canBecomeKeyWindow
|
||||||
{
|
{
|
||||||
return GDK_IS_TOPLEVEL (gdk_surface) ||
|
return GDK_IS_TOPLEVEL (gdk_surface);
|
||||||
(GDK_IS_POPUP (gdk_surface) && GDK_SURFACE (gdk_surface)->input_region != NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)showAndMakeKey:(BOOL)makeKey
|
-(void)showAndMakeKey:(BOOL)makeKey
|
||||||
@ -692,24 +691,9 @@ typedef NSString *CALayerContentsGravity;
|
|||||||
|
|
||||||
-(void)setStyleMask:(NSWindowStyleMask)styleMask
|
-(void)setStyleMask:(NSWindowStyleMask)styleMask
|
||||||
{
|
{
|
||||||
gboolean was_opaque;
|
|
||||||
gboolean is_opaque;
|
|
||||||
|
|
||||||
was_opaque = (([self styleMask] & NSWindowStyleMaskTitled) != 0);
|
|
||||||
|
|
||||||
[super setStyleMask:styleMask];
|
[super setStyleMask:styleMask];
|
||||||
|
|
||||||
is_opaque = (([self styleMask] & NSWindowStyleMaskTitled) != 0);
|
|
||||||
|
|
||||||
_gdk_macos_surface_update_fullscreen_state (gdk_surface);
|
_gdk_macos_surface_update_fullscreen_state (gdk_surface);
|
||||||
|
|
||||||
if (was_opaque != is_opaque)
|
|
||||||
{
|
|
||||||
[self setOpaque:is_opaque];
|
|
||||||
|
|
||||||
if (!is_opaque)
|
|
||||||
[self setBackgroundColor:[NSColor clearColor]];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
|
-(NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
|
||||||
@ -785,13 +769,20 @@ typedef NSString *CALayerContentsGravity;
|
|||||||
|
|
||||||
if (decorated)
|
if (decorated)
|
||||||
{
|
{
|
||||||
style_mask |= NSWindowStyleMaskTitled;
|
style_mask &= ~NSWindowStyleMaskFullSizeContentView;
|
||||||
|
[self setTitleVisibility:NSWindowTitleVisible];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
style_mask &= ~NSWindowStyleMaskTitled;
|
style_mask |= NSWindowStyleMaskFullSizeContentView;
|
||||||
|
[self setTitleVisibility:NSWindowTitleHidden];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[self setTitlebarAppearsTransparent:!decorated];
|
||||||
|
[[self standardWindowButton:NSWindowCloseButton] setHidden:!decorated];
|
||||||
|
[[self standardWindowButton:NSWindowMiniaturizeButton] setHidden:!decorated];
|
||||||
|
[[self standardWindowButton:NSWindowZoomButton] setHidden:!decorated];
|
||||||
|
|
||||||
[self setStyleMask:style_mask];
|
[self setStyleMask:style_mask];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -617,6 +617,14 @@ _gdk_macos_toplevel_surface_constructed (GObject *object)
|
|||||||
|
|
||||||
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
||||||
|
|
||||||
|
[window setOpaque:NO];
|
||||||
|
|
||||||
|
/* Workaround: if we use full transparency, window rendering becomes slow,
|
||||||
|
* because macOS tries to dynamically calculate the shadow.
|
||||||
|
* Instead provide a tiny bit of alpha, so shadows are drawn around the window.
|
||||||
|
*/
|
||||||
|
[window setBackgroundColor:[[NSColor blackColor] colorWithAlphaComponent:0.00001]];
|
||||||
|
|
||||||
/* Allow NSWindow to go fullscreen */
|
/* Allow NSWindow to go fullscreen */
|
||||||
[window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
[window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
||||||
|
|
||||||
|
@ -134,8 +134,8 @@ get_wl_buffer (GdkWaylandSubsurface *self,
|
|||||||
while (!cd.done)
|
while (!cd.done)
|
||||||
gdk_wayland_display_dispatch_queue (GDK_DISPLAY (display), event_queue);
|
gdk_wayland_display_dispatch_queue (GDK_DISPLAY (display), event_queue);
|
||||||
|
|
||||||
wl_event_queue_destroy (event_queue);
|
|
||||||
zwp_linux_buffer_params_v1_destroy (params);
|
zwp_linux_buffer_params_v1_destroy (params);
|
||||||
|
wl_event_queue_destroy (event_queue);
|
||||||
|
|
||||||
buffer = cd.buffer;
|
buffer = cd.buffer;
|
||||||
|
|
||||||
|
@ -1472,7 +1472,7 @@ gdk_x11_display_open (const char *display_name)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* initialize the display's screens */
|
/* initialize the display's screens */
|
||||||
display_x11->screen = _gdk_x11_screen_new (display, DefaultScreen (display_x11->xdisplay));
|
display_x11->screen = _gdk_x11_screen_new (display, DefaultScreen (display_x11->xdisplay));
|
||||||
|
|
||||||
/* If GL is available we want to pick better default/rgba visuals,
|
/* If GL is available we want to pick better default/rgba visuals,
|
||||||
@ -1484,8 +1484,11 @@ gdk_x11_display_open (const char *display_name)
|
|||||||
*/
|
*/
|
||||||
if (!gdk_display_prepare_gl (display, NULL))
|
if (!gdk_display_prepare_gl (display, NULL))
|
||||||
{
|
{
|
||||||
gdk_x11_display_query_default_visual (display_x11, &display_x11->window_visual, &display_x11->window_depth);
|
if (!display_x11->leader_gdk_surface)
|
||||||
gdk_x11_display_init_leader_surface (display_x11);
|
{
|
||||||
|
gdk_x11_display_query_default_visual (display_x11, &display_x11->window_visual, &display_x11->window_depth);
|
||||||
|
gdk_x11_display_init_leader_surface (display_x11);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_XFIXES
|
#ifdef HAVE_XFIXES
|
||||||
@ -3021,7 +3024,7 @@ gdk_x11_display_init_gl (GdkDisplay *display,
|
|||||||
GdkX11Display *self = GDK_X11_DISPLAY (display);
|
GdkX11Display *self = GDK_X11_DISPLAY (display);
|
||||||
|
|
||||||
if (!gdk_x11_display_init_gl_backend (self, &self->window_visual, &self->window_depth, error))
|
if (!gdk_x11_display_init_gl_backend (self, &self->window_visual, &self->window_depth, error))
|
||||||
return FALSE;
|
return NULL;
|
||||||
|
|
||||||
gdk_x11_display_init_leader_surface (self);
|
gdk_x11_display_init_leader_surface (self);
|
||||||
|
|
||||||
|
@ -83,5 +83,6 @@ GDK_AVAILABLE_IN_4_14
|
|||||||
void gsk_stroke_to_cairo (const GskStroke *self,
|
void gsk_stroke_to_cairo (const GskStroke *self,
|
||||||
cairo_t *cr);
|
cairo_t *cr);
|
||||||
|
|
||||||
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GskStroke, gsk_stroke_free)
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -439,7 +439,8 @@ emoji_activated (GtkFlowBox *box,
|
|||||||
|
|
||||||
item = (GVariant*) g_object_get_data (G_OBJECT (child), "emoji-data");
|
item = (GVariant*) g_object_get_data (G_OBJECT (child), "emoji-data");
|
||||||
modifier = (gunichar) GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (child), "modifier"));
|
modifier = (gunichar) GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (child), "modifier"));
|
||||||
add_recent_item (chooser, item, modifier);
|
if ((GtkWidget *) box != chooser->recent.box)
|
||||||
|
add_recent_item (chooser, item, modifier);
|
||||||
|
|
||||||
g_signal_emit (data, signals[EMOJI_PICKED], 0, text);
|
g_signal_emit (data, signals[EMOJI_PICKED], 0, text);
|
||||||
g_free (text);
|
g_free (text);
|
||||||
|
@ -273,7 +273,7 @@ quartz_set_client_surface (GtkIMContext *context,
|
|||||||
|
|
||||||
if (widget != NULL)
|
if (widget != NULL)
|
||||||
{
|
{
|
||||||
GtkNative *native = gtk_widget_get_native (widget);
|
GtkNative *native = GTK_NATIVE (gtk_widget_get_root (widget));
|
||||||
|
|
||||||
if (native != NULL)
|
if (native != NULL)
|
||||||
qc->client_surface = gtk_native_get_surface (native);
|
qc->client_surface = gtk_native_get_surface (native);
|
||||||
@ -317,7 +317,7 @@ quartz_set_cursor_location (GtkIMContext *context, GdkRectangle *area)
|
|||||||
if (!qc->focused)
|
if (!qc->focused)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
surface_widget = GTK_WIDGET (gdk_surface_get_widget (qc->client_surface));
|
surface_widget = GTK_WIDGET (gtk_widget_get_native (qc->client_widget));
|
||||||
|
|
||||||
if (!surface_widget)
|
if (!surface_widget)
|
||||||
return;
|
return;
|
||||||
|
@ -1067,10 +1067,29 @@ switch_menu (GtkModelButton *button)
|
|||||||
stack = gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_STACK);
|
stack = gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_STACK);
|
||||||
if (stack != NULL)
|
if (stack != NULL)
|
||||||
{
|
{
|
||||||
|
if (button->role == GTK_BUTTON_ROLE_NORMAL)
|
||||||
|
{
|
||||||
|
GtkWidget *title_button = gtk_widget_get_first_child (gtk_stack_get_child_by_name (GTK_STACK (stack), button->menu_name));
|
||||||
|
gtk_accessible_update_state (GTK_ACCESSIBLE (button),
|
||||||
|
GTK_ACCESSIBLE_STATE_EXPANDED, TRUE,
|
||||||
|
-1);
|
||||||
|
gtk_accessible_update_state (GTK_ACCESSIBLE (title_button),
|
||||||
|
GTK_ACCESSIBLE_STATE_EXPANDED, TRUE,
|
||||||
|
-1);
|
||||||
|
g_object_set_data (G_OBJECT (title_button), "-gtk-model-button-parent", button);
|
||||||
|
}
|
||||||
|
else if (button->role == GTK_BUTTON_ROLE_TITLE)
|
||||||
|
{
|
||||||
|
GtkWidget *parent_button = g_object_get_data (G_OBJECT (button), "-gtk-model-button-parent");
|
||||||
|
gtk_accessible_update_state (GTK_ACCESSIBLE (parent_button),
|
||||||
|
GTK_ACCESSIBLE_STATE_EXPANDED, FALSE,
|
||||||
|
-1);
|
||||||
|
gtk_accessible_update_state (GTK_ACCESSIBLE (button),
|
||||||
|
GTK_ACCESSIBLE_STATE_EXPANDED, FALSE,
|
||||||
|
-1);
|
||||||
|
g_object_set_data (G_OBJECT (button), "-gtk-model-button-parent", NULL);
|
||||||
|
}
|
||||||
gtk_stack_set_visible_child_name (GTK_STACK (stack), button->menu_name);
|
gtk_stack_set_visible_child_name (GTK_STACK (stack), button->menu_name);
|
||||||
gtk_accessible_update_state (GTK_ACCESSIBLE (button),
|
|
||||||
GTK_ACCESSIBLE_STATE_EXPANDED, TRUE,
|
|
||||||
-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2290,6 +2290,9 @@ gtk_spin_button_set_numeric (GtkSpinButton *spin_button,
|
|||||||
spin_button->numeric = numeric;
|
spin_button->numeric = numeric;
|
||||||
gtk_text_set_input_purpose (GTK_TEXT (spin_button->entry),
|
gtk_text_set_input_purpose (GTK_TEXT (spin_button->entry),
|
||||||
numeric ? GTK_INPUT_PURPOSE_NUMBER: GTK_INPUT_PURPOSE_FREE_FORM);
|
numeric ? GTK_INPUT_PURPOSE_NUMBER: GTK_INPUT_PURPOSE_FREE_FORM);
|
||||||
|
gtk_text_set_input_hints (GTK_TEXT (spin_button->entry),
|
||||||
|
numeric ? GTK_INPUT_HINT_NO_EMOJI : GTK_INPUT_HINT_NONE);
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (spin_button), spinbutton_props[PROP_NUMERIC]);
|
g_object_notify_by_pspec (G_OBJECT (spin_button), spinbutton_props[PROP_NUMERIC]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6468,7 +6468,7 @@ gtk_text_drag_drop (GtkDropTarget *dest,
|
|||||||
gtk_editable_insert_text (GTK_EDITABLE (self), str, length, &drop_position);
|
gtk_editable_insert_text (GTK_EDITABLE (self), str, length, &drop_position);
|
||||||
gtk_accessible_text_update_contents (GTK_ACCESSIBLE_TEXT (self),
|
gtk_accessible_text_update_contents (GTK_ACCESSIBLE_TEXT (self),
|
||||||
GTK_ACCESSIBLE_TEXT_CONTENT_CHANGE_INSERT,
|
GTK_ACCESSIBLE_TEXT_CONTENT_CHANGE_INSERT,
|
||||||
drop_position, drop_position + length);
|
drop_position, drop_position + g_utf8_strlen (str, length));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -6480,7 +6480,7 @@ gtk_text_drag_drop (GtkDropTarget *dest,
|
|||||||
gtk_editable_insert_text (GTK_EDITABLE (self), str, length, &pos);
|
gtk_editable_insert_text (GTK_EDITABLE (self), str, length, &pos);
|
||||||
gtk_accessible_text_update_contents (GTK_ACCESSIBLE_TEXT (self),
|
gtk_accessible_text_update_contents (GTK_ACCESSIBLE_TEXT (self),
|
||||||
GTK_ACCESSIBLE_TEXT_CONTENT_CHANGE_INSERT,
|
GTK_ACCESSIBLE_TEXT_CONTENT_CHANGE_INSERT,
|
||||||
pos, pos + length);
|
pos, pos + g_utf8_strlen (str, length));
|
||||||
end_change (self);
|
end_change (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7058,7 +7058,7 @@ emoji_picked (GtkEmojiChooser *chooser,
|
|||||||
gtk_editable_insert_text (GTK_EDITABLE (self), text, -1, &pos);
|
gtk_editable_insert_text (GTK_EDITABLE (self), text, -1, &pos);
|
||||||
gtk_accessible_text_update_contents (GTK_ACCESSIBLE_TEXT (self),
|
gtk_accessible_text_update_contents (GTK_ACCESSIBLE_TEXT (self),
|
||||||
GTK_ACCESSIBLE_TEXT_CONTENT_CHANGE_INSERT,
|
GTK_ACCESSIBLE_TEXT_CONTENT_CHANGE_INSERT,
|
||||||
pos, pos + 1);
|
pos, pos + g_utf8_strlen (text, -1));
|
||||||
gtk_text_set_selection_bounds (self, pos, pos);
|
gtk_text_set_selection_bounds (self, pos, pos);
|
||||||
end_change (self);
|
end_change (self);
|
||||||
}
|
}
|
||||||
@ -7388,7 +7388,7 @@ gtk_text_history_insert_cb (gpointer funcs_data,
|
|||||||
gtk_editable_insert_text (GTK_EDITABLE (text), str, len, &location);
|
gtk_editable_insert_text (GTK_EDITABLE (text), str, len, &location);
|
||||||
gtk_accessible_text_update_contents (GTK_ACCESSIBLE_TEXT (text),
|
gtk_accessible_text_update_contents (GTK_ACCESSIBLE_TEXT (text),
|
||||||
GTK_ACCESSIBLE_TEXT_CONTENT_CHANGE_INSERT,
|
GTK_ACCESSIBLE_TEXT_CONTENT_CHANGE_INSERT,
|
||||||
location, location + len);
|
location, location + g_utf8_strlen (str, len));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -44,6 +44,7 @@ struct GtkPrinterOptionWidgetPrivate
|
|||||||
{
|
{
|
||||||
GtkPrinterOption *source;
|
GtkPrinterOption *source;
|
||||||
gulong source_changed_handler;
|
gulong source_changed_handler;
|
||||||
|
gulong comboentry_changed_handler_id;
|
||||||
|
|
||||||
GtkWidget *check;
|
GtkWidget *check;
|
||||||
GtkWidget *combo;
|
GtkWidget *combo;
|
||||||
@ -765,9 +766,7 @@ filter_numeric (const char *val,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
combo_changed_cb (GtkWidget *combo,
|
handle_combo_entry_change (GtkPrinterOptionWidget *widget)
|
||||||
GParamSpec *pspec,
|
|
||||||
GtkPrinterOptionWidget *widget)
|
|
||||||
{
|
{
|
||||||
GtkPrinterOptionWidgetPrivate *priv = widget->priv;
|
GtkPrinterOptionWidgetPrivate *priv = widget->priv;
|
||||||
char *value;
|
char *value;
|
||||||
@ -813,7 +812,21 @@ combo_changed_cb (GtkWidget *combo,
|
|||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
GtkWidget *entry = gtk_widget_get_first_child (priv->combo);
|
GtkWidget *entry = gtk_widget_get_first_child (priv->combo);
|
||||||
|
gssize buffer_length, filtered_buffer_length;
|
||||||
|
gint position;
|
||||||
|
|
||||||
|
position = gtk_editable_get_position (GTK_EDITABLE (entry));
|
||||||
|
buffer_length = gtk_entry_buffer_get_length (gtk_entry_get_buffer (GTK_ENTRY (entry)));
|
||||||
|
|
||||||
|
g_signal_handler_block (entry, priv->comboentry_changed_handler_id);
|
||||||
gtk_editable_set_text (GTK_EDITABLE (entry), filtered_val);
|
gtk_editable_set_text (GTK_EDITABLE (entry), filtered_val);
|
||||||
|
g_signal_handler_unblock (entry, priv->comboentry_changed_handler_id);
|
||||||
|
|
||||||
|
filtered_buffer_length = gtk_entry_buffer_get_length (gtk_entry_get_buffer (GTK_ENTRY (entry)));
|
||||||
|
|
||||||
|
/* Maintain position of the cursor with respect to the end of the buffer. */
|
||||||
|
if (position > 0 && filtered_buffer_length < buffer_length)
|
||||||
|
gtk_editable_set_position (GTK_EDITABLE (entry), position - (buffer_length - filtered_buffer_length));
|
||||||
}
|
}
|
||||||
value = filtered_val;
|
value = filtered_val;
|
||||||
}
|
}
|
||||||
@ -825,6 +838,21 @@ combo_changed_cb (GtkWidget *combo,
|
|||||||
emit_changed (widget);
|
emit_changed (widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
combo_changed_cb (GtkWidget *combo,
|
||||||
|
GParamSpec *pspec,
|
||||||
|
GtkPrinterOptionWidget *widget)
|
||||||
|
{
|
||||||
|
handle_combo_entry_change (widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
comboentry_changed_cb (GtkEditable *editable,
|
||||||
|
GtkPrinterOptionWidget *widget)
|
||||||
|
{
|
||||||
|
handle_combo_entry_change (widget);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
entry_changed_cb (GtkWidget *entry,
|
entry_changed_cb (GtkWidget *entry,
|
||||||
GtkPrinterOptionWidget *widget)
|
GtkPrinterOptionWidget *widget)
|
||||||
@ -958,9 +986,15 @@ construct_widgets (GtkPrinterOptionWidget *widget)
|
|||||||
source->choices[i]);
|
source->choices[i]);
|
||||||
gtk_box_append (GTK_BOX (widget), priv->combo);
|
gtk_box_append (GTK_BOX (widget), priv->combo);
|
||||||
if (GTK_IS_DROP_DOWN (priv->combo))
|
if (GTK_IS_DROP_DOWN (priv->combo))
|
||||||
g_signal_connect (priv->combo, "notify::selected", G_CALLBACK (combo_changed_cb),widget);
|
{
|
||||||
|
g_signal_connect (priv->combo, "notify::selected", G_CALLBACK (combo_changed_cb),widget);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
g_signal_connect (gtk_widget_get_last_child (priv->combo), "notify::selected",G_CALLBACK (combo_changed_cb), widget);
|
{
|
||||||
|
g_signal_connect (gtk_widget_get_last_child (priv->combo), "notify::selected", G_CALLBACK (combo_changed_cb), widget);
|
||||||
|
priv->comboentry_changed_handler_id = g_signal_connect (gtk_widget_get_first_child (priv->combo), "changed", G_CALLBACK (comboentry_changed_cb), widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
text = g_strdup_printf ("%s:", source->display_text);
|
text = g_strdup_printf ("%s:", source->display_text);
|
||||||
priv->label = gtk_label_new_with_mnemonic (text);
|
priv->label = gtk_label_new_with_mnemonic (text);
|
||||||
|
Loading…
Reference in New Issue
Block a user