Commit Graph

171 Commits

Author SHA1 Message Date
Benjamin Otte
e356d59a92 build: Add -Wnull-dereference
Sprinkle various g_assert() around the code where gcc cannot figure out
on its own that a variable is not NULL and too much refactoring would be
needed to make it do that.

Also fix usage of g_assert_nonnull(x) to use g_assert(x) because the
first is not marked as G_GNUC_NORETURN because of course GTester
supports not aborting on aborts.
2020-03-05 08:14:37 +01:00
Benjamin Otte
f6b11a5158 build: Add more useful warning flags
I found those on the interwebs and decided they are useful.
2020-03-05 07:56:28 +01:00
Philip Chimento
e123853b8b build: Install Valgrind suppressions files
This is so that other programs linking to GTK can use GTK's suppressions
files when performing their own Valgrind analysis.

Closes: #138
2020-02-23 15:00:37 -08:00
Matthias Clasen
37a9d0620d 3.98.0 2020-02-10 15:32:19 -05:00
Chun-wei Fan
f8d3845b1a meson/MSVC builds: Use -utf-8 where available
This avoids the build from erroring out on C4819 (Unicode handling issue in
Visual Studio compiler), notably when running on Chinese, Japanese and
Korean locales.

Also apply -D_USE_MATH_DEFINES, -FImsvc_recommended_pragmas.h and -utf-8 to
the C++ compiler options as well.
2020-02-03 17:55:09 +08:00
Matthias Clasen
4e58541d52 Make wayland load cursors on demand
Copy just enough of libwayland-cursor to make our own
loading. This lets us drop the dependency on libwayland-cursor,
and changes the startup cost for cursor theme loading
from 25ms to 0.1ms.

At the same time, simplify the handling of scaled cursors -
instead of creating an array of theme objects, just make a
single theme object provide all scaled cursor sizes.
2020-01-24 17:27:45 -05:00
Chun-wei Fan
a9b1d4a389 build: Check for sincosf()
sincosf() is really a GCC-specific function that may more may not be
supported on non-GCC compilers, so we want to check for it, otherwise we
use a fallback implementation, not unlike the one in
demos/gtk-demo/gtkgears.c.
2020-01-08 17:15:29 +08:00
Emmanuele Bassi
3c11c57755 Bump up the required version of Meson
Match the one we're testing on our CI infrastructure.
2019-11-16 18:40:23 +00:00
Matthias Clasen
fa8ce17e1e build: We no longer need freetype 2019-11-01 13:01:54 -04:00
Matthias Clasen
41c52e955d Bump the pango dependency
This lets us avoid freetype uses, and simplifies
some other things as well.
2019-11-01 13:01:54 -04:00
Olivier Fourdan
060a9f072c Bump wayland-protocols requirements
The `name` and `description` events were added to `xdg-output` protocol
in version 2 which is part of wayland-protocols 1.14.

In xdg-output-v1 version 3, the `xdg-output.done` event was deprecated
and the `xdg-output.description` event was made mutable, but that
doesn't change the actual events so we do not actually need to require
that version of xdg-output from wayland-protocols 1.18.

Update the wayland-protocols requirement to the bare minimum version,
which is 1.14.

https://gitlab.gnome.org/GNOME/gtk/issues/2057
2019-07-29 12:03:07 +02:00
Matthias Clasen
4eaf860e86 meson: Rename documentation option to gtk_doc
This name is what most of the stack is using.
Lets follow along, even though it is (imo)
uglier.
2019-07-01 20:16:37 -04:00
Emmanuele Bassi
23e4d05383 build: Do not use add_global_flags()
It's almost always not what you want.
2019-06-24 15:00:21 +01:00
Benjamin Otte
22e0785802 build: Make script interpreter optional
Running the tests needs it though, so it's only optional without tests.
2019-05-30 18:34:51 +02:00
Benjamin Otte
1e0c0c0ba7 rendernodeparser: Parse cairo script
Use cairo-script-interpreter to parse the scripts that generate cairo
nodes.

This requires libcairoscriptinterpreter.so to work properly, but if
it isn't found we disable this (unimportant for normal functioning)
code and just emits a parser warning.
The testsuite requires it however or it will fail.

A new test is included that tests all of this.
2019-05-30 15:32:36 +02:00
Christian Hergert
3a0beeadc5 profiler: port GdkProfiler to sysprof-3
This uses the new sysprof-3 ABI to implement the capture writer. It also
uses the statically linked libsysprof-capture-3.a that is provided with
Sysprof for the capture writing to ensure that we do not leak any symbols
nor depend on any additional libraries.

The GTK_TRACE_FD can be used to pass a FD for tracing into Gtk. Sysprof
uses this when the Gtk instrument is selected for recording.
2019-05-29 19:02:30 -07:00
Christoph Reiter
758830e7c3 meson: allow building man pages without the documentation
The 'documentation' option also guarded the man page build. Instead
if skipping the whole docs subdir skip the specific gtkdoc calls, so that the
man page build still works.

This brings it in line with the gtk3 meson build.
2019-05-25 18:33:01 +02:00
Carlos Garnacho
f3250172a4 gdk/x11: Make XInput2 a mandatory build time dependency for x11
XInput2 is more than a decade old already, and the input improvements
there (and in every other backend really) make it untenable to have
support for X11 core input events dragging things behind.
2019-05-15 01:05:20 +02:00
Matthias Clasen
b01cf6be65 3.96 2019-05-07 03:27:04 +00:00
Emmanuele Bassi
f6594ff073 Update the version of Graphene
We're going to use newly added API soon.
2019-04-29 02:26:31 +02:00
Jonas Ådahl
477ad2505b widget: Add surface relative transform changed callback
Added two new private GtkWidget API:

 * gtk_widget_add_surface_transform_changed_callback()
 * gtk_widget_remove_surface_transform_changed_callback()

The intention is to let the user know when a widget transform relative
to the surface changes. It works by calculating the surface relative
transform during allocation, and notifying the callbacks if it changed
since last time. Each widget adds itself as a listener to its parent
widget, thus will be triggered if a parents surface relative transform
changes.
2019-04-24 14:26:24 +02:00
Benjamin Otte
dff9a5a195 build: Add new gcc error flags
These flags check for code that we don't want to write, so turn them
into error flags.

Variable length arrays should be replaced by malloc() - or explicit
alloca() calls if you know what you're doing.

Implicit fallthrough should be replaced by explicit fallthrough with the
usage of G_GNU_FALLTHROUGH.

This work inspired by Kees Cook's LCA2019 talk:
https://www.youtube.com/watch?v=FY9SbqTO5GQ
http://outflux.net/slides/2019/lca/danger.pdf
2019-04-15 14:40:25 +02:00
Benjamin Otte
0791924bf7 Convert fallthrough comments to G_GNUC_FALLTHROUGH
This way it's very obvious that fallthrough is indeed what we want.

Also bump the glib requirement to 2.59 which introduced
G_GNUC_FALLTHROUGH.
2019-04-15 14:40:25 +02:00
Benjamin Otte
a938c14d11 build: Add gtk-css static library
This library is meant to be the new CSS library that gets used from GDK,
GSK and GTK for string printing and parsing.

As a first step, move GtkCssProviderError into it.

While doing so, split it into GtkCssParserError (for critical problems)
and GtkCssParserWarning (for non-critical problems).
2019-04-12 19:34:28 +02:00
Chun-wei Fan
88086ea91a meson: Only use HarfBuzz fallback when needed
The current Meson releases have broken CMake support, meaning that it is
likely that HarfBuzz could not be located for Visual Studio builds
unless one handcrafts pkg-config files for it, which is both tedious and
error-prone.

Instead, use the existing mechanism for looking for the HarfBuzz headers
and libraries on Visual Studio first when it could not be found via
dependency(), and then use the fallback if it still could not be found.
2019-04-12 18:16:12 +08:00
Matthias Clasen
bcac81eed9 Merge branch 'wip/ebassi/align-test' into 'master'
Remove aligned allocation checks

See merge request GNOME/gtk!596
2019-03-29 22:50:10 +00:00
Benjamin Otte
1944ffe351 Revert "Bump meson req to 0.50"
This reverts commit f0845d98a2.

The commit breaks CI. CI has more power than meson telling things.
2019-03-29 10:19:41 +01:00
Chun-wei Fan
6b08227110 meson.build: Pull in fallback for PangoFT2 only when needed
On some systems PangoFT2 is optional, so we only use the fallback when
it is being required.
2019-03-29 16:50:35 +08:00
Matthias Clasen
f0845d98a2 Bump meson req to 0.50
meson told me to.
2019-03-28 17:35:50 -04:00
Benjamin Otte
979e9bec27 testsuite: Add a transforms test
In particular, check that to_matrix() and to_2d(), to_affine() and
to_translate() return the same values.

This also requires a recent Graphene version or the tests will fail.
2019-03-04 23:41:27 +01:00
Emmanuele Bassi
fad21d8dda Remove aligned allocation checks
The tests were added when we thought we had to align memory allocations
for structures including a Graphene type in their members. Graphene
added alignment annotations for its types, and we never really used the
symbols we set after testing for allocations being aligned out of the
box with malloc(), and for aligned allocators.
2019-03-04 13:51:49 +00:00
Chun-wei Fan
8d987be673 Merge branch 'wip/fanc999/meson.msvc' into 'master'
GTK+ 4: Improve Windows/Visual Studio build experience

See merge request GNOME/gtk!185
2019-02-23 02:13:35 +00:00
Emmanuele Bassi
b56c0fb596 Rename project files
Meson and DOAP are the last holdovers for the old "gtk+" name.
2019-02-06 10:42:50 +01:00
Matthias Clasen
1aeeefdccb Merge branch 'drop-the-plus' into 'master'
Rename some references to GTK+

See merge request GNOME/gtk!553
2019-02-05 08:29:39 +00:00
Matthias Clasen
dbd360262c Add an explicit fribidi dep
We will use fribidi api to determine text direction.
2019-02-04 18:28:31 -05:00
Matthias Clasen
d080be3e50 Rename some references to GTK+
We are dropping the plus.
2019-02-04 11:58:09 -05:00
Benjamin Otte
359bc7695c build: Reintroduce warning flags from autotools
Some of the flags got lost in the meson transition or were demoted from
error flags to warning flags.
This commit reintroduces them.

It also includes fixes for the code that had warnings with those flags.
The big one being -Wshadow.
2019-01-22 04:33:12 +01:00
Benjamin Otte
7723749e00 meson.build: Order warning flags alphabetically
... and remove the duplicate we already had.
2019-01-22 04:33:11 +01:00
Emmanuele Bassi
e458ea2f3d build: Avoid a Meson deprecation warning
Using an empty `configuration_data` object to copy a configuration file
is deprecated since Meson 0.47 (released July 2018); the equivalent
behaviour is available by using `copy: true`.
2019-01-08 14:46:46 +00:00
Chun-wei Fan
3fa28ffd92 build: Make post-install script a Python script
The existing post-install shell script will most likely not work on
Visual Studio builds as there is normally no shell interpreter installed
on the system where the build is done, but the build is normally done in
a standard Windows cmd.exe console.

Instead, use a Python script so that it will work on the platforms that
Python supports.
2018-12-06 17:07:33 +08:00
Nirbheek Chauhan
b98f5a0823 meson: Always fetch pangoft2_dep from the pango subproject
This ensures that we will use pangoft2 if it is available, and not if
it is not available.

See: https://gitlab.gnome.org/GNOME/pango/merge_requests/6
2018-10-12 13:08:48 +05:30
Nirbheek Chauhan
00c29e1fbe meson: Use proxy-libintl subproject when needed and available
Such as on Windows with MSVC.
2018-10-12 13:08:48 +05:30
Nirbheek Chauhan
de3e5be235 meson: Add a fallback for the harfbuzz dependency
This meson port is not upstream yet, so a wrap file is not included.
Upstream has expressed interest but the port hasn't been tested on all
platforms yet. Will be added when it gets upstreamed.

Link to WIP port: https://github.com/centricular/harfbuzz
2018-10-12 13:08:48 +05:30
Nirbheek Chauhan
b343abfa51 meson: Support graphene as a fallback dependency
Don't assume graphene_dep is always a pkg-config dependency.

Closes https://gitlab.gnome.org/GNOME/gtk/issues/1197
2018-07-23 20:17:04 +05:30
Matthias Clasen
faba0f0145 Bump version to 3.94.0 2018-06-25 19:55:04 -04:00
Руслан Ижбулатов
bd2e3f5b9b Add aligned allocator support to meson
* A bunch of new variables for config.h.meson
* A check for aligned allocation being necessary at all
  (graphene must use GCC vector instructions or SSE2)
* A check for C malloc() being aligned at 16-byte boundaries
* A check for a few special aligned allocator functions being
  present and not being built-ins (posix_memalign is a builtin
  in GCC, even on platforms where there is no posix_memalign
  system function)
* Added -mstackrealign flag on Windows, since otherwise
  stack variables may become unaligned when the stack briefly
  passes through OS code (such as in various callbacks and
  handlers)
2018-06-09 13:52:42 +00:00
Matthias Clasen
45db4a5550 Merge branch 'wip/xdg-shell' into 'master'
xdg shell (stable)

See merge request GNOME/gtk!35
2018-05-04 00:43:01 +00:00
Ting-Wei Lan
7fed0b74ed wayland: Use dev/evdev/input.h on FreeBSD
The header linux/input.h used by GDK is specific to Linux. It is
possible to get a few Linux headers on FreeBSD by installing v4l_compat,
but it is usually better to use the one shipped with FreeBSD.

We prefer dev/evdev/input.h to linux/input.h here, so it will always use
dev/evdev/input.h on FreeBSD regardless of v4l_compat.

https://svnweb.freebsd.org/changeset/ports/465644
2018-05-01 22:28:57 +08:00
Jonas Ådahl
a40923b03a wayland: Add support for xdg-shell stable
This commit adds support the stable version of the xdg-shell protocol.
Support for the last version of the unstable series is left intact, but
will not receive new features.

The stable version is prioritized above the older version.

https://bugzilla.gnome.org/show_bug.cgi?id=791939
2018-05-01 13:36:38 +02:00
Ting-Wei Lan
ff1dd5009c build: Use cc.links to check linker arguments
Instead of hard-coding linker flags for a specific operating system and
a specific compiler, we can should cc.links to test them, so they can be
used on more operating systems and compilers.
2018-04-22 21:57:10 +08:00