Compare commits

...

96 Commits

Author SHA1 Message Date
Matthias Clasen d47392487f textview fixes 2021-08-06 16:41:16 -04:00
Matthias Clasen 1394f73ce2 label fixes 2021-08-06 16:41:04 -04:00
Matthias Clasen 4a5025eca1 css fixes 2021-08-06 16:40:54 -04:00
Matthias Clasen be8cbb2adb textview: Use line-height from css
Pass the line height from the style on to the
text attributes.
2021-08-06 14:35:48 -04:00
Matthias Clasen 3c9edc1afa textview: Add line-spacing plumbing
This adds a line-spacing property to GtkTextAttributes
and GtkTextTag.
2021-08-06 14:35:43 -04:00
Matthias Clasen 630bbf8d9b label: Use line-height from css 2021-08-06 14:20:10 -04:00
Matthias Clasen 8eb82da896 css: Add line-height property
This adds the plumbing to parse the line-height
property from CSS. Widgets are not picking it
up yet.
2021-08-06 14:19:34 -04:00
Matthias Clasen a457a81fd9 Merge branch 'matthiasc/for-master' into 'master'
text: Move setup code out of a loop

See merge request GNOME/gtk!3826
2021-08-05 18:45:39 +00:00
Matthias Clasen e5e7f5dd88 ci: Disable treeview-headers-hidden reftest
Somebody needs to figure out why it fails in ci so
frequently.
2021-08-05 12:41:04 -04:00
Matthias Clasen 916886312a Merge branch 'wip/exalm/shadow-extents' into 'master'
Shrink shadow extents

See merge request GNOME/gtk!3825
2021-08-05 16:39:52 +00:00
Matthias Clasen 8ff94ea1f2 text: Move setup code out of a loop
Just a cleanup, no functional change.
2021-08-05 12:31:18 -04:00
Matthias Clasen 053bd0cd31 Merge branch 'fix-tab-not-captured-in-popover' into 'master'
popovermenu: Cycle around focus also with (Shift+)Tab

Closes #3915

See merge request GNOME/gtk!3732
2021-08-05 02:07:43 +00:00
vanadiae a3ce574193 popover: Cycle around focus with (Shift+)Tab
Same thing as the previous popovermenu commit, except for the base popover
because the popovermenu needs special behaviour with e.g. sides arrow so
we need to have the "cycle around" for regular popovers here too.
2021-08-04 12:11:44 +02:00
vanadiae ef92adc87d popovermenu: Cycle around focus also with (Shift+)Tab
Currently when moving the focus with (Shift+)Tab, it also traverses the window's
widgets, although it would be expected that the focus stays within the popover,
as it's (almost) like it's a separate window. This would be consistent with
the behaviour of the Up/down arrows, which do cycle around the focus once it
reaches the end.

So this commit makes the popovermenu cycle around focus in any direction, apart
from left/right because they are used to open and close submenus and it wouldn't
make sense anyway to cycle horizontally as there's usually only one widget per
line.
2021-08-04 12:11:44 +02:00
Alexander Mikhaylenko 46a9538b6a Shrink shadow extents
Long time ago, Cairo shadows in both GTK3 and 4 were drawn at a size about
twice their radius. Eventually this was fixed but the shadow extents are
still calculated for the previous size and appear unreasonably large: for
example, 141px for a 50px radius shadow. This can get very noticeable in
places such as invisible window frame which gets included into screenshots.

https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3419 just divides the
radius by 2 when drawing a shadow with Cairo, do the same when calculating
extents.

See https://gitlab.gnome.org/GNOME/gtk/-/issues/3841
2021-08-04 14:47:17 +05:00
Matthias Clasen ca547b8716 Merge branch 'combobox-keynav' into 'master'
treepopover: Add keynav

See merge request GNOME/gtk!3822
2021-08-03 11:20:56 +00:00
Matthias Clasen 04ea51e843 treepopover: Start adding keynav
Arrange for the items to be focusable, and add keyboard
activation. Still missing: cycling focus inside the
popover.
2021-08-02 23:49:05 -04:00
Matthias Clasen f7dc0dda4e Merge branch 'big-keysyms' into 'master'
imcontext: Treat keysyms as 32bit values

Closes #4149

See merge request GNOME/gtk!3819
2021-08-03 01:05:16 +00:00
Matthias Clasen 8713843022 Merge branch 'surround-test' into 'master'
Remove an unimplemented function

Closes #4151

See merge request GNOME/gtk!3820
2021-08-03 01:00:13 +00:00
Matthias Clasen 6563b05d60 Add some GtkIMContext tests
For now, these check that the surrounding handling
in GtkText and GtkTextView is sane.

Fixes: #4151
2021-08-02 20:44:40 -04:00
Matthias Clasen d119c55b72 textview: Fix the get_surrounding implementation
This was, sadly, returning garbage.
2021-08-02 20:44:40 -04:00
Matthias Clasen 253e25a73c Add a private getter for the textview key controller
This will be used in tests.
2021-08-02 20:44:40 -04:00
Matthias Clasen c63774967f Remove an unimplemented function
_gtk_entry_get_im_context does not exist.
2021-08-02 20:44:40 -04:00
Matthias Clasen bbc36448fb imcontext: Treat keysyms as 32bit values
Our compose table format is still limited to 16bit
values for keysyms, but what we see in key events
can be 32bit values, and we treat them as such now.

Fixes: #4149
2021-08-02 19:16:18 -04:00
Matthias Clasen 5df323fb64 Merge branch 'fix-custom-widget-menu-focus' into 'master'
menusectionbox: Passthrough the focus function of custom widgets' gizmo

Closes gnome-text-editor#93

See merge request GNOME/gtk!3817
2021-08-02 22:21:08 +00:00
Matthias Clasen 0f2c5f13be Merge branch 'wip/otte/for-master' into 'master'
video: Use cross-fade transition to avoid resizes

See merge request GNOME/gtk!3815
2021-08-02 22:19:39 +00:00
Matthias Clasen 58180ad3be Merge branch 'fix-4144' into 'master'
gtkgesturerotate: Fix assertion

Closes #4144

See merge request GNOME/gtk!3818
2021-08-02 22:17:20 +00:00
James Westman fb0229890b gtkgesturerotate: Fix assertion
Fixes #4144. An assertion would be printed when GtkGestureRotate was
used with a touchscreen.
2021-08-02 16:38:35 -05:00
vanadiae 9099888398 menusectionbox: Passthrough the focus function of custom widgets' gizmo
It broke keyboard focusing any widget added through the custom widget
menu feature. So for example if you put e.g. a custom check box widget
in a menu, you won't be able to focus it.

This is because the gizmo is mostly used to custom drawing with e.g.
CSS for small visual elements like scale markers. That's probably why
gizmo's default focus overrides block the focus from going through
the children. So this commit fixes it by overriding those and passing
the focus through the children.
2021-08-02 21:20:32 +02:00
Benjamin Otte 882855f865 video: Use cross-fade transition to avoid resizes
Slide animations cause changes in the size requests due to the
behavior of GtkRevealer. We can avoid those by using cross-fades, which
don't have that problem.

Besides, cross-fades look better anyway.
2021-08-02 20:11:32 +02:00
Matthias Clasen f59d2ae89d Merge branch 'input-tweaks' into 'master'
imcontext: Tweak Compose sequence preedit

Closes #10, #4127, and #4124

See merge request GNOME/gtk!3799
2021-08-02 18:07:46 +00:00
Matthias Clasen 7c3a53a171 Merge branch 'fix-double-underscore-mnemonic' into 'master'
label: Ignore __ for mnemonics

Closes #4129

See merge request GNOME/gtk!3814
2021-08-02 03:54:29 +00:00
Matthias Clasen 1e22572716 Avoid pango deprecations
This function has been deprecated on the main
branch of pango. Since we don't want to bump our
pango dependency to 1.49 yet, ignore the deprecation.
2021-08-01 23:20:01 -04:00
Matthias Clasen 8a25f54e1f Add more label parsing tests
Test various combinations of underline and markup
parsing.
2021-08-01 23:19:00 -04:00
Matthias Clasen c51f2fc0ec label: Ignore __ for mnemonics
We were not ignoring double underscores for mnemonics
in one place, as we should.

Fixes: #4129
2021-08-01 22:14:12 -04:00
Matthias Clasen 2a528df977 Merge branch 'titlebar-gesture' into 'master'
Delegate titlebar action to the compositor if possible

See merge request GNOME/gtk!3797
2021-08-02 01:14:08 +00:00
Piotr Drąg 84684bd56e Update Polish translation 2021-08-01 14:21:25 +02:00
Matthias Clasen e1606ce8eb Merge branch 'color-glyph-fixes' into 'master'
gsk: Make color glyphs

Closes #4141

See merge request GNOME/gtk!3812
2021-07-31 20:54:39 +00:00
Matthias Clasen 47072e0441 Merge branch 'fix-iconhelper' into 'master'
iconhelper: Fix the paintable implementation

Closes #4140

See merge request GNOME/gtk!3809
2021-07-31 20:35:08 +00:00
Matthias Clasen 915c229396 gsk: Use harfbuzz for color fonts
harfbuzz has all the information we need, so we
can avoid poking directly at freetype apis. Also
drop the caching of color glyph information until
it turns out to be a problem.
2021-07-31 16:34:38 -04:00
Matthias Clasen 0bf46b4845 Bump the harfbuzz dep
We need 2.1.0, which has the hb_ot_color apis that we
are going to use in the next commit.
2021-07-31 16:34:38 -04:00
Matthias Clasen a7a2dbc3ea gsk: Cache per-glyph color information
We don't really want to load the bitmaps every time
we create a render node, so do it once and cache the
information on the PangoFont.
2021-07-31 16:34:38 -04:00
Matthias Clasen 7e8f586859 ngl: Use per-glyph color information
Decide per-glyph whether we need color nor not.

Fixes: #4141
2021-07-31 16:34:24 -04:00
Matthias Clasen bb9dccd773 gsk: Mark color glyphs
Steal a bit from PangoGlyphVisAttr to mark glyphs
that have color.
2021-07-31 16:34:24 -04:00
Emmanuele Bassi 7b743e662e Merge branch 'update-docs' into 'master'
docs: Update the URL for related documentation

See merge request GNOME/gtk!3813
2021-07-31 18:39:52 +00:00
Emmanuele Bassi 769dc53c05 docs: Update the URLs of related projects for GTK
And install the gi-docgen project file as well.
2021-07-31 19:08:34 +01:00
Emmanuele Bassi 1a4554daf3 docs: Update the URLs of related projects for GSK
And install the gi-docgen project file.
2021-07-31 19:07:18 +01:00
Emmanuele Bassi 6c0633ef61 docs: Update the URL for related documentation
And install the gi-docgen project files for GDK.
2021-07-31 19:05:33 +01:00
Emmanuele Bassi 4d020a3875 Merge branch 'docs-trigger' into 'master'
ci: Trigger a pages build

See merge request GNOME/gtk!3811
2021-07-31 17:16:26 +00:00
Emmanuele Bassi 316cc55e69 ci: Trigger a pages build
Do not publish the API reference directly, but trigger a CI pipeline for
the docs-gtk-org branch, which will then do the publishing.
2021-07-31 17:13:27 +01:00
Emmanuele Bassi 95f2634ea9 Merge branch 'iter-is-valid-docs' into 'master'
docs: Fix iter_is_valid() description

See merge request GNOME/gtk!3810
2021-07-31 13:07:07 +00:00
Emmanuele Bassi 95c032f531 docs: Fix iter_is_valid() description
Drop the "WARNING" and the block quote, and follow the existing
documentation style guidelines.
2021-07-31 13:41:13 +01:00
Matthias Clasen 744955753f iconhelper: Fix the paintable implementation
get_current_image was recursing due to an obvious typo.

Fixes: #4140
2021-07-31 08:27:17 -04:00
Matthias Clasen ae5e7dc65d Merge branch 'glyph-cache-mystery' into 'master'
ngl: Bypass pango for glyph cache rendering

See merge request GNOME/gtk!3807
2021-07-31 00:38:41 +00:00
Matthias Clasen ed41c46926 ngl: Bypass pango for glyph cache rendering
We can just use cairo directly here,
and cut out some layers of pango in the middle.
2021-07-30 19:46:07 -04:00
Matthias Clasen a460fb2734 Merge branch 'check-activate' into 'master'
checkbutton: Some fixes when used with GActions

See merge request GNOME/gtk!3805
2021-07-30 23:39:17 +00:00
Matthias Clasen 39ddce6ba3 Merge branch 'fix/wm_class' into 'master'
x11: set a default value for program_class

Closes #4138

See merge request GNOME/gtk!3806
2021-07-30 23:25:08 +00:00
Matthias Clasen 8da7e3bdc3 Merge branch 'wip/otte/for-master' into 'master'
widget-factory: Expand the video to cover the whole frame

See merge request GNOME/gtk!3804
2021-07-30 22:43:29 +00:00
Vincent Bernat eff53c023a x11: set a default value for program_class
This was also the behaviour with GTK 3. We use the capitalized program
name.

Fixes #4138

Signed-off-by: Vincent Bernat <vincent@bernat.ch>
2021-07-30 23:22:32 +02:00
Benjamin Otte 99e4a6a2d6 widget-factory: Propagate natural size for text styles
This avoids them requiring scrolling.
2021-07-30 20:54:58 +02:00
Benjamin Otte c06817b951 widget-factory: Make frames cooler
Instead of havoing a label for the video frame that clashes with the
background of the video, add a frame around the text styles box and add
a label for them. As a side benefit, it also makes it more obvious that
it is scrollable.

Note: Most of this patch is just reindenting.
2021-07-30 20:43:02 +02:00
Benjamin Otte e765aaa3f4 widget-factory: Expand the video to cover the whole frame
1. This looks way cooler.

2. Since the frame is rounded, it adds a very visible test for our
   clipping of rounded rectangles.
2021-07-30 20:37:34 +02:00
Florian Müllner 1728aa581c checkbutton: Activate when moving focus
Currently we update the :active property on both the previous and
new focus button. That "visually activate" the button and will
emit ::toggled, but if the button is associated with an action,
the action state won't change.

Fix that by activating the new focus instead of explicitly fiddling
with the :active property.
2021-07-30 20:34:24 +02:00
Florian Müllner c50475de34 checkbutton: Delegate ::activate to the helper if appropriate
If the button is associated with an action, the action is currently
only activated when the button is clicked, not when it is activated.
2021-07-30 20:34:24 +02:00
Matthias Clasen 06348a8517 Merge branch 'wip/chergert/fix-4134' into 'master'
textview: fix yoffset position when top_margin is set

Closes #4134

See merge request GNOME/gtk!3801
2021-07-30 13:41:30 +00:00
Matthias Clasen c4dbb8f01e imcontext: Code cleanup 2021-07-29 20:37:58 -04:00
Matthias Clasen e67b2cb54b composetable: Allow multiple dead keys
Remove the limitation on the number of dead keys
that we match, and allow the result be be multiple
characters.

Regenerate the builtin sequences, since this changes
what dead key sequences we can reproduce algorithmically.

Update tests to match.

Fixes: #10
2021-07-29 20:37:30 -04:00
Christian Hergert 908b1e5e12 textview: fix yoffset position when top_margin is set
This doesn't need to be included in the calculation or it will cause the
yoffset to continually shift while the window is resized.

Fixes #4134
2021-07-29 16:45:04 -07:00
Matthias Clasen 539391ce6c composetable: Change an API
Make gtk_check_algorithmically take a GString
for the result. This is in preparation for allowing
multi-character results here, in the future.

Update all callers.
2021-07-29 17:29:25 -04:00
Florian Müllner 23e79d2eb2 gtk/windowhandle: Delegate titlebar action to the compositor if possible
Delegating the action to the compositor not only improves consistency
with server-side decorations, but also allows for actions that aren't
available client-side (like lower-in-middle-click).

https://gitlab.gnome.org/GNOME/mutter/-/issues/602
2021-07-29 21:39:32 +02:00
Florian Müllner 0c7b1431d7 gdk/toplevel: Add gdk_toplevel_titlebar_gesture()
Where supported, this allows delegating the titlebar action to the
compositor instead of trying to replicate its behavior client-side.

https://gitlab.gnome.org/GNOME/mutter/-/issues/602
2021-07-29 21:39:32 +02:00
Matthias Clasen b6c0155836 imcontext: Handle Escape in Compose sequence
Treat Escape the same in hex sequences and in
Compose sequence: reset the state.
2021-07-29 08:39:17 -04:00
Matthias Clasen 76d67b586c imcontext: Tweak Compose sequence handling
When we don't have any matches for a Compose sequence
anymore, beep, and keep the preedit as it was for the
last match.

Fixes: #4127
2021-07-29 08:24:14 -04:00
Matthias Clasen 914edb1472 composetable: Add a prefix api
Add a function that computes the longest prefix
of a buffer for which a compose table has matches.
2021-07-29 08:23:40 -04:00
Matthias Clasen dbf5033f94 composetable: Reduce the scope of a variable
'prefix' is not a good name for a file-scope variable,
move it into the sole function using it.
2021-07-29 08:22:52 -04:00
Matthias Clasen cc6ecc8b62 Merge branch 'source-static-name' into 'master'
Avoid copying static debug strings

See merge request GNOME/gtk!3789
2021-07-29 11:59:02 +00:00
Matthias Clasen b7e6922605 imcontext: Tweak Compose sequence preedit
When sequences contain multiple Compose keys,
don't hide the first one. This is a very fringe
case, but it matches the behavior of IBus.

Fixes: #4124
2021-07-29 07:36:48 -04:00
Matthias Clasen 05eaffb9f2 ci: Collect tools test output
This should help understanding why some of them fail.
2021-07-28 22:42:46 -04:00
Matthias Clasen 67b568f464 testsuite: Set TEST_RESULT_DIR for tools tests 2021-07-28 22:42:46 -04:00
Matthias Clasen 19b534f7de Avoid copying static debug strings
The g_source_set_name calls were showing up as a
major source of strdups in our profiles. Avoid that
by using new GLib api when available.
2021-07-28 22:42:46 -04:00
Matthias Clasen db8b3419c2 Merge branch 'compose-parse-msvc' into 'master'
compose-parse.c: Include stdlib.h (fix build on Visual Studio)

See merge request GNOME/gtk!3794
2021-07-28 10:38:25 +00:00
Fabio Tomat 0f5ba5192a Update Friulian translation
(cherry picked from commit 16aa8dbad7)
2021-07-28 09:11:33 +00:00
Chun-wei Fan 108c423d70 compose-parse.c: Include stdlib.h
That is needed for exit(), and it may not have been included by the
other headers.
2021-07-28 15:18:36 +08:00
Emmanuele Bassi dded10a396 Merge branch 'gi-fix' into 'master'
gdk: add missing Since annotation

See merge request GNOME/gtk!3790
2021-07-27 17:38:28 +00:00
Marc-André Lureau 1b080826db gdk: add missing Since annotation
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-07-27 21:01:31 +04:00
Matthias Clasen 910f23ea19 Merge branch 'wip/otte/widgetfactory-dnd' into 'master'
Improve DND

See merge request GNOME/gtk!3785
2021-07-27 04:12:58 +00:00
Benjamin Otte f1b50baba1 widget-factory: Add images that support dnd
Just use the bottom left notebook for a GtkPicture with custom drag
source and drop target.
2021-07-27 04:40:57 +02:00
Matthias Clasen 4453597946 widget-factory: Some new backgrounds
Snowy wasn't ideal because of the aspect ratio.
Replace it by beach and nyc.
2021-07-27 04:40:42 +02:00
Benjamin Otte 192bfa10cb droptarget: Make formats construct-only writable
This way, it can be set in GtkBuilder.

Also make sure to only ever look at the GTypes set in the formats, as
GtkDropTarget cannot deal with mime types.
2021-07-27 04:28:04 +02:00
Benjamin Otte 0781429dc5 builder: Add support for GdkContentFormats 2021-07-27 04:28:04 +02:00
Benjamin Otte d760332f00 testsuite: Add contentformat tests 2021-07-27 04:28:04 +02:00
Benjamin Otte 131be5f2e8 contentformats: Add gdk_content_formats_parse() 2021-07-27 04:13:42 +02:00
Matthias Clasen 57a95c540c Merge branch 'matthiasc/for-master' into 'master'
ngl: Cosmetics

See merge request GNOME/gtk!3786
2021-07-26 18:21:56 +00:00
Matthias Clasen 09deb1d757 ngl: Cosmetics
Use the macro we already have to check that colors
are fully transparent.
2021-07-26 13:42:10 -04:00
Benjamin Otte 6a5d555f58 contentformats: Change the format of gdk_content_formats_to_string()
Now, we just print a whitespace-separated list of GTypes and mime types.

This makes this neat for 2 things:

1. Parsing it (see next commit)
2. Using it in GtkBuilder (see commits after that)

In particular, the common case of supporting a single GType (or mime
type) looks like just printing the GType (or mime type), which in
GtkBuilder looks like
<property name="formats">GdkTexture</property>
2021-07-26 02:28:49 +02:00
Benjamin Otte f5dc71021f dnd: Guard drags with a reference when finishing
Usually the "dnd-finished" signal will be used to unref the GdkDrag. In
those cases, we would lose the object, so that when we do the final
drag_drop_done() afterwards, we wouldn't have a remaining reference.

With the reference guard, this now works.
2021-07-26 02:18:54 +02:00
133 changed files with 6626 additions and 4267 deletions
+7 -8
View File
@@ -7,6 +7,7 @@ stages:
- analysis
- docs
- flatpak
- publish
- deploy
.cache-paths: &cache-paths
@@ -57,6 +58,7 @@ style-check-diff:
- "${CI_PROJECT_DIR}/_build/report*.xml"
- "${CI_PROJECT_DIR}/_build/report*.html"
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/tools/output/*/*"
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*/*.syscap"
- "${CI_PROJECT_DIR}/_build_hello/meson-logs"
@@ -336,14 +338,11 @@ reference:
paths:
- _reference
pages:
stage: deploy
publish-docs:
stage: publish
needs: ['reference']
script:
- mv _reference/ public/
- cp .gitlab-ci/pages/* public/
artifacts:
paths:
- public
- "curl -X POST -F token=${PAGES_TRIGGER_TOKEN} -F ref=docs-gtk-org https://gitlab.gnome.org/api/v4/projects/665/trigger/pipeline"
only:
- master
refs:
- master
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 MiB

+34 -1
View File
@@ -696,6 +696,37 @@ on_range_to_changed (GtkSpinButton *to)
gtk_spin_button_set_value (from, v2);
}
static GdkContentProvider *
on_picture_drag_prepare (GtkDragSource *source,
double x,
double y,
gpointer unused)
{
GtkWidget *picture;
picture = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
return gdk_content_provider_new_typed (GDK_TYPE_TEXTURE, gtk_picture_get_paintable (GTK_PICTURE (picture)));
}
static gboolean
on_picture_drop (GtkDropTarget *dest,
const GValue *value,
double x,
double y,
gpointer unused)
{
GtkWidget *picture;
GdkPaintable *paintable;
picture = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (dest));
paintable = g_value_get_object (value);
gtk_picture_set_paintable (GTK_PICTURE (picture), paintable);
return TRUE;
}
static void
info_bar_response (GtkWidget *infobar, int response_id)
{
@@ -1182,7 +1213,7 @@ populate_flowbox (GtkWidget *flowbox)
GtkWidget *child;
int i;
const char *resources[] = {
"sunset.jpg", "snowy.jpg", "portland-rose.jpg"
"sunset.jpg", "portland-rose.jpg", "beach.jpg", "nyc.jpg"
};
if (GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (flowbox), "populated")))
@@ -2040,6 +2071,8 @@ activate (GApplication *app)
"on_page_combo_changed", (GCallback)on_page_combo_changed,
"on_range_from_changed", (GCallback)on_range_from_changed,
"on_range_to_changed", (GCallback)on_range_to_changed,
"on_picture_drag_prepare", (GCallback)on_picture_drag_prepare,
"on_picture_drop", (GCallback)on_picture_drop,
"tab_close_cb", (GCallback)tab_close_cb,
"increase_icon_size", (GCallback)increase_icon_size,
"decrease_icon_size", (GCallback)decrease_icon_size,
@@ -115,7 +115,8 @@
<gresource prefix="/org/gtk/WidgetFactory4">
<file>gtk-logo.webm</file>
<file>sunset.jpg</file>
<file>snowy.jpg</file>
<file>portland-rose.jpg</file>
<file>nyc.jpg</file>
<file>beach.jpg</file>
</gresource>
</gresources>
+117 -80
View File
@@ -1051,22 +1051,9 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="spacing">10</property>
<property name="hexpand">1</property>
<child>
<object class="GtkFrame" id="frame1">
<property name="valign">start</property>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="label" translatable="yes">&lt;b&gt;Video&lt;/b&gt;</property>
<property name="use-markup">1</property>
</object>
</child>
<object class="GtkFrame">
<child>
<object class="GtkVideo">
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="autoplay">1</property>
<property name="loop">1</property>
<property name="file">resource:///org/gtk/WidgetFactory4/gtk-logo.webm</property>
@@ -1075,66 +1062,78 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="vexpand">1</property>
<property name="hscrollbar-policy">never</property>
<property name="vscrollbar-policy">automatic</property>
<object class="GtkFrame">
<child type="label">
<object class="GtkLabel" id="label1">
<property name="label" translatable="yes">&lt;b&gt;Text Styles&lt;/b&gt;</property>
<property name="use-markup">1</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<object class="GtkScrolledWindow">
<property name="vexpand">1</property>
<property name="hscrollbar-policy">never</property>
<property name="vscrollbar-policy">automatic</property>
<property name="propagate-natural-height">1</property>
<property name="propagate-natural-width">1</property>
<child>
<object class="GtkLabel">
<property name="label">Large Title</property>
<style><class name="large-title"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Title 1</property>
<style><class name="title-1"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Title 2</property>
<style><class name="title-2"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Title 3</property>
<style><class name="title-3"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Title 4</property>
<style><class name="title-4"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Heading</property>
<style><class name="heading"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Body</property>
<style><class name="body"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Caption Heading</property>
<style><class name="caption-heading"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Caption</property>
<style><class name="caption"/></style>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
<object class="GtkLabel">
<property name="label">Large Title</property>
<style><class name="large-title"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Title 1</property>
<style><class name="title-1"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Title 2</property>
<style><class name="title-2"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Title 3</property>
<style><class name="title-3"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Title 4</property>
<style><class name="title-4"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Heading</property>
<style><class name="heading"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Body</property>
<style><class name="body"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Caption Heading</property>
<style><class name="caption-heading"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Caption</property>
<style><class name="caption"/></style>
</object>
</child>
</object>
</child>
</object>
@@ -1251,8 +1250,21 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkBox" id="box6">
<property name="orientation">vertical</property>
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/sunset.jpg</property>
<child>
<object class="GtkDragSource">
<property name="actions">copy</property>
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
</object>
</child>
<child>
<object class="GtkDropTarget">
<property name="actions">copy</property>
<property name="formats">GdkTexture</property>
<signal name="drop" handler="on_picture_drop" swapped="no"/>
</object>
</child>
</object>
</property>
<property name="tab">
@@ -1265,8 +1277,21 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkBox" id="box7">
<property name="orientation">vertical</property>
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/nyc.jpg</property>
<child>
<object class="GtkDragSource">
<property name="actions">copy</property>
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
</object>
</child>
<child>
<object class="GtkDropTarget">
<property name="actions">copy</property>
<property name="formats">GdkTexture</property>
<signal name="drop" handler="on_picture_drop" swapped="no"/>
</object>
</child>
</object>
</property>
<property name="tab">
@@ -1278,10 +1303,22 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkNotebookPage">
<property name="position">2</property>
<property name="child">
<object class="GtkBox" id="box8">
<property name="orientation">vertical</property>
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/beach.jpg</property>
<child>
<object class="GtkDragSource">
<property name="actions">copy</property>
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
</object>
</child>
<child>
<object class="GtkDropTarget">
<property name="actions">copy</property>
<property name="formats">GdkTexture</property>
<signal name="drop" handler="on_picture_drop" swapped="no"/>
</object>
</child>
</object>
</property>
<property name="tab">
@@ -1299,7 +1336,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkBox" id="box9">
<object class="GtkBox" id="box8">
<property name="orientation">vertical</property>
</object>
</property>
+1 -1
View File
@@ -13,7 +13,7 @@ devhelp = true
[dependencies."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://developer.gnome.org/gobject/stable"
docs_url = "https://docs.gtk.org/gobject/"
[theme]
name = "basic"
+1 -1
View File
@@ -13,7 +13,7 @@ devhelp = true
[dependencies."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://developer.gnome.org/gobject/stable"
docs_url = "https://docs.gtk.org/gobject/"
[theme]
name = "basic"
+1 -1
View File
@@ -14,7 +14,7 @@ search_index = true
[dependencies."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://developer.gnome.org/gobject/stable"
docs_url = "https://docs.gtk.org/gobject/"
[dependencies."cairo-1.0"]
name = "Cairo"
+24 -4
View File
@@ -1,11 +1,15 @@
expand_content_md_files = [
]
gdk4_toml = configure_file(input: 'gdk4.toml.in', output: 'gdk4.toml', configuration: toml_conf)
gdk4x11_toml = configure_file(input: 'gdk4-x11.toml.in', output: 'gdk4-x11.toml', configuration: toml_conf)
gdk4wayland_toml = configure_file(input: 'gdk4-wayland.toml.in', output: 'gdk4-wayland.toml', configuration: toml_conf)
if get_option('gtk_doc')
gdk4_toml = configure_file(
input: 'gdk4.toml.in',
output: 'gdk4.toml',
configuration: toml_conf,
install: true,
install_dir: docs_dir / 'gdk4',
)
custom_target('gdk4-doc',
input: [ gdk4_toml, gdk_gir[0] ],
output: 'gdk4',
@@ -28,6 +32,14 @@ if get_option('gtk_doc')
)
if x11_enabled
gdk4x11_toml = configure_file(
input: 'gdk4-x11.toml.in',
output: 'gdk4-x11.toml',
configuration: toml_conf,
install: true,
install_dir: docs_dir / 'gdk4-x11',
)
custom_target('gdk4-x11-doc',
input: [ gdk4x11_toml, gdk_x11_gir[0] ],
output: 'gdk4-x11',
@@ -52,6 +64,14 @@ if get_option('gtk_doc')
endif
if wayland_enabled
gdk4wayland_toml = configure_file(
input: 'gdk4-wayland.toml.in',
output: 'gdk4-wayland.toml',
configuration: toml_conf,
install: true,
install_dir: docs_dir / 'gdk4-wayland',
)
custom_target('gdk4-wayland-doc',
input: [ gdk4wayland_toml, gdk_wayland_gir[0] ],
output: 'gdk4-wayland',
+10 -7
View File
@@ -3,11 +3,14 @@
// A map between namespaces and base URLs for their online documentation
baseURLs = [
[ 'Gdk', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4/' ],
[ 'GdkWayland', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-wayland/' ],
[ 'GdkX11', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-x11/' ],
[ 'Gsk', 'https://gnome.pages.gitlab.gnome.org/gtk/gsk4/' ],
[ 'Gtk', 'https://gnome.pages.gitlab.gnome.org/gtk/gtk4/' ],
[ 'Pango', 'https://gnome.pages/gitlab.gnome.org/pango/pango/' ],
[ 'PangoCairo', 'https://gnome.pages.gitlab.gnome.org/pango/pangocairo/' ],
[ 'GLib', 'https://docs.gtk.org/glib/' ],
[ 'GObject', 'https://docs.gtk.org/gobject/' ],
[ 'Gio', 'https://docs.gtk.org/gio/' ],
[ 'Gdk', 'https://docs.gtk.org/gdk4/' ],
[ 'GdkWayland', 'https://docs.gtk.org/gdk4-wayland/' ],
[ 'GdkX11', 'https://docs.gtk.org/gdk4-x11/' ],
[ 'Gsk', 'https://docs.gtk.org/gsk4/' ],
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
]
+1 -1
View File
@@ -14,7 +14,7 @@ search_index = true
[dependencies."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://developer.gnome.org/gobject/stable/"
docs_url = "https://docs.gtk.org/gobject/"
[dependencies."Graphene-1.0"]
name = "Graphene"
+8 -2
View File
@@ -1,6 +1,12 @@
gsk4_toml = configure_file(input: 'gsk4.toml.in', output: 'gsk4.toml', configuration: toml_conf)
if get_option('gtk_doc')
gsk4_toml = configure_file(
input: 'gsk4.toml.in',
output: 'gsk4.toml',
configuration: toml_conf,
install: true,
install_dir: docs_dir / 'gsk4',
)
custom_target('gsk4-doc',
input: [ gsk4_toml, gsk_gir[0] ],
output: 'gsk4',
+10 -7
View File
@@ -3,11 +3,14 @@
// A map between namespaces and base URLs for their online documentation
baseURLs = [
[ 'Gdk', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4/' ],
[ 'GdkWayland', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-wayland/' ],
[ 'GdkX11', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-x11/' ],
[ 'Gsk', 'https://gnome.pages.gitlab.gnome.org/gtk/gsk4/' ],
[ 'Gtk', 'https://gnome.pages.gitlab.gnome.org/gtk/gtk4/' ],
[ 'Pango', 'https://gnome.pages/gitlab.gnome.org/pango/pango/' ],
[ 'PangoCairo', 'https://gnome.pages.gitlab.gnome.org/pango/pangocairo/' ],
[ 'GLib', 'https://docs.gtk.org/glib/' ],
[ 'GObject', 'https://docs.gtk.org/gobject/' ],
[ 'Gio', 'https://docs.gtk.org/gio/' ],
[ 'Gdk', 'https://docs.gtk.org/gdk4/' ],
[ 'GdkWayland', 'https://docs.gtk.org/gdk4-wayland/' ],
[ 'GdkX11', 'https://docs.gtk.org/gdk4-x11/' ],
[ 'Gsk', 'https://docs.gtk.org/gsk4/' ],
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
]
+1 -1
View File
@@ -14,7 +14,7 @@ search_index = true
[dependencies."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://developer.gnome.org/gobject/stable"
docs_url = "https://docs.gtk.org/gobject/"
[dependencies."Graphene-1.0"]
name = "Graphene"
+8 -2
View File
@@ -27,9 +27,15 @@ expand_content_md_files = [
'visual_index.md'
]
gtk4_toml = configure_file(input: 'gtk4.toml.in', output: 'gtk4.toml', configuration: toml_conf)
if get_option('gtk_doc')
gtk4_toml = configure_file(
input: 'gtk4.toml.in',
output: 'gtk4.toml',
configuration: toml_conf,
install: true,
install_dir: docs_dir / 'gtk4',
)
custom_target('gtk4-doc',
input: [ gtk4_toml, gtk_gir[0] ],
output: 'gtk4',
+10 -7
View File
@@ -3,11 +3,14 @@
// A map between namespaces and base URLs for their online documentation
baseURLs = [
[ 'Gdk', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4/' ],
[ 'GdkWayland', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-wayland/' ],
[ 'GdkX11', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-x11/' ],
[ 'Gsk', 'https://gnome.pages.gitlab.gnome.org/gtk/gsk4/' ],
[ 'Gtk', 'https://gnome.pages.gitlab.gnome.org/gtk/gtk4/' ],
[ 'Pango', 'https://gnome.pages/gitlab.gnome.org/pango/pango/' ],
[ 'PangoCairo', 'https://gnome.pages.gitlab.gnome.org/pango/pangocairo/' ],
[ 'GLib', 'https://docs.gtk.org/glib/' ],
[ 'GObject', 'https://docs.gtk.org/gobject/' ],
[ 'Gio', 'https://docs.gtk.org/gio/' ],
[ 'Gdk', 'https://docs.gtk.org/gdk4/' ],
[ 'GdkWayland', 'https://docs.gtk.org/gdk4-wayland/' ],
[ 'GdkX11', 'https://docs.gtk.org/gdk4-x11/' ],
[ 'Gsk', 'https://docs.gtk.org/gsk4/' ],
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
]
+2 -1
View File
@@ -33,6 +33,7 @@
#include "gdkinternals.h"
#include "gdkdeviceprivate.h"
#include <gdk/gdktextureprivate.h>
#include "gdk-private.h"
#include <glib.h>
#include <glib/gprintf.h>
@@ -463,7 +464,7 @@ gdk_broadway_display_flush_in_idle (GdkDisplay *display)
if (broadway_display->idle_flush_id == 0)
{
broadway_display->idle_flush_id = g_idle_add (flush_idle, g_object_ref (display));
g_source_set_name_by_id (broadway_display->idle_flush_id, "[gtk] flush_idle");
gdk_source_set_static_name_by_id (broadway_display->idle_flush_id, "[gtk] flush_idle");
}
}
+7
View File
@@ -57,4 +57,11 @@ guint gdk_parse_debug_var (const char *variable,
# define g_memdup2(mem,size) g_memdup((mem),(size))
#endif
void gdk_source_set_static_name_by_id (guint tag,
const char *name);
#if !GLIB_CHECK_VERSION(2, 69, 1)
#define g_source_set_static_name(source, name) g_source_set_name ((source), (name))
#endif
#endif /* __GDK__PRIVATE_H__ */
+14
View File
@@ -414,3 +414,17 @@ gdk_find_base_dir (const char *text,
return dir;
}
void
gdk_source_set_static_name_by_id (guint tag,
const char *name)
{
GSource *source;
g_return_if_fail (tag > 0);
source = g_main_context_find_source_by_id (NULL, tag);
if (source == NULL)
return;
g_source_set_static_name (source, name);
}
+76 -8
View File
@@ -179,6 +179,76 @@ gdk_content_formats_new_for_gtype (GType type)
return gdk_content_formats_new_take (data, 1, NULL, 0);
}
/**
* gdk_content_formats_parse:
* @string: the string to parse
*
* Parses the given @string into `GdkContentFormats` and
* returns the formats.
*
* Strings printed via [method@Gdk.ContentFormats.to_string]
* can be read in again successfully using this function.
*
* If @string does not describe valid content formats, %NULL
* is returned.
*
* Returns: (nullable): the content formats if @string is valid
*
* Since: 4.4
*/
GdkContentFormats *
gdk_content_formats_parse (const char *string)
{
GdkContentFormatsBuilder *builder;
char **split;
gsize i;
g_return_val_if_fail (string != NULL, NULL);
split = g_strsplit_set (string, "\t\n\f\r ", -1); /* same as g_ascii_isspace() */
builder = gdk_content_formats_builder_new ();
/* first the GTypes */
for (i = 0; split[i] != NULL; i++)
{
GType type;
if (split[i][0] == 0)
continue;
type = g_type_from_name (split[i]);
if (type != 0)
gdk_content_formats_builder_add_gtype (builder, type);
else
break;
}
/* then the mime types */
for (; split[i] != NULL; i++)
{
const char *mime_type;
if (split[i][0] == 0)
continue;
mime_type = gdk_intern_mime_type (split[i]);
if (mime_type)
gdk_content_formats_builder_add_mime_type (builder, mime_type);
else
break;
}
if (split[i] != NULL)
{
g_strfreev (split);
gdk_content_formats_builder_unref (builder);
return NULL;
}
g_strfreev (split);
return gdk_content_formats_builder_free_to_formats (builder);
}
/**
* gdk_content_formats_ref:
* @formats: a `GdkContentFormats`
@@ -227,10 +297,8 @@ gdk_content_formats_unref (GdkContentFormats *formats)
*
* Prints the given @formats into a string for human consumption.
*
* This is meant for debugging and logging.
*
* The form of the representation may change at any time and is
* not guaranteed to stay identical.
* The result of this function can later be parsed with
* [func@Gdk.ContentFormats.parse].
*/
void
gdk_content_formats_print (GdkContentFormats *formats,
@@ -241,20 +309,18 @@ gdk_content_formats_print (GdkContentFormats *formats,
g_return_if_fail (formats != NULL);
g_return_if_fail (string != NULL);
g_string_append (string, "{ ");
for (i = 0; i < formats->n_gtypes; i++)
{
if (i > 0)
g_string_append (string, ", ");
g_string_append (string, " ");
g_string_append (string, g_type_name (formats->gtypes[i]));
}
for (i = 0; i < formats->n_mime_types; i++)
{
if (i > 0 || formats->n_gtypes > 0)
g_string_append (string, ", ");
g_string_append (string, " ");
g_string_append (string, formats->mime_types[i]);
}
g_string_append (string, " }");
}
/**
@@ -263,6 +329,8 @@ gdk_content_formats_print (GdkContentFormats *formats,
*
* Prints the given @formats into a human-readable string.
*
* The resulting string can be parsed with [func@Gdk.ContentFormats.parse].
*
* This is a small wrapper around [method@Gdk.ContentFormats.print]
* to help when debugging.
*
+2
View File
@@ -40,6 +40,8 @@ GdkContentFormats * gdk_content_formats_new (const char
guint n_mime_types);
GDK_AVAILABLE_IN_ALL
GdkContentFormats * gdk_content_formats_new_for_gtype (GType type);
GDK_AVAILABLE_IN_4_4
GdkContentFormats * gdk_content_formats_parse (const char *string);
GDK_AVAILABLE_IN_ALL
GdkContentFormats * gdk_content_formats_ref (GdkContentFormats *formats);
GDK_AVAILABLE_IN_ALL
+6 -2
View File
@@ -29,6 +29,7 @@
#include "gdkinternals.h"
#include "gdkframeclockprivate.h"
#include "gdk.h"
#include "gdk-private.h"
#include "gdkprofilerprivate.h"
#ifdef G_OS_WIN32
@@ -307,12 +308,15 @@ maybe_start_idle (GdkFrameClockIdle *clock_idle,
if (priv->flush_idle_id == 0 && RUN_FLUSH_IDLE (priv))
{
GSource *source;
priv->flush_idle_id = g_timeout_add_full (GDK_PRIORITY_EVENTS + 1,
min_interval,
gdk_frame_clock_flush_idle,
g_object_ref (clock_idle),
(GDestroyNotify) g_object_unref);
g_source_set_name_by_id (priv->flush_idle_id, "[gtk] gdk_frame_clock_flush_idle");
source = g_main_context_find_source_by_id (NULL, priv->flush_idle_id);
g_source_set_static_name (source, "[gtk] gdk_frame_clock_flush_idle");
}
if (!priv->in_paint_idle &&
@@ -324,7 +328,7 @@ maybe_start_idle (GdkFrameClockIdle *clock_idle,
gdk_frame_clock_paint_idle,
g_object_ref (clock_idle),
(GDestroyNotify) g_object_unref);
g_source_set_name_by_id (priv->paint_idle_id, "[gtk] gdk_frame_clock_paint_idle");
gdk_source_set_static_name_by_id (priv->paint_idle_id, "[gtk] gdk_frame_clock_paint_idle");
}
}
}
+2
View File
@@ -856,6 +856,8 @@ gdk_gl_context_set_is_legacy (GdkGLContext *context,
* is not, this function will return %FALSE.
*
* Returns: %TRUE if the two GL contexts are compatible.
*
* Since: 4.4
*/
gboolean
gdk_gl_context_is_shared (GdkGLContext *self,
+18
View File
@@ -78,6 +78,13 @@ gdk_toplevel_default_show_window_menu (GdkToplevel *toplevel,
return FALSE;
}
static gboolean
gdk_toplevel_default_titlebar_gesture (GdkToplevel *toplevel,
GdkTitlebarGesture gesture)
{
return FALSE;
}
static gboolean
gdk_toplevel_default_supports_edge_constraints (GdkToplevel *toplevel)
{
@@ -114,6 +121,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
iface->supports_edge_constraints = gdk_toplevel_default_supports_edge_constraints;
iface->inhibit_system_shortcuts = gdk_toplevel_default_inhibit_system_shortcuts;
iface->restore_system_shortcuts = gdk_toplevel_default_restore_system_shortcuts;
iface->titlebar_gesture = gdk_toplevel_default_titlebar_gesture;
/**
* GdkToplevel:state: (attributes org.gtk.Property.get=gdk_toplevel_get_state)
@@ -716,3 +724,13 @@ gdk_toplevel_begin_move (GdkToplevel *toplevel,
x, y,
timestamp);
}
gboolean
gdk_toplevel_titlebar_gesture (GdkToplevel *toplevel,
GdkTitlebarGesture gesture)
{
g_return_val_if_fail (GDK_IS_TOPLEVEL (toplevel), FALSE);
return GDK_TOPLEVEL_GET_IFACE (toplevel)->titlebar_gesture (toplevel,
gesture);
}
+11
View File
@@ -115,6 +115,13 @@ typedef enum
GDK_TOPLEVEL_STATE_LEFT_RESIZABLE = 1 << 15
} GdkToplevelState;
typedef enum
{
GDK_TITLEBAR_GESTURE_DOUBLE_CLICK = 1,
GDK_TITLEBAR_GESTURE_RIGHT_CLICK = 2,
GDK_TITLEBAR_GESTURE_MIDDLE_CLICK = 3
} GdkTitlebarGesture;
#define GDK_TYPE_TOPLEVEL (gdk_toplevel_get_type ())
@@ -196,6 +203,10 @@ void gdk_toplevel_begin_move (GdkToplevel *toplevel,
double y,
guint32 timestamp);
GDK_AVAILABLE_IN_4_4
gboolean gdk_toplevel_titlebar_gesture (GdkToplevel *toplevel,
GdkTitlebarGesture gesture);
G_END_DECLS
#endif /* __GDK_TOPLEVEL_H__ */
+2
View File
@@ -38,6 +38,8 @@ struct _GdkToplevelInterface
double x,
double y,
guint32 timestamp);
gboolean (* titlebar_gesture) (GdkToplevel *toplevel,
GdkTitlebarGesture gesture);
};
typedef enum
+1 -1
View File
@@ -197,7 +197,7 @@ gdk_display_link_source_new (void)
gdk_display_link_source_frame_cb,
source);
g_source_set_name (source, "[gdk] quartz frame clock");
g_source_set_static_name (source, "[gdk] quartz frame clock");
return source;
}
+4 -1
View File
@@ -21,6 +21,7 @@
#include "gdkdeviceprivate.h"
#include "gdkintl.h"
#include "gdk-private.h"
#include "gdkmacosdevice-private.h"
#include "gdkmacoscursor-private.h"
@@ -161,7 +162,7 @@ gdk_macos_drag_drop_done (GdkDrag *drag,
gdk_macos_zoomback_timeout,
zb,
(GDestroyNotify) gdk_macos_zoomback_destroy);
g_source_set_name_by_id (id, "[gtk] gdk_macos_zoomback_timeout");
gdk_source_set_static_name_by_id (id, "[gtk] gdk_macos_zoomback_timeout");
g_object_unref (drag);
}
@@ -242,9 +243,11 @@ gdk_macos_drag_drop_performed (GdkDrag *drag,
g_assert (GDK_IS_MACOS_DRAG (self));
g_object_ref (self);
drag_ungrab (self);
g_signal_emit_by_name (drag, "dnd-finished");
gdk_drag_drop_done (drag, TRUE);
g_object_unref (self);
}
static void
+1 -1
View File
@@ -1063,7 +1063,7 @@ _gdk_macos_event_source_new (GdkMacosDisplay *display)
event_poll_fd.fd = -1;
source = g_source_new (&event_funcs, sizeof (GdkMacosEventSource));
g_source_set_name (source, "GDK Quartz event source");
g_source_set_static_name (source, "GDK Quartz event source");
g_source_add_poll (source, &event_poll_fd);
g_source_set_priority (source, GDK_PRIORITY_EVENTS);
g_source_set_can_recurse (source, TRUE);
+4 -2
View File
@@ -460,6 +460,7 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
pointer->cursor_timeout_id == 0)
{
guint id;
GSource *source;
gdk_wayland_pointer_stop_cursor_animation (pointer);
@@ -467,7 +468,8 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
id = g_timeout_add (next_image_delay,
(GSourceFunc) gdk_wayland_device_update_surface_cursor,
device);
g_source_set_name_by_id (id, "[gtk] gdk_wayland_device_update_surface_cursor");
source = g_main_context_find_source_by_id (NULL, id);
g_source_set_static_name (source, "[gtk] gdk_wayland_device_update_surface_cursor");
pointer->cursor_timeout_id = id;
}
else
@@ -2218,7 +2220,7 @@ deliver_key_event (GdkWaylandSeat *seat,
timeout = (seat->repeat_deadline - now) / 1000L;
seat->repeat_timer = g_timeout_add (timeout, keyboard_repeat, seat);
g_source_set_name_by_id (seat->repeat_timer, "[gtk] keyboard_repeat");
gdk_source_set_static_name_by_id (seat->repeat_timer, "[gtk] keyboard_repeat");
}
static void
+1 -1
View File
@@ -87,7 +87,7 @@
#define MIN_SYSTEM_BELL_DELAY_MS 20
#define GTK_SHELL1_VERSION 4
#define GTK_SHELL1_VERSION 5
#define OUTPUT_VERSION_WITH_DONE 2
#define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3
#define XDG_ACTIVATION_VERSION 1
+2
View File
@@ -290,8 +290,10 @@ data_source_dnd_finished (void *data,
{
GdkDrag *drag = data;
g_object_ref (drag);
g_signal_emit_by_name (drag, "dnd-finished");
gdk_drag_drop_done (drag, TRUE);
g_object_unref (drag);
}
static void
+67
View File
@@ -4190,6 +4190,65 @@ gdk_wayland_surface_show_window_menu (GdkSurface *surface,
return TRUE;
}
static gboolean
translate_gesture (GdkTitlebarGesture gesture,
enum gtk_surface1_gesture *out_gesture)
{
switch (gesture)
{
case GDK_TITLEBAR_GESTURE_DOUBLE_CLICK:
*out_gesture = GTK_SURFACE1_GESTURE_DOUBLE_CLICK;
break;
case GDK_TITLEBAR_GESTURE_RIGHT_CLICK:
*out_gesture = GTK_SURFACE1_GESTURE_RIGHT_CLICK;
break;
case GDK_TITLEBAR_GESTURE_MIDDLE_CLICK:
*out_gesture = GTK_SURFACE1_GESTURE_MIDDLE_CLICK;
break;
default:
g_warning ("Not handling unknown titlebar gesture %u", gesture);
return FALSE;
}
return TRUE;
}
static gboolean
gdk_wayland_surface_titlebar_gesture (GdkSurface *surface,
GdkTitlebarGesture gesture)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
struct gtk_surface1 *gtk_surface = impl->display_server.gtk_surface;
enum gtk_surface1_gesture gtk_gesture;
GdkSeat *seat;
struct wl_seat *wl_seat;
uint32_t serial;
if (!gtk_surface)
return FALSE;
if (gtk_surface1_get_version (gtk_surface) < GTK_SURFACE1_TITLEBAR_GESTURE_SINCE_VERSION)
return FALSE;
if (!translate_gesture (gesture, &gtk_gesture))
return FALSE;
seat = gdk_display_get_default_seat (surface->display);
wl_seat = gdk_wayland_seat_get_wl_seat (seat);
serial = _gdk_wayland_seat_get_last_implicit_grab_serial (GDK_WAYLAND_SEAT (seat), NULL);
gtk_surface1_titlebar_gesture (impl->display_server.gtk_surface,
serial,
wl_seat,
gtk_gesture);
return TRUE;
}
static gboolean
gdk_wayland_surface_supports_edge_constraints (GdkSurface *surface)
{
@@ -4987,6 +5046,13 @@ gdk_wayland_toplevel_show_window_menu (GdkToplevel *toplevel,
return gdk_wayland_surface_show_window_menu (GDK_SURFACE (toplevel), event);
}
static gboolean
gdk_wayland_toplevel_titlebar_gesture (GdkToplevel *toplevel,
GdkTitlebarGesture gesture)
{
return gdk_wayland_surface_titlebar_gesture (GDK_SURFACE (toplevel), gesture);
}
static gboolean
gdk_wayland_toplevel_supports_edge_constraints (GdkToplevel *toplevel)
{
@@ -5065,6 +5131,7 @@ gdk_wayland_toplevel_iface_init (GdkToplevelInterface *iface)
iface->lower = gdk_wayland_toplevel_lower;
iface->focus = gdk_wayland_toplevel_focus;
iface->show_window_menu = gdk_wayland_toplevel_show_window_menu;
iface->titlebar_gesture = gdk_wayland_toplevel_titlebar_gesture;
iface->supports_edge_constraints = gdk_wayland_toplevel_supports_edge_constraints;
iface->inhibit_system_shortcuts = gdk_wayland_toplevel_inhibit_system_shortcuts;
iface->restore_system_shortcuts = gdk_wayland_toplevel_restore_system_shortcuts;
+19 -2
View File
@@ -1,6 +1,6 @@
<protocol name="gtk">
<interface name="gtk_shell1" version="4">
<interface name="gtk_shell1" version="5">
<description summary="gtk specific extensions">
gtk_shell is a protocol extension providing additional features for
clients implementing it.
@@ -35,7 +35,7 @@
</request>
</interface>
<interface name="gtk_surface1" version="4">
<interface name="gtk_surface1" version="5">
<request name="set_dbus_properties">
<arg name="application_id" type="string" allow-null="true"/>
<arg name="app_menu_path" type="string" allow-null="true"/>
@@ -85,6 +85,23 @@
<!-- Version 4 additions -->
<request name="release" type="destructor" since="4"/>
<!-- Version 5 additions -->
<enum name="gesture" since="5">
<entry name="double_click" value="1"/>
<entry name="right_click" value="2"/>
<entry name="middle_click" value="3"/>
</enum>
<enum name="error" since="5">
<entry name="invalid_gesture" value="0"/>
</enum>
<request name="titlebar_gesture" since="5">
<arg name="serial" type="uint"/>
<arg name="seat" type="object" interface="wl_seat"/>
<arg name="gesture" type="uint" enum="gesture"/>
</request>
</interface>
</protocol>
+3 -1
View File
@@ -27,6 +27,8 @@
#include "config.h"
#include <string.h>
#include "gdk-private.h"
#include <io.h>
#include <fcntl.h>
#include <math.h>
@@ -2196,7 +2198,7 @@ gdk_win32_drag_drop_done (GdkDrag *drag,
id = g_timeout_add_full (G_PRIORITY_DEFAULT, 17,
gdk_drag_anim_timeout, anim,
(GDestroyNotify) gdk_drag_anim_destroy);
g_source_set_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
gdk_source_set_static_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
}
static gboolean
+2 -1
View File
@@ -61,6 +61,7 @@
#include "gdkdisplay-win32.h"
//#include "gdkselection-win32.h"
#include "gdkdragprivate.h"
#include "gdk-private.h"
#include <windowsx.h>
@@ -502,7 +503,7 @@ _gdk_events_init (GdkDisplay *display)
#endif
source = g_source_new (&event_funcs, sizeof (GdkWin32EventSource));
g_source_set_name (source, "GDK Win32 event source");
g_source_set_static_name (source, "GDK Win32 event source");
g_source_set_priority (source, GDK_PRIORITY_EVENTS);
event_source = (GdkWin32EventSource *)source;
+3 -2
View File
@@ -25,6 +25,7 @@
#include "gdkintl.h"
#include "gdkprivate-x11.h"
#include "gdkdisplay-x11.h"
#include "gdk-private.h"
#include <glib.h>
#ifdef HAVE_DESKTOPAPPINFO
@@ -219,7 +220,7 @@ startup_timeout (void *data)
std->timeout_id = 0;
else {
std->timeout_id = g_timeout_add_seconds ((min_timeout + 500)/1000, startup_timeout, std);
g_source_set_name_by_id (std->timeout_id, "[gtk] startup_timeout");
gdk_source_set_static_name_by_id (std->timeout_id, "[gtk] startup_timeout");
}
/* always remove this one, but we may have reinstalled another one. */
@@ -256,7 +257,7 @@ add_startup_timeout (GdkX11Screen *screen,
if (data->timeout_id == 0) {
data->timeout_id = g_timeout_add_seconds (STARTUP_TIMEOUT_LENGTH_SECONDS,
startup_timeout, data);
g_source_set_name_by_id (data->timeout_id, "[gtk] startup_timeout");
gdk_source_set_static_name_by_id (data->timeout_id, "[gtk] startup_timeout");
}
}
+3 -2
View File
@@ -46,6 +46,7 @@ in this Software without prior written authorization from The Open Group.
#include "gdkasync.h"
#include "gdkprivate-x11.h"
#include "gdkdisplay-x11.h"
#include "gdk-private.h"
#include <X11/Xlibint.h>
@@ -171,7 +172,7 @@ send_event_handler (Display *dpy,
{
guint id;
id = g_idle_add (callback_idle, state);
g_source_set_name_by_id (id, "[gtk] callback_idle");
gdk_source_set_static_name_by_id (id, "[gtk] callback_idle");
}
DeqAsyncHandler(state->dpy, &state->async);
@@ -707,7 +708,7 @@ roundtrip_handler (Display *dpy,
{
guint id;
id = g_idle_add (roundtrip_callback_idle, state);
g_source_set_name_by_id (id, "[gtk] roundtrip_callback_idle");
gdk_source_set_static_name_by_id (id, "[gtk] roundtrip_callback_idle");
}
DeqAsyncHandler(state->dpy, &state->async);
+3
View File
@@ -204,6 +204,9 @@ static void
gdk_x11_display_init (GdkX11Display *self)
{
self->monitors = g_list_store_new (GDK_TYPE_MONITOR);
self->program_class = g_strdup (g_get_prgname ());
if (self->program_class && self->program_class[0])
self->program_class[0] = g_ascii_toupper (self->program_class[0]);
}
static void
+3 -1
View File
@@ -884,8 +884,10 @@ gdk_x11_drag_handle_finished (GdkDisplay *display,
if (drag_x11->version == 5)
drag_x11->drop_failed = xevent->xclient.data.l[1] == 0;
g_object_ref (drag);
g_signal_emit_by_name (drag, "dnd-finished");
gdk_drag_drop_done (drag, !drag_x11->drop_failed);
g_object_unref (drag);
}
}
@@ -1862,7 +1864,7 @@ gdk_x11_drag_drop_done (GdkDrag *drag,
id = g_timeout_add_full (G_PRIORITY_DEFAULT, 17,
gdk_drag_anim_timeout, anim,
(GDestroyNotify) gdk_drag_anim_destroy);
g_source_set_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
gdk_source_set_static_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
g_object_unref (drag);
}
+75 -22
View File
@@ -30,7 +30,7 @@
#include "gdk/gdktextureprivate.h"
#include "gdk/gdk-private.h"
#include <cairo-ft.h>
#include <hb-ot.h>
static inline void
gsk_cairo_rectangle (cairo_t *cr,
@@ -2146,7 +2146,7 @@ gsk_outset_shadow_get_extents (GskOutsetShadowNode *self,
{
float clip_radius;
clip_radius = gsk_cairo_blur_compute_pixels (self->blur_radius);
clip_radius = gsk_cairo_blur_compute_pixels (self->blur_radius / 2.0);
*top = MAX (0, clip_radius + self->spread - self->dy);
*right = MAX (0, ceil (clip_radius + self->spread + self->dx));
*bottom = MAX (0, ceil (clip_radius + self->spread + self->dy));
@@ -3852,7 +3852,7 @@ gsk_shadow_node_diff (GskRenderNode *node1,
return;
}
clip_radius = gsk_cairo_blur_compute_pixels (shadow1->radius);
clip_radius = gsk_cairo_blur_compute_pixels (shadow1->radius / 2.0);
top = MAX (top, ceil (clip_radius - shadow1->dy));
right = MAX (right, ceil (clip_radius + shadow1->dx));
bottom = MAX (bottom, ceil (clip_radius + shadow1->dy));
@@ -3886,7 +3886,7 @@ gsk_shadow_node_get_bounds (GskShadowNode *self,
for (i = 0; i < self->n_shadows; i++)
{
float clip_radius = gsk_cairo_blur_compute_pixels (self->shadows[i].radius);
float clip_radius = gsk_cairo_blur_compute_pixels (self->shadows[i].radius / 2.0);
top = MAX (top, clip_radius - self->shadows[i].dy);
right = MAX (right, clip_radius + self->shadows[i].dx);
bottom = MAX (bottom, clip_radius + self->shadows[i].dy);
@@ -4377,6 +4377,15 @@ gsk_text_node_draw (GskRenderNode *node,
cairo_restore (cr);
}
/* We steal one of the bits in PangoGlyphVisAttr */
G_STATIC_ASSERT (sizeof (PangoGlyphVisAttr) == 4);
#define COLOR_GLYPH_BIT 2
#define GLYPH_IS_COLOR(g) (((*(guint32*)&(g)->attr) & COLOR_GLYPH_BIT) != 0)
#define GLYPH_SET_COLOR(g) (*(guint32*)(&(g)->attr) |= COLOR_GLYPH_BIT)
#define GLYPH_CLEAR_COLOR(g) (*(guint32*)(&(g)->attr) &= ~COLOR_GLYPH_BIT)
static void
gsk_text_node_diff (GskRenderNode *node1,
GskRenderNode *node2,
@@ -4401,7 +4410,8 @@ gsk_text_node_diff (GskRenderNode *node1,
info1->geometry.width == info2->geometry.width &&
info1->geometry.x_offset == info2->geometry.x_offset &&
info1->geometry.y_offset == info2->geometry.y_offset &&
info1->attr.is_cluster_start == info2->attr.is_cluster_start)
info1->attr.is_cluster_start == info2->attr.is_cluster_start &&
GLYPH_IS_COLOR (info1) == GLYPH_IS_COLOR (info2))
continue;
gsk_render_node_diff_impossible (node1, node2, region);
@@ -4415,20 +4425,43 @@ gsk_text_node_diff (GskRenderNode *node1,
}
static gboolean
font_has_color_glyphs (const PangoFont *font)
font_has_color_glyphs (PangoFont *font)
{
cairo_scaled_font_t *scaled_font;
gboolean has_color = FALSE;
hb_face_t *face = hb_font_get_face (pango_font_get_hb_font (font));
scaled_font = pango_cairo_font_get_scaled_font ((PangoCairoFont *)font);
if (cairo_scaled_font_get_type (scaled_font) == CAIRO_FONT_TYPE_FT)
return hb_ot_color_has_layers (face) ||
hb_ot_color_has_png (face) ||
hb_ot_color_has_svg (face);
}
static gboolean
glyph_has_color (PangoFont *font,
guint glyph)
{
hb_font_t *hb_font = pango_font_get_hb_font (font);
hb_face_t *face = hb_font_get_face (hb_font);
hb_blob_t *blob;
if (hb_ot_color_glyph_get_layers (face, glyph, 0, NULL, NULL) > 0)
return TRUE;
blob = hb_ot_color_glyph_reference_png (hb_font, glyph);
if (blob)
{
FT_Face ft_face = cairo_ft_scaled_font_lock_face (scaled_font);
has_color = (FT_HAS_COLOR (ft_face) != 0);
cairo_ft_scaled_font_unlock_face (scaled_font);
guint length = hb_blob_get_length (blob);
hb_blob_destroy (blob);
return length > 0;
}
return has_color;
blob = hb_ot_color_glyph_reference_svg (face, glyph);
if (blob)
{
guint length = hb_blob_get_length (blob);
hb_blob_destroy (blob);
return length > 0;
}
return FALSE;
}
/**
@@ -4454,6 +4487,9 @@ gsk_text_node_new (PangoFont *font,
GskTextNode *self;
GskRenderNode *node;
PangoRectangle ink_rect;
PangoGlyphInfo *glyph_infos;
gboolean has_color_glyphs;
int n;
pango_glyph_string_extents (glyphs, font, &ink_rect, NULL);
pango_extents_to_pixels (&ink_rect, NULL);
@@ -4466,19 +4502,36 @@ gsk_text_node_new (PangoFont *font,
node = (GskRenderNode *) self;
self->font = g_object_ref (font);
self->has_color_glyphs = font_has_color_glyphs (font);
self->color = *color;
self->offset = *offset;
self->glyphs = g_malloc_n (glyphs->num_glyphs, sizeof (PangoGlyphInfo));
self->has_color_glyphs = FALSE;
/* skip empty glyphs */
self->num_glyphs = 0;
glyph_infos = g_malloc_n (glyphs->num_glyphs, sizeof (PangoGlyphInfo));
has_color_glyphs = font_has_color_glyphs (font);
n = 0;
for (int i = 0; i < glyphs->num_glyphs; i++)
{
if (glyphs->glyphs[i].glyph != PANGO_GLYPH_EMPTY)
self->glyphs[self->num_glyphs++] = glyphs->glyphs[i];
/* skip empty glyphs */
if (glyphs->glyphs[i].glyph == PANGO_GLYPH_EMPTY)
continue;
glyph_infos[n] = glyphs->glyphs[i];
GLYPH_CLEAR_COLOR (&glyph_infos[n]);
if (has_color_glyphs &&
glyph_has_color (font, glyph_infos[n].glyph))
{
self->has_color_glyphs = TRUE;
GLYPH_SET_COLOR (&glyph_infos[n]);
}
n++;
}
self->glyphs = glyph_infos;
self->num_glyphs = n;
graphene_rect_init (&node->bounds,
offset->x + ink_rect.x - 1,
offset->y + ink_rect.y - 1,
@@ -4813,7 +4866,7 @@ gsk_blur_node_diff (GskRenderNode *node1,
cairo_region_t *sub;
int i, n, clip_radius;
clip_radius = ceil (gsk_cairo_blur_compute_pixels (self1->radius));
clip_radius = ceil (gsk_cairo_blur_compute_pixels (self1->radius / 2.0));
sub = cairo_region_create ();
gsk_render_node_diff (self1->child, self2->child, sub);
@@ -4860,7 +4913,7 @@ gsk_blur_node_new (GskRenderNode *child,
self->child = gsk_render_node_ref (child);
self->radius = radius;
clip_radius = gsk_cairo_blur_compute_pixels (radius);
clip_radius = gsk_cairo_blur_compute_pixels (radius / 2.0);
graphene_rect_init_from_rect (&node->bounds, &child->bounds);
graphene_rect_inset (&self->render_node.bounds,
+5 -13
View File
@@ -165,8 +165,7 @@ render_glyph (cairo_surface_t *surface,
const GskNglGlyphValue *value)
{
cairo_t *cr;
PangoGlyphString glyph_string;
PangoGlyphInfo glyph_info;
cairo_glyph_t glyph;
g_assert (surface != NULL);
g_assert (scaled_font != NULL);
@@ -175,18 +174,11 @@ render_glyph (cairo_surface_t *surface,
cairo_set_scaled_font (cr, scaled_font);
cairo_set_source_rgba (cr, 1, 1, 1, 1);
glyph_info.glyph = key->glyph;
glyph_info.geometry.width = value->ink_rect.width * 1024;
if (glyph_info.glyph & PANGO_GLYPH_UNKNOWN_FLAG)
glyph_info.geometry.x_offset = 256 * key->xshift;
else
glyph_info.geometry.x_offset = 256 * key->xshift - value->ink_rect.x * 1024;
glyph_info.geometry.y_offset = 256 * key->yshift - value->ink_rect.y * 1024;
glyph.index = key->glyph;
glyph.x = 0.25 * key->xshift - value->ink_rect.x;
glyph.y = 0.25 * key->yshift - value->ink_rect.y;
glyph_string.num_glyphs = 1;
glyph_string.glyphs = &glyph_info;
pango_cairo_show_glyph_string (cr, key->font, &glyph_string);
cairo_show_glyphs (cr, &glyph, 1);
cairo_destroy (cr);
cairo_surface_flush (surface);
+19 -11
View File
@@ -1397,7 +1397,7 @@ gsk_ngl_render_job_visit_color_node (GskNglRenderJob *job,
GskNglCommandBatch *batch;
rgba = gsk_color_node_get_color (node);
if (gdk_rgba_is_clear (rgba))
if (RGBA_IS_CLEAR (rgba))
return;
rgba_to_half (rgba, color);
@@ -2835,6 +2835,9 @@ compute_phase_and_pos (float value, float *pos)
}
}
#define COLOR_GLYPH_BIT 2
#define GLYPH_IS_COLOR(g) (((*(guint32*)&(g)->attr) & COLOR_GLYPH_BIT) != 0)
static inline void
gsk_ngl_render_job_visit_text_node (GskNglRenderJob *job,
const GskRenderNode *node,
@@ -2855,7 +2858,9 @@ gsk_ngl_render_job_visit_text_node (GskNglRenderJob *job,
guint last_texture = 0;
GskNglDrawVertex *vertices;
guint used = 0;
guint16 c[4] = { FP16_MINUS_ONE, FP16_MINUS_ONE, FP16_MINUS_ONE, FP16_MINUS_ONE };
guint16 nc[4] = { FP16_MINUS_ONE, FP16_MINUS_ONE, FP16_MINUS_ONE, FP16_MINUS_ONE };
guint16 cc[4];
const guint16 *c;
const PangoGlyphInfo *gi;
guint i;
int yshift;
@@ -2864,16 +2869,11 @@ gsk_ngl_render_job_visit_text_node (GskNglRenderJob *job,
if (num_glyphs == 0)
return;
/* If the font has color glyphs, we don't need to recolor anything.
* We tell the shader by setting the color to vec4(-1).
*/
if (force_color || !gsk_text_node_has_color_glyphs (node))
{
if (gdk_rgba_is_clear (color))
return;
if ((force_color || !gsk_text_node_has_color_glyphs (node)) &&
RGBA_IS_CLEAR (color))
return;
rgba_to_half (color, c);
}
rgba_to_half (color, cc);
lookup.font = (PangoFont *)font;
lookup.scale = (guint) (text_scale * 1024);
@@ -2897,6 +2897,14 @@ gsk_ngl_render_job_visit_text_node (GskNglRenderJob *job,
lookup.glyph = gi->glyph;
/* If the glyph has color, we don't need to recolor anything.
* We tell the shader by setting the color to vec4(-1).
*/
if (!force_color && GLYPH_IS_COLOR (gi))
c = nc;
else
c = cc;
cx = (float)(x_position + gi->geometry.x_offset) / PANGO_SCALE;
lookup.xshift = compute_phase_and_pos (x + cx, &cx);
+2 -1
View File
@@ -30,6 +30,7 @@
#include "gtkdebug.h"
#include "gtkwindow.h"
#include "gtkprivate.h"
#include "a11y/atspi/atspi-accessible.h"
#include "a11y/atspi/atspi-application.h"
@@ -612,7 +613,7 @@ gtk_at_spi_root_queue_register (GtkAtSpiRoot *self,
return;
self->register_id = g_idle_add (root_register, self);
g_source_set_name_by_id (self->register_id, "[gtk] ATSPI root registration");
gdk_source_set_static_name_by_id (self->register_id, "[gtk] ATSPI root registration");
}
void
BIN
View File
Binary file not shown.
+1
View File
@@ -1,6 +1,7 @@
#include <gtk/gtk.h>
#include "gtk/gtkcomposetable.h"
#include <locale.h>
#include <stdlib.h>
/* This program reads a Compose file and generates files with sequences,
* character data, and definitions for the builtin compose table of GTK.
+2 -2
View File
@@ -3,7 +3,7 @@
#define MAX_SEQ_LEN 5
#define N_INDEX_SIZE 30
#define DATA_SIZE 16521
#define N_CHARS 1572
#define DATA_SIZE 16447
#define N_CHARS 1241
#endif
Binary file not shown.
+17
View File
@@ -2242,6 +2242,23 @@ gtk_builder_value_from_string_type (GtkBuilder *builder,
ret = FALSE;
}
}
else if (G_VALUE_HOLDS (value, GDK_TYPE_CONTENT_FORMATS))
{
GdkContentFormats *formats;
formats = gdk_content_formats_parse (string);
if (formats)
g_value_take_boxed (value, formats);
else
{
g_set_error (error,
GTK_BUILDER_ERROR,
GTK_BUILDER_ERROR_INVALID_VALUE,
"Could not parse GdkContentFormats '%s'",
string);
ret = FALSE;
}
}
else if (G_VALUE_HOLDS (value, GSK_TYPE_TRANSFORM))
{
GskTransform *transform;
+1 -1
View File
@@ -791,7 +791,7 @@ gtk_real_button_activate (GtkButton *button)
if (gtk_widget_get_realized (widget) && !priv->activate_timeout)
{
priv->activate_timeout = g_timeout_add (ACTIVATE_TIMEOUT, button_activate_timeout, button);
g_source_set_name_by_id (priv->activate_timeout, "[gtk] button_activate_timeout");
gdk_source_set_static_name_by_id (priv->activate_timeout, "[gtk] button_activate_timeout");
gtk_widget_add_css_class (GTK_WIDGET (button), "keyboard-activating");
priv->button_down = TRUE;
+8 -7
View File
@@ -420,9 +420,6 @@ gtk_check_button_focus (GtkWidget *widget,
GtkDirectionType direction)
{
GtkCheckButton *self = GTK_CHECK_BUTTON (widget);
GtkCheckButton *active_button;
active_button = get_group_active_button (self);
if (gtk_widget_is_focus (widget))
{
@@ -471,9 +468,7 @@ gtk_check_button_focus (GtkWidget *widget,
if (new_focus)
{
gtk_widget_grab_focus (new_focus);
gtk_check_button_set_active (GTK_CHECK_BUTTON (new_focus), TRUE);
if (active_button && active_button != (GtkCheckButton *)new_focus)
gtk_check_button_set_active (GTK_CHECK_BUTTON (active_button), FALSE);
gtk_widget_activate (new_focus);
}
g_ptr_array_free (child_array, TRUE);
@@ -482,6 +477,9 @@ gtk_check_button_focus (GtkWidget *widget,
}
else
{
GtkCheckButton *active_button;
active_button = get_group_active_button (self);
if (active_button && active_button != self)
return FALSE;
@@ -498,7 +496,10 @@ gtk_check_button_real_activate (GtkCheckButton *self)
if (priv->active && (priv->group_prev || priv->group_next))
return;
gtk_check_button_set_active (self, !gtk_check_button_get_active (self));
if (priv->action_helper)
gtk_action_helper_activate (priv->action_helper);
else
gtk_check_button_set_active (self, !gtk_check_button_get_active (self));
}
static void
+101 -128
View File
@@ -486,15 +486,16 @@ parser_remove_duplicates (GtkComposeParser *parser)
GHashTableIter iter;
gunichar *sequence;
char *value;
GString *output;
output = g_string_new ("");
g_hash_table_iter_init (&iter, parser->sequences);
while (g_hash_table_iter_next (&iter, (gpointer *)&sequence, (gpointer *)&value))
{
static guint16 keysyms[MAX_COMPOSE_LEN + 1];
static guint keysyms[MAX_COMPOSE_LEN + 1];
int i;
int n_compose = 0;
gunichar output_char;
char buf[8] = { 0, };
gboolean remove_sequence = FALSE;
if (value[0] == '\0')
@@ -514,8 +515,8 @@ parser_remove_duplicates (GtkComposeParser *parser)
for (i = 0; i < MAX_COMPOSE_LEN + 1; i++)
{
gunichar codepoint = sequence[i];
keysyms[i] = (guint16) codepoint;
guint codepoint = sequence[i];
keysyms[i] = codepoint;
if (codepoint == 0)
break;
@@ -529,10 +530,9 @@ parser_remove_duplicates (GtkComposeParser *parser)
n_compose++;
}
if (gtk_check_algorithmically (keysyms, n_compose, &output_char))
if (gtk_check_algorithmically (keysyms, n_compose, output))
{
g_unichar_to_utf8 (output_char, buf);
if (strcmp (value, buf) == 0)
if (strcmp (value, output->str) == 0)
remove_sequence = TRUE;
}
@@ -540,6 +540,8 @@ next:
if (remove_sequence)
g_hash_table_iter_remove (&iter);
}
g_string_free (output, TRUE);
}
static void
@@ -1069,22 +1071,22 @@ gtk_compose_table_parse (const char *compose_file,
return compose_table;
}
static const char *prefix =
"# GTK has rewritten this file to add the line:\n"
"\n"
"include \"%L\"\n"
"\n"
"# This is necessary to add your own Compose sequences\n"
"# in addition to the builtin sequences of GTK. If this\n"
"# is not what you want, just remove that line.\n"
"#\n"
"# A backup of the previous file contents has been made.\n"
"\n"
"\n";
static gboolean
rewrite_compose_file (const char *compose_file)
{
static const char *prefix =
"# GTK has rewritten this file to add the line:\n"
"\n"
"include \"%L\"\n"
"\n"
"# This is necessary to add your own Compose sequences\n"
"# in addition to the builtin sequences of GTK. If this\n"
"# is not what you want, just remove that line.\n"
"#\n"
"# A backup of the previous file contents has been made.\n"
"\n"
"\n";
char *path = NULL;
char *content = NULL;
gsize content_len;
@@ -1215,7 +1217,7 @@ static int
compare_seq (const void *key, const void *value)
{
int i = 0;
const guint16 *keysyms = key;
const guint *keysyms = key;
const guint16 *seq = value;
while (keysyms[i])
@@ -1234,7 +1236,7 @@ compare_seq (const void *key, const void *value)
static int
compare_seq_index (const void *key, const void *value)
{
const guint16 *keysyms = key;
const guint *keysyms = key;
const guint16 *seq = value;
if (keysyms[0] < seq[0])
@@ -1260,7 +1262,7 @@ compare_seq_index (const void *key, const void *value)
*/
gboolean
gtk_compose_table_check (const GtkComposeTable *table,
const guint16 *compose_buffer,
const guint *compose_buffer,
int n_compose,
gboolean *compose_finish,
gboolean *compose_match,
@@ -1352,6 +1354,47 @@ gtk_compose_table_check (const GtkComposeTable *table,
return FALSE;
}
void
gtk_compose_table_get_prefix (const GtkComposeTable *table,
const guint *compose_buffer,
int n_compose,
int *prefix)
{
int index_stride = table->max_seq_len + 1;
int p = 0;
for (int idx = 0; idx < table->n_index_size; idx++)
{
const guint16 *seq_index = table->data + (idx * index_stride);
if (seq_index[0] == compose_buffer[0])
{
p = 1;
for (int i = 1; i < table->max_seq_len; i++)
{
int len = i + 1;
for (int j = seq_index[i]; j < seq_index[i + 1]; j += len)
{
int k;
for (k = 0; k < MIN (len, n_compose) - 1; k++)
{
if (compose_buffer[k + 1] != table->data[j + k])
break;
}
p = MAX (p, k + 1);
}
}
break;
}
}
*prefix = p;
}
void
gtk_compose_table_foreach (const GtkComposeTable *table,
GtkComposeSequenceCallback callback,
@@ -1419,119 +1462,56 @@ gtk_compose_table_foreach (const GtkComposeTable *table,
#define IS_DEAD_KEY(k) \
((k) >= GDK_KEY_dead_grave && (k) <= GDK_KEY_dead_greek)
/* This function receives a sequence of Unicode characters and tries to
* normalize it (NFC). We check for the case where the resulting string
* has length 1 (single character).
* NFC normalisation normally rearranges diacritic marks, unless these
* belong to the same Canonical Combining Class.
* If they belong to the same canonical combining class, we produce all
* permutations of the diacritic marks, then attempt to normalize.
*/
static gboolean
check_normalize_nfc (gunichar *combination_buffer,
int n_compose)
{
gunichar *combination_buffer_temp;
char *combination_utf8_temp = NULL;
char *nfc_temp = NULL;
int n_combinations;
gunichar temp_swap;
int i;
combination_buffer_temp = g_alloca (n_compose * sizeof (gunichar));
n_combinations = 1;
for (i = 1; i < n_compose; i++)
n_combinations *= i;
/* Xorg reuses dead_tilde for the perispomeni diacritic mark.
* We check if base character belongs to Greek Unicode block,
* and if so, we replace tilde with perispomeni.
*/
if (combination_buffer[0] >= 0x390 && combination_buffer[0] <= 0x3FF)
{
for (i = 1; i < n_compose; i++ )
if (combination_buffer[i] == 0x303)
combination_buffer[i] = 0x342;
}
memcpy (combination_buffer_temp, combination_buffer, n_compose * sizeof (gunichar) );
for (i = 0; i < n_combinations; i++)
{
g_unicode_canonical_ordering (combination_buffer_temp, n_compose);
combination_utf8_temp = g_ucs4_to_utf8 (combination_buffer_temp, n_compose, NULL, NULL, NULL);
nfc_temp = g_utf8_normalize (combination_utf8_temp, -1, G_NORMALIZE_NFC);
if (g_utf8_strlen (nfc_temp, -1) == 1)
{
memcpy (combination_buffer, combination_buffer_temp, n_compose * sizeof (gunichar) );
g_free (combination_utf8_temp);
g_free (nfc_temp);
return TRUE;
}
g_free (combination_utf8_temp);
g_free (nfc_temp);
if (n_compose > 2)
{
temp_swap = combination_buffer_temp[i % (n_compose - 1) + 1];
combination_buffer_temp[i % (n_compose - 1) + 1] = combination_buffer_temp[(i+1) % (n_compose - 1) + 1];
combination_buffer_temp[(i+1) % (n_compose - 1) + 1] = temp_swap;
}
else
break;
}
return FALSE;
}
gboolean
gtk_check_algorithmically (const guint16 *compose_buffer,
int n_compose,
gunichar *output_char)
gtk_check_algorithmically (const guint *compose_buffer,
int n_compose,
GString *output)
{
int i;
gunichar *combination_buffer;
char *combination_utf8, *nfc;
combination_buffer = alloca (sizeof (gunichar) * (n_compose + 1));
if (output_char)
*output_char = 0;
g_string_set_size (output, 0);
for (i = 0; i < n_compose && IS_DEAD_KEY (compose_buffer[i]); i++)
;
/* Allow at most 2 dead keys */
if (i > 2)
return FALSE;
/* Can't combine if there's no base character */
/* Can't combine if there's no base character: incomplete sequence */
if (i == n_compose)
return TRUE;
if (i > 0 && i == n_compose - 1)
{
combination_buffer[0] = gdk_keyval_to_unicode (compose_buffer[i]);
combination_buffer[n_compose] = 0;
GString *input;
char *nfc;
gunichar ch;
ch = gdk_keyval_to_unicode (compose_buffer[i]);
/* We don't allow combining with non-letters */
if (!g_unichar_isalpha (ch))
return FALSE;
input = g_string_sized_new (4 * n_compose);
g_string_append_unichar (input, ch);
i--;
while (i >= 0)
{
switch (compose_buffer[i])
{
#define CASE(keysym, unicode) \
case GDK_KEY_dead_##keysym: combination_buffer[i+1] = unicode; break
case GDK_KEY_dead_##keysym: g_string_append_unichar (input, unicode); break
CASE (grave, 0x0300);
CASE (acute, 0x0301);
CASE (circumflex, 0x0302);
CASE (tilde, 0x0303); /* Also used with perispomeni, 0x342. */
case GDK_KEY_dead_tilde:
if (g_unichar_get_script (ch) == G_UNICODE_SCRIPT_GREEK)
g_string_append_unichar (input, 0x342); /* combining perispomeni */
else
g_string_append_unichar (input, 0x303); /* combining tilde */
break;
CASE (macron, 0x0304);
CASE (breve, 0x0306);
CASE (abovedot, 0x0307);
@@ -1549,7 +1529,7 @@ gtk_check_algorithmically (const guint16 *compose_buffer,
CASE (horn, 0x031B); /* Legacy use for psili, 0x313 (or 0x343). */
CASE (stroke, 0x335);
CASE (abovecomma, 0x0313); /* Equivalent to psili */
CASE (abovereversedcomma, 0x0314); /* Equivalent to dasia */
CASE (abovereversedcomma, 0x0314); /* Equivalent to dasia */
CASE (doublegrave, 0x30F);
CASE (belowring, 0x325);
CASE (belowmacron, 0x331);
@@ -1577,27 +1557,20 @@ gtk_check_algorithmically (const guint16 *compose_buffer,
CASE (capital_schwa, 0x1DEA);
#undef CASE
default:
combination_buffer[i+1] = gdk_keyval_to_unicode (compose_buffer[i]);
g_string_append_unichar (input, gdk_keyval_to_unicode (compose_buffer[i]));
}
i--;
}
/* If the buffer normalizes to a single character, then modify the order
* of combination_buffer accordingly, if necessary, and return TRUE.
*/
if (check_normalize_nfc (combination_buffer, n_compose))
{
combination_utf8 = g_ucs4_to_utf8 (combination_buffer, -1, NULL, NULL, NULL);
nfc = g_utf8_normalize (combination_utf8, -1, G_NORMALIZE_NFC);
nfc = g_utf8_normalize (input->str, input->len, G_NORMALIZE_NFC);
if (output_char)
*output_char = g_utf8_get_char (nfc);
g_string_assign (output, nfc);
g_free (combination_utf8);
g_free (nfc);
g_free (nfc);
return TRUE;
}
g_string_free (input, TRUE);
return TRUE;
}
return FALSE;
+8 -3
View File
@@ -74,15 +74,20 @@ void gtk_compose_table_foreach (const GtkComposeTable *table,
gpointer data);
gboolean gtk_compose_table_check (const GtkComposeTable *table,
const guint16 *compose_buffer,
const guint *compose_buffer,
int n_compose,
gboolean *compose_finish,
gboolean *compose_match,
GString *output);
gboolean gtk_check_algorithmically (const guint16 *compose_buffer,
void gtk_compose_table_get_prefix (const GtkComposeTable *table,
const guint *compose_buffer,
int n_compose,
int *prefix);
gboolean gtk_check_algorithmically (const guint *compose_buffer,
int n_compose,
gunichar *output);
GString *output);
guint32 gtk_compose_table_data_hash (const guint16 *data,
int max_seq_len,
+4
View File
@@ -204,6 +204,10 @@ gtk_css_animated_style_set_animated_value (GtkCssAnimatedStyle *animated,
unshare_font (animated);
gtk_css_take_value (&style->font->letter_spacing, value);
break;
case GTK_CSS_PROPERTY_LINE_HEIGHT:
unshare_font (animated);
gtk_css_take_value (&style->font->line_height, value);
break;
case GTK_CSS_PROPERTY_TEXT_DECORATION_LINE:
unshare_font_variant (animated);
gtk_css_take_value (&style->font_variant->text_decoration_line, value);
+2 -2
View File
@@ -542,8 +542,8 @@ gtk_css_shadow_value_get_extents (const GtkCssValue *value,
spread = _gtk_css_number_value_get (shadow->spread, 0);
radius = _gtk_css_number_value_get (shadow->radius, 0);
if (value->is_filter)
radius = radius * 2;
if (!value->is_filter)
radius = radius / 2.0;
clip_radius = gsk_cairo_blur_compute_pixels (radius);
hoffset = _gtk_css_number_value_get (shadow->hoffset, 0);
voffset = _gtk_css_number_value_get (shadow->voffset, 0);
+5 -1
View File
@@ -107,11 +107,12 @@ static const int font_props[] = {
GTK_CSS_PROPERTY_FONT_WEIGHT,
GTK_CSS_PROPERTY_FONT_STRETCH,
GTK_CSS_PROPERTY_LETTER_SPACING,
GTK_CSS_PROPERTY_TEXT_SHADOW,
GTK_CSS_PROPERTY_TEXT_SHADOW,
GTK_CSS_PROPERTY_CARET_COLOR,
GTK_CSS_PROPERTY_SECONDARY_CARET_COLOR,
GTK_CSS_PROPERTY_FONT_FEATURE_SETTINGS,
GTK_CSS_PROPERTY_FONT_VARIATION_SETTINGS,
GTK_CSS_PROPERTY_LINE_HEIGHT,
};
static const int font_variant_props[] = {
GTK_CSS_PROPERTY_TEXT_DECORATION_LINE,
@@ -417,6 +418,9 @@ gtk_css_static_style_set_value (GtkCssStaticStyle *sstyle,
case GTK_CSS_PROPERTY_LETTER_SPACING:
gtk_css_take_value (&style->font->letter_spacing, value);
break;
case GTK_CSS_PROPERTY_LINE_HEIGHT:
gtk_css_take_value (&style->font->line_height, value);
break;
case GTK_CSS_PROPERTY_TEXT_DECORATION_LINE:
gtk_css_take_value (&style->font_variant->text_decoration_line, value);
break;
+10
View File
@@ -226,3 +226,13 @@ _gtk_css_ident_value_get (const GtkCssValue *value)
return value->string;
}
GtkCssValue *
gtk_css_line_height_value_get_default (void)
{
static GtkCssValue *normal_line_height;
if (normal_line_height == NULL)
normal_line_height = _gtk_css_ident_value_new_take ("normal");
return normal_line_height;
}
+1
View File
@@ -40,6 +40,7 @@ GtkCssValue * _gtk_css_string_value_parse (GtkCssParser *par
const char * _gtk_css_string_value_get (const GtkCssValue *string);
GtkCssValue * gtk_css_line_height_value_get_default (void);
G_END_DECLS
+2
View File
@@ -117,6 +117,8 @@ gtk_css_style_get_value (GtkCssStyle *style,
return style->font->font_stretch;
case GTK_CSS_PROPERTY_LETTER_SPACING:
return style->font->letter_spacing;
case GTK_CSS_PROPERTY_LINE_HEIGHT:
return style->font->line_height;
case GTK_CSS_PROPERTY_TEXT_DECORATION_LINE:
return style->font_variant->text_decoration_line;
case GTK_CSS_PROPERTY_TEXT_DECORATION_COLOR:
View File
+1
View File
@@ -151,6 +151,7 @@ struct _GtkCssFontValues {
GtkCssValue *secondary_caret_color; // NULL if currentColor
GtkCssValue *font_feature_settings;
GtkCssValue *font_variation_settings;
GtkCssValue *line_height;
};
struct _GtkCssFontVariantValues {
+25
View File
@@ -812,6 +812,25 @@ transform_origin_parse (GtkCssStyleProperty *property,
return _gtk_css_position_value_parse (parser);
}
static GtkCssValue *
parse_line_height (GtkCssStyleProperty *property,
GtkCssParser *parser)
{
GtkCssValue *value = NULL;
if (gtk_css_parser_try_ident (parser, "normal"))
value = _gtk_css_ident_value_new ("normal");
else
value = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER |
GTK_CSS_PARSE_PERCENT |
GTK_CSS_POSITIVE_ONLY);
if (value == NULL)
gtk_css_parser_error_syntax (parser, "Not a valid line-height value");
return value;
}
/*** REGISTRATION ***/
G_STATIC_ASSERT (GTK_CSS_PROPERTY_COLOR == 0);
@@ -1401,4 +1420,10 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_AFFECTS_TEXT_ATTRS | GTK_CSS_AFFECTS_TEXT_SIZE,
parse_font_variation_settings,
gtk_css_font_variations_value_new_default ());
gtk_css_style_property_register ("line-height",
GTK_CSS_PROPERTY_LINE_HEIGHT,
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_TEXT_SIZE,
parse_line_height,
_gtk_css_value_ref (gtk_css_line_height_value_get_default ()));
}
+1
View File
@@ -275,6 +275,7 @@ enum { /*< skip >*/
GTK_CSS_PROPERTY_SECONDARY_CARET_COLOR,
GTK_CSS_PROPERTY_FONT_FEATURE_SETTINGS,
GTK_CSS_PROPERTY_FONT_VARIATION_SETTINGS,
GTK_CSS_PROPERTY_LINE_HEIGHT,
/* add more */
GTK_CSS_PROPERTY_N_PROPERTIES
};
+16 -5
View File
@@ -344,7 +344,7 @@ gtk_drop_target_accept (GtkDropTarget *self,
if (self->formats == NULL)
return TRUE;
return gdk_content_formats_match (self->formats, gdk_drop_get_formats (drop));
return gdk_content_formats_match_gtype (self->formats, gdk_drop_get_formats (drop)) != G_TYPE_INVALID;
}
static GdkDragAction
@@ -544,6 +544,12 @@ gtk_drop_target_set_property (GObject *object,
gtk_drop_target_set_actions (self, g_value_get_flags (value));
break;
case PROP_FORMATS:
self->formats = g_value_dup_boxed (value);
if (self->formats == NULL)
self->formats = gdk_content_formats_new (NULL, 0);
break;
case PROP_PRELOAD:
gtk_drop_target_set_preload (self, g_value_get_boolean (value));
break;
@@ -661,7 +667,7 @@ gtk_drop_target_class_init (GtkDropTargetClass *class)
P_("Formats"),
P_("The supported formats"),
GDK_TYPE_CONTENT_FORMATS,
GTK_PARAM_READABLE);
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
/**
* GtkDropTarget:preload: (attributes org.gtk.Property.get=gtk_drop_target_get_preload org.gtk.Property.set=gtk_drop_target_set_preload)
@@ -843,7 +849,6 @@ gtk_drop_target_class_init (GtkDropTargetClass *class)
static void
gtk_drop_target_init (GtkDropTarget *self)
{
self->formats = gdk_content_formats_new (NULL, 0);
}
/**
@@ -864,13 +869,19 @@ gtk_drop_target_new (GType type,
GdkDragAction actions)
{
GtkDropTarget *result;
GdkContentFormats *formats;
if (type != G_TYPE_INVALID)
formats = gdk_content_formats_new_for_gtype (type);
else
formats = NULL;
result = g_object_new (GTK_TYPE_DROP_TARGET,
"formats", formats,
"actions", actions,
NULL);
if (type != G_TYPE_INVALID)
gtk_drop_target_set_gtypes (result, &type, 1);
g_clear_pointer (&formats, gdk_content_formats_unref);
return result;
}
+1 -1
View File
@@ -1016,7 +1016,7 @@ gtk_emoji_chooser_init (GtkEmojiChooser *chooser)
populate_recent_section (chooser);
chooser->populate_idle = g_idle_add (populate_emoji_chooser, chooser);
g_source_set_name_by_id (chooser->populate_idle, "[gtk] populate_emoji_chooser");
gdk_source_set_static_name_by_id (chooser->populate_idle, "[gtk] populate_emoji_chooser");
}
static void
+2 -2
View File
@@ -1982,7 +1982,7 @@ gtk_entry_completion_changed (GtkWidget *widget,
g_timeout_add (COMPLETION_TIMEOUT,
gtk_entry_completion_timeout,
completion);
g_source_set_name_by_id (completion->completion_timeout, "[gtk] gtk_entry_completion_timeout");
gdk_source_set_static_name_by_id (completion->completion_timeout, "[gtk] gtk_entry_completion_timeout");
}
static gboolean
@@ -2048,7 +2048,7 @@ completion_inserted_text_callback (GtkEntryBuffer *buffer,
g_cclosure_new_object (G_CALLBACK (check_completion_callback),
G_OBJECT (completion)));
g_source_attach (completion->check_completion_idle, NULL);
g_source_set_name (completion->check_completion_idle, "[gtk] check_completion_callback");
g_source_set_static_name (completion->check_completion_idle, "[gtk] check_completion_callback");
}
}
-1
View File
@@ -102,7 +102,6 @@ void _gtk_entry_completion_connect (GtkEntryCompletion *completion,
GtkEntry *entry);
void _gtk_entry_completion_disconnect (GtkEntryCompletion *completion);
GtkIMContext * _gtk_entry_get_im_context (GtkEntry *entry);
GtkEventController * gtk_entry_get_key_controller (GtkEntry *entry);
GtkText *gtk_entry_get_text_widget (GtkEntry *entry);
+1 -1
View File
@@ -244,7 +244,7 @@ gtk_expander_drag_enter (GtkDropControllerMotion *motion,
if (!expander->expanded && !expander->expand_timer)
{
expander->expand_timer = g_timeout_add (TIMEOUT_EXPAND, (GSourceFunc) expand_timeout, expander);
g_source_set_name_by_id (expander->expand_timer, "[gtk] expand_timeout");
gdk_source_set_static_name_by_id (expander->expand_timer, "[gtk] expand_timeout");
}
}
+2 -2
View File
@@ -2234,7 +2234,7 @@ location_entry_changed_cb (GtkEditable *editable,
impl->location_changed_id = g_timeout_add (LOCATION_CHANGED_TIMEOUT,
location_changed_timeout_cb,
impl);
g_source_set_name_by_id (impl->location_changed_id, "[gtk] location_changed_timeout_cb");
gdk_source_set_static_name_by_id (impl->location_changed_id, "[gtk] location_changed_timeout_cb");
}
}
@@ -3822,7 +3822,7 @@ load_setup_timer (GtkFileChooserWidget *impl)
g_assert (impl->load_state != LOAD_PRELOAD);
impl->load_timeout_id = g_timeout_add (MAX_LOADING_TIME, load_timeout_cb, impl);
g_source_set_name_by_id (impl->load_timeout_id, "[gtk] load_timeout_cb");
gdk_source_set_static_name_by_id (impl->load_timeout_id, "[gtk] load_timeout_cb");
impl->load_state = LOAD_PRELOAD;
}
+2 -1
View File
@@ -30,6 +30,7 @@
#include "gtktreednd.h"
#include "gtktreemodel.h"
#include "gtkfilter.h"
#include "gtkprivate.h"
/*** Structure: how GtkFileSystemModel works
*
@@ -1095,7 +1096,7 @@ gtk_file_system_model_got_files (GObject *object, GAsyncResult *res, gpointer da
thaw_func,
model,
NULL);
g_source_set_name_by_id (model->dir_thaw_source, "[gtk] thaw_func");
gdk_source_set_static_name_by_id (model->dir_thaw_source, "[gtk] thaw_func");
}
for (walk = files; walk; walk = walk->next)
+1 -1
View File
@@ -267,7 +267,7 @@ gtk_filter_list_model_start_filtering (GtkFilterListModel *self,
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PENDING]);
g_assert (self->pending_cb == 0);
self->pending_cb = g_idle_add (gtk_filter_list_model_run_filter_cb, self);
g_source_set_name_by_id (self->pending_cb, "[gtk] gtk_filter_list_model_run_filter_cb");
gdk_source_set_static_name_by_id (self->pending_cb, "[gtk] gtk_filter_list_model_run_filter_cb");
}
static void
+43 -34
View File
@@ -386,15 +386,18 @@ user_filter_cb (gpointer item,
ret = FALSE;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
langs = pango_fc_font_get_languages (PANGO_FC_FONT (font));
for (i = 0; langs[i]; i++)
{
if (langs[i] == self->filter_language)
{
ret = TRUE;
break;
}
}
G_GNUC_END_IGNORE_DEPRECATIONS
if (langs)
for (i = 0; langs[i]; i++)
{
if (langs[i] == self->filter_language)
{
ret = TRUE;
break;
}
}
}
g_object_unref (font);
@@ -600,17 +603,20 @@ maybe_update_preview_text (GtkFontChooserWidget *self,
alt_default = pango_language_from_string (q);
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
languages = pango_fc_font_get_languages (PANGO_FC_FONT (font));
G_GNUC_END_IGNORE_DEPRECATIONS
/* If the font supports the default language, just use it. */
for (i = 0; languages[i]; i++)
{
if (languages[i] == default_lang || languages[i] == alt_default)
{
lang = default_lang;
goto found;
}
}
if (languages)
for (i = 0; languages[i]; i++)
{
if (languages[i] == default_lang || languages[i] == alt_default)
{
lang = default_lang;
goto found;
}
}
/* Otherwise, we make a list of representative languages */
langs = g_hash_table_new (NULL, NULL);
@@ -1066,28 +1072,31 @@ add_languages_from_font (GtkFontChooserWidget *self,
PangoLanguage **langs;
int i;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
langs = pango_fc_font_get_languages (PANGO_FC_FONT (font));
for (i = 0; langs[i]; i++)
{
if (!g_hash_table_contains (self->language_table, langs[i]))
{
g_hash_table_add (self->language_table, langs[i]);
if (get_language_name (langs[i]))
{
const char *l = pango_language_to_string (langs[i]);
gulong id = 0;
G_GNUC_END_IGNORE_DEPRECATIONS
if (langs)
for (i = 0; langs[i]; i++)
{
if (!g_hash_table_contains (self->language_table, langs[i]))
{
g_hash_table_add (self->language_table, langs[i]);
if (get_language_name (langs[i]))
{
const char *l = pango_language_to_string (langs[i]);
gulong id = 0;
/* Pre-select the default language */
if (pango_language_matches (default_lang, l))
id = g_signal_connect (model, "items-changed", G_CALLBACK (select_added), NULL);
/* Pre-select the default language */
if (pango_language_matches (default_lang, l))
id = g_signal_connect (model, "items-changed", G_CALLBACK (select_added), NULL);
gtk_string_list_append (self->languages, l);
gtk_string_list_append (self->languages, l);
if (id)
g_signal_handler_disconnect (model, id);
}
}
}
if (id)
g_signal_handler_disconnect (model, id);
}
}
}
}
g_object_unref (font);
+1 -1
View File
@@ -146,7 +146,7 @@ _gtk_gesture_click_update_timeout (GtkGestureClick *gesture)
g_object_get (settings, "gtk-double-click-time", &double_click_time, NULL);
priv->double_click_timeout_id = g_timeout_add (double_click_time, _double_click_timeout_cb, gesture);
g_source_set_name_by_id (priv->double_click_timeout_id, "[gtk] _double_click_timeout_cb");
gdk_source_set_static_name_by_id (priv->double_click_timeout_id, "[gtk] _double_click_timeout_cb");
}
static gboolean
+1 -1
View File
@@ -150,7 +150,7 @@ gtk_gesture_long_press_begin (GtkGesture *gesture,
gtk_gesture_get_point (gesture, sequence,
&priv->initial_x, &priv->initial_y);
priv->timeout_id = g_timeout_add (delay, _gtk_gesture_long_press_timeout, gesture);
g_source_set_name_by_id (priv->timeout_id, "[gtk] _gtk_gesture_long_press_timeout");
gdk_source_set_static_name_by_id (priv->timeout_id, "[gtk] _gtk_gesture_long_press_timeout");
}
static void
+5 -5
View File
@@ -95,13 +95,13 @@ _gtk_gesture_rotate_get_angle (GtkGestureRotate *rotate,
goto out;
last_event = gtk_gesture_get_last_event (gesture, sequences->data);
phase = gdk_touchpad_event_get_gesture_phase (last_event);
if (gdk_event_get_event_type (last_event) == GDK_TOUCHPAD_PINCH &&
(phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN ||
phase == GDK_TOUCHPAD_GESTURE_PHASE_UPDATE ||
phase == GDK_TOUCHPAD_GESTURE_PHASE_END))
if (gdk_event_get_event_type (last_event) == GDK_TOUCHPAD_PINCH)
{
phase = gdk_touchpad_event_get_gesture_phase (last_event);
if (phase == GDK_TOUCHPAD_GESTURE_PHASE_CANCEL)
goto out;
*angle = priv->accum_touchpad_angle;
}
else
+1 -1
View File
@@ -294,7 +294,7 @@ gtk_icon_helper_paintable_get_current_image (GdkPaintable *paintable)
if (self->paintable == NULL)
return NULL;
return gtk_icon_helper_paintable_get_current_image (self->paintable);
return gdk_paintable_get_current_image (self->paintable);
}
static int
+1 -1
View File
@@ -1342,7 +1342,7 @@ queue_theme_changed (GtkIconTheme *self)
theme_changed_idle__mainthread_unlocked,
gtk_icon_theme_ref_ref (self->ref),
(GDestroyNotify)gtk_icon_theme_ref_unref);
g_source_set_name_by_id (self->theme_changed_idle, "[gtk] theme_changed_idle");
gdk_source_set_static_name_by_id (self->theme_changed_idle, "[gtk] theme_changed_idle");
}
}
+2 -2
View File
@@ -1831,7 +1831,7 @@ gtk_icon_view_motion (GtkEventController *controller,
if (icon_view->priv->scroll_timeout_id == 0) {
icon_view->priv->scroll_timeout_id = g_timeout_add (30, rubberband_scroll_timeout, icon_view);
g_source_set_name_by_id (icon_view->priv->scroll_timeout_id, "[gtk] rubberband_scroll_timeout");
gdk_source_set_static_name_by_id (icon_view->priv->scroll_timeout_id, "[gtk] rubberband_scroll_timeout");
}
}
else
@@ -6065,7 +6065,7 @@ gtk_icon_view_drag_motion (GtkDropTargetAsync *dest,
if (icon_view->priv->scroll_timeout_id == 0)
{
icon_view->priv->scroll_timeout_id = g_timeout_add (50, drag_scroll_timeout, icon_view);
g_source_set_name_by_id (icon_view->priv->scroll_timeout_id, "[gtk] drag_scroll_timeout");
gdk_source_set_static_name_by_id (icon_view->priv->scroll_timeout_id, "[gtk] drag_scroll_timeout");
}
if (target == GTK_TYPE_TREE_ROW_DATA)
+76 -58
View File
@@ -79,7 +79,7 @@
struct _GtkIMContextSimplePrivate
{
guint16 *compose_buffer;
guint *compose_buffer;
int compose_buffer_len;
GString *tentative_match;
int tentative_match_len;
@@ -118,7 +118,7 @@ init_builtin_table (void)
G_LOCK_DEFINE_STATIC (global_tables);
static GSList *global_tables;
static const guint16 gtk_compose_ignore[] = {
static const guint gtk_compose_ignore[] = {
0, /* Yes, XKB will send us key press events with NoSymbol :( */
GDK_KEY_Overlay1_Enable,
GDK_KEY_Overlay2_Enable,
@@ -384,7 +384,7 @@ gtk_im_context_simple_init (GtkIMContextSimple *context_simple)
priv = context_simple->priv = gtk_im_context_simple_get_instance_private (context_simple);
priv->compose_buffer_len = builtin_compose_table.max_seq_len + 1;
priv->compose_buffer = g_new0 (guint16, priv->compose_buffer_len);
priv->compose_buffer = g_new0 (guint, priv->compose_buffer_len);
priv->tentative_match = g_string_new ("");
priv->tentative_match_len = 0;
}
@@ -544,18 +544,22 @@ is_dead_key (guint keysym)
return GDK_KEY_dead_grave <= keysym && keysym <= GDK_KEY_dead_greek;
}
static gunichar
dead_key_to_unicode (guint keysym,
gboolean *need_space)
static void
append_dead_key (GString *string,
guint keysym)
{
/* Sadly, not all the dead keysyms have spacing mark equivalents
* in Unicode. For those that don't, we use space + the non-spacing
* mark as an approximation
* in Unicode. For those that don't, we use NBSP + the non-spacing
* mark as an approximation.
*/
switch (keysym)
{
#define CASE(keysym, unicode, sp) \
case GDK_KEY_dead_##keysym: *need_space = sp; return unicode;
#define CASE(keysym, unicode, sp) \
case GDK_KEY_dead_##keysym: \
if (sp) \
g_string_append_unichar (string, 0xA0); \
g_string_append_unichar (string, unicode); \
break;
CASE (grave, 0x60, 0);
CASE (acute, 0xb4, 0);
@@ -606,8 +610,7 @@ dead_key_to_unicode (guint keysym,
CASE (capital_schwa, 0x1dea, 1);
#undef CASE
default:
*need_space = FALSE;
return gdk_keyval_to_unicode (keysym);
g_string_append_unichar (string, gdk_keyval_to_unicode (keysym));
}
}
@@ -622,7 +625,7 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
guint keyval;
context = GTK_IM_CONTEXT (context_simple);
priv->in_compose_sequence = FALSE;
/* No compose sequences found, check first if we have a partial
@@ -632,12 +635,12 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
{
int len = priv->tentative_match_len;
int i;
guint16 *compose_buffer;
guint *compose_buffer;
char *str;
compose_buffer = alloca (sizeof (guint16) * priv->compose_buffer_len);
compose_buffer = alloca (sizeof (guint) * priv->compose_buffer_len);
memcpy (compose_buffer, priv->compose_buffer, sizeof (guint16) * priv->compose_buffer_len);
memcpy (compose_buffer, priv->compose_buffer, sizeof (guint) * priv->compose_buffer_len);
str = g_strdup (priv->tentative_match->str);
gtk_im_context_simple_commit_string (context_simple, str);
@@ -675,7 +678,6 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
if (n_compose > 1 && i >= n_compose - 1)
{
gboolean need_space;
GString *s;
s = g_string_new ("");
@@ -684,15 +686,7 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
{
/* dead keys are never *really* dead */
for (int j = 0; j < i; j++)
{
ch = dead_key_to_unicode (priv->compose_buffer[j], &need_space);
if (ch)
{
if (need_space)
g_string_append_c (s, ' ');
g_string_append_unichar (s, ch);
}
}
append_dead_key (s, priv->compose_buffer[j]);
ch = gdk_keyval_to_unicode (priv->compose_buffer[i]);
if (ch != 0 && ch != ' ' && !g_unichar_iscntrl (ch))
@@ -702,14 +696,7 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
}
else
{
ch = dead_key_to_unicode (priv->compose_buffer[0], &need_space);
if (ch)
{
if (need_space)
g_string_append_c (s, ' ');
g_string_append_unichar (s, ch);
}
append_dead_key (s, priv->compose_buffer[0]);
gtk_im_context_simple_commit_string (context_simple, s->str);
for (i = 1; i < n_compose; i++)
@@ -821,7 +808,6 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
int i;
gboolean compose_finish;
gboolean compose_match;
gunichar output_char;
guint keyval, state;
while (priv->compose_buffer[n_compose] != 0 && n_compose < priv->compose_buffer_len)
@@ -1001,16 +987,22 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
return TRUE;
}
if (is_escape)
{
if (priv->in_hex_sequence || priv->in_compose_sequence)
{
gtk_im_context_simple_reset (context);
return TRUE;
}
return FALSE;
}
if (priv->in_hex_sequence)
{
if (hex_keyval && n_compose < 6)
priv->compose_buffer[n_compose++] = hex_keyval;
else if (is_escape)
{
gtk_im_context_simple_reset (context);
return TRUE;
}
else if (!is_hex_end)
{
/* non-hex character in hex sequence, or sequence too long */
@@ -1023,7 +1015,7 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
if (n_compose + 1 == priv->compose_buffer_len)
{
priv->compose_buffer_len += 1;
priv->compose_buffer = g_renew (guint16, priv->compose_buffer, priv->compose_buffer_len);
priv->compose_buffer = g_renew (guint, priv->compose_buffer, priv->compose_buffer_len);
}
priv->compose_buffer[n_compose++] = keyval;
@@ -1071,6 +1063,7 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
else /* Then, check for compose sequences */
{
gboolean success = FALSE;
int prefix = 0;
GString *output;
output = g_string_new ("");
@@ -1109,18 +1102,29 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
success = TRUE;
break;
}
else
{
int table_prefix;
gtk_compose_table_get_prefix ((GtkComposeTable *)tmp_list->data,
priv->compose_buffer, n_compose,
&table_prefix);
prefix = MAX (prefix, table_prefix);
}
tmp_list = tmp_list->next;
}
G_UNLOCK (global_tables);
g_string_free (output, TRUE);
if (success)
return TRUE;
{
g_string_free (output, TRUE);
return TRUE;
}
if (gtk_check_algorithmically (priv->compose_buffer, n_compose, &output_char))
if (gtk_check_algorithmically (priv->compose_buffer, n_compose, output))
{
if (!priv->in_compose_sequence)
{
@@ -1128,11 +1132,30 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
g_signal_emit_by_name (context_simple, "preedit-start");
}
if (output_char)
gtk_im_context_simple_commit_char (context_simple, output_char);
if (output->len > 0)
gtk_im_context_simple_commit_string (context_simple, output->str);
else
g_signal_emit_by_name (context_simple, "preedit-changed");
g_string_free (output, TRUE);
return TRUE;
}
g_string_free (output, TRUE);
/* If we get here, no Compose sequence matched.
* Only beep if we were in a sequence before.
*/
if (prefix > 0)
{
for (i = prefix; i < n_compose; i++)
priv->compose_buffer[i] = 0;
beep_surface (gdk_event_get_surface (event));
g_signal_emit_by_name (context_simple, "preedit-changed");
return TRUE;
}
}
@@ -1195,28 +1218,23 @@ gtk_im_context_simple_get_preedit_string (GtkIMContext *context,
if (priv->compose_buffer[i] == GDK_KEY_Multi_key)
{
/* We only show the Compose key visibly when it is the
* only glyph in the preedit, or when it occurs in the
* only glyph in the preedit, or when the sequence contains
* multiple Compose keys, or when it occurs in the
* middle of the sequence. Sadly, the official character,
* U+2384, COMPOSITION SYMBOL, is bit too distracting, so
* we use U+00B7, MIDDLE DOT.
*/
if (priv->compose_buffer[1] == 0 || i > 0)
if (priv->compose_buffer[1] == 0 || i > 0 ||
priv->compose_buffer[i + 1] == GDK_KEY_Multi_key)
g_string_append (s, "·");
}
else
{
gunichar ch;
gboolean need_space;
if (is_dead_key (priv->compose_buffer[i]))
{
ch = dead_key_to_unicode (priv->compose_buffer[i], &need_space);
if (ch)
{
if (need_space)
g_string_append_c (s, ' ');
g_string_append_unichar (s, ch);
}
append_dead_key (s, priv->compose_buffer[i]);
}
else
{
+30 -2
View File
@@ -53,6 +53,8 @@
#include "gtkdragicon.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkjoinedmenuprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include <math.h>
#include <string.h>
@@ -841,6 +843,26 @@ gtk_label_update_layout_attributes (GtkLabel *self,
pango_attr_list_unref (attrs);
}
static void
gtk_label_update_layout (GtkLabel *self)
{
GtkCssStyle *style;
GtkCssStyleProperty *prop;
float line_spacing;
if (self->layout == NULL)
return;
style = gtk_css_node_get_style (gtk_widget_get_css_node (GTK_WIDGET (self)));
if (_gtk_css_value_equal (style->font->line_height, gtk_css_line_height_value_get_default ()))
line_spacing = 0.0;
else
line_spacing = _gtk_css_number_value_get (style->font->line_height, 1.0);
pango_layout_set_line_spacing (self->layout, line_spacing);
}
static void
gtk_label_css_changed (GtkWidget *widget,
GtkCssStyleChange *change)
@@ -851,6 +873,11 @@ gtk_label_css_changed (GtkWidget *widget,
GTK_WIDGET_CLASS (gtk_label_parent_class)->css_changed (widget, change);
if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT_SIZE))
{
gtk_label_update_layout (self);
}
if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT_ATTRS))
{
new_attrs = gtk_css_style_get_pango_attributes (gtk_css_style_change_get_new_style (change));
@@ -860,7 +887,7 @@ gtk_label_css_changed (GtkWidget *widget,
else
attrs_affected = FALSE;
if (change == NULL || attrs_affected || (self->select_info && self->select_info->links))
if (change == NULL || attrs_affected || (self->select_info && self->select_info->links))
{
gtk_label_update_layout_attributes (self, new_attrs);
@@ -3187,7 +3214,7 @@ strip_ulines (const char *text,
}
*q = *p;
if (after_uline && *accel_key == 0)
if (after_uline && *p != '_' && *accel_key == 0)
*accel_key = g_utf8_get_char (p);
q++;
@@ -3982,6 +4009,7 @@ gtk_label_ensure_layout (GtkLabel *self)
self->layout = gtk_widget_create_pango_layout (GTK_WIDGET (self), self->text);
gtk_label_update_layout_attributes (self, NULL);
gtk_label_update_layout (self);
switch (self->jtype)
{
+5 -5
View File
@@ -1433,14 +1433,14 @@ gtk_list_store_clear (GtkListStore *list_store)
/**
* gtk_list_store_iter_is_valid:
* @list_store: A `GtkListStore`.
* @iter: A `GtkTreeIter`
*
* > This function is slow. Only use it for debugging and/or testing
* > purposes.
* @list_store: a list store
* @iter: the iterator to check
*
* Checks if the given iter is a valid iter for this `GtkListStore`.
*
* This function is slow. Only use it for debugging and/or testing
* purposes.
*
* Returns: %TRUE if the iter is valid, %FALSE if the iter is invalid.
**/
gboolean
+1 -1
View File
@@ -868,7 +868,7 @@ gtk_main_sync (void)
store.store_loop = g_main_loop_new (NULL, TRUE);
store.timeout_id = g_timeout_add_seconds (10, (GSourceFunc) sync_timed_out_cb, &store);
g_source_set_name_by_id (store.timeout_id, "[gtk] gtk_main_sync clipboard store timeout");
gdk_source_set_static_name_by_id (store.timeout_id, "[gtk] gtk_main_sync clipboard store timeout");
if (g_main_loop_is_running (store.store_loop))
g_main_loop_run (store.store_loop);
+22 -2
View File
@@ -34,6 +34,7 @@
#include "gtkbuiltiniconprivate.h"
#include "gtkgizmoprivate.h"
#include "gtkbinlayout.h"
#include "gtkprivate.h"
typedef GtkBoxClass GtkMenuSectionBoxClass;
@@ -175,7 +176,7 @@ gtk_menu_section_box_schedule_separator_sync (GtkMenuSectionBox *box)
box->separator_sync_idle = g_idle_add_full (G_PRIORITY_HIGH_IDLE, /* before resize... */
gtk_menu_section_box_handle_sync_separators,
box, NULL);
g_source_set_name_by_id (box->separator_sync_idle, "[gtk] menu section box handle sync separators");
gdk_source_set_static_name_by_id (box->separator_sync_idle, "[gtk] menu section box handle sync separators");
}
}
@@ -308,6 +309,25 @@ submenu_hidden (GtkPopoverMenu *popover,
gtk_menu_tracker_item_request_submenu_shown (item, FALSE);
}
/* We're using the gizmo as an easy single child container, not as
* a custom widget to draw some visual indicators (like markers).
* As such its default focus functions blocks focus through the children,
* so we need to handle it correctly here so that custom widgets inside
* menus can be focused.
*/
static gboolean
custom_widget_focus (GtkGizmo *gizmo,
GtkDirectionType direction)
{
return gtk_widget_focus_child (GTK_WIDGET (gizmo), direction);
}
static gboolean
custom_widget_grab_focus (GtkGizmo *gizmo)
{
return gtk_widget_grab_focus_child (GTK_WIDGET (gizmo));
}
static void
gtk_menu_section_box_insert_func (GtkMenuTrackerItem *item,
int position,
@@ -368,7 +388,7 @@ gtk_menu_section_box_insert_func (GtkMenuTrackerItem *item,
{
const char *id = gtk_menu_tracker_item_get_custom (item);
widget = gtk_gizmo_new ("widget", NULL, NULL, NULL, NULL, NULL, NULL);
widget = gtk_gizmo_new ("widget", NULL, NULL, NULL, NULL, custom_widget_focus, custom_widget_grab_focus);
gtk_widget_set_layout_manager (widget, gtk_bin_layout_new ());
if (g_hash_table_lookup (box->custom_slots, id))
+2 -1
View File
@@ -46,6 +46,7 @@
#include "gtkshortcutcontroller.h"
#include "gtkshortcut.h"
#include "gtkaccessibleprivate.h"
#include "gtkprivate.h"
/*< private >
* GtkModelButton:
@@ -1363,7 +1364,7 @@ start_open (GtkModelButton *button)
return;
button->open_timeout = g_timeout_add (OPEN_TIMEOUT, open_submenu, button);
g_source_set_name_by_id (button->open_timeout, "[gtk] open_submenu");
gdk_source_set_static_name_by_id (button->open_timeout, "[gtk] open_submenu");
}
static void
+4 -4
View File
@@ -3052,7 +3052,7 @@ gtk_notebook_motion (GtkEventController *controller,
notebook->dnd_timer = g_timeout_add (TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
scroll_notebook_timer,
notebook);
g_source_set_name_by_id (notebook->dnd_timer, "[gtk] scroll_notebook_timer");
gdk_source_set_static_name_by_id (notebook->dnd_timer, "[gtk] scroll_notebook_timer");
}
}
else
@@ -4018,7 +4018,7 @@ gtk_notebook_tab_drop_enter (GtkEventController *controller,
notebook->switch_page = page;
notebook->switch_page_timer = g_timeout_add (TIMEOUT_EXPAND, gtk_notebook_switch_page_timeout, notebook);
g_source_set_name_by_id (notebook->switch_page_timer, "[gtk] gtk_notebook_switch_page_timeout");
gdk_source_set_static_name_by_id (notebook->switch_page_timer, "[gtk] gtk_notebook_switch_page_timeout");
}
static void
@@ -4189,7 +4189,7 @@ gtk_notebook_timer (GtkNotebook *notebook)
notebook->timer = g_timeout_add (TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
(GSourceFunc) gtk_notebook_timer,
notebook);
g_source_set_name_by_id (notebook->timer, "[gtk] gtk_notebook_timer");
gdk_source_set_static_name_by_id (notebook->timer, "[gtk] gtk_notebook_timer");
}
else
retval = TRUE;
@@ -4206,7 +4206,7 @@ gtk_notebook_set_scroll_timer (GtkNotebook *notebook)
notebook->timer = g_timeout_add (TIMEOUT_INITIAL,
(GSourceFunc) gtk_notebook_timer,
notebook);
g_source_set_name_by_id (notebook->timer, "[gtk] gtk_notebook_timer");
gdk_source_set_static_name_by_id (notebook->timer, "[gtk] gtk_notebook_timer");
notebook->need_timer = TRUE;
}
}
+57 -3
View File
@@ -715,7 +715,7 @@ gtk_popover_schedule_mnemonics_visible (GtkPopover *popover)
priv->mnemonics_display_timeout_id =
g_timeout_add (MNEMONICS_DELAY, schedule_mnemonics_visible_cb, popover);
g_source_set_name_by_id (priv->mnemonics_display_timeout_id, "[gtk] popover_schedule_mnemonics_visible_cb");
gdk_source_set_static_name_by_id (priv->mnemonics_display_timeout_id, "[gtk] popover_schedule_mnemonics_visible_cb");
}
static void
@@ -972,6 +972,59 @@ gtk_popover_unrealize (GtkWidget *widget)
g_clear_object (&priv->surface);
}
static gboolean
gtk_popover_focus (GtkWidget *widget,
GtkDirectionType direction)
{
if (!gtk_widget_get_visible (widget))
return FALSE;
/* This code initially comes from gtkpopovermenu.c */
if (gtk_widget_get_first_child (widget) == NULL)
{
/* Empty popover, so nothing to Tab through. */
return FALSE;
}
else
{
/* Move focus normally, but when nothing can be focused in this direction then we cycle around. */
if (gtk_widget_focus_move (widget, direction))
return TRUE;
if (gtk_popover_get_autohide (GTK_POPOVER (widget)))
{
GtkWidget *p = gtk_root_get_focus (gtk_widget_get_root (widget));
/* In the case where the popover doesn't have any focusable child (like
* the GtkTreePopover for combo boxes) then the focus will end up out of
* the popover, hence creating an infinite loop below. To avoid this, just
* say we had focus and stop here.
*/
if (!gtk_widget_is_ancestor (p, widget) && p != widget)
return TRUE;
/* Cycle around with (Shift+)Tab */
if (direction == GTK_DIR_TAB_FORWARD || direction == GTK_DIR_TAB_BACKWARD)
{
for (;
p != widget;
p = gtk_widget_get_parent (p))
{
/* Unfocus everything in the popover. */
gtk_widget_set_focus_child (p, NULL);
}
}
/* Focus again from scratch */
gtk_widget_focus_move (widget, direction);
return TRUE;
}
else
{
return FALSE;
}
}
}
static void
gtk_popover_show (GtkWidget *widget)
{
@@ -1734,6 +1787,7 @@ gtk_popover_class_init (GtkPopoverClass *klass)
widget_class->unrealize = gtk_popover_unrealize;
widget_class->map = gtk_popover_map;
widget_class->unmap = gtk_popover_unmap;
widget_class->focus = gtk_popover_focus;
widget_class->show = gtk_popover_show;
widget_class->hide = gtk_popover_hide;
widget_class->measure = gtk_popover_measure;
@@ -2175,8 +2229,8 @@ gtk_popover_get_position (GtkPopover *popover)
* Sets whether @popover is modal.
*
* A modal popover will grab the keyboard focus on it when being
* displayed. Clicking outside the popover area or pressing Esc
* will dismiss the popover.
* displayed. Focus will wrap around within the popover. Clicking
* outside the popover area or pressing Esc will dismiss the popover.
*
* Called this function on an already showing popup with a new
* autohide value different from the current one, will cause the
+13 -4
View File
@@ -480,12 +480,21 @@ gtk_popover_menu_focus (GtkWidget *widget,
else
return TRUE;
}
else if (direction == GTK_DIR_UP || direction == GTK_DIR_DOWN)
/* Cycle around with up/down arrows and (Shift+)Tab when modal */
else if (gtk_popover_get_autohide (GTK_POPOVER (menu)))
{
GtkWidget *p;
GtkWidget *p = gtk_root_get_focus (gtk_widget_get_root (widget));
/* In the case where the popover doesn't have any focusable child, if
* the menu doesn't have any item for example, then the focus will end
* up out of the popover, hence creating an infinite loop below. To
* avoid this, just say we had focus and stop here.
*/
if (!gtk_widget_is_ancestor (p, widget) && p != widget)
return TRUE;
/* cycle around */
for (p = gtk_root_get_focus (gtk_widget_get_root (widget));
for (;
p != widget;
p = gtk_widget_get_parent (p))
{
@@ -493,7 +502,7 @@ gtk_popover_menu_focus (GtkWidget *widget,
}
if (gtk_widget_focus_move (widget, direction))
return TRUE;
}
}
}
return FALSE;
+2 -2
View File
@@ -539,7 +539,7 @@ win32_poll_status_timeout (GtkPrintOperation *op)
op_win32->timeout_id = g_timeout_add (STATUS_POLLING_TIME,
(GSourceFunc)win32_poll_status_timeout,
op);
g_source_set_name_by_id (op_win32->timeout_id, "[gtk] win32_poll_status_timeout");
gdk_source_set_static_name_by_id (op_win32->timeout_id, "[gtk] win32_poll_status_timeout");
}
g_object_unref (op);
return FALSE;
@@ -583,7 +583,7 @@ win32_end_run (GtkPrintOperation *op,
op_win32->timeout_id = g_timeout_add (STATUS_POLLING_TIME,
(GSourceFunc)win32_poll_status_timeout,
op);
g_source_set_name_by_id (op_win32->timeout_id, "[gtk] win32_poll_status_timeout");
gdk_source_set_static_name_by_id (op_win32->timeout_id, "[gtk] win32_poll_status_timeout");
}
else
/* Dunno what happened, pretend its finished */
+3 -3
View File
@@ -631,7 +631,7 @@ preview_ready (GtkPrintOperationPreview *preview,
preview_print_idle,
pop,
preview_print_idle_done);
g_source_set_name_by_id (id, "[gtk] preview_print_idle");
gdk_source_set_static_name_by_id (id, "[gtk] preview_print_idle");
}
@@ -2895,7 +2895,7 @@ print_pages (GtkPrintOperation *op,
g_timeout_add (SHOW_PROGRESS_TIME,
(GSourceFunc) show_progress_timeout,
data);
g_source_set_name_by_id (priv->show_progress_timeout_id, "[gtk] show_progress_timeout");
gdk_source_set_static_name_by_id (priv->show_progress_timeout_id, "[gtk] show_progress_timeout");
data->progress = progress;
}
@@ -2964,7 +2964,7 @@ print_pages (GtkPrintOperation *op,
print_pages_idle,
data,
print_pages_idle_done);
g_source_set_name_by_id (priv->print_pages_idle_id, "[gtk] print_pages_idle");
gdk_source_set_static_name_by_id (priv->print_pages_idle_id, "[gtk] print_pages_idle");
/* Recursive main loop to make sure we don't exit on sync operations */
if (priv->is_sync)
+1 -1
View File
@@ -1803,7 +1803,7 @@ schedule_idle_mark_conflicts (GtkPrintUnixDialog *dialog)
return;
dialog->mark_conflicts_id = g_idle_add (mark_conflicts_callback, dialog);
g_source_set_name_by_id (dialog->mark_conflicts_id, "[gtk] mark_conflicts_callback");
gdk_source_set_static_name_by_id (dialog->mark_conflicts_id, "[gtk] mark_conflicts_callback");
}
static void
+2 -2
View File
@@ -2758,7 +2758,7 @@ initial_timeout (gpointer data)
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
priv->timer->timeout_id = g_timeout_add (TIMEOUT_REPEAT, second_timeout, range);
g_source_set_name_by_id (priv->timer->timeout_id, "[gtk] second_timeout");
gdk_source_set_static_name_by_id (priv->timer->timeout_id, "[gtk] second_timeout");
return G_SOURCE_REMOVE;
}
@@ -2774,7 +2774,7 @@ gtk_range_add_step_timer (GtkRange *range,
priv->timer = g_new (GtkRangeStepTimer, 1);
priv->timer->timeout_id = g_timeout_add (TIMEOUT_INITIAL, initial_timeout, range);
g_source_set_name_by_id (priv->timer->timeout_id, "[gtk] initial_timeout");
gdk_source_set_static_name_by_id (priv->timer->timeout_id, "[gtk] initial_timeout");
priv->timer->step = step;
gtk_range_scroll (range, priv->timer->step);
+1 -1
View File
@@ -1388,7 +1388,7 @@ gtk_recent_manager_changed (GtkRecentManager *manager)
if (manager->priv->changed_timeout == 0)
{
manager->priv->changed_timeout = g_timeout_add (250, emit_manager_changed, manager);
g_source_set_name_by_id (manager->priv->changed_timeout, "[gtk] emit_manager_changed");
gdk_source_set_static_name_by_id (manager->priv->changed_timeout, "[gtk] emit_manager_changed");
}
else
{
+4 -4
View File
@@ -1216,7 +1216,7 @@ check_update_scrollbar_proximity (GtkScrolledWindow *sw,
else if (indicator_close && !on_other_scrollbar)
{
indicator->over_timeout_id = g_timeout_add (30, enable_over_timeout_cb, indicator);
g_source_set_name_by_id (indicator->over_timeout_id, "[gtk] enable_over_timeout_cb");
gdk_source_set_static_name_by_id (indicator->over_timeout_id, "[gtk] enable_over_timeout_cb");
}
else
indicator_set_over (indicator, FALSE);
@@ -1412,8 +1412,8 @@ scrolled_window_scroll (GtkScrolledWindow *scrolled_window,
{
priv->scroll_events_overshoot_id =
g_timeout_add (50, start_scroll_deceleration_cb, scrolled_window);
g_source_set_name_by_id (priv->scroll_events_overshoot_id,
"[gtk] start_scroll_deceleration_cb");
gdk_source_set_static_name_by_id (priv->scroll_events_overshoot_id,
"[gtk] start_scroll_deceleration_cb");
}
}
@@ -3638,7 +3638,7 @@ indicator_set_fade (Indicator *indicator,
if (visible && indicator->conceil_timer == 0)
{
indicator->conceil_timer = g_timeout_add (INDICATOR_FADE_OUT_TIME, maybe_hide_indicator, indicator);
g_source_set_name_by_id (indicator->conceil_timer, "[gtk] maybe_hide_indicator");
gdk_source_set_static_name_by_id (indicator->conceil_timer, "[gtk] maybe_hide_indicator");
}
if (!visible && indicator->conceil_timer != 0)
{
+1 -1
View File
@@ -126,7 +126,7 @@ gtk_search_engine_model_start (GtkSearchEngine *engine)
return;
model->idle = g_idle_add (do_search, engine);
g_source_set_name_by_id (model->idle, "[gtk] gtk_search_engine_model_start");
gdk_source_set_static_name_by_id (model->idle, "[gtk] gtk_search_engine_model_start");
}
static void
+1 -1
View File
@@ -519,7 +519,7 @@ reset_timeout (GtkSearchEntry *entry)
entry->delayed_changed_id = g_timeout_add (DELAYED_TIMEOUT_ID,
gtk_search_entry_changed_timeout_cb,
entry);
g_source_set_name_by_id (entry->delayed_changed_id, "[gtk] gtk_search_entry_changed_timeout_cb");
gdk_source_set_static_name_by_id (entry->delayed_changed_id, "[gtk] gtk_search_entry_changed_timeout_cb");
}
static void
+2 -2
View File
@@ -906,7 +906,7 @@ start_spinning (GtkSpinButton *spin,
spin->timer = g_timeout_add (TIMEOUT_INITIAL,
(GSourceFunc) gtk_spin_button_timer,
(gpointer) spin);
g_source_set_name_by_id (spin->timer, "[gtk] gtk_spin_button_timer");
gdk_source_set_static_name_by_id (spin->timer, "[gtk] gtk_spin_button_timer");
}
gtk_spin_button_real_spin (spin, click_child == spin->up_button ? step : -step);
}
@@ -1318,7 +1318,7 @@ gtk_spin_button_timer (GtkSpinButton *spin_button)
spin_button->timer = g_timeout_add (TIMEOUT_REPEAT,
(GSourceFunc) gtk_spin_button_timer,
spin_button);
g_source_set_name_by_id (spin_button->timer, "[gtk] gtk_spin_button_timer");
gdk_source_set_static_name_by_id (spin_button->timer, "[gtk] gtk_spin_button_timer");
}
else
{
+1 -1
View File
@@ -245,7 +245,7 @@ gtk_stack_switcher_drag_enter (GtkDropControllerMotion *motion,
guint switch_timer = g_timeout_add (TIMEOUT_EXPAND,
gtk_stack_switcher_switch_timeout,
button);
g_source_set_name_by_id (switch_timer, "[gtk] gtk_stack_switcher_switch_timeout");
gdk_source_set_static_name_by_id (switch_timer, "[gtk] gtk_stack_switcher_switch_timeout");
g_object_set_data_full (G_OBJECT (button), "-gtk-switch-timer", GUINT_TO_POINTER (switch_timer), clear_timer);
}
}
+31 -30
View File
@@ -3636,7 +3636,7 @@ buffer_inserted_text (GtkEntryBuffer *buffer,
password_hint->source_id = g_timeout_add (password_hint_timeout,
(GSourceFunc)gtk_text_remove_password_hint,
self);
g_source_set_name_by_id (password_hint->source_id, "[gtk] gtk_text_remove_password_hint");
gdk_source_set_static_name_by_id (password_hint->source_id, "[gtk] gtk_text_remove_password_hint");
}
}
}
@@ -5049,39 +5049,40 @@ gtk_text_move_visually (GtkText *self,
int index;
PangoLayout *layout = gtk_text_ensure_layout (self, FALSE);
const char *text;
gboolean split_cursor;
gboolean strong;
text = pango_layout_get_text (layout);
index = g_utf8_offset_to_pointer (text, start) - text;
g_object_get (gtk_widget_get_settings (GTK_WIDGET (self)),
"gtk-split-cursor", &split_cursor,
NULL);
if (split_cursor)
strong = TRUE;
else
{
GdkDisplay *display;
GdkSeat *seat;
GdkDevice *keyboard = NULL;
PangoDirection direction = PANGO_DIRECTION_LTR;
display = gtk_widget_get_display (GTK_WIDGET (self));
seat = gdk_display_get_default_seat (display);
if (seat)
keyboard = gdk_seat_get_keyboard (seat);
if (keyboard)
direction = gdk_device_get_direction (keyboard);
strong = direction == priv->resolved_dir;
}
while (count != 0)
{
int new_index, new_trailing;
gboolean split_cursor;
gboolean strong;
g_object_get (gtk_widget_get_settings (GTK_WIDGET (self)),
"gtk-split-cursor", &split_cursor,
NULL);
if (split_cursor)
strong = TRUE;
else
{
GdkDisplay *display;
GdkSeat *seat;
GdkDevice *keyboard = NULL;
PangoDirection direction = PANGO_DIRECTION_LTR;
display = gtk_widget_get_display (GTK_WIDGET (self));
seat = gdk_display_get_default_seat (display);
if (seat)
keyboard = gdk_seat_get_keyboard (seat);
if (keyboard)
direction = gdk_device_get_direction (keyboard);
strong = direction == priv->resolved_dir;
}
if (count > 0)
{
@@ -5098,11 +5099,11 @@ gtk_text_move_visually (GtkText *self,
index = 0;
else if (new_index != G_MAXINT)
index = new_index;
while (new_trailing--)
index = g_utf8_next_char (text + index) - text;
}
return g_utf8_pointer_to_offset (text, text + index);
}
@@ -6285,7 +6286,7 @@ gtk_text_selection_bubble_popup_set (GtkText *self)
priv->selection_bubble_timeout_id =
g_timeout_add (50, gtk_text_selection_bubble_popup_show, self);
g_source_set_name_by_id (priv->selection_bubble_timeout_id, "[gtk] gtk_text_selection_bubble_popup_cb");
gdk_source_set_static_name_by_id (priv->selection_bubble_timeout_id, "[gtk] gtk_text_selection_bubble_popup_cb");
}
static void

Some files were not shown because too many files have changed in this diff Show More