Commit Graph

37089 Commits

Author SHA1 Message Date
Matthias Clasen
9d0952bd7f atspicontext: Implement GetState
Translate the aria states to at-spi's interpretation
of atk states.
2020-10-12 16:19:32 +01:00
Matthias Clasen
e189ccc8ed atspiroot: Fix GetState implementation
When the GetState signature says 'au', it actually
means a bitset that is sent as a pair of 32bit integers.
2020-10-12 16:19:32 +01:00
Matthias Clasen
762fbf34fc atspiroot: Implement GetIndexInParent
Just for good measure
2020-10-12 16:19:32 +01:00
Matthias Clasen
9f73638d43 atspicontext: Implement GetIndexInParent
This is needed for ATs to take our tree seriously.
2020-10-12 16:19:32 +01:00
Matthias Clasen
057b447137 atspicontext: Implement more accessible api
Implement GetChildAtIndex, GetChildren and ChildCount.
2020-10-12 16:19:32 +01:00
Matthias Clasen
78690845b1 atspiroot: Implement GetChildren
No surprises here.
2020-10-12 16:19:32 +01:00
Matthias Clasen
2ea338a8cf atspiroot: Don't leak references
The reffing getter trap, lurking behind g_list_model_get_item().
2020-10-12 16:19:32 +01:00
Matthias Clasen
e2f3039663 atspiroot: Implement GetLocale 2020-10-12 16:19:32 +01:00
Matthias Clasen
8f20133769 atspicontext: Print out the a11y bus address
Make our debug spew useful: Having the bus address
makes it easy to jump on the a11y bus to look around
with dbus tools.
2020-10-12 16:19:32 +01:00
Emmanuele Bassi
55b1fbd0f3 a11y: Localise the role name of the root node 2020-10-12 16:19:32 +01:00
Emmanuele Bassi
b57f1588df a11y: Register the Accessible interface on all AtSpiContext instances
This is not a complement implementation.
2020-10-12 16:19:32 +01:00
Emmanuele Bassi
60acdb9cad a11y: Implement more ATSPI methods on the root node 2020-10-12 16:19:32 +01:00
Emmanuele Bassi
07759b158a a11y: Add method to extract desktop data
We are going to need the desktop name and path to populate the parent
property of AtSpiContexts associated to top level widgets.
2020-10-12 16:19:32 +01:00
Emmanuele Bassi
9511c8273a a11y: Validate the DBus context path
UUIDs use dashes to separate the various blocks; unfortunately, this
results in an invalid DBus object path. Replace the dashes with an
underscore.
2020-10-12 16:19:32 +01:00
Emmanuele Bassi
b85b1f5b51 a11y: Turn accessible roles to string
Add a simple utility function to turn GtkAccessibleRole values into the
appropriate string, including localization.
2020-10-12 16:19:32 +01:00
Emmanuele Bassi
716024d882 a11y: Convert GTK roles to ATSPI ones
There's not a precise, 1:1 mapping between the newer ARIA roles and the
older ATSPI ones. We make do with what we have.
2020-10-12 16:19:32 +01:00
Emmanuele Bassi
21482e8264 a11y: Compute the label for a GtkATContext
The ARIA spec defines the mechanism for determining the name of an
accessible element—see §4.3 of the WAI-ARIA spec.

We follow the specification as much as it makes sense for GTK to do
so:

 1. if the element is hidden, return an empty string
 1. if the element has a labelled-by relation set, retrieve the
    label of the related element
 2. if the element has a label property set, use the value of
    the property
 3. if neither labelled-by nor label attributes are set, we use
    the role to compute the name:
   - for a `range` role, we return the contents of the value of
     the `value-text` or `value-now` properties
   - for any other role, we return a textual representation of
     the GtkAccessibleRole enumeration value
2020-10-12 16:19:32 +01:00
Emmanuele Bassi
e6c5d57ffe a11y: Return the ATSPI role for the root element 2020-10-12 16:19:32 +01:00
Emmanuele Bassi
d7ebf18723 a11y: Add AT-SPI cache object
Right now, the cache is unused, and we still need to implement the
serialisation method and emit the signals.
2020-10-12 16:19:32 +01:00
Emmanuele Bassi
658d910967 a11y: Ignore widgets during destruction
There's no point in creating a GtkATContext when a widget is getting
destroyed.
2020-10-12 16:19:32 +01:00
Emmanuele Bassi
bd43e9cfc5 a11y: Register the accessible root object
When we create the first AT-SPI context we also need to register the
accessible root on the accessibility bus. The accessible root object is
the main entry point of an accessible application, and it holds the
global state to present to the ATs that connect to the bus.
2020-10-12 16:19:32 +01:00
Emmanuele Bassi
8c18480092 a11y: Add a display to GtkATContext
Since we need to check at run time what kind of AT context to use, we
need a hook into the whole GDK backend machinery. The display connection
seems to be the best choice, in this case, as it allows us to determine
whether we're running on an X11 or Wayland system, and thus whether we
should create a GtkAtSpiContext.

This requires some surgery to fix the GtkATContext creation function, in
order to include a GdkDisplay instance.
2020-10-12 16:19:32 +01:00
Emmanuele Bassi
8f19bb0832 a11y: Add dummy AT-SPI context
Does not do anything, at the moment, but it's going to get filled out
soon.

The backend is selected depending on the platform being compiled in;
since we're using AT-SPI on X11 and Wayland, and we don't have other
accessibility implementations, we currently don't care about run time
selection, but we're going to have to deal with that.
2020-10-12 16:19:31 +01:00
Emmanuele Bassi
c50916d27b a11y: Add the AT-SPI DBus descriptions
And generate the code for the DBus interfaces.

We don't want the full object manager experience, here, because we're
going to have a single object responding to various interfaces and
remote method calls. For this reason, we're not using the gnome module
in Meson to call gdbus-codegen for us: we need to use the interface info
command line arguments, and those are not available from Meson.
2020-10-12 16:19:31 +01:00
Emmanuele Bassi
daac36ea4c Generate introspection for GdkWayland API
Like we do for GdkX11. We can't use all of the public C API, but we can
expose enough type information to allow non-C developers to actually
check if they are running the Wayland GDK backend or not—plus some
additional Wayland-specific API.
2020-10-12 14:07:26 +01:00
Matthias Clasen
035e303f83 Merge branch 'wip/chergert/gdk-macos-fixes' into 'master'
various build fixes for GDK/GTK on macos

See merge request GNOME/gtk!2680
2020-10-10 11:55:01 +00:00
Christian Hergert
07bb07abbe macos: port gtk to GDK_WINDOWING_MACOS
For the various uses of GDK_WINDOWING_QUARTZ, we need to use
alternatives from GDK_WINDOWING_MACOS.

Some minor loss of functionality is here, such as icons sent with
application menus. That can certainly be added back at a future
point.
2020-10-09 20:08:23 -07:00
Christian Hergert
41101673c3 gtk: use GDK_WINDOWING_MACOS in gentypefuncs.py 2020-10-09 20:05:20 -07:00
Matthias Clasen
115ed005e6 Send focus events to the root
We are not propagating focus change events, and that is the only
place where we are listening for focus change events. If GtkWindow
does not see focus-in events for its popovers, we end up with
inadvertendly inactive windows.

Fixes: #3240
2020-10-09 07:43:40 -04:00
Matthias Clasen
6a0704aeb4 window: Be more careful when looking for focus
When passing focus up to a parent, make sure the
newly chosen focus widget actually accepts the focus.
2020-10-09 07:43:25 -04:00
Benjamin Otte
bc5723a846 Merge branch 'wip/otte/for-master' into 'master'
textbuffer: Don't serialize the \0 byte

See merge request GNOME/gtk!2672
2020-10-07 20:33:25 +00:00
Benjamin Otte
0fdb33e82a textbuffer: Don't serialize the \0 byte
... when converting to text/plain.
2020-10-07 22:14:18 +02:00
Matthias Clasen
cfb316799a colorchooser: Bring color names back
These are useful for accessibility.

Fixes: #3237
2020-10-07 15:56:11 -04:00
Jan Alexander Steffens (heftig)
fb0c062506 gtkplacessidebar: Disconnect and unref cloud_manager in dispose
The manager's providers-changed signal can fire after the sidebar has
been freed. Make sure we disconnect the sidebar from the manager.

https://bugs.archlinux.org/task/57984
https://bugs.archlinux.org/task/68123
2020-10-07 15:16:31 -04:00
Matthias Clasen
043207133d Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3235

See merge request GNOME/gtk!2667
2020-10-06 18:25:48 +00:00
Matthias Clasen
490163efcd Merge branch 'aboutwindow' into 'master'
gtkaboutdialog: Directly specialize GtkWindow

See merge request GNOME/gtk!2666
2020-10-06 18:25:27 +00:00
Matthias Clasen
44fd0c18c8 aboutdialog: Fix updating license tab
We need to update the license button visibility
whenever the license type changes.
2020-10-06 12:53:46 -04:00
Adrien Plazas
a17f33b1fe gtkaboutdialog: Directly specialize GtkWindow
As it doesn't act as a dialog, there is no point specializing GtkDialog,
so his makes it specialize GtkWindow directly.
2020-10-06 18:46:48 +02:00
Matthias Clasen
22eac2f407 window: Fix setting min size
We were inadvertedly setting the windows min size
to the default size, making it so that you can never
shrink a window below its default size.

Fixes: #3235
2020-10-06 11:06:36 -04:00
Matthias Clasen
7698b4dd63 treelistrowsorter: Add a bandaid
The GtkTreeListRowSortKeys implementation doesn't
know how it wants to cache its keys, and just crashes.

Since that is not cool, add a bandaid fix that forces
it to recreate its keys instead. Extra work, but hey,
no crash.

Related: #3228
2020-10-06 07:58:01 -04:00
Matthias Clasen
b6d4067717 Merge branch 'wip/carlosg/for-master' into 'master'
gtkpopover: Revert focus to parent on hide()

Closes #3214

See merge request GNOME/gtk!2653
2020-10-06 02:14:54 +00:00
Matthias Clasen
ac164d240b Cosmetic
Don't call gtk_root_get_focus when we already have
the GtkWindowPrivate struct at hand. And use
gtk_window_set_focus to update the focus, like the
old code did.
2020-10-05 21:53:05 -04:00
Carlos Garnacho
38547120b2 gtkwindow: Ensure to revert focus to a parent on hide()
When a widget is hidden, check harder for the keyboard focus being
contained in that widget, in order to reset it. Portions of the
focus child hierarchy may be outdated at the time, so it is more
reliable to check GtkRoot::focus (i.e. the property we intend to
update here).

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3214
2020-10-06 03:29:13 +02:00
Matthias Clasen
20fb7812df window: Fix window size snapping back
We were not updating the remembered size at all when
the window is interactively resized, causing it to
snap back to its default size the next time we call
gdk_toplevel_present().

This is a bandaid fix to prevent very broken resizing
behavior, until we have properly redone toplevel sizing.

Fixes: #3076
2020-10-05 20:24:19 -04:00
Matthias Clasen
5d5625dec8 Update script names to Unicode 13
It would be better if this was provided elsewhere...
2020-10-04 16:15:09 -04:00
Matthias Clasen
cb833d52fb Merge branch 'emoji-data-cldr' into 'master'
Update Emoji data

Closes #1511 and #950

See merge request GNOME/gtk!2656
2020-10-04 13:56:40 +00:00
Matthias Clasen
8ca612c966 scale: Make draw-value default to FALSE
This is rarely what you want, so lets turn it off
by default.

Update the one place in our demos where we want to
draw a value, add support for this to gtk-builder-tool,
add a test and mention this change in the migration
guide.
2020-10-04 08:26:44 -04:00
Matthias Clasen
452c909b64 Redo the handling of Emoji data
Use the data files from https://github.com/milesj/emojibase.git
as source for our Emoji data. Slightly change our data format by
adding a group to each item, in both the Emoji data and in the
setting for recent-emoji.

Install translated versions of the data as separate resource
bundles in $prefix/gtk-4.0/emoji, and load them when appropriate.

Currently, we have data for de, en, es, fr, zh, with data taken
from Unicode 13 and CLDR 13.

Fixes: #950 #1511
2020-10-04 01:14:42 -04:00
Matthias Clasen
7ef5921022 Emoji: Drop the shortname field from emoji.data
Match the name for Emoji completion, and display
it too. 'man worker' looks a lot more natural in
the UI than ':man_worker:'.
2020-10-03 20:06:31 -04:00
Matthias Clasen
1d9d5fcf39 Do case-folding and tokenization when creating emoji.data
We can avoid doing the extra work of case-folding and
tokenization whenever we filter in the Emoji chooser.
2020-10-03 19:46:46 -04:00
Matthias Clasen
ed724ebc35 emoji: Add keywords to the data
And use them for matching in the Emoji chooser.
2020-10-03 19:46:46 -04:00
Matthias Clasen
44448016e8 emoji: Some work on the conversion tool
Document the variant format, and write out json
format if asked to.
2020-10-03 19:46:46 -04:00
Matthias Clasen
a4284569c0 Fix Emoji completion
This is some late fallout from the container removal.
2020-10-03 19:42:19 -04:00
Matthias Clasen
6e594da5f2 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #506

See merge request GNOME/gtk!2655
2020-10-03 19:27:15 +00:00
Matthias Clasen
ac79c0e799 textbuffer: Improve some get_iter apis
Make these functions return FALSE if they did not
return the exact position that was requested.

Adapt tests.

Based on a patch by Sebastien Wilmet

Fixes: #506
2020-10-03 14:29:07 -04:00
Matthias Clasen
60b1b4669e spinbutton: Add some missing accessors
Add a setter and getter for the climb-rate property.
2020-10-03 13:11:20 -04:00
Matthias Clasen
9d0d4cef03 Cosmetics 2020-10-03 13:11:20 -04:00
Matthias Clasen
1b1bf6c90a text: Add some missing setters and getters
Add getters and setters for the enable-emoji-completion,
propagate-text-width and truncate-multiline properties.
2020-10-03 13:11:20 -04:00
Matthias Clasen
38bd4439e8 directorylist: Drop the item-type property
No need for this to be a property.
This showed up in a test for missing accessors.
2020-10-03 13:11:20 -04:00
Matthias Clasen
9fdb71cbd2 icontheme: Add a missing getter
We want to have a get_display() method on every object
that is tied to the display, so add one here.
2020-10-03 13:11:20 -04:00
Matthias Clasen
ff7bcf738c colorbutton: Properly override interface properties
This showed up in a test for missing property accessors.
2020-10-03 13:11:20 -04:00
Matthias Clasen
949f22b8b2 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #2261 and #1002

See merge request GNOME/gtk!2654
2020-10-03 03:55:32 +00:00
Matthias Clasen
a9809b0f67 Allow inserting newlines in css strings
Rename _gtk_css_print_string to strip the _ and add
an insert_newlines argument to it. Update all callers,
and make the render node serializer insert newlines.
2020-10-02 23:40:16 -04:00
Matthias Clasen
9033336a23 css: Move _gtk_css_print_string around
Move this to a separate header, since it is not
parser functionality, and kill the duplicate
gtkcssparserprivate.h header.
2020-10-02 23:40:16 -04:00
Jakub Steiner
68ae8506d5 Merge branch 'stackswitcher-button-styling' into 'master'
Adwaita: Simplify stackswitcher button styling

See merge request GNOME/gtk!2498
2020-10-02 15:09:07 +00:00
Matthias Clasen
da8ee53e2d emojichooser: Allow inserting multiple Emoji
Don't close the Emoji chooser when the Control
key is held while clicking. So you can insert
multiple Emoji without having to reopen the
chooser every time.

Fixes: #1002
2020-10-01 23:45:05 -04:00
Matthias Clasen
3cf8904d0b Add GTK_INPUT_HINT_PRIVATE
Add a flag that requests that input methods should not
update personalized data (such as typing history).

Fixes: #2261
2020-10-01 17:14:58 -04:00
Matthias Clasen
c43d535aab docs: Fix a copy-paste error 2020-10-01 17:07:53 -04:00
Jakub Steiner
81cfcba5ad Adwaita: close button for infobar, searchbar
fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3215
2020-10-01 13:14:25 +02:00
Matthias Clasen
5a3aed8ade Merge branch 'introspection' into 'master'
meson: Change introspection option to yielding feature

See merge request GNOME/gtk!2648
2020-09-30 17:50:21 +00:00
Benjamin Otte
5b89253fd9 Use correct child widget when measuring
Fixes a copy/paste error.

Fixed #3220
2020-09-30 17:48:24 +00:00
Xavier Claessens
0e5dac8c25 meson: Change introspection option to yielding feature
Yielding option means that if pango is built as a subproject, it will
take the value of that option from the parent project (e.g. gst-build).
For that to work it must be of the same type, which is "feature" instead
of "boolean" in all GStreamer modules.
2020-09-30 09:50:24 -04:00
Matthias Clasen
9d701129cc icontheme: Clarify the docs
Mention that icons directly in /$app_id/icons/ are treated
as unthemed icons.

See #3216
2020-09-30 08:55:39 -04:00
Matthias Clasen
87393c7fb6 Merge branch 'small-cleanup' into 'master'
menubutton: Remove obsolete private method

See merge request GNOME/gtk!2643
2020-09-29 21:52:37 +00:00
Matthias Clasen
76d616909f Merge branch 'ebassi/for-master' into 'master'
Ebassi/for master

See merge request GNOME/gtk!2642
2020-09-29 20:45:00 +00:00
Florian Müllner
7ad42df727 menubutton: Remove obsolete private method
It was only added for the fallback app menu in headerbars, which
has been removed in the meantime.
2020-09-29 20:58:25 +02:00
Emmanuele Bassi
c6cedf608a Add annotations for GtkBuildable virtual functions
Now that the functions that wrap them have gone away from the public
API, we need proper annotations for the virtual functions, otherwise
languages will not have enough information on nullable arguments and
ownership transfer.
2020-09-29 19:48:55 +01:00
Matthias Clasen
687ed74d46 Merge branch 'snapshot-stack-optimize' into 'master'
Minor optimizations to GtkSnapshot state stack

See merge request GNOME/gtk!2641
2020-09-29 18:44:07 +00:00
Emmanuele Bassi
97276a5cd4 Remove gtk-doc stanzas from private GtkBuildable API
Various functions were moved to the private GtkBuildable header by
commit 2715b3ec31, but the functions still
have gtk-doc stanzas.
2020-09-29 19:39:34 +01:00
Alexander Larsson
796e6ee306 snapshot: Preallocate and don't memset the state stack
Most of the time the snapshot is less than 16 levels deep (did some testing
in gtk-demo), so lets pre-allocate 16 levels of state stack to avoid the
extra allocation most of the time.
2020-09-29 16:03:06 +02:00
Matthias Clasen
4a2c817690 docs: Document various entry ::activate signals 2020-09-29 07:04:07 -04:00
Matthias Clasen
aac9414117 statusbar: Remove a misleading doc comment 2020-09-29 07:04:07 -04:00
Matthias Clasen
c897daf797 snapshot: Document radial gradient apis 2020-09-29 07:04:07 -04:00
Matthias Clasen
3af249c046 Silence a compiler warning
These variables are not used anymore since
commit 11e4a46967.
2020-09-29 07:04:07 -04:00
Alexander Larsson
950cc41e15 GtkSnapshot: Add gtk_snapshot_push_glshader() 2020-09-29 09:51:16 +02:00
Alexander Larsson
7ea755e206 Add GskGLShaderNode and GskGLShader
A GskGLShader is an abstraction of a GLSL fragment shader that
can produce pixel values given inputs:
 * N (currently max 4) textures
 * Current arguments for the shader uniform
Uniform types are: float,(u)int,bool,vec234)
There is also a builder for the uniform arguments which are
passed around as immutable GBytes in the built form.

A GskGLShaderNode is a render node that renders a GskGLShader inside a
specified rectangular bounds. It renders its child nodes as textures
and passes those as texture arguments to the shader. You also pass it
a uniform arguments object.
2020-09-29 09:51:16 +02:00
Alexander Larsson
645fc6a9a5 GtkWindow: Create renderer before realizing child widgets
This way the child widgets can rely on the renderer (for example what
type it is) to decide details about how they render (such as if they
should use OpenGL shaders).
2020-09-29 09:51:16 +02:00
Matthias Clasen
a91b6b4786 css: Move the last parser api to the new header
This lets us use it from the render node parser
in gsk.
2020-09-29 09:51:16 +02:00
Matthias Clasen
e29c586b7c Merge branch 'arnaudb/menubutton-direction' into 'master'
Make GtkMenuButton::direction more useful.

Closes #2811

See merge request GNOME/gtk!2636
2020-09-29 01:55:24 +00:00
Matthias Clasen
a799c86edb textbuffer: Elaborate docs
Explain a bit more what gtk_text_buffer_get_content_provider()
is for.

Fixes: #3202
2020-09-28 20:51:13 -04:00
Matthias Clasen
68bb532290 window: Don't get surfaces needlessly
There is a 1-1 correspondence between natives and
surfaces, so we can just compare the natives, no
need to get the surface for every single one.
2020-09-28 20:51:13 -04:00
Matthias Clasen
d2f0e3fa6b doc: Document some apis as widget implementor only
A better solution for this would be nice. For the
time being, just add a sentence to the docs.
2020-09-28 20:51:13 -04:00
Arnaud Bonatti
4684082232 Make GtkMenuButton::direction more useful.
This property was only used until now when
there was neither an icon nor a label set,
for arrow direction and popover placement.

Starting with Gtk4, a GtkMenuButton with a
label shows an arrow at the right (in LTR)
of the label. Allow disabling the arrow or
changing its direction using the direction
property, to have a way to restore a Gtk3-
like look or to improve popover placement.

Fixes #2811.
2020-09-29 02:26:13 +02:00
Carlos Garnacho
11e4a46967 gtkeventcontrollerscroll: Drop device type checks
Kinetic scrolling (and begin/end tracking) broke with commit cab1dcb696
since the pointing device used on X11 does not get as much GdkInputSource
granularity as the source device used to have in GTK3.

Actually this is kinda pointless, devices incapable of smooth scroll
should send discrete events, without those devices in the picture, we
want kinetic scroll to apply on every other device capable of smooth
scroll, so just do that.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3210
2020-09-28 23:35:36 +02:00
Matthias Clasen
27b3bb59eb Merge branch 'another-attempt-to-fix-shadertoy' into 'master'
Flip GLArea textures

See merge request GNOME/gtk!2634
2020-09-28 16:16:51 +00:00
Matthias Clasen
5206cfa837 Merge branch 'wip/otte/for-master' into 'master'
snapshot: Don't flip textures

See merge request GNOME/gtk!2633
2020-09-28 15:43:02 +00:00
Matthias Clasen
b711c12bbe glarea: Flip our texture
The texture that produce is upside-down, compared to what
GSK expects, so flip things around with a transform.

This fixes the shadertoy demo being upside-down after a
recent fix to avoid downloading and reuploading the texture.
2020-09-28 11:34:23 -04:00
Benjamin Otte
651c92c0ed snapshot: Don't flip textures
... or gradients or borders or shadows. Instead, ensure that affines
have non-negative scale factors. Otherwise add a transform node.

The only place where this check is not necessary is color nodes, but
special casing them seems not worth it.
2020-09-28 16:14:28 +02:00
Matthias Clasen
536e1a1954 Merge branch 'patch-1' into 'master'
treestore: Document the fact that iter is modified by the function, in a machine-readable fashion.

See merge request GNOME/gtk!2613
2020-09-27 15:03:04 +00:00
Danny Milosavljevic
32baa0a549 Update gtktreestore.c: gtk_tree_store_remove didn't have the proper comment annotation
"inout" for the parameter ITER passed.  This means that bindings would misjudge what
the function does.  In the case of guile-gi, it would be misjudged for a predicate,
see gulie-gi bug 87.
2020-09-27 15:03:03 +00:00
Matthias Clasen
752270253f fontchooser: Fix builds without PangoFT2
Currently, only if PangoFT2 is present and used it is supported
to retrieve the languages that are supported by a particular font.

If we don't have PangoFT2, remove the language filtering and the
sample text selection.

Based on earlier work by Chun-wei Fan, see
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/2614
2020-09-26 19:15:45 -04:00
Matthias Clasen
92e551f895 Merge branch 'BUG_gtktreeview_headers_focus_on_click_GTK4' into 'master'
GtkTreeviewColumn: don't focus-on-click header buttons

See merge request GNOME/gtk!1806
2020-09-26 22:50:23 +00:00
Florian Müllner
2715b3ec31 buildable: Make vfunc accessor functions private
With the exception of gtk_buildable_get_id(), those are only used
to construct objects from XML descriptions, which is functionality
internal to GTK.

The API is therefore unlikely to be missed, and keeping it internal
means they can no longer unintentionally shadow object methods in
bindings with less namespacing; for example it's currently ambiguous
whether `infoBar.add_child()` refers to gtk_info_bar_add_child() or
gtk_buildable_add_child().

https://gitlab.gnome.org/GNOME/gtk/-/issues/3191
2020-09-26 02:16:57 +02:00
Florian Müllner
12189bc10f buildable: Rename set_name() to set_buildable_id()
GtkBuildable's get_name()/set_name() methods may shadow
GtkWidget's methods. Avoid that by renaming the API to
get_buildable_id()/set_buildable_id(), which also reflects
the name of the XML attribute the API refers to.

https://gitlab.gnome.org/GNOME/gtk/-/issues/3191
2020-09-26 02:16:05 +02:00
Matthias Clasen
a9de1d702e Merge branch 'matthiasc/for-master' into 'master'
columnview: Simplify column constructors

See merge request GNOME/gtk!2622
2020-09-25 18:25:09 +00:00
Matthias Clasen
0c3f42e06e columnview: Simplify column constructors
Drop gtk_column_view_column_new_with_factory and
just make gtk_column_view_column_new accept a
nullable factory. This follows what we've been
doing elsewhere.

Update all callers.
2020-09-25 13:57:10 -04:00
Carlos Garnacho
d9d494826f gtkbutton: Clean up priv->in_button
This is now only toggled around, may be cleaned up.
2020-09-25 19:20:27 +02:00
Carlos Garnacho
ea6e575901 gtkbutton: Check release coordinates on all release event types
The priv->in_button state that used to be relied upon for pointer
events has been reduced over time to a broken state, since the button
does not track crossing events anymore.

Make the coordinate-based checks apply for pointer events too, besides
touch events. This fixes GtkButton mistakenly emitting ::clicked with
pointer button releases outside the widget.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3121
2020-09-25 19:20:04 +02:00
Carlos Garnacho
0ccdbfd802 gtktextview: Avoid GtkGestureClick claiming on touch press
We still want the drag gesture (and text selection) to work. Avoid claiming
the gesture early, like it's done in the pointer case.
2020-09-25 19:02:26 +02:00
Carlos Garnacho
7d5accc69f gtkscrolledwindow: Do not eagerly claim touch press event
Claiming early makes the contents unable to react to the touch press
event. Do this on GtkGestureDrag::update past a threshold, so the
child widget(s) can claim before the scrolledwindow does.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3125
2020-09-25 18:58:44 +02:00
Carlos Garnacho
b1606db839 gtkscrolledwindow: Drop gtk_scrolled_window_set_capture_button_press()
This API is kinda stuck in the GdkEvent days, we now negotiate ownership
of the input sequence via GtkGestures. Remove it as it reflects a way to
work that was not exactly accurate and it will turn plainly wrong soon.
2020-09-25 18:57:40 +02:00
Timm Bäder
09564a5798 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

See merge request GNOME/gtk!2617
2020-09-25 13:35:20 +00:00
Matthias Clasen
e6d5a3c4e8 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3180, #3178, and #3179

See merge request GNOME/gtk!2618
2020-09-24 18:50:26 +00:00
Matthias Clasen
e70ed905d1 columview: Don't overdraw
Just always tell the title and cell widgets to
clip their children to the right size. Otherwise
we risk things getting out of sync and unintended
overdraw.

Fixes: #3179
2020-09-24 14:30:40 -04:00
Matthias Clasen
7eb0ae39c5 columview: Fix column resizing
We were not handling the fixed_width quite right,
and that was causing screaming from the GTK size
allocation machinery.

Fixes: #3178
2020-09-24 14:18:38 -04:00
Timm Bäder
2f93287473 cssimagefallback: Whitespace 2020-09-24 19:08:22 +02:00
Timm Bäder
484dcc043b cssimagefallback: Avoid allocating GPtrArray for colors
If we just parse a color, like image(#FFF), avoid allocating the
GPtrArray to store images. This happens in Adwaita for background images
of backdrop buttons. We save around 70 GPtrArrays this way.
2020-09-24 19:08:22 +02:00
Timm Bäder
716b5afe6a Adwaita: Fix calendar header button backdrop bg color 2020-09-24 19:08:22 +02:00
Timm Bäder
12cc178756 textbuffer: Don't try to inset NULL text from clipboard
That used to generate a critical error message.

Also free() the data.
2020-09-24 19:08:22 +02:00
Matthias Clasen
9fde0137a0 listview: Avoid a critical when reordering
When sorting a cell into the place its already at,
we were triggering criticals. Avoid that.

Fixes: #3180
2020-09-23 22:53:21 -04:00
Matthias Clasen
9dab51e7be Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3188

See merge request GNOME/gtk!2612
2020-09-23 22:44:22 +00:00
Matthias Clasen
810218b2f5 fontchooser: Don't center the list
The centered layout of the font previews don't look appealing
and make it harder to judge the relative width and weight of
the individual styles.

Fixes: #3188
2020-09-23 16:32:48 -04:00
Thomas Holder
4325c20013 gtktreeview: Fix child access after TEST_EXPAND_ROW
In gtk_tree_view_build_tree with recurse=TRUE, the TEST_EXPAND_ROW
signal might invalidate the child iterator. Getting the iterator after
the signal (instead of before) fixes the issue.

Fixes https://gitlab.com/inkscape/inkscape/-/issues/1879
2020-09-23 07:53:33 -04:00
Matthias Clasen
7bae48335f Merge branch 'wip/jimmac/osd-spinbutton' into 'master'
Adwaita: osd spinbutton specificity bump

Closes #2769

See merge request GNOME/gtk!2610
2020-09-23 11:47:01 +00:00
Matthias Clasen
571f15cac6 Merge branch 'make-claiming-button-release-work' into 'master'
gestures: Make claiming button release work

See merge request GNOME/gtk!2576
2020-09-23 11:35:59 +00:00
Jakub Steiner
78236bfdbe Adwaita: osd spinbutton specificity bump
- mimic the peculiar selector from the normal style onto osd to
  override.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2769
2020-09-23 10:16:55 +02:00
nana-4
2d6a9990b7 Adwaita: Don't restrict columnview editablelabel style to .data-table
This should be available without .data-table.
2020-09-22 10:40:15 +09:00
nana-4
42be26f1b1 Adwaita: Improve columnview styling
- Move padding from parent row to child cell.
- Align horizontal sizing of cell with header button.
- Properly support GtkColumnView:show-column-separators.
- Change cell height with and without .data-table.
2020-09-22 10:37:04 +09:00
nana-4
f98055b075 Adwaita: Fix separator color for lists 2020-09-22 10:35:15 +09:00
Matthias Clasen
3252d4cab2 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2607
2020-09-21 18:11:41 +00:00
Matthias Clasen
2c527ec87e inspector: Make switches go back to normal size 2020-09-21 11:53:48 -04:00
Matthias Clasen
256f845d89 colorbutton: Fix handling of transient parents
When we create the dialog before the button has
been rooted, we need to update its transient
parent when that happens.
2020-09-21 11:53:48 -04:00
Timm Bäder
b3c21bc89a Merge branch 'fix-hover-tracking' into 'master'
main: Update pointer focus state for button releases

Closes #3172

See merge request GNOME/gtk!2601
2020-09-21 12:20:00 +00:00
Matthias Clasen
1d34f955a2 filechooser: Fix gtk_file_chooser_set_choice
This broke when it was ported to GtkDropDown.
2020-09-20 12:04:49 -04:00
Matthias Clasen
ee75bae8f8 fontchooser: Make sure the tweak button is updated
This was showing up as tweak buttons being visible
when they should not. The code probably relied on
widgets being hidden by default (as they were in
GTK3).
2020-09-20 10:59:37 -04:00
Matthias Clasen
3c62cd90d4 fontchooser: Handle families without faces
This might seem useless, but I've met fonts
where pango_font_family_get_face (family, NULL)
return NULL. Handle it without criticals.
2020-09-20 10:59:37 -04:00
Matthias Clasen
81793b62d8 docs: Improve gtk_widget_set_font_map docs 2020-09-20 10:59:37 -04:00
Matthias Clasen
18a5ca257a Merge branch 'kill-widget-new' into 'master'
Drop gtk_widget_new

See merge request GNOME/gtk!2603
2020-09-19 21:25:32 +00:00
Matthias Clasen
874b9ef8b0 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2602
2020-09-19 21:22:30 +00:00
Matthias Clasen
d89f7fd046 Drop gtk_widget_new
An abstract type should not have a constructor.
If you want to be generic, just use g_object_new.
2020-09-19 16:58:42 -04:00
Matthias Clasen
cdc5e83ef2 Merge branch 'matthiasc/for-master' into 'master'
textbuffer: Redo insert markup a little bit

See merge request GNOME/gtk!2600
2020-09-19 20:48:49 +00:00
Matthias Clasen
661da6baec main: Update pointer focus state for button releases
Failure to do so makes the old pointer focus target
'sticky', because we end up ignoring the result of
picking the pointer focus until a motion event comes
in.

Fixes: #3172
2020-09-19 16:48:15 -04:00
Matthias Clasen
e927866ed4 shortcutswindow: Drop the Private struct 2020-09-19 16:22:04 -04:00
Matthias Clasen
4b9e7ac355 revealer: Drop the Private struct 2020-09-19 14:41:41 -04:00
Matthias Clasen
bebe0b5c1b magnifier: Drop the Private struct 2020-09-19 14:36:44 -04:00
Matthias Clasen
2ad9864cdc Cosmetic 2020-09-19 14:31:02 -04:00
Matthias Clasen
ec46900f06 colorscale: Drop the Private struct 2020-09-19 14:29:35 -04:00
Matthias Clasen
93cfa3855c Merge branch 'wayland-backend-api-cleanup' into 'master'
wayland: Change backend api to use GdkToplevel

See merge request GNOME/gtk!2598
2020-09-19 18:19:18 +00:00
Matthias Clasen
6b708e9b60 textbuffer: Redo insert markup a little bit
Redo the tag insertion function to avoid quadratic
behavior, and at the same time, fix handling of
alpha for color attributes.

Update the copy of this function in gtk4-demo
as well.
2020-09-19 14:17:28 -04:00
Matthias Clasen
dd0da0f3cc passwordentry: Add an ::activate signal
GtkSearchEntry has one, no reason why GtkPasswordEntry
should not as well.

Fixes: #3174
2020-09-19 13:25:03 -04:00
Matthias Clasen
48594a2d7a passwordentry: Drop the Private struct 2020-09-19 13:23:40 -04:00
Matthias Clasen
3023a61e1d wayland: Change backend api to use GdkToplevel
Most of the surface api we have in the Wayland backend
only makes sense for toplevels, so reshuffle things to
take a GdkToplevel instead of a GdkSurface.

Update all callers and the docs.
2020-09-19 13:07:11 -04:00
Matthias Clasen
57253b0039 Merge branch 'wip/baedert/radial-gradient' into 'master'
Radial gradients

Closes #2262, #3170, and #3173

See merge request GNOME/gtk!2597
2020-09-19 15:49:14 +00:00
Matthias Clasen
84d82dcda9 Merge branch 'wip/fontchooser-language-filtering' into 'master'
fontchooser: add language filtering

See merge request GNOME/gtk!2551
2020-09-19 15:06:56 +00:00
Matthias Clasen
4e35d56263 fontchooser: Remove signal handlers in dispose
Avoid ordering issues in dispose by disconnecting
the rows_changed_cb handler first thing.
2020-09-19 10:44:50 -04:00
Matthias Clasen
a9bf129286 fontchooser: Don't show "No fonts" prematurely
Don't switch to the empty page while we are still busy
filtering. Fonts might yet appear.
2020-09-19 10:25:45 -04:00
Matthias Clasen
76b7f0ca1c fontchooser: Use filter language for sample text
When you are asking to only see fonts that support
a given language, you probably want to see the
sample text for that language too.
2020-09-19 10:13:36 -04:00
Matthias Clasen
09604eb3eb fontchooser: Add user filtering
Add a popover that has filtering options. As a start,
allow filtering by monospace and by language coverage.
2020-09-19 10:13:36 -04:00
Matthias Clasen
0485a6c008 Improve language names
Shorten a few of the names we pick up by removing
parentheses that make them excessively long.
2020-09-19 09:47:15 -04:00
Matthias Clasen
169c208b7a Merge branch 'matthiasc/for-master' into 'master'
win32: Fix compiler warnings

See merge request GNOME/gtk!2596
2020-09-19 13:26:34 +00:00
Matthias Clasen
e0b1c3e8b0 win32: Fix compiler warnings
The compiler informs me that GetLastError() return a DWORD,
so use %lx to print it.
2020-09-19 08:29:29 -04:00
Timm Bäder
79dc25e0b1 cssimageradial: Avoid creating color stops with an offset > 1 2020-09-19 08:55:18 +02:00
Timm Bäder
1d371db8d8 scrolledwindow: Ignore captured motion events if no child is set
Fixes #3173
2020-09-19 08:44:58 +02:00
Matthias Clasen
69d5dc7c9a fontchooser: Determine sample text intelligently
Look at the languages supported by a font, and pick
a suitable sample text from the pango list of sample
texts. We can only implement this on platforms using
fontconfig, since it relies on pangofc apis.

This bumps the pango dependency to 1.47.1.
2020-09-18 23:04:39 -04:00
Timm Bäder
07b6431afe Inspector: Show radial gradient node info 2020-09-18 15:39:07 +02:00
Matthias Clasen
2886e19772 css: switch to h/vradius 2020-09-18 15:39:07 +02:00
Matthias Clasen
c08df82d54 snapshot: switch to h/vradius 2020-09-18 15:39:07 +02:00
Matthias Clasen
2881d347d3 css: Use snapshot api for radial gradients 2020-09-18 15:39:04 +02:00
Matthias Clasen
66d16049c3 snapshot: Add api for radial gradients
These are the equivalents of the linear gradient apis.
2020-09-18 15:39:04 +02:00
Matthias Clasen
0c6226c20b gsk: Add a radial gradient node
Only a fallback implementation for now.

Fixes #2262
2020-09-18 15:38:55 +02:00
Peter Bloomfield
50f373fbc2 language-names: Do not g_free() a GError
It's NULL anyway, so freeing GError with g_free() when it's allocated with
GSlice never actually happens, but it just looks bad.
2020-09-17 23:34:03 +00:00
Matthias Clasen
7082624fd7 textview: Properly delete anchored children
When we remove anchors with widgets from the text
buffer, we used to call gtk_widget_destroy(), which
indirectly called gtk_container_remove() which cleared
the child properly. When gtk_widget_destroy() was
removed, we replaced the calls with gtk_widget_unparent(),
but that is not enough. Explicitly call
gtk_text_view_remove() instead - we know the parent
is a text view.
2020-09-16 23:01:49 -04:00
Matthias Clasen
25d30011a0 textview: Make clickable tags work again
We were claiming the clicks too eagerly, preventing
clickable links, e.g. in GtkAboutDialog, from working.
2020-09-16 22:30:58 -04:00
Matthias Clasen
cd60ed4391 Plug a memory leak in an error case
gtk_show_uri() not freeing the error after showing
it to the user.

Pointed out by Peter Bloomfield in #3166
2020-09-16 19:13:18 -04:00
Matthias Clasen
cc9fe4b354 stack: Add gtk_stack_add_child
The name of children is not essential, so add
a way to add children without providing one.

Fixes: #3165
2020-09-15 18:39:09 -04:00
Matthias Clasen
6f56d8df28 Merge branch 'wip/jimmac/dnd-green' into 'master'
Adwaita: update tango color for DND

Closes #3158

See merge request GNOME/gtk!2581
2020-09-15 11:04:59 +00:00
Matthias Clasen
9eb4eef48b Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2582
2020-09-15 11:04:54 +00:00
Jakub Steiner
d1a68ac7ba Adwaita: update tango color for DND
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3158
2020-09-15 12:18:55 +02:00
Timm Bäder
a545fa15e4 inspector: Remove unsued function 2020-09-15 05:28:31 +02:00
Timm Bäder
e669433cde listbox: Activate single-click rows if n_press >= 1
Quickly clicking rows should always activate the row if
single-click-activation is enabled. Before, only the first click
(n_press == 1) would activate the row.
2020-09-15 05:21:54 +02:00
Timm Bäder
a6f86d9c26 popover: Only destroy arrow render node if position changed 2020-09-15 05:21:54 +02:00
Timm Bäder
c8f4c8c4f0 filechooserwidget: Plug a memory leak
g_list_store_append refs the file
2020-09-15 05:21:54 +02:00
Timm Bäder
87f589f738 emojichooser: Fix typo in css class 2020-09-15 05:21:54 +02:00
Timm Bäder
27f3600419 listbox: Add preconditions to remove() 2020-09-15 05:21:53 +02:00
Timm Bäder
a0422bfe25 inspector: Fix huge listbox rows
This is handled by .rich-list
2020-09-15 05:21:53 +02:00
Matthias Clasen
67c1600ac2 Document some API as widget-implementation only
Using gtk_widget_insert_before on a complex container
is a *bad* idea; it will mess up the containers bookkeeping
of its children and can easily lead to failure and crashes.
2020-09-14 20:28:44 -04:00
Emmanuele Bassi
595cc929e6 Annotate the expression array as "nullable"
While it's a bit dubious whether array+length annotations should be
marked as "nullable", we do this elsewhere in the API, so might as well
be consistent.

In practice, the array argument is only ever allowed to be NULL iff the
length argument is 0; annotations are static, so if somebody decides to
pass a NULL argument with a non-zero value, they will get a run time
critical error, instead of a compile time one, which is somewhat counter
to the point of annotating the API in the first place.

Fixes: #2923
2020-09-14 17:00:23 +01:00
Matthias Clasen
a201bfd9a5 Merge branch 'wip/jimmac/navlist-expander-whitespace' into 'master'
Adwaita: navigation list expander whitespace

See merge request GNOME/gtk!2575
2020-09-14 12:59:05 +00:00
Matthias Clasen
53dddf163d gestures: Make claiming button release work
When claiming a sequence in a gesture signal handler,
the expected result is that GtkGesture::handle-event
returns TRUE, causing the event to not be propagated
further.

This doesn't work for button release events, since
gtk_gesture_handle_event does the following:
  add point
  emit ::update
  remove point
  check claimed status
The ::update signal is where the application code
claims the sequence. But removing the point purges
the sequence from the gestures memory, so checking
the claimed status returns FALSE.

This patch fixes things to behave as expected, by
checking the claimed status before removing the point.
2020-09-14 08:35:44 -04:00
Jakub Steiner
e7c75f04dd Adwaita: navigation list expander whitespace
- Address https://gitlab.gnome.org/GNOME/gtk/-/issues/3138#note_910476
2020-09-14 14:31:23 +02:00
Jakub Steiner
8eab10dabf Adwaita: whitespace for the grid
- separate labels
- 12px margins around cells

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3164
2020-09-14 14:18:52 +02:00
Matthias Clasen
6a676d527c Merge branch 'wip/jimmac/natigation-sidebar-whitespace' into 'master'
Wip/jimmac/natigation sidebar whitespace

Closes #3138

See merge request GNOME/gtk!2572
2020-09-14 11:13:52 +00:00
Jakub Steiner
bcb2861447 assets: adjust gesture graphic
- quick, somebody on the internet is offended!

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3074
2020-09-14 12:14:40 +02:00
Jakub Steiner
962f76ddc9 Adwaita: navigation-sidebar spacing
- split from placessidebar as it's more generic

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3138
2020-09-14 11:51:54 +02:00
Matthias Clasen
c462f35a5e inspector: Use gdk_frame_clock_get_fps 2020-09-13 23:35:01 -04:00
Matthias Clasen
4b589b6afb main: Reshuffle debug code
Mode all the debug flags related code together,
to make gtkmain.c a bit less messy.
2020-09-13 22:48:29 -04:00
Matthias Clasen
fedeb51f31 Drop support for GTK_TEST_TOUCHSCREEN
This environment variable is undocumented, and you can
just use GTK_DEBUG=touchscreen insead.
2020-09-13 22:44:32 -04:00
Matthias Clasen
d2faa38eed Move version-related functions to gtkversion.c
This is just an internal cleanup, to make gtkmain.c
a bit less messy.
2020-09-13 22:23:06 -04:00
Matthias Clasen
ff9ca2b68d Clean up debug flags code a bit
Use the GtkDebugFlags enum, since we have it.
2020-09-13 22:10:25 -04:00
Matthias Clasen
aa5207b349 iconview: Small doc additions 2020-09-13 21:51:42 -04:00
Matthias Clasen
2b5b6e0885 Drop gtk_render_slider from headers
The function does not exist.
2020-09-13 21:51:42 -04:00
Matthias Clasen
93d9a2ceda colorchooser: Bring back gtk_color_chooser_widget_new
This was removed by accident in commit f392fbfb6d6f1116728b.
2020-09-13 21:51:42 -04:00
nana-4
f6e4486338 colorchooserwidget: Update default palette
This makes it completely in line with the new GNOME HIG color palette.

See https://gitlab.gnome.org/GNOME/gtk/-/issues/3146
2020-09-14 07:05:04 +09:00
Matthias Clasen
30c3a533f4 video: Make autoplay work
We were setting things up in the wrong order, so
autoplay had no effect when you using gtk_video_set_file().
2020-09-13 01:56:56 -04:00
Matthias Clasen
22257b124a placessidebar: Remove a pointless restriction
The sidebar was refusing to show shortcuts for
things that don't have a local path, for no
good reason.
2020-09-13 01:14:00 -04:00
Matthias Clasen
4629182246 filechooser: Fix setting unlisted filters
This is documented to work, but it was broken
when we ported things to list models.
2020-09-13 01:12:51 -04:00
Matthias Clasen
c8a9e7fa82 Fix a compiler warning 2020-09-13 01:12:39 -04:00
Matthias Clasen
b534752d5c Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3110 and #2994

See merge request GNOME/gtk!2565
2020-09-12 16:25:17 +00:00
Matthias Clasen
929a56e53c Clean up lots of GTK+ -> GTK
Replace most remaining uses of GTK+ in the docs and
user-visible strings by GTK. Also remove some leftover
"Was added in 3.x" sentences from the docs.
2020-09-12 12:01:04 -04:00
Matthias Clasen
0011a1032d text: Claim the sequence when we start selecting
Without this, drag-select will only work sporadically
in entries in headerbars.

Fixes: #2994
2020-09-12 11:18:36 -04:00
Matthias Clasen
38b71ba292 Cosmetics
Add a missing comma.
2020-09-12 11:11:28 -04:00
Matthias Clasen
756c52ef08 filechooser: Prevent a crash
With csd, we are handling external widgets when
there is an entry in the headerbar. Use a weak ref
to prevent that pointer from going stale. This fixes
a crash when cancelling a save dialog.

Fixes: #3110
2020-09-12 10:40:13 -04:00
Emmanuele Bassi
25bcec5cbb Properly annotate GtkLayoutManagerClass.create_layout_child()
We're missing the ownership transfer rule for the created GtkLayoutChild
instance; this makes the virtual function not introspectable.

Fixes: #3156
2020-09-12 14:33:24 +01:00
Matthias Clasen
e55bdf87b5 Merge branch 'text-layout-speedup' into 'master'
textlayout: Avoid some iter comparisons

See merge request GNOME/gtk!2561
2020-09-11 21:20:38 +00:00
Matthias Clasen
c09575d9cb textlayout: Avoid some iter comparisons
We were doing more iter comparisons than necessary in the
inner loop of gtk_text_layout_snapshot(), in the presence
of a selection. Rewrite the code to compare line numbers
instead, which is faster than full iter comparisons.
2020-09-11 16:41:42 -04:00
Matthias Clasen
ff392fbfb6 colorchooser: Don't parse color names needlessly
We have a fancy macro to initialize GdkRGBAs without
any runtime work, lets use them.
2020-09-11 09:31:17 -04:00
Matthias Clasen
498cbae95c colorchooser: Drop color names
These were not used anymore, after a11y stopped using them.
2020-09-11 09:12:34 -04:00
Matthias Clasen
fa9608fd02 color chooser: Don't show too many custom colors
The code was hardcoding a fixed number of custom
colors, but we really want to match the number
of columns in the palette(s). Make it so.
2020-09-11 08:42:03 -04:00
Jakub Steiner
8700e136da colorChooser: updte color palette
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3146
2020-09-11 10:47:24 +02:00
Matthias Clasen
93078e52c0 gdk: Rename GdkSurfaceState to GdkToplevelState
That is what it is.

Fixes: #2790
2020-09-10 00:39:03 -04:00
Matthias Clasen
d47d036663 search entry: Don't propagate handled events
When the text says it has handled the event,
trust it. We don't want to emit ::search-started
if the content hasn't changed, but we still
should not propagate e.g. an Insert key press
if it has already toggled overwrite mode in
the text.

Fixes: #2874
2020-09-09 22:26:27 -04:00
Benjamin Otte
cb5b375f43 revealer: Remove arbitrary 100x scale limit
This is no longer necessary because the bug it was rying to solve is now
solved via the preference for min and nat size.
2020-09-09 17:38:37 +02:00
Benjamin Otte
dfccaa8831 revealer: Prefer min and nat size
Assume that the fully expanded revealer will likely get an allocation
that matches the child's minimum or natural allocation, so we
special-case these two values.

So when - due to the precision loss - multiple sizes would match the
current allocation, we don't pick one at random, we prefer the min and
nat size.

The preference of nat size over min sie was decided after an IRC vote,
we don't actually have an idea what's more likely to happen in the real
world.
Should we ever get better data, we might want to switch.
2020-09-09 17:38:37 +02:00
Benjamin Otte
cc58956dbb revealer: Use floor(), not ceil()
We use ceil() in measure(), so using it again will increase the
child's size whenever there is even a tiny rounding error.

This should also not make the size too small, because:
min = ceil(child_min * scale)
min / scale >= child_min
floor (min / scale) >= floor (child_min) = child_min
The last equality is because child_min is an integer.

Fixes #3137
2020-09-09 17:38:37 +02:00
Benjamin Otte
0ad10ccf39 revealer: Refactor code
Assign the values in the same place.
2020-09-09 17:38:37 +02:00
Benjamin Otte
8cb03a8cc0 widget: Add a critical when allocation is too small. 2020-09-09 17:38:37 +02:00
Emmanuele Bassi
f4b410daa7 Make sure we don't call back into GtkEntryBuffer
After commit 7e77afe94c moved the deletion
of text into the signal handler, in order to make undo work, we need to
override the GtkEntryBuffer::deleted-text class closure when subclassing
GtkEntryBuffer, as well as overriding GtkEntryBufferClass.delete_text,
otherwise the default class closure will be invoked, and will try to
delete an empty buffer.

Fixes: #3140
2020-09-09 11:29:16 +01:00
Chun-wei Fan
3095bccd2e gtksecurememory.c: Port secure memory allocation to Windows
Use the Windows API CryptProtectMemory() to encrypt the data that we want to
secure, and use CryptUnprotectMemory() to de-crypt the secured data that we
want to access, since mmap() and mlock() are not available on Windows.
2020-09-09 13:50:15 +08:00
Chun-wei Fan
c72b2f6167 gtksecurememory.c: Don't include unistd.h unconditionally
It is not universally available on non-POSIX systems.
2020-09-09 13:48:33 +08:00
Emmanuele Bassi
ae97284409 docs: Add a note on GtkPasswordEntry's secure storage 2020-09-08 23:50:12 +01:00
Emmanuele Bassi
7cda32d49e Use GtkPasswordEntryBuffer in GtkPasswordEntry
Now that we have a secure buffer, we should start using it.

Fixed: #3119
2020-09-08 23:50:12 +01:00
Emmanuele Bassi
fb99bde840 Add a secure GtkEntryBuffer
We have a widget for password and passphrase entries, but we have no way
to handle the data securely. This is usually performed by a separate
GtkEntryBuffer—for instance, the one in GCR. While we have API for
setting a new entry buffer on GtkText, we don't have API for
GtkPasswordEntry, though, so the options are:

 - expose additional API for GtkPasswordEntry to allow setting a secure
   text buffer on the internal GtkText widget
 - provide a secure text buffer out of the box

Given that an insecure-by-default GtkPasswordEntry is basically
pointless, might as well have a secure buffer built in.

We don't really need to make the password entry buffer public out of the
box, but we can re-evaluate at a later date.

Fixes: #2403
2020-09-08 23:50:12 +01:00
Emmanuele Bassi
9dc5c6a0f3 Move g_autoptr macro for GtkEntryBuffer
We need it into its own header, so we can derive from GtkEntryBuffer
with G_DECLARE_* macros without including gtk.h.
2020-09-08 23:50:12 +01:00
Emmanuele Bassi
31a7574544 Import egg-secure-memory allocator from gcr
We can re-use the code inside gcr, as we know that it's working, tested,
and license compatible.
2020-09-08 23:50:12 +01:00
Matthias Clasen
cb2b0688ca Merge branch 'filter-constructors' into 'master'
Filter constructors

See merge request GNOME/gtk!2360
2020-09-08 12:58:27 +00:00
Matthias Clasen
5a8267dfae text: Set the hotspot for the drag icon
This makes the drag icon align properly with the
dragged text at the beginning of the drag.
2020-09-07 11:18:45 -04:00
Matthias Clasen
bc80ed4240 aboutdialog: Disable text undo
The text buffers here are not editable, so it
does not make sense to have text undo enabled
for them.

Fixes: #3123
2020-09-06 17:02:00 -04:00
Matthias Clasen
4d45c2669c text history: Update state when enabled changes
This makes can-undo go FALSE when we disable the
text history, as it should.
2020-09-06 17:02:00 -04:00
Matthias Clasen
06c866f45e Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2538
2020-09-06 19:38:56 +00:00
Matthias Clasen
adc9d91e0e text: Stop drag updates when a dnd starts
This prevents the selection from changing underneath
us, messing up move dnd operations.
2020-09-06 12:19:44 -04:00
Matthias Clasen
1150c23b0f Merge branch 'listwidgets-doc-fix' into 'master'
docs: Update list widgets docs

See merge request GNOME/gtk!2537
2020-09-06 15:53:59 +00:00
Matthias Clasen
9b8c175f23 textview: Fix dnd
When we start a dnd of the selection in the drag-update handler,
set the gesture state to denied. Otherwise, we get more drag-update
signals, and things get really confused, leading to no dnd and
sadness.
2020-09-06 11:48:10 -04:00
Andreas Persson
e0134aaf15 docs: Update list widgets docs
Removed sentence that claimed the view will wrap the model in a
GtkSingleSelection, as it's no longer true. Fixed the code example in
GtkListView for the same reason. Fixed a small typo in GtkDropDown docs.
2020-09-06 17:19:24 +02:00
Matthias Clasen
a4ba25f0f8 inspector: Fix teardown of the general tab
We were connecting signal handlers to the display
and seats here, and never cleaning them up, leading
to crashes after the inspector is closed. This is
fairly easy to reproduce under Wayland, where the
scroll device is only created the first time we
create a scroll event.
2020-09-05 22:35:30 -04:00
Matthias Clasen
24389a0ef5 Make sorter constructors return exact types
Make functions like gtk_custom_sorter_new() return
the actual type they construct.

Update all callers.
2020-09-05 21:50:15 -04:00
Matthias Clasen
dfabe74c59 Make filter constructors return exact types
Make functions like gtk_custom_filter_new() return
the actual type they construct.

Update all callers.
2020-09-05 21:43:42 -04:00
Matthias Clasen
727f25f6da Merge branch 'revert-43ca43a22f' into 'master'
Revert "Adwaita: rich-list styling"

See merge request GNOME/gtk!2533
2020-09-05 16:00:33 +00:00
nana-4
12afc10ec3 Revert "Adwaita: rich-list styling"
This reverts commit 2f0a4c7128.

It seems the commit was accidentally added when
768e24afc1 was manually merged and pushed.
2020-09-05 23:13:24 +09:00
Matthias Clasen
ffc77ca926 css: Use an array when parsing selectors
There's no need for us to have a hard size-limit here;
with GdkArray we don't have to give up on stack-preallocation
either.
2020-09-05 09:51:59 -04:00
Matthias Clasen
635492b016 text: Don't replace unselected text with Emoji
We must be careful to not select everything on focus-in
before we have the Emoji inserted. This was accidentally
broken in d5121af876.

Fixes: #3122
2020-09-05 08:40:02 -04:00