Commit Graph

71744 Commits

Author SHA1 Message Date
Benjamin Otte
5fe35cb0fd path: Add GSK_CIRCLE_POINT_INIT() to initialize points on the circle
This is just splitting out a commonly done operation into a macro.
2021-12-04 22:43:31 -05:00
Benjamin Otte
70f097ebd7 pathbuilder: Redo semantics for starting curves
We now always have a "current point" which is either the last point an
operation was made to, or (0, 0) if no drawing operation has
been made yet.

Adding a contour of any kind to the builder will always update the
current point to that contour's end point.
2021-12-04 22:43:31 -05:00
Benjamin Otte
1f1641fdfc gtk-demo: Show closest point in text-on-path demo 2021-12-04 22:43:31 -05:00
Benjamin Otte
dce77dc2a5 path: Split GskPathBuilder into its own file
... and add missing API docs.
2021-12-04 22:42:38 -05:00
Benjamin Otte
1500250116 testsuite: Add a test using get_point() and get_closest_point() 2021-12-04 22:42:38 -05:00
Benjamin Otte
8a5c2e771a testsuite: Add a test for get_point() 2021-12-04 22:42:38 -05:00
Benjamin Otte
419f4f87a4 testsuite: Update create_random_path()
1. Allow specifying the max number of contours
2. Be smarter about creating the paths:
   With 10% chance, create a "weird" path like the empty one or only
   points or things like that.
   Otherwise create a bunch of contours, with 2/3 a standard contour,
   with 1/3 a predetermined one.
2021-12-04 22:42:38 -05:00
Benjamin Otte
0f848aace9 gtk-demo: Add cute maze demo 2021-12-04 22:42:38 -05:00
Benjamin Otte
c1111d9c4d testsuite: Add tests for gsk_path_measure_get_closest_point() 2021-12-04 22:42:14 -05:00
Benjamin Otte
614e043c94 path: Add gsk_path_measure_get_closest_point()
... and gsk_path_measure_get_closest_point_full().

Those 2 functions allow finding the closest point on a path to a given
point.
2021-12-04 22:42:14 -05:00
Benjamin Otte
ee8ad62bb5 spline: Use Skia's tolerance checks
This avoids measuring being too far off (it's still off, but it's less
than a percent now.
2021-12-04 22:42:14 -05:00
Benjamin Otte
ec6d102dc5 testsuite: Add tests for gsk_path_measure_add_segment() 2021-12-04 22:42:14 -05:00
Benjamin Otte
c82cfa8b0c gtk-demo: Add a text-on-path demo 2021-12-04 22:42:14 -05:00
Benjamin Otte
ab41ef43d8 gtk-demo: Add a path-fill demo 2021-12-04 22:42:14 -05:00
Benjamin Otte
aa913100ba path: Add gsk_path_measure_get_point()
Allows querying the coordinates and direction of any specific point on a
path.
2021-12-04 22:40:12 -05:00
Matthias Clasen
0e256a6935 path: Add gsk_path_add_circle()
Adds a circle contour, too.
2021-12-04 22:40:12 -05:00
Benjamin Otte
2559885415 pathmeasure: Implement support for beziers
Instead of treating bezier curves as lines, we properly decompose them
into line segments now so that we can treat those as lines.
2021-12-04 22:40:12 -05:00
Benjamin Otte
d9a79c0a2f path: Implement gsk_path_to_cairo() using foreach() 2021-12-04 22:40:12 -05:00
Benjamin Otte
268efbd5a6 path: Add gsk_path_foreach() 2021-12-04 22:40:12 -05:00
Benjamin Otte
a14770a47d path: Collect flags
We don't need them yet, but maybe later.
2021-12-04 22:40:12 -05:00
Benjamin Otte
d42f45bc5a testsuite: Add path tests 2021-12-04 22:40:12 -05:00
Benjamin Otte
87b108209e pathmeasure: Add gsk_path_measure_add_segment()
This allows chunking paths, weeee.
2021-12-04 22:40:12 -05:00
Benjamin Otte
5ac2abc6d9 path: Add gsk_path_builder_add_path() 2021-12-04 22:40:12 -05:00
Benjamin Otte
9c721bff1b gsk: Add GskPathMeasure
An object to do measuring operations on paths - determining their
length, cutting off subpaths, things like that.
2021-12-04 22:40:12 -05:00
Benjamin Otte
78cae537a9 path: Change data structure for standard path
Instead of the Cairo method and imitating cairo_path_data_t, use the
Skia method and keep points and operations separate.

That way we get a points array that includes the starting point -
because it's always the end point of the previous operation.
2021-12-04 22:40:12 -05:00
Benjamin Otte
69cdeb6037 popover: Use fill and stroke nodes instead of Cairo
... to render the arrow.

The arrow should really be turned into a real thing - maybe an icon?
2021-12-04 22:40:12 -05:00
Benjamin Otte
8d1f354d01 snapshot: Add gtk_snapshot_push_stroke() 2021-12-04 22:40:12 -05:00
Benjamin Otte
c8928bf064 gsk: Add GskStrokeNode 2021-12-04 22:40:12 -05:00
Benjamin Otte
2b029af78f gsk: Add GskStroke
It's unused in this commit. This just prepares the new object.
2021-12-04 22:40:12 -05:00
Benjamin Otte
592bab384f demos: Add a simple demo filling a path 2021-12-04 22:40:12 -05:00
Benjamin Otte
ffebe0c340 snapshot: Add gtk_snapshot_push_fill() 2021-12-04 22:40:12 -05:00
Benjamin Otte
16ca8f75fd gsk: Add GskFillNode
Take a rendernode as source and a GskPath and fill the region in the
path just like cairo_fill() would.
2021-12-04 22:40:12 -05:00
Benjamin Otte
955762c5e8 gsk: Add GskPath 2021-12-04 22:40:12 -05:00
Matthias Clasen
c49205c1e6 gtk-demo: Small fixup to the cursors demo 2021-12-04 22:40:12 -05:00
Matthias Clasen
fc67b5a8cf Merge branch 'wip/carlosg/im-wayland-module-priority' into 'main'
gtkimcontextwayland: Set a higher IO extension priority

Closes #4443

See merge request GNOME/gtk!4216
2021-12-03 23:55:31 +00:00
Carlos Garnacho
ce1b970b46 gtkimcontextwayland: Set a higher IO extension priority
We want this to take precedence in the wayland platform to other
modules that might be loaded via the IO extension point. None of
those is going to bode well in this platform.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4443
2021-12-04 00:21:53 +01:00
Matthias Clasen
ceb77d6100 Merge branch 'wip/hadess/listbox-fixes' into 'main'
listbox: Explain behaviour of GtkListBoxCreateWidgetFunc

See merge request GNOME/gtk!4194
2021-12-03 23:05:13 +00:00
Matthias Clasen
02579a1333 Merge branch 'wip/chergert/inspector-im-module' into 'main'
inspector: add im-module

Closes #4512

See merge request GNOME/gtk!4214
2021-12-03 22:51:32 +00:00
Matthias Clasen
2f7fa10434 Merge branch 'textview-im-surrounding' into 'main'
textview: Provide more context to input methods

See merge request GNOME/gtk!4209
2021-12-03 20:26:54 +00:00
Christian Hergert
6be352f446 inspector: add im-module
This adds a new row to the Global/Information section which displays the
GTK im-module that is likely to be in use unless changed by an application.
It responds to updates of GtkSettings:gtk-im-module unless the
GTK_IM_MODULE environment variable is set.

Fixes #4512
2021-12-03 12:11:25 -08:00
Matthias Clasen
4d2be2e322 Merge branch 'text-scroll-test' into 'main'
Improve scroll-to mark behavior

Closes #4325

See merge request GNOME/gtk!4208
2021-12-03 20:00:05 +00:00
Matthias Clasen
d5c01098fd textview: Provide more context to input methods
When returning surrounding context to input methods,
include at least 2 words before and after the insertion
point.

Update the affected input method tests.
2021-12-03 14:44:05 -05:00
Matthias Clasen
d2bda8ea77 Merge branch 'text-anchor-replacement-char' into 'main'
textchildanchor: allow to specify replacement character

See merge request GNOME/gtk!4213
2021-12-03 16:02:49 +00:00
Georg Vienna
c517e945de textchildanchor: allow to specify replacement character 2021-12-03 16:02:48 +00:00
Matthias Clasen
e3a1a2e0c6 Merge branch 'better-tabs-demo' into 'main'
Beef up the tabs demo

See merge request GNOME/gtk!4200
2021-12-03 13:30:22 +00:00
Matthias Clasen
b9c2a925e2 Beef up the tabs demo
Show various alignments, including numeric.
2021-12-03 07:55:20 -05:00
Benjamin Otte
59238c6e73 Merge branch 'gtk4-win32-egl' into 'main'
Fix running GTK4 under EGL on Windows

See merge request GNOME/gtk!4188
2021-12-03 10:48:50 +00:00
Chun-wei Fan
652ab1ac72 gskglcompiler.c: Force GLSL version 300 es as needed
For libANGLE to work with our shaders, we must use "300 es" for
the #version directive in our shaders, as well as using the non-legacy/
non-GLES codepath in the shaders.  In order to check whether we are
using the GLSL 300 es shaders, we check whether we are using a GLES 3.0+
context.  As a result, make ->glsl_version a const char* and make sure
the existing shader version macros are defined apprpriately, and add a
new macro for the "300 es" shader version string.

This will allow the gtk4 programs to run under Windows using EGL via
libANGLE.  Some of the GL demos won't work for now, but at least this
makes things a lot better for using GL-accelerated graphics under Windows
for those that want to or need to use libANGLE (such as those with
graphics drivers that aren't capable of our Desktop (W)GL requirements in
GTK.
2021-12-03 10:39:59 +08:00
Chun-wei Fan
bdf879427c gdksurface-win32.c: Call gdk_surface_set_egl_native_window()
.. when creating the surface (with the HWND associated with the
newly-created surface) as well as destroying the surface (with NULL,
since the HWND is going to be destroyed), so that we can tie the EGL
calls to the HWND that we want to do the EGL stuff.
2021-12-03 10:39:59 +08:00
Matthias Clasen
4058b80d56 Bump pango req
Require pango 1.50.
2021-12-02 21:24:24 -05:00