Commit Graph

130 Commits

Author SHA1 Message Date
Matthias Clasen
d48084dad9 font chooser: Allow tweaking fractions
This makes some sense, and frac is meant to be set globally.
2018-04-14 20:28:27 -04:00
Benjamin Otte
169203951b widget: Remove clip from size-allocate vfunc
As the clip is no longer needed, get rid of it.
2018-04-05 14:56:38 +02:00
Matthias Clasen
bd9debe048 font chooser: Remove some dead code
This is leftover code from already removed debug spew.
2018-04-02 17:46:41 -04:00
Matthias Clasen
5a68ac27cf font chooser: Make the language property writable
This is meant as an input to the font chooser.
We don't want the user to select a language, but
rather have fonts presented as they would work for
the current language. Therefore, do away with the
lang/script combo on the tweak page.
2018-04-02 13:37:53 -04:00
Chun-wei Fan
464943e5a6 gtk, demos: Fix builds without HarfBuzz and PangoFT
Really exclude the portions in the gtkfontchooserwidget.c that are built
when HarfBuzz and PangoFT2 are built, and update the Meson files to
exclude such sources as well from the main GTK SO/DLL and from the
gtk4-demo program.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-04-02 19:15:18 +08:00
Matthias Clasen
d0e46d257c font chooser: Add examples for font features
For some font features, we can figure out affected
glyphs, and show before/after. For some others, we
hardcode typical sequences.

Still to do: figure out how to find ligatures and
show them.
2018-04-01 19:36:54 -04:00
Matthias Clasen
ad814509a4 font chooser: Align level value names
In the backport, I used the plural for variations, and that
is a better name, so use it here too.
2018-03-31 21:02:51 -04:00
Matthias Clasen
d15a29c876 Defeat compiler optimization
We always want to call both update functions here, and
the compiler unhelpfully optimizes out the second call
if the first one returns TRUE.
2018-03-31 21:02:51 -04:00
Matthias Clasen
b1b05bee53 font chooser: Make levels flags
Turn the GtkFontChooserLevel field into flags, and
add flags for OpenType variations and features. The
motivation for this is to make font-features in the UI
opt-in, since applications need to support them by
applying the pango attribute.
2018-03-27 16:14:21 -04:00
Matthias Clasen
85a7d0a201 font chooser widget: Expose tweak-action as property
This is necessary for applications that want to embed
the font chooser widget outside of GtkFontChooserDialog,
in order to access the tweak page.
2018-03-27 16:14:21 -04:00
Alexander Larsson
63e060a21d GtkWidget: Start renaming widget->window
This is an automated change doing these command:

git sed -f g gtk_widget_set_has_window gtk_widget_set_has_surface
git sed -f g gtk_widget_get_has_window gtk_widget_get_has_surface
git sed -f g gtk_widget_set_parent_window gtk_widget_set_parent_surface
git sed -f g gtk_widget_get_parent_window gtk_widget_get_parent_surface
git sed -f g gtk_widget_set_window gtk_widget_set_surface
git sed -f g gtk_widget_get_window gtk_widget_get_surface
git sed -f g gtk_widget_register_window gtk_widget_register_surface
git sed -f g gtk_widget_unregister_window gtk_widget_unregister_surface

git checkout NEWS*
2018-03-20 15:21:12 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Matthias Clasen
7e491fd3fc font chooser: Stop using ::scroll-event
We have an event controller for this purpose now.
2018-01-16 14:14:09 -05:00
Matthias Clasen
3dd3ae1b9d font chooser: Plug a memory leak
We were leaking the hb_font object.
2018-01-04 22:24:21 -05:00
Matthias Clasen
e41e8c4c53 font chooser: Fix a memory leak
We were leaking the delayed font descriptions.
2018-01-04 21:19:28 -05:00
Matthias Clasen
8a5b6d422f fontchooser: fix feature formatting
There was a " missing, causing some features to be missed.
2018-01-04 08:39:18 -05:00
Matthias Clasen
a79f950dfe font chooser: Manage tweak button sensitivity
When we don't have any font features or variation axes,
there is no point in going to the tweak page, so disable
the action in this case.
2018-01-03 14:06:00 -05:00
Matthias Clasen
7687393583 font chooser: Don't set hardcoded default features
We should rely on harfbuzz to select the right defaults.
2018-01-03 13:41:20 -05:00
Matthias Clasen
4cc68a97a8 font chooser: Support font variations
Add sliders for the available axes to the tweak page.
2018-01-03 13:28:33 -05:00
Matthias Clasen
894a0c0ff4 font chooser: Add properties for features and language
These can't be returned as part of the font description,
so we need new api for them. For now, this is just readonly
properties. Maybe these should be writable too, eventually.
2018-01-03 12:18:18 -05:00
Matthias Clasen
ade33c6e14 Add font features on the tweak page 2018-01-03 12:18:18 -05:00
Matthias Clasen
15f8b2d0ae font chooser: Add a tweak page
Add a button the dialog's header bar that lets us
switch to a second page where we can customize
the selected font.

Make the font chooser widget export an action that the
dialog can use for the button. This has some advantages:
- we can export not just the toggle state, but also enabled
- we can reuse the same enabled state to make the select
  button insensitive when no font is selected

To determine whether a font is selected, listen to changes
of the list selection. And ensure that the font chooser is
in an initial state when mapped, even if we close the dialog
from the tweak page.
2018-01-03 12:18:18 -05:00
Matthias Clasen
f0526359d1 font chooser: introduce font chooser levels
This is a more systematic approach to reducing the
level of detail in the font chooser.
2018-01-03 12:18:18 -05:00
Matthias Clasen
78f9193d7e font chooser: Small revision of the UI
Show only the font names in the list, in their own
font, in order to make the list less noisy.
2018-01-03 12:18:18 -05:00
Matthias Clasen
e90787d975 fontchooser: Add global keynav
Starting to type should focus the search entry and start
a search.
2017-12-27 17:29:24 -05:00
Matthias Clasen
5478bd59bf Fix a crash introduced in the previous commit
The signatures of row-inserted and row-deleted are not
identical, so we need to be a bit more careful here.
2017-12-19 14:17:55 -05:00
Matthias Clasen
1b05474979 font chooser: Simplify some code
Instead of separate handlers, just keep a single
handler for both row-inserted and row-deleted.
Slightly less work that way.
2017-12-19 12:10:47 -05:00
Matthias Clasen
e5154547f8 font chooser: Stop listening to style-updated
The only time a style-updated indicates we need
to reload fonts is when it is synthesized by GtkSettings
in response to a fontconfig timestamp change, but
we are listening to those already, anyway.
2017-12-19 11:45:56 -05:00
Matthias Clasen
ffd6baec42 gtk: Intern css names
This avoids a bunch of strdups at startup.
2017-11-17 22:49:57 -05:00
Benjamin Otte
44614394e6 widget: Turn screen-changed signal into display-changed 2017-10-31 00:43:11 +01:00
Carlos Garnacho
67239f112e fontchooser: Update to using GdkEvent API 2017-09-19 18:39:02 +02:00
Carlos Garnacho
5fdcfa4739 fontchooser: Block row deleted signal handler when reloading model
This prevents the load_fonts() function from switching to the "no fonts"
page and back when the model is reloaded. Given
GtkSettings::gtk-fontconfig-timestamp is 0 on Wayland and style changes
happen often, the stack change messes up popovers and pointer focus
on the fonts treeview and test entry.
2017-08-23 20:41:18 +02:00
Timm Bäder
36ab70ddf5 widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well
change the size-allocate signature to include a out_clip parameter, just
like GtkCssGadget did. And since we now always propagate baselines, we
might as well pass that one on to size-allocate.

This way we can also make sure to transform the clip returned from
size-allocate to parent-coordinates, i.e. the same coordinate space
priv->allocation is in.
2017-07-19 21:27:16 -04:00
Timm Bäder
9fedd05051 fontchooserwidgets: Spinbuttons are no entries 2017-07-19 21:27:11 -04:00
Carlos Garnacho
a72404dd5a gtk: Mass delete all GtkWidget event mask API
We now rely on toplevels receiving and forwarding all the events
the windowing should be able to handle. Event masks are no longer a
way to determine whether an event is deliverable ot a widget.

Events will always be delivered in the three captured/target/bubbled
phases, widgets can now just attach GtkEventControllers and let those
handle the events.
2017-05-25 16:25:58 +02:00
Timm Bäder
5c4934cfc0 Chain up in size-allocate implementations
Otherwise we're not setting an allocation at all.
2017-05-01 21:21:40 +02:00
Timm Bäder
fc22543b41 fontchooserwidget: Inherit from GtkWidget 2017-03-31 09:50:39 +02:00
Timm Bäder
11c599a1b5 fontchooserwidget: Remove unused defines 2017-03-31 09:50:39 +02:00
Emmanuele Bassi
db6f9a8e45 gtk: Add missing function declarations 2016-10-17 11:44:11 +01:00
Benjamin Otte
1518fe0a8f API: stylecontext: Remove state argument from getters
The argument must always be the current state.
2016-10-16 18:18:58 +02:00
Benjamin Otte
77cdbfde97 fontchooserwidget: Query dpi from CssStyle 2016-10-16 18:17:21 +02:00
Timm Bäder
c5369356e8 Various documentation fixes
Always have Since: annotations at the very bottom, use the correct
ClassName::signal-name/ClassName:property-name syntax, fix a few typos
in type names, wrong function names, non-existing type names, etc.
2016-02-08 22:56:52 +01:00
Matthias Clasen
d2e80a7993 font chooser: Add a CSS name
The CSS name for GtkFontChooserWidget is fontchooser.
2016-01-13 23:42:35 -05:00
Matthias Clasen
f210dc9281 Fix make check
GtkFontChooserWidget is using a GThemedIcon in its template,
so we need to ensure that the type is registered before
loading it. This was causing the defaultvalue test to fail.
2015-12-04 17:01:03 -05:00
Matthias Clasen
aa9dd72e8f font chooser: Make repeated Escape cancel the dialog
The first Escape clears the search entry, the second Escape
closes the dialog.
2015-08-10 22:43:19 -04:00
Matthias Clasen
61ffb517bc font chooser: Make Escape stop search 2015-08-10 22:43:18 -04:00
Christian Hergert
08addd9859 fontchooserwidget: use appropriate model for GtkTreeIter
We were previously mixing the model used when filtering with an iter that
has been resolved to the backing model.

This results in both an invalid row index as well as an invalid
iter->stamp.
2015-07-29 12:57:43 -07:00
Benjamin Otte
31191d5566 fontchooserwidget: Refactor code so we actually optimize
Previously, we would pango_font_describe() every time the code ran and
we wouldn't ever hit the optimized quick exit.

The code now is a lot more complex because the
compute-actual-value-when-required-the-first-time approach is not
supported out of the box in GtkTreeModel (or GValue).
2015-07-22 16:01:21 +02:00
Matthias Clasen
f35c7b83d9 font chooser: Remove a stray notify
This was forgotten when I changed to font map to not be a
property.
2015-07-11 00:15:42 -05:00
Matthias Clasen
6f955a7df6 Redo font map support in GtkFontChooser
We can't add properties to the interface, since it breaks
3rd party implementations of the GtkFontChooser interface.
These exist, for example in gnumeric.

So, instead of a new property, add getter/setter vfuncs.
2015-06-13 00:00:51 -04:00