Compare commits

..

329 Commits

Author SHA1 Message Date
Matthias Clasen 05e8057b5b Fix gtk_column_view_sort_by_column
We must clear the current sort columns before
setting the new one, to prevent double arrows
in the headers.

Fixes: #4696
2022-04-18 20:37:04 -04:00
Matthias Clasen e89365e9e3 gtk-builder-tool: Error out if screenshooting fails
If we don't produce a texture for whatever reason,
apologize and fail.
2022-04-18 11:16:05 -04:00
Timm Bäder 6484807719 Merge branch 'badcel/fix-typo' into 'main'
docs: Fix typo in description of GtkExpression

See merge request GNOME/gtk!4647
2022-04-18 09:27:05 +00:00
Marcel Tiede 527ff05107 docs: Fix typo in description of GtkExpression 2022-04-18 06:20:19 +00:00
Matthias Clasen b89cfdb77f Merge branch 'screenshot-command' into 'main'
gtk-builder-tool: Add a screenshot command

See merge request GNOME/gtk!4645
2022-04-17 17:40:46 +00:00
Matthias Clasen 499687a11d gtk-builder-tool: Add a screenshot command
This is an obvious variation of the preview
command. It can save a .ui file as either
.png or .node.
2022-04-17 12:57:46 -04:00
Matthias Clasen c5e26dd591 gtk-builder-tool: Reshuffle --help
Use GOptionContext better.
2022-04-17 12:57:46 -04:00
Matthias Clasen bc17d1d5ea Merge branch 'wip/exalm/scrolled-window' into 'main'
scrolledwindow: Pick up gtk-overlay-scrolling changes on the fly

See merge request GNOME/gtk!4642
2022-04-17 16:07:59 +00:00
Matthias Clasen b88ac0890e gtk-builder-tool: Small reshuffle
Move the display check into the preview command.
2022-04-17 11:23:00 -04:00
Matthias Clasen d30baf34b3 Merge branch 'filechooser-entry-popup' into 'main'
filechooser: Prevent random completion popups

See merge request GNOME/gtk!4643
2022-04-17 03:51:32 +00:00
Matthias Clasen b927ad2c87 Merge branch 'filechooser-save-sensitive' into 'main'
filechooser: Small fix for save mode

Closes #4851

See merge request GNOME/gtk!4644
2022-04-17 03:31:39 +00:00
Matthias Clasen 4540dac11a filechooser: Prevent random completion popups
It is very irritating when the entry completion popup
appears not in response to user input in the entry.
In particular, when that happens right as the dialog
is shown.

To prevent that, temporarily disable completion
when setting the entry text programmatically.
2022-04-16 23:29:04 -04:00
Matthias Clasen aa9cac695d filechooser: Small fix for save mode
When changing folders, we were making the select
button insensitive when there's no files around.
That doesn't make sense in save mode when we don't
want to select a file but create one.

Fixes: #4851
2022-04-16 22:00:22 -04:00
Alexander Mikhaylenko 52412ca944 scrolledwindow: Pick up gtk-overlay-scrolling changes on the fly 2022-04-16 16:56:17 +04:00
Alexander Mikhaylenko cd82b18cfd scrolledwindow: Fix :kinetic-scrolling setter 2022-04-16 16:30:33 +04:00
Matthias Clasen da5bb6ff22 Merge branch 'wip/exalm/tooltip' into 'main'
tooltipwindow: Don't restrict minimum tooltip label length

Closes #3741

See merge request GNOME/gtk!4640
2022-04-16 00:07:21 +00:00
Alexander Mikhaylenko 7871f1e13b tooltipwindow: Don't restrict minimum tooltip label length
We only care about wrapping at that length, we still want short tooltips
for short labels.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3741
2022-04-16 03:48:21 +04:00
Alexander Mikhaylenko dd18c7dedf tooltipwindow: Remove a duplicate gtk_widget_class_set_css_name() call 2022-04-16 03:28:50 +04:00
Matthias Clasen a34a6e9b84 Merge branch 'ebassi/for-main' into 'main'
docs: Fix the GtkPaned style

See merge request GNOME/gtk!4637
2022-04-15 00:09:42 +00:00
Emmanuele Bassi 0a5f29c9eb Mark nullable arguments in GtkPaned
The set_start_child() and set_end_child() methods take NULL for the
child argument, as a way to remove the child from the paned widget.
2022-04-14 22:44:17 +01:00
Emmanuele Bassi 417be0719b docs: Fix the GtkPaned style
Use proper links to properties and methods, and drop gtk-doc'isms.
2022-04-14 22:43:40 +01:00
Matthias Clasen 3263a26cad Merge branch 'fix_tooltip' into 'main'
label: Maintain value for `has-tooltip` for labels with links

See merge request GNOME/gtk!4635
2022-04-14 18:00:43 +00:00
Matthias Clasen 00916c2b47 Merge branch 'fix_link_tabs' into 'main'
label: Move focus out of widget after last link

Closes #4681

See merge request GNOME/gtk!4636
2022-04-14 11:36:19 +00:00
Julian Sparber e3320633a6 label: Move focus out of widget after last link
This allows the user to navigate via tab the links in a label and exits
the widget after the last link, when moving forward, and first link,
when moving backward.

This also ensures that ellipsised links arn't focused.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4681
2022-04-14 12:48:20 +02:00
Julian Sparber 764a8cea59 label: Maintain value for has-tooltip for labels with links
The `has-tooltip` property gets set to `false` for label with links if no
link is selected. This makes sure to only change the property to `true`
but never to `false`.
2022-04-13 19:05:53 +02:00
Benjamin Otte a2599c2bb9 Merge branch 'clarify-scrollable-docs' into 'main'
scrollable: Clarify when to set adjustment props

See merge request GNOME/gtk!4632
2022-04-12 23:48:55 +00:00
Ivan Molodetskikh e2675306e1 scrollable: Clarify when to set adjustment props
Instead of populating the properties right away (when the widget might
not have been allocated yet, and hence cannot know the right values),
the widget should queue an allocation, where it will populate the
values.
2022-04-12 17:22:51 +03:00
Benjamin Otte 7d1429cb91 Merge branch 'gles-win32' into 'main'
Inspector: Fix running on Windows with GLES (was: fix running GL demos with GLES on Windows)

See merge request GNOME/gtk!4595
2022-04-08 22:00:33 +00:00
Matthias Clasen f13a018739 Merge branch 'matthiasc/for-main' into 'main'
gsk/gl: Typo fix

See merge request GNOME/gtk!4628
2022-04-08 16:14:43 +00:00
Matthias Clasen 84b3b1fab5 gsk/gl: Typo fix 2022-04-08 11:20:12 -04:00
Luca Bacci 048bb6db6f Merge branch 'gdk-win32-fix-mouse-move-crossing-events' into 'main'
GdkWin32: Mouse events fixes

Closes #4722 and #4813

See merge request GNOME/gtk!4620
2022-04-08 08:31:14 +00:00
Matthias Clasen 8c548d5579 Merge branch 'nonoverlapping-containers' into 'main'
gsk/gl: Avoid offscreening in more cases

See merge request GNOME/gtk!4619
2022-04-07 14:32:53 +00:00
Matthias Clasen 09d5ec1b08 Merge branch 'n-docs-fixes' into 'main'
More doc fixes

See merge request GNOME/gtk!4618
2022-04-07 14:05:40 +00:00
Matthias Clasen 28bba484da Merge branch 'matthiasc/for-main' into 'main'
gl: Don't leak big glyphs

See merge request GNOME/gtk!4626
2022-04-07 11:46:11 +00:00
Matthias Clasen 191558cfa4 gtk-demo: Small fixup to the cursors demo 2022-04-07 07:01:29 -04:00
Luca Bacci cb0c1b3f08 GdkWin32: Generate crossing event after button release
Fixes #4813
2022-04-06 20:27:46 +02:00
Luca Bacci 91f200167e GdkWin32: Correct generation of crossing events when holding an implicit grab
Fixes #4722
2022-04-06 20:27:32 +02:00
Luca Bacci 2b6fb005a8 GdkWin32: Report serial for events 2022-04-06 19:45:50 +02:00
Matthias Clasen af6bec7539 Merge branch 'push-history-position-fix' into 'main'
gdk: always populate GDK_AXIS_{X,Y} in merged event history

Closes #4809

See merge request GNOME/gtk!4623
2022-04-06 15:56:26 +00:00
Matthias Clasen 38362c2803 Merge branch 'wip/carlosg/osk-activation' into 'main'
imwayland: Connect OSK activating gesture to parent widget on editables

Closes #4795

See merge request GNOME/gtk!4624
2022-04-06 15:44:43 +00:00
Carlos Garnacho eb7c78aa48 imwayland: Do not defer commit() after set_surrounding_text()
For reasons that only apply to the old serial handling, asking for
the surrounding after IM changes resulted in lazy handling of
commit() afterwards.

With the recent interpretation of serials, this problem became more
apparent, since it is in fact very likely that the last interaction
step after an IM change is notifying of the changed surrounding
text after the IM change was applied.

Make handling of surrounding text similar to caret position changes,
always commit() after the state change, but skip through non-changes.

This makes the compositor state fully up-to-date after an IM change.
2022-04-06 13:52:05 +02:00
Carlos Garnacho 7ab39b5461 imwayland: Connect OSK activating gesture to parent widget on editables
The gesture as connected currently on the child GtkText is easily overridden
by the parent editables (and gently done so in the attempt to consume all
clicks).

Connect this gesture to the parent editable widget in these cases, so the
gesture can cohabit with the click-consuming one. It's not part of the same
group, but it won't be abruptly cancelled.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4795
2022-04-06 13:52:05 +02:00
Hemidark 0c44851848 gdk: always populate GDK_AXIS_{X,Y} in merged event history
Since GdkTimeCoord stores only axis values, prior to this change,
if a device didn't report GDK_AXIS_X or GDK_AXIS_Y, the history
attached to merged motion events wouldn't contain any positional
information.

Commit 6012276093 already addressed
this issue for devices without tools by storing the event position
in GdkTimeCoord using GDK_AXIS_X and GDK_AXIS_Y and augmenting the
GdkTimeCoord's axis bitmask accordingly.

This change generalizes that workaround to all devices. Note that
if a device DOES report values for GDK_AXIS_X and GDK_AXIS_Y, those
values won't be overwritten.

Closes #4809
2022-04-05 15:35:12 -07:00
Matthias Clasen d72ed045df gsk/gl: Use pre-collected opacity information
We now collect this information during node
construction, so use it here.

The concrete change here is that we now avoid
offscreens for container nodes with multiple children,
as long as they don't overlap. In particular, this
avoid offscreens for ellipsized dim labels.
2022-04-05 14:57:38 -04:00
Matthias Clasen 38eb182947 gsk: Collect opacity information
Collect information about whether to use offscreens
for opacity during node construction, so we don't
need to walk the tree repeatedly, later.
2022-04-05 14:57:38 -04:00
Matthias Clasen 0eba21b2b5 gsk: Track disjointness of container nodes
This can be used to optimize some things in the
GL renderer.
2022-04-05 14:57:38 -04:00
Matthias Clasen 21cba193ad Merge branch 'blurry-offscreen' into 'main'
gsk/gl: Always align offscreen rendering with the pixel grid

Closes #3833

See merge request GNOME/gtk!4621
2022-04-05 12:25:59 +00:00
Matthias Clasen ee7c83e15a Merge branch 'matthiasc/for-main' into 'main'
gl: Don't leak big glyphs

See merge request GNOME/gtk!4622
2022-04-05 03:15:53 +00:00
Matthias Clasen 48dbbbc099 gl: Don't leak big glyphs
We were never resetting the accessed bit of
glyphs that are big enough to be stored individually,
so these would just accumulate and never be dropped.
2022-04-04 23:00:45 -04:00
Sebastian Keller 1c733857b3 testsuite: Add unaligned-offscreen test
Tests whether text rendered to an offscreen node unaligned with the
pixel grid introduces blurriness.
2022-04-04 23:48:58 +02:00
Sebastian Keller 85a6517d65 gsk/gl: Always align offscreen rendering with the pixel grid
This fixes two issues with the offscreen rendering code for nodes with
bounds not aligned with the pixel grid:

1.) When drawing to an offscreen buffer the size of the offscreen buffer
was rounded up, but then later when used as texture the vertices
correspond to the original bounds with the unrounded size. This could
then result in the offscreen texture being drawn onscreen at a slightly
smaller size, which then lead to it being visually shifted and blurry.

This is fixed by adjusting the u/v coordinates to ignore the padding
region in the offscreen texture that got added by the size increase from
rounding.

2.) The viewport used when rendering to the offscreen buffer was not
aligned with the pixel grid for nodes at coordinates not aligned with
the pixel grid. Then because the content of the offscreen buffer is not
aligned with the pixel grid and later when used as textures sampling
from it will result in interpolated values for an onscreen pixel. This
could also result in shifting and blurriness, especially for nested
offscreen rendering at different offsets.

This is fixed by adding similar padding at the beginning of the
texture and also adjusting the u/v coordinates to ignore this region.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3833
2022-04-04 21:40:01 +02:00
Christian Hergert d75147db0a Merge branch 'sumibi-yakitori/fix-minimize-window-macos' into 'main'
macos: Fix problem that window cannot be minimized by user operation

Closes #4811

See merge request GNOME/gtk!4613
2022-04-04 18:53:19 +00:00
sumibi-yakitori d3cf7088b3 macos: Skip running showAndMakeKey when a window is minimized by user action
When a window is minimized by user action, the `showAndMakeKey` method is not executed when idle. This prevents the window from being un-minimized immediately.
And allow programmatic minimization of a window by un-minimizing them in `_gdk_macos_toplevel_surface_present`

Closes #4811
2022-04-05 01:06:44 +09:00
Maximiliano Sandoval R ffa7185397 application: Add link and inline code blocks 2022-04-04 14:11:16 +02:00
Maximiliano Sandoval R d7fe62817c filter: Add link to FilterListmodel 2022-04-04 14:10:56 +02:00
Maximiliano Sandoval R a034bdb17e texttag: Correct typo
Does not generate a gir docstring without it.
2022-04-04 14:10:18 +02:00
Matthias Clasen af20f7e9b5 gl: Don't leak big glyphs
We were never resetting the accessed bit of
glyphs that are big enough to be stored individually,
so these would just accumulate and never be dropped.
2022-04-03 20:25:22 -04:00
Christian Hergert 15b7a4572b Merge branch 'sumibi-yakitori/fix-maximize-window-macos' into 'main'
macos: prohibit fullscreen transition if in transtion

This prevents performing additional fullscreen transitions while
a transition is already in progress.

Closes #4808

See merge request GNOME/gtk!4612
2022-04-03 22:14:52 +00:00
sumibi-yakitori 146bb70c2e macos: prohibit fullscreen transition if in transtion
This prevents performing additional fullscreen transitions while
a transition is already in progress.
2022-04-03 22:14:52 +00:00
Matthias Clasen 494de142f6 Merge branch 'matthiasc/for-main' into 'main'
inspector: Avoid a crash

See merge request GNOME/gtk!4617
2022-04-03 20:11:29 +00:00
Matthias Clasen 5d979cde82 inspector: Avoid another crash
We need to handle all event types here.
This was tripping over GDK_TOUCHPAD_HOLD events.
2022-04-03 15:55:21 -04:00
Matthias Clasen f48b894468 inspector: Avoid a crash
Attribute lists can be NULL, it turns out.
2022-04-03 15:55:21 -04:00
Matthias Clasen a6e47892be Merge branch 'matthiasc/for-main' into 'main'
gsk: Plug a memory leak

See merge request GNOME/gtk!4616
2022-04-03 14:21:13 +00:00
Matthias Clasen 1e0c25d96a Merge branch 'meson_fixes' into 'main'
meson: Use proper type for bools

See merge request GNOME/gtk!4615
2022-04-03 12:41:14 +00:00
Matthias Clasen f57eec5288 css: Plug a memory leak
We were leaking the terms of calc values. Oops.
2022-04-03 08:04:35 -04:00
illiliti e938befcbc meson: Use proper type for bools
Fix invalid usage of bools which violates official meson specification and thus
breaks muon, an implementation of meson written in C.
2022-04-03 14:55:33 +03:00
Matthias Clasen 2af8ac655b gsk: Plug a memory leak
This was introduced in 9defc7fc64.
2022-04-03 07:34:44 -04:00
Matthias Clasen cc3c0125a8 Merge branch 'matthiasc/for-main' into 'main'
imcontextsimple: Plug a memory leak

See merge request GNOME/gtk!4614
2022-04-02 19:47:03 +00:00
Matthias Clasen 59f9be457f imcontextsimple: Plug a memory leak 2022-04-02 15:30:47 -04:00
Emmanuele Bassi d1ce514260 Merge branch 'selection-model-docs' into 'main'
docs: Fix links in selection models

See merge request GNOME/gtk!4609
2022-04-01 11:20:11 +00:00
Maximiliano Sandoval R ad5e72728f docs: Fix links in selection models 2022-04-01 13:04:14 +02:00
Andika Triwidada 1bf24f7b19 Update Indonesian translation 2022-04-01 03:56:36 +00:00
Matthias Clasen a3cedb0163 Merge branch 'clipboard-seg' into 'main'
x11: Check return of gdk_x11_get_xatom_name_for_display

See merge request GNOME/gtk!4607
2022-04-01 00:56:32 +00:00
Matthias Clasen 97bab27d82 Merge branch 'fix-win32-empty-clipboard' into 'main'
gdkclipboard-win32.c: Fix call to gdk_clipboard_claim_remote() (check GdkContentFormat is not NULL

Closes #4796

See merge request GNOME/gtk!4604
2022-04-01 00:56:02 +00:00
Matthias Clasen 6030da573d Merge branch 'nls' into 'main'
Remove #ifdef ENABLE_NLS

See merge request GNOME/gtk!4606
2022-03-31 17:07:37 +00:00
Matthias Clasen 0128574ca1 Merge branch 'wip/carlosg/immulticontext-display-switch' into 'main'
gtkimmulticontext: Handle switches between displays

Closes #4805

See merge request GNOME/gtk!4605
2022-03-31 16:29:38 +00:00
Christoph Reiter b27a169200 Merge branch 'msys2-ci-cleanup' into 'main'
CI: clean up MSYS2 build dependencies

See merge request GNOME/gtk!4600
2022-03-31 15:46:54 +00:00
Xavier Claessens bcd0704511 Remove #ifdef ENABLE_NLS
libintl API is guaranteed to always be available, glib will fallback to
proxy-libintl in case gettext is not found.
2022-03-31 11:41:34 -04:00
Dr. David Alan Gilbert 506566b6a4 x11: Check return of gdk_x11_get_xatom_name_for_display
When given an invalid atom, gdk_x11_get_xatom_name_for_display can
return NULL and trigger a seg in gdk_x11_clipboard_formats_from_atoms.
Check for NULL.

Why I'm seeing a bad atom there is probably a separate question.
https://bugzilla.redhat.com/show_bug.cgi?id=2037786
2022-03-31 15:56:09 +01:00
Carlos Garnacho b67da38916 gtkimmulticontext: Handle switches between displays
Currently the GtkIMMultiContext may stick to a delegate GtkIMContext
that no longer applies after the multicontext is dissociated from
any widget.

Handle set_client_widget() so that it can handle changes between
widgets from 2 different display, but also so the delegate is made
NULL whenever the context has a NULL widget.

Doing so, any new client widget results in a new delegate IM context
lookup from the right GdkDisplay and GtkSettings, which avoids any
mix up.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4805
2022-03-31 16:35:29 +02:00
Chun-wei Fan 8519ab56f5 gdkclipboard-win32.c: Fix call to gdk_clipboard_claim_remote()
The call to gdk_win32_clipboard_request_contentformats() can return NULL even
without an error condition being hit (such as when the system clipboard is
empty), so check whether the returned GdkContentFormat pointer is not NULL
before calling gdk_clipboard_claim_remote(), which expects it to be not NULL,
otherwise we face a warning from that funtion and the subsequent
g_object_unref().

This at least partially fixes issue #4796.
2022-03-31 10:55:39 +08:00
Chun-wei Fan 89d87e3482 inspector/general.c: Check whether GL context supports WGL
We may well be using an EGL context that does not support Desktop (W)GL on
Windows, such as in the case of using libANGLE.  So, check whether WGL is
supported for this running instance before trying to query WGL extensions.

This will get rid of warning messages from libepoxy.
2022-03-30 16:09:18 +08:00
Carlos Garnacho 04c9c6b428 Merge branch 'wip/exalm/scroll-hold' into 'main'
eventcontrollerscroll: Always propagate hold events

See merge request GNOME/gtk!4599
2022-03-28 14:27:55 +00:00
Alexander Mikhaylenko 9bd8ed0d82 eventcontrollerscroll: Always propagate hold events
Otherwise a stray scroll controller may prevent others from getting hold
events, even if it always propagates scroll events and does absolutely
nothing.
2022-03-28 12:04:15 +00:00
Rūdolfs Mazurs 40386c97eb Update Latvian translation
(cherry picked from commit 3b50f2e8b9)
2022-03-27 20:19:34 +00:00
Rūdolfs Mazurs 6649cc6e5e Update Latvian translation
(cherry picked from commit d4dd7969d6)
2022-03-27 19:54:19 +00:00
Christoph Reiter e69dc04a7f CI: clean up MSYS2 build dependencies
We only need a C compiler and not the whole toolchain,
and gst-plugins-bad was split into libraries and plugins.
pkg-config -> pkgconf.

This should speed the CI setup up a bit.
2022-03-27 20:10:58 +02:00
Emmanuele Bassi c1361f7a5a Merge branch 'antoniof-main-patch-34986' into 'main'
overlaylayout: Set position style class on child

Closes nautilus#2099

See merge request GNOME/gtk!4597
2022-03-27 16:25:50 +00:00
António Fernandes 351ffef704 overlaylayout: Set position style class on child
As documented:
> Overlay children whose alignments cause them to be positioned
> at an edge get the style classes “.left”, “.right”, “.top”, 
> and/or “.bottom” according to their position.

Likely accidental regression in b7ee2cbc28

Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2099
2022-03-27 14:59:10 +00:00
Matthias Clasen a1ddd3fead Merge branch 'inspector-attributes' into 'main'
inspector: Allow viewing PangoAttrList properties

See merge request GNOME/gtk!4596
2022-03-25 13:03:00 +00:00
Matthias Clasen 79f0f4ee8e inspector: Allow viewing PangoAttrList properties
We have pango_attr_list_to/from_string, so this is
easy. The editing UI isn't ideal, but it solves my
immediate need to see attributes.
2022-03-25 08:35:16 -04:00
Matthias Clasen 7b8bfb4c80 Merge branch 'main' into 'main'
Check for 'rst2man' misses installed 'rst2man.py' (#4728)

See merge request GNOME/gtk!4586
2022-03-25 11:48:28 +00:00
Benjamin Otte 7106cf6524 Merge branch 'wip/chergert/fix-gl-rgba' into 'main'
gdk/gl: handle GL_RGBA/GL_UNSIGNED_NORMALIZED

Closes #4783

See merge request GNOME/gtk!4594
2022-03-25 01:34:15 +00:00
Christian Hergert e706e14fd9 gdk/gl: handle GL_RGBA/GL_UNSIGNED_NORMALIZED
WebKit's GTK 4 port can give us textures with an internal format of
GL_RGBA with GL_UNSIGNED_NORMALIZED and a bit-depth of 8. This fixes
warnings for every GdkGLTexture created/delivered to the GskGLRenderer.

The format is essentially the same as GL_RGBA8 since it is normalized
between 0.0..1.0 for 8-bit components.

Fixes #4783
2022-03-24 18:05:11 -07:00
Matthias Clasen 3f1021048f Merge branch 'want_prepare_without_play_for_size' into 'main'
GtkMediaStream with gstreamer backend isn't 'prepared' until media is played

See merge request GNOME/gtk!4560
2022-03-24 19:19:01 +00:00
Matthias Clasen ddba7f8601 Apply 1 suggestion(s) to 1 file(s) 2022-03-24 17:16:11 +00:00
Bruce Cowan 1660a0eaf1 Update British English translation
(cherry picked from commit dd198cfc06)
2022-03-24 13:19:45 +00:00
Kukuh Syafaat ffffb382e2 Update Indonesian translation 2022-03-23 15:39:17 +00:00
Kukuh Syafaat 09453bc60b Update Indonesian translation 2022-03-23 13:46:25 +00:00
Matthias Clasen f76b749e43 Merge branch 'fix-popover-menu-rtl-position' into 'main'
popover-menu: Fix buttons' position in RTL

See merge request GNOME/gtk!4587
2022-03-23 02:16:41 +00:00
Cheng-Chia Tseng 0aca2a03b4 Update Chinese (Taiwan) translation 2022-03-22 14:47:50 +00:00
Matthias Clasen fd358990a2 Merge branch 'wip/chergert/reduce-overlay-overhead' into 'main'
Default: avoid use of opacity for overlay scrollbars

See merge request GNOME/gtk!4590
2022-03-22 13:27:54 +00:00
Matthias Clasen 01b91c1ba3 Merge branch 'fix-high-depth-switch' into 'main'
surface: Use correct display when destroying a surface for depth switch

Closes #4773

See merge request GNOME/gtk!4591
2022-03-22 12:58:07 +00:00
Sebastian Keller cc02076b75 surface: Use correct display when destroying a surface for depth switch
When surface depth switches from non-high-depth to high-depth (or vice
versa) the current surface has to be destroyed before a new one can be
created for this window. eglDestroySurface however was getting passed a
GdkDisplay, rather than the EGLDisplay it expects. As a result the old
surface did not get destroyed and the new surface could not be created
causing rendering to freeze.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4773
2022-03-22 08:18:26 +01:00
Christian Hergert b726a2d902 Default: avoid use of opacity for overlay scrollbars
If using the opacity CSS property the renderer cannot optimize these
handles without the use of offscreens due to the use of both a border
and rgb render node.

Instead, we can apply the alpha to the color values and get the same
effect in a way that the GL renderer can optimize without the use of
offscreen textures for a sizeable reduction in runtime overhead.
2022-03-21 22:10:23 -07:00
Marek Černocký 654ae5928a Updated Czech translation 2022-03-21 14:57:35 +01:00
Marek Černocký 1c24514798 Updated Czech translation 2022-03-21 12:14:36 +01:00
Yosef Or Boczko 33f3ab9991 popover-menu: Fix buttons' position in RTL
The radio/check/previous buttons shows in
the wrong place in RTL. Fix it.

#4641

Signed-off-by: Yosef Or Boczko <yoseforb@gmail.com>
2022-03-20 00:54:26 +02:00
aneejit1 91511a80ac Check for 'rst2man' misses installed 'rst2man.py' (#4728)
By default, 'docutils' installs 'rst2man' as 'rst2man.py'. Amend the
check for 'rst2man' to look for 'rst2man.py' as well if 'rst2man' is
not found.
2022-03-19 13:58:40 +00:00
Philipp Kiemle a585457861 Update German translation
(cherry picked from commit d9c39f6795)
2022-03-19 12:32:43 +00:00
Carlos Garnacho 4a0ddac307 Merge branch 'wip/carlosg/fix-accumulated-velocity' into 'main'
kinetic scroll fixes

See merge request GNOME/gtk!4572
2022-03-19 12:02:56 +00:00
Carlos Garnacho f7d9ede82d gtkkineticscrolling: Do not take distance based shortcuts
The pixel distance could be small enough between tick() calls that
this kind of checks might potentially become a problem. Rely only on
the calculated velocity to trigger the STOPPED phase, and use a lower
threshold to avoid cutting the animation too early.

Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/4725
2022-03-19 12:35:11 +01:00
Carlos Garnacho 65839f67f8 gtkscrolledwindow: Do not trigger kinetic helpers on 0 velocity
Doing this is pointless, so it could be skipped.
2022-03-19 12:35:11 +01:00
Carlos Garnacho df40db137b gtkscrolledwindow: Change lifetime of kinetic scroll helpers
In order to properly accumulate scroll velocities, we need to keep
the kinetic scroll helpers after we have possibly stopped them
in the process of initiating a further scroll flick.

So, instead of stopping (and destroying) those helpers on scroll-begin,
keep them until the next scroll-end if a scroll was initiated before
kinetic scroll finished. This way we can fetch the last velocity when
calculating the extra kick.

In order to ensure the helpers don't live beyond what it is expected,
we now also remove them after a finished hold event.

Fixes the accumulation of scrolling velocity on consecutive scroll
sequences.
2022-03-19 12:35:11 +01:00
Carlos Garnacho 129bc27d53 gtkscrolledwindow: Refactor kinetic scroll animation
Do not depend on the kinetic scroll helpers existing or not before
exiting the animation, as we may want to keep those a little bit
longer after stopped.
2022-03-19 12:35:11 +01:00
Carlos Garnacho 274e2b221f gtkkineticscroll: Do not reset velocity after stop()
We may want to fetch the last velocity obtained, even though we
preemptively called stop() on a kinetic scroll helper. Keep this
velocity so it can be queried later on.
2022-03-19 12:35:11 +01:00
Emmanuele Bassi adc4009354 Merge branch 'search-delay-versions' into 'main'
Fix GtkSearchEntry:search-delay docs

See merge request GNOME/gtk!4585
2022-03-19 10:14:04 +00:00
Sebastian Dröge f058a42bd3 Add version marker to GtkSearchEntry:search-delay property 2022-03-19 11:56:05 +02:00
Sebastian Dröge 3a8cb276e7 Fix typo in gtk_search_entry_set_search_delay() docs causing it to not show up 2022-03-19 11:55:03 +02:00
Matthias Clasen eeaa73c12a Merge branch 'macos-fix-scroll-unit-build' into 'main'
macos: fix scroll-unit build

See merge request GNOME/gtk!4584
2022-03-19 03:57:48 +00:00
panoplie 3873861b27 macos: fix scroll-unit build 2022-03-19 02:55:02 +01:00
Carlos Garnacho 8e455e333b Merge branch 'scroll-unit' into 'main'
GdkScrollEvent: indicate the delta unit with a new GdkScrollUnit enum

See merge request GNOME/gtk!4508
2022-03-19 00:47:08 +00:00
Matthias Clasen 3d10e6c3d1 Merge branch 'wip/carlosg/rewritten-events-from-other-toplevels' into 'main'
gtk/main: Make coords out of surface when rewriting events for grabs

Closes #4760

See merge request GNOME/gtk!4566
2022-03-19 00:34:17 +00:00
Matthias Clasen dcc7cf7114 Merge branch 'wip/chergert/gsk-gl-texture-library' into 'main'
gsk/gl: texture libraries, shader creation

See merge request GNOME/gtk!4583
2022-03-18 23:46:17 +00:00
panoplie f1d0886087 gtkeventcontrollerscroll: Map surface scroll unit in discrete steps 2022-03-19 00:41:26 +01:00
panoplie 951e4ee6b2 recorder: Show scroll events deltas unit 2022-03-19 00:41:26 +01:00
panoplie f9e2c106bc gtkrange: Add scroll unit handling 2022-03-19 00:41:26 +01:00
panoplie 53956e5389 gtkscrolledwindow: Add scroll unit handling
On the "scroll" signal, the widget uses
gtk_event_controller_scroll_get_unit() to get the
scroll unit.

When the unit is GDK_SCROLL_UNIT_WHEEL, the
behavior is unchanged: the widget scrolls a
certain number of pixels at each wheel detent
click. This number of pixels is determined by the
window dimensions in get_wheel_detent_scroll_step().

When the delta unit is GDK_SCROLL_UNIT_SURFACE, the
widget directly adds the delta to the number of
scrolled pixels no matter the window dimensions.
2022-03-19 00:41:26 +01:00
panoplie 3ab63fd03b gtkeventcontrollerscroll: Add scroll unit getter
The scroll unit is accessible through
gtk_event_controller_scroll_get_unit() after the
"scroll" signal reception.
2022-03-19 00:41:26 +01:00
panoplie fb4927827b gdk: Add enum to indicate the unit of scroll deltas
Add a new GdkScrollUnit enum that represent the
unit of scroll deltas provided by GdkScrollEvent.
The unit is accessible through
gdk_scroll_event_get_unit().
2022-03-19 00:41:26 +01:00
Christian Hergert cbbca38d88 gsk/gl: use consistent library naming 2022-03-18 14:59:49 -07:00
Christian Hergert c64836e1c9 gsk/gl: make texture libraries more autonomous
This moves a lot of the texture atlas control out of the driver and into
the various texture libraries through their base GskGLTextureLibrary class.

Additionally, this gives more control to libraries on allocating which can
be necessary for some tooling such as future Glyphy integration.

As part of this, the 1x1 pixel initialization is moved to the Glyph library
which is the only place where it is actually needed.

The compact vfunc now is responsible for compaction and it allows for us
to iterate the atlas hashtable a single time instead of twice as we were
doing previously.

The init_atlas vfunc is used to do per-library initialization such as
adding a 1x1 pixel in the Glyph cache used for coloring lines.

The allocate vfunc purely allocates but does no upload. This can be useful
for situations where a library wants to reuse the allocator from the
base class but does not want to actually insert a key/value entry. The
glyph library uses this for it's 1x1 pixel.

In the future, we will also likely want to decouple the rectangle packing
implementation from the atlas structure, or at least move it into a union
so that we do not allocate unused memory for alternate allocators.
2022-03-18 14:59:46 -07:00
Christian Hergert 6b23fe3aa7 gsk/gl: pin atlases to single texture library
This removes the sharing of atlases across various texture libraries. Doing
so is necessary so that atlases can have different semantics for how they
allocate within the texture as well as potentially allowing for different
formats of texture data.

For example, in the future we might store non-pixel data in the textures
such as Glyphy or even keep glyphs with color content separate from glyphs
which do not and can use alpha channel only.
2022-03-18 12:48:43 -07:00
Christian Hergert 9defc7fc64 gsk/gl: add more control over shader generation
This allows the gskglprograms.defs a bit more control over how a shader
will get generated and if it needs to combine sources. Currently, none of
the built-in shaders do that, but upcoming shaders which come from external
libraries will need the ability to inject additional sources in-between
layers.
2022-03-18 12:34:32 -07:00
Christian Hergert 9d56f44cdf gsk/gl: rename glyphs to glyphs_library
This naming style is less likely to collide with shader naming and makes
it clear where it is consumed what it is.
2022-03-18 12:34:32 -07:00
Christian Hergert 1b9da2bb17 gsk/gl: allow configuring atlas size 2022-03-18 12:34:27 -07:00
Christian Hergert 2efc1729e2 gsk/gl: check for format as well
This could potentially happen if a uniform had never been set.
2022-03-18 12:33:33 -07:00
Christian Hergert a66a0dde81 gsk/gl: only clear glyph cache durign reclaimation
We don't need to clear the front cache on every frame as we can clear it
specifically when we do reclaimation to avoid unnecessary memset() calls.
2022-03-18 12:33:33 -07:00
Christian Hergert 7062411bad gsk/gl: ignore max_entry_size when zero
If the max_entry_size is zero, then assume we can add anything to the
atlas. This allows for situations where we might be uploading an arc list
to the atlas instead of pixel data for GPU font rendering.
2022-03-18 12:33:33 -07:00
Christian Hergert 9dbd137ec8 gsk/gl: make max-frame-age configurable
This is nice for some texture libraries that we might want to keep around
for longer than say 60 frames such as a glyph cache.
2022-03-18 12:33:33 -07:00
Matthias Clasen 79fad9f221 gtk-demo: Don't hardcode a title font
We want a large font size, but we don't have to
hardcode Sans.
2022-03-18 12:33:33 -07:00
Matthias Clasen 8f9ee48aaa Merge branch 'filefilter-suffixes' into 'main'
filefilter: Fix <suffixes> in buildable

See merge request GNOME/gtk!4581
2022-03-17 16:57:09 +00:00
James Westman 8eb9844a45 filefilter: Fix <suffixes> in buildable
A bug in GtkFileFilter's GtkBuildable implementation caused the
<suffixes> tag not to be recognized.
2022-03-17 10:52:20 -05:00
Milo Casagrande b90132c917 Update Italian translation
(cherry picked from commit 3e4bfa2bae)
2022-03-17 08:36:13 +00:00
Milo Casagrande 23806b7788 Update Italian translation
(cherry picked from commit 9bbf09fb0a)
2022-03-17 08:34:32 +00:00
Мирослав Николић d266c0d105 Update Serbian translation
(cherry picked from commit c874f65d95)
2022-03-17 06:04:41 +00:00
Carlos Garnacho 581461c2b5 Merge branch 'wip/carlosg/im-wayland-serials' into 'main'
gtk/imwayland: Use serial to control outbound messages

Closes #3641

See merge request GNOME/gtk!4398
2022-03-16 18:52:24 +00:00
Carlos Garnacho f108f053d4 gtk/imwayland: Use serial to control outbound messages
Following the text-input protocol changes at
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/115,
use the serial number to have the client push changes to the
zwp_text_input_v3 object only after compositor/client states match.

This specifically is more lenient to compositors pushing multiple
.done events ahead of the client replying to them.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3641
2022-03-16 17:38:14 +01:00
Matthias Clasen df593ee651 Merge branch 'wip/carlosg/im-text-location' into 'main'
gtkimcontextwayland: Add native surface offset to input coordinates

Closes #4668

See merge request GNOME/gtk!4573
2022-03-16 11:54:26 +00:00
Carlos Garnacho 4dcd011486 gtkimcontextwayland: Add native surface offset to input coordinates
We were missing the surface offset (e.g. shadows) at the time of expressing
the text caret location in surface coordinates. Add this offset so the
coordinates are as expected by the compositor.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4668
2022-03-16 09:57:42 +01:00
Matthias Clasen 6fe7e373e2 Merge branch 'gtk/gss-search-delay' into 'main'
searchentry: Make search delay editable

Closes #4133

See merge request GNOME/gtk!4563
2022-03-15 22:40:54 +00:00
Ondřej Míchal 0c3583b4bd searchentry: Make search delay editable
The default search delay of 150ms can be too low at times[0], leading app
developers to add additional delay while handling the search-changed
signal[1].

Based on past work from hugsie[2].

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4133

[0] https://github.com/getting-things-gnome/gtg/issues/281
[1] https://github.com/getting-things-gnome/gtg/pull/587
[2] https://gitlab.gnome.org/GNOME/gtk/-/issues/678
2022-03-15 23:55:10 +02:00
Kjartan Maraas 5bd0179a88 Update Norwegian Bokmål translation
(cherry picked from commit 72a557087c)
2022-03-15 15:26:58 +00:00
Matthias Clasen f116efd48e Merge branch 'main' into 'main'
gtkplacessidebar: Prevent calling g_object_unref on null

See merge request GNOME/gtk!4569
2022-03-15 14:37:14 +00:00
Matthias Clasen 8057bee295 Apply 1 suggestion(s) to 1 file(s) 2022-03-15 14:35:09 +00:00
Matthias Clasen ab330f1efc Merge branch 'wip/jimmac/symbolics-gnome-42-sync' into 'main'
icons: update symbolics

See merge request GNOME/gtk!4571
2022-03-15 14:29:27 +00:00
Carlos Garnacho e5dc66b10e gtk/main: Fix handling of !owner_events grabs
These are meant to always redirect events to the grabbing surface,
even for other surfaces of the same client. We weren't doing that
(instead letting the event go through unmodified), fix this handling
so GTK sees the events consistenty.
2022-03-15 14:40:49 +01:00
Carlos Garnacho aa43d97a80 gtk/main: Make coords out of surface when rewriting events for grabs
If a grab is held on a toplevel surface tree, and events happen on a
different surface tree from another toplevel/window group, we rewrite
these events so they look like generated on the window group that
holds the grab, but it missed that coordinates would fail to be
translated, so these would stay unchanged and "pointing" to random
parts of the toplevel that is holding the grab and handling the events.

Since off-surface coordinates are not specially meaningful, and in
fact impossible to obtain in some backends, just fake the coordinates
making it sure that all rewritten events point outside the surface.

The grabbing window will still handle the events, but the coordinates
in these will be harmlessly moot.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4760
2022-03-15 14:29:16 +01:00
Matthias Clasen eaf4fb68f3 Merge branch 'avoid-objcopy-on-arm' into 'main'
build: Avoid objcopy on arm

Closes #4757, #4748, and #4752

See merge request GNOME/gtk!4567
2022-03-15 13:08:53 +00:00
Jakub Steiner bfe193e6e2 icons: update symbolics
- match the metaphors/style updates of gnome 42

See https://gitlab.gnome.org/GNOME/gtk/-/issues/4764
2022-03-15 08:31:26 +01:00
Мирослав Николић aa8dec3d27 Update Serbian translation
(cherry picked from commit b59f9b97f3)
2022-03-15 06:33:46 +00:00
Matthias Clasen d2e7060150 Merge branch 'builder-tool-nodisplay' into 'main'
gtk-builder-tool: Operate without display

See merge request GNOME/gtk!4568
2022-03-14 22:15:11 +00:00
Fina Wilke 08f3acb534 gtkplacessidebar: Prevent calling g_object_unref on null
g_object_unref would be called on a null end_icon when provider_account_status
is CLOUD_PROVIDERS_ACCOUNT_STATUS_IDLE
2022-03-14 22:33:35 +01:00
Matthias Clasen 525f96f2f8 gtk-builder-tool: Operate without display
The simplify and validate commands can function
without a display connection, only preview absolutely
needs one. Allow this, by using gtk_init_check().
2022-03-14 15:40:12 -04:00
Matthias Clasen b6b2682bd6 build: Avoid objcopy on arm
The trickery we do with objcopy and ld to speed up
resource inclusion does not seem to work right on
32bit Arm, so just skip it there.

Fixes: #4757, #4748, #4752
2022-03-14 08:44:09 -04:00
Christian Kirbach 1832964188 Update German translation
(cherry picked from commit a1f4735652)
2022-03-13 22:09:17 +00:00
Matthias Clasen eb599653e6 Merge branch 'wip/lantw/build-Don't-use-ld-and-objcopy-when-cross-compiling' into 'main'
build: Don't use ld and objcopy when cross-compiling

See merge request GNOME/gtk!4565
2022-03-13 14:31:23 +00:00
Ting-Wei Lan e1e88ce665 build: Don't use ld and objcopy when cross-compiling
These commands don't work when compiling Windows binaries on Linux.
2022-03-13 15:19:46 +08:00
Balázs Úr 66d21689bc Update Hungarian translation 2022-03-13 00:23:04 +00:00
Matthias Clasen 8186cb8bee Merge branch 'wip/chergert/for-main' into 'main'
macos: fit'n'finish fixes for main

See merge request GNOME/gtk!4564
2022-03-12 19:07:41 +00:00
Baurzhan Muftakhidinov 9b8f28903b Update Kazakh translation
(cherry picked from commit 6ac723321f)
2022-03-12 13:23:41 +00:00
Anders Jonsson 1cd42825c2 Update Swedish translation
(cherry picked from commit 343b08f3e6)
2022-03-12 11:39:33 +00:00
Christian Hergert 166444f115 macos: exclude popups from window list
This probably only matters if you do window list integration for the global
menu on macOS.
2022-03-11 22:36:26 -08:00
Christian Hergert 3cd68c5de5 macos: pass events to foreign windows 2022-03-11 18:25:47 -08:00
Christian Hergert 9e2357d5f3 macos: clear sorted surfaces when showing file chooser
When showing the native file chooser, we need to ensure we clear the
sorted surfaces in the display so that we don't risk delivering events
correctly on the next frame.
2022-03-11 18:19:44 -08:00
Christian Hergert bd0c68f641 macos: dont steal key window from NSPanel
Or we risk making it really difficult to use native file choosers.
2022-03-11 18:07:34 -08:00
Christian Hergert c3a7d79154 macos: fix window level for popups
This comment isn't really accurate anymore it seems, so we can start
setting the proper stacking order for popups now.
2022-03-11 18:01:05 -08:00
Christian Hergert 25624083dd macos: fix attachment of popups to parents
We had code to do it and it never actually got used correctly. This ensures
that the popup services are attached to the parents so that they get proper
stacking orders when displayed. Additionally, it fixes popups from being
shown as their own windows in Exposé.
2022-03-11 17:53:42 -08:00
Christian Hergert 407b5246a6 macos: fix window activation during shadow click-through
If we are clicking through the shadow of a window, we need to take special
care to not raise the old window on mouseUp. This is normally done by the
display server for us, so we need to use the proper API that is public to
handle this (rather than CGSSetWindowTags()). Doing so requires us to
dispatch the event to the NSView and then cancel the activcation from
the mouseDown: event there.
2022-03-11 14:44:07 -08:00
Christian Hergert 6bedcf22bc macos: select new key window after processing events
If we closed a key window in response to events, we need to denote another
window as the new key window. This is easiest to do from an idle so that
we don't clobber notification pairs of "did resign"/"did become" key
window.

We have a sorted set of surfaces by display server stacking, so we can
take the first one we come across that is already mapped and re-show it
to become key/main.
2022-03-11 14:44:06 -08:00
Christian Hergert eeb9d6c398 macos: request layout with server-side decoration
If we have server-side decorations we might need to request a layout in
response to the resize notification. We don't need to do this in other
cases because we already handle that in the process of doing the resize
(and that code is that way because of delayed delivery of NSNotification).
2022-03-11 14:44:06 -08:00
Christian Hergert cf8d2374c5 macos: fix resize when using server-side decorations
If we are using NSWindow titled windows, we don't end up waking up the
frame clock when the window is resized on the display server. This ensures
that we do that after getting a notification of resize.
2022-03-11 14:44:06 -08:00
Christian Hergert 9fa5378d83 macos: set main window in addition to key
If we are showing the window, we might also want to make it the main
window for the application when shown.
2022-03-11 14:44:06 -08:00
Dušan Kazik 90352d760d Update Slovak translation
(cherry picked from commit c8d1f23ff5)
2022-03-11 07:44:15 +00:00
Balázs Úr c3c1763a9f Update Hungarian translation 2022-03-11 01:09:19 +00:00
Matthias Clasen 9f7c9ce6ad Merge branch 'better-format-conversions' into 'main'
gdk: Clean up the optimised premultiply conversion function

See merge request GNOME/gtk!4550
2022-03-10 19:26:25 +00:00
Matthias Clasen 1f155bf39a Merge branch 'wlprotocols-dependency-correctness' into 'main'
meson: use proper handling of wayland-protocols dependency

See merge request GNOME/gtk!4561
2022-03-10 19:15:39 +00:00
Christian Hergert 84014e3414 macos: make transient-for key window when hiding surface
This only handled the popover case before and not the transient-for case.
2022-03-10 08:04:14 -08:00
Christian Hergert 4ced1c90f1 macos: actually drop unnecessary momentum events
These would get passed along to the NSApplication which we don't really
need to have happen. Denote it as such.
2022-03-10 03:21:12 -08:00
Christian Hergert 54c3b947fc macos: queue all pending events
Rather than process these a single event at a time, queue all of the
outstanding events from the NSEvent queue.
2022-03-10 03:20:07 -08:00
Eli Schwartz 94007caf8d meson: use proper handling of wayland-protocols dependency
Ensure that resolution of the subproject occurs via the dependency
interface, not the "poke at subprojects manually" interface, and make
that actually work via --wrap-mode=forcefallback.

There's no need to mark it as not-required and then manually invoke
subproject(), since fallback should work correctly and it is always
needed.

However, if fallback was performed (or forced) it would error out since
get_variable() was instructed to only use pkg-config while the relevant
variable was exported by the subproject as an internal fallback
dependency.
2022-03-10 00:08:36 -05:00
Matthias Clasen 675c8b45b1 Merge branch 'wip/jimmac/legacy-icons-gtk4' into 'main'
icons: add missing legacy fullcolor

See merge request GNOME/gtk!4558
2022-03-09 23:37:26 +00:00
Christian Hergert ea59d174a0 macos: drop enter/exit when in manual drag/resize
If we are in a manual resize/drag then we don't want to generate crossing
events as they can just confuse things.
2022-03-09 13:20:53 -08:00
Christian Hergert 32935d9fb0 macos: allow dropping NSEvent without propagation
There are cases we might want to consume a NSEvent without creating a
GdkEvent or passing it along to the NSApplication for processing. This
creates a new value we can use and check against to propagate that without
having to do out parameters at the slightly odd invalid pointer value for
a GdkEvent (similar to how MMAP_FAILED is done).
2022-03-09 13:19:22 -08:00
Christian Hergert b390e1da4f macos: do not focus new window when resigning main
This can get in the way of how we track changes while events are actively
processing. Instead, we may want to delay this until the next main loop
idle and then check to see if we have a main window as the NSNotification
may have come in right after this.
2022-03-09 12:33:46 -08:00
Jiri Grönroos cccd1147e7 Update Finnish translation
(cherry picked from commit d188c6dbaf)
2022-03-09 19:03:58 +00:00
Emmanuele Bassi d8db5f3217 Merge branch 'fix_gtk_accessible_update_relation_example' into 'main'
fix docs for gtk_accessible_update_relation example

See merge request GNOME/gtk!4559
2022-03-09 18:22:54 +00:00
Marek Černocký f5bb364bb5 Fixed Czech translation 2022-03-09 19:06:22 +01:00
Caolán McNamara 82f57c6a93 GtkMediaStream with gstreamer backend isn't 'prepared' until media is played
This seems to be a problem since:
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3565

To demo the problem, the video demo in gtk4-demo is currently set to
autoplay, but it doesn't autoplay on load as expected because the
"prepared" notification doesn't fire until the user explicitly presses
play.

Similarly if the demo is tweaked to disable autoplay then on loading a
video (or an audio-only ogg) the duration is not known or shown until
the user presses play.

In LibreOffice we want to know what the size of the video is to position
it before the user can interact with it to set it to play. We can
workaround this to some degree by listening to "invalidate-size" on the
GtkMediaStream object which updates for videos, but that doesn't wor
for audio-only streams.

So restore listening to media-info-updated but ignore -1 (which I see
for audio-only where I get -1 and then a useful value) and 0 of the
original report.

see also:
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3550

GNOME/gtk!4513
2022-03-09 16:29:11 +00:00
Caolán McNamara 20c41dce80 fix docs for gtk_accessible_update_relation example 2022-03-09 16:24:47 +00:00
Jakub Steiner a9de385ac5 icons: add missing legacy fullcolor
- relied on in testsuite

See https://gitlab.gnome.org/GNOME/gtk/-/issues/4754
2022-03-09 16:19:16 +01:00
Anders Jonsson ead210c170 Update Swedish translation
(cherry picked from commit 9053fd8335)
2022-03-09 10:50:11 +00:00
Matthias Clasen 2ad471542a Merge branch 'fix-focus-issues' into 'main'
Fix some focus issues

See merge request GNOME/gtk!4556
2022-03-08 19:37:45 +00:00
Danial Behzadi d73cff5846 Update Persian translation
(cherry picked from commit a9720259f0)
2022-03-08 15:01:00 +00:00
Matthias Clasen 213376ee0a text: Stop blinking when we lose focus
We were looking at GtkWidget:has-focus from
event controller signal handlers here, but
the widget property is only changed after
the event controllers.
2022-03-08 06:06:47 -07:00
Matthias Clasen 1cc100415f focus controller: Update for active window
When the window gains or looses active status,
update the focus controllers status.
2022-03-08 06:06:47 -07:00
Matthias Clasen d9ad7884e9 window: Update has-focus property
Update the :has-focus property of the focus
widget when the active status of the window
changes.

We change the property after generating the
GDK_CROSSING_ACTIVE crossing events.
2022-03-08 06:05:49 -07:00
Ask Hjorth Larsen f545d7a910 Updated Danish translation 2022-03-08 01:28:14 +01:00
Ask Hjorth Larsen 206eb647a4 Updated Danish translation of gtk-properties 2022-03-08 01:28:11 +01:00
Aurimas Černius 00e637b480 Updated Lithuanian translation 2022-03-07 18:29:37 +02:00
Emmanuele Bassi bfc8b7b7b6 Merge branch 'gdk-tests-naming' into 'main'
Use the correct name for installed gdk tests

See merge request GNOME/gtk!4555
2022-03-07 15:34:31 +00:00
Sebastien Bacher c44288c739 Use the correct name for installed gdk tests 2022-03-07 16:13:38 +01:00
Luna Jernberg 2fb5104731 Update Swedish translation
(cherry picked from commit 89bba41fd7)
2022-03-07 08:09:54 +00:00
Matthias Clasen 0ae4d80766 Merge branch 'wip/chergert/for-main' into 'main'
macos: fixes for main

See merge request GNOME/gtk!4553
2022-03-06 01:36:13 +00:00
Christian Hergert f5098e4fc5 macos: fix cursor blink time
The value from settings is for the duration of the blink period, not the
timeout. This fixes the blink lasting longer than 10 seconds.
2022-03-05 12:01:53 -08:00
Christian Hergert 28607f082c macos: require input region to become key
Some things cannot become key windows (like tooltips). We can use the
input_region existence to determine if we should allow it as a key window.
2022-03-05 11:58:43 -08:00
Matthias Clasen f3968f2f1e Merge branch 'fix-doc-typo' into 'main'
Fix a documentation typo

Closes #4747

See merge request GNOME/gtk!4552
2022-03-05 05:50:10 +00:00
Matthias Clasen 88fa226223 Fix a documentation typo
It is XDG_DATA_HOME.

Fixes: #4747
2022-03-04 22:18:06 -07:00
Jordi Mas i Hernandez c4c496a31c Update Catalan translation
(cherry picked from commit 2be2912e43)
2022-03-04 21:40:53 +00:00
Changwoo Ryu c1eac4a421 Update Korean translation 2022-03-04 14:22:53 +00:00
Changwoo Ryu b5d1323f49 Update Korean translation
(cherry picked from commit 2755ad19be)
2022-03-04 14:20:48 +00:00
Matthias Clasen e297ac319d Merge branch 'fixup-shadernode-constructor' into 'main'
Fix up preconditions of gsk_gl_shader_node_new

Closes #4739

See merge request GNOME/gtk!4551
2022-03-04 06:06:35 +00:00
Matthias Clasen bf852bea24 Fix up preconditions of gsk_gl_shader_node_new
These were not quite right, and implied that args
may be NULL, when it really can't.

Fixes: #4739
2022-03-03 22:40:10 -07:00
Matthias Clasen a652507b7b Merge branch 'center-layout-setters' into 'main'
gtk: Have GtkCenterLayout hold a reference to its widgets

See merge request GNOME/gtk!4544
2022-03-03 19:38:28 +00:00
Jason Francis 4a2a76c231 gtk: Have GtkCenterLayout hold a reference to its widgets 2022-03-03 14:00:25 -05:00
Benjamin Otte 8cb7369b7a Merge branch 'wip/chergert/KHR_swap_buffers_with_damage' into 'main'
gdk: use EGL_KHR_swap_buffers_with_damage

See merge request GNOME/gtk!4548
2022-03-03 15:29:47 +00:00
Emmanuel Gil Peyrot 588076d166 gdk: Add a rgb8 → rgba8 conversion macro
This one can be used for both premultiplied and non-premultiplied alpha
formats, since alpha is always 255.  It is useful for opaque PNG upload
on both cairo and GL renderers.
2022-03-03 16:05:52 +01:00
Emmanuel Gil Peyrot 3a98b28ab7 gdk: Make the optimized premultiply function a macro
That way, all permutations are possible.  Previously it was only useful
in the cairo renderer, which required rgba8 → premultiplied bgra8, while
the GL renderer required rgba8 → premultiplied rgba8.  Now both are
available.
2022-03-03 16:04:45 +01:00
Emmanuel Gil Peyrot cfeedcc321 gdk: Remove pixel format conversion ARM intrinsics
This was only useful when building for AArch32 without -mfpu=neon, on
AArch64 or with -mfpu=neon gcc is smart enough to do the auto-
vectorisation, leading to code almost as good as what I wrote in
1fdf5b7cf8.
2022-03-03 16:04:45 +01:00
Matthias Clasen d0aedbc9fc Merge branch 'bilelmoussaoui/docs' into 'main'
headerbar: Fix docs

See merge request GNOME/gtk!4545
2022-03-03 14:11:25 +00:00
Changwoo Ryu 5557a528b6 Update Korean translation
(cherry picked from commit 156f99560d)
2022-03-03 12:46:55 +00:00
Christian Hergert 5316eb0c35 gdk: use EGL_KHR_swap_buffers_with_damage
It appears that NVIDIA does not implement EGL_EXT_swap_buffers_with_damage
on their EGL implementation, but does implement the KHR variant of it.
This checks for a suitable implementation and stores a pointer to the
compatible implementation within the GdkGLContextPrivate struct.
2022-03-03 01:22:01 -08:00
Bilal Elmoussaoui e6afe28de5 headerbar: Fix docs 2022-03-03 08:36:33 +00:00
Matthias Clasen eaf0353205 Merge branch 'wip/chergert/for-main' into 'main'
macos: various fixes

See merge request GNOME/gtk!4543
2022-03-02 13:37:06 +00:00
Carlos Garnacho f9f9bd3f5b Merge branch 'xdg-activation-no-surface' into 'main'
wayland: xdg-activation: Don't assume there's a focus surface

See merge request GNOME/gtk!4366
2022-03-02 12:44:52 +00:00
Christian Hergert ca79688f52 macos: clear window stack before requesting motion
We want to ensure that we recalculate the sort order of windows before
processing the motion. Generally this would be done in response from the
display server in GdkMacosWindow, but I've seen it possible to race there.
2022-03-02 01:04:53 -08:00
Christian Hergert efa8f903c2 macos: invalidate surface contents when mapping 2022-03-02 00:48:06 -08:00
Christian Hergert f7d0b91267 macos: move children when monitor changes
We can rely on other code to move monitors, but specifically with children
we want to try harder to move them as a group and keep positioning in tact.
2022-03-02 00:47:27 -08:00
Christian Hergert ed4f0de2b0 macos: make move_resize possibly idempotent
We need to handle the case where we might be racing against an incoming
configure event due to how notifications are queued from the display
server. Rather than calling configure (and possibly causing other things
to move around) this just queries the display server directly for the
coordinates that we care about.

Additionally, we can display:NO as we are in control of all the display
process now using CALayer.
2022-03-02 00:45:44 -08:00
Christian Hergert 50b96dcdd5 macos: handle transient-for from configure
We failed to handle the toplevel with transient-for case here which could
cause our X/Y calculations to be off in other areas such as best monitor
detection.
2022-03-02 00:43:33 -08:00
Christian Hergert cf25f2c04b macos: use parent frame clock again
We do actually need the parent frame clock here because it is the way we
ensure that we get layout called for our popup surfaces at the same time
as the parent surface.
2022-03-02 00:42:09 -08:00
Christian Hergert ddf07ffe22 macos: reduce chances for layout cycles
We need to be more careful about when we request a layout because it can
cause us to get into a layout cycle at maximum frame rate.
2022-03-02 00:40:21 -08:00
Christian Hergert 82f1eaacc9 macos: improve initial placement of toplevels with parent
This doesn't appear to happen much, but if it does it is nice to setup
the window placement initially. Generally, transient-for is set after
the creation of the toplevel rather than here.
2022-03-02 00:38:39 -08:00
Christian Hergert 4cdb07fa02 macos: leave a note about monitor configuration
It can be helpful to see what the range of monitor values is when emulating
the GDK coordinate system.
2022-03-02 00:37:07 -08:00
Christian Hergert bdd5393084 macos: use GdkMacosBuffer for storing damage region
The GdkMacosBuffer object already has storage for tracking the damage
region as it is used in GdkMacosCairoContext to manually copy regions from
the front buffer to the back buffer. This makes the GdkMacosGLContext also
use that field so that we can easily drop old damage regions when the
buffer is lost. This happens during resizes, monitor changes, etc.
2022-03-02 00:36:17 -08:00
Christian Hergert 27b87ebec5 macos: add clamp helper to keep rectangle in workarea
This helper is useful to ensure we are consistent with how we keep a
window clamped to the workarea of a monitor when placing windows on
screen. (This does not affect snap-to-edges).
2022-03-02 00:34:27 -08:00
Christian Hergert 8c0df66d5f macos: style cleanup 2022-03-02 00:33:13 -08:00
Christian Hergert e5238bf54f macos: add re-entrancy check when monitors change 2022-03-02 00:32:50 -08:00
Christian Hergert e9abcde031 macos: check for best_monitor before using
Make sure we have a monitor to enqueue/dequeue from before using it. That
also allows us to use this from destroy and what-not.
2022-03-02 00:32:07 -08:00
Goran Vidović d45281e6c7 Update Croatian translation
(cherry picked from commit 4eee322654)
2022-03-01 13:05:13 +00:00
Goran Vidović 3fd5ebffcb Update Croatian translation
(cherry picked from commit 67ae05d855)
2022-03-01 12:54:18 +00:00
Carlos Garnacho 88a621fa13 Merge branch 'wip/carlosg/focus-request-over-xdg-activation' into 'main'
wayland: Use xdg-activation for non-startup initiated focus requests

See merge request GNOME/gtk!4535
2022-03-01 11:21:12 +00:00
Marek Černocký ce4b799f1e Updated Czech translation 2022-03-01 12:08:18 +01:00
Carlos Garnacho 4dcacff312 wayland: Use xdg-activation for non-startup initiated focus requests
Currently, we have all the plumbing in place so that GTK consumes the
startup notification ID when focusing a window through the xdg-activation
protocol.

This however misses the case that a window might be requested to be
focused with no startup ID (i.e. via interaction with the application,
not through GApplication or other application launching logic).

In this case, we let the application create a token that will be
consumed by itself. The serial used is that from the last
interaction, so the compositor will still be able to do focus prevention
logic if it applies.

Since we already do have a last serial at hand, prefer xdg-activation
all the way over the now stale gtk-shell focusing support. The timestamp
argument becomes unused, but that is a weak argument to prefer the
private protocol over the standard one. The gtk-shell protocol support
is so far left for interaction with older Mutter.
2022-03-01 11:38:51 +01:00
Matthias Clasen fd7667246d Merge branch 'wip/chergert/for-main' into 'main'
macos: various fixes and multi-monitor frame clocks

Closes #4736, #4735, #4732, #4733, and #4734

See merge request GNOME/gtk!4533
2022-02-28 22:13:03 +00:00
Matthias Clasen b8cb15f28d Merge branch 'wip/carlosg/scrolledwindow-warning' into 'main'
gtkscrolledwindow: Do not try to doubly trigger deceleration

Closes #4730

See merge request GNOME/gtk!4536
2022-02-28 21:50:19 +00:00
Christian Hergert 51607ce93c macos: avoid size/origin changes when possible
If _gdk_macos_surface_move_resize() was called with various -1 parameters
we really want to avoid changing anything even if we think we know what
the value might be. Otherwise, we risk messing up in-flight operations that
we have not yet been notified of yet.

This improves the chances we place windows in an appropriate location as
they don't et screwed up before window-manager placement.
2022-02-28 13:09:57 -08:00
Christian Hergert 66284cd245 macos: start application in foreground
We need to bring the application to the foreground in multiple ways, and
this call to [NSApp activateIgnoringOtherApps:YES] ensures that we become
foreground before the first window is opened. Otherwise we end up starting
applications in the background.

Fixes #4736
2022-02-28 12:20:24 -08:00
Christian Hergert f9faecd5b7 macos: add GDK_NOTE when surface changes monitor 2022-02-28 12:13:29 -08:00
Christian Hergert 92261b5022 macos: add GDK_NOTE for surface sizing and placement
This can be useful to debug sizing issues with the surface as well as the
"window manager" placement code.
2022-02-28 11:50:21 -08:00
Christian Hergert 91f5bfd211 macos: leave note about monitor discovery 2022-02-28 11:36:27 -08:00
Christian Hergert 63f20b173d macos: external access to display name helpers
These can be handy to print debug information when we don't have a
GdkMacosMonitor to work with.
2022-02-28 11:36:27 -08:00
Christian Hergert 25b3bd64af macos: fix redisplay of GdkPopup
This broke recently during the configure cleanups and also needed to have
the tail directions fixed again.
2022-02-28 11:36:27 -08:00
Christian Hergert fc4d36e50a macos: fix cairo renderer with double buffering
If we are double buffering surfaces with IOSurface then we need to copy
the area that was damaged in the previous frame to the back buffer. This
can be done with IOSurface but we need to hold the read-only lock so that
we don't cause the underlying IOSurface contents to be invalidated.

Additionally, since this is only used in the context of rendering to a
GdkMacosSurface, we know the life-time of the cairo_surface_t and can
simply lock/unlock the IOSurface buffer from begin_frame/end_frame to have
the buffer flushing semantics we want.

To ensure that we don't over damage, we store the damage in begin_frame
(and copy it) and then subtract it from the next frames damage to determine
the smallest amount we need to copy (taking scale factor into account).

We don't care to modify the damage region to swapBuffers because they
already have the right contents and could potentially fall into another
tile anyway and we'd like to avoid damaging that.

Fixes #4735
2022-02-28 11:36:27 -08:00
Christian Hergert dbede0b115 macos: add readonly IOSurfaceLock helper
This can be used to lock a surface for reading to avoid causing the
surface contents to be invalidated. This is needed when reading back from
a front-buffer to the back-buffer as is needed when using Cairo surfaces
to implement something similar to BufferAge.
2022-02-28 11:36:27 -08:00
Christian Hergert 1e40033852 macos: short-circuit on NSEventPhaseMayBegin
We only need to send a single event in this case, so just short-circuit
instead of trying to return an additional event.
2022-02-28 11:36:27 -08:00
Christian Hergert 478bf45320 macos: support mix-rate monitors
Previously, a single CVDisplayLink was used to drive updates for all
surfaces across all monitors. It used a 'best guess' rate which would
allow for updates across monitors of mixed rates. This is undesirable for
situations where you might have a 144hz monitor as it does not allow for
reaching up to that frame rate.

Instead, we want to use a per-monitor CVDisplayLink which will fire at the
rate of the monitor down to the level of updates we require. This commit
does just that.

When a surface crosses onto a new monitor, that monitor is used to drive
the GdkFrameClock.

Fixes #4732
2022-02-28 11:36:27 -08:00
Christian Hergert dac0b7d609 macos: use video mode for refresh rate and interval
Using the mode allows better detection of refresh rate and refresh
interval for the CVDisplayLink bridge to GdkFrameClock. Using it can help
ensure that our 144hz displays can actually reach that rather than falling
back to just 60hz.

This will also need future commits to rework the displaylink source to be
per-monitor.
2022-02-28 11:36:27 -08:00
Christian Hergert d14987e819 macos: send stop event when fingers touch
When the fingers are placed on the touchpad, we get a scroll event with
the phase NSEventPhaseMayBegin. We can use this to synthesize an is_stop
event. This results in the scrolledwindow stopping scroll with stop
gestures.

This can cause another warning as well, however, which should be addressed
from #4730.

Fixes #4733
2022-02-28 11:36:27 -08:00
Christian Hergert 3a0077f65f macos: remove emulated scroll events
We don't appear to actually need the emulated scroll events and they get
in the way of proper scrolling with the touchpad.

Fixes #4734
2022-02-28 11:36:27 -08:00
Christian Hergert 03882ef8e5 macos: do not inherit parents frame clock
Windows can end up on different monitors despite having a parent or
transient-for ancestor. We want them to be driven by the CVDisplayLink
for the best-monitor, and so this needs to be unshared.
2022-02-28 11:36:27 -08:00
Christian Hergert 505e10f3ea macos: calculate best monitor when changing screens
When we change screens, we can keep track of the best monitor so that we
can use it to register CVDisplayLink callbacks.
2022-02-28 11:36:27 -08:00
Christian Hergert 1e01444de8 macos: remove duplicated opaque_region field
This can be relied upon from GdkSurface and we do not need to keep a copy
of it. Just remove it and use the GdkSurface.opaque_region field.
2022-02-28 11:36:27 -08:00
Christian Hergert 4404c43cd3 macos: use display id when creating CVDisplayLink
Currently we're using a display link that is for all active displays which
is just the display server trying to find some timings that try to overlap
as many as possible.

That was fine for a prototype, but we really need to do better for
situations with mixed frame rate (such as 60hz and 120hz promotion
displays). Additionally, the 144hz external monitor I have will never
reach 144hz using the current design.

This is just the first step in changing this, but the goal is to have
one of these attached to each GdkMacosMonitor which we can then use to
thaw surfaces specific to that monitor.
2022-02-28 11:36:27 -08:00
Christian Hergert 92a7c7cdc3 macos: move feedback mechanisms into separate file
We will eventually be needing additional feedback from the display server
which would be nice to keep away from the rest of GdkMacosDisplay for
cleanliness sake. Particularly for feedback from mission control and other
environment factors that requires private API for proper integration.
2022-02-28 11:36:23 -08:00
Carlos Garnacho 33db142eab gtkscrolledwindow: Do not try to doubly trigger deceleration
This may come from different sources at around the same time, e.g.
a hold gesture while on overshoot. Avoid doing that if an
animation is already set.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4730
2022-02-28 20:27:43 +01:00
Carlos Garnacho 68319afd23 Merge branch 'startup-vs-xdg-activation' into 'main'
Startup tracking with xdg-activation

See merge request GNOME/gtk!3883
2022-02-28 17:29:09 +00:00
Guido Günther 25f4e597ee print-editor: Use gtk_window_present()
This lets xdg-activation work as otherwise gdk_wayland_surface_focus is
never invoked.
2022-02-28 16:55:54 +00:00
Guido Günther db8339ca66 demo: Use gtk_window_present()
This lets xdg-activation work as otherwise gdk_wayland_surface_focus is
never invoked.
2022-02-28 16:55:54 +00:00
Guido Günther 5ba02e3459 widget-factory: Use gtk_window_present()
This lets xdg-activation work as otherwise gdk_wayland_surface_focus is
never invoked.
2022-02-28 16:55:54 +00:00
Guido Günther 999509be61 wayland: Keep startup_notification_id around long enough
When using xdg_activation we need to keep the id around until we send
the first activate to signal succesful startup.
2022-02-28 16:55:54 +00:00
Guido Günther 5dca6dce91 window: Make sure we call gdk_wayland_surface_focus
When using xdg_activation this is responsible for submitting
the activation token / startup id to the compositor.
2022-02-28 16:55:54 +00:00
Luca Bacci d3acfa8c2b Merge branch 'gdk-win32-configure-as-needed-fullscreen' into 'main'
GdkWin32: Configure as needed when fullscreening toplevels

Closes #4631

See merge request GNOME/gtk!4506
2022-02-28 15:11:36 +00:00
Luca Bacci c1cc8c979b Merge branch 'win32-fix-4724-gtk4' into 'main'
gdkkeys-win32: Only perform substitution as last-resort [GTK4]

See merge request GNOME/gtk!4531
2022-02-28 08:44:10 +00:00
Matthias Clasen eed74f6ea0 Merge branch 'ci-disable-debug' into 'main'
CI: disable debug for MSVC

See merge request GNOME/gtk!4525
2022-02-27 15:45:16 +00:00
Philip Zander e5a4b91997 gdkkeys-win32: Only perform substitution as last-resort
Instead of performing keyboard layout substitution whenever we find a matching
entry in the registry, first try to load the original layout and only attempt
substitution when that fails.

See #4724
2022-02-27 16:40:58 +01:00
Matthias Clasen 885b34d382 Merge branch 'wip/ricotz/annotations' into 'main'
gdk: Add missing out annotation on gdk_content_deserialize_finish

See merge request GNOME/gtk!4529
2022-02-27 00:50:07 +00:00
Rico Tzschichholz 3faf9d85bb gdk: Add missing out annotation on gdk_content_deserialize_finish 2022-02-26 22:05:20 +01:00
Benjamin Otte 4cd4c25c25 Merge branch 'wip/otte/for-main' into 'main'
glrenderer: Don't return NULL form render_texture()

See merge request GNOME/gtk!4522
2022-02-26 20:15:18 +00:00
Benjamin Otte bffa5dfddd listview: Fix return_if_fail()s 2022-02-26 20:35:44 +01:00
Benjamin Otte 2fe20878c3 flattenlistmodel: Fix indentation 2022-02-26 20:35:44 +01:00
Benjamin Otte b28c3ef3d9 renderers: Handle large viewports
When large viewports are passed to gsk_renderer_render_texture(), don't
fail (or even return NULL).

Instead, draw multiple tiles and assemble them into a memory texture.

Tests added to the testsuite for this.
2022-02-26 20:35:44 +01:00
Matthias Clasen ed5fb4bbfe Merge branch 'try-to-fix-ci-build' into 'main'
Revert "Bump the wayland-protocols dep"

See merge request GNOME/gtk!4528
2022-02-26 18:08:38 +00:00
Matthias Clasen 2dd86aaa00 Revert "Bump the wayland-protocols dep"
This reverts commit 6a7da77980.

This is causing various build problems between wayland-protocols
and wayland-scanner.
2022-02-26 12:03:22 -05:00
Christoph Reiter eaf952d902 CI: disable debug for MSVC
CI currently fails with "fatal error LNK1318: Unexpected PDB error; OK (0) ''"
Google tells me it might be related to hitting a memory limit. Let's try
disabling debug for now.
2022-02-26 16:32:15 +01:00
Piotr Drąg 88cb6a46f2 Update Polish translation 2022-02-26 13:29:33 +01:00
Matthias Clasen c76b4bdc77 Merge branch 'wip/chergert/macos-add-window-accessor' into 'main'
macos: add getter for NSWindow with macOS windowing

See merge request GNOME/gtk!4509
2022-02-26 03:17:59 +00:00
Matej Urbančič 62fe4eae16 Update Slovenian translation 2022-02-25 21:13:32 +00:00
Christian Hergert 99a40de8ad macos: add getter for NSWindow with macOS windowing
There may be various reasons that an application could need access to the
underlying NSWindow that is being used to display the GdkMacosSurface
contents. This provides a minimal API to do that without exposing our
implementation details through public API.

As our rendering system is likely to change over time, we very much want
to keep GdkMacosView, GdkMacosLayer, GdkMacosTile, and GdkMacosWindow all
private implementation details which are subject to change.

As this is public API, we are a bit long-winded with the name so it is
clear what is being accessed without polluting symbol names with things
like "ns" as we used to.
2022-02-25 11:36:39 -08:00
Aleksandr Melman b8376407a4 Update Russian translation 2022-02-25 18:38:49 +00:00
Luca Bacci a5643b0c83 Merge branch 'gdk-win32-fix-issue-1402-gtk4' into 'main'
Fix last error reporting when calling GetClipboardOwner

Closes #1402

See merge request GNOME/gtk!4521
2022-02-25 16:54:15 +00:00
Luca Bacci 828688d5cd Fix last error reporting when calling GetClipboardOwner
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/1402
2022-02-25 17:14:39 +01:00
Matthias Clasen fc47b913b1 Merge branch 'wip/chergert/macos-fix-popover-tails' into 'main'
macos: fix positioning of popover tails

See merge request GNOME/gtk!4515
2022-02-25 15:50:15 +00:00
Matthias Clasen 7d8b3357a5 Merge branch 'wip/chergert/better-positioning' into 'main'
macos: fix positioning of popover tails

See merge request GNOME/gtk!4516
2022-02-25 15:49:50 +00:00
Matthias Clasen e0b98bc7de Merge branch 'wip/chergert/macos-fix-titled-resize' into 'main'
macos: fix origin during live resize of titled window

See merge request GNOME/gtk!4519
2022-02-25 15:49:07 +00:00
Matthias Clasen 493b145496 Merge branch 'wip/chergert/macos-unfullscreen' into 'main'
macos: restore unfullscreen frame with style mask

See merge request GNOME/gtk!4518
2022-02-25 15:48:44 +00:00
Matthias Clasen 1b2c11d7f5 Merge branch 'wip/chergert/fix-macos-overshoot' into 'main'
macos: fix kinetic scrolling with overshoot

See merge request GNOME/gtk!4517
2022-02-25 14:37:45 +00:00
Christian Hergert a56828237a macos: fix origin during live resize of titled window
When using server-side-decorations, we need to avoid potential cycles with
compute-size as it may not have the new sizing information yet. We can
just short circuit during "live resize" to get that effect.

Fixes poor window resizing from top-left on titled windows.
2022-02-24 23:29:18 -08:00
Christian Hergert 56e2a7e8bb macos: restore unfullscreen frame with style mask
This doesn't give us appropriate results if we use the window delegate.
Instead, we need to adjust the frame at the same time we change the
style mask so that we end up in the same location.
2022-02-24 22:32:43 -08:00
Christian Hergert f278f3610b macos: fix kinetic scrolling with overshoot
Previously we had issues on macos where the overshoot would keep showing.
To fix this we need to actually use discrete events instead of the
generated deltas from macOS in the scroll wheel case. Additionally, we need
to drop the kinetic momentum events from macOS and rely on the gtk kinetic
events which are already happening anyway. We also need to submit the
is_stop event for the GDK_SCROLL_SMOOTH case when we detect it.

To keep the discrete scroll events correct, we need to alter the hack in
gtkscrolledwindow.c to use the same path as other platforms except for
when a smooth scroll event is in place. In the future, I would imagine that
this falls into the boundary of high-precision scrolling and would share
the same code paths as other platforms.

With all of these in place, kinetic scrolling with overshoot appears the
same on macOS as other platforms.
2022-02-24 18:58:48 -08:00
Christian Hergert c111e633e9 macos: remove unused code 2022-02-24 18:58:07 -08:00
Christian Hergert eea7cf30bb macos: create new windows with slight origin offset
When creating new windows, it is better if we create them with a slight
offset to where they were created before so that they are visible to the
user separately from what they might be overshadowing.
2022-02-24 18:58:07 -08:00
Christian Hergert 36bdcfaccb macos: fix positioning of popover tails
This broke with the previous fixes for initial window positioning. We need
the initial positioning so that tails will be displayed correctly when the
popover surface is displayed.
2022-02-24 16:29:53 -08:00
Luming Zh 45bb820656 Update Chinese (China) translation 2022-02-25 00:07:39 +00:00
Fran Dieguez 617deb8bb6 Update Galician translation 2022-02-24 12:53:57 +00:00
Matthias Clasen 8efcd34dbe Merge branch 'ebassi/unexport-x11' into 'main'
Remove unnecessary warning

See merge request GNOME/gtk!4512
2022-02-24 12:32:41 +00:00
Daniel Mustieles a78b573f8b Updated Spanish translation 2022-02-24 12:54:02 +01:00
Emmanuele Bassi 226f0e0567 Remove unnecessary warning
Unexporting the window handle on X11 is a no-op, so there's no need
to emit a warning.
2022-02-24 02:04:06 +00:00
Rafael Fontenelle 4304a494ae Update Brazilian Portuguese translation 2022-02-23 23:54:08 +00:00
Matthias Clasen b71ff21530 Merge branch 'bump-wayland-dep' into 'main'
Bump the wayland-protocols dep

See merge request GNOME/gtk!4511
2022-02-23 21:05:01 +00:00
Matthias Clasen 6a7da77980 Bump the wayland-protocols dep
Bump the dep to 1.25, so we can add support
for toplevel bounds.
2022-02-23 14:30:49 -05:00
Matthias Clasen c5f92340ee Fix up tests for version bump 2022-02-23 14:29:48 -05:00
Hugo Carvalho 572a884e90 Update Portuguese translation 2022-02-23 11:29:15 +00:00
Emin Tufan Çetin 69bc9d0702 Update Turkish translation 2022-02-23 09:42:06 +00:00
Yuri Chornoivan 34ff9e359b Update Ukrainian translation 2022-02-23 07:10:19 +00:00
Benjamin Otte de705c2a2b Add 4.8 version macros 2022-02-22 22:55:48 -05:00
Benjamin Otte d1102f586c build: Set version to 4.7 2022-02-22 22:55:42 -05:00
Luca Bacci ab65e8e178 GdkWin32: Configure as needed when going fullscreen
Apply the fixes made by Chun-Wei Fan in [1] also for fullscreening /
unfullscreen. Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4631

Also set the SWP_FRAMECHANGED flag as written by Raymond Chen in "How
do I switch a window between normal and fullscreen?" [2]

> An important flag to pass here is SWP_FRAME­CHANGED, which tells
> the window manager to recalculate the window decorations (which we
> need it to do because we just changed them).

References:
[1] - https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3712
[2] - https://devblogs.microsoft.com/oldnewthing/20100412-00/?p=14353
2022-02-22 09:15:28 +01:00
Guido Günther 4d741bac98 wayland: xdg-activation: Don't assume there's a focus surface
Tools like gtk4-launch can't set surface on the activation token so
don't require it. If the compositor requires it we can't do anything
about it anyway. This avoids a critical:

   (gtk4-launch:23497): Gdk-CRITICAL **: 17:07:24.704: gdk_wayland_surface_get_wl_surface: assertion 'GDK_IS_WAYLAND_SURFACE (surface)' failed

Fixes: be4216e051 ("gdk/wayland: Support the xdg-activation wayland protocol")

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2022-01-19 08:57:10 +01:00
335 changed files with 40018 additions and 37295 deletions
-312
View File
@@ -1,315 +1,3 @@
Overview of Changes in 4.6.8, 24-10-2022
========================================
* Input:
- Fix problems with input method interactions that caused
dead keys not to work
* GtkText:
- Respect the no-emoji input hint fully
* GtkNotebook:
- Fix an infinite loop in accessibility code
- Event handling fixes
* GtkFileChooser:
- Restore ~ and .functionality
* GtkTreeView:
- Event handling fixes
* GtkTreeListModel:
- Prevent possible crashes with collapsed nodes
* GtkGridView:
- Fix issues with rubberband selection
* GtkEmojiChooser:
- Fix navigation with arrow keys when filtered
* GtkPopover:
- Fix problems with focus when dismissing popovers
- Fix problems with focusing editable labels in popovers
* GtkStackSidebar:
- Improve accessible presentation
* Wayland:
- Make gtk_launch_uri more robust
- Make monitor bounds handling more robust
- Prevent shrinking clients due to wrong toplevel bounds
* Flatpak:
- Fix file DND with the FileTransfer portal
* Translation updates
Brazilian Portuguese
Croatian
Czech
Georgian
German
Hungarian
Icelandic
Lithuanian
Polish
Portuguese
Serbian
Slovenian
Swedish
Turkish
Overview of Changes in 4.6.7, 17-08-2022
========================================
* Miscellaneous memory leak fixes
* GtkTreeView:
- Fix a problem with DND
- Fix a problem with row selection
* GtkTreePopover:
- Support scrolling
* GtkGridView:
- Fix issues with rubberband selection
* GtkSnapshot:
- Make GtkSnapshot work from bindings
* X11:
- Fix preferred action for DND
* Windows:
- Fix DND
* Translation updates
Croatian
Georgian
Indonesian
Russian
Serbian
Spanish
Overview of Changes in 4.6.6, 02-07-2022
========================================
* Fix translations in GTKs own ui files
* Wayland:
- Fix a problem with the activation protocol
- Don't force the HighContrast icontheme
* Windows:
- Fix a problem with builtin icons if the
hicolor icontheme is not installed
* Translation updates:
Brazilian Portuguese
Russian
Turkish
Overview of Changes in 4.6.5, 27-05-2022
========================================
* GtkFileChooser:
- Fix pasting text into the name field
* GtkText:
- Remove an assertion that is sometimes hit
* Wayland:
- Ensure that our cursor surfaces don't violate
protocol constraints
* Accssibility:
- Fix a problem in the accessibility tree
* Translation updates:
Brazilian Portuguese
German
Persian
Polish
Portuguese
Russian
Swedish
Turkish
Ukrainian
Overview of Changes in 4.6.4, 13-05-2022
========================================
* GtkFileChooser:
- Fix select button sensitivity in select_folder mode
- Fix some fallout from list model porting
* GtkListView, GtkColumnView:
- Optimize scrolling
* print-to-file:
- Handle nonexisting files better in the dialog
* Avoid infinite loops in size allocation
* CSS:
- Optimize a case of reparenting that is important in GtkListView
* GSK:
- Check for half-float support before using it
* Wayland:
- Ignore empty preedit updates This fixes a problem with
textview scrolling
- Freeze popups when hidden. This addresses a frame rate drop
* Translation updates
Hebrew
Nepali
Overview of Changes in 4.6.3, 21-04-2022
========================================
* GtkOverlay:
- Bring back positional style classes
* GtkFileChooser:
- Prevent unwanted completion popups
- Fix small problems in save mode
- Fix buildable suport of GtkFileFilter
* GtkPopover:
- Fix button positions in right-to-left locales
* GtkLabel:
- Fix small issues with link handling
* Tooltips:
- Don't restrict the minimum tooltip length
* Theme:
- Don't use opacity for overlay scrollbars
- Fix selection text color in vertical spin buttons
* GSK:
- Accept textures that are generated by webkit
- Align offscreen rendering to the pixel grid
* Accessibility
- Fix a crash in startup when orca is running
* Input:
- Fix display changes in GtkIMMultiContext
- Fix activating on-screen keyboards
- Always propagate hold events in GtkEventControllerScroll
* Windows:
- Fix a critical warning in clipboard handling
- Report serial numbers for events
* MacOS:
- Prevent fullscreen transition reentrancy
* Translation updates
British English
Czech
German
Indonesian
Latvian
Overview of Changes in 4.6.2, 18-03-2022
========================================
* GtkScrolledWindow:
- Set scroll-to-focus on viewports
- Avoid doubly triggering deceleration
* GtkEntry:
- Stop cursor blinking on focus-out
* Emoji:
- Update Emoji data to CLDR 40 and Unicode 14
- Add more locales for Emoji data (da, de, en, es,
fr hu, it, ko, lt, ms, nl, pl, pt, ru, s, uk zh)
* GDK
- Optimize texture conversions on x86 and ARM
- Use EGK_KHR_swap_buffers_with_damage if available
* GSK
- Avoid clearing opaque regions
- Support using a non-default framebuffer
- Handle large viewports by tiling
* Wayland:
- Prefer xdg-activation over gtk-shell
- text protocol: Fix text caret location
- text protocol: Use serials to control outbound messages
* Inspector:
- Show app ID and resource path
* Demos:
- widget-factory: Handle F11 to toggle fullscreen
* Tools:
- gtk-builder-tool: Allow use without display
* Windows:
- Fix preedit window placement on HiDPI
- Build improvements
- Fix fullscreen handling
* MacOS:
- Fix scrolling with an external mouse
- Fix kinetic scrolling with overshoot
- Improve monitor detection
- Many input handling fixes
- Support OpenGL accelerated video playback
- Support fullscreen
- Improve interactive window resizing and moving
- Fix backdrop state handling
- Fix GtkFileChooserNative filtering
- Use CALayer and IOSurface for rendering
- Use per monitor CVDisplayLink to support mixed-rate monitors
- Start applications in foreground
- Fix cursor blink time
* Translation updates
Basque
Brazilian Portuguese
Catalan
Chinese (China)
Croatian
Czech
Danish
Finnish
Galician
German
Hebrew
Hungarian
Italian
Kazakh
Korean
Lithuanian
Norwegian Bokmål
Persian
Poliah
Portuguese
Russian
Slovak
Slovenian
Spanish
Swedish
Turkish
Ukrainian
Overview of Changes in 4.6.1, 11-02-2022
========================================
-1
View File
@@ -223,7 +223,6 @@ static void
destroy_gear (struct gear *g)
{
g_free (g->strips);
g_free (g->vertices);
g_free (g);
}
+1 -1
View File
@@ -512,7 +512,7 @@ load_file (const char *demoname,
info_buffer = gtk_text_buffer_new (NULL);
gtk_text_buffer_create_tag (info_buffer, "title",
"font", "Sans 18",
"size", 18 * 1024,
"pixels-below-lines", 10,
NULL);
+102 -102
View File
@@ -479,7 +479,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkStackPage">
<property name="name">page1</property>
<property name="title" translatable="yes">Page _1</property>
<property name="title" translatable="1">Page _1</property>
<property name="use-underline">1</property>
<property name="child">
<object class="GtkBox" id="page1">
@@ -497,7 +497,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="has-entry">1</property>
<child internal-child="entry">
<object class="GtkEntry" id="comboboxtext-entry">
<property name="text" translatable="yes">comboboxentry</property>
<property name="text" translatable="1">comboboxentry</property>
</object>
</child>
<items>
@@ -514,7 +514,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child internal-child="entry">
<object class="GtkEntry" id="comboboxtext-entry2">
<property name="invisible-char">•</property>
<property name="text" translatable="yes">comboboxentry</property>
<property name="text" translatable="1">comboboxentry</property>
</object>
</child>
</object>
@@ -523,7 +523,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<object class="GtkEntry" id="entry1">
<property name="enable-emoji-completion">1</property>
<property name="invisible_char">•</property>
<property name="placeholder-text" translatable="yes">Click icon to change mode</property>
<property name="placeholder-text" translatable="1">Click icon to change mode</property>
<property name="secondary-icon-name">view-refresh-symbolic</property>
<property name="secondary-icon-tooltip-text">Change mode</property>
<signal name="icon-release" handler="on_entry_icon_release" swapped="no"/>
@@ -532,7 +532,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkEntry" id="entry2">
<property name="sensitive">0</property>
<property name="text" translatable="yes">entry</property>
<property name="text" translatable="1">entry</property>
</object>
</child>
<child>
@@ -543,7 +543,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkEntry" id="entry24">
<property name="enable-emoji-completion">1</property>
<property name="text" translatable="yes">entry</property>
<property name="text" translatable="1">entry</property>
<property name="hexpand">1</property>
</object>
</child>
@@ -557,7 +557,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkPasswordEntry">
<property name="show-peek-icon">1</property>
<property name="placeholder-text" translatable="yes">Password…</property>
<property name="placeholder-text" translatable="1">Password…</property>
</object>
</child>
<child>
@@ -612,13 +612,13 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="spacing">20</property>
<child>
<object class="GtkLabel" id="label3">
<property name="label" translatable="yes">label</property>
<property name="label" translatable="1">label</property>
</object>
</child>
<child>
<object class="GtkLabel" id="label4">
<property name="sensitive">0</property>
<property name="label" translatable="yes">label</property>
<property name="label" translatable="1">label</property>
</object>
</child>
<child>
@@ -644,13 +644,13 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="row-spacing">6</property>
<child>
<object class="GtkCheckButton" id="checkbutton1">
<property name="label" translatable="yes">checkbutton</property>
<property name="label" translatable="1">checkbutton</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkCheckButton" id="checkbutton2">
<property name="label" translatable="yes">checkbutton</property>
<property name="label" translatable="1">checkbutton</property>
<layout>
<property name="column">0</property>
<property name="row">1</property>
@@ -659,7 +659,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkCheckButton" id="checkbutton3">
<property name="label" translatable="yes">checkbutton</property>
<property name="label" translatable="1">checkbutton</property>
<property name="inconsistent">1</property>
<layout>
<property name="column">0</property>
@@ -669,7 +669,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkCheckButton" id="checkbutton4">
<property name="label" translatable="yes">checkbutton</property>
<property name="label" translatable="1">checkbutton</property>
<property name="sensitive">0</property>
<property name="active">1</property>
<layout>
@@ -680,7 +680,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkCheckButton" id="checkbutton5">
<property name="label" translatable="yes">checkbutton</property>
<property name="label" translatable="1">checkbutton</property>
<property name="sensitive">0</property>
<layout>
<property name="column">0</property>
@@ -690,7 +690,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkCheckButton" id="checkbutton6">
<property name="label" translatable="yes">checkbutton</property>
<property name="label" translatable="1">checkbutton</property>
<property name="sensitive">0</property>
<property name="inconsistent">1</property>
<layout>
@@ -701,7 +701,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkCheckButton" id="radiobutton1">
<property name="label" translatable="yes">radiobutton</property>
<property name="label" translatable="1">radiobutton</property>
<property name="active">1</property>
<layout>
<property name="column">1</property>
@@ -711,7 +711,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkCheckButton">
<property name="label" translatable="yes">radiobutton</property>
<property name="label" translatable="1">radiobutton</property>
<property name="group">radiobutton1</property>
<layout>
<property name="column">1</property>
@@ -721,7 +721,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkCheckButton" id="radiobutton3">
<property name="label" translatable="yes">radiobutton</property>
<property name="label" translatable="1">radiobutton</property>
<property name="inconsistent">1</property>
<property name="group">radiobutton1</property>
<layout>
@@ -732,7 +732,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkCheckButton" id="radiobutton4">
<property name="label" translatable="yes">radiobutton</property>
<property name="label" translatable="1">radiobutton</property>
<property name="sensitive">0</property>
<property name="active">1</property>
<layout>
@@ -743,7 +743,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkCheckButton" id="radiobutton5">
<property name="label" translatable="yes">radiobutton</property>
<property name="label" translatable="1">radiobutton</property>
<property name="sensitive">0</property>
<property name="group">radiobutton4</property>
<layout>
@@ -754,7 +754,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkCheckButton" id="radiobutton6">
<property name="label" translatable="yes">radiobutton</property>
<property name="label" translatable="1">radiobutton</property>
<property name="sensitive">0</property>
<property name="inconsistent">1</property>
<property name="group">radiobutton4</property>
@@ -809,27 +809,27 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="spacing">10</property>
<child>
<object class="GtkToggleButton" id="togglebutton1">
<property name="label" translatable="yes">togglebutton</property>
<property name="label" translatable="1">togglebutton</property>
<property name="receives-default">1</property>
</object>
</child>
<child>
<object class="GtkToggleButton" id="togglebutton2">
<property name="label" translatable="yes">togglebutton</property>
<property name="label" translatable="1">togglebutton</property>
<property name="sensitive">0</property>
<property name="receives-default">1</property>
</object>
</child>
<child>
<object class="GtkToggleButton" id="togglebutton3">
<property name="label" translatable="yes">togglebutton</property>
<property name="label" translatable="1">togglebutton</property>
<property name="receives-default">1</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkToggleButton" id="togglebutton4">
<property name="label" translatable="yes">togglebutton</property>
<property name="label" translatable="1">togglebutton</property>
<property name="sensitive">0</property>
<property name="receives-default">1</property>
<property name="active">1</property>
@@ -874,7 +874,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkLinkButton" id="linkbutton1">
<property name="label" translatable="yes">link button</property>
<property name="label" translatable="1">link button</property>
<property name="receives-default">1</property>
<property name="has-tooltip">1</property>
<property name="has-frame">0</property>
@@ -1061,7 +1061,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</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="label" translatable="1">&lt;b&gt;Text Styles&lt;/b&gt;</property>
<property name="use-markup">1</property>
</object>
</child>
@@ -1176,7 +1176,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn3">
<property name="title" translatable="yes">Cool</property>
<property name="title" translatable="1">Cool</property>
<child>
<object class="GtkCellRendererToggle" id="cellrenderertoggle1"/>
<attributes>
@@ -1188,7 +1188,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn4">
<property name="title" translatable="yes">Icon</property>
<property name="title" translatable="1">Icon</property>
<property name="reorderable">1</property>
<child>
<object class="GtkCellRendererPixbuf" id="cellrendererpixbuf1"/>
@@ -1200,7 +1200,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
<property name="title" translatable="yes">Name</property>
<property name="title" translatable="1">Name</property>
<property name="resizable">1</property>
<property name="reorderable">1</property>
<property name="sort-indicator">1</property>
@@ -1217,7 +1217,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn2">
<property name="title" translatable="yes">Nick</property>
<property name="title" translatable="1">Nick</property>
<property name="resizable">1</property>
<property name="reorderable">1</property>
<property name="sort-indicator">1</property>
@@ -1281,7 +1281,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</property>
<property name="tab">
<object class="GtkLabel" id="label5">
<property name="label" translatable="yes">Sunset</property>
<property name="label" translatable="1">Sunset</property>
</object>
</property>
</object>
@@ -1307,7 +1307,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</property>
<property name="tab">
<object class="GtkLabel" id="label6">
<property name="label" translatable="yes">NYC</property>
<property name="label" translatable="1">NYC</property>
</object>
</property>
</object>
@@ -1333,7 +1333,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</property>
<property name="tab">
<object class="GtkLabel" id="label7">
<property name="label" translatable="yes">Beach</property>
<property name="label" translatable="1">Beach</property>
</object>
</property>
</object>
@@ -1352,7 +1352,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</property>
<property name="tab">
<object class="GtkLabel" id="label8">
<property name="label" translatable="yes">page 1</property>
<property name="label" translatable="1">page 1</property>
</object>
</property>
</object>
@@ -1367,7 +1367,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</property>
<property name="tab">
<object class="GtkLabel" id="label9">
<property name="label" translatable="yes">page 2</property>
<property name="label" translatable="1">page 2</property>
</object>
</property>
</object>
@@ -1382,7 +1382,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</property>
<property name="tab">
<object class="GtkLabel" id="label10">
<property name="label" translatable="yes">page 3</property>
<property name="label" translatable="1">page 3</property>
</object>
</property>
</object>
@@ -1401,7 +1401,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</property>
<property name="tab">
<object class="GtkLabel" id="label11">
<property name="label" translatable="yes">page 1</property>
<property name="label" translatable="1">page 1</property>
</object>
</property>
</object>
@@ -1416,7 +1416,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</property>
<property name="tab">
<object class="GtkLabel" id="label12">
<property name="label" translatable="yes">page 2</property>
<property name="label" translatable="1">page 2</property>
</object>
</property>
</object>
@@ -1431,7 +1431,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</property>
<property name="tab">
<object class="GtkLabel" id="label13">
<property name="label" translatable="yes">page 3</property>
<property name="label" translatable="1">page 3</property>
</object>
</property>
</object>
@@ -1450,7 +1450,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</property>
<property name="tab">
<object class="GtkLabel" id="label14">
<property name="label" translatable="yes">page 1</property>
<property name="label" translatable="1">page 1</property>
</object>
</property>
</object>
@@ -1465,7 +1465,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</property>
<property name="tab">
<object class="GtkLabel" id="label15">
<property name="label" translatable="yes">page 2</property>
<property name="label" translatable="1">page 2</property>
</object>
</property>
</object>
@@ -1480,7 +1480,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</property>
<property name="tab">
<object class="GtkLabel" id="label16">
<property name="label" translatable="yes">page 3</property>
<property name="label" translatable="1">page 3</property>
</object>
</property>
</object>
@@ -1496,7 +1496,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkStackPage">
<property name="name">page2</property>
<property name="title" translatable="yes">Page _2</property>
<property name="title" translatable="1">Page _2</property>
<property name="use-underline">1</property>
<property name="child">
<object class="GtkOverlay" id="page2">
@@ -1527,7 +1527,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkButton" id="page2reset">
<property name="valign">3</property>
<property name="label" translatable="yes">Reset</property>
<property name="label" translatable="1">Reset</property>
</object>
</child>
<child>
@@ -1700,7 +1700,7 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkBox">
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Row 1</property>
<property name="label" translatable="1">Row 1</property>
<property name="halign">1</property>
<property name="valign">3</property>
<property name="hexpand">1</property>
@@ -1723,7 +1723,7 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkBox">
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Row 2</property>
<property name="label" translatable="1">Row 2</property>
<property name="halign">1</property>
<property name="valign">3</property>
<property name="hexpand">1</property>
@@ -1747,7 +1747,7 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkBox">
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Row 3</property>
<property name="label" translatable="1">Row 3</property>
<property name="halign">1</property>
<property name="valign">3</property>
<property name="hexpand">1</property>
@@ -1772,7 +1772,7 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkBox">
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Row 4</property>
<property name="label" translatable="1">Row 4</property>
<property name="halign">1</property>
<property name="valign">3</property>
<property name="hexpand">1</property>
@@ -1797,7 +1797,7 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkBox">
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Row 5</property>
<property name="label" translatable="1">Row 5</property>
<property name="halign">1</property>
<property name="valign">3</property>
<property name="hexpand">1</property>
@@ -1821,7 +1821,7 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkBox">
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Row 6</property>
<property name="label" translatable="1">Row 6</property>
<property name="halign">1</property>
<property name="valign">3</property>
<property name="hexpand">1</property>
@@ -1843,7 +1843,7 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkBox">
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Row 7</property>
<property name="label" translatable="1">Row 7</property>
<property name="halign">1</property>
<property name="valign">3</property>
<property name="hexpand">1</property>
@@ -1859,7 +1859,7 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkBox">
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Row 8</property>
<property name="label" translatable="1">Row 8</property>
<property name="halign">1</property>
<property name="valign">3</property>
<property name="hexpand">1</property>
@@ -1896,16 +1896,16 @@ microphone-sensitivity-medium-symbolic</property>
</style>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">New</property>
<property name="label" translatable="1">New</property>
<property name="icon-name">document-new</property>
<property name="tooltip-text" translatable="yes">Create a new document</property>
<property name="tooltip-text" translatable="1">Create a new document</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Save</property>
<property name="label" translatable="1">Save</property>
<property name="icon-name">document-save</property>
<property name="tooltip-text" translatable="yes">Save the current document</property>
<property name="tooltip-text" translatable="1">Save the current document</property>
</object>
</child>
<child>
@@ -1913,24 +1913,24 @@ microphone-sensitivity-medium-symbolic</property>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Search</property>
<property name="label" translatable="1">Search</property>
<property name="icon-name">edit-find</property>
<property name="action-name">win.search</property>
<property name="tooltip-text" translatable="yes">Search for it</property>
<property name="tooltip-text" translatable="1">Search for it</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insert</property>
<property name="label" translatable="1">Insert</property>
<property name="icon-name">insert-image</property>
<property name="tooltip-text" translatable="yes">Insert something</property>
<property name="tooltip-text" translatable="1">Insert something</property>
</object>
</child>
<child>
<object class="GtkColorButton">
<property name="rgba">#9141AC</property>
<property name="tooltip-text" translatable="yes">Select a color</property>
<property name="tooltip-text" translatable="1">Select a color</property>
</object>
</child>
</object>
@@ -2107,32 +2107,32 @@ microphone-sensitivity-medium-symbolic</property>
</child>
<child type="label">
<object class="GtkLabel" id="label19">
<property name="label" translatable="yes">Expander</property>
<property name="label" translatable="1">Expander</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="info_dialog_button">
<property name="label" translatable="yes">_Inform</property>
<property name="label" translatable="1">_Inform</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkButton" id="action_dialog_button">
<property name="label" translatable="yes">_Act</property>
<property name="label" translatable="1">_Act</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkButton" id="preference_dialog_button">
<property name="label" translatable="yes">_Configure</property>
<property name="label" translatable="1">_Configure</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkButton" id="selection_dialog_button">
<property name="label" translatable="yes">S_elect</property>
<property name="label" translatable="1">S_elect</property>
<property name="use-underline">1</property>
</object>
</child>
@@ -2147,7 +2147,7 @@ microphone-sensitivity-medium-symbolic</property>
<child>
<object class="GtkStackPage">
<property name="name">page3</property>
<property name="title" translatable="yes">Page _3</property>
<property name="title" translatable="1">Page _3</property>
<property name="use-underline">1</property>
<property name="child">
<object class="GtkBox">
@@ -2179,7 +2179,7 @@ microphone-sensitivity-medium-symbolic</property>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Name</property>
<property name="title" translatable="1">Name</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
@@ -2190,7 +2190,7 @@ microphone-sensitivity-medium-symbolic</property>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Birth</property>
<property name="title" translatable="1">Birth</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
@@ -2201,7 +2201,7 @@ microphone-sensitivity-medium-symbolic</property>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Death</property>
<property name="title" translatable="1">Death</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
@@ -2219,7 +2219,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="selectable">1</property>
<property name="halign">1</property>
<property name="use-markup">1</property>
<property name="label" translatable="yes">&lt;small&gt;Data source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Charlemagne#Ancestry&quot;&gt;Wikipedia&lt;/a&gt;&lt;/small&gt;</property>
<property name="label" translatable="1">&lt;small&gt;Data source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Charlemagne#Ancestry&quot;&gt;Wikipedia&lt;/a&gt;&lt;/small&gt;</property>
</object>
</child>
</object>
@@ -2553,28 +2553,28 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkButton" id="toolbutton1">
<property name="icon-name">document-open-symbolic</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Insert ⌘</property>
<property name="tooltip-text" translatable="1">Insert ⌘</property>
</object>
</child>
<child>
<object class="GtkButton" id="toolbutton2">
<property name="icon-name">send-to-symbolic</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Insert ⚽</property>
<property name="tooltip-text" translatable="1">Insert ⚽</property>
</object>
</child>
<child>
<object class="GtkButton" id="toolbutton3">
<property name="icon-name">view-fullscreen-symbolic</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Insert ⤢</property>
<property name="tooltip-text" translatable="1">Insert ⤢</property>
</object>
</child>
<child>
<object class="GtkButton" id="toolbutton4">
<property name="icon-name">star-new-symbolic</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Insert ☆</property>
<property name="tooltip-text" translatable="1">Insert ☆</property>
</object>
</child>
</object>
@@ -2602,7 +2602,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="sensitive">0</property>
<property name="icon-name">edit-cut-symbolic</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Cut</property>
<property name="tooltip-text" translatable="1">Cut</property>
</object>
</child>
<child>
@@ -2610,7 +2610,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="sensitive">0</property>
<property name="icon-name">edit-copy-symbolic</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Copy</property>
<property name="tooltip-text" translatable="1">Copy</property>
</object>
</child>
<child>
@@ -2618,7 +2618,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="sensitive">0</property>
<property name="icon-name">edit-paste-symbolic</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Paste</property>
<property name="tooltip-text" translatable="1">Paste</property>
</object>
</child>
</object>
@@ -2629,7 +2629,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">2</property>
<property name="icon-name">edit-delete-symbolic</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Delete</property>
<property name="tooltip-text" translatable="1">Delete</property>
</object>
</child>
</object>
@@ -2715,7 +2715,7 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkBox">
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Page 1</property>
<property name="label" translatable="1">Page 1</property>
<property name="halign">3</property>
<property name="hexpand">1</property>
</object>
@@ -2747,7 +2747,7 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkBox">
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Page 2</property>
<property name="label" translatable="1">Page 2</property>
<property name="halign">3</property>
<property name="hexpand">1</property>
</object>
@@ -2781,7 +2781,7 @@ microphone-sensitivity-medium-symbolic</property>
</property>
<property name="tab">
<object class="GtkLabel">
<property name="label" translatable="yes">Page 3</property>
<property name="label" translatable="1">Page 3</property>
</object>
</property>
</object>
@@ -2810,7 +2810,7 @@ microphone-sensitivity-medium-symbolic</property>
<child>
<object class="GtkEntry">
<property name="hexpand">1</property>
<property name="placeholder-text" translatable="yes">Name…</property>
<property name="placeholder-text" translatable="1">Name…</property>
<property name="completion">name_completion</property>
</object>
</child>
@@ -2818,7 +2818,7 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkEntry">
<property name="hexpand">1</property>
<property name="show-emoji-icon">1</property>
<property name="placeholder-text" translatable="yes">Age…</property>
<property name="placeholder-text" translatable="1">Age…</property>
<signal name="notify::text" handler="age_entry_changed"/>
</object>
</child>
@@ -2851,7 +2851,7 @@ microphone-sensitivity-medium-symbolic</property>
</property>
<property name="tab">
<object class="GtkLabel">
<property name="label" translatable="yes">Page 1</property>
<property name="label" translatable="1">Page 1</property>
</object>
</property>
</object>
@@ -2866,7 +2866,7 @@ microphone-sensitivity-medium-symbolic</property>
</property>
<property name="tab">
<object class="GtkLabel">
<property name="label" translatable="yes">Page 2</property>
<property name="label" translatable="1">Page 2</property>
</object>
</property>
</object>
@@ -2879,7 +2879,7 @@ microphone-sensitivity-medium-symbolic</property>
</property>
<property name="tab">
<object class="GtkLabel">
<property name="label" translatable="yes">Page 3</property>
<property name="label" translatable="1">Page 3</property>
</object>
</property>
</object>
@@ -2892,7 +2892,7 @@ microphone-sensitivity-medium-symbolic</property>
</property>
<property name="tab">
<object class="GtkLabel">
<property name="label" translatable="yes">Page 4</property>
<property name="label" translatable="1">Page 4</property>
</object>
</property>
</object>
@@ -2905,7 +2905,7 @@ microphone-sensitivity-medium-symbolic</property>
</property>
<property name="tab">
<object class="GtkLabel">
<property name="label" translatable="yes">Page 5</property>
<property name="label" translatable="1">Page 5</property>
</object>
</property>
</object>
@@ -2932,19 +2932,19 @@ microphone-sensitivity-medium-symbolic</property>
<property name="transient-for">window</property>
<property name="resizable">0</property>
<property name="modal">1</property>
<property name="text" translatable="yes">Do something?</property>
<property name="secondary-text" translatable="yes">If you don't do something,
<property name="text" translatable="1">Do something?</property>
<property name="secondary-text" translatable="1">If you don't do something,
bad things might happen.</property>
<property name="hide-on-close">1</property>
<child type="action">
<object class="GtkButton" id="cancel_info_dialog">
<property name="label" translatable="yes">_Cancel</property>
<property name="label" translatable="1">_Cancel</property>
<property name="use-underline">1</property>
</object>
</child>
<child type="action">
<object class="GtkButton" id="doit_info_dialog">
<property name="label" translatable="yes">_Do It</property>
<property name="label" translatable="1">_Do It</property>
<property name="use-underline">1</property>
</object>
</child>
@@ -2958,7 +2958,7 @@ bad things might happen.</property>
<property name="resizable">0</property>
<property name="modal">1</property>
<property name="use-header-bar">1</property>
<property name="title" translatable="yes">Zelda</property>
<property name="title" translatable="1">Zelda</property>
<property name="hide-on-close">1</property>
<property name="default-widget">act_action_dialog</property>
<child internal-child="content_area">
@@ -2969,20 +2969,20 @@ bad things might happen.</property>
<property name="margin-end">20</property>
<property name="margin-top">20</property>
<property name="margin-bottom">20</property>
<property name="label" translatable="yes">To free the princess, you have to slay the dragon.</property>
<property name="label" translatable="1">To free the princess, you have to slay the dragon.</property>
</object>
</child>
</object>
</child>
<child type="action">
<object class="GtkButton" id="cancel_action_dialog">
<property name="label" translatable="yes">_Run</property>
<property name="label" translatable="1">_Run</property>
<property name="use-underline">1</property>
</object>
</child>
<child type="action">
<object class="GtkButton" id="act_action_dialog">
<property name="label" translatable="yes">_Act</property>
<property name="label" translatable="1">_Act</property>
<property name="use-underline">1</property>
</object>
</child>
@@ -2996,7 +2996,7 @@ bad things might happen.</property>
<property name="modal">1</property>
<property name="resizable">0</property>
<property name="use-header-bar">1</property>
<property name="title" translatable="yes">Settings</property>
<property name="title" translatable="1">Settings</property>
<property name="hide-on-close">1</property>
<child internal-child="content_area">
<object class="GtkBox">
@@ -3141,7 +3141,7 @@ bad things might happen.</property>
<property name="transient-for">window</property>
<property name="modal">1</property>
<property name="use-header-bar">1</property>
<property name="title" translatable="yes">Choose one</property>
<property name="title" translatable="1">Choose one</property>
<property name="hide-on-close">1</property>
<property name="default-widget">select_selection_dialog</property>
<child internal-child="content_area">
@@ -3162,13 +3162,13 @@ bad things might happen.</property>
</child>
<child type="action">
<object class="GtkButton" id="cancel_selection_dialog">
<property name="label" translatable="yes">_Cancel</property>
<property name="label" translatable="1">_Cancel</property>
<property name="use-underline">1</property>
</object>
</child>
<child type="action">
<object class="GtkButton" id="select_selection_dialog">
<property name="label" translatable="yes">_Select</property>
<property name="label" translatable="1">_Select</property>
<property name="use-underline">1</property>
</object>
</child>
+1 -1
View File
@@ -5,7 +5,7 @@ repository_url = "https://gitlab.gnome.org/GNOME/gtk.git"
website_url = "https://www.gtk.org"
authors = "GTK Development Team"
logo_url = "gtk-logo.svg"
license = "LGPL-2.1-or-later"
license = "GPL-2.1-or-later"
description = "The GTK toolkit"
devhelp = true
+1 -1
View File
@@ -5,7 +5,7 @@ repository_url = "https://gitlab.gnome.org/GNOME/gtk.git"
website_url = "https://www.gtk.org"
authors = "GTK Development Team"
logo_url = "gtk-logo.svg"
license = "LGPL-2.1-or-later"
license = "GPL-2.1-or-later"
description = "The GTK toolkit"
dependencies = ["Gdk-4.0"]
devhelp = true
+29 -1
View File
@@ -16,6 +16,7 @@ SYNOPSIS
| **gtk4-builder-tool** enumerate <FILE>
| **gtk4-builder-tool** simplify [OPTIONS...] <FILE>
| **gtk4-builder-tool** preview [OPTIONS...] <FILE>
| **gtk4-builder-tool** screenshot [OPTIONS...] <FILE>
DESCRIPTION
-----------
@@ -41,7 +42,7 @@ definition file.
Preview
^^^^^^^
The ``preview`` command displays the UI dfinition file.
The ``preview`` command displays the UI definition file.
This command accepts options to specify the ID of the toplevel object and a CSS
file to use.
@@ -55,6 +56,33 @@ file to use.
Load style information from the given CSS file.
Screenshot
^^^^^^^^^^
The ``screenshot`` command saves a rendering of the UI definition file
as a png image or node file. The name of the file to write can be specified as
a second FILE argument.
This command accepts options to specify the ID of the toplevel object and a CSS
file to use.
``--id=ID``
The ID of the object to preview. If not specified, gtk4-builder-tool will
choose a suitable object on its own.
``--css=FILE``
Load style information from the given CSS file.
``--node``
Write a serialized node file instead of a png image.
``--force``
Overwrite an existing file.
Simplification
^^^^^^^^^^^^^^
-1
View File
@@ -354,7 +354,6 @@ typedef struct {
typedef union {
BroadwayReplyBase base;
BroadwayReplySync sync;
BroadwayReplyEvent event;
BroadwayReplyQueryMouse query_mouse;
BroadwayReplyNewSurface new_surface;
+18 -14
View File
@@ -219,7 +219,11 @@ static void
client_handle_request (BroadwayClient *client,
BroadwayRequest *request)
{
BroadwayReply reply;
BroadwayReplyNewSurface reply_new_surface;
BroadwayReplySync reply_sync;
BroadwayReplyQueryMouse reply_query_mouse;
BroadwayReplyGrabPointer reply_grab_pointer;
BroadwayReplyUngrabPointer reply_ungrab_pointer;
guint32 before_serial, now_serial;
guint32 global_id;
int fd;
@@ -229,7 +233,7 @@ client_handle_request (BroadwayClient *client,
switch (request->base.type)
{
case BROADWAY_REQUEST_NEW_SURFACE:
reply.new_surface.id =
reply_new_surface.id =
broadway_server_new_surface (server, client->id,
request->new_surface.x,
request->new_surface.y,
@@ -237,9 +241,9 @@ client_handle_request (BroadwayClient *client,
request->new_surface.height);
client->surfaces =
g_list_prepend (client->surfaces,
GUINT_TO_POINTER (reply.new_surface.id));
GUINT_TO_POINTER (reply_new_surface.id));
send_reply (client, request, &reply, sizeof (reply.new_surface),
send_reply (client, request, (BroadwayReply *)&reply_new_surface, sizeof (reply_new_surface),
BROADWAY_REPLY_NEW_SURFACE);
break;
case BROADWAY_REQUEST_FLUSH:
@@ -247,7 +251,7 @@ client_handle_request (BroadwayClient *client,
break;
case BROADWAY_REQUEST_SYNC:
broadway_server_flush (server);
send_reply (client, request, &reply, sizeof (reply.sync),
send_reply (client, request, (BroadwayReply *)&reply_sync, sizeof (reply_sync),
BROADWAY_REPLY_SYNC);
break;
case BROADWAY_REQUEST_ROUNDTRIP:
@@ -257,11 +261,11 @@ client_handle_request (BroadwayClient *client,
break;
case BROADWAY_REQUEST_QUERY_MOUSE:
broadway_server_query_mouse (server,
&reply.query_mouse.surface,
&reply.query_mouse.root_x,
&reply.query_mouse.root_y,
&reply.query_mouse.mask);
send_reply (client, request, &reply, sizeof (reply.query_mouse),
&reply_query_mouse.surface,
&reply_query_mouse.root_x,
&reply_query_mouse.root_y,
&reply_query_mouse.mask);
send_reply (client, request, (BroadwayReply *)&reply_query_mouse, sizeof (reply_query_mouse),
BROADWAY_REPLY_QUERY_MOUSE);
break;
case BROADWAY_REQUEST_DESTROY_SURFACE:
@@ -357,21 +361,21 @@ client_handle_request (BroadwayClient *client,
request->move_resize.height);
break;
case BROADWAY_REQUEST_GRAB_POINTER:
reply.grab_pointer.status =
reply_grab_pointer.status =
broadway_server_grab_pointer (server,
client->id,
request->grab_pointer.id,
request->grab_pointer.owner_events,
request->grab_pointer.event_mask,
request->grab_pointer.time_);
send_reply (client, request, &reply, sizeof (reply.grab_pointer),
send_reply (client, request, (BroadwayReply *)&reply_grab_pointer, sizeof (reply_grab_pointer),
BROADWAY_REPLY_GRAB_POINTER);
break;
case BROADWAY_REQUEST_UNGRAB_POINTER:
reply.ungrab_pointer.status =
reply_ungrab_pointer.status =
broadway_server_ungrab_pointer (server,
request->ungrab_pointer.time_);
send_reply (client, request, &reply, sizeof (reply.ungrab_pointer),
send_reply (client, request, (BroadwayReply *)&reply_ungrab_pointer, sizeof (reply_ungrab_pointer),
BROADWAY_REPLY_UNGRAB_POINTER);
break;
case BROADWAY_REQUEST_FOCUS_SURFACE:
+15 -53
View File
@@ -97,7 +97,7 @@ add_files (GDBusProxy *proxy,
AddFileData *afd)
{
GUnixFDList *fd_list;
GVariantBuilder fds, options;
GVariantBuilder fds;
int i;
char *key;
@@ -146,10 +146,9 @@ add_files (GDBusProxy *proxy,
key = (char *)g_object_get_data (G_OBJECT (afd->task), "key");
g_variant_builder_init (&options, G_VARIANT_TYPE_VARDICT);
g_dbus_proxy_call_with_unix_fd_list (proxy,
"AddFiles",
g_variant_new ("(saha{sv})", key, &fds, &options),
g_variant_new ("(sah)", key, &fds),
0, -1,
fd_list,
NULL,
@@ -481,36 +480,20 @@ connection_closed (GDBusConnection *connection,
}
static void
finish_registration (void)
got_proxy (GObject *source,
GAsyncResult *result,
gpointer data)
{
gdk_content_register_serializer (G_TYPE_FILE,
"application/vnd.portal.filetransfer",
portal_file_serializer,
NULL,
NULL);
GError *error = NULL;
gdk_content_register_serializer (GDK_TYPE_FILE_LIST,
"application/vnd.portal.filetransfer",
portal_file_serializer,
NULL,
NULL);
file_transfer_proxy = g_dbus_proxy_new_for_bus_finish (result, &error);
if (!file_transfer_proxy)
{
g_message ("Failed to get file transfer portal: %s", error->message);
g_clear_error (&error);
return;
}
gdk_content_register_deserializer ("application/vnd.portal.filetransfer",
GDK_TYPE_FILE_LIST,
portal_file_deserializer,
NULL,
NULL);
gdk_content_register_deserializer ("application/vnd.portal.filetransfer",
G_TYPE_FILE,
portal_file_deserializer,
NULL,
NULL);
/* FIXME: I missed up and used the wrong mime type here when
* I implemented my own protocol. Keep these around for a while
* so we can interoperate with existing flatpaks using GTK 4.6
*/
gdk_content_register_serializer (G_TYPE_FILE,
"application/vnd.portal.files",
portal_file_serializer,
@@ -540,21 +523,6 @@ finish_registration (void)
"closed", G_CALLBACK (connection_closed), NULL);
}
static gboolean
proxy_has_owner (GDBusProxy *proxy)
{
char *owner;
owner = g_dbus_proxy_get_name_owner (proxy);
if (owner)
{
g_free (owner);
return TRUE;
}
return FALSE;
}
void
file_transfer_portal_register (void)
{
@@ -563,8 +531,7 @@ file_transfer_portal_register (void)
if (!called)
{
called = TRUE;
file_transfer_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES
| G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS
| G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
@@ -573,13 +540,8 @@ file_transfer_portal_register (void)
"/org/freedesktop/portal/documents",
"org.freedesktop.portal.FileTransfer",
NULL,
got_proxy,
NULL);
if (file_transfer_proxy && !proxy_has_owner (file_transfer_proxy))
g_clear_object (&file_transfer_proxy);
if (file_transfer_proxy)
finish_registration ();
}
}
+2
View File
@@ -407,6 +407,8 @@ gdk_content_register_deserializer (const char *mime_type,
g_return_if_fail (mime_type != NULL);
g_return_if_fail (deserialize != NULL);
init ();
deserializer = g_slice_new0 (Deserializer);
deserializer->mime_type = g_intern_string (mime_type);
+2
View File
@@ -413,6 +413,8 @@ gdk_content_register_serializer (GType type,
g_return_if_fail (mime_type != NULL);
g_return_if_fail (serialize != NULL);
init ();
serializer = g_slice_new0 (Serializer);
serializer->mime_type = g_intern_string (mime_type);
+3 -3
View File
@@ -1628,10 +1628,10 @@ gdk_display_check_egl_extensions (EGLDisplay egl_display,
/* translators: Arguments are the number of missing extensions
* followed by a comma-separated list of their names */
g_dngettext (GETTEXT_PACKAGE,
"EGL implementation is missing extension %s",
"EGL implementation is missing %2$d extensions: %1$s",
"EGL implementation is missing extension %2$s",
"EGL implementation is missing %d extensions: %s",
n_missing),
missing->str, (int) n_missing);
(int) n_missing, missing->str);
g_string_free (missing, TRUE);
return FALSE;
+56 -24
View File
@@ -597,7 +597,8 @@ _gdk_event_unqueue (GdkDisplay *display)
/*
* If the last N events in the event queue are smooth scroll events
* for the same surface and device, combine them into one.
* for the same surface, the same device and the same scroll unit,
* combine them into one.
*
* We give the remaining event a history with N items, and deltas
* that are the sum over the history entries.
@@ -611,6 +612,8 @@ gdk_event_queue_handle_scroll_compression (GdkDisplay *display)
GdkEvent *last_event = NULL;
GList *scrolls = NULL;
GArray *history = NULL;
GdkScrollUnit scroll_unit = GDK_SCROLL_UNIT_WHEEL;
gboolean scroll_unit_defined = FALSE;
GdkTimeCoord hist;
l = g_queue_peek_tail_link (&display->queued_events);
@@ -618,6 +621,7 @@ gdk_event_queue_handle_scroll_compression (GdkDisplay *display)
while (l)
{
GdkEvent *event = l->data;
GdkScrollEvent *scroll_event = (GdkScrollEvent *) event;
if (event->flags & GDK_EVENT_PENDING)
break;
@@ -634,11 +638,17 @@ gdk_event_queue_handle_scroll_compression (GdkDisplay *display)
device != event->device)
break;
if (scroll_unit_defined &&
scroll_unit != scroll_event->unit)
break;
if (!last_event)
last_event = event;
surface = event->surface;
device = event->device;
scroll_unit = scroll_event->unit;
scroll_unit_defined = TRUE;
scrolls = l;
l = l->prev;
@@ -710,7 +720,8 @@ gdk_event_queue_handle_scroll_compression (GdkDisplay *display)
gdk_event_get_modifier_state (old_event),
dx,
dy,
gdk_scroll_event_is_stop (old_event));
gdk_scroll_event_is_stop (old_event),
scroll_unit);
((GdkScrollEvent *)event)->history = history;
@@ -746,15 +757,21 @@ gdk_motion_event_push_history (GdkEvent *event,
memset (&hist, 0, sizeof (GdkTimeCoord));
hist.time = gdk_event_get_time (history_event);
if (tool)
{
hist.flags = gdk_device_tool_get_axes (tool);
for (i = GDK_AXIS_X; i < GDK_AXIS_LAST; i++)
gdk_event_get_axis (history_event, i, &hist.axes[i]);
}
else
/* GdkTimeCoord has no dedicated fields to record event position. For plain
* pointer events, and for tools which don't report GDK_AXIS_X/GDK_AXIS_Y
* on their own, we surface the position using the X and Y input axes.
*/
if (!(hist.flags & GDK_AXIS_FLAG_X) || !(hist.flags & GDK_AXIS_FLAG_Y))
{
hist.flags = GDK_AXIS_FLAG_X | GDK_AXIS_FLAG_Y;
hist.flags |= GDK_AXIS_FLAG_X | GDK_AXIS_FLAG_Y;
gdk_event_get_position (history_event, &hist.axes[GDK_AXIS_X], &hist.axes[GDK_AXIS_Y]);
}
@@ -1764,7 +1781,7 @@ gdk_key_event_matches (GdkEvent *event,
guint ev_keyval;
int layout;
int level;
GdkModifierType ignored_modifiers;
GdkModifierType consumed_modifiers;
GdkModifierType shift_group_mask;
gboolean group_mod_is_accel_mod = FALSE;
const GdkModifierType mask = GDK_CONTROL_MASK |
@@ -1783,23 +1800,7 @@ gdk_key_event_matches (GdkEvent *event,
ev_keyval = self->translated[1].keyval;
layout = self->translated[1].layout;
level = self->translated[1].level;
/*
* If a modifier is currently active (e.g. Shift is pressed) and was marked
* as consumed, we ignore it for the purposes of matching shortcuts.
* For example, when Ctrl+Shift+[plus/equals key] is translated into
* Ctrl+plus on a keyboard where Shift+equals is the plus sign, we want
* shortcuts for either <Control><Shift>plus or <Control>plus to match.
* (See https://bugzilla.gnome.org/show_bug.cgi?id=100439)
*
* If a modifier is *not* currently active, the X11 backend can sometimes
* mark it as consumed where the Wayland and Windows backends do not.
* In this case, we still want to pay attention to its state.
* For example, when Ctrl+x is translated into Ctrl+x, we only want to
* trigger shortcuts for <Control>x, not for <Control><Shift>x.
* (See https://gitlab.gnome.org/GNOME/gtk/-/issues/5095)
*/
ignored_modifiers = (self->translated[1].consumed & state);
consumed_modifiers = self->translated[1].consumed;
/* if the group-toggling modifier is part of the default accel mod
* mask, and it is active, disable it for matching
@@ -1811,7 +1812,7 @@ gdk_key_event_matches (GdkEvent *event,
if (mask & shift_group_mask)
group_mod_is_accel_mod = TRUE;
if ((modifiers & ~ignored_modifiers & mask) == (state & ~ignored_modifiers & mask))
if ((modifiers & ~consumed_modifiers & mask) == (state & ~consumed_modifiers & mask))
{
/* modifier match */
GdkKeymapKey *keys;
@@ -2350,7 +2351,8 @@ gdk_scroll_event_new (GdkSurface *surface,
GdkModifierType state,
double delta_x,
double delta_y,
gboolean is_stop)
gboolean is_stop,
GdkScrollUnit unit)
{
GdkScrollEvent *self = gdk_event_alloc (GDK_SCROLL, surface, device, time);
@@ -2360,6 +2362,7 @@ gdk_scroll_event_new (GdkSurface *surface,
self->delta_x = delta_x;
self->delta_y = delta_y;
self->is_stop = is_stop;
self->unit = unit;
return (GdkEvent *) self;
}
@@ -2379,6 +2382,7 @@ gdk_scroll_event_new_discrete (GdkSurface *surface,
self->state = state;
self->direction = direction;
self->pointer_emulated = emulated;
self->unit = GDK_SCROLL_UNIT_WHEEL;
return (GdkEvent *) self;
}
@@ -2412,6 +2416,9 @@ gdk_scroll_event_get_direction (GdkEvent *event)
*
* The deltas will be zero unless the scroll direction
* is %GDK_SCROLL_SMOOTH.
*
* For the representation unit of these deltas, see
* [method@Gdk.ScrollEvent.get_unit].
*/
void
gdk_scroll_event_get_deltas (GdkEvent *event,
@@ -2454,6 +2461,31 @@ gdk_scroll_event_is_stop (GdkEvent *event)
return self->is_stop;
}
/**
* gdk_scroll_event_get_unit:
* @event: (type GdkScrollEvent): a scroll event.
*
* Extracts the scroll delta unit of a scroll event.
*
* The unit will always be %GDK_SCROLL_UNIT_WHEEL if the scroll direction is not
* %GDK_SCROLL_SMOOTH.
*
* Returns: the scroll unit.
*
* Since: 4.8
*/
GdkScrollUnit
gdk_scroll_event_get_unit (GdkEvent *event)
{
GdkScrollEvent *self = (GdkScrollEvent *) event;
g_return_val_if_fail (GDK_IS_EVENT (event), GDK_SCROLL_UNIT_WHEEL);
g_return_val_if_fail (GDK_IS_EVENT_TYPE (event, GDK_SCROLL),
GDK_SCROLL_UNIT_WHEEL);
return self->unit;
}
/* }}} */
/* {{{ GdkTouchpadEvent */
+33
View File
@@ -265,6 +265,37 @@ typedef enum
GDK_SCROLL_SMOOTH
} GdkScrollDirection;
/**
* GdkScrollUnit:
* @GDK_SCROLL_UNIT_WHEEL: The delta is in number of wheel clicks.
* @GDK_SCROLL_UNIT_SURFACE: The delta is in surface pixels to scroll directly
* on screen.
*
* Specifies the unit of scroll deltas.
*
* When you get %GDK_SCROLL_UNIT_WHEEL, a delta of 1.0 means 1 wheel detent
* click in the south direction, 2.0 means 2 wheel detent clicks in the south
* direction... This is the same logic for negative values but in the north
* direction.
*
* If you get %GDK_SCROLL_UNIT_SURFACE, are managing a scrollable view and get a
* value of 123, you have to scroll 123 surface logical pixels right if it's
* @delta_x or down if it's @delta_y. This is the same logic for negative values
* but you have to scroll left instead of right if it's @delta_x and up instead
* of down if it's @delta_y.
*
* 1 surface logical pixel is equal to 1 real screen pixel multiplied by the
* final scale factor of your graphical interface (the product of the desktop
* scale factor and eventually a custom scale factor in your app).
*
* Since: 4.8
*/
typedef enum
{
GDK_SCROLL_UNIT_WHEEL,
GDK_SCROLL_UNIT_SURFACE
} GdkScrollUnit;
/**
* GdkNotifyType:
* @GDK_NOTIFY_ANCESTOR: the surface is entered from an ancestor or
@@ -395,6 +426,8 @@ GDK_AVAILABLE_IN_ALL
void gdk_scroll_event_get_deltas (GdkEvent *event,
double *delta_x,
double *delta_y);
GDK_AVAILABLE_IN_4_8
GdkScrollUnit gdk_scroll_event_get_unit (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_scroll_event_is_stop (GdkEvent *event);
+4 -1
View File
@@ -212,6 +212,7 @@ struct _GdkTouchEvent
* @history: (element-type GdkTimeCoord): array of times and deltas
* for other scroll events that were compressed before delivering the
* current event
* @unit: The scroll unit in which delta_x and delta_y are represented.
*
* Generated from button presses for the buttons 4 to 7. Wheel mice are
* usually configured to generate button press events for buttons 4 and 5
@@ -234,6 +235,7 @@ struct _GdkScrollEvent
gboolean is_stop;
GdkDeviceTool *tool;
GArray *history; /* <GdkTimeCoord> */
GdkScrollUnit unit;
};
/*
@@ -486,7 +488,8 @@ GdkEvent * gdk_scroll_event_new (GdkSurface *surface,
GdkModifierType state,
double delta_x,
double delta_y,
gboolean is_stop);
gboolean is_stop,
GdkScrollUnit unit);
GdkEvent * gdk_scroll_event_new_discrete (GdkSurface *surface,
GdkDevice *device,
-3
View File
@@ -373,9 +373,6 @@ gdk_frame_clock_flush_idle (void *data)
else
priv->phase = GDK_FRAME_CLOCK_PHASE_NONE;
g_clear_handle_id (&priv->paint_idle_id, g_source_remove);
gdk_frame_clock_paint_idle (data);
return FALSE;
}
+4 -18
View File
@@ -1,7 +1,7 @@
/* GDK - The GIMP Drawing Kit
*
* gdkglcontext.c: GL context abstraction
*
*
* Copyright © 2014 Emmanuele Bassi
*
* This library is free software; you can redistribute it and/or
@@ -103,7 +103,6 @@ typedef struct {
guint has_khr_debug : 1;
guint use_khr_debug : 1;
guint has_half_float : 1;
guint has_unpack_subimage : 1;
guint has_debug_output : 1;
guint extensions_checked : 1;
@@ -1543,23 +1542,18 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
glGetIntegerv (GL_MAX_LABEL_LENGTH, &priv->max_debug_label_length);
}
priv->has_half_float = gdk_gl_context_check_version (context, 3, 0, 3, 0) ||
epoxy_has_gl_extension ("OES_vertex_half_float");
GDK_DISPLAY_NOTE (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), OPENGL,
g_message ("%s version: %d.%d (%s)\n"
"* GLSL version: %s\n"
"* Extensions checked:\n"
" - GL_KHR_debug: %s\n"
" - GL_EXT_unpack_subimage: %s\n"
" - OES_vertex_half_float: %s",
" - GL_EXT_unpack_subimage: %s",
gdk_gl_context_get_use_es (context) ? "OpenGL ES" : "OpenGL",
priv->gl_version / 10, priv->gl_version % 10,
priv->is_legacy ? "legacy" : "core",
glGetString (GL_SHADING_LANGUAGE_VERSION),
priv->has_khr_debug ? "yes" : "no",
priv->has_unpack_subimage ? "yes" : "no",
priv->has_half_float ? "yes" : "no"));
priv->has_unpack_subimage ? "yes" : "no"));
priv->extensions_checked = TRUE;
}
@@ -1763,14 +1757,6 @@ gdk_gl_context_has_debug (GdkGLContext *self)
return priv->debug_enabled || priv->use_khr_debug;
}
gboolean
gdk_gl_context_has_vertex_half_float (GdkGLContext *self)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
return priv->has_half_float;
}
/* This is currently private! */
/* When using GL/ES, don't flip the 'R' and 'B' bits on Windows/ANGLE for glReadPixels() */
gboolean
@@ -1813,7 +1799,7 @@ gboolean
gdk_gl_backend_can_be_used (GdkGLBackend backend_type,
GError **error)
{
if (the_gl_backend_type == GDK_GL_NONE ||
if (the_gl_backend_type == GDK_GL_NONE ||
the_gl_backend_type == backend_type)
return TRUE;
-2
View File
@@ -139,8 +139,6 @@ gboolean gdk_gl_context_has_debug (GdkGLContext
gboolean gdk_gl_context_use_es_bgra (GdkGLContext *context);
gboolean gdk_gl_context_has_vertex_half_float (GdkGLContext *self) G_GNUC_PURE;
G_END_DECLS
#endif /* __GDK_GL_CONTEXT_PRIVATE_H__ */
+2 -12
View File
@@ -32,9 +32,6 @@ G_DEFINE_POINTER_TYPE (GdkToplevelSize, gdk_toplevel_size)
#define UNCONFIGURED_WIDTH 400
#define UNCONFIGURED_HEIGHT 300
#define DEFAULT_BOUNDS_WIDTH INT_MAX
#define DEFAULT_BOUNDS_HEIGHT INT_MAX
void
gdk_toplevel_size_init (GdkToplevelSize *size,
int bounds_width,
@@ -71,15 +68,8 @@ gdk_toplevel_size_get_bounds (GdkToplevelSize *size,
g_return_if_fail (bounds_width);
g_return_if_fail (bounds_height);
if (size->bounds_width > 0)
*bounds_width = size->bounds_width;
else
*bounds_width = DEFAULT_BOUNDS_WIDTH;
if (size->bounds_height > 0)
*bounds_height = size->bounds_height;
else
*bounds_height = DEFAULT_BOUNDS_HEIGHT;
*bounds_width = size->bounds_width;
*bounds_height = size->bounds_height;
}
/**
+24
View File
@@ -108,6 +108,16 @@
*/
#define GDK_VERSION_4_6 (G_ENCODE_VERSION (4, 6))
/**
* GDK_VERSION_4_8:
*
* A macro that evaluates to the 4.8 version of GDK, in a format
* that can be used by the C pre-processor.
*
* Since: 4.8
*/
#define GDK_VERSION_4_8 (G_ENCODE_VERSION (4, 8))
/* evaluates to the current stable version; for development cycles,
* this means the next stable target, with a hard backstop to the
@@ -249,4 +259,18 @@
# define GDK_DEPRECATED_IN_4_6_FOR(f) _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_8
# define GDK_AVAILABLE_IN_4_8 GDK_UNAVAILABLE(4, 8)
#else
# define GDK_AVAILABLE_IN_4_8 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_8
# define GDK_DEPRECATED_IN_4_8 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_8_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_8 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_8_FOR(f) _GDK_EXTERN
#endif
#endif /* __GDK_VERSION_MACROS_H__ */
+6 -3
View File
@@ -644,7 +644,8 @@ fill_scroll_event (GdkMacosDisplay *self,
NULL,
get_time_from_ns_event (nsevent),
state,
0.0, 0.0, TRUE);
0.0, 0.0, TRUE,
GDK_SCROLL_UNIT_SURFACE);
dx = [nsevent deltaX];
dy = [nsevent deltaY];
@@ -665,7 +666,8 @@ fill_scroll_event (GdkMacosDisplay *self,
state,
-sx,
-sy,
FALSE);
FALSE,
GDK_SCROLL_UNIT_SURFACE);
/* Fall through for scroll emulation */
}
@@ -714,7 +716,8 @@ fill_scroll_event (GdkMacosDisplay *self,
NULL,
get_time_from_ns_event (nsevent),
state,
0.0, 0.0, TRUE);
0.0, 0.0, TRUE,
GDK_SCROLL_UNIT_SURFACE);
}
return g_steal_pointer (&ret);
+26
View File
@@ -596,6 +596,11 @@ gdk_macos_surface_class_init (GdkMacosSurfaceClass *klass)
surface_class->set_input_region = gdk_macos_surface_set_input_region;
surface_class->set_opaque_region = gdk_macos_surface_set_opaque_region;
/**
* GdkMacosSurface:native: (attributes org.gtk.Property.get=gdk_macos_surface_get_native_window)
*
* The "native" property contains the underlying NSWindow.
*/
properties [PROP_NATIVE] =
g_param_spec_pointer ("native",
"Native",
@@ -758,6 +763,27 @@ _gdk_macos_surface_get_native (GdkMacosSurface *self)
return (NSWindow *)self->window;
}
/**
* gdk_macos_surface_get_native_window: (attributes org.gtk.Method.get_property=native)
* @self: a #GdkMacosSurface
*
* Gets the underlying NSWindow used by the surface.
*
* The NSWindow's contentView is an implementation detail and may change
* between releases of GTK.
*
* Returns: (nullable): a #NSWindow or %NULL
*
* Since: 4.8
*/
gpointer
gdk_macos_surface_get_native_window (GdkMacosSurface *self)
{
g_return_val_if_fail (GDK_IS_MACOS_SURFACE (self), NULL);
return _gdk_macos_surface_get_native (self);
}
void
_gdk_macos_surface_set_geometry_hints (GdkMacosSurface *self,
const GdkGeometry *geometry,
+3 -1
View File
@@ -36,7 +36,9 @@ typedef struct _GdkMacosSurfaceClass GdkMacosSurfaceClass;
#define GDK_IS_MACOS_SURFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MACOS_SURFACE))
GDK_AVAILABLE_IN_ALL
GType gdk_macos_surface_get_type (void);
GType gdk_macos_surface_get_type (void);
GDK_AVAILABLE_IN_4_8
gpointer gdk_macos_surface_get_native_window (GdkMacosSurface *self);
G_END_DECLS
+28 -66
View File
@@ -200,51 +200,23 @@ wl_cursor_destroy(struct wl_cursor *cursor)
}
static struct wl_cursor *
wl_cursor_create_from_xcursor_images(struct wl_cursor_theme *theme,
wl_cursor_create_from_xcursor_images(XcursorImages *images,
struct wl_cursor_theme *theme,
const char *name,
unsigned int size,
unsigned int scale)
unsigned int load_size)
{
char *path;
XcursorImages *images;
struct cursor *cursor;
struct cursor_image *image;
int i, nbytes;
unsigned int load_size;
int load_scale = 1;
load_size = size * scale;
path = g_strconcat (theme->path, "/", name, NULL);
images = xcursor_load_images (path, load_size);
if (!images)
{
g_free (path);
return NULL;
}
if (images->images[0]->width != load_size ||
images->images[0]->height != load_size)
{
xcursor_images_destroy (images);
images = xcursor_load_images (path, size);
load_scale = scale;
}
g_free (path);
int i, size;
cursor = malloc(sizeof *cursor);
if (!cursor) {
xcursor_images_destroy (images);
if (!cursor)
return NULL;
}
cursor->cursor.images =
malloc(images->nimage * sizeof cursor->cursor.images[0]);
if (!cursor->cursor.images) {
free(cursor);
xcursor_images_destroy (images);
return NULL;
}
@@ -260,37 +232,22 @@ wl_cursor_create_from_xcursor_images(struct wl_cursor_theme *theme,
image->theme = theme;
image->buffer = NULL;
image->image.width = images->images[i]->width * load_scale;
image->image.height = images->images[i]->height * load_scale;
image->image.hotspot_x = images->images[i]->xhot * load_scale;
image->image.hotspot_y = images->images[i]->yhot * load_scale;
image->image.width = images->images[i]->width;
image->image.height = images->images[i]->height;
image->image.hotspot_x = images->images[i]->xhot;
image->image.hotspot_y = images->images[i]->yhot;
image->image.delay = images->images[i]->delay;
nbytes = image->image.width * image->image.height * 4;
image->offset = shm_pool_allocate(theme->pool, nbytes);
size = image->image.width * image->image.height * 4;
image->offset = shm_pool_allocate(theme->pool, size);
if (image->offset < 0) {
free(image);
break;
}
if (load_scale == 1) {
/* copy pixels to shm pool */
memcpy(theme->pool->data + image->offset,
images->images[i]->pixels, nbytes);
}
else {
/* scale image up while copying it */
for (int y = 0; y < image->image.height; y++) {
char *p = theme->pool->data + image->offset + y * image->image.width * 4;
char *q = ((char *)images->images[i]->pixels) + (y / load_scale) * images->images[i]->width * 4;
for (int x = 0; x < image->image.width; x++) {
p[4 * x] = q[4 * (x/load_scale)];
p[4 * x + 1] = q[4 * (x/load_scale) + 1];
p[4 * x + 2] = q[4 * (x/load_scale) + 2];
p[4 * x + 3] = q[4 * (x/load_scale) + 3];
}
}
}
/* copy pixels to shm pool */
memcpy(theme->pool->data + image->offset,
images->images[i]->pixels, size);
cursor->total_delay += image->image.delay;
cursor->cursor.images[i] = (struct wl_cursor_image *) image;
}
@@ -300,24 +257,27 @@ wl_cursor_create_from_xcursor_images(struct wl_cursor_theme *theme,
free(cursor->cursor.name);
free(cursor->cursor.images);
free(cursor);
xcursor_images_destroy (images);
return NULL;
}
xcursor_images_destroy (images);
return &cursor->cursor;
}
static void
load_cursor(struct wl_cursor_theme *theme,
const char *name,
unsigned int size,
unsigned int scale)
load_cursor(struct wl_cursor_theme *theme, const char *name, unsigned int size)
{
XcursorImages *images;
struct wl_cursor *cursor;
char *path;
cursor = wl_cursor_create_from_xcursor_images(theme, name, size, scale);
path = g_strconcat (theme->path, "/", name, NULL);
images = xcursor_load_images (path, size);
g_free (path);
if (!images)
return;
cursor = wl_cursor_create_from_xcursor_images(images, theme, name, size);
if (cursor) {
theme->cursor_count++;
@@ -332,6 +292,8 @@ load_cursor(struct wl_cursor_theme *theme,
theme->cursors[theme->cursor_count - 1] = cursor;
}
}
xcursor_images_destroy (images);
}
/** Load a cursor theme to memory shared with the compositor
@@ -411,7 +373,7 @@ wl_cursor_theme_get_cursor(struct wl_cursor_theme *theme,
return theme->cursors[i];
}
load_cursor (theme, name, theme->size, scale);
load_cursor (theme, name, size);
if (i < theme->cursor_count) {
if (size == theme->cursors[i]->size &&
+4 -13
View File
@@ -59,17 +59,13 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
if (display->xdg_activation)
{
struct xdg_activation_token_v1 *token;
struct wl_event_queue *event_queue;
struct wl_surface *wl_surface = NULL;
GdkWaylandSeat *seat;
GdkSurface *focus_surface;
AppLaunchData app_launch_data = { 0 };
event_queue = wl_display_create_queue (display->wl_display);
seat = GDK_WAYLAND_SEAT (gdk_display_get_default_seat (GDK_DISPLAY (display)));
focus_surface = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (GDK_SEAT (seat)));
token = xdg_activation_v1_get_activation_token (display->xdg_activation);
wl_proxy_set_queue ((struct wl_proxy *) token, event_queue);
xdg_activation_token_v1_add_listener (token,
&token_listener,
@@ -77,21 +73,16 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
xdg_activation_token_v1_set_serial (token,
_gdk_wayland_seat_get_last_implicit_grab_serial (seat, NULL),
gdk_wayland_seat_get_wl_seat (GDK_SEAT (seat)));
focus_surface = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (GDK_SEAT (seat)));
if (focus_surface)
wl_surface = gdk_wayland_surface_get_wl_surface (focus_surface);
if (wl_surface)
xdg_activation_token_v1_set_surface (token, wl_surface);
xdg_activation_token_v1_set_surface (token,
gdk_wayland_surface_get_wl_surface (focus_surface));
xdg_activation_token_v1_commit (token);
while (app_launch_data.token == NULL)
wl_display_dispatch_queue (display->wl_display, event_queue);
wl_display_roundtrip (display->wl_display);
xdg_activation_token_v1_destroy (token);
id = app_launch_data.token;
wl_event_queue_destroy (event_queue);
}
else if (display->gtk_shell_version >= 3)
{
+6 -19
View File
@@ -178,7 +178,6 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
if (c)
{
struct wl_cursor_image *image;
int cursor_scale;
if (image_index >= c->image_count)
{
@@ -190,22 +189,12 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
image = c->images[image_index];
cursor_scale = desired_scale;
if ((image->width % cursor_scale != 0) ||
(image->height % cursor_scale != 0))
{
g_warning (G_STRLOC " cursor image size (%dx%d) not an integer"
"multiple of scale (%d)", image->width, image->height,
cursor_scale);
cursor_scale = 1;
}
*hotspot_x = image->hotspot_x / desired_scale;
*hotspot_y = image->hotspot_y / desired_scale;
*hotspot_x = image->hotspot_x / cursor_scale;
*hotspot_y = image->hotspot_y / cursor_scale;
*width = image->width / cursor_scale;
*height = image->height / cursor_scale;
*scale = cursor_scale;
*width = image->width / desired_scale;
*height = image->height / desired_scale;
*scale = desired_scale;
return wl_cursor_image_get_buffer (image);
}
@@ -215,7 +204,7 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
cairo_surface_t *surface;
struct wl_buffer *buffer;
texture = g_object_ref (gdk_cursor_get_texture (cursor));
texture = gdk_cursor_get_texture (cursor);
from_texture:
surface = g_hash_table_lookup (display->cursor_surface_cache, cursor);
@@ -245,8 +234,6 @@ from_texture:
buffer = _gdk_wayland_shm_surface_get_wl_buffer (surface);
wl_buffer_add_listener (buffer, &buffer_listener, surface);
g_object_unref (texture);
return buffer;
}
+13 -5
View File
@@ -1416,7 +1416,8 @@ flush_smooth_scroll_event (GdkWaylandSeat *seat,
seat->pointer_info.time,
device_get_modifiers (seat->logical_pointer),
delta_x, delta_y,
is_stop);
is_stop,
GDK_SCROLL_UNIT_SURFACE);
_gdk_wayland_display_deliver_event (seat->display, event);
}
@@ -1557,6 +1558,12 @@ pointer_handle_leave (void *data,
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
GdkDeviceGrabInfo *grab;
if (!surface)
return;
if (!GDK_IS_SURFACE (wl_surface_get_user_data (surface)))
return;
if (!seat->pointer_info.focus)
return;
@@ -1749,10 +1756,10 @@ pointer_handle_axis (void *data,
switch (axis)
{
case WL_POINTER_AXIS_VERTICAL_SCROLL:
pointer_frame->delta_y = wl_fixed_to_double (value) / 10.0;
pointer_frame->delta_y = wl_fixed_to_double (value);
break;
case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
pointer_frame->delta_x = wl_fixed_to_double (value) / 10.0;
pointer_frame->delta_x = wl_fixed_to_double (value);
break;
default:
g_return_if_reached ();
@@ -1762,7 +1769,7 @@ pointer_handle_axis (void *data,
GDK_SEAT_NOTE (seat, EVENTS,
g_message ("scroll, axis %s, value %f, seat %p",
get_axis_name (axis), wl_fixed_to_double (value) / 10.0,
get_axis_name (axis), wl_fixed_to_double (value),
seat));
if (display->seat_version < WL_POINTER_HAS_FRAME)
@@ -3988,7 +3995,8 @@ tablet_tool_handle_wheel (void *data,
tablet->pointer_info.time,
device_get_modifiers (tablet->logical_device),
0, clicks,
FALSE);
FALSE,
GDK_SCROLL_UNIT_WHEEL);
_gdk_wayland_display_deliver_event (seat->display, event);
+2 -1
View File
@@ -2169,7 +2169,8 @@ gdk_wayland_display_get_setting (GdkDisplay *display,
{
if (strcmp (name, "gtk-decoration-layout") == 0)
set_decoration_layout_from_entry (display, entry, value);
else if (strcmp (name, "gtk-theme-name") == 0)
else if (strcmp (name, "gtk-theme-name") == 0 ||
strcmp (name, "gtk-icon-theme-name") == 0)
set_theme_from_entry (display, entry, value);
else
set_value_from_entry (display, entry, value);
+5 -24
View File
@@ -113,7 +113,6 @@ struct _GdkWaylandSurface
PopupState popup_state;
unsigned int popup_thaw_upon_show : 1;
unsigned int initial_configure_received : 1;
unsigned int has_uncommitted_ack_configure : 1;
unsigned int mapped : 1;
@@ -1395,6 +1394,7 @@ configure_toplevel_geometry (GdkSurface *surface)
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkDisplay *display = gdk_surface_get_display (surface);
GdkMonitor *monitor;
GdkRectangle monitor_geometry;
int bounds_width, bounds_height;
GdkToplevelSize size;
GdkToplevelLayout *layout;
@@ -1402,20 +1402,10 @@ configure_toplevel_geometry (GdkSurface *surface)
GdkSurfaceHints mask;
monitor = g_list_model_get_item (gdk_display_get_monitors (display), 0);
if (monitor)
{
GdkRectangle monitor_geometry;
gdk_monitor_get_geometry (monitor, &monitor_geometry);
g_object_unref (monitor);
bounds_width = monitor_geometry.width;
bounds_height = monitor_geometry.height;
}
else
{
bounds_width = 0;
bounds_height = 0;
}
gdk_monitor_get_geometry (monitor, &monitor_geometry);
g_object_unref (monitor);
bounds_width = monitor_geometry.width;
bounds_height = monitor_geometry.height;
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
gdk_toplevel_notify_compute_size (GDK_TOPLEVEL (surface), &size);
@@ -2994,9 +2984,6 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
if (GDK_IS_POPUP (surface))
{
impl->popup_thaw_upon_show = TRUE;
gdk_surface_freeze_updates (surface);
switch (impl->popup_state)
{
case POPUP_STATE_WAITING_FOR_REPOSITIONED:
@@ -3236,12 +3223,6 @@ show_popup (GdkSurface *surface,
if (!impl->display_server.wl_surface)
gdk_wayland_surface_create_surface (surface);
if (impl->popup_thaw_upon_show)
{
impl->popup_thaw_upon_show = FALSE;
gdk_surface_thaw_updates (surface);
}
gdk_wayland_surface_map_popup (surface, width, height, layout);
}
+11 -23
View File
@@ -142,6 +142,8 @@ struct _drop_target_context
static void
gdk_win32_drop_init (GdkWin32Drop *drop)
{
drop->droptarget_w32format_contentformat_map = g_array_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair));
GDK_NOTE (DND, g_print ("gdk_win32_drop_init %p\n", drop));
}
@@ -412,13 +414,9 @@ set_source_actions_helper (GdkDrop *drop,
DWORD grfKeyState)
{
GdkDragAction user_action;
GdkWin32Drop *drop_win32;
user_action = get_user_action (grfKeyState);
drop_win32 = GDK_WIN32_DROP (drop);
drop_win32->actions = actions;
if (user_action != 0)
gdk_drop_set_actions (drop, user_action);
else
@@ -473,7 +471,6 @@ idroptarget_dragenter (LPDROPTARGET This,
GdkDragAction source_actions;
GdkDragAction dest_actions;
GdkContentFormats *formats;
GArray *droptarget_w32format_contentformat_map;
GDK_NOTE (DND, g_print ("idroptarget_dragenter %p @ %ld : %ld"
" for dest window 0x%p"
@@ -494,8 +491,7 @@ idroptarget_dragenter (LPDROPTARGET This,
display = gdk_surface_get_display (ctx->surface);
droptarget_w32format_contentformat_map = g_array_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair));
formats = query_object_formats (pDataObj, droptarget_w32format_contentformat_map);
formats = query_object_formats (pDataObj, NULL);
drop = gdk_drop_new (display,
gdk_seat_get_pointer (gdk_display_get_default_seat (display)),
drag,
@@ -503,7 +499,7 @@ idroptarget_dragenter (LPDROPTARGET This,
ctx->surface,
GDK_DRAG_PROTO_OLE2);
drop_win32 = GDK_WIN32_DROP (drop);
drop_win32->droptarget_w32format_contentformat_map = droptarget_w32format_contentformat_map;
g_array_set_size (drop_win32->droptarget_w32format_contentformat_map, 0);
gdk_content_formats_unref (formats);
ctx->drop = drop;
@@ -524,7 +520,7 @@ idroptarget_dragenter (LPDROPTARGET This,
drop_win32->last_key_state = grfKeyState;
drop_win32->last_x = pt_x;
drop_win32->last_y = pt_y;
dest_actions = filter_actions (gdk_drop_get_actions (drop), source_actions);
dest_actions = filter_actions (drop_win32->actions, source_actions);
*pdwEffect_and_dwOKEffects = drop_effect_for_actions (dest_actions);
GDK_NOTE (DND, g_print ("idroptarget_dragenter returns S_OK with actions %s"
@@ -558,7 +554,9 @@ idroptarget_dragover (LPDROPTARGET This,
GdkDragAction source_actions;
GdkDragAction dest_actions;
source_actions = actions_for_drop_effects (*pdwEffect_and_dwOKEffects);
source_actions = set_source_actions_helper (ctx->drop,
actions_for_drop_effects (*pdwEffect_and_dwOKEffects),
grfKeyState);
GDK_NOTE (DND, g_print ("idroptarget_dragover %p @ %d : %d"
" (raw %ld : %ld)"
@@ -571,8 +569,7 @@ idroptarget_dragover (LPDROPTARGET This,
if (pt_x != drop_win32->last_x ||
pt_y != drop_win32->last_y ||
grfKeyState != drop_win32->last_key_state ||
source_actions != drop_win32->actions)
grfKeyState != drop_win32->last_key_state)
{
double x = 0.0;
double y = 0.0;
@@ -581,15 +578,13 @@ idroptarget_dragover (LPDROPTARGET This,
x /= drop_win32->scale;
y /= drop_win32->scale;
set_source_actions_helper (ctx->drop, source_actions, grfKeyState);
gdk_drop_emit_motion_event (ctx->drop, TRUE, x, y, GDK_CURRENT_TIME);
drop_win32->last_key_state = grfKeyState;
drop_win32->last_x = pt_x;
drop_win32->last_y = pt_y;
}
dest_actions = filter_actions (gdk_drop_get_actions (ctx->drop), source_actions);
dest_actions = filter_actions (drop_win32->actions, source_actions);
*pdwEffect_and_dwOKEffects = drop_effect_for_actions (dest_actions);
GDK_NOTE (DND, g_print ("idroptarget_dragover returns S_OK with actions %s"
@@ -650,12 +645,8 @@ idroptarget_drop (LPDROPTARGET This,
x /= drop_win32->scale;
y /= drop_win32->scale;
gdk_drop_emit_motion_event (ctx->drop, TRUE, x, y, GDK_CURRENT_TIME);
gdk_drop_emit_drop_event (ctx->drop, TRUE, x, y, GDK_CURRENT_TIME);
gdk_drop_emit_leave_event (ctx->drop, TRUE, GDK_CURRENT_TIME);
while (!drop_win32->drop_finished)
g_main_context_iteration (NULL, FALSE);
@@ -833,10 +824,7 @@ gdk_win32_drop_status (GdkDrop *drop,
_gdk_win32_drag_action_to_string (gdk_drop_get_actions (drop)),
_gdk_win32_drag_action_to_string (preferred)));
if (preferred != 0)
actions = preferred;
gdk_drop_set_actions (drop, drop_win32->actions & actions);
drop_win32->actions = actions;
}
static void
+2 -1
View File
@@ -2729,7 +2729,8 @@ gdk_event_translate (MSG *msg,
build_pointer_event_state (msg),
delta_x,
delta_y,
FALSE);
FALSE,
GDK_SCROLL_UNIT_WHEEL);
/* Append the discrete version too */
direction = 0;
+2 -1
View File
@@ -1778,7 +1778,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
state,
delta_x,
delta_y,
delta_x == 0.0 && delta_y == 0.0);
delta_x == 0.0 && delta_y == 0.0,
GDK_SCROLL_UNIT_WHEEL);
}
break;
}
+16 -12
View File
@@ -361,9 +361,9 @@ gdk_x11_drop_update_actions (GdkX11Drop *drop_x11)
if (!drop_x11->xdnd_have_actions)
actions = drop_x11->suggested_action;
else if (drop_x11->suggested_action & GDK_ACTION_ASK)
actions = drop_x11->xdnd_actions | GDK_ACTION_ASK;
else
actions = drop_x11->xdnd_actions & GDK_ACTION_ALL;
else
actions = drop_x11->suggested_action;
gdk_drop_set_actions (GDK_DROP (drop_x11), actions);
}
@@ -769,18 +769,22 @@ gdk_x11_drop_status (GdkDrop *drop,
possible_actions = actions & gdk_drop_get_actions (drop);
if (preferred & possible_actions)
suggested_action = preferred;
else if (drop_x11->suggested_action & possible_actions)
if (drop_x11->suggested_action != 0)
suggested_action = drop_x11->suggested_action;
else if (possible_actions & GDK_ACTION_COPY)
suggested_action = GDK_ACTION_COPY;
else if (possible_actions & GDK_ACTION_MOVE)
suggested_action = GDK_ACTION_MOVE;
else if (possible_actions & GDK_ACTION_ASK)
suggested_action = GDK_ACTION_ASK;
else
suggested_action = 0;
suggested_action = preferred & possible_actions;
if (suggested_action == 0 && possible_actions != 0)
{
if (possible_actions & GDK_ACTION_COPY)
suggested_action = GDK_ACTION_COPY;
else if (possible_actions & GDK_ACTION_MOVE)
suggested_action = GDK_ACTION_MOVE;
else if (possible_actions & GDK_ACTION_ASK)
suggested_action = GDK_ACTION_ASK;
else
suggested_action = 0;
}
xev.xclient.type = ClientMessage;
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "XdndStatus");
+1 -1
View File
@@ -280,7 +280,7 @@ compute_toplevel_size (GdkSurface *surface,
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
gdk_toplevel_notify_compute_size (GDK_TOPLEVEL (surface), &size);
if (size.shadow.is_valid)
if (size.shadow.is_valid && update_geometry)
{
update_shadow_size (surface,
size.shadow.left,
+1 -1
View File
@@ -282,7 +282,7 @@ snapshot_uniforms (GskGLUniformState *state,
{
const GskGLUniformMapping *mapping = &program->mappings[i];
if (!mapping->info.initial && mapping->location > -1)
if (!mapping->info.initial && mapping->info.format && mapping->location > -1)
{
uniform[count].location = mapping->location;
uniform[count].info = mapping->info;
+86 -110
View File
@@ -44,9 +44,6 @@
#include <gdk/gdkprofilerprivate.h>
#include <gdk/gdktextureprivate.h>
#define ATLAS_SIZE 512
#define MAX_OLD_RATIO 0.5
G_DEFINE_TYPE (GskGLDriver, gsk_gl_driver, G_TYPE_OBJECT)
static guint
@@ -156,50 +153,6 @@ gsk_gl_driver_collect_unused_textures (GskGLDriver *self,
return collected;
}
static void
gsk_gl_texture_atlas_free (GskGLTextureAtlas *atlas)
{
if (atlas->texture_id != 0)
{
glDeleteTextures (1, &atlas->texture_id);
atlas->texture_id = 0;
}
g_clear_pointer (&atlas->nodes, g_free);
g_slice_free (GskGLTextureAtlas, atlas);
}
GskGLTextureAtlas *
gsk_gl_driver_create_atlas (GskGLDriver *self)
{
GskGLTextureAtlas *atlas;
g_return_val_if_fail (GSK_IS_GL_DRIVER (self), NULL);
atlas = g_slice_new0 (GskGLTextureAtlas);
atlas->width = ATLAS_SIZE;
atlas->height = ATLAS_SIZE;
/* TODO: We might want to change the strategy about the amount of
* nodes here? stb_rect_pack.h says width is optimal. */
atlas->nodes = g_malloc0_n (atlas->width, sizeof (struct stbrp_node));
stbrp_init_target (&atlas->context, atlas->width, atlas->height, atlas->nodes, atlas->width);
atlas->texture_id = gsk_gl_command_queue_create_texture (self->command_queue,
atlas->width,
atlas->height,
GL_RGBA8,
GL_LINEAR,
GL_LINEAR);
gdk_gl_context_label_object_printf (gdk_gl_context_get_current (),
GL_TEXTURE, atlas->texture_id,
"Texture atlas %d",
atlas->texture_id);
g_ptr_array_add (self->atlases, atlas);
return atlas;
}
static void
remove_program (gpointer data)
{
@@ -226,6 +179,29 @@ gsk_gl_driver_shader_weak_cb (gpointer data,
g_hash_table_remove (self->shader_cache, where_object_was);
}
G_GNUC_NULL_TERMINATED static inline GBytes *
join_sources (GBytes *first_bytes,
...)
{
GByteArray *byte_array = g_byte_array_new ();
GBytes *bytes = first_bytes;
va_list args;
va_start (args, first_bytes);
while (bytes != NULL)
{
gsize len;
const guint8 *data = g_bytes_get_data (bytes, &len);
if (len > 0)
g_byte_array_append (byte_array, data, len);
g_bytes_unref (bytes);
bytes = va_arg (args, GBytes *);
}
va_end (args);
return g_byte_array_free_to_bytes (byte_array);
}
static void
gsk_gl_driver_dispose (GObject *object)
{
@@ -235,6 +211,10 @@ gsk_gl_driver_dispose (GObject *object)
g_assert (self->in_frame == FALSE);
#define GSK_GL_NO_UNIFORMS
#define GSK_GL_SHADER_RESOURCE(name)
#define GSK_GL_SHADER_STRING(str)
#define GSK_GL_SHADER_SINGLE(name)
#define GSK_GL_SHADER_JOINED(kind, ...)
#define GSK_GL_ADD_UNIFORM(pos, KEY, name)
#define GSK_GL_DEFINE_PROGRAM(name, resource, uniforms) \
GSK_GL_DELETE_PROGRAM(name); \
@@ -248,6 +228,10 @@ gsk_gl_driver_dispose (GObject *object)
} G_STMT_END;
# include "gskglprograms.defs"
#undef GSK_GL_NO_UNIFORMS
#undef GSK_GL_SHADER_RESOURCE
#undef GSK_GL_SHADER_STRING
#undef GSK_GL_SHADER_SINGLE
#undef GSK_GL_SHADER_JOINED
#undef GSK_GL_ADD_UNIFORM
#undef GSK_GL_DEFINE_PROGRAM
@@ -289,11 +273,10 @@ gsk_gl_driver_dispose (GObject *object)
g_assert (!self->texture_id_to_key || g_hash_table_size (self->texture_id_to_key) == 0);
g_assert (!self->key_to_texture_id|| g_hash_table_size (self->key_to_texture_id) == 0);
g_clear_object (&self->glyphs);
g_clear_object (&self->icons);
g_clear_object (&self->shadows);
g_clear_object (&self->glyphs_library);
g_clear_object (&self->icons_library);
g_clear_object (&self->shadows_library);
g_clear_pointer (&self->atlases, g_ptr_array_unref);
g_clear_pointer (&self->autorelease_framebuffers, g_array_unref);
g_clear_pointer (&self->key_to_texture_id, g_hash_table_unref);
g_clear_pointer (&self->textures, g_hash_table_unref);
@@ -330,7 +313,6 @@ gsk_gl_driver_init (GskGLDriver *self)
self->shader_cache = g_hash_table_new_full (NULL, NULL, NULL, remove_program);
self->texture_pool = g_array_new (FALSE, FALSE, sizeof (guint));
self->render_targets = g_ptr_array_new ();
self->atlases = g_ptr_array_new_with_free_func ((GDestroyNotify)gsk_gl_texture_atlas_free);
}
static gboolean
@@ -348,14 +330,14 @@ gsk_gl_driver_load_programs (GskGLDriver *self,
/* Setup preambles that are shared by all shaders */
gsk_gl_compiler_set_preamble_from_resource (compiler,
GSK_GL_COMPILER_ALL,
"/org/gtk/libgsk/gl/preamble.glsl");
GSK_GL_COMPILER_ALL,
"/org/gtk/libgsk/gl/preamble.glsl");
gsk_gl_compiler_set_preamble_from_resource (compiler,
GSK_GL_COMPILER_VERTEX,
"/org/gtk/libgsk/gl/preamble.vs.glsl");
GSK_GL_COMPILER_VERTEX,
"/org/gtk/libgsk/gl/preamble.vs.glsl");
gsk_gl_compiler_set_preamble_from_resource (compiler,
GSK_GL_COMPILER_FRAGMENT,
"/org/gtk/libgsk/gl/preamble.fs.glsl");
GSK_GL_COMPILER_FRAGMENT,
"/org/gtk/libgsk/gl/preamble.fs.glsl");
/* Setup attributes that are provided via VBO */
gsk_gl_compiler_bind_attribute (compiler, "aPosition", 0);
@@ -365,10 +347,28 @@ gsk_gl_driver_load_programs (GskGLDriver *self,
/* Use XMacros to register all of our programs and their uniforms */
#define GSK_GL_NO_UNIFORMS
#define GSK_GL_SHADER_RESOURCE(name) \
g_resources_lookup_data("/org/gtk/libgsk/gl/" name, 0, NULL)
#define GSK_GL_SHADER_STRING(str) \
g_bytes_new_static(str, strlen(str))
#define GSK_GL_SHADER_SINGLE(bytes) \
G_STMT_START { \
GBytes *b = bytes; \
gsk_gl_compiler_set_source (compiler, GSK_GL_COMPILER_ALL, b); \
g_bytes_unref (b); \
} G_STMT_END;
#define GSK_GL_SHADER_JOINED(kind, ...) \
G_STMT_START { \
GBytes *bytes = join_sources(__VA_ARGS__); \
gsk_gl_compiler_set_source (compiler, GSK_GL_COMPILER_##kind, bytes); \
g_bytes_unref (bytes); \
} G_STMT_END;
#define GSK_GL_ADD_UNIFORM(pos, KEY, name) \
gsk_gl_program_add_uniform (program, #name, UNIFORM_##KEY);
#define GSK_GL_DEFINE_PROGRAM(name, resource, uniforms) \
gsk_gl_compiler_set_source_from_resource (compiler, GSK_GL_COMPILER_ALL, resource); \
#define GSK_GL_DEFINE_PROGRAM(name, sources, uniforms) \
gsk_gl_compiler_set_source (compiler, GSK_GL_COMPILER_VERTEX, NULL); \
gsk_gl_compiler_set_source (compiler, GSK_GL_COMPILER_FRAGMENT, NULL); \
sources \
GSK_GL_COMPILE_PROGRAM(name ## _no_clip, uniforms, "#define NO_CLIP 1\n"); \
GSK_GL_COMPILE_PROGRAM(name ## _rect_clip, uniforms, "#define RECT_CLIP 1\n"); \
GSK_GL_COMPILE_PROGRAM(name, uniforms, "");
@@ -401,6 +401,11 @@ gsk_gl_driver_load_programs (GskGLDriver *self,
#undef GSK_GL_DEFINE_PROGRAM_CLIP
#undef GSK_GL_DEFINE_PROGRAM
#undef GSK_GL_ADD_UNIFORM
#undef GSK_GL_SHADER_SINGLE
#undef GSK_GL_SHADER_JOINED
#undef GSK_GL_SHADER_RESOURCE
#undef GSK_GL_SHADER_STRING
#undef GSK_GL_NO_UNIFORMS
ret = TRUE;
@@ -456,9 +461,9 @@ gsk_gl_driver_new (GskGLCommandQueue *command_queue,
return NULL;
}
self->glyphs = gsk_gl_glyph_library_new (self);
self->icons = gsk_gl_icon_library_new (self);
self->shadows = gsk_gl_shadow_library_new (self);
self->glyphs_library = gsk_gl_glyph_library_new (self);
self->icons_library = gsk_gl_icon_library_new (self);
self->shadows_library = gsk_gl_shadow_library_new (self);
gdk_profiler_end_mark (before, "create GskGLDriver", NULL);
@@ -518,37 +523,6 @@ failure:
return g_steal_pointer (&driver);
}
static GPtrArray *
gsk_gl_driver_compact_atlases (GskGLDriver *self)
{
GPtrArray *removed = NULL;
g_assert (GSK_IS_GL_DRIVER (self));
for (guint i = self->atlases->len; i > 0; i--)
{
GskGLTextureAtlas *atlas = g_ptr_array_index (self->atlases, i - 1);
if (gsk_gl_texture_atlas_get_unused_ratio (atlas) > MAX_OLD_RATIO)
{
GSK_NOTE (GLYPH_CACHE,
g_message ("Dropping atlas %d (%g.2%% old)", i,
100.0 * gsk_gl_texture_atlas_get_unused_ratio (atlas)));
if (removed == NULL)
removed = g_ptr_array_new_with_free_func ((GDestroyNotify)gsk_gl_texture_atlas_free);
g_ptr_array_add (removed, g_ptr_array_steal_index (self->atlases, i - 1));
}
}
GSK_NOTE (GLYPH_CACHE, {
static guint timestamp;
if (timestamp++ % 60 == 0)
g_message ("%d atlases", self->atlases->len);
});
return removed;
}
/**
* gsk_gl_driver_begin_frame:
* @self: a `GskGLDriver`
@@ -565,7 +539,6 @@ gsk_gl_driver_begin_frame (GskGLDriver *self,
GskGLCommandQueue *command_queue)
{
gint64 last_frame_id;
GPtrArray *removed;
g_return_if_fail (GSK_IS_GL_DRIVER (self));
g_return_if_fail (GSK_IS_GL_COMMAND_QUEUE (command_queue));
@@ -580,19 +553,14 @@ gsk_gl_driver_begin_frame (GskGLDriver *self,
gsk_gl_command_queue_begin_frame (self->command_queue);
/* Compact atlases with too many freed pixels */
removed = gsk_gl_driver_compact_atlases (self);
/* Mark unused pixel regions of the atlases */
gsk_gl_texture_library_begin_frame (GSK_GL_TEXTURE_LIBRARY (self->icons),
self->current_frame_id,
removed);
gsk_gl_texture_library_begin_frame (GSK_GL_TEXTURE_LIBRARY (self->glyphs),
self->current_frame_id,
removed);
gsk_gl_texture_library_begin_frame (GSK_GL_TEXTURE_LIBRARY (self->icons_library),
self->current_frame_id);
gsk_gl_texture_library_begin_frame (GSK_GL_TEXTURE_LIBRARY (self->glyphs_library),
self->current_frame_id);
/* Cleanup old shadows */
gsk_gl_shadow_library_begin_frame (self->shadows);
gsk_gl_shadow_library_begin_frame (self->shadows_library);
/* Remove all textures that are from a previous frame or are no
* longer used by linked GdkTexture. We do this at the beginning
@@ -600,9 +568,6 @@ gsk_gl_driver_begin_frame (GskGLDriver *self,
* we block on any resources while delivering our frames.
*/
gsk_gl_driver_collect_unused_textures (self, last_frame_id - 1);
/* Now free atlas textures */
g_clear_pointer (&removed, g_ptr_array_unref);
}
/**
@@ -1182,14 +1147,23 @@ void
gsk_gl_driver_save_atlases_to_png (GskGLDriver *self,
const char *directory)
{
GPtrArray *atlases;
g_return_if_fail (GSK_IS_GL_DRIVER (self));
if (directory == NULL)
directory = ".";
for (guint i = 0; i < self->atlases->len; i++)
#define copy_atlases(dst, library) \
g_ptr_array_extend(dst, GSK_GL_TEXTURE_LIBRARY(library)->atlases, NULL, NULL)
atlases = g_ptr_array_new ();
copy_atlases (atlases, self->glyphs_library);
copy_atlases (atlases, self->icons_library);
#undef copy_atlases
for (guint i = 0; i < atlases->len; i++)
{
GskGLTextureAtlas *atlas = g_ptr_array_index (self->atlases, i);
GskGLTextureAtlas *atlas = g_ptr_array_index (atlases, i);
char *filename = g_strdup_printf ("%s%sframe-%d-atlas-%d.png",
directory,
G_DIR_SEPARATOR_S,
@@ -1198,6 +1172,8 @@ gsk_gl_driver_save_atlases_to_png (GskGLDriver *self,
write_atlas_to_png (self, atlas, filename);
g_free (filename);
}
g_ptr_array_unref (atlases);
}
#endif
+3 -6
View File
@@ -100,17 +100,15 @@ struct _GskGLDriver
GskGLCommandQueue *shared_command_queue;
GskGLCommandQueue *command_queue;
GskGLGlyphLibrary *glyphs;
GskGLIconLibrary *icons;
GskGLShadowLibrary *shadows;
GskGLGlyphLibrary *glyphs_library;
GskGLIconLibrary *icons_library;
GskGLShadowLibrary *shadows_library;
GArray *texture_pool;
GHashTable *textures;
GHashTable *key_to_texture_id;
GHashTable *texture_id_to_key;
GPtrArray *atlases;
GHashTable *shader_cache;
GArray *autorelease_framebuffers;
@@ -184,7 +182,6 @@ void gsk_gl_driver_add_texture_slices (GskGLDriver *s
GskGLProgram * gsk_gl_driver_lookup_shader (GskGLDriver *self,
GskGLShader *shader,
GError **error);
GskGLTextureAtlas * gsk_gl_driver_create_atlas (GskGLDriver *self);
#ifdef G_ENABLE_DEBUG
void gsk_gl_driver_save_atlases_to_png (GskGLDriver *self,
+54 -4
View File
@@ -84,15 +84,64 @@ gsk_gl_glyph_value_free (gpointer data)
}
static void
gsk_gl_glyph_library_begin_frame (GskGLTextureLibrary *library,
gint64 frame_id,
GPtrArray *removed_atlases)
gsk_gl_glyph_library_clear_cache (GskGLTextureLibrary *library)
{
GskGLGlyphLibrary *self = (GskGLGlyphLibrary *)library;
g_assert (GSK_IS_GL_GLYPH_LIBRARY (self));
memset (self->front, 0, sizeof self->front);
}
static void
gsk_gl_glyph_library_init_atlas (GskGLTextureLibrary *self,
GskGLTextureAtlas *atlas)
{
gboolean packed G_GNUC_UNUSED;
int x, y;
guint gl_format;
guint gl_type;
guint8 pixel_data[4 * 3 * 3];
g_assert (GSK_IS_GL_GLYPH_LIBRARY (self));
g_assert (atlas != NULL);
/* Insert a single pixel at 0,0 for use in coloring */
gdk_gl_context_push_debug_group_printf (gdk_gl_context_get_current (),
"Initializing Atlas");
packed = gsk_gl_texture_library_allocate (self, atlas, 3, 3, &x, &y);
g_assert (packed);
g_assert (x == 0 && y == 0);
memset (pixel_data, 255, sizeof pixel_data);
if (gdk_gl_context_get_use_es (gdk_gl_context_get_current ()))
{
gl_format = GL_RGBA;
gl_type = GL_UNSIGNED_BYTE;
}
else
{
gl_format = GL_BGRA;
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
}
glBindTexture (GL_TEXTURE_2D, atlas->texture_id);
glTexSubImage2D (GL_TEXTURE_2D, 0,
0, 0,
3, 3,
gl_format, gl_type,
pixel_data);
gdk_gl_context_pop_debug_group (gdk_gl_context_get_current ());
self->driver->command_queue->n_uploads++;
}
static void
gsk_gl_glyph_library_finalize (GObject *object)
{
@@ -111,7 +160,8 @@ gsk_gl_glyph_library_class_init (GskGLGlyphLibraryClass *klass)
object_class->finalize = gsk_gl_glyph_library_finalize;
library_class->begin_frame = gsk_gl_glyph_library_begin_frame;
library_class->clear_cache = gsk_gl_glyph_library_clear_cache;
library_class->init_atlas = gsk_gl_glyph_library_init_atlas;
}
static void
+16 -16
View File
@@ -1,71 +1,71 @@
GSK_GL_DEFINE_PROGRAM (blend,
"/org/gtk/libgsk/gl/blend.glsl",
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("blend.glsl")),
GSK_GL_ADD_UNIFORM (1, BLEND_SOURCE2, u_source2)
GSK_GL_ADD_UNIFORM (2, BLEND_MODE, u_mode))
GSK_GL_DEFINE_PROGRAM (blit,
"/org/gtk/libgsk/gl/blit.glsl",
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("blit.glsl")),
GSK_GL_NO_UNIFORMS)
GSK_GL_DEFINE_PROGRAM (blur,
"/org/gtk/libgsk/gl/blur.glsl",
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("blur.glsl")),
GSK_GL_ADD_UNIFORM (1, BLUR_RADIUS, u_blur_radius)
GSK_GL_ADD_UNIFORM (2, BLUR_SIZE, u_blur_size)
GSK_GL_ADD_UNIFORM (3, BLUR_DIR, u_blur_dir))
GSK_GL_DEFINE_PROGRAM (border,
"/org/gtk/libgsk/gl/border.glsl",
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("border.glsl")),
GSK_GL_ADD_UNIFORM (1, BORDER_WIDTHS, u_widths)
GSK_GL_ADD_UNIFORM (2, BORDER_OUTLINE_RECT, u_outline_rect))
GSK_GL_DEFINE_PROGRAM (color,
"/org/gtk/libgsk/gl/color.glsl",
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("color.glsl")),
GSK_GL_NO_UNIFORMS)
GSK_GL_DEFINE_PROGRAM (coloring,
"/org/gtk/libgsk/gl/coloring.glsl",
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("coloring.glsl")),
GSK_GL_NO_UNIFORMS)
GSK_GL_DEFINE_PROGRAM (color_matrix,
"/org/gtk/libgsk/gl/color_matrix.glsl",
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("color_matrix.glsl")),
GSK_GL_ADD_UNIFORM (1, COLOR_MATRIX_COLOR_MATRIX, u_color_matrix)
GSK_GL_ADD_UNIFORM (2, COLOR_MATRIX_COLOR_OFFSET, u_color_offset))
GSK_GL_DEFINE_PROGRAM (conic_gradient,
"/org/gtk/libgsk/gl/conic_gradient.glsl",
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("conic_gradient.glsl")),
GSK_GL_ADD_UNIFORM (1, CONIC_GRADIENT_COLOR_STOPS, u_color_stops)
GSK_GL_ADD_UNIFORM (2, CONIC_GRADIENT_NUM_COLOR_STOPS, u_num_color_stops)
GSK_GL_ADD_UNIFORM (3, CONIC_GRADIENT_GEOMETRY, u_geometry))
GSK_GL_DEFINE_PROGRAM (cross_fade,
"/org/gtk/libgsk/gl/cross_fade.glsl",
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("cross_fade.glsl")),
GSK_GL_ADD_UNIFORM (1, CROSS_FADE_PROGRESS, u_progress)
GSK_GL_ADD_UNIFORM (2, CROSS_FADE_SOURCE2, u_source2))
GSK_GL_DEFINE_PROGRAM (filled_border,
"/org/gtk/libgsk/gl/filled_border.glsl",
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("filled_border.glsl")),
GSK_GL_ADD_UNIFORM (1, FILLED_BORDER_WIDTHS, u_widths)
GSK_GL_ADD_UNIFORM (2, FILLED_BORDER_OUTLINE_RECT, u_outline_rect))
GSK_GL_DEFINE_PROGRAM (inset_shadow,
"/org/gtk/libgsk/gl/inset_shadow.glsl",
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("inset_shadow.glsl")),
GSK_GL_ADD_UNIFORM (1, INSET_SHADOW_SPREAD, u_spread)
GSK_GL_ADD_UNIFORM (2, INSET_SHADOW_OFFSET, u_offset)
GSK_GL_ADD_UNIFORM (3, INSET_SHADOW_OUTLINE_RECT, u_outline_rect))
GSK_GL_DEFINE_PROGRAM (linear_gradient,
"/org/gtk/libgsk/gl/linear_gradient.glsl",
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("linear_gradient.glsl")),
GSK_GL_ADD_UNIFORM (1, LINEAR_GRADIENT_COLOR_STOPS, u_color_stops)
GSK_GL_ADD_UNIFORM (2, LINEAR_GRADIENT_NUM_COLOR_STOPS, u_num_color_stops)
GSK_GL_ADD_UNIFORM (3, LINEAR_GRADIENT_POINTS, u_points)
GSK_GL_ADD_UNIFORM (4, LINEAR_GRADIENT_REPEAT, u_repeat))
GSK_GL_DEFINE_PROGRAM (outset_shadow,
"/org/gtk/libgsk/gl/outset_shadow.glsl",
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("outset_shadow.glsl")),
GSK_GL_ADD_UNIFORM (1, OUTSET_SHADOW_OUTLINE_RECT, u_outline_rect))
GSK_GL_DEFINE_PROGRAM (radial_gradient,
"/org/gtk/libgsk/gl/radial_gradient.glsl",
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("radial_gradient.glsl")),
GSK_GL_ADD_UNIFORM (1, RADIAL_GRADIENT_COLOR_STOPS, u_color_stops)
GSK_GL_ADD_UNIFORM (2, RADIAL_GRADIENT_NUM_COLOR_STOPS, u_num_color_stops)
GSK_GL_ADD_UNIFORM (3, RADIAL_GRADIENT_REPEAT, u_repeat)
@@ -73,12 +73,12 @@ GSK_GL_DEFINE_PROGRAM (radial_gradient,
GSK_GL_ADD_UNIFORM (5, RADIAL_GRADIENT_GEOMETRY, u_geometry))
GSK_GL_DEFINE_PROGRAM (repeat,
"/org/gtk/libgsk/gl/repeat.glsl",
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("repeat.glsl")),
GSK_GL_ADD_UNIFORM (1, REPEAT_CHILD_BOUNDS, u_child_bounds)
GSK_GL_ADD_UNIFORM (2, REPEAT_TEXTURE_RECT, u_texture_rect))
GSK_GL_DEFINE_PROGRAM (unblurred_outset_shadow,
"/org/gtk/libgsk/gl/unblurred_outset_shadow.glsl",
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("unblurred_outset_shadow.glsl")),
GSK_GL_ADD_UNIFORM (1, UNBLURRED_OUTSET_SHADOW_SPREAD, u_spread)
GSK_GL_ADD_UNIFORM (2, UNBLURRED_OUTSET_SHADOW_OFFSET, u_offset)
GSK_GL_ADD_UNIFORM (3, UNBLURRED_OUTSET_SHADOW_OUTLINE_RECT, u_outline_rect))
+1 -21
View File
@@ -24,7 +24,6 @@
#include <gdk/gdkdisplayprivate.h>
#include <gdk/gdkglcontextprivate.h>
#include <gdk/gdksurfaceprivate.h>
#include <gdk/gdkintl.h>
#include <gsk/gskdebugprivate.h>
#include <gsk/gskrendererprivate.h>
#include <gsk/gskrendernodeprivate.h>
@@ -94,7 +93,6 @@ gsk_gl_renderer_realize (GskRenderer *renderer,
GdkDisplay *display;
gboolean ret = FALSE;
gboolean debug_shaders = FALSE;
GdkGLAPI api;
if (self->context != NULL)
return TRUE;
@@ -117,24 +115,6 @@ gsk_gl_renderer_realize (GskRenderer *renderer,
if (!context || !gdk_gl_context_realize (context, error))
goto failure;
api = gdk_gl_context_get_api (context);
if (api == GDK_GL_API_GLES)
{
gdk_gl_context_make_current (context);
if (!gdk_gl_context_has_vertex_half_float (context))
{
int major, minor;
gdk_gl_context_get_version (context, &major, &minor);
g_set_error (error,
GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
_("This GLES %d.%d implementation does not support half-float vertex data"),
major, minor);
goto failure;
}
}
#ifdef G_ENABLE_DEBUG
if (GSK_RENDERER_DEBUG_CHECK (GSK_RENDERER (self), SHADERS))
debug_shaders = TRUE;
@@ -351,7 +331,7 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
{
for (x = 0; x < width; x += max_size)
{
texture = gsk_gl_renderer_render_texture (renderer, root,
texture = gsk_gl_renderer_render_texture (renderer, root,
&GRAPHENE_RECT_INIT (x, y,
MIN (max_size, viewport->size.width - x),
MIN (max_size, viewport->size.height - y)));
+8 -62
View File
@@ -2512,7 +2512,9 @@ gsk_gl_render_job_visit_blurred_outset_shadow_node (GskGLRenderJob *job,
scaled_outline.corner[i].height *= scale_y;
}
cached_tid = gsk_gl_shadow_library_lookup (job->driver->shadows, &scaled_outline, blur_radius);
cached_tid = gsk_gl_shadow_library_lookup (job->driver->shadows_library,
&scaled_outline,
blur_radius);
if (cached_tid == 0)
{
@@ -2574,7 +2576,7 @@ gsk_gl_render_job_visit_blurred_outset_shadow_node (GskGLRenderJob *job,
blur_radius * scale_x,
blur_radius * scale_y);
gsk_gl_shadow_library_insert (job->driver->shadows,
gsk_gl_shadow_library_insert (job->driver->shadows_library,
&scaled_outline,
blur_radius,
blurred_texture_id);
@@ -2858,58 +2860,6 @@ gsk_gl_render_job_visit_cross_fade_node (GskGLRenderJob *job,
gsk_gl_render_job_end_draw (job);
}
static gboolean
is_non_branching (const GskRenderNode *node)
{
switch ((int)gsk_render_node_get_node_type (node))
{
case GSK_COLOR_NODE:
case GSK_LINEAR_GRADIENT_NODE:
case GSK_REPEATING_LINEAR_GRADIENT_NODE:
case GSK_RADIAL_GRADIENT_NODE:
case GSK_REPEATING_RADIAL_GRADIENT_NODE:
case GSK_CONIC_GRADIENT_NODE:
case GSK_BORDER_NODE:
case GSK_TEXTURE_NODE:
case GSK_INSET_SHADOW_NODE:
case GSK_OUTSET_SHADOW_NODE:
case GSK_TEXT_NODE:
case GSK_CAIRO_NODE:
return TRUE;
case GSK_TRANSFORM_NODE:
return is_non_branching (gsk_transform_node_get_child (node));
case GSK_OPACITY_NODE:
return is_non_branching (gsk_opacity_node_get_child (node));
case GSK_COLOR_MATRIX_NODE:
return is_non_branching (gsk_color_matrix_node_get_child (node));
case GSK_CLIP_NODE:
return is_non_branching (gsk_clip_node_get_child (node));
case GSK_ROUNDED_CLIP_NODE:
return is_non_branching (gsk_rounded_clip_node_get_child (node));
case GSK_SHADOW_NODE:
return is_non_branching (gsk_shadow_node_get_child (node));
case GSK_BLUR_NODE:
return is_non_branching (gsk_shadow_node_get_child (node));
case GSK_DEBUG_NODE:
return is_non_branching (gsk_debug_node_get_child (node));
case GSK_CONTAINER_NODE:
return gsk_container_node_get_n_children (node) == 1 &&
is_non_branching (gsk_container_node_get_child (node, 0));
default:
return FALSE;
}
}
static inline void
gsk_gl_render_job_visit_opacity_node (GskGLRenderJob *job,
const GskRenderNode *node)
@@ -2922,11 +2872,7 @@ gsk_gl_render_job_visit_opacity_node (GskGLRenderJob *job,
{
float prev_alpha = gsk_gl_render_job_set_alpha (job, new_alpha);
/* Handle a few easy cases without offscreen. We bail out
* as soon as we see nodes with multiple children - in theory,
* we would only need offscreens for overlapping children.
*/
if (is_non_branching (child))
if (!gsk_render_node_use_offscreen_for_opacity (child))
{
gsk_gl_render_job_visit_node (job, child);
gsk_gl_render_job_set_alpha (job, prev_alpha);
@@ -2996,7 +2942,7 @@ gsk_gl_render_job_visit_text_node (GskGLRenderJob *job,
guint num_glyphs = gsk_text_node_get_num_glyphs (node);
float x = offset->x + job->offset_x;
float y = offset->y + job->offset_y;
GskGLGlyphLibrary *library = job->driver->glyphs;
GskGLGlyphLibrary *library = job->driver->glyphs_library;
GskGLCommandBatch *batch;
int x_position = 0;
GskGLGlyphKey lookup;
@@ -3499,14 +3445,14 @@ gsk_gl_render_job_upload_texture (GskGLRenderJob *job,
GdkTexture *texture,
GskGLRenderOffscreen *offscreen)
{
if (gsk_gl_texture_library_can_cache ((GskGLTextureLibrary *)job->driver->icons,
if (gsk_gl_texture_library_can_cache ((GskGLTextureLibrary *)job->driver->icons_library,
texture->width,
texture->height) &&
!GDK_IS_GL_TEXTURE (texture))
{
const GskGLIconData *icon_data;
gsk_gl_icon_library_lookup_or_add (job->driver->icons, texture, &icon_data);
gsk_gl_icon_library_lookup_or_add (job->driver->icons_library, texture, &icon_data);
offscreen->texture_id = GSK_GL_TEXTURE_ATLAS_ENTRY_TEXTURE (icon_data);
memcpy (&offscreen->area, &icon_data->entry.area, sizeof offscreen->area);
}
+2 -2
View File
@@ -29,9 +29,9 @@
struct _GskGLShadowLibrary
{
GObject parent_instance;
GObject parent_instance;
GskGLDriver *driver;
GArray *shadows;
GArray *shadows;
};
typedef struct _Shadow
+318 -158
View File
@@ -27,7 +27,10 @@
#include "gskgldriverprivate.h"
#include "gskgltexturelibraryprivate.h"
#define MAX_FRAME_AGE 60
#define DEFAULT_MAX_FRAME_AGE 60
#define DEFAULT_ATLAS_WIDTH 512
#define DEFAULT_ATLAS_HEIGHT 512
#define MAX_OLD_RATIO 0.5
G_DEFINE_ABSTRACT_TYPE (GskGLTextureLibrary, gsk_gl_texture_library, G_TYPE_OBJECT)
@@ -39,6 +42,149 @@ enum {
static GParamSpec *properties [N_PROPS];
static void
gsk_gl_texture_atlas_free (GskGLTextureAtlas *atlas)
{
if (atlas->texture_id != 0)
{
glDeleteTextures (1, &atlas->texture_id);
atlas->texture_id = 0;
}
g_clear_pointer (&atlas->nodes, g_free);
g_slice_free (GskGLTextureAtlas, atlas);
}
static gboolean
gsk_gl_texture_library_real_compact (GskGLTextureLibrary *self,
gint64 frame_id)
{
GPtrArray *removed = NULL;
gboolean ret = FALSE;
gboolean periodic_scan;
g_assert (GSK_IS_GL_TEXTURE_LIBRARY (self));
periodic_scan = (self->max_frame_age > 0 &&
(frame_id % self->max_frame_age) == 0);
for (guint i = self->atlases->len; i > 0; i--)
{
GskGLTextureAtlas *atlas = g_ptr_array_index (self->atlases, i - 1);
if (gsk_gl_texture_atlas_get_unused_ratio (atlas) > MAX_OLD_RATIO)
{
GSK_NOTE (GLYPH_CACHE,
g_message ("Dropping atlas %d (%g.2%% old)", i,
100.0 * gsk_gl_texture_atlas_get_unused_ratio (atlas)));
if (removed == NULL)
removed = g_ptr_array_new_with_free_func ((GDestroyNotify)gsk_gl_texture_atlas_free);
g_ptr_array_add (removed, g_ptr_array_steal_index (self->atlases, i - 1));
}
}
if (periodic_scan || removed != NULL)
{
GskGLTextureAtlasEntry *entry;
GHashTableIter iter;
guint dropped = 0;
guint atlased = 0;
g_hash_table_iter_init (&iter, self->hash_table);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&entry))
{
if (entry->is_atlased)
{
if (removed && g_ptr_array_find (removed, entry->atlas, NULL))
{
g_hash_table_iter_remove (&iter);
dropped++;
}
else if (periodic_scan)
{
gsk_gl_texture_atlas_entry_mark_unused (entry);
entry->accessed = FALSE;
if (entry->is_atlased)
atlased++;
}
}
else
{
if (!entry->accessed)
{
gsk_gl_driver_release_texture (self->driver, entry->texture);
g_hash_table_iter_remove (&iter);
dropped++;
}
if (periodic_scan)
entry->accessed = FALSE;
}
}
GSK_NOTE (GLYPH_CACHE, g_message ("%s: Dropped %d individual items",
G_OBJECT_TYPE_NAME (self),
dropped);
g_message ("%s: %d items cached (%d atlased, %d individually)",
G_OBJECT_TYPE_NAME (self),
g_hash_table_size (self->hash_table),
atlased,
g_hash_table_size (self->hash_table) - atlased));
if (dropped > 0)
gsk_gl_texture_library_clear_cache (self);
ret = TRUE;
g_clear_pointer (&removed, g_ptr_array_unref);
}
GSK_NOTE (GLYPH_CACHE, {
static gint64 last_message;
gint64 now = g_get_monotonic_time ();
if (now - last_message > G_USEC_PER_SEC)
{
last_message = now;
g_message ("%s contains %d atlases",
G_OBJECT_TYPE_NAME (self),
self->atlases->len);
}
});
return ret;
}
static gboolean
gsk_gl_texture_library_real_allocate (GskGLTextureLibrary *self,
GskGLTextureAtlas *atlas,
int width,
int height,
int *out_x,
int *out_y)
{
stbrp_rect rect;
g_assert (GSK_IS_GL_TEXTURE_LIBRARY (self));
g_assert (atlas != NULL);
g_assert (width > 0);
g_assert (height > 0);
g_assert (out_x != NULL);
g_assert (out_y != NULL);
rect.w = width;
rect.h = height;
stbrp_pack_rects (&atlas->context, &rect, 1);
if (rect.was_packed)
{
*out_x = rect.x;
*out_y = rect.y;
}
return rect.was_packed;
}
static void
gsk_gl_texture_library_constructed (GObject *object)
{
@@ -52,6 +198,7 @@ gsk_gl_texture_library_dispose (GObject *object)
{
GskGLTextureLibrary *self = (GskGLTextureLibrary *)object;
g_clear_pointer (&self->atlases, g_ptr_array_unref);
g_clear_object (&self->driver);
G_OBJECT_CLASS (gsk_gl_texture_library_parent_class)->dispose (object);
@@ -105,6 +252,9 @@ gsk_gl_texture_library_class_init (GskGLTextureLibraryClass *klass)
object_class->get_property = gsk_gl_texture_library_get_property;
object_class->set_property = gsk_gl_texture_library_set_property;
klass->compact = gsk_gl_texture_library_real_compact;
klass->allocate = gsk_gl_texture_library_real_allocate;
properties [PROP_DRIVER] =
g_param_spec_object ("driver",
"Driver",
@@ -118,6 +268,10 @@ gsk_gl_texture_library_class_init (GskGLTextureLibraryClass *klass)
static void
gsk_gl_texture_library_init (GskGLTextureLibrary *self)
{
self->max_frame_age = DEFAULT_MAX_FRAME_AGE;
self->atlas_width = DEFAULT_ATLAS_WIDTH;
self->atlas_height = DEFAULT_ATLAS_HEIGHT;
self->atlases = g_ptr_array_new_with_free_func ((GDestroyNotify)gsk_gl_texture_atlas_free);
}
void
@@ -136,78 +290,14 @@ gsk_gl_texture_library_set_funcs (GskGLTextureLibrary *self,
void
gsk_gl_texture_library_begin_frame (GskGLTextureLibrary *self,
gint64 frame_id,
GPtrArray *removed_atlases)
gint64 frame_id)
{
GHashTableIter iter;
g_return_if_fail (GSK_IS_GL_TEXTURE_LIBRARY (self));
gsk_gl_texture_library_compact (self, frame_id);
if (GSK_GL_TEXTURE_LIBRARY_GET_CLASS (self)->begin_frame)
GSK_GL_TEXTURE_LIBRARY_GET_CLASS (self)->begin_frame (self, frame_id, removed_atlases);
if (removed_atlases != NULL)
{
GskGLTextureAtlasEntry *entry;
guint dropped = 0;
g_hash_table_iter_init (&iter, self->hash_table);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&entry))
{
if (entry->is_atlased)
{
for (guint i = 0; i < removed_atlases->len; i++)
{
GskGLTextureAtlas *atlas = g_ptr_array_index (removed_atlases, i);
if (atlas == entry->atlas)
{
g_hash_table_iter_remove (&iter);
dropped++;
break;
}
}
}
}
GSK_NOTE (GLYPH_CACHE,
if (dropped > 0)
g_message ("%s: Dropped %d items",
G_OBJECT_TYPE_NAME (self), dropped));
}
if (frame_id % MAX_FRAME_AGE == 0)
{
GskGLTextureAtlasEntry *entry;
int atlased = 0;
int dropped = 0;
g_hash_table_iter_init (&iter, self->hash_table);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&entry))
{
if (!entry->is_atlased && !entry->accessed)
{
gsk_gl_driver_release_texture (self->driver, entry->texture);
g_hash_table_iter_remove (&iter);
dropped++;
continue;
}
gsk_gl_texture_atlas_entry_mark_unused (entry);
entry->accessed = FALSE;
if (entry->is_atlased)
atlased++;
}
GSK_NOTE (GLYPH_CACHE, g_message ("%s: Dropped %d individual items",
G_OBJECT_TYPE_NAME (self),
dropped);
g_message ("%s: %d items cached (%d atlased, %d individually)",
G_OBJECT_TYPE_NAME (self),
g_hash_table_size (self->hash_table),
atlased,
g_hash_table_size (self->hash_table) - atlased));
}
GSK_GL_TEXTURE_LIBRARY_GET_CLASS (self)->begin_frame (self, frame_id);
}
static GskGLTexture *
@@ -234,90 +324,29 @@ gsk_gl_texture_library_pack_one (GskGLTextureLibrary *self,
return texture;
}
static inline gboolean
gsk_gl_texture_atlas_pack (GskGLTextureAtlas *self,
int width,
int height,
int *out_x,
int *out_y)
{
stbrp_rect rect;
rect.w = width;
rect.h = height;
stbrp_pack_rects (&self->context, &rect, 1);
if (rect.was_packed)
{
*out_x = rect.x;
*out_y = rect.y;
}
return rect.was_packed;
}
static void
gsk_gl_texture_atlas_initialize (GskGLDriver *driver,
GskGLTextureAtlas *atlas)
{
/* Insert a single pixel at 0,0 for use in coloring */
gboolean packed G_GNUC_UNUSED;
int x, y;
guint gl_format;
guint gl_type;
guint8 pixel_data[4 * 3 * 3];
gdk_gl_context_push_debug_group_printf (gdk_gl_context_get_current (),
"Initializing Atlas");
packed = gsk_gl_texture_atlas_pack (atlas, 3, 3, &x, &y);
g_assert (packed);
g_assert (x == 0 && y == 0);
memset (pixel_data, 255, sizeof pixel_data);
if (gdk_gl_context_get_use_es (gdk_gl_context_get_current ()))
{
gl_format = GL_RGBA;
gl_type = GL_UNSIGNED_BYTE;
}
else
{
gl_format = GL_BGRA;
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
}
glBindTexture (GL_TEXTURE_2D, atlas->texture_id);
glTexSubImage2D (GL_TEXTURE_2D, 0,
0, 0,
3, 3,
gl_format, gl_type,
pixel_data);
gdk_gl_context_pop_debug_group (gdk_gl_context_get_current ());
driver->command_queue->n_uploads++;
}
static void
gsk_gl_texture_atlases_pack (GskGLDriver *driver,
int width,
int height,
GskGLTextureAtlas **out_atlas,
int *out_x,
int *out_y)
gsk_gl_texture_library_pack_any_atlas (GskGLTextureLibrary *self,
int width,
int height,
GskGLTextureAtlas **out_atlas,
int *out_x,
int *out_y)
{
GskGLTextureAtlas *atlas = NULL;
int x, y;
for (guint i = 0; i < driver->atlases->len; i++)
{
atlas = g_ptr_array_index (driver->atlases, i);
g_assert (GSK_IS_GL_TEXTURE_LIBRARY (self));
g_assert (width > 0);
g_assert (height > 0);
g_assert (out_atlas != NULL);
g_assert (out_x != NULL);
g_assert (out_y != NULL);
if (gsk_gl_texture_atlas_pack (atlas, width, height, &x, &y))
for (guint i = 0; i < self->atlases->len; i++)
{
atlas = g_ptr_array_index (self->atlases, i);
if (gsk_gl_texture_library_allocate (self, atlas, width, height, &x, &y))
break;
atlas = NULL;
@@ -326,12 +355,10 @@ gsk_gl_texture_atlases_pack (GskGLDriver *driver,
if (atlas == NULL)
{
/* No atlas has enough space, so create a new one... */
atlas = gsk_gl_driver_create_atlas (driver);
gsk_gl_texture_atlas_initialize (driver, atlas);
atlas = gsk_gl_texture_library_acquire_atlas (self);
/* Pack it onto that one, which surely has enough space... */
if (!gsk_gl_texture_atlas_pack (atlas, width, height, &x, &y))
if (!gsk_gl_texture_library_allocate (self, atlas, width, height, &x, &y))
g_assert_not_reached ();
}
@@ -380,17 +407,19 @@ gsk_gl_texture_library_pack (GskGLTextureLibrary *self,
*out_packed_x = 0;
*out_packed_y = 0;
}
else if (width <= self->max_entry_size && height <= self->max_entry_size)
else if (self->max_entry_size == 0 ||
(width <= self->max_entry_size &&
height <= self->max_entry_size))
{
int packed_x;
int packed_y;
gsk_gl_texture_atlases_pack (self->driver,
padding + width + padding,
padding + height + padding,
&atlas,
&packed_x,
&packed_y);
gsk_gl_texture_library_pack_any_atlas (self,
padding + width + padding,
padding + height + padding,
&atlas,
&packed_x,
&packed_y);
entry->atlas = atlas;
entry->is_atlased = TRUE;
@@ -424,3 +453,134 @@ gsk_gl_texture_library_pack (GskGLTextureLibrary *self,
return entry;
}
/*
* gsk_gl_texture_library_clear_cache:
*
* Clear the front cache if the texture library is using one. For
* example the glyph cache would drop it's front cache to force
* next lookups to fall through to the GHashTable key lookup.
*/
void
gsk_gl_texture_library_clear_cache (GskGLTextureLibrary *self)
{
g_return_if_fail (GSK_IS_GL_TEXTURE_LIBRARY (self));
if (GSK_GL_TEXTURE_LIBRARY_GET_CLASS (self)->clear_cache)
GSK_GL_TEXTURE_LIBRARY_GET_CLASS (self)->clear_cache (self);
}
/*
* gsk_gl_texture_library_compact:
*
* Requests that the texture library compact it's altases. That
* generally means to traverse them to look for unused pixels over
* a certain threshold and release them if necessary.
*
* Returns: %TRUE if any compaction occurred.
*/
gboolean
gsk_gl_texture_library_compact (GskGLTextureLibrary *self,
gint64 frame_id)
{
g_return_val_if_fail (GSK_IS_GL_TEXTURE_LIBRARY (self), FALSE);
if (GSK_GL_TEXTURE_LIBRARY_GET_CLASS (self)->compact)
return GSK_GL_TEXTURE_LIBRARY_GET_CLASS (self)->compact (self, frame_id);
return FALSE;
}
void
gsk_gl_texture_library_reset (GskGLTextureLibrary *self)
{
g_return_if_fail (GSK_IS_GL_TEXTURE_LIBRARY (self));
gsk_gl_texture_library_clear_cache (self);
g_hash_table_remove_all (self->hash_table);
if (self->atlases->len)
g_ptr_array_remove_range (self->atlases, 0, self->atlases->len);
}
void
gsk_gl_texture_library_set_atlas_size (GskGLTextureLibrary *self,
int width,
int height)
{
g_return_if_fail (GSK_IS_GL_TEXTURE_LIBRARY (self));
if (width <= 0)
width = DEFAULT_ATLAS_WIDTH;
if (height <= 0)
height = DEFAULT_ATLAS_HEIGHT;
self->atlas_height = height;
self->atlas_width = width;
gsk_gl_texture_library_reset (self);
}
/*
* gsk_gl_texture_library_acquire_atlas:
*
* Allocates a new texture atlas based on the current size
* and format requirements.
*/
GskGLTextureAtlas *
gsk_gl_texture_library_acquire_atlas (GskGLTextureLibrary *self)
{
GskGLTextureAtlas *atlas;
g_return_val_if_fail (GSK_IS_GL_TEXTURE_LIBRARY (self), NULL);
g_return_val_if_fail (GSK_IS_GL_DRIVER (self->driver), NULL);
g_return_val_if_fail (GSK_IS_GL_COMMAND_QUEUE (self->driver->command_queue), NULL);
g_return_val_if_fail (self->atlas_width > 0, NULL);
g_return_val_if_fail (self->atlas_height > 0, NULL);
atlas = g_slice_new0 (GskGLTextureAtlas);
atlas->width = self->atlas_width;
atlas->height = self->atlas_height;
/* TODO: We might want to change the strategy about the amount of
* nodes here? stb_rect_pack.h says width is optimal. */
atlas->nodes = g_malloc0_n (atlas->width, sizeof (struct stbrp_node));
stbrp_init_target (&atlas->context, atlas->width, atlas->height, atlas->nodes, atlas->width);
atlas->texture_id = gsk_gl_command_queue_create_texture (self->driver->command_queue,
atlas->width,
atlas->height,
GL_RGBA8,
GL_LINEAR,
GL_LINEAR);
gdk_gl_context_label_object_printf (gdk_gl_context_get_current (),
GL_TEXTURE, atlas->texture_id,
"Texture atlas %d",
atlas->texture_id);
g_ptr_array_add (self->atlases, atlas);
if (GSK_GL_TEXTURE_LIBRARY_GET_CLASS (self)->init_atlas)
GSK_GL_TEXTURE_LIBRARY_GET_CLASS (self)->init_atlas (self, atlas);
return atlas;
}
gboolean
gsk_gl_texture_library_allocate (GskGLTextureLibrary *self,
GskGLTextureAtlas *atlas,
int width,
int height,
int *out_x,
int *out_y)
{
g_assert (GSK_IS_GL_TEXTURE_LIBRARY (self));
g_assert (atlas != NULL);
g_assert (width > 0);
g_assert (height > 0);
g_assert (out_x != NULL);
g_assert (out_y != NULL);
return GSK_GL_TEXTURE_LIBRARY_GET_CLASS (self)->allocate (self, atlas, width, height, out_x, out_y);
}
+50 -24
View File
@@ -50,7 +50,6 @@ typedef struct _GskGLTextureAtlas
*/
int unused_pixels;
void *user_data;
} GskGLTextureAtlas;
typedef struct _GskGLTextureAtlasEntry
@@ -89,40 +88,67 @@ typedef struct _GskGLTextureAtlasEntry
typedef struct _GskGLTextureLibrary
{
GObject parent_instance;
GObject parent_instance;
GskGLDriver *driver;
GHashTable *hash_table;
guint max_entry_size;
GPtrArray *atlases;
GHashTable *hash_table;
guint max_entry_size;
guint max_frame_age;
guint atlas_width;
guint atlas_height;
} GskGLTextureLibrary;
typedef struct _GskGLTextureLibraryClass
{
GObjectClass parent_class;
void (*begin_frame) (GskGLTextureLibrary *library,
gint64 frame_id,
GPtrArray *removed_atlases);
void (*begin_frame) (GskGLTextureLibrary *library,
gint64 frame_id);
gboolean (*compact) (GskGLTextureLibrary *library,
gint64 frame_id);
void (*clear_cache) (GskGLTextureLibrary *library);
void (*init_atlas) (GskGLTextureLibrary *library,
GskGLTextureAtlas *atlas);
gboolean (*allocate) (GskGLTextureLibrary *library,
GskGLTextureAtlas *atlas,
int width,
int height,
int *out_x,
int *out_y);
} GskGLTextureLibraryClass;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GskGLTextureLibrary, g_object_unref)
GType gsk_gl_texture_library_get_type (void) G_GNUC_CONST;
void gsk_gl_texture_library_set_funcs (GskGLTextureLibrary *self,
GHashFunc hash_func,
GEqualFunc equal_func,
GDestroyNotify key_destroy,
GDestroyNotify value_destroy);
void gsk_gl_texture_library_begin_frame (GskGLTextureLibrary *self,
gint64 frame_id,
GPtrArray *removed_atlases);
gpointer gsk_gl_texture_library_pack (GskGLTextureLibrary *self,
gpointer key,
gsize valuelen,
guint width,
guint height,
int padding,
guint *out_packed_x,
guint *out_packed_y);
GType gsk_gl_texture_library_get_type (void) G_GNUC_CONST;
gboolean gsk_gl_texture_library_compact (GskGLTextureLibrary *self,
gint64 frame_id);
void gsk_gl_texture_library_clear_cache (GskGLTextureLibrary *self);
void gsk_gl_texture_library_reset (GskGLTextureLibrary *self);
void gsk_gl_texture_library_set_atlas_size (GskGLTextureLibrary *self,
int width,
int height);
GskGLTextureAtlas *gsk_gl_texture_library_acquire_atlas (GskGLTextureLibrary *self);
void gsk_gl_texture_library_set_funcs (GskGLTextureLibrary *self,
GHashFunc hash_func,
GEqualFunc equal_func,
GDestroyNotify key_destroy,
GDestroyNotify value_destroy);
void gsk_gl_texture_library_begin_frame (GskGLTextureLibrary *self,
gint64 frame_id);
gboolean gsk_gl_texture_library_allocate (GskGLTextureLibrary *self,
GskGLTextureAtlas *atlas,
int width,
int height,
int *out_x,
int *out_y);
gpointer gsk_gl_texture_library_pack (GskGLTextureLibrary *self,
gpointer key,
gsize valuelen,
guint width,
guint height,
int padding,
guint *out_packed_x,
guint *out_packed_y);
static inline void
gsk_gl_texture_atlas_mark_unused (GskGLTextureAtlas *self,
+16 -3
View File
@@ -58,14 +58,14 @@ value_render_node_init (GValue *value)
{
value->data[0].v_pointer = NULL;
}
static void
value_render_node_free_value (GValue *value)
{
if (value->data[0].v_pointer != NULL)
gsk_render_node_unref (value->data[0].v_pointer);
}
static void
value_render_node_copy_value (const GValue *src,
GValue *dst)
@@ -75,7 +75,7 @@ value_render_node_copy_value (const GValue *src,
else
dst->data[0].v_pointer = NULL;
}
static gpointer
value_render_node_peek_pointer (const GValue *value)
{
@@ -738,3 +738,16 @@ gsk_render_node_prefers_high_depth (const GskRenderNode *node)
{
return node->prefers_high_depth;
}
/* Whether we need an offscreen to handle opacity correctly for this node.
* We don't if there is only one drawing node inside (could be child
* node, or grandchild, or...).
*
* For containers with multiple children, we can avoid the offscreen if
* the children are known not to overlap.
*/
gboolean
gsk_render_node_use_offscreen_for_opacity (const GskRenderNode *node)
{
return node->offscreen_for_opacity;
}
+47
View File
@@ -139,6 +139,7 @@ gsk_color_node_new (const GdkRGBA *rgba,
self = gsk_render_node_alloc (GSK_COLOR_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = FALSE;
self->color = *rgba;
graphene_rect_init_from_rect (&node->bounds, bounds);
@@ -284,6 +285,7 @@ gsk_linear_gradient_node_new (const graphene_rect_t *bounds,
self = gsk_render_node_alloc (GSK_LINEAR_GRADIENT_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = FALSE;
graphene_rect_init_from_rect (&node->bounds, bounds);
graphene_point_init_from_point (&self->start, start);
@@ -336,6 +338,7 @@ gsk_repeating_linear_gradient_node_new (const graphene_rect_t *bounds,
self = gsk_render_node_alloc (GSK_REPEATING_LINEAR_GRADIENT_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = FALSE;
graphene_rect_init_from_rect (&node->bounds, bounds);
graphene_point_init_from_point (&self->start, start);
@@ -584,6 +587,7 @@ gsk_radial_gradient_node_new (const graphene_rect_t *bounds,
self = gsk_render_node_alloc (GSK_RADIAL_GRADIENT_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = FALSE;
graphene_rect_init_from_rect (&node->bounds, bounds);
graphene_point_init_from_point (&self->center, center);
@@ -652,6 +656,7 @@ gsk_repeating_radial_gradient_node_new (const graphene_rect_t *bounds,
self = gsk_render_node_alloc (GSK_REPEATING_RADIAL_GRADIENT_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = FALSE;
graphene_rect_init_from_rect (&node->bounds, bounds);
graphene_point_init_from_point (&self->center, center);
@@ -1030,6 +1035,7 @@ gsk_conic_gradient_node_new (const graphene_rect_t *bounds,
self = gsk_render_node_alloc (GSK_CONIC_GRADIENT_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = FALSE;
graphene_rect_init_from_rect (&node->bounds, bounds);
graphene_point_init_from_point (&self->center, center);
@@ -1413,6 +1419,7 @@ gsk_border_node_new (const GskRoundedRect *outline,
self = gsk_render_node_alloc (GSK_BORDER_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = FALSE;
gsk_rounded_rect_init_copy (&self->outline, outline);
memcpy (self->border_width, border_width, sizeof (self->border_width));
@@ -1559,6 +1566,7 @@ gsk_texture_node_new (GdkTexture *texture,
self = gsk_render_node_alloc (GSK_TEXTURE_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = FALSE;
self->texture = g_object_ref (texture);
graphene_rect_init_from_rect (&node->bounds, bounds);
@@ -2014,6 +2022,7 @@ gsk_inset_shadow_node_new (const GskRoundedRect *outline,
self = gsk_render_node_alloc (GSK_INSET_SHADOW_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = FALSE;
gsk_rounded_rect_init_copy (&self->outline, outline);
self->color = *color;
@@ -2313,6 +2322,7 @@ gsk_outset_shadow_node_new (const GskRoundedRect *outline,
self = gsk_render_node_alloc (GSK_OUTSET_SHADOW_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = FALSE;
gsk_rounded_rect_init_copy (&self->outline, outline);
self->color = *color;
@@ -2506,6 +2516,7 @@ gsk_cairo_node_new (const graphene_rect_t *bounds)
self = gsk_render_node_alloc (GSK_CAIRO_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = FALSE;
graphene_rect_init_from_rect (&node->bounds, bounds);
@@ -2576,6 +2587,7 @@ struct _GskContainerNode
{
GskRenderNode render_node;
gboolean disjoint;
guint n_children;
GskRenderNode **children;
};
@@ -2724,6 +2736,7 @@ gsk_container_node_new (GskRenderNode **children,
self = gsk_render_node_alloc (GSK_CONTAINER_NODE);
node = (GskRenderNode *) self;
self->disjoint = TRUE;
self->n_children = n_children;
if (n_children == 0)
@@ -2743,11 +2756,14 @@ gsk_container_node_new (GskRenderNode **children,
for (guint i = 1; i < n_children; i++)
{
self->children[i] = gsk_render_node_ref (children[i]);
self->disjoint &= !graphene_rect_intersection (&bounds, &(children[i]->bounds), NULL);
graphene_rect_union (&bounds, &(children[i]->bounds), &bounds);
node->prefers_high_depth |= gsk_render_node_prefers_high_depth (children[i]);
node->offscreen_for_opacity |= children[i]->offscreen_for_opacity;
}
graphene_rect_init_from_rect (&node->bounds, &bounds);
node->offscreen_for_opacity |= !self->disjoint;
}
return node;
@@ -2801,6 +2817,24 @@ gsk_container_node_get_children (const GskRenderNode *node,
return self->children;
}
/*< private>
* gsk_container_node_is_disjoint:
* @node: a container `GskRenderNode`
*
* Returns `TRUE` if it is known that the child nodes are not
* overlapping. There is no guarantee that they do overlap
* if this function return FALSE.
*
* Returns: `TRUE` if children don't overlap
*/
gboolean
gsk_container_node_is_disjoint (const GskRenderNode *node)
{
const GskContainerNode *self = (const GskContainerNode *) node;
return self->disjoint;
}
/*** GSK_TRANSFORM_NODE ***/
/**
@@ -2962,6 +2996,7 @@ gsk_transform_node_new (GskRenderNode *child,
self = gsk_render_node_alloc (GSK_TRANSFORM_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = child->offscreen_for_opacity;
self->child = gsk_render_node_ref (child);
self->transform = gsk_transform_ref (transform);
@@ -3106,6 +3141,7 @@ gsk_opacity_node_new (GskRenderNode *child,
self = gsk_render_node_alloc (GSK_OPACITY_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = child->offscreen_for_opacity;
self->child = gsk_render_node_ref (child);
self->opacity = CLAMP (opacity, 0.0, 1.0);
@@ -3309,6 +3345,7 @@ gsk_color_matrix_node_new (GskRenderNode *child,
self = gsk_render_node_alloc (GSK_COLOR_MATRIX_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = child->offscreen_for_opacity;
self->child = gsk_render_node_ref (child);
graphene_matrix_init_from_matrix (&self->color_matrix, color_matrix);
@@ -3457,6 +3494,7 @@ gsk_repeat_node_new (const graphene_rect_t *bounds,
self = gsk_render_node_alloc (GSK_REPEAT_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = TRUE;
graphene_rect_init_from_rect (&node->bounds, bounds);
@@ -3594,6 +3632,7 @@ gsk_clip_node_new (GskRenderNode *child,
self = gsk_render_node_alloc (GSK_CLIP_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = child->offscreen_for_opacity;
self->child = gsk_render_node_ref (child);
graphene_rect_normalize_r (clip, &self->clip);
@@ -3727,6 +3766,7 @@ gsk_rounded_clip_node_new (GskRenderNode *child,
self = gsk_render_node_alloc (GSK_ROUNDED_CLIP_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = child->offscreen_for_opacity;
self->child = gsk_render_node_ref (child);
gsk_rounded_rect_init_copy (&self->clip, clip);
@@ -3946,6 +3986,7 @@ gsk_shadow_node_new (GskRenderNode *child,
self = gsk_render_node_alloc (GSK_SHADOW_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = child->offscreen_for_opacity;
self->child = gsk_render_node_ref (child);
self->n_shadows = n_shadows;
@@ -4142,6 +4183,7 @@ gsk_blend_node_new (GskRenderNode *bottom,
self = gsk_render_node_alloc (GSK_BLEND_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = TRUE;
self->bottom = gsk_render_node_ref (bottom);
self->top = gsk_render_node_ref (top);
@@ -4292,6 +4334,7 @@ gsk_cross_fade_node_new (GskRenderNode *start,
self = gsk_render_node_alloc (GSK_CROSS_FADE_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = TRUE;
self->start = gsk_render_node_ref (start);
self->end = gsk_render_node_ref (end);
@@ -4478,6 +4521,7 @@ gsk_text_node_new (PangoFont *font,
self = gsk_render_node_alloc (GSK_TEXT_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = FALSE;
self->font = g_object_ref (font);
self->color = *color;
@@ -4884,6 +4928,7 @@ gsk_blur_node_new (GskRenderNode *child,
self = gsk_render_node_alloc (GSK_BLUR_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = child->offscreen_for_opacity;
self->child = gsk_render_node_ref (child);
self->radius = radius;
@@ -5013,6 +5058,7 @@ gsk_debug_node_new (GskRenderNode *child,
self = gsk_render_node_alloc (GSK_DEBUG_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = child->offscreen_for_opacity;
self->child = gsk_render_node_ref (child);
self->message = message;
@@ -5174,6 +5220,7 @@ gsk_gl_shader_node_new (GskGLShader *shader,
self = gsk_render_node_alloc (GSK_GL_SHADER_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = TRUE;
graphene_rect_init_from_rect (&node->bounds, bounds);
self->shader = g_object_ref (shader);
+5
View File
@@ -29,6 +29,7 @@ struct _GskRenderNode
graphene_rect_t bounds;
guint prefers_high_depth : 1;
guint offscreen_for_opacity : 1;
};
struct _GskRenderNodeClass
@@ -113,6 +114,10 @@ void gsk_transform_node_get_translate (const GskRenderNode *no
float *dy);
gboolean gsk_render_node_prefers_high_depth (const GskRenderNode *node);
gboolean gsk_container_node_is_disjoint (const GskRenderNode *node);
gboolean gsk_render_node_use_offscreen_for_opacity (const GskRenderNode *node);
G_END_DECLS
-8
View File
@@ -285,14 +285,6 @@
...
fun:g_intern_static_string
}
{
glib GQuark
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
...
fun:g_intern_string
}
# Threads
{
+14 -24
View File
@@ -436,11 +436,7 @@ get_parent_context_ref (GtkAccessible *accessible)
gtk_accessible_get_at_context (GTK_ACCESSIBLE (parent));
if (parent_context != NULL)
{
gtk_at_context_realize (parent_context);
res = gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (parent_context));
}
res = gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (parent_context));
}
if (res == NULL)
@@ -1422,7 +1418,7 @@ gtk_at_spi_context_unregister_object (GtkAtSpiContext *self)
g_clear_pointer (&self->interfaces, g_variant_unref);
}
/* }}} */
/* {{{ GObject boilerplate */
/* {{{ GObject boilerplate */
static void
gtk_at_spi_context_finalize (GObject *gobject)
{
@@ -1447,22 +1443,6 @@ gtk_at_spi_context_constructed (GObject *gobject)
static const char *get_bus_address (GdkDisplay *display);
static void
register_object (GtkAtSpiRoot *root,
GtkAtSpiContext *context)
{
GtkAccessible *accessible = gtk_at_context_get_accessible (GTK_AT_CONTEXT (context));
gtk_atspi_connect_text_signals (accessible,
(GtkAtspiTextChangedCallback *)emit_text_changed,
(GtkAtspiTextSelectionCallback *)emit_text_selection_changed,
context);
gtk_atspi_connect_selection_signals (accessible,
(GtkAtspiSelectionCallback *)emit_selection_changed,
context);
gtk_at_spi_context_register_object (context);
}
static void
gtk_at_spi_context_realize (GtkATContext *context)
{
@@ -1509,10 +1489,11 @@ gtk_at_spi_context_realize (GtkATContext *context)
if (self->connection == NULL)
return;
GtkAccessible *accessible = gtk_at_context_get_accessible (context);
#ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (A11Y))
{
GtkAccessible *accessible = gtk_at_context_get_accessible (context);
GtkAccessibleRole role = gtk_at_context_get_accessible_role (context);
char *role_name = g_enum_to_string (GTK_TYPE_ACCESSIBLE_ROLE, role);
g_message ("Realizing ATSPI context “%s” for accessible “%s”, with role: “%s”",
@@ -1523,7 +1504,16 @@ gtk_at_spi_context_realize (GtkATContext *context)
}
#endif
gtk_at_spi_root_queue_register (self->root, self, register_object);
gtk_atspi_connect_text_signals (accessible,
(GtkAtspiTextChangedCallback *)emit_text_changed,
(GtkAtspiTextSelectionCallback *)emit_text_selection_changed,
self);
gtk_atspi_connect_selection_signals (accessible,
(GtkAtspiSelectionCallback *)emit_selection_changed,
self);
gtk_at_spi_context_register_object (self);
gtk_at_spi_root_queue_register (self->root, self);
}
static void
+10 -36
View File
@@ -106,7 +106,6 @@ gtk_at_spi_root_dispose (GObject *gobject)
g_clear_object (&self->cache);
g_clear_object (&self->connection);
g_clear_pointer (&self->queued_contexts, g_list_free);
G_OBJECT_CLASS (gtk_at_spi_root_parent_class)->dispose (gobject);
}
@@ -475,24 +474,16 @@ gtk_at_spi_root_child_changed (GtkAtSpiRoot *self,
window_ref);
}
typedef struct {
GtkAtSpiRoot *root;
GtkAtSpiRootRegisterFunc register_func;
} RegistrationData;
static void
on_registration_reply (GObject *gobject,
GAsyncResult *result,
gpointer user_data)
{
RegistrationData *data = user_data;
GtkAtSpiRoot *self = data->root;
GtkAtSpiRoot *self = user_data;
GError *error = NULL;
GVariant *reply = g_dbus_connection_call_finish (G_DBUS_CONNECTION (gobject), result, &error);
self->register_id = 0;
if (error != NULL)
{
g_critical ("Unable to register the application: %s", error->message);
@@ -518,28 +509,19 @@ on_registration_reply (GObject *gobject,
/* Drain the list of queued GtkAtSpiContexts, and add them to the cache */
if (self->queued_contexts != NULL)
{
self->queued_contexts = g_list_reverse (self->queued_contexts);
for (GList *l = self->queued_contexts; l != NULL; l = l->next)
{
if (data->register_func != NULL)
data->register_func (self, l->data);
gtk_at_spi_cache_add_context (self->cache, l->data);
}
gtk_at_spi_cache_add_context (self->cache, l->data);
g_clear_pointer (&self->queued_contexts, g_list_free);
}
self->toplevels = gtk_window_get_toplevels ();
g_free (data);
}
static gboolean
root_register (gpointer user_data)
root_register (gpointer data)
{
RegistrationData *data = user_data;
GtkAtSpiRoot *self = data->root;
GtkAtSpiRoot *self = data;
const char *unique_name;
/* Register the root element; every application has a single root, so we only
@@ -595,7 +577,9 @@ root_register (gpointer user_data)
G_DBUS_CALL_FLAGS_NONE, -1,
NULL,
on_registration_reply,
data);
self);
self->register_id = 0;
return G_SOURCE_REMOVE;
}
@@ -603,24 +587,18 @@ root_register (gpointer user_data)
/*< private >
* gtk_at_spi_root_queue_register:
* @self: a `GtkAtSpiRoot`
* @context: the AtSpi context to register
* @func: the function to call when the root has been registered
*
* Queues the registration of the root object on the AT-SPI bus.
*/
void
gtk_at_spi_root_queue_register (GtkAtSpiRoot *self,
GtkAtSpiContext *context,
GtkAtSpiRootRegisterFunc func)
gtk_at_spi_root_queue_register (GtkAtSpiRoot *self,
GtkAtSpiContext *context)
{
/* The cache is available if the root has finished registering itself; if we
* are still waiting for the registration to finish, add the context to a queue
*/
if (self->cache != NULL)
{
if (func != NULL)
func (self, context);
gtk_at_spi_cache_add_context (self->cache, context);
return;
}
@@ -634,11 +612,7 @@ gtk_at_spi_root_queue_register (GtkAtSpiRoot *self,
if (self->register_id != 0)
return;
RegistrationData *data = g_new (RegistrationData, 1);
data->root = self;
data->register_func = func;
self->register_id = g_idle_add (root_register, data);
self->register_id = g_idle_add (root_register, self);
gdk_source_set_static_name_by_id (self->register_id, "[gtk] ATSPI root registration");
}
+1 -5
View File
@@ -34,13 +34,9 @@ G_DECLARE_FINAL_TYPE (GtkAtSpiRoot, gtk_at_spi_root, GTK, AT_SPI_ROOT, GObject)
GtkAtSpiRoot *
gtk_at_spi_root_new (const char *bus_address);
typedef void (* GtkAtSpiRootRegisterFunc) (GtkAtSpiRoot *root,
GtkAtSpiContext *context);
void
gtk_at_spi_root_queue_register (GtkAtSpiRoot *self,
GtkAtSpiContext *context,
GtkAtSpiRootRegisterFunc func);
GtkAtSpiContext *context);
void
gtk_at_spi_root_unregister (GtkAtSpiRoot *self,
+1 -1
View File
@@ -864,7 +864,7 @@ notebook_handle_method (GDBusConnection *connection,
for (child = gtk_widget_get_first_child (widget);
child;
child = gtk_widget_get_next_sibling (child))
child = gtk_widget_get_next_sibling (widget))
{
/* skip actions */
if (gtk_accessible_get_accessible_role (GTK_ACCESSIBLE (child)) != GTK_ACCESSIBLE_ROLE_TAB)
+1 -12
View File
@@ -152,24 +152,13 @@ gtk_css_data_url_parse (const char *url,
gsize read;
gsize written;
gpointer data;
GError *local_error = NULL;
data = g_convert_with_fallback (bdata, bsize,
"UTF-8", charset,
(char *) "*",
&read, &written, &local_error);
&read, &written, NULL);
g_free (bdata);
if (local_error)
{
g_propagate_error (error, local_error);
g_free (charset);
g_free (data);
g_free (mimetype);
return NULL;
}
bdata = data;
bsize = written;
}
+5 -7
View File
@@ -991,15 +991,13 @@ gtk_action_muxer_unregister_observer (GtkActionObservable *observable,
GtkActionObserver *observer)
{
GtkActionMuxer *muxer = GTK_ACTION_MUXER (observable);
Action *action = find_observers (muxer, name);
Action *action;
action = find_observers (muxer, name);
if (action)
{
if (g_slist_find (action->watchers, observer) != NULL)
{
g_object_weak_unref (G_OBJECT (observer), gtk_action_muxer_weak_notify, action);
gtk_action_muxer_unregister_internal (action, observer);
}
g_object_weak_unref (G_OBJECT (observer), gtk_action_muxer_weak_notify, action);
gtk_action_muxer_unregister_internal (action, observer);
}
}
@@ -1271,7 +1269,7 @@ gtk_action_muxer_insert (GtkActionMuxer *muxer,
if (!muxer->groups)
muxer->groups = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, gtk_action_muxer_free_group);
group = g_slice_new0 (Group);
group = g_slice_new (Group);
group->muxer = muxer;
group->group = g_object_ref (action_group);
group->prefix = g_strdup (prefix);
+2 -41
View File
@@ -288,12 +288,6 @@ gtk_box_layout_compute_opposite_size (GtkBoxLayout *self,
*natural = largest_nat;
}
/* if widgets haven't reached their min opposite size at this
* huge value, things went massively wrong and we need to bail to not
* cause an infinite loop.
*/
#define MAX_ALLOWED_SIZE (1 << 20)
static int
distribute_remaining_size (GtkRequestedSize *sizes,
gsize n_sizes,
@@ -327,40 +321,7 @@ distribute_remaining_size (GtkRequestedSize *sizes,
{
int test;
if (min > MAX_ALLOWED_SIZE)
{
/* sanity check! */
for (i = 0; i < n_sizes; i++)
{
int check_min, check_nat;
gtk_widget_measure (sizes[i].data,
orientation,
MAX_ALLOWED_SIZE,
&sizes[i].minimum_size, &sizes[i].natural_size,
NULL, NULL);
gtk_widget_measure (sizes[i].data,
orientation,
-1,
&check_min, &check_nat,
NULL, NULL);
if (check_min < sizes[i].minimum_size)
{
g_critical ("%s %p reports a minimum %s of %u, but minimum %s for %s of %u is %u. Expect overlapping widgets.",
G_OBJECT_TYPE_NAME (sizes[i].data), sizes[i].data,
orientation == GTK_ORIENTATION_HORIZONTAL ? "width" : "height",
check_min,
orientation == GTK_ORIENTATION_HORIZONTAL ? "width" : "height",
orientation == GTK_ORIENTATION_HORIZONTAL ? "height" : "width",
MAX_ALLOWED_SIZE, sizes[i].minimum_size);
sizes[i].minimum_size = check_min;
sizes[i].natural_size = check_nat;
}
total_size += sizes[i].minimum_size;
}
return MAX (0, available - total_size);
}
if (max == MAX_ALLOWED_SIZE)
if (max == G_MAXINT)
test = min * 2;
else
test = (min + max) / 2;
@@ -504,7 +465,7 @@ gtk_box_layout_compute_opposite_size_for_size (GtkBoxLayout *self,
self->orientation,
available,
min_size,
MAX_ALLOWED_SIZE);
G_MAXINT);
/* Bring children up to size first */
available = gtk_distribute_natural_allocation (available, nvis_children, sizes);
+22 -16
View File
@@ -523,11 +523,26 @@ gtk_center_layout_allocate (GtkLayoutManager *layout_manager,
}
}
static void
gtk_center_layout_dispose (GObject *object)
{
GtkCenterLayout *self = GTK_CENTER_LAYOUT (object);
g_clear_object (&self->start_widget);
g_clear_object (&self->center_widget);
g_clear_object (&self->end_widget);
G_OBJECT_CLASS (gtk_center_layout_parent_class)->dispose (object);
}
static void
gtk_center_layout_class_init (GtkCenterLayoutClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkLayoutManagerClass *layout_class = GTK_LAYOUT_MANAGER_CLASS (klass);
object_class->dispose = gtk_center_layout_dispose;
layout_class->get_request_mode = gtk_center_layout_get_request_mode;
layout_class->measure = gtk_center_layout_measure;
layout_class->allocate = gtk_center_layout_allocate;
@@ -641,11 +656,8 @@ gtk_center_layout_set_start_widget (GtkCenterLayout *self,
g_return_if_fail (GTK_IS_CENTER_LAYOUT (self));
g_return_if_fail (widget == NULL || GTK_IS_WIDGET (widget));
if (self->start_widget == widget)
return;
self->start_widget = widget;
gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (self));
if (g_set_object (&self->start_widget, widget))
gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (self));
}
/**
@@ -680,11 +692,8 @@ gtk_center_layout_set_center_widget (GtkCenterLayout *self,
g_return_if_fail (GTK_IS_CENTER_LAYOUT (self));
g_return_if_fail (widget == NULL || GTK_IS_WIDGET (widget));
if (self->center_widget == widget)
return;
self->center_widget = widget;
gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (self));
if (g_set_object (&self->center_widget, widget))
gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (self));
}
/**
@@ -706,7 +715,7 @@ gtk_center_layout_get_center_widget (GtkCenterLayout *self)
/**
* gtk_center_layout_set_end_widget:
* @self: a `GtkCenterLayout`
* @widget: (nullable) (transfer none): the new end widget
* @widget: (nullable): the new end widget
*
* Sets the new end widget of @self.
*
@@ -719,11 +728,8 @@ gtk_center_layout_set_end_widget (GtkCenterLayout *self,
g_return_if_fail (GTK_IS_CENTER_LAYOUT (self));
g_return_if_fail (widget == NULL || GTK_IS_WIDGET (widget));
if (self->end_widget == widget)
return;
self->end_widget = widget;
gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (self));
if (g_set_object (&self->end_widget, widget))
gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (self));
}
/**
+2 -3
View File
@@ -1703,9 +1703,8 @@ gtk_column_view_sort_by_column (GtkColumnView *self,
g_return_if_fail (column == NULL || GTK_IS_COLUMN_VIEW_COLUMN (column));
g_return_if_fail (column == NULL || gtk_column_view_column_get_column_view (column) == self);
if (column == NULL)
gtk_column_view_sorter_clear (GTK_COLUMN_VIEW_SORTER (self->sorter));
else
gtk_column_view_sorter_clear (GTK_COLUMN_VIEW_SORTER (self->sorter));
if (column != NULL)
gtk_column_view_sorter_set_column (GTK_COLUMN_VIEW_SORTER (self->sorter),
column,
direction == GTK_SORT_DESCENDING);
+8 -8
View File
@@ -239,7 +239,7 @@ gtk_css_node_dispose (GObject *object)
}
gtk_css_node_set_invalid (cssnode, FALSE);
g_clear_pointer (&cssnode->cache, gtk_css_node_style_cache_unref);
G_OBJECT_CLASS (gtk_css_node_parent_class)->dispose (object);
@@ -292,7 +292,7 @@ may_use_global_parent_cache (GtkCssNode *node)
{
GtkStyleProvider *provider;
GtkCssNode *parent;
parent = gtk_css_node_get_parent (node);
if (parent == NULL)
return FALSE;
@@ -700,10 +700,10 @@ gtk_css_node_invalidate_style (GtkCssNode *cssnode)
cssnode->style_is_invalid = TRUE;
gtk_css_node_set_invalid (cssnode, TRUE);
if (cssnode->first_child)
gtk_css_node_invalidate_style (cssnode->first_child);
if (cssnode->next_sibling)
gtk_css_node_invalidate_style (cssnode->next_sibling);
}
@@ -796,7 +796,7 @@ gtk_css_node_reposition (GtkCssNode *node,
gtk_css_node_invalidate_style (node->next_sibling);
}
gtk_css_node_invalidate (node, (old_parent != new_parent ? GTK_CSS_CHANGE_ANY_PARENT : 0)
gtk_css_node_invalidate (node, GTK_CSS_CHANGE_ANY_PARENT
| GTK_CSS_CHANGE_ANY_SIBLING
| GTK_CSS_CHANGE_NTH_CHILD
| (node->previous_sibling ? 0 : GTK_CSS_CHANGE_FIRST_CHILD)
@@ -842,7 +842,7 @@ gtk_css_node_insert_before (GtkCssNode *parent,
g_return_if_fail (next_sibling == NULL || next_sibling->parent == parent);
g_return_if_fail (cssnode != next_sibling);
if (cssnode->next_sibling == next_sibling &&
if (cssnode->next_sibling == next_sibling &&
cssnode->parent == parent)
return;
@@ -1067,7 +1067,7 @@ gtk_css_node_set_visible (GtkCssNode *cssnode,
}
}
}
if (cssnode->previous_sibling)
{
if (gtk_css_node_is_last_child (cssnode))
@@ -1424,7 +1424,7 @@ gtk_css_node_print (GtkCssNode *cssnode,
change = gtk_css_static_style_get_change (gtk_css_style_get_static_style (style));
g_string_append (string, " ");
gtk_css_change_print (change, string);
gtk_css_change_print (change, string);
}
g_string_append_c (string, '\n');
+2 -7
View File
@@ -28,7 +28,6 @@
static GtkCssValue * gtk_css_calc_value_new (guint n_terms);
static GtkCssValue * gtk_css_calc_value_new_sum (GtkCssValue *a,
GtkCssValue *b);
static gsize gtk_css_value_calc_get_size (gsize n_terms);
enum {
TYPE_CALC = 0,
@@ -79,13 +78,9 @@ gtk_css_value_number_free (GtkCssValue *number)
for (guint i = 0; i < n_terms; i++)
_gtk_css_value_unref (number->calc.terms[i]);
}
g_slice_free1 (gtk_css_value_calc_get_size (n_terms), number);
}
else
{
g_slice_free (GtkCssValue, number);
}
g_slice_free (GtkCssValue, number);
}
static double
+16 -16
View File
@@ -208,21 +208,6 @@ gtk_drop_target_end_drop (GtkDropTarget *self)
g_object_thaw_notify (G_OBJECT (self));
}
static GdkDragAction
make_action_unique (GdkDragAction actions)
{
if (actions & GDK_ACTION_COPY)
return GDK_ACTION_COPY;
if (actions & GDK_ACTION_MOVE)
return GDK_ACTION_MOVE;
if (actions & GDK_ACTION_LINK)
return GDK_ACTION_LINK;
return 0;
}
static void
gtk_drop_target_do_drop (GtkDropTarget *self)
{
@@ -234,7 +219,7 @@ gtk_drop_target_do_drop (GtkDropTarget *self)
g_signal_emit (self, signals[DROP], 0, &self->value, self->coords.x, self->coords.y, &success);
if (success)
gdk_drop_finish (self->drop, make_action_unique (self->actions & gdk_drop_get_actions (self->drop)));
gdk_drop_finish (self->drop, gdk_drop_get_actions (self->drop));
else
gdk_drop_finish (self->drop, 0);
@@ -363,6 +348,21 @@ gtk_drop_target_accept (GtkDropTarget *self,
return gdk_content_formats_match_gtype (self->formats, gdk_drop_get_formats (drop)) != G_TYPE_INVALID;
}
static GdkDragAction
make_action_unique (GdkDragAction actions)
{
if (actions & GDK_ACTION_COPY)
return GDK_ACTION_COPY;
if (actions & GDK_ACTION_MOVE)
return GDK_ACTION_MOVE;
if (actions & GDK_ACTION_LINK)
return GDK_ACTION_LINK;
return 0;
}
static GdkDragAction
gtk_drop_target_enter (GtkDropTarget *self,
double x,
+1 -13
View File
@@ -193,23 +193,11 @@ gtk_editable_label_prepare_drag (GtkDragSource *source,
gtk_label_get_label (GTK_LABEL (self->label)));
}
static gboolean
stop_editing_soon (gpointer data)
{
GtkEventController *controller = data;
GtkWidget *widget = gtk_event_controller_get_widget (controller);
if (!gtk_event_controller_focus_contains_focus (GTK_EVENT_CONTROLLER_FOCUS (controller)))
gtk_editable_label_stop_editing (GTK_EDITABLE_LABEL (widget), TRUE);
return FALSE;
}
static void
gtk_editable_label_focus_out (GtkEventController *controller,
GtkEditableLabel *self)
{
g_timeout_add (100, stop_editing_soon, controller);
gtk_editable_label_stop_editing (self, TRUE);
}
static void
+53 -111
View File
@@ -1034,34 +1034,6 @@ gtk_emoji_chooser_show (GtkWidget *widget)
gtk_editable_set_text (GTK_EDITABLE (chooser->search_entry), "");
}
static EmojiSection *
find_section (GtkEmojiChooser *chooser,
GtkWidget *box)
{
if (box == chooser->recent.box)
return &chooser->recent;
else if (box == chooser->people.box)
return &chooser->people;
else if (box == chooser->body.box)
return &chooser->body;
else if (box == chooser->nature.box)
return &chooser->nature;
else if (box == chooser->food.box)
return &chooser->food;
else if (box == chooser->travel.box)
return &chooser->travel;
else if (box == chooser->activities.box)
return &chooser->activities;
else if (box == chooser->objects.box)
return &chooser->objects;
else if (box == chooser->symbols.box)
return &chooser->symbols;
else if (box == chooser->flags.box)
return &chooser->flags;
else
return NULL;
}
static EmojiSection *
find_next_section (GtkEmojiChooser *chooser,
GtkWidget *box,
@@ -1133,111 +1105,81 @@ keynav_failed (GtkWidget *box,
GtkWidget *focus;
GtkWidget *child;
GtkWidget *sibling;
GtkAllocation alloc;
int i;
int column;
int n_columns = 7;
int child_x;
focus = gtk_root_get_focus (gtk_widget_get_root (box));
if (focus == NULL)
return FALSE;
child = gtk_widget_get_ancestor (focus, GTK_TYPE_EMOJI_CHOOSER_CHILD);
column = 0;
child_x = G_MAXINT;
for (sibling = gtk_widget_get_first_child (box);
sibling;
sibling = gtk_widget_get_next_sibling (sibling))
/* determine the number of columns */
child_x = -1;
for (i = 0; i < 20; i++)
{
if (!gtk_widget_get_child_visible (sibling))
continue;
GtkAllocation alloc;
gtk_widget_get_allocation (sibling, &alloc);
if (alloc.x < child_x)
column = 0;
gtk_widget_get_allocation (GTK_WIDGET (gtk_flow_box_get_child_at_index (GTK_FLOW_BOX (box), i)),
&alloc);
if (alloc.x > child_x)
child_x = alloc.x;
else
column++;
child_x = alloc.x;
if (sibling == child)
break;
{
n_columns = i;
break;
}
}
n_columns = MAX (n_columns, 1);
child = gtk_widget_get_ancestor (focus, GTK_TYPE_EMOJI_CHOOSER_CHILD);
i = 0;
for (sibling = gtk_widget_get_first_child (box);
sibling != child;
sibling = gtk_widget_get_next_sibling (sibling))
i++;
column = i % n_columns;
if (direction == GTK_DIR_DOWN)
{
next = find_section (chooser, box);
while (TRUE)
{
next = find_next_section (chooser, box, TRUE);
if (next == NULL)
return FALSE;
i = 0;
for (sibling = gtk_widget_get_first_child (next->box);
sibling;
sibling = gtk_widget_get_next_sibling (sibling), i++)
{
next = find_next_section (chooser, next->box, TRUE);
if (next == NULL)
return FALSE;
i = 0;
child_x = G_MAXINT;
for (sibling = gtk_widget_get_first_child (next->box);
sibling;
sibling = gtk_widget_get_next_sibling (sibling))
if (i == column)
{
if (!gtk_widget_get_child_visible (sibling))
continue;
gtk_widget_get_allocation (sibling, &alloc);
if (alloc.x < child_x)
i = 0;
else
i++;
child_x = alloc.x;
if (i == column)
{
gtk_widget_grab_focus (sibling);
return TRUE;
}
gtk_widget_grab_focus (sibling);
return TRUE;
}
}
}
else if (direction == GTK_DIR_UP)
{
next = find_section (chooser, box);
while (TRUE)
next = find_next_section (chooser, box, FALSE);
if (next == NULL)
return FALSE;
i = 0;
child = NULL;
for (sibling = gtk_widget_get_first_child (next->box);
sibling;
sibling = gtk_widget_get_next_sibling (sibling), i++)
{
next = find_next_section (chooser, next->box, FALSE);
if (next == NULL)
return FALSE;
i = 0;
child_x = G_MAXINT;
child = NULL;
for (sibling = gtk_widget_get_first_child (next->box);
sibling;
sibling = gtk_widget_get_next_sibling (sibling))
{
if (!gtk_widget_get_child_visible (sibling))
continue;
gtk_widget_get_allocation (sibling, &alloc);
if (alloc.x < child_x)
i = 0;
else
i++;
child_x = alloc.x;
if (i == column)
child = sibling;
}
if (child)
{
gtk_widget_grab_focus (child);
return TRUE;
}
if ((i % n_columns) == column)
child = sibling;
}
if (child)
{
gtk_widget_grab_focus (child);
return TRUE;
}
}
+56 -9
View File
@@ -67,6 +67,7 @@
#define SCROLL_CAPTURE_THRESHOLD_MS 150
#define HOLD_TIMEOUT_MS 50
#define SURFACE_UNIT_DISCRETE_MAPPING 10
typedef struct
{
@@ -85,6 +86,8 @@ struct _GtkEventControllerScroll
double cur_dx;
double cur_dy;
GdkScrollUnit cur_unit;
guint hold_timeout_id;
guint active : 1;
};
@@ -345,6 +348,7 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
double dx = 0, dy = 0;
gboolean handled = GDK_EVENT_PROPAGATE;
GdkEventType event_type;
GdkScrollUnit scroll_unit;
event_type = gdk_event_get_event_type (event);
@@ -360,6 +364,8 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
g_clear_handle_id (&scroll->hold_timeout_id, g_source_remove);
scroll_unit = gdk_scroll_event_get_unit (event);
/* FIXME: Handle device changes */
direction = gdk_scroll_event_get_direction (event);
if (direction == GDK_SCROLL_SMOOTH)
@@ -380,18 +386,31 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
scroll->cur_dy += dy;
dx = dy = 0;
if (ABS (scroll->cur_dx) >= 1)
if (scroll_unit == GDK_SCROLL_UNIT_SURFACE)
{
steps = trunc (scroll->cur_dx);
scroll->cur_dx -= steps;
dx = steps;
}
dx = (int) scroll->cur_dx / SURFACE_UNIT_DISCRETE_MAPPING;
scroll->cur_dx -= dx * SURFACE_UNIT_DISCRETE_MAPPING;
if (ABS (scroll->cur_dy) >= 1)
dy = (int) scroll->cur_dy / SURFACE_UNIT_DISCRETE_MAPPING;
scroll->cur_dy -= dy * SURFACE_UNIT_DISCRETE_MAPPING;
scroll_unit = GDK_SCROLL_UNIT_WHEEL;
}
else
{
steps = trunc (scroll->cur_dy);
scroll->cur_dy -= steps;
dy = steps;
if (ABS (scroll->cur_dx) >= 1)
{
steps = trunc (scroll->cur_dx);
scroll->cur_dx -= steps;
dx = steps;
}
if (ABS (scroll->cur_dy) >= 1)
{
steps = trunc (scroll->cur_dy);
scroll->cur_dy -= steps;
dy = steps;
}
}
}
}
@@ -423,6 +442,8 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
dx = 0;
}
scroll->cur_unit = scroll_unit;
if (dx != 0 || dy != 0)
g_signal_emit (controller, signals[SCROLL], 0, dx, dy, &handled);
else if (direction == GDK_SCROLL_SMOOTH &&
@@ -492,6 +513,9 @@ gtk_event_controller_scroll_class_init (GtkEventControllerScrollClass *klass)
* Signals that the widget should scroll by the
* amount specified by @dx and @dy.
*
* For the representation unit of the deltas, see
* [method@Gtk.EventControllerScroll.get_unit].
*
* Returns: %TRUE if the scroll event was handled,
* %FALSE otherwise.
*/
@@ -609,3 +633,26 @@ gtk_event_controller_scroll_get_flags (GtkEventControllerScroll *scroll)
return scroll->flags;
}
/**
* gtk_event_controller_scroll_get_unit:
* @scroll: a `GtkEventControllerScroll`.
*
* Gets the scroll unit of the last
* [signal@Gtk.EventControllerScroll::scroll] signal received.
*
* Always returns %GDK_SCROLL_UNIT_WHEEL if the
* %GTK_EVENT_CONTROLLER_SCROLL_DISCRETE flag is set.
*
* Returns: the scroll unit.
*
* Since: 4.8
*/
GdkScrollUnit
gtk_event_controller_scroll_get_unit (GtkEventControllerScroll *scroll)
{
g_return_val_if_fail (GTK_IS_EVENT_CONTROLLER_SCROLL (scroll),
GDK_SCROLL_UNIT_WHEEL);
return scroll->cur_unit;
}
+3
View File
@@ -71,6 +71,9 @@ GDK_AVAILABLE_IN_ALL
GtkEventControllerScrollFlags
gtk_event_controller_scroll_get_flags (GtkEventControllerScroll *scroll);
GDK_AVAILABLE_IN_4_8
GdkScrollUnit gtk_event_controller_scroll_get_unit (GtkEventControllerScroll *scroll);
G_END_DECLS
#endif /* __GTK_EVENT_CONTROLLER_SCROLL_H__ */
+4
View File
@@ -39,6 +39,7 @@
#include "gtkfilefilterprivate.h"
#include "macos/gdkmacos.h"
#include "macos/gdkmacosdisplay-private.h"
#include "macos/gdkmacossurface-private.h"
typedef struct {
@@ -368,6 +369,9 @@ filechooser_quartz_launch (FileChooserQuartzData *data)
[data->key_window makeKeyAndOrderFront:nil];
}
/* Need to clear our cached copy of ordered windows */
_gdk_macos_display_clear_sorting (GDK_MACOS_DISPLAY (gdk_display_get_default ()));
if (!data->skip_response)
{
g_slist_free_full (self->custom_files, g_object_unref);
+16 -49
View File
@@ -236,7 +236,6 @@ struct _GtkFileChooserWidget
LocationMode location_mode;
GtkWidget *external_entry;
GtkEventController *external_entry_controller;
GtkWidget *choice_box;
GHashTable *choices;
@@ -2194,9 +2193,7 @@ update_default (GtkFileChooserWidget *impl)
return;
files = gtk_file_chooser_get_files (GTK_FILE_CHOOSER (impl));
sensitive = (g_list_model_get_n_items (files) > 0 ||
impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
sensitive = (g_list_model_get_n_items (files) > 0 || impl->action == GTK_FILE_CHOOSER_ACTION_SAVE);
gtk_widget_set_sensitive (button, sensitive);
g_object_unref (files);
@@ -2303,28 +2300,6 @@ forward_key (GtkEventControllerKey *key,
return gtk_event_controller_key_forward (key, GTK_WIDGET (impl));
}
static void
external_entry_setup (GtkFileChooserWidget *impl)
{
/* Make keybindings (for example, Ctrl+H to toggle showing hidden files)
* work even when the focus is on the external entry (which is outside
* the hierarchy of GtkFileChooserWidget) */
impl->external_entry_controller = gtk_event_controller_key_new ();
gtk_event_controller_set_propagation_phase (impl->external_entry_controller,
GTK_PHASE_BUBBLE);
g_signal_connect (impl->external_entry_controller, "key-pressed",
G_CALLBACK (forward_key), impl);
gtk_widget_add_controller (impl->external_entry, impl->external_entry_controller);
}
static void
external_entry_disconnect (GtkFileChooserWidget *impl)
{
gtk_widget_remove_controller (impl->external_entry, impl->external_entry_controller);
impl->external_entry_controller = NULL;
}
/* Creates the widgets specific to Save mode */
static void
save_widgets_create (GtkFileChooserWidget *impl)
@@ -2346,7 +2321,10 @@ save_widgets_create (GtkFileChooserWidget *impl)
impl->location_entry = impl->external_entry;
g_object_add_weak_pointer (G_OBJECT (impl->external_entry), (gpointer *)&impl->location_entry);
location_entry_setup (impl);
external_entry_setup (impl);
g_signal_connect_after (gtk_entry_get_key_controller (GTK_ENTRY (impl->external_entry)),
"key-pressed",
G_CALLBACK (forward_key), impl);
return;
}
@@ -2383,7 +2361,9 @@ save_widgets_destroy (GtkFileChooserWidget *impl)
{
if (impl->external_entry && impl->external_entry == impl->location_entry)
{
external_entry_disconnect (impl);
g_signal_handlers_disconnect_by_func (gtk_entry_get_key_controller (GTK_ENTRY (impl->external_entry)),
forward_key, impl);
location_entry_disconnect (impl);
impl->location_entry = NULL;
}
@@ -3122,6 +3102,7 @@ gtk_file_chooser_widget_dispose (GObject *object)
GtkFileChooserWidget *impl = (GtkFileChooserWidget *) object;
cancel_all_operations (impl);
g_clear_pointer (&impl->rename_file_popover, gtk_widget_unparent);
g_clear_pointer (&impl->browse_files_popover, gtk_widget_unparent);
g_clear_object (&impl->extra_widget);
@@ -3129,7 +3110,6 @@ gtk_file_chooser_widget_dispose (GObject *object)
if (impl->external_entry && impl->location_entry == impl->external_entry)
{
external_entry_disconnect (impl);
location_entry_disconnect (impl);
impl->external_entry = NULL;
}
@@ -5466,7 +5446,7 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
* So we want the selection to be "bar/foo.txt". Jump to the case for the
* filename entry to see if that is the case.
*/
if (g_list_model_get_n_items (G_LIST_MODEL (info.result)) == 0 && impl->location_entry)
if (info.result == NULL && impl->location_entry)
goto file_entry;
}
else if (impl->location_entry &&
@@ -5484,7 +5464,7 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
goto out;
if (!is_well_formed)
goto empty;
return NULL;
if (info.file_from_entry)
{
@@ -5494,7 +5474,7 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
else if (!file_list_seen)
goto file_list;
else
goto empty;
return NULL;
}
else if (impl->toplevel_last_focus_widget == impl->browse_files_tree_view)
goto file_list;
@@ -5515,7 +5495,7 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
* then we fall back to the current directory
*/
if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER &&
g_list_model_get_n_items (G_LIST_MODEL (info.result)) == 0)
info.result == NULL)
{
GFile *current_folder;
@@ -5526,11 +5506,6 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
}
return G_LIST_MODEL (info.result);
empty:
g_list_store_remove_all (info.result);
return G_LIST_MODEL (info.result);
}
/* Shows or hides the filter widgets */
@@ -7760,17 +7735,9 @@ captured_key (GtkEventControllerKey *controller,
impl->location_mode == LOCATION_MODE_FILENAME_ENTRY))
return GDK_EVENT_PROPAGATE;
if (keyval == GDK_KEY_slash || keyval == GDK_KEY_asciitilde || keyval == GDK_KEY_period)
if (keyval == GDK_KEY_slash)
return GDK_EVENT_PROPAGATE;
if (impl->location_entry)
{
GtkWidget *focus = gtk_root_get_focus (gtk_widget_get_root (GTK_WIDGET (impl)));
if (focus && gtk_widget_is_ancestor (focus, impl->location_entry))
return GDK_EVENT_PROPAGATE;
}
handled = gtk_event_controller_key_forward (controller, GTK_WIDGET (impl->search_entry));
if (handled == GDK_EVENT_STOP)
operation_mode_set (impl, OPERATION_MODE_SEARCH);
@@ -7880,11 +7847,11 @@ gtk_file_chooser_widget_set_save_entry (GtkFileChooserWidget *impl,
g_return_if_fail (GTK_IS_FILE_CHOOSER_WIDGET (impl));
g_return_if_fail (entry == NULL || GTK_IS_FILE_CHOOSER_ENTRY (entry));
impl->external_entry = entry;
if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
save_widgets_destroy (impl);
impl->external_entry = entry;
save_widgets_create (impl);
}
}
+1 -1
View File
@@ -339,7 +339,7 @@ parser_end_element (GtkBuildableParseContext *context,
{
SubParserData *data = (SubParserData*)user_data;
if (data->string && data->parsing)
if (data->string)
{
switch (data->type)
{
+17 -23
View File
@@ -204,7 +204,7 @@ cell_augment (GtkRbTree *tree,
* index of the returned row
* @offset: (out caller-allocates) (optional): stores the offset
* in pixels between y and top of cell.
* @size: (out caller-allocates) (optional): stores the height
* @offset: (out caller-allocates) (optional): stores the height
* of the cell
*
* Gets the Cell that occupies the leftmost position in the row at offset
@@ -413,19 +413,6 @@ gtk_grid_view_get_allocation_across (GtkListBase *base,
return TRUE;
}
static int
gtk_grid_view_compute_total_height (GtkGridView *self)
{
Cell *cell;
CellAugment *aug;
cell = gtk_list_item_manager_get_root (self->item_manager);
if (cell == NULL)
return 0;
aug = gtk_list_item_manager_get_item_augment (self->item_manager, cell);
return aug->size;
}
static gboolean
gtk_grid_view_get_position_from_allocation (GtkListBase *base,
int across,
@@ -441,9 +428,6 @@ gtk_grid_view_get_position_from_allocation (GtkListBase *base,
return FALSE;
n_items = gtk_list_base_get_n_items (base);
along = CLAMP (along, 0, gtk_grid_view_compute_total_height (self) - 1);
across = across < 0 ? 0 : across;
if (!gtk_grid_view_get_cell_at_y (self,
along,
&pos,
@@ -483,19 +467,16 @@ gtk_grid_view_get_items_in_rect (GtkListBase *base,
result = gtk_bitset_new_empty ();
if (rect->y >= gtk_grid_view_compute_total_height (self))
return result;
n_items = gtk_list_base_get_n_items (base);
if (n_items == 0)
return result;
first_column = fmax (floor (rect->x / self->column_width), 0);
last_column = fmin (floor ((rect->x + rect->width) / self->column_width), self->n_columns - 1);
first_column = floor (rect->x / self->column_width);
last_column = floor ((rect->x + rect->width) / self->column_width);
if (!gtk_grid_view_get_cell_at_y (self, rect->y, &first_row, NULL, NULL))
first_row = rect->y < 0 ? 0 : n_items - 1;
if (!gtk_grid_view_get_cell_at_y (self, rect->y + rect->height, &last_row, NULL, NULL))
last_row = rect->y + rect->height < 0 ? 0 : n_items - 1;
last_row = rect->y < 0 ? 0 : n_items - 1;
gtk_bitset_add_rectangle (result,
first_row + first_column,
@@ -741,6 +722,19 @@ cell_set_size (Cell *cell,
gtk_rb_tree_node_mark_dirty (cell);
}
static int
gtk_grid_view_compute_total_height (GtkGridView *self)
{
Cell *cell;
CellAugment *aug;
cell = gtk_list_item_manager_get_root (self->item_manager);
if (cell == NULL)
return 0;
aug = gtk_list_item_manager_get_item_augment (self->item_manager, cell);
return aug->size;
}
static void
gtk_grid_view_size_allocate (GtkWidget *widget,
int width,
+2 -12
View File
@@ -1719,7 +1719,7 @@ static const char builtin_hicolor_index[] =
"[Icon Theme]\n"
"Name=Hicolor\n"
"Hidden=True\n"
"Directories=16x16/actions,16x16/status,22x22/actions,24x24/actions,24x24/status,32x32/actions,32x32/status,48x48/status,64x64/actions,scalable/status,scalable/actions\n"
"Directories=16x16/actions,16x16/status,22x22/actions,24x24/actions,24x24/status,32x32/actions,32x32/status,48x48/status,64x64/actions\n"
"[16x16/actions]\n"
"Size=16\n"
"Type=Threshold\n"
@@ -1746,17 +1746,7 @@ static const char builtin_hicolor_index[] =
"Type=Threshold\n"
"[64x64/actions]\n"
"Size=64\n"
"Type=Threshold\n"
"[scalable/status]\n"
"MinSize=1\n"
"Size=128\n"
"MaxSize=256\n"
"Type=Scalable\n"
"[scalable/actions]\n"
"MinSize=1\n"
"Size=128\n"
"MaxSize=256\n"
"Type=Scalable\n";
"Type=Threshold\n";
static void
insert_theme (GtkIconTheme *self,
+29 -30
View File
@@ -5726,35 +5726,8 @@ drag_scroll_timeout (gpointer data)
return TRUE;
}
static GdkDragAction
gtk_icon_view_get_action (GtkWidget *widget,
GdkDrop *drop)
{
GtkIconView *iconview = GTK_ICON_VIEW (widget);
GdkDrag *drag = gdk_drop_get_drag (drop);
GdkDragAction actions;
actions = gdk_drop_get_actions (drop);
if (drag == iconview->priv->drag &&
actions & GDK_ACTION_MOVE)
return GDK_ACTION_MOVE;
if (actions & GDK_ACTION_COPY)
return GDK_ACTION_COPY;
if (actions & GDK_ACTION_MOVE)
return GDK_ACTION_MOVE;
if (actions & GDK_ACTION_LINK)
return GDK_ACTION_LINK;
return 0;
}
static gboolean
set_destination (GtkIconView *icon_view,
GdkDrop *drop,
GtkDropTargetAsync *dest,
int x,
int y,
@@ -5841,7 +5814,7 @@ set_destination (GtkIconView *icon_view,
out:
if (can_drop)
{
*suggested_action = gtk_icon_view_get_action (widget, drop);
*suggested_action = GDK_ACTION_ALL;
gtk_icon_view_set_drag_dest_item (GTK_ICON_VIEW (widget),
path, pos);
@@ -6081,7 +6054,7 @@ gtk_icon_view_drag_motion (GtkDropTargetAsync *dest,
gboolean empty;
GdkDragAction result;
if (!set_destination (icon_view, drop, dest, x, y, &suggested_action, &target))
if (!set_destination (icon_view, dest, x, y, &suggested_action, &target))
return 0;
gtk_icon_view_get_drag_dest_item (icon_view, &path, &pos);
@@ -6146,7 +6119,7 @@ gtk_icon_view_drag_drop (GtkDropTargetAsync *dest,
if (!check_model_dnd (model, GTK_TYPE_TREE_DRAG_DEST, "drop"))
return FALSE;
if (!set_destination (icon_view, drop, dest, x, y, &suggested_action, &target))
if (!set_destination (icon_view, dest, x, y, &suggested_action, &target))
return FALSE;
path = get_logical_destination (icon_view, &drop_append_mode);
@@ -6176,6 +6149,32 @@ gtk_icon_view_drag_drop (GtkDropTargetAsync *dest,
return FALSE;
}
static GdkDragAction
gtk_icon_view_get_action (GtkWidget *widget,
GdkDrop *drop)
{
GtkIconView *iconview = GTK_ICON_VIEW (widget);
GdkDrag *drag = gdk_drop_get_drag (drop);
GdkDragAction actions;
actions = gdk_drop_get_actions (drop);
if (drag == iconview->priv->drag &&
actions & GDK_ACTION_MOVE)
return GDK_ACTION_MOVE;
if (actions & GDK_ACTION_COPY)
return GDK_ACTION_COPY;
if (actions & GDK_ACTION_MOVE)
return GDK_ACTION_MOVE;
if (actions & GDK_ACTION_LINK)
return GDK_ACTION_LINK;
return 0;
}
static void
gtk_icon_view_drag_data_received (GObject *source,
GAsyncResult *result,
+10 -28
View File
@@ -132,9 +132,7 @@ gtk_image_definition_new_paintable (GdkPaintable *paintable)
GtkImageDefinition *
gtk_image_definition_ref (GtkImageDefinition *def)
{
GtkImageDefinitionEmpty *empty = (GtkImageDefinitionEmpty *) def;
empty->ref_count++;
def->empty.ref_count++;
return def;
}
@@ -142,11 +140,9 @@ gtk_image_definition_ref (GtkImageDefinition *def)
void
gtk_image_definition_unref (GtkImageDefinition *def)
{
GtkImageDefinitionEmpty *empty = (GtkImageDefinitionEmpty *) def;
def->empty.ref_count--;
empty->ref_count--;
if (empty->ref_count > 0)
if (def->empty.ref_count > 0)
return;
switch (def->type)
@@ -156,22 +152,13 @@ gtk_image_definition_unref (GtkImageDefinition *def)
g_assert_not_reached ();
break;
case GTK_IMAGE_PAINTABLE:
{
GtkImageDefinitionPaintable *paintable = (GtkImageDefinitionPaintable *) def;
g_object_unref (paintable->paintable);
}
g_object_unref (def->paintable.paintable);
break;
case GTK_IMAGE_ICON_NAME:
{
GtkImageDefinitionIconName *icon_name = (GtkImageDefinitionIconName *) def;
g_free (icon_name->icon_name);
}
g_free (def->icon_name.icon_name);
break;
case GTK_IMAGE_GICON:
{
GtkImageDefinitionGIcon *gicon = (GtkImageDefinitionGIcon *) def;
g_object_unref (gicon->gicon);
}
g_object_unref (def->gicon.gicon);
break;
}
@@ -202,32 +189,27 @@ gtk_image_definition_get_scale (const GtkImageDefinition *def)
const char *
gtk_image_definition_get_icon_name (const GtkImageDefinition *def)
{
const GtkImageDefinitionIconName *icon_name = (const GtkImageDefinitionIconName *) def;
if (def->type != GTK_IMAGE_ICON_NAME)
return NULL;
return icon_name->icon_name;
return def->icon_name.icon_name;
}
GIcon *
gtk_image_definition_get_gicon (const GtkImageDefinition *def)
{
const GtkImageDefinitionGIcon *gicon = (const GtkImageDefinitionGIcon *) def;
if (def->type != GTK_IMAGE_GICON)
return NULL;
return gicon->gicon;
return def->gicon.gicon;
}
GdkPaintable *
gtk_image_definition_get_paintable (const GtkImageDefinition *def)
{
const GtkImageDefinitionPaintable *paintable = (const GtkImageDefinitionPaintable *) def;
if (def->type != GTK_IMAGE_PAINTABLE)
return NULL;
return paintable->paintable;
return def->paintable.paintable;
}
+27 -57
View File
@@ -98,11 +98,6 @@ struct _GtkIMContextWayland
static void gtk_im_context_wayland_focus_out (GtkIMContext *context);
static void commit_state (GtkIMContextWayland *context);
static void notify_surrounding_text (GtkIMContextWayland *context);
static void notify_cursor_location (GtkIMContextWayland *context);
static void notify_content_type (GtkIMContextWayland *context);
G_DEFINE_TYPE_WITH_CODE (GtkIMContextWayland, gtk_im_context_wayland, GTK_TYPE_IM_CONTEXT_SIMPLE,
gtk_im_module_ensure_extension_point ();
g_io_extension_point_implement (GTK_IM_MODULE_EXTENSION_POINT_NAME,
@@ -133,8 +128,7 @@ gtk_im_context_wayland_get_global (GtkIMContextWayland *self)
}
static void
notify_im_change (GtkIMContextWayland *context,
enum zwp_text_input_v3_change_cause cause)
notify_external_change (GtkIMContextWayland *context)
{
GtkIMContextWaylandGlobal *global;
gboolean result;
@@ -143,13 +137,9 @@ notify_im_change (GtkIMContextWayland *context,
if (global == NULL)
return;
context->surrounding_change = cause;
context->surrounding_change = ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_OTHER;
g_signal_emit_by_name (global->current, "retrieve-surrounding", &result);
notify_surrounding_text (context);
notify_content_type (context);
notify_cursor_location (context);
commit_state (context);
}
static void
@@ -184,9 +174,6 @@ text_input_preedit_apply (GtkIMContextWaylandGlobal *global)
return;
context = GTK_IM_CONTEXT_WAYLAND (global->current);
if (context->pending_preedit.text == NULL &&
context->current_preedit.text == NULL)
return;
state_change = ((context->pending_preedit.text == NULL)
!= (context->current_preedit.text == NULL));
@@ -263,14 +250,9 @@ text_input_delete_surrounding_text_apply (GtkIMContextWaylandGlobal *global)
len = context->pending_surrounding_delete.after_length
+ context->pending_surrounding_delete.before_length;
if (len > 0)
{
g_signal_emit_by_name (global->current, "delete-surrounding",
-context->pending_surrounding_delete.before_length,
len, &retval);
notify_im_change (GTK_IM_CONTEXT_WAYLAND (context),
ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD);
}
g_signal_emit_by_name (global->current, "delete-surrounding",
-context->pending_surrounding_delete.before_length,
len, &retval);
context->pending_surrounding_delete = defaults;
}
@@ -280,25 +262,17 @@ text_input_done (void *data,
uint32_t serial)
{
GtkIMContextWaylandGlobal *global = data;
GtkIMContextWayland *context;
gboolean update_im;
gboolean result;
global->done_serial = serial;
if (!global->current)
return;
context = GTK_IM_CONTEXT_WAYLAND (global->current);
update_im = (context->pending_commit != NULL ||
g_strcmp0 (context->pending_preedit.text,
context->current_preedit.text) != 0);
text_input_delete_surrounding_text_apply (global);
text_input_commit_apply (global);
g_signal_emit_by_name (global->current, "retrieve-surrounding", &result);
text_input_preedit_apply (global);
if (update_im && global->serial == serial)
notify_im_change (context, ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD);
}
static void
@@ -315,6 +289,8 @@ notify_surrounding_text (GtkIMContextWayland *context)
global = gtk_im_context_wayland_get_global (context);
if (global == NULL)
return;
if (global->done_serial != global->serial)
return;
len = strlen (context->surrounding.text);
cursor = context->surrounding.cursor_idx;
@@ -389,6 +365,8 @@ notify_cursor_location (GtkIMContextWayland *context)
global = gtk_im_context_wayland_get_global (context);
if (global == NULL)
return;
if (global->done_serial != global->serial)
return;
rect = context->cursor_rect;
gtk_widget_translate_coordinates (context->widget,
@@ -479,6 +457,8 @@ notify_content_type (GtkIMContextWayland *context)
global = gtk_im_context_wayland_get_global (context);
if (global == NULL)
return;
if (global->done_serial != global->serial)
return;
g_object_get (context,
"input-hints", &hints,
@@ -544,6 +524,7 @@ released_cb (GtkGestureClick *gesture,
{
GtkIMContextWaylandGlobal *global;
GtkInputHints hints;
gboolean result;
global = gtk_im_context_wayland_get_global (context);
if (global == NULL)
@@ -560,8 +541,8 @@ released_cb (GtkGestureClick *gesture,
x, y))
{
zwp_text_input_v3_enable (global->text_input);
notify_im_change (GTK_IM_CONTEXT_WAYLAND (context),
ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_OTHER);
g_signal_emit_by_name (global->current, "retrieve-surrounding", &result);
commit_state (context);
}
}
@@ -693,9 +674,12 @@ static void
enable (GtkIMContextWayland *context_wayland,
GtkIMContextWaylandGlobal *global)
{
gboolean result;
zwp_text_input_v3_enable (global->text_input);
notify_im_change (context_wayland,
ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_OTHER);
g_signal_emit_by_name (global->current, "retrieve-surrounding", &result);
notify_content_type (context_wayland);
notify_cursor_location (context_wayland);
commit_state (context_wayland);
}
static void
@@ -705,12 +689,6 @@ disable (GtkIMContextWayland *context_wayland,
zwp_text_input_v3_disable (global->text_input);
commit_state (context_wayland);
/* The commit above will still count in the .done event accounting,
* we should account for it, lest the serial gets out of sync after
* a future focus_in/enable.
*/
global->done_serial++;
/* after disable, incoming state changes won't take effect anyway */
if (context_wayland->current_preedit.text)
{
@@ -873,8 +851,7 @@ gtk_im_context_wayland_focus_out (GtkIMContext *context)
static void
gtk_im_context_wayland_reset (GtkIMContext *context)
{
notify_im_change (GTK_IM_CONTEXT_WAYLAND (context),
ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_OTHER);
notify_external_change (GTK_IM_CONTEXT_WAYLAND (context));
GTK_IM_CONTEXT_CLASS (gtk_im_context_wayland_parent_class)->reset (context);
}
@@ -909,6 +886,8 @@ gtk_im_context_wayland_set_cursor_location (GtkIMContext *context,
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (context_wayland->gesture));
context_wayland->cursor_rect = *rect;
notify_cursor_location (context_wayland);
commit_state (context_wayland);
}
static void
@@ -942,6 +921,9 @@ gtk_im_context_wayland_set_surrounding (GtkIMContext *context,
context_wayland->surrounding.text = g_strndup (text, len);
context_wayland->surrounding.cursor_idx = cursor_index;
context_wayland->surrounding.anchor_idx = selection_bound;
notify_surrounding_text (context_wayland);
commit_state (context_wayland);
}
static gboolean
@@ -963,17 +945,6 @@ gtk_im_context_wayland_get_surrounding (GtkIMContext *context,
return TRUE;
}
static void
gtk_im_context_wayland_commit (GtkIMContext *context,
const gchar *str)
{
if (GTK_IM_CONTEXT_CLASS (gtk_im_context_wayland_parent_class)->commit)
GTK_IM_CONTEXT_CLASS (gtk_im_context_wayland_parent_class)->commit (context, str);
notify_im_change (GTK_IM_CONTEXT_WAYLAND (context),
ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD);
}
static void
gtk_im_context_wayland_class_init (GtkIMContextWaylandClass *klass)
{
@@ -992,7 +963,6 @@ gtk_im_context_wayland_class_init (GtkIMContextWaylandClass *klass)
im_context_class->set_use_preedit = gtk_im_context_wayland_set_use_preedit;
im_context_class->set_surrounding_with_selection = gtk_im_context_wayland_set_surrounding;
im_context_class->get_surrounding_with_selection = gtk_im_context_wayland_get_surrounding;
im_context_class->commit = gtk_im_context_wayland_commit;
}
static void
+1 -5
View File
@@ -181,8 +181,6 @@ gtk_kinetic_scrolling_tick (GtkKineticScrolling *data,
{
case GTK_KINETIC_SCROLLING_PHASE_DECELERATING:
{
double last_position = data->position;
double last_time = data->t;
double exp_part;
data->t += time_delta;
@@ -199,8 +197,7 @@ gtk_kinetic_scrolling_tick (GtkKineticScrolling *data,
{
gtk_kinetic_scrolling_init_overshoot(data, data->upper, data->position, data->velocity);
}
else if (fabs(data->velocity) < 1 ||
(last_time != 0.0 && fabs(data->position - last_position) < 1))
else if (fabs(data->velocity) < 0.1)
{
gtk_kinetic_scrolling_stop (data);
}
@@ -254,6 +251,5 @@ gtk_kinetic_scrolling_stop (GtkKineticScrolling *data)
{
data->phase = GTK_KINETIC_SCROLLING_PHASE_FINISHED;
data->position = round (data->position);
data->velocity = 0;
}
}
+15 -18
View File
@@ -1566,28 +1566,25 @@ gtk_list_base_stop_rubberband (GtkListBase *self,
return;
rubberband_selection = gtk_list_base_get_items_in_rect (self, &rect);
if (gtk_bitset_is_empty (rubberband_selection))
{
gtk_bitset_unref (rubberband_selection);
return;
}
if (modify && extend) /* Ctrl + Shift */
{
if (gtk_bitset_is_empty (rubberband_selection))
{
selected = gtk_bitset_ref (rubberband_selection);
mask = gtk_bitset_ref (rubberband_selection);
}
else
{
GtkBitset *current;
guint min = gtk_bitset_get_minimum (rubberband_selection);
guint max = gtk_bitset_get_maximum (rubberband_selection);
/* toggle the rubberband, keep the rest */
current = gtk_selection_model_get_selection_in_range (model, min, max - min + 1);
selected = gtk_bitset_copy (current);
gtk_bitset_unref (current);
gtk_bitset_intersect (selected, rubberband_selection);
gtk_bitset_difference (selected, rubberband_selection);
GtkBitset *current;
guint min = gtk_bitset_get_minimum (rubberband_selection);
guint max = gtk_bitset_get_maximum (rubberband_selection);
/* toggle the rubberband, keep the rest */
current = gtk_selection_model_get_selection_in_range (model, min, max - min + 1);
selected = gtk_bitset_copy (current);
gtk_bitset_unref (current);
gtk_bitset_intersect (selected, rubberband_selection);
gtk_bitset_difference (selected, rubberband_selection);
mask = gtk_bitset_ref (rubberband_selection);
}
mask = gtk_bitset_ref (rubberband_selection);
}
else if (modify) /* Ctrl */
{
-16
View File
@@ -247,22 +247,6 @@ gtk_list_item_new (void)
return g_object_new (GTK_TYPE_LIST_ITEM, NULL);
}
void
gtk_list_item_do_notify (GtkListItem *list_item,
gboolean notify_item,
gboolean notify_position,
gboolean notify_selected)
{
GObject *object = G_OBJECT (list_item);
if (notify_item)
g_object_notify_by_pspec (object, properties[PROP_ITEM]);
if (notify_position)
g_object_notify_by_pspec (object, properties[PROP_POSITION]);
if (notify_selected)
g_object_notify_by_pspec (object, properties[PROP_SELECTED]);
}
/**
* gtk_list_item_get_item: (attributes org.gtk.Method.get_property=item)
* @self: a `GtkListItem`
+4
View File
@@ -162,5 +162,9 @@ gtk_list_item_factory_update (GtkListItemFactory *self,
list_item = gtk_list_item_widget_get_list_item (widget);
g_object_freeze_notify (G_OBJECT (list_item));
GTK_LIST_ITEM_FACTORY_GET_CLASS (self)->update (self, widget, list_item, position, item, selected);
g_object_thaw_notify (G_OBJECT (list_item));
}
-5
View File
@@ -40,11 +40,6 @@ struct _GtkListItem
GtkListItem * gtk_list_item_new (void);
void gtk_list_item_do_notify (GtkListItem *list_item,
gboolean notify_item,
gboolean notify_position,
gboolean notify_selected);
G_END_DECLS
+16 -23
View File
@@ -485,27 +485,20 @@ gtk_list_item_widget_update (GtkListItemWidget *self,
gboolean selected)
{
GtkListItemWidgetPrivate *priv = gtk_list_item_widget_get_instance_private (self);
gboolean was_selected;
was_selected = priv->selected;
if (priv->list_item)
gtk_list_item_factory_update (priv->factory, self, position, item, selected);
else
gtk_list_item_widget_default_update (self, NULL, position, item, selected);
/* don't look at selected variable, it's not reentrancy safe */
if (was_selected != priv->selected)
{
if (priv->selected)
gtk_widget_set_state_flags (GTK_WIDGET (self), GTK_STATE_FLAG_SELECTED, FALSE);
else
gtk_widget_unset_state_flags (GTK_WIDGET (self), GTK_STATE_FLAG_SELECTED);
if (selected)
gtk_widget_set_state_flags (GTK_WIDGET (self), GTK_STATE_FLAG_SELECTED, FALSE);
else
gtk_widget_unset_state_flags (GTK_WIDGET (self), GTK_STATE_FLAG_SELECTED);
gtk_accessible_update_state (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_STATE_SELECTED, priv->selected,
-1);
}
gtk_accessible_update_state (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_STATE_SELECTED, selected,
-1);
}
void
@@ -561,29 +554,29 @@ gtk_list_item_widget_default_update (GtkListItemWidget *self,
gpointer item,
gboolean selected)
{
/* Track notify manually instead of freeze/thaw_notify for performance reasons. */
gboolean notify_item = FALSE, notify_position = FALSE, notify_selected = FALSE;
GtkListItemWidgetPrivate *priv = gtk_list_item_widget_get_instance_private (self);
/* FIXME: It's kinda evil to notify external objects from here... */
if (g_set_object (&priv->item, item))
notify_item = TRUE;
{
if (list_item)
g_object_notify (G_OBJECT (list_item), "item");
}
if (priv->position != position)
{
priv->position = position;
notify_position = TRUE;
if (list_item)
g_object_notify (G_OBJECT (list_item), "position");
}
if (priv->selected != selected)
{
priv->selected = selected;
notify_selected = TRUE;
if (list_item)
g_object_notify (G_OBJECT (list_item), "selected");
}
if (list_item)
gtk_list_item_do_notify (list_item, notify_item, notify_position, notify_selected);
}
void
+1 -6
View File
@@ -377,9 +377,6 @@ gtk_list_view_get_items_in_rect (GtkListBase *base,
result = gtk_bitset_new_empty ();
if (rect->y >= gtk_list_view_get_list_height (self))
return result;
n_items = gtk_list_base_get_n_items (base);
if (n_items == 0)
return result;
@@ -393,7 +390,7 @@ gtk_list_view_get_items_in_rect (GtkListBase *base,
if (row)
last = gtk_list_item_manager_get_item_position (self->item_manager, row);
else
last = rect->y + rect->height < 0 ? 0 : n_items - 1;
last = rect->y < 0 ? 0 : n_items - 1;
gtk_bitset_add_range_closed (result, first, last);
return result;
@@ -428,8 +425,6 @@ gtk_list_view_get_position_from_allocation (GtkListBase *base,
if (across >= self->list_width)
return FALSE;
along = CLAMP (along, 0, gtk_list_view_get_list_height (self) - 1);
row = gtk_list_view_get_row_at_y (self, along, &remaining);
if (row == NULL)
return FALSE;
+46 -44
View File
@@ -897,31 +897,11 @@ rewrite_event_for_surface (GdkEvent *event,
GdkSurface *new_surface)
{
GdkEventType type;
double x, y;
double x = -G_MAXDOUBLE, y = -G_MAXDOUBLE;
double dx, dy;
type = gdk_event_get_event_type (event);
switch ((guint) type)
{
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
case GDK_MOTION_NOTIFY:
case GDK_TOUCH_BEGIN:
case GDK_TOUCH_UPDATE:
case GDK_TOUCH_END:
case GDK_TOUCH_CANCEL:
case GDK_TOUCHPAD_SWIPE:
case GDK_TOUCHPAD_PINCH:
case GDK_TOUCHPAD_HOLD:
gdk_event_get_position (event, &x, &y);
gdk_surface_translate_coordinates (gdk_event_get_surface (event), new_surface, &x, &y);
break;
default:
x = y = 0;
break;
}
switch ((guint) type)
{
case GDK_BUTTON_PRESS:
@@ -1031,8 +1011,7 @@ rewrite_event_for_grabs (GdkEvent *event)
display = gdk_event_get_display (event);
device = gdk_event_get_device (event);
if (!gdk_device_grab_info (display, device, &grab_surface, &owner_events) ||
!owner_events)
if (!gdk_device_grab_info (display, device, &grab_surface, &owner_events))
return NULL;
break;
default:
@@ -1042,11 +1021,24 @@ rewrite_event_for_grabs (GdkEvent *event)
event_widget = gtk_get_event_widget (event);
grab_widget = GTK_WIDGET (gtk_native_get_for_surface (grab_surface));
if (grab_widget &&
gtk_main_get_window_group (grab_widget) != gtk_main_get_window_group (event_widget))
return rewrite_event_for_surface (event, grab_surface);
else
if (!grab_widget)
return NULL;
/* If owner_events was set, events in client surfaces get forwarded
* as normal, but we consider other window groups foreign surfaces.
*/
if (owner_events &&
gtk_main_get_window_group (grab_widget) == gtk_main_get_window_group (event_widget))
return NULL;
/* If owner_events was not set, events only get sent to the grabbing
* surface.
*/
if (!owner_events &&
grab_surface == gtk_native_get_surface (gtk_widget_get_native (event_widget)))
return NULL;
return rewrite_event_for_surface (event, grab_surface);
}
static GdkEvent *
@@ -1082,19 +1074,30 @@ rewrite_event_for_toplevel (GdkEvent *event)
}
static gboolean
translate_coordinates (double event_x,
double event_y,
double *x,
double *y,
GtkWidget *widget)
translate_event_coordinates (GdkEvent *event,
double *x,
double *y,
GtkWidget *widget)
{
GtkWidget *event_widget;
GtkNative *native;
graphene_point_t p;
double event_x, event_y;
double native_x, native_y;
*x = *y = 0;
native = gtk_widget_get_native (widget);
if (!gtk_widget_compute_point (GTK_WIDGET (native),
if (!gdk_event_get_position (event, &event_x, &event_y))
return FALSE;
event_widget = gtk_get_event_widget (event);
native = gtk_widget_get_native (event_widget);
gtk_native_get_surface_transform (GTK_NATIVE (native), &native_x, &native_y);
event_x -= native_x;
event_y -= native_y;
if (!gtk_widget_compute_point (event_widget,
widget,
&GRAPHENE_POINT_INIT (event_x, event_y),
&p))
@@ -1106,13 +1109,12 @@ translate_coordinates (double event_x,
return TRUE;
}
void
static void
gtk_synthesize_crossing_events (GtkRoot *toplevel,
GtkCrossingType crossing_type,
GtkWidget *old_target,
GtkWidget *new_target,
double surface_x,
double surface_y,
GdkEvent *event,
GdkCrossingMode mode,
GdkDrop *drop)
{
@@ -1168,7 +1170,7 @@ gtk_synthesize_crossing_events (GtkRoot *toplevel,
crossing.new_descendent = NULL;
}
check_crossing_invariants (widget, &crossing);
translate_coordinates (surface_x, surface_y, &x, &y, widget);
translate_event_coordinates (event, &x, &y, widget);
gtk_widget_handle_crossing (widget, &crossing, x, y);
if (crossing_type == GTK_CROSSING_POINTER)
gtk_widget_unset_state_flags (widget, GTK_STATE_FLAG_PRELIGHT);
@@ -1211,7 +1213,7 @@ gtk_synthesize_crossing_events (GtkRoot *toplevel,
crossing.old_descendent = old_target ? crossing.new_descendent : NULL;
}
translate_coordinates (surface_x, surface_y, &x, &y, widget);
translate_event_coordinates (event, &x, &y, widget);
gtk_widget_handle_crossing (widget, &crossing, x, y);
if (crossing_type == GTK_CROSSING_POINTER)
gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_PRELIGHT, FALSE);
@@ -1378,7 +1380,7 @@ handle_pointing_event (GdkEvent *event)
old_target = update_pointer_focus_state (toplevel, event, NULL);
gtk_synthesize_crossing_events (GTK_ROOT (toplevel), GTK_CROSSING_POINTER, old_target, NULL,
x, y, gdk_crossing_event_get_mode (event), NULL);
event, gdk_crossing_event_get_mode (event), NULL);
break;
case GDK_TOUCH_END:
case GDK_TOUCH_CANCEL:
@@ -1391,7 +1393,7 @@ handle_pointing_event (GdkEvent *event)
old_target = update_pointer_focus_state (toplevel, event, NULL);
gtk_drop_begin_event (drop, GDK_DRAG_LEAVE);
gtk_synthesize_crossing_events (GTK_ROOT (toplevel), GTK_CROSSING_DROP, old_target, NULL,
x, y, GDK_CROSSING_NORMAL, drop);
event, GDK_CROSSING_NORMAL, drop);
gtk_drop_end_event (drop);
}
break;
@@ -1418,7 +1420,7 @@ handle_pointing_event (GdkEvent *event)
sequence))
{
gtk_synthesize_crossing_events (GTK_ROOT (toplevel), GTK_CROSSING_POINTER, old_target, target,
x, y, GDK_CROSSING_NORMAL, NULL);
event, GDK_CROSSING_NORMAL, NULL);
}
gtk_window_maybe_update_cursor (toplevel, NULL, device);
@@ -1429,7 +1431,7 @@ handle_pointing_event (GdkEvent *event)
GdkDrop *drop = gdk_dnd_event_get_drop (event);
gtk_drop_begin_event (drop, type);
gtk_synthesize_crossing_events (GTK_ROOT (toplevel), GTK_CROSSING_DROP, old_target, target,
x, y, GDK_CROSSING_NORMAL, gdk_dnd_event_get_drop (event));
event, GDK_CROSSING_NORMAL, gdk_dnd_event_get_drop (event));
gtk_drop_end_event (drop);
}
else if (type == GDK_TOUCH_BEGIN)
@@ -1469,7 +1471,7 @@ handle_pointing_event (GdkEvent *event)
new_target = GTK_WIDGET (toplevel);
gtk_synthesize_crossing_events (GTK_ROOT (toplevel), GTK_CROSSING_POINTER, target, new_target,
x, y, GDK_CROSSING_UNGRAB, NULL);
event, GDK_CROSSING_UNGRAB, NULL);
gtk_window_maybe_update_cursor (toplevel, NULL, device);
update_pointer_focus_state (toplevel, event, new_target);
}
-2
View File
@@ -2605,7 +2605,6 @@ gtk_notebook_gesture_pressed (GtkGestureClick *gesture,
if (arrow != ARROW_NONE)
{
gtk_notebook_arrow_button_press (notebook, arrow, button);
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
return;
}
@@ -6811,7 +6810,6 @@ gtk_notebook_child_reordered (GtkNotebook *notebook,
gtk_widget_insert_after (page->tab_widget, notebook->tabs_widget, sibling);
update_arrow_state (notebook);
gtk_notebook_update_labels (notebook);
gtk_widget_queue_allocate (notebook->tabs_widget);
}
+1 -10
View File
@@ -1995,19 +1995,10 @@ gtk_paned_set_focus_child (GtkWidget *widget,
/* If there is one or more paned widgets between us and the
* focus widget, we want the topmost of those as last_focus
*/
for (w = last_focus; w && w != GTK_WIDGET (paned); w = gtk_widget_get_parent (w))
for (w = last_focus; w != GTK_WIDGET (paned); w = gtk_widget_get_parent (w))
if (GTK_IS_PANED (w))
last_focus = w;
if (w == NULL)
{
g_warning ("Error finding last focus widget of GtkPaned %p, "
"gtk_paned_set_focus_child was called on widget %p "
"which is not child of %p.",
widget, child, widget);
return;
}
focus_child = gtk_widget_get_focus_child (widget);
if (focus_child == paned->start_child)
gtk_paned_set_last_start_child_focus (paned, last_focus);
+23 -23
View File
@@ -146,7 +146,7 @@ gtk_printer_option_widget_finalize (GObject *object)
{
GtkPrinterOptionWidget *widget = GTK_PRINTER_OPTION_WIDGET (object);
GtkPrinterOptionWidgetPrivate *priv = widget->priv;
if (priv->source)
{
g_signal_handler_disconnect (priv->source,
@@ -154,7 +154,7 @@ gtk_printer_option_widget_finalize (GObject *object)
g_object_unref (priv->source);
priv->source = NULL;
}
G_OBJECT_CLASS (gtk_printer_option_widget_parent_class)->finalize (object);
}
@@ -165,7 +165,7 @@ gtk_printer_option_widget_set_property (GObject *object,
GParamSpec *pspec)
{
GtkPrinterOptionWidget *widget;
widget = GTK_PRINTER_OPTION_WIDGET (object);
switch (prop_id)
@@ -246,7 +246,7 @@ gtk_printer_option_widget_set_source (GtkPrinterOptionWidget *widget,
if (source)
g_object_ref (source);
if (priv->source)
{
g_signal_handler_disconnect (priv->source,
@@ -672,17 +672,6 @@ dialog_response_callback (GtkDialog *dialog,
g_free (filename_short);
g_object_unref (info);
}
else
{
const char *path = g_file_peek_path (new_location);
char *filename_utf8 = g_utf8_make_valid (path, -1);
char *filename_short = trim_long_filename (filename_utf8);
gtk_button_set_label (GTK_BUTTON (priv->button), filename_short);
g_free (filename_short);
g_free (filename_utf8);
}
}
gtk_window_destroy (GTK_WINDOW (dialog));
@@ -730,7 +719,18 @@ filesave_choose_cb (GtkWidget *button,
{
priv->last_location = g_file_new_for_uri (priv->source->value);
if (priv->last_location)
gtk_file_chooser_set_file (GTK_FILE_CHOOSER (dialog), priv->last_location, NULL);
{
char *basename;
char *basename_utf8;
gtk_file_chooser_select_file (GTK_FILE_CHOOSER (dialog), priv->last_location, NULL);
basename = g_file_get_basename (priv->last_location);
basename_utf8 = g_filename_to_utf8 (basename, -1, NULL, NULL, NULL);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), basename_utf8);
g_free (basename_utf8);
g_free (basename);
}
}
g_signal_connect (dialog, "response",
@@ -760,7 +760,7 @@ filter_numeric (const char *val,
filtered_val[j] = val[i];
j++;
}
else if (allow_dec && !dec_set &&
else if (allow_dec && !dec_set &&
(val[i] == '.' || val[i] == ','))
{
/* allow one period or comma
@@ -796,7 +796,7 @@ combo_changed_cb (GtkWidget *combo,
gboolean custom = TRUE;
g_signal_handler_block (priv->source, priv->source_changed_handler);
value = combo_box_get (priv->combo, &custom);
/* Handle constraints if the user entered a custom value. */
@@ -851,7 +851,7 @@ entry_changed_cb (GtkWidget *entry,
{
GtkPrinterOptionWidgetPrivate *priv = widget->priv;
const char *value;
g_signal_handler_block (priv->source, priv->source_changed_handler);
value = gtk_editable_get_text (GTK_EDITABLE (entry));
if (value)
@@ -867,7 +867,7 @@ radio_changed_cb (GtkWidget *button,
{
GtkPrinterOptionWidgetPrivate *priv = widget->priv;
char *value;
g_signal_handler_block (priv->source, priv->source_changed_handler);
value = g_object_get_data (G_OBJECT (button), "value");
if (value)
@@ -928,9 +928,9 @@ construct_widgets (GtkPrinterOptionWidget *widget)
GtkWidget *group;
source = priv->source;
deconstruct_widgets (widget);
gtk_widget_set_sensitive (GTK_WIDGET (widget), TRUE);
if (source == NULL)
@@ -1112,7 +1112,7 @@ update_widgets (GtkPrinterOptionWidget *widget)
GtkPrinterOption *source;
source = priv->source;
if (source == NULL)
{
gtk_widget_hide (priv->image);
-9
View File
@@ -152,15 +152,6 @@ char * _gtk_elide_underscores (const char *original);
void setlocale_initialization (void);
void gtk_synthesize_crossing_events (GtkRoot *toplevel,
GtkCrossingType crossing_type,
GtkWidget *old_target,
GtkWidget *new_target,
double surface_x,
double surface_y,
GdkCrossingMode mode,
GdkDrop *drop);
G_END_DECLS
#endif /* __GTK_PRIVATE_H__ */
+11 -9
View File
@@ -2202,25 +2202,27 @@ gtk_range_scroll_controller_scroll (GtkEventControllerScroll *scroll,
GtkRange *range)
{
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
double scroll_unit, delta;
double delta;
gboolean handled;
GtkOrientation move_orientation;
#ifdef GDK_WINDOWING_MACOS
scroll_unit = 1;
#else
scroll_unit = gtk_adjustment_get_page_increment (priv->adjustment);
#endif
GdkScrollUnit scroll_unit;
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL && dx != 0)
{
move_orientation = GTK_ORIENTATION_HORIZONTAL;
delta = dx * scroll_unit;
delta = dx;
}
else
{
move_orientation = GTK_ORIENTATION_VERTICAL;
delta = dy * scroll_unit;
delta = dy;
}
scroll_unit = gtk_event_controller_scroll_get_unit (scroll);
if (scroll_unit == GDK_SCROLL_UNIT_WHEEL)
{
delta *= gtk_adjustment_get_page_increment (priv->adjustment);
}
if (delta != 0 && should_invert_move (range, move_orientation))
+86 -88
View File
@@ -54,10 +54,6 @@
#include "gtkviewport.h"
#include "gtkwidgetprivate.h"
#ifdef GDK_WINDOWING_WAYLAND
#include <gdk/wayland/gdkwayland.h>
#endif
#include <math.h>
/**
@@ -1062,6 +1058,11 @@ gtk_scrolled_window_decelerate (GtkScrolledWindow *scrolled_window,
gtk_scrolled_window_start_deceleration (scrolled_window);
priv->x_velocity = priv->y_velocity = 0;
}
else
{
g_clear_pointer (&priv->hscrolling, gtk_kinetic_scrolling_free);
g_clear_pointer (&priv->vscrolling, gtk_kinetic_scrolling_free);
}
}
static void
@@ -1232,16 +1233,14 @@ check_update_scrollbar_proximity (GtkScrolledWindow *sw,
}
static double
get_scroll_unit (GtkScrolledWindow *sw,
GtkOrientation orientation,
GtkEventControllerScroll *scroll)
get_wheel_detent_scroll_step (GtkScrolledWindow *sw,
GtkOrientation orientation)
{
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (sw);
GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (sw));
GtkScrollbar *scrollbar;
GtkAdjustment *adj;
double page_size;
double scroll_unit;
double scroll_step;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
scrollbar = GTK_SCROLLBAR (priv->hscrollbar);
@@ -1253,32 +1252,9 @@ get_scroll_unit (GtkScrolledWindow *sw,
adj = gtk_scrollbar_get_adjustment (scrollbar);
page_size = gtk_adjustment_get_page_size (adj);
scroll_unit = pow (page_size, 2.0 / 3.0);
scroll_step = pow (page_size, 2.0 / 3.0);
#ifdef GDK_WINDOWING_MACOS
{
GdkEvent *event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (scroll));
if (event != NULL &&
gdk_event_get_event_type (event) == GDK_SCROLL &&
gdk_scroll_event_get_direction (event) == GDK_SCROLL_SMOOTH)
scroll_unit = 1;
}
#endif
#ifdef GDK_WINDOWING_WAYLAND
if (GDK_IS_WAYLAND_DISPLAY (display))
{
GdkEvent *event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (scroll));
if (event != NULL &&
gdk_event_get_event_type (event) == GDK_SCROLL &&
gdk_scroll_event_get_direction (event) == GDK_SCROLL_SMOOTH)
scroll_unit = 25;
}
#endif
return scroll_unit;
return scroll_step;
}
static gboolean
@@ -1420,12 +1396,18 @@ scrolled_window_scroll (GtkScrolledWindow *scrolled_window,
{
GtkAdjustment *adj;
double new_value;
double scroll_unit;
GdkScrollUnit scroll_unit;
adj = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (priv->hscrollbar));
scroll_unit = get_scroll_unit (scrolled_window, GTK_ORIENTATION_HORIZONTAL, scroll);
scroll_unit = gtk_event_controller_scroll_get_unit (scroll);
new_value = priv->unclamped_hadj_value + delta_x * scroll_unit;
if (scroll_unit == GDK_SCROLL_UNIT_WHEEL)
{
delta_x *= get_wheel_detent_scroll_step (scrolled_window,
GTK_ORIENTATION_HORIZONTAL);
}
new_value = priv->unclamped_hadj_value + delta_x;
_gtk_scrolled_window_set_adjustment_value (scrolled_window, adj,
new_value);
}
@@ -1435,12 +1417,18 @@ scrolled_window_scroll (GtkScrolledWindow *scrolled_window,
{
GtkAdjustment *adj;
double new_value;
double scroll_unit;
GdkScrollUnit scroll_unit;
adj = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (priv->vscrollbar));
scroll_unit = get_scroll_unit (scrolled_window, GTK_ORIENTATION_VERTICAL, scroll);
scroll_unit = gtk_event_controller_scroll_get_unit (scroll);
new_value = priv->unclamped_vadj_value + delta_y * scroll_unit;
if (scroll_unit == GDK_SCROLL_UNIT_WHEEL)
{
delta_y *= get_wheel_detent_scroll_step (scrolled_window,
GTK_ORIENTATION_VERTICAL);
}
new_value = priv->unclamped_vadj_value + delta_y;
_gtk_scrolled_window_set_adjustment_value (scrolled_window, adj,
new_value);
}
@@ -1487,30 +1475,36 @@ scroll_controller_decelerate (GtkEventControllerScroll *scroll,
double initial_vel_y,
GtkScrolledWindow *scrolled_window)
{
double unit_x, unit_y;
GdkScrollUnit scroll_unit;
gboolean shifted;
GdkModifierType state;
scroll_unit = gtk_event_controller_scroll_get_unit (scroll);
state = gtk_event_controller_get_current_event_state (GTK_EVENT_CONTROLLER (scroll));
shifted = (state & GDK_SHIFT_MASK) != 0;
unit_x = get_scroll_unit (scrolled_window, GTK_ORIENTATION_HORIZONTAL, scroll);
unit_y = get_scroll_unit (scrolled_window, GTK_ORIENTATION_VERTICAL, scroll);
if (shifted)
{
gtk_scrolled_window_decelerate (scrolled_window,
initial_vel_y * unit_x,
initial_vel_x * unit_y);
double tmp;
tmp = initial_vel_x;
initial_vel_x = initial_vel_y;
initial_vel_y = tmp;
}
else
if (scroll_unit == GDK_SCROLL_UNIT_WHEEL)
{
gtk_scrolled_window_decelerate (scrolled_window,
initial_vel_x * unit_x,
initial_vel_y * unit_y);
initial_vel_x *= get_wheel_detent_scroll_step (scrolled_window,
GTK_ORIENTATION_HORIZONTAL);
initial_vel_y *= get_wheel_detent_scroll_step (scrolled_window,
GTK_ORIENTATION_VERTICAL);
}
gtk_scrolled_window_decelerate (scrolled_window,
initial_vel_x,
initial_vel_y);
}
static void
@@ -3281,6 +3275,7 @@ scrolled_window_deceleration_cb (GtkWidget *widget,
GtkAdjustment *hadjustment, *vadjustment;
gint64 current_time;
double position, elapsed;
gboolean retval = G_SOURCE_REMOVE;
current_time = gdk_frame_clock_get_frame_time (frame_clock);
elapsed = (current_time - priv->last_deceleration_time) / (double)G_TIME_SPAN_SECOND;
@@ -3296,28 +3291,23 @@ scrolled_window_deceleration_cb (GtkWidget *widget,
{
priv->unclamped_hadj_value = position;
gtk_adjustment_set_value (hadjustment, position);
retval = G_SOURCE_CONTINUE;
}
else if (priv->hscrolling)
g_clear_pointer (&priv->hscrolling, gtk_kinetic_scrolling_free);
if (priv->vscrolling &&
gtk_kinetic_scrolling_tick (priv->vscrolling, elapsed, &position, NULL))
{
priv->unclamped_vadj_value = position;
gtk_adjustment_set_value (vadjustment, position);
}
else if (priv->vscrolling)
g_clear_pointer (&priv->vscrolling, gtk_kinetic_scrolling_free);
if (!priv->hscrolling && !priv->vscrolling)
{
gtk_scrolled_window_cancel_deceleration (scrolled_window);
return G_SOURCE_REMOVE;
retval = G_SOURCE_CONTINUE;
}
gtk_scrolled_window_invalidate_overshoot (scrolled_window);
if (retval == G_SOURCE_REMOVE)
gtk_scrolled_window_cancel_deceleration (scrolled_window);
else
gtk_scrolled_window_invalidate_overshoot (scrolled_window);
return G_SOURCE_CONTINUE;
return retval;
}
static void
@@ -3381,19 +3371,23 @@ gtk_scrolled_window_start_deceleration (GtkScrolledWindow *scrolled_window)
GtkAdjustment *hadjustment;
gtk_scrolled_window_accumulate_velocity (&priv->hscrolling, elapsed, &priv->x_velocity);
g_clear_pointer (&priv->hscrolling, gtk_kinetic_scrolling_free);
hadjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (priv->hscrollbar));
lower = gtk_adjustment_get_lower (hadjustment);
upper = gtk_adjustment_get_upper (hadjustment);
upper -= gtk_adjustment_get_page_size (hadjustment);
priv->hscrolling =
gtk_kinetic_scrolling_new (lower,
upper,
MAX_OVERSHOOT_DISTANCE,
DECELERATION_FRICTION,
OVERSHOOT_FRICTION,
priv->unclamped_hadj_value,
priv->x_velocity);
if (priv->x_velocity != 0)
{
hadjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (priv->hscrollbar));
lower = gtk_adjustment_get_lower (hadjustment);
upper = gtk_adjustment_get_upper (hadjustment);
upper -= gtk_adjustment_get_page_size (hadjustment);
priv->hscrolling =
gtk_kinetic_scrolling_new (lower,
upper,
MAX_OVERSHOOT_DISTANCE,
DECELERATION_FRICTION,
OVERSHOOT_FRICTION,
priv->unclamped_hadj_value,
priv->x_velocity);
}
}
else
g_clear_pointer (&priv->hscrolling, gtk_kinetic_scrolling_free);
@@ -3404,19 +3398,23 @@ gtk_scrolled_window_start_deceleration (GtkScrolledWindow *scrolled_window)
GtkAdjustment *vadjustment;
gtk_scrolled_window_accumulate_velocity (&priv->vscrolling, elapsed, &priv->y_velocity);
g_clear_pointer (&priv->vscrolling, gtk_kinetic_scrolling_free);
vadjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (priv->vscrollbar));
lower = gtk_adjustment_get_lower(vadjustment);
upper = gtk_adjustment_get_upper(vadjustment);
upper -= gtk_adjustment_get_page_size(vadjustment);
priv->vscrolling =
gtk_kinetic_scrolling_new (lower,
upper,
MAX_OVERSHOOT_DISTANCE,
DECELERATION_FRICTION,
OVERSHOOT_FRICTION,
priv->unclamped_vadj_value,
priv->y_velocity);
if (priv->y_velocity != 0)
{
vadjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (priv->vscrollbar));
lower = gtk_adjustment_get_lower(vadjustment);
upper = gtk_adjustment_get_upper(vadjustment);
upper -= gtk_adjustment_get_page_size(vadjustment);
priv->vscrolling =
gtk_kinetic_scrolling_new (lower,
upper,
MAX_OVERSHOOT_DISTANCE,
DECELERATION_FRICTION,
OVERSHOOT_FRICTION,
priv->unclamped_vadj_value,
priv->y_velocity);
}
}
else
g_clear_pointer (&priv->vscrolling, gtk_kinetic_scrolling_free);
+78 -6
View File
@@ -106,6 +106,7 @@ enum {
PROP_0,
PROP_PLACEHOLDER_TEXT,
PROP_ACTIVATES_DEFAULT,
PROP_SEARCH_DELAY,
NUM_PROPERTIES,
};
@@ -122,6 +123,8 @@ struct _GtkSearchEntry
GtkWidget *capture_widget;
GtkEventController *capture_widget_controller;
guint search_delay;
GtkWidget *entry;
GtkWidget *icon;
@@ -150,9 +153,6 @@ G_DEFINE_TYPE_WITH_CODE (GtkSearchEntry, gtk_search_entry, GTK_TYPE_WIDGET,
G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE,
gtk_search_entry_editable_init))
/* 150 mseconds of delay */
#define DELAYED_TIMEOUT_ID 150
static void
text_changed (GtkSearchEntry *entry)
{
@@ -224,6 +224,10 @@ gtk_search_entry_set_property (GObject *object,
}
break;
case PROP_SEARCH_DELAY:
gtk_search_entry_set_search_delay (entry, g_value_get_uint (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -250,6 +254,10 @@ gtk_search_entry_get_property (GObject *object,
g_value_set_boolean (value, gtk_text_get_activates_default (GTK_TEXT (entry->entry)));
break;
case PROP_SEARCH_DELAY:
g_value_set_uint (value, entry->search_delay);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -315,6 +323,21 @@ gtk_search_entry_class_init (GtkSearchEntryClass *klass)
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkSearchEntry:search-delay:
*
* The delay in milliseconds from last keypress to the search
* changed signal.
*
* Since: 4.8
*/
props[PROP_SEARCH_DELAY] =
g_param_spec_uint ("search-delay",
P_("Search delay"),
P_("The delay from last keypress to the search-changed signal. If this is not set, it defaults to 150ms"),
0, G_MAXUINT, 150,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (object_class, NUM_PROPERTIES, props);
gtk_editable_install_properties (object_class, NUM_PROPERTIES);
@@ -339,8 +362,9 @@ gtk_search_entry_class_init (GtkSearchEntryClass *klass)
* GtkSearchEntry::search-changed:
* @entry: the entry on which the signal was emitted
*
* Emitted with a short delay of 150 milliseconds after the
* last change to the entry text.
* Emitted with a delay. The length of the delay can be
* changed with the [property@Gtk.SearchEntry:search-delay]
* property.
*/
signals[SEARCH_CHANGED] =
g_signal_new (I_("search-changed"),
@@ -526,7 +550,7 @@ reset_timeout (GtkSearchEntry *entry)
{
if (entry->delayed_changed_id > 0)
g_source_remove (entry->delayed_changed_id);
entry->delayed_changed_id = g_timeout_add (DELAYED_TIMEOUT_ID,
entry->delayed_changed_id = g_timeout_add (entry->search_delay,
gtk_search_entry_changed_timeout_cb,
entry);
gdk_source_set_static_name_by_id (entry->delayed_changed_id, "[gtk] gtk_search_entry_changed_timeout_cb");
@@ -595,6 +619,8 @@ gtk_search_entry_init (GtkSearchEntry *entry)
GtkWidget *icon;
GtkGesture *press, *catchall;
entry->search_delay = 150;
/* The search icon is purely presentational */
icon = g_object_new (GTK_TYPE_IMAGE,
"accessible-role", GTK_ACCESSIBLE_ROLE_PRESENTATION,
@@ -773,6 +799,52 @@ gtk_search_entry_get_key_capture_widget (GtkSearchEntry *entry)
return entry->capture_widget;
}
/**
* gtk_search_entry_set_search_delay:
* @entry: a `GtkSearchEntry`
* @delay: a delay in milliseconds
*
* Set the delay to be used between the last keypress and the
* [signal@Gtk.SearchEntry::search-changed] signal being emitted.
*
* Since: 4.8
*/
void
gtk_search_entry_set_search_delay (GtkSearchEntry *entry,
guint delay)
{
g_return_if_fail (GTK_IS_SEARCH_ENTRY (entry));
if (entry->search_delay == delay)
return;
entry->search_delay = delay;
/* Apply the updated timeout */
reset_timeout (entry);
g_object_notify_by_pspec (G_OBJECT (entry), props[PROP_SEARCH_DELAY]);
}
/**
* gtk_search_entry_get_search_delay
* @entry: a `GtkSearchEntry`
*
* Get the delay to be used between the last keypress and the
* [signal@Gtk.SearchEntry::search-changed] signal being emitted.
*
* Returns: a delay in milliseconds.
*
* Since: 4.8
*/
guint
gtk_search_entry_get_search_delay (GtkSearchEntry *entry)
{
g_return_val_if_fail (GTK_IS_SEARCH_ENTRY (entry), 0);
return entry->search_delay;
}
GtkEventController *
gtk_search_entry_get_key_controller (GtkSearchEntry *entry)
{
+5
View File
@@ -54,6 +54,11 @@ void gtk_search_entry_set_key_capture_widget (GtkSearchEntry *entry,
GDK_AVAILABLE_IN_ALL
GtkWidget* gtk_search_entry_get_key_capture_widget (GtkSearchEntry *entry);
GDK_AVAILABLE_IN_4_8
void gtk_search_entry_set_search_delay (GtkSearchEntry *entry,
guint delay);
GDK_AVAILABLE_IN_4_8
guint gtk_search_entry_get_search_delay (GtkSearchEntry *entry);
G_END_DECLS
+3 -1
View File
@@ -127,7 +127,9 @@ gtk_show_uri_full (GtkWindow *parent,
data->task = g_task_new (parent, cancellable, callback, user_data);
g_task_set_source_tag (data->task, gtk_show_uri);
if (!parent || !gtk_window_export_handle (parent, window_handle_exported, data))
if (parent)
gtk_window_export_handle (parent, window_handle_exported, data);
else
window_handle_exported (parent, NULL, data);
}
+22 -20
View File
@@ -163,10 +163,7 @@ gtk_snapshot_dispose (GObject *object)
GtkSnapshot *snapshot = GTK_SNAPSHOT (object);
if (!gtk_snapshot_states_is_empty (&snapshot->state_stack))
{
GskRenderNode *node = gtk_snapshot_to_node (snapshot);
g_clear_pointer (&node, gsk_render_node_unref);
}
gsk_render_node_unref (gtk_snapshot_to_node (snapshot));
g_assert (gtk_snapshot_states_is_empty (&snapshot->state_stack));
g_assert (gtk_snapshot_nodes_is_empty (&snapshot->nodes));
@@ -182,6 +179,11 @@ gtk_snapshot_class_init (GtkSnapshotClass *klass)
gobject_class->dispose = gtk_snapshot_dispose;
}
static void
gtk_snapshot_init (GtkSnapshot *self)
{
}
static GskRenderNode *
gtk_snapshot_collect_default (GtkSnapshot *snapshot,
GtkSnapshotState *state,
@@ -268,18 +270,6 @@ gtk_snapshot_state_clear (GtkSnapshotState *state)
gsk_transform_unref (state->transform);
}
static void
gtk_snapshot_init (GtkSnapshot *self)
{
gtk_snapshot_states_init (&self->state_stack);
gtk_snapshot_nodes_init (&self->nodes);
gtk_snapshot_push_state (self,
NULL,
gtk_snapshot_collect_default,
NULL);
}
/**
* gtk_snapshot_new:
*
@@ -290,7 +280,19 @@ gtk_snapshot_init (GtkSnapshot *self)
GtkSnapshot *
gtk_snapshot_new (void)
{
return g_object_new (GTK_TYPE_SNAPSHOT, NULL);
GtkSnapshot *snapshot;
snapshot = g_object_new (GTK_TYPE_SNAPSHOT, NULL);
gtk_snapshot_states_init (&snapshot->state_stack);
gtk_snapshot_nodes_init (&snapshot->nodes);
gtk_snapshot_push_state (snapshot,
NULL,
gtk_snapshot_collect_default,
NULL);
return snapshot;
}
/**
@@ -759,7 +761,7 @@ gtk_snapshot_ensure_translate (GtkSnapshot *snapshot,
gtk_snapshot_autopush_transform (snapshot);
state = gtk_snapshot_get_current_state (snapshot);
}
gsk_transform_to_translate (state->transform, dx, dy);
}
@@ -848,7 +850,7 @@ gtk_snapshot_push_clip (GtkSnapshot *snapshot,
{
GtkSnapshotState *state;
float scale_x, scale_y, dx, dy;
gtk_snapshot_ensure_affine (snapshot, &scale_x, &scale_y, &dx, &dy);
state = gtk_snapshot_push_state (snapshot,
@@ -2515,7 +2517,7 @@ gtk_snapshot_append_border (GtkSnapshot *snapshot,
gsk_rounded_rect_scale_affine (&real_outline, outline, scale_x, scale_y, dx, dy);
node = gsk_border_node_new (&real_outline,
(float[4]) {
(float[4]) {
border_width[0] * scale_y,
border_width[1] * scale_x,
border_width[2] * scale_y,
+3 -5
View File
@@ -1638,11 +1638,9 @@ gtk_stack_remove (GtkStack *stack,
* @stack: a `GtkStack`
* @child: a child of @stack
*
* Retrieves the stack page for the given @child.
* Returns the `GtkStackPage` object for @child.
*
* If the given @child is not a child widget of the stack, this function will return `NULL`.
*
* Returns: (transfer none) (nullable): the stack page object
* Returns: (transfer none): the `GtkStackPage` for @child
*/
GtkStackPage *
gtk_stack_get_page (GtkStack *stack,
@@ -2585,7 +2583,7 @@ gtk_stack_measure (GtkWidget *widget,
int min_for_size;
gtk_widget_measure (child, OPPOSITE_ORIENTATION (orientation), -1, &min_for_size, NULL, NULL, NULL);
gtk_widget_measure (child, orientation, MAX (min_for_size, for_size), &child_min, &child_nat, NULL, NULL);
}
else
-7
View File
@@ -34,8 +34,6 @@
#include "gtkwidgetprivate.h"
#include "gtkintl.h"
#include <glib/gi18n-lib.h>
/**
* GtkStackSidebar:
*
@@ -150,11 +148,6 @@ gtk_stack_sidebar_init (GtkStackSidebar *self)
self->list = GTK_LIST_BOX (gtk_list_box_new ());
gtk_widget_add_css_class (GTK_WIDGET (self->list), "navigation-sidebar");
gtk_accessible_update_property (GTK_ACCESSIBLE (self->list),
GTK_ACCESSIBLE_PROPERTY_LABEL,
C_("accessibility", "Sidebar"),
-1);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), GTK_WIDGET (self->list));
+18 -31
View File
@@ -1523,13 +1523,13 @@ gtk_text_class_init (GtkTextClass *class)
NULL);
/* Emoji */
gtk_widget_class_add_binding_action (widget_class,
gtk_widget_class_add_binding_signal (widget_class,
GDK_KEY_period, GDK_CONTROL_MASK,
"misc.insert-emoji",
"insert-emoji",
NULL);
gtk_widget_class_add_binding_action (widget_class,
gtk_widget_class_add_binding_signal (widget_class,
GDK_KEY_semicolon, GDK_CONTROL_MASK,
"misc.insert-emoji",
"insert-emoji",
NULL);
/* Undo/Redo */
@@ -3808,6 +3808,8 @@ gtk_text_move_cursor (GtkText *self,
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
int new_pos = priv->current_pos;
gtk_text_reset_im_context (self);
if (priv->current_pos != priv->selection_bound && !extend_selection)
{
/* If we have a current selection and aren't extending it, move to the
@@ -3934,9 +3936,6 @@ gtk_text_move_cursor (GtkText *self,
gtk_text_set_selection_bounds (self, new_pos, new_pos);
gtk_text_pend_cursor_blink (self);
priv->need_im_reset = TRUE;
gtk_text_reset_im_context (self);
}
static void
@@ -3964,6 +3963,8 @@ gtk_text_delete_from_cursor (GtkText *self,
int end_pos = priv->current_pos;
int old_n_bytes = gtk_entry_buffer_get_bytes (get_buffer (self));
gtk_text_reset_im_context (self);
if (!priv->editable)
{
gtk_widget_error_bell (GTK_WIDGET (self));
@@ -3973,8 +3974,6 @@ gtk_text_delete_from_cursor (GtkText *self,
if (priv->selection_bound != priv->current_pos)
{
gtk_text_delete_selection (self);
gtk_text_schedule_im_reset (self);
gtk_text_reset_im_context (self);
return;
}
@@ -4039,11 +4038,6 @@ gtk_text_delete_from_cursor (GtkText *self,
if (gtk_entry_buffer_get_bytes (get_buffer (self)) == old_n_bytes)
gtk_widget_error_bell (GTK_WIDGET (self));
else
{
gtk_text_schedule_im_reset (self);
gtk_text_reset_im_context (self);
}
gtk_text_pend_cursor_blink (self);
}
@@ -4054,6 +4048,8 @@ gtk_text_backspace (GtkText *self)
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
int prev_pos;
gtk_text_reset_im_context (self);
if (!priv->editable)
{
gtk_widget_error_bell (GTK_WIDGET (self));
@@ -4063,8 +4059,6 @@ gtk_text_backspace (GtkText *self)
if (priv->selection_bound != priv->current_pos)
{
gtk_text_delete_selection (self);
gtk_text_schedule_im_reset (self);
gtk_text_reset_im_context (self);
return;
}
@@ -4109,9 +4103,6 @@ gtk_text_backspace (GtkText *self)
{
gtk_editable_delete_text (GTK_EDITABLE (self), prev_pos, priv->current_pos);
}
gtk_text_schedule_im_reset (self);
gtk_text_reset_im_context (self);
}
else
{
@@ -4332,11 +4323,9 @@ gtk_text_delete_surrounding_cb (GtkIMContext *context,
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
if (priv->editable)
{
gtk_editable_delete_text (GTK_EDITABLE (self),
priv->current_pos + offset,
priv->current_pos + offset + n_chars);
}
gtk_editable_delete_text (GTK_EDITABLE (self),
priv->current_pos + offset,
priv->current_pos + offset + n_chars);
return TRUE;
}
@@ -4351,8 +4340,10 @@ gtk_text_enter_text (GtkText *self,
{
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
int tmp_pos;
gboolean old_need_im_reset;
guint text_length;
old_need_im_reset = priv->need_im_reset;
priv->need_im_reset = FALSE;
if (priv->selection_bound != priv->current_pos)
@@ -4370,6 +4361,8 @@ gtk_text_enter_text (GtkText *self,
tmp_pos = priv->current_pos;
gtk_editable_insert_text (GTK_EDITABLE (self), str, strlen (str), &tmp_pos);
gtk_text_set_selection_bounds (self, tmp_pos, tmp_pos);
priv->need_im_reset = old_need_im_reset;
}
/* All changes to priv->current_pos and priv->selection_bound
@@ -6578,13 +6571,7 @@ blink_cb (GtkWidget *widget,
return G_SOURCE_REMOVE;
}
if (priv->selection_bound != priv->current_pos)
{
g_warning ("GtkText - unexpected blinking selection. Removing");
gtk_text_check_cursor_blink (self);
return G_SOURCE_REMOVE;
}
g_assert (priv->selection_bound == priv->current_pos);
blink_timeout = get_cursor_blink_timeout (self);
blink_time = get_cursor_time (self);
+18 -20
View File
@@ -5516,8 +5516,17 @@ gtk_text_view_key_controller_im_update (GtkEventControllerKey *controller,
GtkTextView *text_view)
{
GtkTextViewPrivate *priv = text_view->priv;
GtkTextMark *insert;
GtkTextIter iter;
gboolean can_insert;
insert = gtk_text_buffer_get_insert (get_buffer (text_view));
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, insert);
can_insert = gtk_text_iter_can_insert (&iter, priv->editable);
priv->need_im_reset = TRUE;
if (!can_insert)
gtk_text_view_reset_im_context (text_view);
}
static gboolean
@@ -6349,6 +6358,8 @@ gtk_text_view_move_cursor (GtkTextView *text_view,
return;
}
gtk_text_view_reset_im_context (text_view);
if (step == GTK_MOVEMENT_PAGES)
{
if (!gtk_text_view_scroll_pages (text_view, count, extend_selection))
@@ -6532,9 +6543,6 @@ gtk_text_view_move_cursor (GtkTextView *text_view,
gtk_text_view_check_cursor_blink (text_view);
gtk_text_view_pend_cursor_blink (text_view);
priv->need_im_reset = TRUE;
gtk_text_view_reset_im_context (text_view);
}
static void
@@ -6825,16 +6833,14 @@ gtk_text_view_delete_from_cursor (GtkTextView *text_view,
priv = text_view->priv;
gtk_text_view_reset_im_context (text_view);
if (type == GTK_DELETE_CHARS)
{
/* Char delete deletes the selection, if one exists */
if (gtk_text_buffer_delete_selection (get_buffer (text_view), TRUE,
priv->editable))
{
priv->need_im_reset = TRUE;
gtk_text_view_reset_im_context (text_view);
return;
}
return;
}
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &insert,
@@ -6961,9 +6967,6 @@ gtk_text_view_delete_from_cursor (GtkTextView *text_view,
{
gtk_widget_error_bell (GTK_WIDGET (text_view));
}
priv->need_im_reset = TRUE;
gtk_text_view_reset_im_context (text_view);
}
static void
@@ -6974,14 +6977,12 @@ gtk_text_view_backspace (GtkTextView *text_view)
priv = text_view->priv;
gtk_text_view_reset_im_context (text_view);
/* Backspace deletes the selection, if one exists */
if (gtk_text_buffer_delete_selection (get_buffer (text_view), TRUE,
priv->editable))
{
priv->need_im_reset = TRUE;
gtk_text_view_reset_im_context (text_view);
return;
}
return;
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view),
&insert,
@@ -6994,9 +6995,6 @@ gtk_text_view_backspace (GtkTextView *text_view)
DV(g_print (G_STRLOC": scrolling onscreen\n"));
gtk_text_view_scroll_mark_onscreen (text_view,
gtk_text_buffer_get_insert (get_buffer (text_view)));
priv->need_im_reset = TRUE;
gtk_text_view_reset_im_context (text_view);
}
else
{
@@ -8687,7 +8685,7 @@ gtk_text_view_delete_surrounding_handler (GtkIMContext *context,
gtk_text_iter_forward_chars (&end, offset + n_chars);
gtk_text_buffer_delete_interactive (priv->buffer, &start, &end,
priv->editable);
priv->editable);
return TRUE;
}
+11 -16
View File
@@ -436,20 +436,6 @@ gtk_tree_list_model_items_changed_cb (GListModel *model,
static void gtk_tree_list_row_destroy (GtkTreeListRow *row);
static void
gtk_tree_list_model_clear_node_children (TreeNode *node)
{
if (node->model)
{
g_signal_handlers_disconnect_by_func (node->model,
gtk_tree_list_model_items_changed_cb,
node);
g_clear_object (&node->model);
}
g_clear_pointer (&node->children, gtk_rb_tree_unref);
}
static void
gtk_tree_list_model_clear_node (gpointer data)
{
@@ -458,7 +444,15 @@ gtk_tree_list_model_clear_node (gpointer data)
if (node->row)
gtk_tree_list_row_destroy (node->row);
gtk_tree_list_model_clear_node_children (node);
if (node->model)
{
g_signal_handlers_disconnect_by_func (node->model,
gtk_tree_list_model_items_changed_cb,
node);
g_object_unref (node->model);
}
if (node->children)
gtk_rb_tree_unref (node->children);
}
static void
@@ -553,7 +547,8 @@ gtk_tree_list_model_collapse_node (GtkTreeListModel *self,
n_items = tree_node_get_n_children (node);
gtk_tree_list_model_clear_node_children (node);
g_clear_pointer (&node->children, gtk_rb_tree_unref);
g_clear_object (&node->model);
tree_node_mark_dirty (node);
+6 -24
View File
@@ -30,8 +30,6 @@
#include "gtkgizmoprivate.h"
#include "gtkwidgetprivate.h"
#include "gtkbuiltiniconprivate.h"
#include "gtkscrolledwindow.h"
#include "gtkviewport.h"
// TODO
// positioning + sizing
@@ -228,22 +226,12 @@ gtk_tree_popover_class_init (GtkTreePopoverClass *class)
G_TYPE_NONE, 1, G_TYPE_STRING);
}
static GtkWidget *
gtk_tree_popover_get_stack (GtkTreePopover *popover)
{
GtkWidget *sw = gtk_popover_get_child (GTK_POPOVER (popover));
GtkWidget *vp = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (sw));
GtkWidget *stack = gtk_viewport_get_child (GTK_VIEWPORT (vp));
return stack;
}
static void
gtk_tree_popover_add_submenu (GtkTreePopover *popover,
GtkWidget *submenu,
const char *name)
{
GtkWidget *stack = gtk_tree_popover_get_stack (popover);
GtkWidget *stack = gtk_popover_get_child (GTK_POPOVER (popover));
gtk_stack_add_named (GTK_STACK (stack), submenu, name);
}
@@ -251,7 +239,7 @@ static GtkWidget *
gtk_tree_popover_get_submenu (GtkTreePopover *popover,
const char *name)
{
GtkWidget *stack = gtk_tree_popover_get_stack (popover);
GtkWidget *stack = gtk_popover_get_child (GTK_POPOVER (popover));
return gtk_stack_get_child_by_name (GTK_STACK (stack), name);
}
@@ -259,26 +247,20 @@ void
gtk_tree_popover_open_submenu (GtkTreePopover *popover,
const char *name)
{
GtkWidget *stack = gtk_tree_popover_get_stack (popover);
GtkWidget *stack = gtk_popover_get_child (GTK_POPOVER (popover));
gtk_stack_set_visible_child_name (GTK_STACK (stack), name);
}
static void
gtk_tree_popover_init (GtkTreePopover *popover)
{
GtkWidget *sw;
GtkWidget *stack;
sw = gtk_scrolled_window_new ();
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_propagate_natural_height (GTK_SCROLLED_WINDOW (sw), TRUE);
gtk_popover_set_child (GTK_POPOVER (popover), sw);
stack = gtk_stack_new ();
gtk_stack_set_vhomogeneous (GTK_STACK (stack), FALSE);
gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT);
gtk_stack_set_interpolate_size (GTK_STACK (stack), TRUE);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), stack);
gtk_popover_set_child (GTK_POPOVER (popover), stack);
gtk_widget_add_css_class (GTK_WIDGET (popover), "menu");
}
@@ -483,7 +465,7 @@ static GtkWidget *
gtk_tree_popover_get_path_item (GtkTreePopover *popover,
GtkTreePath *search)
{
GtkWidget *stack = gtk_tree_popover_get_stack (popover);
GtkWidget *stack = gtk_popover_get_child (GTK_POPOVER (popover));
GtkWidget *item = NULL;
GtkWidget *stackchild;
GtkWidget *child;
@@ -797,7 +779,7 @@ rebuild_menu (GtkTreePopover *popover)
GtkWidget *stack;
GtkWidget *child;
stack = gtk_tree_popover_get_stack (popover);
stack = gtk_popover_get_child (GTK_POPOVER (popover));
while ((child = gtk_widget_get_first_child (stack)))
gtk_stack_remove (GTK_STACK (stack), child);
+44 -55
View File
@@ -2770,13 +2770,6 @@ gtk_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
gboolean rtl;
GtkWidget *target;
gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, x, y,
&bin_x, &bin_y);
/* Are we clicking a column header? */
if (bin_y < 0)
return;
/* check if this is a click in a child widget */
target = gtk_event_controller_get_target (GTK_EVENT_CONTROLLER (gesture));
if (gtk_widget_is_ancestor (target, widget))
@@ -2792,6 +2785,13 @@ gtk_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
return;
}
/* Because grab_focus can cause reentrancy, we delay grab_focus until after
* we're done handling the button press.
*/
gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, x, y,
&bin_x, &bin_y);
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
if (n_press > 1)
gtk_gesture_set_state (priv->drag_gesture,
GTK_EVENT_SEQUENCE_DENIED);
@@ -2819,7 +2819,6 @@ gtk_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
}
grab_focus_and_unset_draw_keyfocus (tree_view);
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
return;
}
@@ -2868,8 +2867,8 @@ gtk_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
continue;
background_area.width = gtk_tree_view_column_get_width (candidate);
if ((background_area.x > x) ||
(background_area.x + background_area.width <= x))
if ((background_area.x > bin_x) ||
(background_area.x + background_area.width <= bin_x))
{
background_area.x += background_area.width;
continue;
@@ -2943,7 +2942,6 @@ gtk_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
{
GtkCellArea *area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (column));
cell_editable = gtk_cell_area_get_edit_widget (area);
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
if (cell_editable != NULL)
{
@@ -2976,7 +2974,7 @@ gtk_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
focus_cell = _gtk_tree_view_column_get_cell_at_pos (column,
&cell_area,
&background_area,
x, y);
bin_x, bin_y);
if (focus_cell)
gtk_tree_view_column_focus_cell (column, focus_cell);
@@ -3001,10 +2999,7 @@ gtk_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
}
if (button == GDK_BUTTON_PRIMARY && n_press == 2)
{
gtk_tree_view_row_activated (tree_view, path, column);
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
}
gtk_tree_view_row_activated (tree_view, path, column);
else
{
if (n_press == 1)
@@ -3041,11 +3036,6 @@ gtk_tree_view_drag_gesture_begin (GtkGestureDrag *gesture,
gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, start_x, start_y,
&bin_x, &bin_y);
/* Are we dragging a column header? */
if (bin_y < 0)
return;
priv->press_start_x = priv->rubber_band_x = bin_x;
priv->press_start_y = priv->rubber_band_y = bin_y;
gtk_tree_rbtree_find_offset (priv->tree, bin_y + priv->dy,
@@ -6530,9 +6520,6 @@ gtk_tree_view_top_row_to_dy (GtkTreeView *tree_view)
if (priv->in_top_row_to_dy)
return;
if (gtk_adjustment_is_animating (priv->vadjustment))
return;
if (priv->top_row)
path = gtk_tree_row_reference_get_path (priv->top_row);
else
@@ -6858,36 +6845,9 @@ scroll_row_timeout (gpointer data)
return TRUE;
}
static GdkDragAction
gtk_tree_view_get_action (GtkWidget *widget,
GdkDrop *drop)
{
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
TreeViewDragInfo *di;
GdkDrag *drag = gdk_drop_get_drag (drop);
GdkDragAction actions;
di = get_info (tree_view);
actions = gdk_drop_get_actions (drop);
if (di && di->drag == drag &&
actions & GDK_ACTION_MOVE)
return GDK_ACTION_MOVE;
if (actions & GDK_ACTION_COPY)
return GDK_ACTION_COPY;
if (actions & GDK_ACTION_MOVE)
return GDK_ACTION_MOVE;
return 0;
}
/* Returns TRUE if event should not be propagated to parent widgets */
static gboolean
set_destination_row (GtkTreeView *tree_view,
GdkDrop *drop,
GtkDropTargetAsync *dest,
/* coordinates relative to the widget */
int x,
@@ -6993,7 +6953,7 @@ set_destination_row (GtkTreeView *tree_view,
out:
if (can_drop)
{
*suggested_action = gtk_tree_view_get_action (widget, drop);
*suggested_action = GDK_ACTION_COPY | GDK_ACTION_MOVE;
gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget),
path, pos);
@@ -7258,7 +7218,7 @@ gtk_tree_view_drag_motion (GtkDropTargetAsync *dest,
GdkDragAction suggested_action = 0;
GType target;
if (!set_destination_row (tree_view, drop, dest, x, y, &suggested_action, &target))
if (!set_destination_row (tree_view, dest, x, y, &suggested_action, &target))
return 0;
priv->event_last_x = x;
@@ -7338,7 +7298,7 @@ gtk_tree_view_drag_drop (GtkDropTargetAsync *dest,
if (!check_model_dnd (model, GTK_TYPE_TREE_DRAG_DEST, "drag_drop"))
return FALSE;
if (!set_destination_row (tree_view, drop, dest, x, y, &suggested_action, &target))
if (!set_destination_row (tree_view, dest, x, y, &suggested_action, &target))
return FALSE;
path = get_logical_dest_row (tree_view, &path_down_mode, &drop_append_mode);
@@ -7371,6 +7331,32 @@ gtk_tree_view_drag_drop (GtkDropTargetAsync *dest,
return FALSE;
}
static GdkDragAction
gtk_tree_view_get_action (GtkWidget *widget,
GdkDrop *drop)
{
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
TreeViewDragInfo *di;
GdkDrag *drag = gdk_drop_get_drag (drop);
GdkDragAction actions;
di = get_info (tree_view);
actions = gdk_drop_get_actions (drop);
if (di && di->drag == drag &&
actions & GDK_ACTION_MOVE)
return GDK_ACTION_MOVE;
if (actions & GDK_ACTION_COPY)
return GDK_ACTION_COPY;
if (actions & GDK_ACTION_MOVE)
return GDK_ACTION_MOVE;
return 0;
}
static void
gtk_tree_view_drag_data_received (GObject *source,
GAsyncResult *result,
@@ -10127,7 +10113,10 @@ gtk_tree_view_real_start_interactive_search (GtkTreeView *tree_view,
gtk_editable_set_text (GTK_EDITABLE (priv->search_entry), "");
/* Grab focus without selecting all the text. */
gtk_text_grab_focus_without_selecting (GTK_TEXT (priv->search_entry));
if (GTK_IS_ENTRY (priv->search_entry))
gtk_entry_grab_focus_without_selecting (GTK_ENTRY (priv->search_entry));
else
gtk_widget_grab_focus (priv->search_entry);
gtk_popover_popup (GTK_POPOVER (priv->search_popover));
if (priv->search_entry_changed_id == 0)
+8 -50
View File
@@ -180,7 +180,6 @@ typedef struct
GtkWidget *default_widget;
GtkWidget *focus_widget;
GtkWidget *move_focus_widget;
GtkWindow *transient_parent;
GtkWindowGeometryInfo *geometry_info;
GtkWindowGroup *group;
@@ -2048,12 +2047,7 @@ gtk_window_root_set_focus (GtkRoot *root,
if (focus == priv->focus_widget)
{
if (priv->move_focus &&
focus && gtk_widget_is_visible (focus))
{
priv->move_focus = FALSE;
g_clear_object (&priv->move_focus_widget);
}
priv->move_focus = FALSE;
return;
}
@@ -2073,12 +2067,7 @@ gtk_window_root_set_focus (GtkRoot *root,
g_clear_object (&old_focus);
if (priv->move_focus &&
focus && gtk_widget_is_visible (focus))
{
priv->move_focus = FALSE;
g_clear_object (&priv->move_focus_widget);
}
priv->move_focus = FALSE;
g_object_notify (G_OBJECT (self), "focus-widget");
}
@@ -2602,7 +2591,6 @@ gtk_window_dispose (GObject *object)
g_list_free_full (priv->foci, (GDestroyNotify) gtk_pointer_focus_unref);
priv->foci = NULL;
g_clear_object (&priv->move_focus_widget);
gtk_window_set_focus (window, NULL);
gtk_window_set_default_widget (window, NULL);
@@ -4731,25 +4719,7 @@ maybe_unset_focus_and_default (GtkWindow *window)
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
if (priv->move_focus)
{
GtkWidget *parent;
parent = _gtk_widget_get_parent (priv->move_focus_widget);
while (parent)
{
if (_gtk_widget_get_visible (parent))
{
if (gtk_widget_grab_focus (parent))
break;
}
parent = _gtk_widget_get_parent (parent);
}
priv->move_focus = FALSE;
g_clear_object (&priv->move_focus_widget);
}
gtk_widget_child_focus (GTK_WIDGET (window), GTK_DIR_TAB_FORWARD);
if (priv->unset_default)
gtk_window_set_default_widget (window, NULL);
@@ -5042,9 +5012,6 @@ synthesize_focus_change_events (GtkWindow *window,
GtkWidget *prev;
gboolean seen_ancestor;
if (old_focus == new_focus)
return;
if (old_focus && new_focus)
ancestor = gtk_widget_common_ancestor (old_focus, new_focus);
else
@@ -5208,10 +5175,7 @@ _gtk_window_unset_focus_and_default (GtkWindow *window,
child = priv->focus_widget;
if (child && (child == widget || gtk_widget_is_ancestor (child, widget)))
{
priv->move_focus_widget = g_object_ref (widget);
priv->move_focus = TRUE;
}
priv->move_focus = TRUE;
child = priv->default_widget;
if (child && (child == widget || gtk_widget_is_ancestor (child, widget)))
@@ -6367,6 +6331,10 @@ gtk_window_unexport_handle (GtkWindow *window)
return;
}
#endif
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (gtk_widget_get_display (GTK_WIDGET (window))))
return;
#endif
g_warning ("Couldn't unexport handle for %s surface, unsupported windowing system",
G_OBJECT_TYPE_NAME (priv->surface));
@@ -6498,17 +6466,7 @@ gtk_window_update_pointer_focus_on_state_change (GtkWindow *window,
else if (focus->target == widget ||
gtk_widget_is_ancestor (focus->target, widget))
{
GtkWidget *old_target;
old_target = g_object_ref (focus->target);
gtk_pointer_focus_repick_target (focus);
gtk_synthesize_crossing_events (GTK_ROOT (window),
GTK_CROSSING_POINTER,
old_target, focus->target,
focus->x, focus->y,
GDK_CROSSING_NORMAL,
NULL);
g_object_unref (old_target);
}
gtk_pointer_focus_unref (focus);
Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

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