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

Matthiasc/for master

Closes #3318, #3319, and #3320

See merge request GNOME/gtk!2776
This commit is contained in:
Matthias Clasen 2020-11-03 20:15:08 +00:00
commit fd52220b1b
10 changed files with 65 additions and 24 deletions

16
NEWS
View File

@ -24,6 +24,9 @@ Overview of Changes in master
* GtkTextView: * GtkTextView:
- Fix rendering and positioning of anchored children - Fix rendering and positioning of anchored children
* Constraints:
- Fix loading constraints from ui files
* Media support: * Media support:
- Use cubic instead of linear volume - Use cubic instead of linear volume
@ -42,10 +45,22 @@ Overview of Changes in master
- Deliver events on flush - Deliver events on flush
- Drop the unused GdkPoint struct from the API - Drop the unused GdkPoint struct from the API
* Demos:
- Add another constraints demo
- Tweak various demos to improve consistency
* Tools:
- Improve gtk4-builder-tool handling of various
widgets when converting ui files from GTK 3
* Documentation: * Documentation:
- Use GtkApplication in all examples - Use GtkApplication in all examples
- Improve and expand the widget gallery - Improve and expand the widget gallery
* Testsuite:
- Improve coverage of GDK
- Improve coverage of gtk4-builder-tool
* Build: * Build:
- Fix the build with cups 2.2.12 - Fix the build with cups 2.2.12
- Make cloudprint support build without warnings - Make cloudprint support build without warnings
@ -55,6 +70,7 @@ Overview of Changes in master
- Make GtkGLArea work (with the cairo backend) - Make GtkGLArea work (with the cairo backend)
* Translation updates: * Translation updates:
German
Polish Polish

View File

@ -260,6 +260,8 @@ activate_about (GSimpleAction *action,
gpointer user_data) gpointer user_data)
{ {
GtkApplication *app = user_data; GtkApplication *app = user_data;
GtkWindow *window;
GtkWidget *button;
const char *authors[] = { const char *authors[] = {
"Andrea Cimitan", "Andrea Cimitan",
"Cosimo Cecchi", "Cosimo Cecchi",
@ -277,6 +279,10 @@ activate_about (GSimpleAction *action,
s = g_string_new (""); s = g_string_new ("");
window = gtk_application_get_active_window (app);
button = GTK_WIDGET (g_object_get_data (G_OBJECT (window), "open_menubutton"));
gtk_menu_button_popdown (GTK_MENU_BUTTON (button));
os_name = g_get_os_info (G_OS_INFO_KEY_NAME); os_name = g_get_os_info (G_OS_INFO_KEY_NAME);
os_version = g_get_os_info (G_OS_INFO_KEY_VERSION_ID); os_version = g_get_os_info (G_OS_INFO_KEY_VERSION_ID);
if (os_name && os_version) if (os_name && os_version)
@ -326,6 +332,21 @@ activate_about (GSimpleAction *action,
g_free (os_version); g_free (os_version);
} }
static void
activate_shortcuts_window (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GtkApplication *app = user_data;
GtkWindow *window;
GtkWidget *button;
window = gtk_application_get_active_window (app);
button = GTK_WIDGET (g_object_get_data (G_OBJECT (window), "open_menubutton"));
gtk_menu_button_popdown (GTK_MENU_BUTTON (button));
gtk_widget_activate_action (GTK_WIDGET (window), "win.show-help-overlay", NULL);
}
static void static void
activate_quit (GSimpleAction *action, activate_quit (GSimpleAction *action,
GVariant *parameter, GVariant *parameter,
@ -2371,6 +2392,7 @@ main (int argc, char *argv[])
GAction *action; GAction *action;
static GActionEntry app_entries[] = { static GActionEntry app_entries[] = {
{ "about", activate_about, NULL, NULL, NULL }, { "about", activate_about, NULL, NULL, NULL },
{ "shortcuts", activate_shortcuts_window, NULL, NULL, NULL },
{ "quit", activate_quit, NULL, NULL, NULL }, { "quit", activate_quit, NULL, NULL, NULL },
{ "inspector", activate_inspector, NULL, NULL, NULL }, { "inspector", activate_inspector, NULL, NULL, NULL },
{ "main", NULL, "s", "'steak'", NULL }, { "main", NULL, "s", "'steak'", NULL },

View File

@ -51,7 +51,7 @@
</item> </item>
<item> <item>
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute> <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
<attribute name="action">win.show-help-overlay</attribute> <attribute name="action">app.shortcuts</attribute>
</item> </item>
<item> <item>
<attribute name="label" translatable="yes">_About Widget Factory</attribute> <attribute name="label" translatable="yes">_About Widget Factory</attribute>
@ -3220,7 +3220,7 @@ bad things might happen.</property>
<object class="GtkMenuButton"> <object class="GtkMenuButton">
<property name="halign">end</property> <property name="halign">end</property>
<property name="icon-name">emblem-system-symbolic</property> <property name="icon-name">emblem-system-symbolic</property>
<property name="menu-model">gear_menu</property> <property name="menu-model">gear_menu_model</property>
<property name="tooltip-text">This is a menu button</property> <property name="tooltip-text">This is a menu button</property>
<layout> <layout>
<property name="column">1</property> <property name="column">1</property>

View File

@ -1080,12 +1080,12 @@ gtk_icon_paintable_get_icon_name() and set the icon name on a #GtkImage.
### Update to GtkFileChooser API changes ### Update to GtkFileChooser API changes
GtkFileChooser moved to a GFile-based API. If you need to convert a GtkFileChooser moved to a GFile-based API. If you need to convert a path
path or a URI, use g_file_new_for_path(), g_file_new_for_commandline_arg(), or a URI, use g_file_new_for_path(), g_file_new_for_commandline_arg(),
or g_file_new_for_uri(); similarly, if you need to get a path or a URI or g_file_new_for_uri(); similarly, if you need to get a path, name or URI
from a GFile, use g_file_get_path(), or g_file_get_uri(). With the from a GFile, use g_file_get_path(), g_file_get_basename() or g_file_get_uri().
removal or path and URI-based functions, the "local-only" property has With the removal or path and URI-based functions, the "local-only" property
been removed; GFile can be used to access non-local as well as local has been removed; GFile can be used to access non-local as well as local
resources. resources.
The GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER action has been removed. Use The GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER action has been removed. Use

View File

@ -1408,13 +1408,9 @@ impl_surface_add_update_area (GdkSurface *impl_surface,
void void
gdk_surface_queue_render (GdkSurface *surface) gdk_surface_queue_render (GdkSurface *surface)
{ {
cairo_region_t *region;
g_return_if_fail (GDK_IS_SURFACE (surface)); g_return_if_fail (GDK_IS_SURFACE (surface));
region = cairo_region_create (); gdk_surface_invalidate_rect (surface, NULL);
impl_surface_add_update_area (surface, region);
cairo_region_destroy (region);
} }
/* /*
@ -1495,7 +1491,9 @@ gdk_surface_freeze_updates (GdkSurface *surface)
surface->update_freeze_count++; surface->update_freeze_count++;
if (surface->update_freeze_count == 1) if (surface->update_freeze_count == 1)
{
_gdk_frame_clock_uninhibit_freeze (surface->frame_clock); _gdk_frame_clock_uninhibit_freeze (surface->frame_clock);
}
} }
/* /*

View File

@ -202,6 +202,8 @@ gtk_magnifier_class_init (GtkMagnifierClass *klass)
P_("resize"), P_("resize"),
FALSE, FALSE,
G_PARAM_READWRITE)); G_PARAM_READWRITE));
gtk_widget_class_set_css_name (widget_class, "magnifier");
} }
static void static void

View File

@ -839,7 +839,7 @@ gtk_popover_init (GtkPopover *popover)
priv->final_position = GTK_POS_BOTTOM; priv->final_position = GTK_POS_BOTTOM;
priv->autohide = TRUE; priv->autohide = TRUE;
priv->has_arrow = TRUE; priv->has_arrow = TRUE;
priv->cascade_popdown = TRUE; priv->cascade_popdown = FALSE;
controller = gtk_event_controller_key_new (); controller = gtk_event_controller_key_new ();
g_signal_connect_swapped (controller, "key-pressed", G_CALLBACK (gtk_popover_key_pressed), popover); g_signal_connect_swapped (controller, "key-pressed", G_CALLBACK (gtk_popover_key_pressed), popover);
@ -1674,7 +1674,7 @@ gtk_popover_class_init (GtkPopoverClass *klass)
g_param_spec_boolean ("cascade-popdown", g_param_spec_boolean ("cascade-popdown",
P_("Cascade popdown"), P_("Cascade popdown"),
P_("Wether the popover pops down after a child popover"), P_("Wether the popover pops down after a child popover"),
TRUE, FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties); g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);

View File

@ -309,6 +309,7 @@ gtk_popover_menu_init (GtkPopoverMenu *popover)
g_free (controllers); g_free (controllers);
gtk_popover_disable_auto_mnemonics (GTK_POPOVER (popover)); gtk_popover_disable_auto_mnemonics (GTK_POPOVER (popover));
gtk_popover_set_cascade_popdown (GTK_POPOVER (popover), TRUE);
} }
static void static void

View File

@ -116,22 +116,19 @@ gtk_text_handle_present_surface (GtkTextHandle *handle)
GdkPopupLayout *layout; GdkPopupLayout *layout;
GdkRectangle rect; GdkRectangle rect;
GtkRequisition req; GtkRequisition req;
double x, y; GtkWidget *parent;
gtk_widget_get_preferred_size (widget, NULL, &req); gtk_widget_get_preferred_size (widget, NULL, &req);
gtk_text_handle_get_padding (handle, &handle->border); gtk_text_handle_get_padding (handle, &handle->border);
rect.x = handle->pointing_to.x; parent = gtk_widget_get_parent (widget);
rect.y = handle->pointing_to.y + handle->pointing_to.height - handle->border.top; gtk_widget_get_surface_allocation (parent, &rect);
rect.x += handle->pointing_to.x;
rect.y += handle->pointing_to.y + handle->pointing_to.height - handle->border.top;
rect.width = req.width - handle->border.left - handle->border.right; rect.width = req.width - handle->border.left - handle->border.right;
rect.height = 1; rect.height = 1;
gtk_widget_translate_coordinates (gtk_widget_get_parent (widget),
gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW),
rect.x, rect.y, &x, &y);
rect.x = x;
rect.y = y;
if (handle->role == GTK_TEXT_HANDLE_ROLE_CURSOR) if (handle->role == GTK_TEXT_HANDLE_ROLE_CURSOR)
rect.x -= rect.width / 2; rect.x -= rect.width / 2;
else if ((handle->role == GTK_TEXT_HANDLE_ROLE_SELECTION_END && else if ((handle->role == GTK_TEXT_HANDLE_ROLE_SELECTION_END &&
@ -420,6 +417,8 @@ gtk_text_handle_update_for_role (GtkTextHandle *handle)
gtk_widget_remove_css_class (widget, "bottom"); gtk_widget_remove_css_class (widget, "bottom");
gtk_widget_remove_css_class (widget, "insertion-cursor"); gtk_widget_remove_css_class (widget, "insertion-cursor");
} }
gtk_widget_queue_draw (widget);
} }
static void static void

View File

@ -1845,6 +1845,9 @@ popover.background {
} }
} }
magnifier {
background-color: $base_color;
}
/************* /*************
* Notebooks * * Notebooks *