Commit Graph

1524 Commits

Author SHA1 Message Date
Emmanuele Bassi
6719d3044d Add parsing for GtkAlternativeTrigger
Alternative triggers are separate by a pipe character.
2020-03-27 14:35:00 +00:00
Emmanuele Bassi
c75fdda8dd tests: Add more cases for the trigger parser 2020-03-27 13:57:19 +00:00
Emmanuele Bassi
6e8c78714d Turn GtkShortcutAction into a GObject
Just like we did for GtkShortcutTrigger.

This allows language bindings to properly deal with all the actions.
2020-03-25 23:14:45 -04:00
Emmanuele Bassi
457b6657bb Turn GtkShortcutTrigger into an object
The lightweight inheritance mechanism used for GtkShortcutTrigger is not
going to be usable by bindings, because boxed types cannot have derived
types.

We could use GTypeInstance and derive everything from that, like
GParamSpec, but in the end shortcuts are not really a performance
critical paths, unlike CSS values or render nodes.
2020-03-25 23:14:45 -04:00
Matthias Clasen
d66121c61e Drop the keyhash test
GtkKeyHash is going away.
2020-03-25 23:14:45 -04:00
Matthias Clasen
586e7749d5 shortcuttrigger: Do elaborate matching for key events
Copy the logic from GtkKeyHash for matching key events
to shortcuts.

Adapt shortcuts test to work with the better matching,
by creating more complete key events.
2020-03-25 23:14:45 -04:00
Matthias Clasen
904835d4b1 shortcuttrigger: Introduce partial matches
Allow GtkShortcutTrigger to return partial matches.
Currently, no triggers produce such results, and
GtkShortcutController treats partial matches like
exact ones.
2020-03-25 23:14:45 -04:00
Matthias Clasen
cb821d5df3 Add tests for shortcut actions 2020-03-25 23:14:45 -04:00
Matthias Clasen
ff056af249 Add a test for shortcut triggers 2020-03-25 23:14:45 -04:00
Matthias Clasen
778d884f70 Use an action for the context menu keybinding
The ::popup-menu signal is going away.
2020-03-25 23:14:44 -04:00
Benjamin Otte
cac39526a9 testsuite: Remove GtkAccelGroup usage 2020-03-25 23:14:28 -04:00
Benjamin Otte
90a34312d4 accel: Add display arg to gtk_accelerator_parse_with_keycode()
It was using the default display unconditionally.
2020-03-25 23:14:28 -04:00
Benjamin Otte
580863b112 accelerators: Make gtk_accelerator_parse() return TRUE/FALSE
A parse function should return success or not. So do that.
2020-03-25 23:14:28 -04:00
Benjamin Otte
cd0332aad5 shortcut: Add GtkShortcutAction
Similar to GtkShortcutTrigger, GtkShortCutAction provides all the
different ways to activate a shortcut.

So far, these different ways are supported:

 - do nothing
 - Call a user-provided callback
 - Call gtk_widget_activate()
 - Call gtk_widget_mnemonic_activate()
 - Emit an action signal
 - Activate an action from the widget's action muxer
2020-03-25 23:14:27 -04:00
Benjamin Otte
9a03c8b4d8 gtk: Remove bindings
The whole binding functionality is now handled by shortcuts.
2020-03-25 23:14:27 -04:00
Matthias Clasen
6d452f1eb8 shortcut: Add GtkShortcutTrigger
Triggers are meant to describe how to trigger a shortcut.
So far only a keyval + modifiers trigger exists.
2020-03-25 22:36:03 -04:00
Matthias Clasen
5870d9d72a testsuite: Set NO_AT_BRIDGE for gtk tests
The a11y stack insists on spewing hard to control warnings
that make our tests fail. So, no accessibility for gtk tests :(
2020-03-25 17:03:58 -04:00
Marc-Antoine Perennou
eb8e0910c3 testsuite/gtk/flattenlistmodel.c: fix build
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2020-03-22 10:53:59 +01:00
Christian Hergert
ccac404f28 widget: fix class private data usage to be _init() safe
Before this commit, adding GtkWidgetAction to class private data would
require copying the actions to each subclass as they were built or
modified. This was convenient in that it is a sort of "copy on write"
semantic.

However, due to the way that GTypeInstance works with base _init()
functions, the "g_class" pointer in GTypeInstance is updated as each
_init() function is called. That means you cannot access the subclasses
class private data, but only the parent class private data.

If instead we use a singly linked list of GtkWidgetAction, each subclass
has their own "head" yet all subclasses share the tail of the
GtkWidgetAction chain.

This creates one bit of complexity though. You need a stable way to know
which "bit" is the "enabled" bit of the action so we can track enabled
GAction state. That is easily solved by calculating the distance to the
end of the chain for a given action so that base classes sort ahead of
subclasses. Since the parent class always knows its parent's actions, the
position is stable.

A new dynamic bitarray helper also helps us avoid allocations in all the
current cases (up to 64 actions per widget) and dynamically switches to
malloc if that is to ever be exceeded.
2020-03-20 11:17:56 -07:00
Matthias Clasen
c7caa53917 testsuite: disable performance tests
For some reason, these tests are flaky in ci,
they always work locally for me. So, until
we use the data these tests produce for something,
lets just turn them off.
2020-03-20 13:47:58 -04:00
Matthias Clasen
9eda683060 testsuite: Fix an a11y test
The derive test wasn't producing TAP, so
running it as part of a tap testsuite wasn't
going well. Fix that.
2020-03-20 12:09:21 -04:00
Matthias Clasen
cbb0ca4902 testsuite: Tell meson we use TAP
This makes meson actually parse the individual test
results. Most of the time, it does not make a difference,
but one case where it does is when all the individual
tests of a binary are skipped, meson will mark the
test as skipped.
2020-03-20 11:55:26 -04:00
Matthias Clasen
9403f44aef reftests: Fix an xfail to work
The background-image-multiple.ref.ui file uses
non-existing properties, which gives us a g_warning,
and the glib test framework insists on treating
warnings as fatal, so we end up doing exit(133),
which in turn makes the meson TAP parser ignore
its xfails.

Comment out the nonexisting properties, so we can
fail properly, and then in turn xfail properly.
2020-03-20 11:55:26 -04:00
Matthias Clasen
dc4b7131f1 testsuite: Don't exit unsuccessfully when using TAP
The meson TAP parser doesn't take this lightly and
forgets all about xfails when we exit(1), so don't.
2020-03-20 11:55:26 -04:00
Matthias Clasen
c893f79023 reftests: Don't run tests with --verbose
Unexpected output tends to break TAP.
2020-03-20 10:43:25 -04:00
Matthias Clasen
cf7dc5b2bb testsuite: Don't g_print from tests
This breaks the TAP output.
2020-03-20 10:03:04 -04:00
Matthias Clasen
068ec58287 testsuite: Fix the accessible test
This test was happily doing nothing.
2020-03-20 10:03:04 -04:00
Matthias Clasen
f6fc3073fb temporarily disable window test
This test was broken by the GdkToplevel refactoring,
and needs a big gtkwindow.c configure request cleanup
before it will work again.
2020-03-19 18:08:06 -04:00
Matthias Clasen
31db615885 Revert "Merge branch 'disable-window-test' into 'master'"
This reverts commit 3ac4c76b18, reversing
changes made to 6ec96d2e98.
2020-03-19 18:03:16 -04:00
Matthias Clasen
89b537bd8a Fix the action test
We have a test that enumerates the GtkText actions,
so when a new open appears, the test needs to be updated.
2020-03-19 14:29:37 -04:00
Matthias Clasen
2e70b4c323 temporarily disable window test
This test was broken by the GdkToplevel refactoring,
and needs a big gtkwindow.c configure request cleanup
before it will work again.
2020-03-19 11:25:38 -04:00
Benjamin Otte
93bb3f7144 testsuite: Remove GtkAccelGroup usage 2020-03-18 23:00:51 -04:00
Benjamin Otte
94ef20ea36 accel: Add display arg to gtk_accelerator_parse_with_keycode()
It was using the default display unconditionally.
2020-03-18 23:00:51 -04:00
Benjamin Otte
87df17e4ce accelerators: Make gtk_accelerator_parse() return TRUE/FALSE
A parse function should return success or not. So do that.
2020-03-18 23:00:51 -04:00
Benjamin Otte
0c81698911 shortcuts: Mananage managed shortcuts with a custom model
Reduce the amount of special casing by using a list model
for global and managed shortcuts, too.

This way, the ListModel API will work for the ShortcutController in the
GtkShortcutManager and GtkRoot.

The only special case remaining is shortcut activation, which needs to
pass the right widget to the controller in the global/managed case.
2020-03-18 23:00:51 -04:00
Benjamin Otte
e6d0560a82 shortcut: Add GtkShortcutAction
Similar to GtkShortcutTrigger, GtkShortCutAction provides all the
different ways to activate a shortcut.

So far, these different ways are supported:

 - do nothing
 - Call a user-provided callback
 - Call gtk_widget_activate()
 - Call gtk_widget_mnemonic_activate()
 - Emit an action signal
 - Activate an action from the widget's action muxer
 - Activate a GAction
2020-03-18 23:00:51 -04:00
Benjamin Otte
fb99f834e6 gtk: Remove bindings
The whole binding functionality is now handled by shortcuts.
2020-03-18 23:00:50 -04:00
Matthias Clasen
78f9940ddc shortcut: Add GtkShortcutTrigger
Triggers are meant to describe how to trigger a shortcut.
So far only a keyval + modifiers trigger exists.
2020-03-18 23:00:49 -04:00
Matthias Clasen
33db28c288 Merge branch 'fix-tools-tests' into 'master'
Fix tools tests

See merge request GNOME/gtk!1524
2020-03-13 20:36:54 +00:00
Matthias Clasen
7db490ef2a testsuite: Specify the test protocol
If we don't specify protocol: 'tap', meson things
all is good even though my test yells "not ok".
2020-03-13 15:53:19 -04:00
Matthias Clasen
8b1301cecd Update the ui file conversion output
This changed because the popover property got renamed.
2020-03-13 15:53:19 -04:00
Matthias Clasen
bc6953a081 testsuite: Update the settings test output 2020-03-13 15:53:19 -04:00
Matthias Clasen
4b71ed3f5e testsuite: Update tools tests
These tests need to test GTK4 ui file syntax.
2020-03-13 15:34:54 -04:00
Matthias Clasen
8fd51d761b testsuite: Actually run tools tests
The script was looking in the wrong place for the tests.
2020-03-13 15:11:07 -04:00
Matthias Clasen
66a0a8d53e Merge branch 'wip/baedert/test-cflags' into 'master'
Pass (almost) all our cflags to tests, testsuite, examples, demos, ...

See merge request GNOME/gtk!1516
2020-03-13 18:40:46 +00:00
Matthias Clasen
e7ef4a57ca testsuite: Stop using type-hints 2020-03-11 19:36:04 -04:00
Matthias Clasen
aec3705717 testsuite: Stop using type-hint 2020-03-11 19:35:56 -04:00
Matthias Clasen
c488e86caa testsuite: Update a11y test output 2020-03-11 19:35:55 -04:00
Matthias Clasen
ad322c154c testsuite: Stop using GtkSpinner::active
This property was renamed to ::spinning.
2020-03-11 19:35:55 -04:00
Matthias Clasen
d70c9453ba disable popover test
This is failing atm
2020-03-11 19:35:55 -04:00
Timm Bäder
7553649c47 testsuite/gtk: Add common_cflags to build
With a few exceptions.
2020-03-07 16:28:04 +01:00
Timm Bäder
6fcd5d5ab5 testsuite/reftests: Add common_cflags to build 2020-03-06 18:24:58 +01:00
Timm Bäder
e759358402 testsuite/a11y: Add common_cflags to build 2020-03-06 18:22:01 +01:00
Timm Bäder
01bd7910ce testsuite/css: Add common_cflags to build
And fix all the errors coming from that.
2020-03-06 18:22:01 +01:00
Timm Bäder
79c60bb7fd testsuite/gdk: Add common_cflags to build 2020-03-06 18:22:01 +01:00
Timm Bäder
b3c332ad9c testsuite/performance: Add common_cflags to build 2020-03-06 18:22:01 +01:00
Timm Bäder
83982a28e7 testuite/gsk: Add common_cflags to build
And fix all the warnings and errors.
2020-03-06 18:22:01 +01:00
Benjamin Otte
b1a257c0c3 reftest: Plug memleak 2020-03-06 05:52:44 +01:00
Benjamin Otte
b231a40106 testsuite: Avoid passing NULL to strcmp()
Use g_strcmp0() instead.
2020-03-06 05:43:56 +01:00
Benjamin Otte
a411959c91 droptarget: Redo
This is a huge reorganization of GtkDropTarget. I did not know how to
split this up, so it's unfortunately all one commit.

Highlights:

- Split GtkDropTarget into GtkDropTarget and GtkDropTargetAsync
  GtkDropTarget is the simple one that only works with GTypes and offers
  a synchronous interface.
  GtkDropTargetAsync retains the full old functionality and allows
  handling mime types.

- Drop events are handled differently
  Instead of picking a single drop target and sending all DND events to
  it, every event is sent to every drop target. The first one to handle
  the event gets to call gdk_drop_status(), further handlers do not
  interact with the GdkDrop.
  Of course, for the ultimate GDK_DROP_STARTING event, only the first
  one to accept the drop gets to handle it.
  This allows stacking DND event controllers that aren't necessarily
  interested in handling the event or that might decide later to drop
  it.

- Port all widgets to either of those
  Both have a somewhat changed API due to the new event handling.
  For the ones who should use the sync version, lots of cleanup was
  involved to operate on a sync API.
2020-03-02 03:18:55 +01:00
Benjamin Otte
d9fa839097 testsuite: Use g_assert() in tests 2020-03-02 03:18:55 +01:00
Matthias Clasen
fa75d7f480 builder-tool: Fix a thinko
We can't rely on the pspec for a removed property.
This code worked until I actually removed the properties.

Update the tests to reflect this.
2020-02-26 10:01:38 -05:00
Matthias Clasen
37a2cae10e Small fixups
Trying to get the ci style test to pass.
2020-02-26 08:13:45 -05:00
Matthias Clasen
b5bacb3be6 Drop the margin property
Replace it with margin-start, -end, -top, -bottom throughout.
2020-02-25 20:59:04 -05:00
Matthias Clasen
a9c05193a7 Drop the expand property
The hexpand and vexpand properties are sufficient.
2020-02-25 18:29:15 -05:00
Matthias Clasen
2d4e1e248d update testsuite
Update the expected results of the tools tests that are
affected by the new property handling for expand and margin.
2020-02-25 18:28:55 -05:00
Matthias Clasen
648a67085f testsuite: Remove outdated exclusions
There were mentions of GtkCList and GtkColorSelection
in these test. The memories!
2020-02-24 23:08:34 -05:00
Matthias Clasen
a43d13aa74 popover: Drop ::relative-to
It is enough to just set the parent (and make the parent
call gtk_native_check_resize in size_allocate).

This commit removes the relative_to argument to the
constructors of GtkPopover and GtkPopoverMenu, and
updates all callers.
2020-02-24 20:46:41 -05:00
Matthias Clasen
7f46b25c04 Merge branch 'wip/ebassi/filechooser-new' into 'master'
Clean up the GtkFileChooser API

Closes #2455

See merge request GNOME/gtk!1454
2020-02-24 00:32:23 +00:00
Benjamin Otte
cc7c1fe108 gdk: Remove GdkAtom
finally!!!!!
2020-02-23 01:59:26 +01:00
Emmanuele Bassi
4a3742979d Remove GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
We don't need a whole separate action, now that the file chooser widget
can create folders; we can create use SELECT_FOLDER and create one.
2020-02-22 15:22:06 +00:00
Emmanuele Bassi
b09e7df81b Remove GtkFileChooser:local-only
Now that the whole API goes through GFile we don't have the weird split
between local-only and non-local-only modes.
2020-02-22 15:22:06 +00:00
Benjamin Otte
6f0a0ce7f1 testsuite: Don't use g_return_if_fail()
Use g_assert()
2020-02-22 07:44:52 +01:00
Benjamin Otte
18d7187e4b testsuite: Don't use return_if_fail()
Use assert() instead
2020-02-22 07:35:23 +01:00
Benjamin Otte
2a8fd25a4b testsuite: Check proper notify emissions, too
This is in particular relevant for the ::is-focus property, because
updating that one doesn't cause enter/leave events.

But it also checks that notify and enter/leave happen in the right
order.
2020-02-22 07:33:40 +01:00
Benjamin Otte
7597f6b594 transform: Don't crash for gsk_transform_transform (id, id)
See attached tests
2020-02-21 18:30:13 +01:00
Benjamin Otte
b50093d044 transform: Make sure the identity transform is equal to NULL 2020-02-21 18:25:05 +01:00
Matthias Clasen
cadeca74e2 Go back to ::enter/::leave for pointer changes
These signals are behaving a little differently from
what ::focus-in/::focus-out used to do.
2020-02-21 00:51:03 -05:00
Matthias Clasen
5a2f829a40 Split off GtkEventControllerFocus
Split the focus tracking into a separate
GtkEventControllerFocus, and change the API one more time.
We are back to having ::focus-in and ::focus-out signals.

Update all users.
2020-02-21 00:51:03 -05:00
Matthias Clasen
4098653974 Update the focus test
This needs an update to handle the new focus-change signal.
2020-02-21 00:51:03 -05:00
Matthias Clasen
4cf63f3eb3 wip: Use event constructors in the testsuite
This doesn't work because the constructors aren't exported,
so remove the gestures text temporarily, until we figure
out how to deal with it.
2020-02-21 00:40:52 -05:00
Matthias Clasen
9330158f11 Make a11y testsuite pass 2020-02-21 00:39:12 -05:00
Timm Bäder
5097c1defc Merge branch 'file-filter-name-property' into 'master'
GtkFileFilter: Add a GObject property for the name

See merge request GNOME/gtk!376
2020-02-19 07:43:51 +00:00
Matthias Clasen
66307f00f1 icontheme: Update the api
Add properties, and use string arrays instead of lists.

Among other things, this renames gtk_icon_theme_list_icons
to gtk_icon_theme_get_icon_names.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2410
2020-02-18 20:32:17 -05:00
Matthias Clasen
723b894c19 testsuite: Stop using gdk_surface_new_temp
We can just use regular toplevels here.
2020-02-14 21:19:29 +01:00
Benjamin Otte
222e6e5d6e testsuite: Use GtkTextDirection instead of GtkWindowType
GtkWindowType is aout to be dropped, so use another enum for the enum
tests - one that is likely to survive for a long time.
2020-02-14 21:18:49 +01:00
Benjamin Otte
a278edab22 window: Remove type argument from gtk_window_new() 2020-02-14 21:18:49 +01:00
Benjamin Otte
c2bd4bc3cb testsuite: Replace popups with toplevels
The tests do not depend on the window being a popup.
2020-02-14 21:18:49 +01:00
Benjamin Otte
fb856d96cd builder: Use different construct-only property
The window type is going away, so use the css name instead.
2020-02-14 21:18:49 +01:00
Benjamin Otte
ad23ce23ad testsuite: Remove popup property from simplify tools
I'm not even sure a popup GtkAssistant should be a thing...
2020-02-14 21:18:49 +01:00
Benjamin Otte
41bdf16b23 testsuite: Turn all CSS test ui files into regular windows
Use undecorated windows instead of popups.
2020-02-14 21:18:49 +01:00
Benjamin Otte
2c843362a0 testsuite: Make a11y tests use regular windows 2020-02-14 21:18:49 +01:00
Benjamin Otte
980934f82d reftests: Change popup windows to non-decorated windows
This allows getting rid of popup windows.
2020-02-14 17:54:38 +01:00
Benjamin Otte
d303b5b0eb slicelistmodel: Fix two wrong computations
Both of those are thinkos during math.
Found by Mohammed Sadiq.

Testcases triggering both have been added.
2020-02-14 03:15:22 +01:00
Matthias Clasen
cdee2ac173 testsuite: Handle icontheme test better
Skip just the failing tests in release builds.
2020-02-13 10:56:26 -05:00
Matthias Clasen
47f2a6cafd Remove border-half-pixel reftest from xfail
It passes both locally and on ci now.
2020-02-13 09:39:27 -05:00
Benjamin Otte
75b130ed6b testsuite: Add tests for rounded rect code
... including the bug that was fixed in the parent commit.
2020-02-13 07:36:38 +01:00
Benjamin Otte
16e38701b6 testsuite: Don't use gdk_cairo_get_clip_rectangle()
I want to remove it.
2020-02-13 06:15:44 +01:00
Benjamin Otte
9d8ceb0cb2 testsuite: Don't destroy surfaces that are still used
Coercing the surfaces must not unref the old surface, because the old
surface is going to be saved to a file.
2020-02-13 06:15:44 +01:00
Benjamin Otte
c313a71c3a testsuite: Remove accidentally checked in file
This file should go in the listview branch I guess.
2020-02-13 06:14:05 +01:00