Commit Graph

51615 Commits

Author SHA1 Message Date
Olivier Fourdan
b1d55f2c85 gtksettings: Remove display from cache on closing
GTK caches the settings per display in a static `GArray`, keeping a
reference to the `GdkDisplay` as the key.

However, when closing the display, the corresponding entry is not
removed from the cache in `GtkSettings`.

So when reopening again a `GdkDisplay`, if the new address matches one
of the previously closed display, the cache will return the existing
`GtkSettings` from the cache, which still holds a reference to the old
`GdkScreen` which was freed along the `GdkDisplay`.

To avoid the issue, make sure to remove the `GdkDisplay` and
corresponding `GdkSettings` when closing the `GdkDisplay`.

Also, care must be taken not to recreate the `GdkSettings` and re-add
the `GdkDisplay` to the cache once the display is closed, and make sure
callers of `gtk_settings_get_for_display()` can deal with a returned
value being `NULL` if the display is closed.

Fixes: commit 360a3c1690 - "Use a cheaper way to store settings per
display"
2020-01-23 17:34:47 +01:00
Olivier Fourdan
c9601f1567 gdk/wayland: Fix gdk_window_impl_wayland_finalize() warnings
On Wayland, opening and closing a `GdkDisplay` generates a coupe of
warnings at runtime:

```
  GLib-GObject-WARNING **:
    invalid cast from 'GdkWindowImplWayland' to 'GdkWindow'
  GLib-GObject-WARNING **:
    invalid cast from 'GdkWaylandWindow' to 'GdkWindowImplWayland'
```

This is from `gdk_window_impl_wayland_finalize()` which tries to cast
the given GObject to a `GdkWindow` while it's a `GdkWindowImplWayland`.

Use the correct type casting of objects to avoid the warnings.
2020-01-23 17:34:47 +01:00
WGH
3d5f083b75 printing: Fix crash in avahi_service_resolver_cb
printer_name_compressed_strv is NULL-terminated array
of gchar*, which means N+1 memory should be allocated.

Otherwise, if the printer name has no empty components
(which is usually the case), printer_name_compressed_strv[N],
which should contain the NULL sentinel, will actually lie
just outside of allocated memory, which is UB.

In my case, it led to crashes inside g_strjoinv
when Print... dialog is opened in evince.

    #0  0x00007fad2ce1bad7 in __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:96
    #1  0x00007fad2d04d88d in g_strjoinv (separator=separator@entry=0x7fad0c9bc508 "-", str_array=str_array@entry=0x556b017f0200) at ../glib-2.60.7/glib/gstrfuncs.c:2585
    #2  0x00007fad0c9b8a89 in avahi_service_resolver_cb (source_object=<optimized out>, res=<optimized out>, user_data=0x7fad08020ee0) at /var/tmp/portage/x11-libs/gtk+-3.24.13/work/gtk+-3.24.13/modules/printbackends/cups/gtkprintbackendcups.c:3223
    #3  0x00007fad2d1f8ed3 in g_task_return_now (task=0x556b017a8b00 [GTask]) at ../glib-2.60.7/gio/gtask.c:1209
    #4  0x00007fad2d1f987d in g_task_return (task=0x556b017a8b00 [GTask], type=<optimized out>) at ../glib-2.60.7/gio/gtask.c:1278
    #5  0x00007fad2d1f9dec in g_task_return (type=G_TASK_RETURN_SUCCESS, task=<optimized out>) at ../glib-2.60.7/gio/gtask.c:1678
    #6  0x00007fad2d1f9dec in g_task_return_pointer (task=<optimized out>, result=<optimized out>, result_destroy=<optimized out>) at ../glib-2.60.7/gio/gtask.c:1683
    #7  0x00007fad2d24b6af in g_dbus_connection_call_done (source=<optimized out>, result=0x556b017a8bc0, user_data=0x556b017a8b00) at ../glib-2.60.7/gio/gdbusconnection.c:5747
    #8  0x00007fad2d1f8ed3 in g_task_return_now (task=0x556b017a8bc0 [GTask]) at ../glib-2.60.7/gio/gtask.c:1209
    #9  0x00007fad2d1f8f09 in complete_in_idle_cb (task=0x556b017a8bc0) at ../glib-2.60.7/gio/gtask.c:1223
    #10 0x00007fad2d02d2c0 in g_main_dispatch (context=0x556b00eee090) at ../glib-2.60.7/glib/gmain.c:3189
    #11 0x00007fad2d02d2c0 in g_main_context_dispatch (context=context@entry=0x556b00eee090) at ../glib-2.60.7/glib/gmain.c:3854
    #12 0x00007fad2d02d658 in g_main_context_iterate (context=context@entry=0x556b00eee090, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib-2.60.7/glib/gmain.c:3927
    #13 0x00007fad2d02d6df in g_main_context_iteration (context=context@entry=0x556b00eee090, may_block=may_block@entry=1) at ../glib-2.60.7/glib/gmain.c:3988
    #14 0x00007fad2d22248d in g_application_run (application=0x556b0116f130 [EvApplication], argc=<optimized out>, argv=<optimized out>) at ../glib-2.60.7/gio/gapplication.c:2519
    #15 0x0000556b002e55a1 in  ()
    #16 0x00007fad2ccd6f1b in __libc_start_main (main=0x556b002e50d0, argc=2, argv=0x7ffe1057fa88, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffe1057fa78) at ../csu/libc-start.c:308
    #17 0x0000556b002e567a in  ()

    (gdb) p printer_name_compressed_strv[0]
    $4 = (gchar *) 0x556d4a4be430 "Brother"
    (gdb) p printer_name_compressed_strv[1]
    $5 = (gchar *) 0x7f9dbc011090 "MFC"
    (gdb) p printer_name_compressed_strv[2]
    $6 = (gchar *) 0x556d4a51ba50 "7860DW"
    (gdb) p printer_name_compressed_strv[3]
    $7 = (gchar *) 0x401 <error: Cannot access memory at address 0x401>
2020-01-23 18:27:41 +03:00
John Ralls
eabaf90076 Match returns annotation on quartz version of gtk_drag_dest_get_target_List. 2020-01-22 20:53:38 -08:00
John Ralls
c3deff17a6 Check target list not null to prevent segfault. 2020-01-22 20:53:38 -08:00
John Ralls
44c033ccb8 Ensure that GtkDragDestSite is inited to 0. 2020-01-22 20:53:38 -08:00
John Ralls
81c42faa5a Handle NSException from removeItemAtIndex. 2020-01-22 20:53:38 -08:00
sicklylife
43d7747df6 Update Japanese translation 2020-01-22 17:36:38 +00:00
sicklylife
650a3996ba Update Japanese translation 2020-01-22 17:27:16 +00:00
Emmanuele Bassi
e8cd4d4d33 Merge branch 'wip/muktupavels/issue-1084' into 'gtk-3-24'
Complete startup notification sequence for remote invocations

See merge request GNOME/gtk!1296
2020-01-22 15:07:27 +00:00
Matthias Clasen
159ad1161f Merge branch 'wip/jimmac/typography-classes-gtk3' into 'gtk-3-24'
Adwaita: general typography classes

See merge request GNOME/gtk!1341
2020-01-22 13:51:02 +00:00
Jakub Steiner
9b11707a52 Adwaita: general typography classes
- many moons and some iterations later, these are the suggested
      general typographic styles. Already being referenced in apps like
      Banner Viewer (for now shipping custom definitions)

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1808
2020-01-22 12:06:31 +01:00
Jwtiyar Nariman
3822ac74fc Add Kurdish Sorani translation 2020-01-19 07:52:05 +00:00
Matthias Clasen
11568b158f inspector: Avoid an array overrun
Commit 3f56af3738 added a new value to the
GdkInputSource enum, forgetting that the inspector
has an array of names to match this enum.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2385
2020-01-18 10:53:30 -05:00
Matthias Clasen
cbf5768e91 Merge branch 'gtk3-fix-gesture-get-center' into 'gtk-3-24'
[GTK3] gtkgesture: Fix gtk_gesture_get_bounding_box_center() for touchpads

See merge request GNOME/gtk!1269
2020-01-17 22:24:32 +00:00
Yariv Barkan
1c050bdcf4 demo: Use pinch translation in the gestures demo
Add the pinch translation offset to the pinch gesture demo. That allows
moving the square around in addition to the already-supported rotate and
zoom.
2020-01-17 22:37:55 +02:00
Yariv Barkan
e229c6fe81 gtkgesture: Fix get-center for touchpad gestures
Touchpad gestures have only a single event sequence. The current
'center' of the gesture is the starting point + accumulated deltas.
Update gtk_gesture_get_bounding_box_center() accordingly.
2020-01-17 22:37:55 +02:00
Matthias Clasen
c6ce7fedd5 Merge branch 'wip/muktupavels/fix-critical-warning' into 'gtk-3-24'
menu: fix critical warning

See merge request GNOME/gtk!1182
2020-01-17 18:16:42 +00:00
Matthias Clasen
9f9fdd6caa Merge branch 'wip/muktupavels/root-surface-scale' into 'gtk-3-24'
gdkscreen-x11: update device scale also for root window

See merge request GNOME/gtk!1208
2020-01-17 18:13:50 +00:00
Timm Bäder
5986e100eb Merge branch '3-24-fix-imwayland-cursor' into 'gtk-3-24'
imwayland: Fix get_preedit_string cursor position

See merge request GNOME/gtk!1251
2020-01-17 06:46:56 +00:00
Jakub Steiner
5d38dd5618 Adwaita: update checkbox & radio
- minor update to checkboxes and radios,
  approved for gtk3 as well.

See https://gitlab.gnome.org/GNOME/gtk/issues/2291
2020-01-15 22:18:38 +01:00
Matthias Clasen
6d3138fe6b Merge branch 'fix-2378' into 'gtk-3-24'
fontchooser: Fix size label not being hidden

See merge request GNOME/gtk!1317
2020-01-14 22:42:33 +00:00
Alex Samorukov
e02148491f Use bundle id instead of package name for the macOS preview as filename is now changed 2020-01-14 22:12:53 +00:00
James Westman
b5ea2c78d6 fontchooser: Fix size label not being hidden
Even when the level property of a font chooser did not include
GTK_FONT_CHOOSER_LEVEL_SIZE, the "Size" label was still displayed.

Fixes #2378.
2020-01-14 16:01:16 -06:00
Ricardo Silva Veloso
db7c2afe6b Update Brazilian Portuguese translation 2020-01-14 20:31:35 +00:00
Matthias Clasen
0bffcd8882 Merge branch 'adwaita-cross-fade-fix-gtk3' into 'gtk-3-24'
Adwaita: Fix syntax error in cross-fade() (GTK3)

See merge request GNOME/gtk!1307
2020-01-14 05:32:45 +00:00
Matthias Clasen
8ed65a96b9 Merge branch 'image-surfce-cache-leak' into 'gtk-3-24'
GtkCssImageSurface: Plug cache surface leak

See merge request GNOME/gtk!1309
2020-01-14 05:32:08 +00:00
Matthias Clasen
cf31119bf4 gtk-demo: Use a default action in the infobars demo
This makes the question infobar activatable by clicking
anywhere in it.
2020-01-14 00:29:53 -05:00
Matthias Clasen
0c6ea4c7b2 Adwaita: Add hover for clickable infobars 2020-01-14 00:29:53 -05:00
Matthias Clasen
b55ef8d89a infobar: Activate default action on clicks
When we have a default action set on the infobar, activate it
for clicks anywhere in the infobar.  Also add an .action style
class in this case, so we can add a hover highlight to the infobar
just for this case.
2020-01-14 00:29:53 -05:00
Sebastian Keller
7e2bebb4d5 GtkCssImageSurface: Plug cache surface leak
Fixes https://gitlab.gnome.org/GNOME/gtk/issues/2373
2020-01-13 23:24:47 +01:00
nana-4
404f4c6627 Adwaita: Fix syntax error in cross-fade()
cross-fade() requires two images.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/2371
2020-01-14 06:21:17 +09:00
Alex Samorukov
4a1dc1abfa Merge branch 'gtk-3-24-issue-2102' into 'gtk-3-24'
gdk_quartz_keymap_translate_keyboard_state fills consumed_modifiers incorrectly (closes #2102)

See merge request GNOME/gtk!1225
2020-01-10 21:07:46 +00:00
Mario Sanchez Prada
c17c18e440 application: Complete startup notification sequence for remote invocations
When a remote instance of a GTK application implementing the Startup
Notification protocol gets spawned it will pass the startup sequence
ID as "platform data" to the main instance. Thus, we need to make sure
that the startup sequence gets completed in that case, since the remote
instance won't do it by itself, since it won't map any top level window.

Checking for this "platform data" in the implementation of the after_emit()
virtual method in the primary instance should be a good place to do so, since
the existence of such data proves that a remote instance has been spawned.

https://gitlab.gnome.org/GNOME/gtk/issues/1084
2020-01-10 13:32:37 +02:00
Michael Forney
fb98242e18 Use wayland-scanner private-code in autotools build
The sed -i flag is non-standard, and may not be available in all
implementations.

The meson build already requires wayland >= 1.14.91 and uses
private-code, so just do that in the autotools build as well.
2020-01-09 19:15:46 -08:00
Michael Forney
156d6fffbe Update wayland requirement to 1.14.91 for use of private-code
In a4fe15d9f0, the wayland-scanner command was changed to use
`private-code`, which was first introduced in wayland-1.14.91. This
was synced from master commit a2a99d27c9, which *did* include a
corresponding wayland version requirement bump, but it appears that
this was lost in the sync.
2020-01-09 19:04:44 -08:00
Umarzuki Bin Mochlis Moktar
d0c351468b Update Malay translation 2020-01-08 14:53:41 +00:00
Alex Samorukov
55346fbeb9 Merge branch 'gtk-3-24-fix-set_functions' into 'gtk-3-24'
quartz: impl_class->set_functions listed twice in the object

See merge request GNOME/gtk!1282
2020-01-08 14:17:36 +00:00
Alex Samorukov
76e95a702f impl_class->set_functions listed twice in the object 2020-01-08 14:17:36 +00:00
Alex Samorukov
a4bb6cea63 Merge branch 'gtk-3-24-fixeventloop' into 'gtk-3-24'
Move `[NSApplication sharedApplication]` after event loop init to avoid window focus issues (closes #2342).

See merge request GNOME/gtk!1285
2020-01-08 14:13:36 +00:00
Alex Samorukov
6fdef1055b move [NSApplication sharedApplication] after _gdk_quartz_events_init() to avoid initialization issues 2020-01-08 14:13:36 +00:00
Alex Samorukov
a83066bdc5 Merge branch 'samm/fix-fs/gtk-3-24' into 'gtk-3-24'
Fix was_fullscreen flag (again!)

See merge request GNOME/gtk!1287
2020-01-08 13:56:10 +00:00
Alex Samorukov
2406badb92 Fix was_fullscreen flag (again!) 2020-01-08 13:56:10 +00:00
Alexandr Miloslavskiy
822705fe3e gkimmulticontext: Fix crash due to leaked signal handler
The problem is caused by gtk_im_multicontext_set_slave(), which forgets
to disconnect these signal handlers:
* gtk_im_multicontext_retrieve_surrounding_cb
* gtk_im_multicontext_delete_surrounding_cb

If slave GtkImContext emits signal after GtkIMMulticontext context is
destroyed, this leads to reading freed memory, sometimes causing a crash.

Fixes: #2365
2020-01-06 20:39:34 +01:00
Jordi Mas
fcc72575a2 Update Catalan translation 2020-01-04 07:23:34 +01:00
Matthias Clasen
6f374e787b Merge branch 'gtk-3-24-fix-fullscreen-state' into 'gtk-3-24'
Fix typo which preventing fullscreen state from being updated correctly

See merge request GNOME/gtk!1277
2020-01-03 17:54:12 +00:00
Alex Samorukov
5cdca80c0c Fix typo which preventing fullscreen state from being updated correctly 2020-01-03 17:54:12 +00:00
Alberts Muktupāvels
489fb1783b gdkscreen-x11: update device scale also for root window
Window scale can change at runtime. If cairo_surface is already
created for root window gdk_pixbuf_get_from_window will return
wrong image.

_gdk_x11_screen_set_window_scale already updates window_scale for
root window, update also cairo_surface device scale.

https://gitlab.gnome.org/GNOME/gtk/merge_requests/1208
2020-01-03 18:50:14 +02:00
Umarzuki Bin Mochlis Moktar
a1a99bef83 Update Malay translation 2020-01-03 13:41:04 +00:00
Matthias Clasen
6116c0a0b4 Merge branch 'cherry-pick-6769db16' into 'gtk-3-24'
icontheme: Don't try to scale pixbufs to 0px

See merge request GNOME/gtk!1275
2020-01-01 19:24:21 +00:00