Commit Graph

3450 Commits

Author SHA1 Message Date
Alexander Mikhaylenko
b7bfb29ae8 tests: Fix print-editor
Don't assume GtkWindow is a container.
2020-05-11 02:17:42 +05:00
Timm Bäder
57444f77f7 testtreeview: Properly annotate a switch fallthrough 2020-05-10 08:44:20 +02:00
Matthias Clasen
82e92582bd tests: Stop using ::size-allocate 2020-05-06 14:27:45 -04:00
Matthias Clasen
cac514f647 testtooltips: Derive demo from GtkWidget 2020-05-04 22:53:08 -04:00
Matthias Clasen
ec394e805b Use gtk_combo_box_set_child throughout 2020-05-04 22:53:08 -04:00
Matthias Clasen
44f9a51827 testkineticscrolling: Make this work again
There was an errant g_free here, and lots of
redundant gtk_widget_show.
2020-05-04 22:53:08 -04:00
Matthias Clasen
e2781af16f testgtk: Fix g_object_new use
This is the kind of thing that happens with varargs apis.
2020-05-04 22:53:08 -04:00
Matthias Clasen
77af8e303d Use gtk_overlay_set_child throughout
Replace all uses of gtk_container_add on overlays
by gtk_overlay_set_child.
2020-05-04 22:53:08 -04:00
Matthias Clasen
12ecbd1508 listboxrow: Derive from GtkWidget
We want to remove GtkBin and GtkContainer as they don't
provide much useful functionality anymore.

See #2681
2020-05-04 22:53:08 -04:00
Matthias Clasen
b8d1a9eb0d flowboxchild: Derive from GtkWidget
We want to remove GtkBin and GtkContainer as they don't
provide much useful functionality anymore.

See #2681
2020-05-04 22:53:08 -04:00
Matthias Clasen
649ae635a7 Use gtk_revealer_set_child throughout
Replace all uses of gtk_container_add on revealers
with gtk_revealer_set_child.
2020-05-04 22:53:08 -04:00
Matthias Clasen
f59f355190 Use gtk_window_set_child throughout
Replace all uses of gtk_container_add on windows
by gtk_window_set_child.
2020-05-04 22:53:08 -04:00
Matthias Clasen
af6e0ee2b3 Use gtk_button_set_child throughout
Replace all uses of gtk_container_add on buttons
by gtk_button_set_child.
2020-05-04 22:53:07 -04:00
Matthias Clasen
67759d4c3e Use gtk_scrolled_window_set_child throughout
Replace all uses of gtk_container_add on popovers
by gtk_scrolled_window_set_child.
2020-05-04 22:53:07 -04:00
Matthias Clasen
8e261056b9 Use gtk_popover_set_child throughout
Replace all uses of gtk_container_add on popovers
by gtk_popover_set_child.
2020-05-04 22:53:07 -04:00
Matthias Clasen
e9ddf0fda5 Use gtk_viewport_set_child throughout
Replace all uses of gtk_container_add on viewports
by gtk_viewport_set_child.
2020-05-04 17:01:18 -04:00
Matthias Clasen
1706b80815 Use gtk_frame_set_child throughout
Replace all uses of gtk_container_add for
frames with gtk_frame_set_child.
2020-05-04 17:01:18 -04:00
Matthias Clasen
92ac66f16a testframe: Drop padding
No need to emulate features that GtkFrame no longer has.
2020-05-04 07:37:38 -04:00
Alexander Mikhaylenko
c2e4e1af73 headerbar: Remove user-settable title
Use window title, or custom title widget if it's set. Remove 'title'
property.

Update demos and tests to set the title on the window instead of
headerbar.
2020-05-01 19:48:05 +05:00
Alexander Mikhaylenko
35d50f88c8 headerbar: Remove subtitle
Also remove the box containing title and subtitle, as there's only one
label now.
2020-05-01 19:48:05 +05:00
Matthias Clasen
f8ef15b555 Add a quick sound test
Just to show that our media infrastructure is up
to playing little beeps and bings.
2020-04-29 10:54:40 -04:00
Matthias Clasen
8c0fbb2294 tests: Stop using focus adjustments
Set scroll-to-focus instead, in testgtk.
2020-04-18 14:52:50 -04:00
Matthias Clasen
b315dce757 Add a test for scroll-to-focus 2020-04-18 14:43:48 -04:00
Matthias Clasen
df1816a29c button: Drop relief
We are only using this as a boolean, so change it
to a boolean property named has-frame.
2020-04-17 10:57:36 -04:00
Matthias Clasen
edae2a8dc5 frame: Drop shadow-type
Frames that don't draw frames are not very useful,
so just drop the shadow-type property.
2020-04-17 10:57:36 -04:00
Matthias Clasen
285aa226e5 scrolledwindow: Drop shadow-type
We were only using this as a boolean, so change it
to a boolean property named has-frame.
2020-04-17 10:57:36 -04:00
Timm Bäder
4851081a77 label: Remove public pattern API 2020-04-17 15:21:00 +02:00
Matthias Clasen
03080f29b9 css: use :focus-visible instead of :focus(visible)
This is aligning our language with
https://www.w3.org/TR/selectors-4/
2020-04-15 23:09:36 -04:00
Matthias Clasen
443fd4d63d tests: Stop using gtk_get_current_ apis
Replace these by equivalent event controller
apis where needed.
2020-04-11 17:29:27 -04:00
Matthias Clasen
394ea32e93 Use gtk_widget_add/remove_css_class more
Replace most uses of gtk_style_context_add/remove_class
by the new APIs. The only remaining uses of the old API
are in save/restore situations.
2020-04-10 12:09:57 -04:00
Matthias Clasen
e8f30c836d tests: Stop using gtk_accelerator_set_default_mod_mask
This is not doing anything useful here.
2020-04-06 01:40:49 -04:00
Olivier Fourdan
3e1f59af61 gdk: Add gdk_toplevel_inhibit_system_shortcuts API
With the removal of grabs from the public API, we need a replacement API
to let applications bypass system keyboard shortcuts.

A typical use case for this API is remote desktop or virtual machine
viewers which need to inhibit the default system keyboard shortcuts so
that the remote session or virtual host gets those instead of the local
environment.

Close: https://gitlab.gnome.org/GNOME/gtk/issues/982
2020-03-30 18:25:36 +02: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
Benjamin Otte
7c4d8d49b6 testmenubutton: Don't create a GtkAccelGroup
It's unused.
2020-03-25 23:14:28 -04:00
Emmanuele Bassi
541c478eeb testgtk: Port keyval example to shortcut controllers 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
9a03c8b4d8 gtk: Remove bindings
The whole binding functionality is now handled by shortcuts.
2020-03-25 23:14:27 -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
Benjamin Otte
e944514664 testmenubutton: Don't create a GtkAccelGroup
It's unused.
2020-03-18 23:00:51 -04:00
Emmanuele Bassi
1a55f59f23 testgtk: Port keyval example to shortcut controllers 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
fb99f834e6 gtk: Remove bindings
The whole binding functionality is now handled by shortcuts.
2020-03-18 23:00:50 -04:00
Matthias Clasen
103ef3c195 tests: Stop using keep above/below 2020-03-14 15:16:56 -04:00
Matthias Clasen
d4f49a8cb9 tests: Stop sticking windows 2020-03-14 14:34:39 -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
a79b6fbf35 testgtk: Stop setting decorations and functions 2020-03-12 14:56:20 -04:00
Matthias Clasen
496bd5783c tests: Stop using gdk_surface_fullscreen 2020-03-12 14:56:20 -04:00
Matthias Clasen
8ea80801b4 testgtk: Stop using gdk_surface_set_icon_name
Its not useful api, and will disappear.
2020-03-12 14:56:20 -04:00
Matthias Clasen
8e0ad72875 testgtk: Stop using gdk_surface_get_state 2020-03-12 14:56:20 -04:00
Matthias Clasen
78d71eb439 Simplify surface move/drag api
Drop the with_device variants, and always pass a device.
2020-03-11 19:35:55 -04:00
Timm Bäder
d1cd6aacba tests: Add common_cflags to build
And fix all the errors and warnings resulting from that

See #2491
2020-03-06 18:21:58 +01:00
Benjamin Otte
3b8d9dbd28 testtreeview: Fix 19 year old use-after-free 2020-03-06 05:43:56 +01:00
Benjamin Otte
18b011a717 tests: Add a test for changing the hovered widget
The add/remove one crashes after a few enter/leave events.
2020-03-05 07:05:48 +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
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
9d80db29de Merge branch 'spinning-spinner' into 'master'
Rename GtkSpinner::active to ::spinning

See merge request GNOME/gtk!1475
2020-02-25 04:04:46 +00:00
Matthias Clasen
e73a40733f Rename GtkSpinner::active to ::spinning
And add a setter and getter. The old name was
confusing with the widget state of the same
name. 'Active' is just too overloaded.
2020-02-24 22:37:02 -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
Emmanuele Bassi
ff6772fd98 Remove preview widget from GtkFileChooser
The preview widget harks from a platform before time, when we didn't
have GIO, or a thumbnail specification.

Very few applications use it correctly, if at all; it has an horrid hack
to deal with the ownership of the widget's instance when accessed
through the getter function; it messes up the layout of the widget and
its label is less than useful when it comes to file names longer than a
dozen characters; it's a poor substitute for a proper thumbnail view.
2020-02-22 16:39:01 +00: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
Emmanuele Bassi
063ad28b1a Remove overwrite confirmation machinery from GtkFileChooser
Overwrite confirmation should not be optional, and it should not loop
into application code to create their own dialog and user response.
2020-02-22 15:22:06 +00:00
Emmanuele Bassi
d505573ee6 Drop GtkFileChooser:extra-widget
We have "choices" as a more rational (and portable) API; additionally,
the ownership semantics of the extra widget property getter are a hack.
2020-02-22 15:22:06 +00:00
Emmanuele Bassi
5f070ff233 Remove filename/URI API from GtkFileChooser
GtkFileChooser's API predates GIO by a few years, so it started off with
filenames and URI as character arrays. After introducing GIO as a
dependency, the API included GFile-based entry points.

It's much more appropriate to use GFile everywhere, as we want to
encourage people to use GIO instead of passing random bytes to low level
POSIX API.

See: #2455
2020-02-22 15:22:06 +00:00
Benjamin Otte
8a098b1343 tests: Guard variables with necessary macros 2020-02-22 07:44:52 +01:00
Matthias Clasen
b1eaa502df events: reorganize getters
Restructure the getters for event fields to
be more targeted at particular event types.

Update all callers, and replace all direct
event struct access with getters.

As a side-effect, this drops some unused getters.
2020-02-21 00:51:03 -05:00
Benjamin Otte
9660ae5556 Merge branch 'wip/xdg-popup-async-relayout' into 'master'
Synchronous popup layout

See merge request GNOME/gtk!1241
2020-02-19 18:57:14 +00:00
Jonas Ådahl
6eaeadb3b9 tests/popover: Add check box for switching autohide prop 2020-02-19 09:47:18 +01: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
Benjamin Otte
7ae5fd357c tests: Modernize testdnd2 2020-02-18 02:40:00 +01:00
Benjamin Otte
b8cf7ea1c6 dnd: Port the TreeModel machinery to GValue DND 2020-02-18 02:40:00 +01:00
Benjamin Otte
80ba7fd682 dragdest: Make gtk_drop_target_new() args be transfer full
Saves tons of code.
2020-02-17 04:04:21 +01:00
Benjamin Otte
e1f8c1430f dnd: simplify code
The old code did mimetype checks everywhere when type compatibility has
since been moved to the GtkDropTarget::accept signal.

So the code can now just assume a compatible mime type exists.
2020-02-17 04:04:21 +01:00
Benjamin Otte
dbad440468 testdnd3: Use GValue dnd 2020-02-16 20:10:30 +01:00
Benjamin Otte
8d2ed36a1b contentprovider: Add gdk_content_provider_new_typed()
Gets around the boilerplate required to create and initialize a GValue
by having this function doing it via G_VALUE_COLLECT().
2020-02-16 20:10:30 +01:00
Benjamin Otte
47c8026e38 Merge branch 'wip/otte/dnd' into 'master'
some DND fixes

See merge request GNOME/gtk!1440
2020-02-15 23:45:25 +00:00
Benjamin Otte
b844f34cda tests: Do proper local DND
Just transfer GValues.
2020-02-15 22:33:57 +01:00
Timm Bäder
8612a8a39f testinfobar: Stop using gtk_info_bar_get_content_area()
We have an easier way of adding widgets to the content area of an
infobar: Just gtk_container_add() them like usual.
2020-02-15 17:18:26 +01:00
Benjamin Otte
c1f71ee3e8 window: Remove GtkWindowType and window->type
And remove code that was making decisions on the type and just use
the part for toplevels.
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
Emmanuele Bassi
cdd7e4c5ec Add a notify function to GdkContentProvider
The callback-based content providers need a GDestroyNotify function to
free the data passed to them on construction, otherwise they are going
to leak.
2020-02-13 14:53:25 +00:00
Chun-wei Fan
6ec546be02 tests/frame-stats.c: Include stdlib.h
It is used for exit().
2020-02-11 20:59:04 +08:00
Matthias Clasen
59b935af38 Merge branch 'mainloop-cleanup' into 'master'
Mainloop cleanup

See merge request GNOME/gtk!1404
2020-02-10 14:32:09 +00:00
Alexander Larsson
1698369d52 Merge branch 'icon-theme-api-rework' into 'master'
Icon theme api rework

See merge request GNOME/gtk!1390
2020-02-10 12:45:56 +00:00
Alexander Larsson
904eecd1ed icon paintable: Replace get_filename and get_resource_path with get_file()
This returns a GFile which can represent both the above.
2020-02-10 12:33:17 +01:00
Matthias Clasen
a6c5466900 Stop using gtk_main and gtk_main_quit
Replace these calls with direct use of GMainContext api.
2020-02-09 23:12:32 -05:00
Timm Bäder
b9b5cae6d2 calendar: Remove day-selected-double-click signal
It doesn't really make sense to treat double clicks here different than
single clicks (and is bad UX), and it also breaks switching months by
quickly trying to single-click the last/first days in the calendar.
2020-02-07 13:16:32 -05:00
Timm Bäder
8ef9009bde calendar: Remove month-changed signal
Listen to notify::month instead.
2020-02-07 13:16:32 -05:00
Timm Bäder
93c6f2256f calendar: Return a GDateTime from get_date() 2020-02-07 13:16:32 -05:00
Timm Bäder
74cb1ca2f5 calendar: Add accessors for display properties
Instead of having a display flags enum and bitfield, just add proper
accessors for the properties, which is what we do everywhere else.
2020-02-07 13:16:32 -05:00
Timm Bäder
e94e703685 testcalendar: Remove unused function 2020-02-07 13:16:32 -05:00
Timm Bäder
4cceba06bc calendar: Remove details
This is an unused feature that's way too complicated for a default
calendar widget and complicates the implementation a lot. Since we want
to eventually replace this with actual widgets, remove the details
support now.
2020-02-07 13:16:32 -05:00
Timm Bäder
3a727eed7a testcalendar: Close window properly 2020-02-07 13:15:59 -05:00
Benjamin Otte
44e153d8a8 GtkToolbar: remove 2020-02-07 14:08:26 +01:00
Benjamin Otte
e00030dff2 css: Remove .primary-toolbar
It's not used anywhere anymore.
2020-02-07 14:08:08 +01:00
Benjamin Otte
9cccb944ef css: Remove .inline-toolbar
It's not used anywhere anymore.
2020-02-07 14:08:08 +01:00
Alexander Larsson
2be29f982d Remove stray space 2020-02-07 08:44:46 +01:00
Alexander Larsson
6317fd3529 Replace last users of gtk_icon_paintable_download_texture ()
These now render the paintable to a cairo surface and convert that
to a texture. This is sort of a hack, but its only used in two
special cases internally and in two hacky test apps.
2020-02-06 17:47:56 +01:00
Alexander Larsson
d69f7fd63e IconTheme: Never fail a lookup or icon load
If icon lookup fails or if loading it fails later, just always
fall back to the built in image-missing icon. Nobody is handling
missing icons in a sane way anyway.

If you *truly* need to handle missing icons, you need to manually
use gtk_icon_theme_has_icon().

While changing the loading code I also fixed an issue where it
was always passing "png" to pixbuf, now it also handles "xpm" if
that is the filename suffix.
2020-02-06 09:38:25 +01:00
Matthias Clasen
ac7dd02f8f Merge branch 'master.msvc' into 'master'
Fix building recent GTK master on Visual Studio

See merge request GNOME/gtk!1369
2020-02-05 18:26:22 +00:00
Alexander Larsson
410541f82b Rename GtkIcon to GtkIconPaintable 2020-02-04 17:19:22 +01:00
Benjamin Otte
138de60ab2 icontheme: Remove GENERIC_FALLBACKS
Instead, rely on people passing fallbacks explicitly.

Alternatively, GThemedIcon provides the functionality to create
fallbacks, which is what GtkImage and the testsuite now use.
That method is slightly better, too, so the expected test results
have been updated accordingly.
2020-02-04 16:51:54 +01:00
Benjamin Otte
571021cbc1 icontheme: Pass fallbacks as optional argument to lookup_icon()
This way, we can remove gtk_icon_theme_choose_icon() completely.
2020-02-04 16:51:54 +01:00
Benjamin Otte
f7a5dd7b8b icontheme: Remove contexts
There is no way to query contexts or do anything useful with them.

So don't keep track of them and don't make them an argument in public
APIs with the docs saying "I don't know what to use here, maybe read
some spec somewhere".
2020-02-04 16:51:54 +01:00
Benjamin Otte
4b96ba592f icontheme: Remove gtk_icon_get_base_size() and gtk_icon_get_base_dir()
Those functions are unused and the documentation says "Returns some
random number that the icon theme creator chose" which does not seem at
all useful and an implementation detail.

So get rid of it.
2020-02-04 16:43:59 +01:00
Benjamin Otte
10023b5d6d icontheme: Remove GTK_ICON_LOOKUP_USE_BUILTIN
It's unused.
2020-02-04 16:41:36 +01:00
Benjamin Otte
bbbe39fb44 icontheme: Make text direction a lookup argument
Most users were just forgetting to set the proper flags.
And flags aren't the right way to set this anyway, it was just
acceptable as a workaround during GTK3 to not break API.
2020-02-04 16:41:36 +01:00
Benjamin Otte
b713b9f68d icontheme: Remove async APIs
Widgets would not use them properly. In fact, the only user was using
them wrong.

As icons are loaded async by default, this call isn't necessary.
2020-02-04 16:41:36 +01:00
Benjamin Otte
bfebc2b01a icontheme: Remove gtk_icon_theme_get_default()
The API encouraged wrong usage - most of the users were indeed wrong.

Use the correct version instead:
  gtk_icon_theme_get_for_display (gtk_widget_get_display ())
2020-02-04 16:41:36 +01:00
Chun-wei Fan
f2915180a6 tests/testdnd2.c: Don't include unistd.h unconditionally
Instead, on Windows when it is not available, include io.h for close()
2020-02-03 17:18:36 +08:00
Matthias Clasen
a46f9af1c0 Remove primary monitor api
We only have implementations of this on X11 and Win32,
so make it available as backend api there.

Update all callers to use either the backend api, or
just monitor 0.
2020-01-30 21:33:37 +01:00
Alexander Larsson
d1cd578d59 icon-theme: Add i/o priority to choose_icon_async()
This is set on the GTask and lower priority will be loaded before,
this can be used to prioritize some icons for preloading.
2020-01-30 15:15:08 +01:00
Alexander Larsson
27799ba4f5 Remove final references to "icon info" with just "icon" 2020-01-30 10:53:43 +01:00
Alexander Larsson
b087f9ca51 icon-theme: Drop the _for_scale() versions and always take scale 2020-01-30 10:53:43 +01:00
Alexander Larsson
e2f778602b icon-theme: Rename GtkIconInfo to GtkIcon 2020-01-30 10:53:43 +01:00
Alexander Larsson
0d666f0cec icon-theme: Use gtk_icon_theme_choose_icon_async in tests 2020-01-29 19:06:16 +01:00
Alexander Larsson
dbe021239f icons: Convert use of load() to download_texture() 2020-01-29 19:06:16 +01:00
Alexander Larsson
c42977af04 Convert trivial users of icon theme loading to use info as paintable 2020-01-29 19:06:16 +01:00
Benjamin Otte
43339f1c1c testcalendar: Don't do dumb stuff with font sizes.
If you want to test font stuff, it's 2020 and we have an inspector.
2020-01-28 02:17:32 +01:00
Benjamin Otte
6c8b65baf9 stylecontext: Remove GTK_STYLE_PROPERTY_* defines
They shouldn't be (and aren't) used anymore.
2020-01-28 02:17:03 +01:00
Matthias Clasen
23426b0f39 Fix testsuite without -Dprofiler=true
Only build and run the performance tests if we have sysprof.
2020-01-21 18:09:43 -05:00
Matthias Clasen
ea17728ee5 Prototype a sysprof helper
This is an attempt to see how we can use sysprof data
in our tests to extract useful performance numbers.

Use it as a wrapper around any GTK+ process:

./testperf ./gtk4-widget-factory

Currently, it repeatedly runs the given commandline,
extracts the first css validation time from the resulting
syscap file, and prints out the min/max/avg of the runs
at the end.

This relies on the environment variable GTK_DEBUG_AUTO_QUIT
to cause the process to exit soon after launch.
2020-01-21 17:31:48 -05:00
Benjamin Otte
b9c81b1b94 widget: Initialize cssnode name asap
That way, it's correct in subclass's init functions.
2020-01-21 12:47:16 +01:00
Matthias Clasen
ec255f9bb1 Update all callers 2020-01-11 00:50:22 -05:00
Matthias Clasen
f33fe6daed testdnd: Fix up for current api 2020-01-09 10:29:33 -05:00
Matthias Clasen
1c03bbeb9c Update all users 2020-01-08 18:48:23 -05:00
Matthias Clasen
5e57b3d07a testdnd2: Fix the text case
We must take mime types into account when checking.
2020-01-08 18:48:22 -05:00
Matthias Clasen
0297039b38 Add another dnd testcase
This one tests nested drop sites and interaction between
DND and other gestures.
2020-01-08 18:48:22 -05:00
Matthias Clasen
5206a92522 Update all callers 2020-01-08 18:48:22 -05:00
Matthias Clasen
009228471c testdnd2: Use GDK content formats api 2020-01-08 18:48:22 -05:00
Matthias Clasen
c95659bf32 testdnd2: Update to the api change in the previous commit 2020-01-08 18:48:22 -05:00
Matthias Clasen
c1029535ca testtoolbar: Use gtk_widget_add_controller for drag source 2020-01-08 18:48:21 -05:00
Matthias Clasen
a5ca5eb865 testlist3: Use gtk_widget_add_controller for drag source 2020-01-08 18:48:21 -05:00
Matthias Clasen
2227d2a2b5 testdnd2: Use gtk_widget_add_controller for drag source 2020-01-08 18:48:21 -05:00
Matthias Clasen
61559e38f4 testdnd: Use gtk_widget_add_controller for drag source 2020-01-08 18:48:21 -05:00
Matthias Clasen
e8b830a3dd dragsource: Reshuffle api a bit
Remove arguments from the constructor.

For actions, we now default to COPY, which is the most common one
that we should enable by default (MOVE requires handling deletion
on the the source side, and ASK only makes sense if we have
multiple actions).

For the content provider, we add a new ::prepare signal where
it should be provided just-in-time.
2020-01-08 18:48:21 -05:00
Matthias Clasen
38974d7d2b dragsource: Tweak api, update all callers
Add GdkDrag back to signals, drop ::drag-data-delete,
and replace it with a boolean in ::drag-end.
2020-01-08 18:48:21 -05:00
Matthias Clasen
508570864d Remove gtk_drop_target_get_target
Now that drop targets are event controllers,
we can just use gtk_event_controller_get_widget.
Update all callers.
2020-01-08 18:48:21 -05:00
Matthias Clasen
e9067ae2db Replace gtk_drop_target_attach/detach
Since drop targets are now just event controller,
gtk_widget_add/remove_controller works just fine
for them.
2020-01-08 18:48:21 -05:00
Matthias Clasen
46f42fc53d droptarget: Drop defaults flags
These no longer have any effect.

Update all callers.
2020-01-08 18:48:20 -05:00
Matthias Clasen
58106af54d testdnd2: Add a test for ASK handling
It is a bit unfortunate that we need to extend the
lifespan of the drop object by keeping our own
ref, but I don't see a better way of doing it.
2020-01-08 18:48:20 -05:00
Matthias Clasen
74d445636c testtreednd: Use the new asyn selection read 2020-01-08 18:48:20 -05:00
Matthias Clasen
7048790931 testlist3: Use async read api for selection 2020-01-08 18:48:20 -05:00
Matthias Clasen
cd7303d47c testtreednd: Convert to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
0f9cbf49ac testnotebookdnd: Fix, partially
Make this mostly work again.
2020-01-08 18:48:20 -05:00
Matthias Clasen
a309e74be7 testtoolbar: Convert to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
ccaf70e1b7 testlist3: Convert to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
2fd9431f23 testdnd: Convert to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
3f33a0ed27 testdnd2: Port to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
b4c689ecd6 tests: Convert to GtkDragSource
Some tests, such as testimage did not have
anything particularly worth keeping, so
were removed instead of fixed.
2020-01-08 18:48:19 -05:00
Matthias Clasen
337057eb35 entry: Port icon dnd to GtkDragSource
This requires a small change in the api,
since we need to provide a GdkContentProvider now.
2020-01-08 18:48:19 -05:00
Timm Bäder
1477882b31 testentryicons: Fix a memory leak 2020-01-07 17:27:16 +01:00
Matthias Clasen
96d2bf10b9 Add a text view mark/cursor test
This has testcases for some issues around invalidation
of marks.
2020-01-03 11:18:08 -05:00
Matthias Clasen
e56eb7b17b testtooltips: Test tooltips on popovers
They do not currently work right.
2019-12-29 22:09:13 -05:00
Matthias Clasen
5c97f09796 tests: Stop using menus 2019-12-29 20:31:58 -05:00
Matthias Clasen
7078765903 Revert unintended changes
I didn't mean to make this a complicated
portal test. Go back to being a simple test.
2019-12-29 13:03:44 -05:00
Matthias Clasen
29e1dac1ff testfilechooser: Test the choice apis 2019-12-25 09:47:22 -05:00
Christoph Reiter
8f8229dcd2 Fix various new mingw compiler warnings
These are the result of us missing CI for some time now and
MSYS2 having a newer GCC now I guess.
2019-12-18 09:25:06 +01:00
Chun-wei Fan
d51e3e835e tests/: Revert bbb56d8 for non-UNIX
The portal bits are only supported on *nix, so use the old code on
non-*nix.
2019-12-17 00:52:25 +08:00
Matthias Clasen
bbb56d8216 Merge branch 'file-transfer' into 'master'
clipboard: file transfer portal support

See merge request GNOME/gtk!1244
2019-12-12 19:33:02 +00:00
Matthias Clasen
a20c8af678 clipboard: file transfer portal support
Implement file-list <-> application/vnd.flatpak.file-list
serialization by talking to the file transfer portal.

See https://github.com/flatpak/xdg-desktop-portal/pull/222
2019-12-12 14:25:33 -05:00
Benjamin Otte
f6bdfc32d3 tests: Set an existing font in testfontchooser 2019-12-12 19:50:55 +01:00
Matthias Clasen
3ee9b0cf4b Make a test with a custom display
This completely breaks the inspector.
2019-12-07 10:03:42 -05:00
Benjamin Otte
a15fb95c46 gtk-demo: Use normal way to lookup up symbols
We're a normal application, so we can use the normal way to hook up code
into builder files, which is using dlsym() for the function pointers.

There's no need to to extra work exporting static symbols.
2019-12-03 18:12:25 +01:00
Timm Bäder
8ca46169b1 gl renderer: Blur shader improvements
Use a two-pass blur shader, fix a few other things and unify the
blurring of blur nodes and blurred outset shadow nodes.

Related to #1283
2019-12-03 08:40:34 +01:00
Timm Bäder
642ced0cfc testblur: Fix default blur radius
sync it up with the adjustment value. also just add the destroyed
handler.
2019-12-03 08:40:34 +01:00
Benjamin Otte
b025ee428c builder: Connect signals automatically
gtk_builder_connect_signals() is no longer necessary, because all the
setup that made it necessary to have this extra step is now done
automatically via the closure functions.
2019-11-22 17:42:31 +01:00
Benjamin Otte
27d05102ab builder: Remove user_data argument from gtk_builder_connect_signals()
This is pretty unused and gets in the way of the next steps.

A potential side effect is that for templates the widget was passed as
the user data argument. If that turns out to be important, we have to
special case that situation.
2019-11-22 07:46:18 +01:00
Matthias Clasen
d4180931f8 Merge branch 'seal-popover-menu' into 'master'
Privatize popover menu pieces

See merge request GNOME/gtk!925
2019-11-18 01:57:55 +00:00
Emmanuele Bassi
b70e4f6de9 Rename "iconify" to "minimize"
The "iconified" state is mostly an X11-ism; every other platform calls
this state "minimized" because it may not involve turning a window into
an icon at all.
2019-11-16 20:07:37 +00:00
Timm Bäder
f8303c7a22 testpopover: Plug two GtkBuilder leaks 2019-11-14 09:15:58 +01:00
Matthias Clasen
bfa0509f08 Privatize popover menu pieces
Don't allow manual creation of popover menus
anymore. This lets us also make GtkModelButton
private
2019-11-11 12:42:06 +01:00
Christian Hergert
5e341210a1 texthistory: add GtkTextHistory helper
The GtkTextHistory helper provides the fundamental undo/redo stack that
can be integrated with other text widgets. It allows coalescing related
actions to reduce both the number of undo actions to the user as well as
the memory overhead.

A new istring helper is used by GtkTextHistory to allow for "inline
strings" that gracefully grow to using allocations with g_realloc(). This
ensure that most undo operations require no additional allocations other
than the struct for the action itself.

A queue of undoable and redoable actions are maintained and the link for
the queue is embedded in the undo action union. This allows again, for
reducing the number of allocations involved for undo operations.
2019-11-05 09:34:29 -08:00
Matthias Clasen
dbbb7eef15 testicontheme: Remove useless function
Contexts in icon themes are not useful for anything,
so drop this function from testicontheme.
2019-10-18 08:53:23 -05:00
Timm Bäder
8928323c6b popover2.ui: Stop trying to set GtkModelButton:label
The property is called "text"
2019-10-09 16:57:22 +02:00
Timm Bäder
c7203550a2 testmodelbutton: Remove toggles for removed properties 2019-10-09 16:57:22 +02:00
Christian Hergert
fea2a82ef6 textview: use GtkTextViewChild for border and overlay children
This creates a new GtkTextViewChild that can manage overlay children at
given x,y offsets in buffer coordinates. This simplifies GtkTextView by
extracting this from GtkTextWindow as well as providing a real widget for
the borders.

With this change, we also rename gtk_text_view_add_child_in_window() to
gtk_text_view_add_overlay(). For those that were using
GTK_TEXT_WINDOW_WIDGET, they can use a GtkOverlay. It does not appear
that anyone was using GTK_TEXT_WINDOW_(LEFT|RIGHT|TOP|BOTTOM) for widgets
in this fashion, but that can be done by setting a gutter widget with
gtk_text_view_set_gutter(). We can make GtkTextViewChild public if
necessary to simplify this should it become necessary.

GtkTextViewChild will setup a CSS node of either "text" or "border"
depending on the GtkTextWindowType.

The old GtkTextViewChild has been renamed to AnchoredChild as it is only
used for widgets with anchors in the GtkTextBuffer. This also removes the
use of allocated GSList and instead embeds a GQueue and GList to save a
few extraneous allocations.
2019-10-04 14:45:43 -07:00
Matthias Clasen
9501fc2c14 Merge branch 'nested-popover-menu' into 'master'
Nested popover menus

See merge request GNOME/gtk!1076
2019-09-10 01:09:31 +00:00
Timm Bäder
7d93e9963a testlist2: quit on window close 2019-09-09 17:36:27 +02:00
Timm Bäder
71339225eb icontheme: Remove gtk_icon_info_load_texture
It's the same as load_icon now.
2019-09-09 17:36:26 +02:00
Timm Bäder
590e70d4d1 icontheme: Return a paintable from gtk_icon_info_load_icon 2019-09-09 17:36:26 +02:00
Timm Bäder
fd16ac4d5e icontheme: Return paintables from more API 2019-09-09 17:36:26 +02:00
Timm Bäder
f3099afcc5 icontheme: Return textures from load_icon{,_for_scale} 2019-09-09 17:36:26 +02:00
Timm Bäder
6821fe0c13 icontheme: Add error argument to _load_texture
Loading an icon might fail.
2019-09-09 17:36:26 +02:00
Timm Bäder
4cc4868e93 label: Remove "line" from wrap properties
The property names are "wrap" and "wrap-mode", so it doesn't make sense
that the accessors refer to line_wrap and line_wrap_mode.
2019-09-09 17:36:23 +02:00
Matthias Clasen
ea44eade21 Add nesting popover menus
Add a variant of popover menus that are nesting
like traditional menus. This is a better fit for
replacing traditional main menus.
2019-09-08 19:02:06 -04:00
Timm Bäder
1c8b746b42 testscale: Properly call gtk_main_quit 2019-08-09 14:30:01 +02:00
Jonas Ådahl
7f6c31c041 tests: Remove obsolete props from popover2.ui 2019-07-24 22:42:37 +02:00
Jonas Ådahl
a2ff6af4b3 tests: Add back testpopupat
It's still useful for testing menus. Fixed the .ui file by removing a
property that no longer exists.

This effectively reverts commit
84d2150077.
2019-07-03 11:42:28 +02:00
Benjamin Otte
d541aed165 testgtk: Remove unused code
This code has been doing nothing since 2010 when the optionmenu was
removed in 274395063a.
2019-06-18 15:53:01 -04:00
Timm Bäder
66b081dc9c glglyphcache: Use stb_rect_pack for better glyph packing 2019-06-04 22:42:00 +00:00
Matthias Clasen
90f330e27a Merge branch 'gesture-click' into 'master'
Rename GtkGestureMultiPress to GtkGestureClick

See merge request GNOME/gtk!878
2019-05-29 18:39:09 +00:00
Matthias Clasen
d2bc5b490a tests: Stop using gtk_window_set_position
This api is going away.
2019-05-29 18:04:08 +00:00
Matthias Clasen
7f65e5f96b Rename GtkGestureMultiPress to GtkGestureClick
The name just made it hard for people to find the
right gesture to use.
2019-05-29 17:10:46 +00:00
Matthias Clasen
5675d585f4 testgtk: Fix a crash
Somebody forgot to update the signal handler
here when changing the size-allocate signal.
2019-05-29 11:07:01 -04:00
Benjamin Otte
a079fd2def widget: Fix transform refcounting in allocate()
Make the transform (transfer full).

1. This makes sure we actually reference the transform. Previously we
   did not.
2. Most callers create a new transform to pass to us. Now they don't
   have to uref it anymore.
2019-05-29 16:34:56 +02:00
Matthias Clasen
7447abb52b Stop using gtk_widget_get_toplevel
All uses of it can be replaced by gtk_widget_get_root.
2019-05-28 20:25:16 +00:00
Matthias Clasen
302d2a04ae Stop using gtk_widget_get_surface
Replace all uses of gtk_widget_get_surface by
gtk_native_get_surface.
2019-05-28 20:25:16 +00:00
Matthias Clasen
18788c2a86 Remove gtk_widget_get/set_has_surface
These serve no purpose anymore - widgets don't
have surfaces, unless they're a GtkNative.
2019-05-28 20:25:15 +00:00
Matthias Clasen
6ab8ab87c8 Reimplement GtkPopover 2019-05-28 20:25:13 +00:00
Daniel Boles
037454d904 testscrolledwindow: GtkMenuButton != GtkContainer
It's not anymore, so don't cast it to one... Use the new :label instead.
2019-05-21 21:21:01 +01:00
Benjamin Otte
5273634f47 tests: Use g_free(), not free()
Windows doesn't like that.
2019-05-21 07:23:30 +02:00
Benjamin Otte
a1d08b4b52 rendernode: Take a graphene_point_t for the offset
... instead of 2 floats.
2019-05-21 06:43:59 +02:00
Matthias Clasen
5368f98dd5 demos: Stop using gtk_button_clicked 2019-05-18 14:33:41 -04:00
Timm Bäder
dde69802cd Add error func to node deserialization 2019-05-05 07:18:39 +02:00
Matthias Clasen
c9eca55c5e tests: Stop using gtk_menu_set_display
It is not needed here.
2019-05-01 21:54:57 +00:00
Matthias Clasen
92e21c3f1c Drop the can-default property
It was added at a time when default buttons
had a very large external border that would disrupt
aligment. Not a problem nowadays.
2019-04-28 23:28:39 +00:00
Matthias Clasen
89f7b974f2 Stop using gtk_widget_grab_default
Replace gtk_widget_grab_default by gtk_window_set_default_widget.
2019-04-28 23:21:51 +00:00
Matthias Clasen
fe3b5ba545 tests: Stop using gtk_widget_get_parent_surface
We can just use the surface of the parent.
2019-04-24 20:57:09 -04:00
Benjamin Otte
84d2150077 tests: Remove popupat test
The test hasn't worked for a while and nobody cared to fix it.

Neither do I.
2019-04-15 14:38:23 +02:00
Benjamin Otte
117fc68195 tests: Remove testboxcss
That test was cool in 2011, but hasn't been updated or used since then
because its features are now part of widget-factory and the inspector.

So let's remove it.
2019-04-12 19:34:29 +02:00
Benjamin Otte
a8f712b09a cssection: Return locations, not numbers
Now that we have GtkCssLocation, actually use it.
2019-04-12 19:34:28 +02:00
Benjamin Otte
a938c14d11 build: Add gtk-css static library
This library is meant to be the new CSS library that gets used from GDK,
GSK and GTK for string printing and parsing.

As a first step, move GtkCssProviderError into it.

While doing so, split it into GtkCssParserError (for critical problems)
and GtkCssParserWarning (for non-critical problems).
2019-04-12 19:34:28 +02:00
Matthias Clasen
ef982b7d46 Rename things
Rename the can-pick property to can-target,
and redo the pick flags with more descriptive names.
2019-04-08 08:42:25 -04:00
Matthias Clasen
b804235aea Add a flags argument to gtk_widget_pick
This will be used to let the inspector and other users
pick insensitive widgets again. For now, update all
callers to pass no flags, preserving the current
behavior.
2019-04-07 17:19:09 +00:00
Matthias Clasen
0a4a7b310d testgtk: Stop using child properties 2019-04-05 12:01:43 +00:00
Matthias Clasen
f184393f07 Remove testactionbar
This test relies on child properties.
2019-04-05 12:01:43 +00:00
Matthias Clasen
1f37600c4c Remove testtitlebar
This test relies on child properties.
2019-04-05 12:01:43 +00:00
Matthias Clasen
69d4081ff8 Merge branch 'wip/ebassi/grid-layout' into 'master'
Implement GtkGridLayout

See merge request GNOME/gtk!714
2019-04-05 02:42:55 +00:00
Emmanuele Bassi
9700543e02 tests: Update GtkGrid definitions in UI files 2019-04-05 00:20:45 +01:00
Matthias Clasen
09cd6e3b5f Fix teststack
This testcase wasn't updated to new GtkStack apis.
2019-04-03 15:10:10 +00:00
Emmanuele Bassi
447dfc029f Remove GtkLayout
The need of a specialised fixed layout container that can be placed into
a GtkScrolledWindow ceased to exist once GtkScrolledWindow gained the
ability to automatically interpose a GtkViewport when adding a child
that does not implement GtkScrollable.

All the other justifications that led to the existence of GtkLayout as a
separate widget from GtkFixed have been largely made irrelevant in the
20 years since its inception.
2019-04-02 15:29:20 +01:00
Matthias Clasen
53a28f7672 testrevealer: Cover the new transitions
Add tests for all the swing transitions.
2019-03-29 10:54:45 -04:00
Matthias Clasen
700183e5b6 Convert ui files
Run gtk4-builder-tool simplify --3to4 over all ui files.
2019-03-28 16:37:21 -04:00
Matthias Clasen
14ad26a599 Convert ui files
Run gtk4-builder-tool simplify --3to4 over all ui files.
2019-03-27 18:40:40 -04:00
Matthias Clasen
7ac250dea7 Convert all ui files
Run gtk4-builder-tool simplify --3to4 over all ui files.
2019-03-27 13:36:24 -04:00
Matthias Clasen
de741e57f3 tests: Stop using gtk_window_set_gravity
This api is going away.
2019-03-26 17:55:29 -04:00
Matthias Clasen
27c286773c tests: Stop using gtk_window_move
It is going away.
2019-03-26 17:55:29 -04:00
Matthias Clasen
6b6f26ed45 Add a window move/resize test 2019-03-26 15:57:04 -04:00
Matthias Clasen
7ca24f12d7 window: Remove initial-focus builder support
With focus-widget now a property, this is no longer needed.
2019-03-16 21:24:45 -04:00
Matthias Clasen
2bf1561b48 Port widgets to the root focus API 2019-03-16 21:24:44 -04:00
Matthias Clasen
a3b73a416e password entry: Add a way to see the content
Add a ::show-peek-icon property and show a clickable
icon when it is set. Clicking it toggles the visibility
of the content. The same functionality is also accessible
via a context menu item.

This is a common feature of password entries.
2019-03-14 20:31:45 -04:00
Benjamin Otte
0e1a50366a transform: Move to GSK
The renaming of the prefix makes this a large patch.
2019-03-04 23:09:02 +01:00
Timm Bäder
f35b8a7541 Fix compile time warnings 2019-03-02 05:28:55 +01:00
Matthias Clasen
9e0c471b03 entry, spin button: Drop redundant API
Avoid duplicating GtkEditable APIs. Port existing users.
2019-02-28 16:34:00 -05:00
Matthias Clasen
41c0ac1a68 Merge branch 'overlay-cleanup' into 'master'
Overlay cleanup

See merge request GNOME/gtk!600
2019-02-22 03:38:20 +00:00
Matthias Clasen
f8609efa2b testoverlay: Use gtk_widget_set_can_pick
Use gtk_widget_set_can_pick instead of the
overlay-specific api with the same purpose.
2019-02-21 21:55:05 -05:00
Matthias Clasen
3487ebe4fd remove tests that no longer work 2019-02-21 19:46:38 -05:00
Benjamin Otte
e8b5056940 And another keybinding leftover 2019-02-22 00:07:35 +01:00
Benjamin Otte
c24f32619f widget: Make gtk_widget_allocate() take a GtkTransform
We can reason about GtkTransform way better - and determine its category or
do equality checks.
2019-02-21 19:47:27 +01:00
Benjamin Otte
01f7f255b5 gtk: Check return value of compute_bounds()
Half of these calls will completely break if anybody ever uses CSS
transforms with them, but hey...
2019-02-20 05:26:31 +01:00
Timm Bäder
8ce6cf569f Add test for widget transforms 2019-02-19 19:22:10 +01:00
Matthias Clasen
22ea832eb3 Fix testtreesort warnings 2019-02-19 00:25:59 -05:00
Matthias Clasen
210c5d88a2 Add a test for GtkPassworkEntry 2019-02-19 00:25:59 -05:00
Matthias Clasen
e5e2bd3187 Drop GtkAssistantPage::has-padding
This is causing us some internal complications, and
it is very easy to just add padding to the pages
yourself.
2019-02-15 10:23:48 -05:00
Emmanuele Bassi
61fbd5b541 tests: Fix comment for accuracy
The command line for compiling testwindowsize has changed.
2019-02-06 10:41:49 +01:00
Timm Bäder
55b99e9916 window: Remove icon list 2019-02-05 08:11:43 -05:00
Matthias Clasen
5120748981 Drop GtkButtonBox
This widget does not seem worth keeping,
and we want to get rid of child properties.
2019-02-04 12:44:55 -05:00
Timm Bäder
25e199e7b7 testgtk: Fix image menu item child order
We want the image first, text second.
2019-02-04 17:05:30 +01:00