Commit Graph

3496 Commits

Author SHA1 Message Date
Jonas Ådahl
d7d738d745 tests/animated-resizing: Use gtk_window_default_size() instead
This will actually make it resize on-demand, as the default size is the
size used when computing the window size when the size is not fixed.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
8e3ee58e3f tests/animated-resizing: Don't try to resize during frame dispatch
This will not work on X11 because it's too late to resize, due to
resizing being asynchronous i.e. it won't be complete before we need to
draw.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
b738054344 gdk: Remove GdkSurface::size-changed
It's not emitted, and everyone should use the GdkSurface::layout signal
from now on.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
2854d0339c tests/testgtk: Remove 'Resize' button
The gtk_window_resize() API is going away, so remove this test.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
98fffe6f23 tests/animated-resizing: Resize widget instead of window
This means the window needs to be marked as non-resizable, otherwise it
won't shrink.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
f083849ebb tests: Use gtk_window_set_default_size() when appropriate
Replace the usage of gtk_window_resize() with
gtk_window_set_default_size() where possible.
2020-12-07 09:46:39 +01:00
Benjamin Otte
eb9c204535 gtk: Remove GtkFileChooserButton
... as discussed in the meeting.
2020-12-03 02:02:27 +01:00
Benjamin Otte
a51f11999a tests: Remove testsvg
That demo lives in gtk-demo now.
2020-12-02 20:17:28 +01:00
Benjamin Otte
1c7daece7a Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

See merge request GNOME/gtk!2855
2020-11-17 19:08:01 +00:00
Benjamin Otte
eded9459df tests: Fix for new tranfer behavior of constructors
We were still unreffing a listmodel where the reference wasn't ours
anymore.
2020-11-17 19:04:39 +01:00
Emmanuele Bassi
153c6424d3 Remove pointless inout arguments
GtkTreeView.get_tooltip_context() takes an inout X and Y coordinates,
but the "out" side is a side effect: the conversion from widget-relative
to bin window-relative coordinates is not documented, and can be done
using public API, if needed.

GtkIconView.get_tooltip_context() follows the same pattern, and takes
two inout arguments for the coordinates, but it does not change them any
more, after GtkIconView's bin window was dropped in commit 8dc5e13e.

There's really no point in having these `inout` arguments, and while
GtkTreeView and GtkIconView are certainly de-emphasised in GTK4, and we
nudge developers to move to the new list views, we should take advantage
of the API break to remove warts.
2020-11-17 16:38:12 +00:00
Matthias Clasen
121e61cf01 gsk: Avoid using gtk css types in public api
Using GtkCssSection in public headers here may be
ok from the C perspective, since it all ends up in
the same library anyway. But it causes circular
dependency problems for our gir files that are still
split by namespace.

To avoid this problem, copy the GtkCssLocation struct
struct as GskParseLocation, and pass take two of them
instead of a GtkCssSection in the error callback.

Update all users.

Fixes: #2454
2020-11-16 23:27:44 -05:00
Arnaud Bonatti
f7de0bc9c8 Fix tests with regard to GtkBuilder <requires>. 2020-11-07 16:17:36 +01:00
Timm Bäder
a2291fb989 showrendernode: Pass error to deserialize() 2020-10-22 17:46:33 +02:00
Timm Bäder
da0abfce3a showrendernode: Plug GOptionContext memory leak 2020-10-14 15:06:12 -04:00
Timm Bäder
958e4be86d testfilechooser: Stop listening to ::selection-changed
Doesn't exist anymore.
2020-10-14 15:06:12 -04:00
Matthias Clasen
593907f7b0 testupload: Test more formats
Copy the format conversion code from GdkMemoryTexture
so we can produce all formats, and test them all.

The upload fast paths assume that the stride is a
multiple of four, so some of the padding values cause
it to fail. Apart from that, things seem to work for
all combinations.
2020-09-26 17:26:12 -04:00
Matthias Clasen
d56ad7c40c Add a test for various texture uploads
Create textures with various characteristics (alpha, premultiplication,
stride) that trigger different code paths in the gl texture upload
function, and show the resulting images. If all goes well, they all
should look the same.

On my system, this tests texture upload for memory formats
GDK_MEMORY_B8G8R8A8_PREMULTIPLIED, GDK_MEMORY_R8G8B8A8, and
GDK_MEMORY_R8G8B8, and it works with both gl and gles.
2020-09-26 09:20:00 -04: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
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
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
b5f3ac9718 Add a testcase for controls in headerbars
This is meant to help with figuring out entry
selection drag issues.
2020-09-12 10:58:07 -04: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
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
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
8a3621a125 Beef up transform testcase
Make this show 'paintings in paintings'.
2020-09-04 13:20:59 -04:00
Matthias Clasen
1a8f109af8 Add a simple testcase for transforms
This can help in tracking various things down,
from picking to clipping.
2020-09-03 10:09:22 -04:00
Matthias Clasen
b628338db3 list widgets: Simplify the constructors
Now that both arguments to the _new_with_factory() constructors
are nullable, there's no good reason to keep a separate _new()
around. Just make gtk_list_view_new() and gtk_grid_view_new()
take both a model and a factory.
2020-09-01 12:24:06 -04:00
Matthias Clasen
8d79a32c50 list widgets: Use selection models in the api
Change the apis in GtkListView, GtkColumnView and
GtkGridView to be explicitly about GtkSelectionModel,
to make it obvious that the widgets handle selection.

Update all users.
2020-08-31 17:15:05 -04:00
Matthias Clasen
c7b6c2f441 Remove GtkRadioButton references in the docs 2020-08-30 21:23:25 -04:00
Matthias Clasen
2c5c938f0d Clean up uses of gtk_toggle_button_get/set_active
Replace all uses on check buttons by the corresponding
check button api.
2020-08-30 21:23:25 -04:00
Matthias Clasen
8f1bf594b9 Drop a long-dead test
We don't parse rc files anymore. Time for testrc.c to go.
2020-08-30 21:23:25 -04:00
Matthias Clasen
1b6f734019 tests: Stop using radio buttons
Use grouped check buttons.
2020-08-30 21:23:25 -04:00
Timm Bäder
1375fb4464 Change button hierarchy
A radiobutton without indicator is really just a togglebutton with a
group.

A radiobutton with indicator is really just a checkbutton with a group.

Make checkbutton its own widget not inheriting from GtkButton.
GtkRadioButton could be removed but it stays for now.

Radiobutton && !draw-indicator => Togglebutton
Checkbutton && !draw-indicator => Togglebutton

Radiobutton && draw-indicator => CheckButton + group
2020-08-29 16:46:28 +02:00
Timm Bäder
7a8d71138f testoutsetshadowdrawing: Make window background white
This makes it easier to compare the rendering with other sources.
2020-08-29 16:46:28 +02:00
Timm Bäder
ea21e50cc1 testadjustsize: Fix overlay/box confusion 2020-08-29 11:11:29 +02:00
Matthias Clasen
125ed52ccb Merge branch 'new-sysprof' into 'master'
Port profiling to sysprof-collector api

See merge request GNOME/gtk!2457
2020-08-21 23:58:09 +00:00
Matthias Clasen
81e88c1d9e Alterative sysprof build support
Don't link libgtk against libsysprof. We only
need that for the test-performance binary.
2020-08-21 18:28:29 -04:00
Björn Daase
6315cd977c *: Fix spelling mistakes found by codespell 2020-08-21 15:29:34 +02:00
Matthias Clasen
ae7cefd97d Drop style class defines
We document the supported style classes by name,
not by macro name, and these macros don't really
add any value. Drop them for GTK 4.
2020-08-14 07:03:27 -04:00
Andreas Persson
f4a6a99b7c Specify version for optional librsvg dependency
The testsvg test uses a method in librsvg that was introduced in
2.46.0. The test is now skipped if the librsvg version is too old.
(It was previously already skipped if librsvg wasn't found.)
2020-08-06 14:02:02 +02:00
Matthias Clasen
2eec82c32a testsvg: Some additions
Load a file from the commandline, and implement
intrinsic width/height.
2020-08-05 23:53:29 -04:00
Matthias Clasen
29ba8f0819 Add an svg test
tests/testsvg is a minimal paintable implementation wrapped
around RsvgHandle.
2020-08-05 23:22:03 -04:00
Matthias Clasen
d7c4f93c76 Merge branch 'wip/compute-size' into 'master'
Compute size via signal

See merge request GNOME/gtk!2325
2020-08-05 16:19:19 +00:00
Jonas Ådahl
2ff74eb667 gdk/toplevel: Negotiate surface size via a compute-size signal
GTK will not up front know how to correctly calculate a size, since it
will not be able to reliably predict the constraints that may exist
where it will be mapped.

Thus, to handle this, calculate the size of the toplevel by having GDK
emitting a signal called 'compute-size' that will contain information
needed for computing a toplevel window size.

This signal may be emitted at any time, e.g. during
gdk_toplevel_present(), or spontaneously if constraints change.

This also drops the max size from the toplevel layout, while moving the
min size from the toplevel layout struct to the struct passed via the
signal,

This needs changes to a test case where we make sure we process
GDK_CONFIGURE etc, which means we also needs to show the window and
process all pending events in the test-focus-chain test case.
2020-08-05 15:49:00 +02:00
Matthias Clasen
9c8bceb691 testborderdrawing: Don't crash on exit 2020-08-05 08:19:07 -04:00
Matthias Clasen
8562c623d3 Drop GtkAccelLabel
We no longer use this widget anywhere.
2020-08-04 23:05:18 -04:00
Matthias Clasen
ed13e6a41e grid layout: Rename some properties
Rename GtkGridLayoutChild:left-attach/top-attach to
GtkGridLayoutChild:column/row. Update all users.

Fixes: #2967
2020-08-02 17:58:03 -04:00
Matthias Clasen
f136a6f51f testgtk: More GTimeVal eradication 2020-07-31 13:37:29 -04:00
Christian Hergert
459af3acab build: bump to sysprof 4 ABI
Sysprof has moved to a new ABI which removes GLib from the capture library
so that GLib itself can link against sysprof-capture.

This bumps the library ABI so we can keep things coordinated between all
the new tracing layers in the stack.
2020-07-28 11:22:33 -07:00
Matthias Clasen
bc0182fa3e Merge branch 'ebassi/new-a11y' into 'master'
Accessibility rework

See merge request GNOME/gtk!2239
2020-07-27 11:55:19 +00:00
Matthias Clasen
d187ff858c Merge branch 'drop-down-constructor' into 'master'
GtkDropDown api revisions

See merge request GNOME/gtk!2286
2020-07-26 23:57:48 +00:00
Matthias Clasen
eb5c76210e gridview: Revise constructors
Make both gtk_grid_view_new and gtk_grid_view_new_with_factory
take a model as first argument, and make all arguments
allow-none and transfer full.

Update all callers.
2020-07-26 18:50:50 -04:00
Matthias Clasen
fc22b75a06 columnview: Revise the constructor
Make gtk_column_view_new take a model as first argument,
and make it allow-none and transfer full.

Update all callers.
2020-07-26 18:32:50 -04:00
Matthias Clasen
43000abeff listview: Revise constructors
Make both gtk_list_view_new and gtk_list_view_new_with_factory
take a model as first argument, and make all arguments
allow-none and transfer full.

Update all callers.
2020-07-26 18:27:23 -04:00
Matthias Clasen
f7ab6f665d dropdown: Revise constructors
A dropdown without a model is useless, so accept a model
and expression in the constructor. Allow them to be NULL,
but consume them if given. This makes chained constructors
convenient without breaking language bindings.

Drop gtk_drop_down_set_from_strings() and instead add
gtk_drop_down_new_from_strings().

Update all users.
2020-07-26 18:09:54 -04:00
Matthias Clasen
dd1c0c0b22 treelistmodel: Make constructor transfer full
Make gtk_tree_list_model_new() take the root model
as first argument, and make it transfer full, for
consistency with other wrapping list constructors.

Update all callers.

Still missing here: Make the model property writable,
and allow passing NULL in the constructor.
2020-07-26 18:04:40 -04:00
Matthias Clasen
a46cfd3ff4 sortlistmodel: Make constructor transfer full
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.
2020-07-26 18:04:40 -04:00
Matthias Clasen
706d464ae6 filterlistmodel: Make constructor transfer full
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.
2020-07-26 18:04:40 -04:00
Emmanuele Bassi
c63087a563 Remove ATK
To build a better world sometimes means having to tear the old one down.
        -- Alexander Pierce, "Captain America: The Winter Soldier"

ATK served us well for nearly 20 years, but the world has changed, and
GTK has changed with it. Now ATK is mostly a hindrance towards improving
the accessibility stack:

 - it maps to a very specific implementation, AT-SPI, which is Linux and
   Unix specific
 - it requires implementing the same functionality in three different
   layers of the stack: AT-SPI, ATK, and GTK
 - only GTK uses it; every other Linux and Unix toolkit and application
   talks to AT-SPI directly, including assistive technologies

Sadly, we cannot incrementally port GTK to a new accessibility stack;
since ATK insulates us entirely from the underlying implementation, we
cannot replace it piecemeal. Instead, we're going to remove everything
and then incrementally build on a clean slate:

 - add an "accessible" interface, implemented by GTK objects directly,
   which describe the accessible role and state changes for every UI
   element
 - add an "assistive technology context" to proxy a native accessibility
   API, and assign it to every widget
 - implement the AT context depending on the platform

For more information, see: https://gitlab.gnome.org/GNOME/gtk/-/issues/2833
2020-07-26 20:31:14 +01:00
Benjamin Otte
3078b180fe Replace "gdouble" with "double" 2020-07-25 00:47:36 +02:00
Benjamin Otte
556997f9df Replace "gfloat" with "float" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Timm Bäder
7e19911d3f testwidgettransforms: Fix GtkBox casts 2020-07-17 07:14:50 +02:00
Matthias Clasen
e31bacf7be filechooser: Drop the ::current-folder-changed signal
This signal does not work on native file choosers,
and it exposes internals of the widget that should
not be public. And it is just not very interesting.
2020-07-09 01:48:33 -04:00
Matthias Clasen
99a0b35705 filechooser: Drop the ::file-activated signal
This signal does not work on native file choosers,
and it exposes internals of the widget that should
not be public. And it is just not very interesting.
2020-07-09 01:40:08 -04:00
Matthias Clasen
89bf8af878 filechooser: Make get_files return a list model
Like the other list getters in this interface,
make gtk_file_chooser_get_files() return a
list model.
2020-07-09 01:29:20 -04:00
Matthias Clasen
73dcda460f tests: Stop using file chooser apis that are going away
gtk_file_chooser_[un]select_all are going away, stop
using them.
2020-07-09 00:50:03 -04:00
Matthias Clasen
76290e8ddb filechooser: Add gtk_file_chooser_get_filters
Replace gtk_file_chooser_list_filters with a new
api that returns a list model.

Update all callers.
2020-07-06 10:36:35 -04:00
Matthias Clasen
644d522d19 filefilter: Drop custom filters
These don't work with native file choosers.
2020-07-05 14:34:33 -04:00
Matthias Clasen
a8b0125da1 filefilter: Drop GtkFileFilterInfo
We can just make the filter operate on GFileInfo.
This is in preparation for making GtkFileFilter a
GtkFilter.

Update all users.
2020-07-05 13:55:42 -04:00
Matthias Clasen
acccac516e filefiler: No more floating
Make GtkFileFilter not be initially unowned anymore.
This is in preparation for deriving GtkFileFilter
from GtkFilter. Update all callers.
2020-07-05 12:36:47 -04:00
Benjamin Otte
6f2f828bce tests: Make testlistview be a list again
The grid conversion was for testing and should never have been
committed.
2020-07-05 02:59:21 +02:00
Alexander Mikhaylenko
7c3b30036e headerbar: Show title buttons by default
Most of the time show-title-buttons is set to TRUE. Go ahead and make that
the default.
2020-07-02 23:51:16 +05:00
Matthias Clasen
c0e2d7c62f Drop unnecessary uses of gtk_style_context_add_class
We can use gtk_widget_add_css_class instead, most places.
2020-06-30 17:42:30 -04:00
Matthias Clasen
c267a75eef Stop using GtkFunctionsListItemFactory
This was an early attempt at a factory, and has been
superseded by GtkSignalsListItemFactory. Port all users
the the newer one.
2020-06-29 22:10:34 -04:00
Matthias Clasen
01fbf8444b Stop setting GTK_IM_MODULE_FILE
GTK no longer reads this environment variable, so
setting it can have no benefit for uninstalled demos
anymore.
2020-06-28 13:42:02 -04:00
Matthias Clasen
f4e200708d Merge branch 'scrolled-window-api' into 'master'
scrolledwindow: Don't take adjustments in new()

See merge request GNOME/gtk!2146
2020-06-24 19:58:03 +00:00
Matthias Clasen
455d91b0fc testgtk: Update list of cursor names
Use the standard names, since that is what we want
everybody else to use too.
2020-06-24 14:06:50 -04:00
Matthias Clasen
386b63b85d scrolledwindow: Don't take adjustments in new()
In 99.9% of all cases, these are just NULL, NULL.
So just do away with these arguments, people can
use the setters for the rare cases where they want
the scrolled window to use a different adjustment.
2020-06-24 11:25:09 -04:00
Matthias Clasen
67a7ad069f entrycompletion: Drop action support
This api has not really been kept up with current
user experiences in popups, and we're better off
just dropping it and letting people do their own
popups if they need custom UI.
2020-06-22 14:43:36 -04:00
Matthias Clasen
17af979b24 testlistdnd: Use editable labels
Use editable labels instead of entries, and write
changes back to the model.
2020-06-19 16:30:25 -04:00
Matthias Clasen
6280066207 testlistdnd: Add a tree
This lets us test auto-expand of tree expanders.
2020-06-19 15:26:47 -04:00
Matthias Clasen
5629ac3c63 Add a list dnd example
Add a test for dnd with listview, gridview and columnview.
2020-06-19 15:26:10 -04:00
Emmanuele Bassi
c7916c8e48 Use the appropriate name for Juneteenth
Juneteenth (a portmanteau of June and nineteenth)[2] (also known as
Freedom Day,[3] Jubilee Day,[4] and Liberation Day,[5]) is an unofficial
American holiday celebrated annually on the 19th of June in the United
States.
        -- https://en.wikipedia.org/wiki/Juneteenth
2020-06-18 17:43:46 +01:00
Matthias Clasen
86718439be testdropdown: Add some more tests
Add a homegrown combobox entry replacement that
combines a dropdown with a plain entry.
2020-06-12 08:49:01 -04:00
Matthias Clasen
8c670b3b5d testcolumnview: Add recent file support
Use testcolumnview --recent to see recent files.
2020-06-11 16:14:47 -04:00
Emmanuele Bassi
6b096e5c5b Make tooltip properties idiomatic
The tooltip handling in GtkWidget is "special":

 - the string is stored inside the qdata instead of the private
   instance data
 - the accessors call g_object_set() and g_object_get(), and the
   logic is all inside the property implementation, instead of
   being the other way around
 - the getters return a copy of the string
 - the setters don't really notify all the involved properties

The GtkWidgetAccessible uses the (escaped) tooltip text as a source for
the accessible object description, which means it has to store the
tooltip inside the object qdata, and update its copy at construction and
property notification time.

We can simplify this whole circus by making the tooltip properties (text
and markup) more idiomatic:

 - notify all side-effect properties
 - return a constant string from the getter
 - if tooltip-text is set:
   - store the text as is
   - escape the markup and store it separately for the markup getter
 - if tooltip-markup is set:
   - store the markup as is
   - parse the markup and store it separately for the text getter

The part of the testtooltips interactive test that checks that the
getters are doing the right thing is now part of the gtk testsuite, so
we ensure we don't regress in behaviour.
2020-06-05 20:32:26 +01:00
Matthias Clasen
371dab51bb Add GtkDropDown
This is a simple drop down control using list models.
2020-05-30 19:31:38 -04:00
Matthias Clasen
e3ce99988f Add GtkTreeListRowSorter
This is a special-purpose sorter that can
apply the sorting of another sorter to the
levels of a GtkTreeListModel.
2020-05-30 19:30:14 -04:00
Benjamin Otte
fb78f1ef8e testcolumnview: Add sorters 2020-05-30 19:28:30 -04:00
Benjamin Otte
9f19699806 tests: Add testcolumnview 2020-05-30 19:26:46 -04:00
Benjamin Otte
30f09ea10b listitem: Make this a GObject
This splits GtkListItem into 2 parts:

1. GtkListItem
   This is purely a GObject with public API for developers who want to
   populate lists. There is no chance to cause conflict with GtkWidget
   properties that the list implementation assumed control over and
   defines a clear boundary.
2. GtkListItemWidget
   The widget part of the listitem. This is not only fully in control of
   the list machinery, the machinery can also use different widget
   implementations for different list widgets like I inted to for
   GtkColumnView.
2020-05-30 19:26:46 -04:00
Benjamin Otte
affd2737d5 gridview: Implement minimum row height
We only allocate a certain amount of widgets - and we don't want to run
out of them. So we make all widgets high enough for this to never
happen.
2020-05-30 19:26:46 -04:00
Benjamin Otte
7451e51619 Add GtkTreeExpander
This is a container widget that takes over all the duties of tree
expanding and collapsing.
It has to be a container so it can capture keybindings while focus is
inside the listitem.

So far, this widget does not allow interacting with it, but it shows the
expander arrow in its correct state.

Also, testlistview uses this widget now instead of implementing
expanding itself.
2020-05-30 19:26:45 -04:00
Benjamin Otte
626c525706 listview: Expose GtkListItemFactory APIs
Due to the many different ways to set factories, it makes sense to
expose them as custom objects.

This makes the actual APIs for the list widgets simpler, because they
can just have a regular "factory" property.

As a convenience function, gtk_list_view_new_with_factory() was added
to make this whole approach easy to use from C.
2020-05-30 19:26:45 -04:00
Benjamin Otte
360a728d77 tests: Add a rough form of multiselection
Just store a "filechooser::selected" attribute in the GFileInfo if
the file is meant to be selected.
2020-05-30 19:26:45 -04:00