Matthias Clasen
feac1e5fba
Use pango api better
...
Avoid direct access to PangoLayoutLine members,
use pango api for it where we can.
2022-01-22 23:10:53 -05:00
Timm Bäder
ae60293c24
textlayout: Remove unused-but-set variables
2021-12-16 11:06:50 +01:00
Matthias Clasen
66910ed998
Restore the GtkTextchild abi
...
Move the new chars field to a private struct.
Fixes : #4531
2021-12-11 10:58:58 -05:00
Georg Vienna
c517e945de
textchildanchor: allow to specify replacement character
2021-12-03 16:02:48 +00:00
Matthias Clasen
b9cad7cc54
textview: Implement new pango attributes
...
Implement the word and sentence attributes.
2021-08-25 14:57:13 -04:00
Matthias Clasen
417b3f9c6b
Implement text transforms for GtkTextView
...
Add a property to GtkTextTag and do all the
legwork to translate it to the Pango attribute.
2021-08-22 15:57:50 -04:00
Matthias Clasen
ba95ef63da
Drop PANGO_VERSION_CHECK checks
...
We require Pango 1.49 now.
2021-08-22 15:26:23 -04:00
Matthias Clasen
4759afcc3e
textview: Set line height from css
...
Set the line height in the default attributes from
the CSS style. This makes line height work in
GtkTextView.
2021-08-22 15:15:50 -04:00
Matthias Clasen
66b297e408
textview: Add line height plumbing
...
This adds a line-height property to GtkTexttag and a
line_height field to GtkTextAttributes, and translates
it to a pango attribute.
2021-08-22 15:15:50 -04:00
Matthias Clasen
da1232caaf
textview: Don't eat block cursors
...
We need to render even an empty paragraph when
it has a block cursor at the end. This fixes block
cursors not showing up in empty lines.
2021-08-20 01:57:31 -04:00
Matthias Clasen
91f7b9663f
gtk: Clean up docs syntax
...
Replace leftover gtk-doc syntax (#Type) with backquotes.
2021-05-22 17:25:26 -04:00
Matthias Clasen
4a0d3d7acc
docs: Reduce redundancy
...
Remove a boatload of "or %NULL" from nullable parameters
and return values. gi-docgen generates suitable text from
the annotation that we don't need to duplicate.
This adds a few missing nullable annotations too.
2021-05-20 20:45:06 -04:00
Matthias Clasen
7fe0610b68
introspection: Stop using allow-none
...
allow-none has been deprecated for a long time
already. Instead use optional and nullable everywhere.
2021-05-20 19:17:49 -04:00
Matthias Clasen
8ba16eb4f1
Documentation fixes
...
Mostly fixing up indentation of continuation lines,
and other small cleanups.
2021-05-20 19:17:49 -04:00
Alexander Mikhaylenko
70ee86c951
textlayout: Clip selection bounds to the line extents
...
The rest of the line will be painted separately.
2021-05-04 01:08:19 +05:00
Alexander Mikhaylenko
167134e1a8
textlayout: Support fully transparent selection text
...
Pango treats 0 alpha value as a unset alpha, so we have to special case it.
2021-05-04 00:16:05 +05:00
Alexander Mikhaylenko
0fa4b7a249
textview: Invalidate selection when its style changes
2021-05-04 00:16:05 +05:00
Alexander Mikhaylenko
f413d5ef22
textlayout: Only special case selection rendering for opaque colors
...
If the selection is partially transparent, it may still be desirable to
see the colors from tags underneath.
2021-05-04 00:16:05 +05:00
Matthias Clasen
288a5d4151
textview: Fix a problem with the last line
...
Sometimes, we missed the last line for display.
Fixes : #3835
2021-04-06 11:09:05 -04:00
Matthias Clasen
2e18f1b6e3
textlayout: Remove an unused function
2021-04-05 08:47:53 -04:00
Matthias Clasen
6cf712591f
textlayout: Avoid allocations for line iteration
...
No need to collect the lines firs, and allocate memory
for that. We can just iterate over them right away.
2021-04-04 23:42:58 -04:00
Matthias Clasen
b32cd5d328
textlayout: Introduce some locals
...
No need to call _gtk_text_buffer_get_btree over and over.
2021-04-04 22:44:09 -04:00
Matthias Clasen
2af99bd65e
textlayout: Create the cursor snapshot on demand
...
We don't need it all the time.
2021-04-04 22:27:53 -04:00
Matthias Clasen
d719a3d877
textbtree: Return tags in a GPtrArray
...
One of the callers prefers that, it lets us avoid
copying the array in one place, and generally makes
for better code.
2021-04-04 22:27:53 -04:00
Matthias Clasen
b0df8910ba
textlayout: Only get selection color once
...
No need to do this for every paragraph that is
inside the selection.
2021-04-04 14:20:25 -04:00
Matthias Clasen
67ee6b2740
textlayout: Don't call render_para too much
...
render_para produces no nodes for an empty paragraph.
Don't call it over and over for those.
2021-04-04 14:20:25 -04:00
Matthias Clasen
07a3fb833c
textlayout: Remove some unnecessary code
...
The same field is set again 2 lines down.
2021-04-04 14:20:25 -04:00
Matthias Clasen
a75c038e09
textview: Tweak render nodes
...
Arrange for the contents to be in a single transform
node that is updated as we scroll. This makes the job
of the render node differ a lot easier, since it does
not have to compare to big containers one-by-one.
2021-03-28 10:59:55 -04:00
Matthias Clasen
9be2f130f0
textview: Fix blinking block cursors
...
When we have a block cursor, we need to discard the
cached node of the line containing the cursor, in order
to get a blinking cursor.
2021-03-12 21:50:07 -05:00
Matthias Clasen
3a928c8980
textlayout: Render cursors at the end
...
Don't place the insertion cursor render nodes in the
middle of the text nodes for all the text. This helps
the renderer batching the text draw calls together.
2021-03-12 19:28:36 -05:00
Timm Bäder
e90f5e8a20
gskpango: Don't copy fg color
...
No need to do that here, we copy it in to the individual render nodes
anyway.
2020-12-21 15:23:25 +01:00
Timm Bäder
98b99201b0
gskpango: Remove bounds rect
...
We only need this to render shapes and trapezoids, i.e. only when
falling back to cairo. Remove code to measure the layout and convert the
ink_rect to a graphene_rect_t from gtk_snapshot_append_layout() and do
it when drawing shapes and trapezoids instead.
2020-12-21 12:56:38 +01:00
Timm Bäder
2031c5bf90
textlayout: Remove dead offset_y code
2020-12-21 10:26:03 +01:00
Matthias Clasen
5cbc55578f
textview: Update child allocations
...
This was accidentally lost when display line caching
was introduced.
2020-10-28 20:18:54 -04:00
Matthias Clasen
c09575d9cb
textlayout: Avoid some iter comparisons
...
We were doing more iter comparisons than necessary in the
inner loop of gtk_text_layout_snapshot(), in the presence
of a selection. Rewrite the code to compare line numbers
instead, which is faster than full iter comparisons.
2020-09-11 16:41:42 -04:00
Christian Hergert
35325ea11a
linedisplaycache: improve invalidation with y_range
...
When we invalidate a y_range using the common pattern of y==0 and
old_height==new_height, we are generally invalidating the entire buffer.
This short-circuits that case to just invalidate the buffer in a faster
and more complete form. The problem here appears to be that we can't
always calculate the ranges properly to invalidate because validation
has not run far enough.
2020-08-07 12:44:26 -07:00
Benjamin Otte
d375dce9f5
Replace "gchar" with "char"
2020-07-25 00:47:36 +02:00
Benjamin Otte
d7266b25ba
Replace "gint" with "int"
2020-07-25 00:47:36 +02:00
Christian Hergert
fae014eb45
textlayout: remove virtual table indirection
...
GtkTextLayout is private now and therefore we can drop all of
the indirection through the class vtable. Instead, just call the
implementations directly and remove the unused vtable entries
for default signal handlers.
2020-06-30 17:38:31 -07:00
Yuri Chornoivan
c0cf839729
Fix minor typos
2020-06-18 10:47:16 +03:00
Matthias Clasen
b251893030
Drop pango version checks
...
We are requiring pango 1.45.0 now, so no need to
Keep these ifdefs in the code any longer.
2020-06-06 21:32:55 -04:00
Timm Bäder
289b157e32
textchild: Return an array from get_widgets
...
Yay, one GList less.
2020-05-05 08:20:09 +02:00
Matthias Clasen
b4c79bad34
Assorted documentation fixes
2020-04-20 00:38:58 -04:00
Matthias Clasen
9259efb5d7
Make overline support conditional
...
The ci image does not have Pango 1.45, so for the
time being, make the overline support conditional
on Pango being new enough.
2020-03-21 01:18:54 -04:00
Matthias Clasen
fd9c911c3a
textlayout: Handle new text tag properties
...
Translate tag properties for overlines and
hyphenation control into Pango attributes.
2020-03-20 23:58:23 -04:00
Alexander Larsson
1698369d52
Merge branch 'icon-theme-api-rework' into 'master'
...
Icon theme api rework
See merge request GNOME/gtk!1390
2020-02-10 12:45:56 +00:00
Timm Bäder
17ddae5bf9
textlayout: Use gtk_snapshot_{push,pop}_collect()
2020-02-07 13:16:32 -05:00
Alexander Larsson
8282698201
textview: Use paintables instead of textures, and fix the support
...
This changes gtk_text_buffer_insert_texture() to
gtk_text_buffer_insert_paintable() which is strictly more useful
(as textures are paintables). It also fixes the code to actually
support drawing the paintables (as well as tracking changes
to the paintables.
2020-02-06 17:47:56 +01:00
Benjamin Otte
632fab0ca7
stylecontext: Get rid of gtk_style_context_get()
...
... and replace all the calls to it with
gtk_style_context_peek_property().
All the calls are hacks that need to go away btw.
2020-01-28 02:58:02 +01:00
Matthias Clasen
9c2c5665df
textview: Render visible marks better
...
The only other visible mark that is in common use
besides insert and selection_bound is dnd_mark, and
we don't want it to blink or be affected by 'cursor'
visibility.
Therefore, cache not just the cursor positions, but
also whether they are insert or selection_bound,
and take that into account when rendering them.
2020-01-03 13:00:53 -05:00