Commit Graph

10515 Commits

Author SHA1 Message Date
Simon McVittie
0709370184 New upstream version 2.24.33 2020-12-28 12:15:46 +00:00
John Ralls
5f104c9883 Include gdkquartz.h in gtkclipboard-quartz.c
to declare gdk_quartz_pasteboard_type_to_atom_libgtk_only.

Closes https://gitlab.gnome.org/GNOME/gtk/-/issues/3161
2020-09-14 13:19:09 -07:00
Ting-Wei Lan
f203b1a751 build: Move gtk.def to builddir
GTK2 uses different gtk.def files on 32-bit and 64-bit Windows. GTK2
source tarballs ship pre-generated gtk.def for 32-bit Windows. If the
user wants to build for 64-bit Windows, the pre-generated gtk.def must
be deleted before the build to force regeneration, or it will fail to
link with 'symbol not defined' errors because the 32-bit Windows build
includes more legacy functions than the 64-bit Windows build.

While users who want to build for 64-bit Windows can delete gtk.def in
the build script, which is currently what most build scripts do, doing
so breaks out-of-source build. On AUR, MinGW packages are usually built
and packaged in the following order:

1. Run 'configure' and 'make' to build for i686-w64-mingw32.
2. Run 'configure' and 'make' to build for x86_64-w64-mingw32.
3. Run 'make install' for i686-w64-mingw32.
4. Run 'make install' for x86_64-w64-mingw32.

It fails because step 3 sees gtk.def left by step 2, which is generated
for a different build. In step 3, make sees the gtk.def change and runs
libtool to relink libgtk-win32-2.0-0.dll. libtool fails to find a lot of
necessary libraries, decides that it is not possible to build a DLL with
-no-undefined, and produces only the static library. It then tries to
relink executables with the static library, and fails with undefined
reference to 'IID_IUnknown' because -Wl,--start-group isn't used and
the use of -Wl,-luuid prevents libtool from using the correct order.

To resolve the problem, move gtk.def to builddir so different builds can
have different gtk.def files while sharing the same source tree. This
also means that the source tarball will no longer include pre-generated
gtk.def file, which should be acceptable because it is already broken on
64-bit Windows.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3029
2020-08-26 23:02:51 +08:00
Philip Zander
aae860fe3e Change __declspec(dllexport) to extern __declspec(dllexport)
As of 28 July 2020, building on MSYS2 fails with "multiple definition"
errors unless exported variables are explicitly marked as "extern".

Closes #2958
2020-07-28 13:22:15 +02:00
Alex Samorukov
29103cdc3c Use bundle id instead of package name for the macOS preview as filename is now changed 2020-01-14 22:17:09 +00:00
Petr Viktorin
b5ea5a0cf1 gtk-builder-convert: Update bug report URL
Also, use a newline instead of period at the end to make the
URL easy to copy
2019-09-03 14:57:40 +02:00
Petr Viktorin
4f8efe3ae0 gtk-builder-convert: Remove compat code for Python 2.3 and below 2019-09-03 14:57:36 +02:00
Petr Viktorin
3ff8f70b96 Make gtk-builder-convert compatible with Python 3
- Convert tabs to spaces
- Use print as a function, even on Python 2
- Output a binary file, or decode for stdout
2019-09-03 13:54:49 +02:00
John Lindgren
539a596e49 Fix use-after-free due to unexpected unref of context->default_style.
Segfault occurred when displaying two windows on different X11 displays.

valgrind said:

Invalid read of size 8
  at 0x4A20962: _gtk_style_init_for_settings (gtkstyle.c:398)
  by 0x49ED785: gtk_rc_get_style (gtkrc.c:2036)
  by 0x4AC39C2: gtk_widget_reset_rc_style (gtkwidget.c:6601)
Address 0x70b8e80 is 560 bytes inside a block of size 1,024 free'd
  at 0x48399AB: free (vg_replace_malloc.c:530)
  by 0x51180D6: g_type_free_instance (in /usr/lib/libgobject-2.0.so.0.6000.6)
  by 0x49E98CE: gtk_rc_reset_styles (gtkrc.c:1702)
  by 0x49E9A0C: _gtk_rc_context_get_default_font_name (gtkrc.c:1740)
  by 0x4A20961: _gtk_style_init_for_settings (gtkstyle.c:396)
  by 0x49ED785: gtk_rc_get_style (gtkrc.c:2036)
  by 0x4AC39C2: gtk_widget_reset_rc_style (gtkwidget.c:6601)
Block was alloc'd at
  at 0x483877F: malloc (vg_replace_malloc.c:299)
  by 0x51BD289: g_malloc (in /usr/lib/libglib-2.0.so.0.6000.6)
  by 0x519F673: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.6000.6)
  by 0x51A62BA: g_slice_alloc0 (in /usr/lib/libglib-2.0.so.0.6000.6)
  by 0x5119141: g_type_create_instance (in /usr/lib/libgobject-2.0.so.0.6000.6)
  by 0x513563D: ??? (in /usr/lib/libgobject-2.0.so.0.6000.6)
  by 0x5136A54: g_object_new_with_properties (in /usr/lib/libgobject-2.0.so.0.6000.6)
  by 0x5136B51: g_object_new (in /usr/lib/libgobject-2.0.so.0.6000.6)
  by 0x49ED774: gtk_rc_get_style (gtkrc.c:2035)
  by 0x4AC39C2: gtk_widget_reset_rc_style (gtkwidget.c:6601)
2019-08-06 02:12:43 -04:00
Руслан Ижбулатов
6ae3082603 Fix UAC manifest RC file
CREATEPROCESS_MANIFEST_RESOURCE_ID is a macro defined in winbase.h,
so we need an include to resolve that macro to its value, 1.

Without that it stays as a literal CREATEPROCESS_MANIFEST_RESOURCE_ID,
and ends up in the .exe file as-is, and Windows can't find it by that name,
resulting in UAC manifest not working and gtk-update-icon-cache bringing
up UAC prompt.
2019-03-14 09:18:09 +00:00
Marco Trevisan (Treviño)
072d8546b0 icontheme: Fix annotations on array arguments
The extra ':' makes gir not to handle properly all the rest.
2019-03-06 19:54:49 +01:00
Chun-wei Fan
6b55898162 MSVC introspection: Make more robust and avoid confusion
This updates the introspection build process that we also check on
changes in the Makefiles when we generate the NMake Makefile snippets
and file lists, so that any changes to the source file list can be
reflected.  Also ensure that we build against the freshly-built
libraries.

Make the NMake Makefiles also output the built introspection items to
the output directories of the various Visual Studio versions, according
to the build configuration and architecture, so that we avoid confusion
for different Visual Studio build configs.
2019-01-21 12:53:37 +08:00
Chun-wei Fan
4612f0b3fe gtk/gtkiconcache.c: Fix running on GLib-2.57.3 or later on Windows
In GLib-2.57.3 and later, GStatBuf may not be a struct stat on Windows,
depending on the architecture and the compiler used, so we can't just
call fstat() on the GStatBuf.

Instead, we need to use the correct CRT function to call on the
GStatBuf, which is as follows:

-_fstat32() for Windows 32-bit builds on mingw-w64 and MSVC
-_fstat64() for Windows 64-bit builds on mingw-w64
-stat() for Windows 64-bit builds on MSVC, and on all other platforms.
2018-12-21 13:40:05 +08:00
Chun-wei Fan
639688d37e [gdk|gtk]/Makefile.am: Fix CFlags passed to introspecion on MSVC
Don't pass in G_LOG_DOMAIN=\"...\" to the CFlags that is passed into the
generation the NMake Makefiles.  This will avoid the introspection scanner
from choking because the resulting NMake Makefiles may not have that
CFlag escaped properly, and it is not really needed for building the
introspection binary.
2018-12-21 13:02:05 +08:00
Eduard Braun
303858fa76 Consistently use g_stat and GStatBuf
Replace "stat struct" with "GStatBuf" and "stat" with "g_stat" where
appropriate to fix cross-platform issues, specifically on Windows.

Code should be identical on *nix but fixes some serious issues
on Windows:
- Field widths of "struct stat" are not constant on Windows.
  If the stat function does not match the stat struct used
  it will cause overwrites and undefined behavior
- The Windows stat function needs a properly encoded filename.
  In many places we pass an UTF-8 encoded value which breaks as soon
  as non-ASCII characters are involved.

https://bugzilla.gnome.org/show_bug.cgi?id=787772
2018-08-19 14:53:15 +02:00
Daniel Boles
168434c4a1 FileChooserDefault: Avoid printf()ing a NULL char*
If the name of the bookmark is NULL, using it with the printf %s format
specifier is undefined behaviour per the C Standard. Besides, it would
result in a completely unhelpful tooltip even if it were well-defined.

We already have an else case for when nothing is selected, which avoids
trying to use the name, so ensure we go there if it's NULL or empty too.

https://gitlab.gnome.org/GNOME/gtk/issues/1169
2018-06-22 15:10:56 +01:00
Benjamin Otte
48821a76c6 Merge branch 'gtk2-icon-fix' into 'gtk-2-24'
Fix incorrect optimization in find_builtin_icon().

See merge request GNOME/gtk!154
2018-05-16 12:54:32 +00:00
John Lindgren
889a63dffc Fix compiler warnings with GCC 8.1.
GCC 8.1 added some new warnings, including warning about parentheses
with no effect in variable declarations.  GTK2 headers have a few of
these, which produce a lot of warnings in projects using GTK2.

The warnings look like:
/usr/include/gtk-2.0/gtk/gtkfilechooserbutton.h:59:8: warning:
unnecessary parentheses in declaration of ‘__gtk_reserved1’ [-Wparentheses]
   void (*__gtk_reserved1);
        ^

Removing the parentheses is harmless and fixes the warnings.
2018-05-15 21:52:15 -04:00
John Lindgren
9ce6f8086e Fix incorrect optimization in find_builtin_icon().
When we found an icon with exactly the requested size, we'd stop
searching immediately (good), but we'd neglect to set the returned
min_difference to 0 (bad).  This caused theme_lookup_icon() to
prefer other, potentially much worse, matches over the exact one.

Cherry-picked from 5aa939dc (gtk-3-22)

https://bugzilla.gnome.org/show_bug.cgi?id=792738
2018-05-15 21:35:21 -04:00
Dennis Schridde
88bb7ecc47 Make gtk+-2.24.31 compatible with the changed API of glib-2.54.3
glib-2.54.3 changed API, compared to glib-2.52.3 and gtk+-2.24.31's
 expectations.  This commit fixes the resulting issue in a backwards
 compatible way.

See-Also: https://bugs.gentoo.org/650536
2018-03-18 19:55:37 +01:00
Rafal Luzynski
2ea743ab46 calendar: Use the new "%OB" format if supported
Due to the recent changes introduced in glibc 2.27 "%OB" is the
correct format to obtain a month name as used in the calendar
header.  The same rule has been working in BSD family (including
OS X) since 1990s.  This simple hack checks whether "%OB" is supported
at runtime and uses it if it is, falls back to the old "%B" otherwise.

Closes: #9
2018-02-13 23:02:28 +01:00
Emmanuele Bassi
f14fbca645 Revert "Fix abicheck"
This reverts commit 331877fe36.

The newly visible symbols were the result of a bug in the Python port of
glib-genmarshal, which was fixed in GLib 2.54.

https://bugzilla.gnome.org/show_bug.cgi?id=793057
2018-02-10 18:55:59 +00:00
Chris Lamb
78c34e11c3 gtk/queryimmodules.c: Make the output deterministic.
Whilst working on the Reproducible Builds effort [0], we noticed that
queryimmodules generates non-reproducible output as it iterates over the
filesystem without sorting.

Patch attached.

 [0] https://reproducible-builds.org/

Signed-off-by: Chris Lamb <lamby@debian.org>

https://bugzilla.gnome.org/show_bug.cgi?id=786528
2018-01-22 19:59:59 +00:00
Jeremy Bicha
3f67785787 New upstream version 2.24.32 2018-01-20 07:01:47 -05:00
Matthias Clasen
331877fe36 Fix abicheck
Update symbols files, and ignore marshallers that appear.
2018-01-08 16:35:39 -05:00
Jeremy Bicha
a5bbaa1975 New upstream version 2.24.31 2017-12-20 08:11:13 -05:00
Daniel Boles
292e023c83 Fixed: If can’t add child, don’t add to child info
If the call to set_parent() failed, we were still adding the child to
the internal list of children, despite that it was not really added.
That meant we could later try to do invalid stuff with that non-child.

Fix that by asserting and giving up if the child that the user is
attempting to add is already parented.

https://bugzilla.gnome.org/show_bug.cgi?id=701296
2017-10-13 09:56:17 +01:00
Daniel Boles
6b4e050e15 ComboBox: Don’t let modes disconnect each other
…from priv->button. My refactor to g_signal_disconnect_by_data()
included this widget, when I shouldn’t have as both modes use it.
In GTK+ 3, this broke opening a CB by keyboard that was in menu mode,
if it had been in list mode initially (e.g. due to the theme).

Fix by moving to disconnect_by_func() and only removing in each mode’s
destroy() method the signals that it set on the button in its setup().

https://bugzilla.gnome.org/show_bug.cgi?id=788577
2017-10-06 01:43:06 +01:00
Colomban Wendling
687e4576eb Enter submenus when activating their parent item
This gives consistent behavior with e.g. Qt, Mozilla's suites and
LibreOffice (with non-truly native backends like "gen" and "gtk",
but unlike "gtk2" and "gtk3" ones that probably use true GTK menus).

This behavior is expected by at least some accessibility users, and
it seems good to behave like other common applications and toolkits
in this area.  There should be no issue in doing so either for current
users, as it only enters the submenu instead of not doing anything.

https://bugzilla.gnome.org/show_bug.cgi?id=778811
2017-10-05 19:47:14 +01:00
Daniel Boles
c75c8d0bda ComboBox: Don’t pile up ::grab-broken handlers
It was connecting a new handler to do the same thing every time it
popped up, never disconnecting between. Just connect once in init().
2017-10-05 19:47:13 +01:00
Daniel Boles
e46ac4dcba ComboBox: Clarify :row|column-span/wrap-width docs
ComboBox warned in the doc for :row-span-column that the value must not
exceed :wrap-width, but :wrap-width does not interact with the number of
rows; it’s the :column-span-column that’s relevant.

Also: Warn that spans must be > 0 for rows too, & that column spans <=
:wrap-width are also not useful for items at menu column positions > 0.
Rrefer to items having spans, not values, as we’re already talking about
values in the model (& rows in the menu). And clarify :wrap-width a bit.
2017-10-05 19:47:13 +01:00
Daniel Boles
111853d7da Entry: Fix leak of text in ensure_has_tooltip()
Thanks to Mohammed Sadiq for noticing this. I guess I got
Widget.get_tooltip_text() confused with Label.get_label().

https://bugzilla.gnome.org/show_bug.cgi?id=787410
2017-09-07 14:59:15 +01:00
Daniel Boles
b51eea1881 Revert "ComboBox: Don’t redundantly show() scrolled_window"
This reverts commit 03ead0c824.

That was a real brainfart, which broke showing list-mode CBs on the 2nd
and subsequent popups.
2017-09-05 00:14:00 +01:00
Ingo Brückl
c12dd8f0b9 Set translation domain for parameter_string in gtk_init_with_args
This was requested in bug 554926.

Backport of original commit e3bd926c1ef83027c756488ba19f4353930fc6db by
Gabor Kelemen, kelemeng at gnome dot hu, applied to GTK+ 2.90.5 on Tue,
10 Aug 2010 04:13:22 +0000 (UTC).

https://bugzilla.gnome.org/show_bug.cgi?id=785165
2017-09-03 14:44:45 +01:00
Daniel Boles
d57d105e11 Toolbar: Clarify how the arrow overflow menu works
The fact it affects the preferred size, and only works with ToolItems
that return a menu proxy item, was unclear unless deduced from other
sources, and this led to users thinking it was broken, for example:

https://stackoverflow.com/q/44644642/2757035

https://bugzilla.gnome.org/show_bug.cgi?id=787158
https://bugzilla.gnome.org/show_bug.cgi?id=787195
2017-09-03 11:22:58 +01:00
Daniel Boles
86d80b9d76 ToolItem: Add see-also from proxy setter to signal 2017-09-03 11:21:40 +01:00
Daniel Boles
e0e2107f35 ComboBox: Add missing disconnect in menu_destroy()
We were not disconnecting the signals from the menu (popup_widget), so
they were leaked when e.g. the mode was changed or the CB was destroyed.
2017-09-01 16:34:14 +01:00
Daniel Boles
68e2f276f2 FileChooserDefault: Fix misleading indentation
which caused a compiler warning. Update to match 3.22’s indentation.
2017-09-01 15:12:15 +01:00
Daniel Boles
e8f15a8d23 FileChooserDefault: Remove an unused #include 2017-09-01 14:23:22 +01:00
Daniel Boles
03ead0c824 ComboBox: Don’t redundantly show() scrolled_window
It and its child were already show()n in list_setup().
2017-08-28 19:59:39 +01:00
Daniel Boles
fac72327f9 ComboBox: Fix wrongly matched signal disconnect()s
Various disconnections had the wrong flags and/or data, so we failed to
disconnect a pile of signals, shown by 0 returned by the disconnect_*()
functions. Fix this, and use the nicer disconnect_by_*() while here.
2017-08-28 19:59:39 +01:00
Daniel Boles
2759e89611 ComboBox: Really set list-mode popup transient-for
set_transient_for(toplevel) was only called in list_setup(). It was easy
to make a test showing a NULL :transient-for instead of the correct one.

So, move the call from list_setup() to real_popup(). Also do the same
for window_group_add_window(), which means not calling it redundantly.

(I tried using a ComboBox:parent-set handler, but the Inspector’s CB
didn’t like that: it calls popup_for_device() twice and closes on button
release. Anyway, using popup() is much more concise than a new handler.)
2017-08-28 19:59:27 +01:00
Daniel Boles
faa69b3547 ComboBox: List-mode popup must open on CB’s screen
The screen for the list-mode popup_window was only being set in
set_popup_widget(), i.e. when changing modes, so if the ComboBox was
moved to a different screen later, the popup would appear on the
original one, which is wrong.

Worse, this broke opening some combos in the Inspector in GTK+ 3.

Fix this by moving the call to set_screen() to real_popup(), so
the popup_window is put on the correct screen each time around.

https://bugzilla.gnome.org/show_bug.cgi?id=468868
https://bugzilla.gnome.org/show_bug.cgi?id=786771
2017-08-28 19:02:59 +01:00
Daniel Boles
47bea2deaa ComboBox: Use iter before popdown() may invalidate
Bad actors, such as our very own FileChooserButton, may connect to the
:popped-up property and alter the model as the menu becomes in/visible.

We were getting an iter to the model while popped-up, then doing
popdown(), then using the iter, which may have just been invalidated by
the errant notify::popped-up handler. If so, we quickly crash fatally.

This is clearly bonkers, but until such patterns are removed, we have to
work around them. So, set_active() from the clicked item while it is
known to be valid, by moving the call to set_active() before popdown().

While here, change set_active_iter(iter) to set_active_internal(path) to
avoid pointlessly going through the iter to get the path we already have

https://bugzilla.gnome.org/show_bug.cgi?id=729651
2017-08-25 21:03:33 +01:00
Daniel Boles
2166e25f2e ComboBox: Clarify documentation of get_active_iter
https://bugzilla.gnome.org/show_bug.cgi?id=618160
2017-08-25 20:59:50 +01:00
Daniel Boles
bf8c1c212e Container: Don’t scroll to unset focus child coord
In gtk_container_real_set_focus_child(), we try to scroll to the
position of the new :focus-child if we have h or v adjustments.

gtk_widget_translate_coordinates() returns FALSE if neither widget is
realized or in other situations that cause output parameters x and y not
to be set. Thus, if the caller did not initialise x/y and uses them even
if the function returns FALSE, they are using uninitialised variables.

In gtk_container_real_set_focus_child(), we did not check the return
value but merrily went ahead and used x and y regardless. This is UB, as
caught by Valgrind, as well as being pointless.

The trivial fix is to exit early if (!gtk_widget_translate_coordinates).

https://bugzilla.gnome.org/show_bug.cgi?id=776909
2017-08-07 19:20:51 +01:00
Matthias Clasen
e6d2655e1e GtkLabel: make patterns work a little better
When a pattern has been set, we must not throw away
the attributes that contain it.

https://bugzilla.gnome.org/show_bug.cgi?id=658111
https://bugzilla.gnome.org/show_bug.cgi?id=676550
2017-08-06 19:07:24 +01:00
Jasper St. Pierre
491d79d540 recentchooserdefault: Clean up load_id when we have nothing left to do
Returning FALSE from a GSourceFunc will implicitly remove it, so we need
to do this in order to make the new g_source_remove happy.

https://bugzilla.gnome.org/show_bug.cgi?id=779605
2017-08-05 19:23:06 +01:00
Daniel Boles
fdb701837f Entry: Fix unset icon tooltip hiding Entry tooltip
Our ::query-tooltip handler first checks whether the pointer is over any
of the icons, returning their tooltip if so, and if not chains up to
Widget::query-tooltip in order to show the text for the widget overall.

But ensure_has_tooltip(), which exists to update :has-tooltip based on
whether ::query-tooltip is needed, only set :has-tooltip to TRUE if any
icon had a tooltip, without caring whether the widget as a whole does.

That is asymmetrical and meant that if the Entry had a tooltip, but
subsequently all icons had their tooltips unset, :has-tooltip would be
set to FALSE, and hence the tooltip for the widget would become lost.

The fix is to set :has-tooltip to TRUE if the widget has a tooltip of
its own, and we only need to check the icons if that is not the case.

https://bugzilla.gnome.org/show_bug.cgi?id=785672
2017-08-01 18:13:00 +01:00
Daniel Boles
8302b71381 Entry: Warn about corner case hiding icon tooltips
https://bugzilla.gnome.org/show_bug.cgi?id=785672#c4
2017-08-01 18:12:59 +01:00