Commit Graph

71833 Commits

Author SHA1 Message Date
Ivan Molodetskikh
7ef54e9c53 picture: Return natural size 0 for size 0
It was returning the full natural size (same as -1) due to default value
handling in the code below.

Tests have been updated to match this output.
2021-12-08 19:20:24 +01:00
Matthias Clasen
12bb700c62 Merge branch 'wip/chergert/fix-recursive-action-muxer' into 'main'
actionmuxer: avoid duplicate and recursive work

Closes #4422, #4519, and gnome-text-editor#220

See merge request GNOME/gtk!4223
2021-12-08 10:47:40 +00:00
Matthias Clasen
e3ba7250f1 Merge branch 'wip/chergert/layout-marshaller' into 'main'
surface: add missing va_marshaller for layout signal

See merge request GNOME/gtk!4221
2021-12-08 10:46:35 +00:00
Matthias Clasen
54842095c3 Merge branch 'wip/chergert/reduce-action-muxer-allocations' into 'main'
menutracker: reduce allocations and signal emission

See merge request GNOME/gtk!4222
2021-12-08 10:45:56 +00:00
Christian Hergert
d1aec0c3f1 actionmuxer: avoid duplicate and recursive work
If we've already done the tracking into the parent muxer, there is no need
to do it again. This can save a great deal of recursive work when adding
items to the muxer.

This makes showing the context menu in gnome-text-editor repeatedly fast
even as spelling corrections are changed.

It is likely that this could fix #4422 as well.

Fixes #4519
Fixes https://gitlab.gnome.org/GNOME/gnome-text-editor/-/issues/220
2021-12-08 00:32:36 -08:00
Christian Hergert
00d5f72d6e menutracker: reduce allocations and signal emission
When handling action-added callbacks the code was previously using a
freeze_notify/thaw_notify in all cases. This turns out to allocate a
significant amount of memory when called a lot.

That said, it shouldn't be getting called this much but given the current
state of affairs elsewhere in GtkActionMuxer, this brought temporary
allocations down from 9MiB to 9KiB in gnome-text-editor after showing
the context menu a few times.

Related #4422
2021-12-07 22:42:04 -08:00
Christian Hergert
15d01d4315 surface: add missing va_marshaller for layout signal
I saw this coming across through a ffi boundary in Sysprof, and we wanted
to keep most things within GDK using native marshalling to improve
profiler results when frame pointers are not used.
2021-12-07 22:21:19 -08:00
Benjamin Otte
348e34f221 Merge branch 'wip/otte/viewport' into 'main'
viewport: Handle things differently

See merge request GNOME/gtk!4220
2021-12-07 23:31:06 +00:00
Benjamin Otte
ce7b0656c0 viewport: Allocate properly
Instead of allocation width for height for width for height or whatever
that code was doing, actually allocate the size we were given or the
requested size, whatever is larger.
2021-12-08 00:12:35 +01:00
Benjamin Otte
fd0d360f9b Revert "viewport: Actually report the size we're gonna allocate"
This reverts commit b8468af411.
2021-12-07 23:52:21 +01:00
Benjamin Otte
f26cae3838 Merge branch 'wip/otte/viewport' into 'main'
viewport: Use array for member variables

See merge request GNOME/gtk!4219
2021-12-07 21:19:58 +00:00
Benjamin Otte
b8468af411 viewport: Actually report the size we're gonna allocate
Don't just pass on measure() calls, but actually behave in the way we
behave during size allocate.

This should improve cases where GtkScrolledWindow is used with GTK_POLICY_NEVER.
2021-12-07 21:58:42 +01:00
Benjamin Otte
9fd7e319f3 viewport: Use array for member variables
That way we can index them by orientation in future commits.
2021-12-07 21:58:42 +01:00
Benjamin Otte
80a8b59f24 Merge branch 'wip/otte/for-main' into 'main'
gtktypes: GTK_INVALID_LIST_POSITION should be an int

See merge request GNOME/gtk!4218
2021-12-07 15:30:48 +00:00
Benjamin Otte
b9d4da9cfe gtktypes: GTK_INVALID_LIST_POSITION should be an int
GListModel uses guint, so the macros we define for it should match that.

Related: !3738
2021-12-07 16:15:17 +01:00
Emmanuele Bassi
5bf5b58eb3 Merge branch 'gi-const' into 'main'
gtk: fix GTK_INVALID_LIST_POSITION type

See merge request GNOME/gtk!3738
2021-12-07 14:22:40 +00:00
Hugo Carvalho
b2c227e9c5 Update Portuguese translation 2021-12-04 19:46:16 +00:00
Yuri Chornoivan
d854228d58 Update Ukrainian translation 2021-12-04 16:46:08 +00:00
Benjamin Otte
a0c09bc2a9 Merge branch 'check-for-unknown-duration' into 'main'
gstmediafile: Correctly report unknown duration

See merge request GNOME/gtk!4217
2021-12-04 09:45:34 +00:00
Anders Jonsson
aca3b2da58 Update Swedish translation 2021-12-04 09:34:37 +00:00
Ivan Molodetskikh
604541863c gstmediafile: Correctly report unknown duration
When loading .mp3 files the duration is initially unknown. Before this
change it was reported as a large integer (since GST_CLOCK_TIME_NONE is
-1). Now it's correctly reported as 0.
2021-12-04 11:48:30 +03:00
Matthias Clasen
fc67b5a8cf Merge branch 'wip/carlosg/im-wayland-module-priority' into 'main'
gtkimcontextwayland: Set a higher IO extension priority

Closes #4443

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

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

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

Closes #4512

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

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

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

Closes #4325

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

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

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

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

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

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

Closes #4376

See merge request GNOME/gtk!4211
2021-12-02 17:38:16 +00:00
Emmanuele Bassi
b57b12fdb7 Update placeholder visibility when setting a buffer
If we set the placeholder text before setting a buffer, we end up with
both the placeholder *and* the buffer's contents visible at the same
time.

Fixes: #4376
2021-12-02 17:17:12 +00:00
Matthias Clasen
e64bb40d0b Merge branch 'wip/carlosg/tablet-fixes' into 'main'
Wayland tablet device modifier fixes

Closes #4103 and #4102

See merge request GNOME/gtk!4210
2021-12-02 16:34:35 +00:00
Carlos Garnacho
c8d83b7a63 gesturestylus: Use GtkEventControllerEvent events to track changes
We use gtk_gesture_get_last_event() underneath at places that need to
work during ::proximity emission. Since GtkGesture only tracks events
while there are button/touch presses involved, this is not going to
bring the right result there.

Use gtk_event_controller_get_current_event() consistently inside,
which always pokes at the event being handled (which is the correct
intent here).
2021-12-02 17:06:35 +01:00
Carlos Garnacho
9539cc4a93 gdk/wayland: Unset GDK_BUTTON1_MASK on proximity_in
In some circumstances (e.g. activating with a stylus something that
closes a window), we can receive zwp_tablet_tool.proximity_out without
receiving a zwp_tablet_tool.up beforehand.

In those cases, we are not expecting neither .up nor .button, so
reset the stylus device button modifiers on proximity_out.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4103
2021-12-02 17:06:35 +01:00
Carlos Garnacho
72cf304a86 gdk/wayland: Use right modifiers for tablet button events
We are looking up the seat logical pointer modifiers (i.e. the wl_pointer),
not the ones for the tablet tool device. This breaks accounting further
along in GTK leaving stuck implicit grabs.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4102
2021-12-02 17:06:35 +01:00
Matthias Clasen
67ad566188 textview: Improve scroll-to-mark behavior
The idea of within-margin is to scroll as little
as possible to bring the mark within the margins
defined by the factor. The code was achieving
that when scrolling down, but not when scrolling
up. This change makes things symmetrical.

Fixes: #4325
2021-12-01 19:35:11 -05:00
Matthias Clasen
db46a8dd06 Add a testcase for scroll-to-mark
This should help for figuring out #4325.
2021-12-01 17:22:19 -05:00
Matthias Clasen
fd9e0dd13a Deprecate GdkDevice:source
GdkDeviceTool is more consistently supported across
backends, and provides the same information.
2021-12-01 14:04:35 -05:00
Matthias Clasen
2611a996ff Merge branch 'matthiasc/for-main' into 'main'
textbuffer: Fix pasting text

Closes #4357

See merge request GNOME/gtk!4205
2021-12-01 02:59:10 +00:00
Matthias Clasen
3e7618fef7 textbuffer: Try harder to fix pasting
It turns out we can't just use the size returned
by the memory stream as-is, since it may contain
unfilled garbage at the end, which utf8 validation
will choke on. So, cut it off at the first '\0'
we find.
2021-11-30 21:42:19 -05:00
Matthias Clasen
5b1b75b055 textbuffer: Fix pasting text
The memory stolen from a memory outputstream
isn't guaranteed to be 0-terminated, so don't
make that assumption.

Fixes: #4357
2021-11-30 20:37:25 -05:00
Matthias Clasen
f1612e36ee Merge branch 'update_focus_indicators_in_popovers' into 'main'
update focus indicators in popovers

See merge request GNOME/gtk!4124
2021-12-01 01:21:32 +00:00