Commit Graph

63892 Commits

Author SHA1 Message Date
Emmanuele Bassi
eda1703f9d a11y: Update accessible state for GtkTreeView directly
Do not use GtkWidgetAccessibleClass.notify_gtk().
2020-06-05 20:35:10 +01:00
Emmanuele Bassi
51fc382582 Notify accessibility state changes from GtkWidget
Piggybacking on blanket GObject::notify is not very efficient.
2020-06-05 20:35:10 +01:00
Emmanuele Bassi
6e52ef96a4 Move orientable style classes into GtkWidget
It feels slightly wrong to have GtkOrientable operate on widgets, but at
least what happens when an orientable widget changes orientation should
be part of GtkWidget.

This will allow to add more state changes without accessing widget state
from the outside of gtkwidget.c.
2020-06-05 20:35:09 +01:00
Emmanuele Bassi
9606c1eee9 Notify mapped state to the accessible object directly
Do not use signal connections: if we have an accessible object, notify
it directly when getting mapped and unmapped.
2020-06-05 20:32:27 +01:00
Emmanuele Bassi
959c101400 Drop unused AtkRegistry path
We expect widgets to use their own derived GtkWidgetAccessible type,
these days, and given that we hard code the default accessible type of a
GtkWidget to GtkWidgetAccessible, and that we enforce the dependency of
the type passed to gtk_widget_class_set_accessible_type(), the registry
code path is clearly unused.
2020-06-05 20:32:27 +01: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
Emmanuele Bassi
9ac1eacdc8 Use modern GObject macros for GtkAccessible 2020-06-05 20:32:26 +01:00
Matthias Clasen
8e7395a7e3 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2048
2020-06-05 19:25:46 +00:00
Matthias Clasen
80fbc1b72d multiselection: Fix the select_range implementation
When exclusive is TRUE, we would not always emit a
::selection-changed signal that covers all the items
that were unselected.

This commit includes a test.
2020-06-05 14:57:59 -04:00
Matthias Clasen
17ea03eee2 set: Fix gtk_set_get_max
This function had an off-by-one error. Thankfully,
our selection tests are thorough enough to catch it.
2020-06-05 14:57:32 -04:00
Matthias Clasen
985b5a052e dropdown: Connect a forgotten signal handler
The code was exporting a search_stop function, but
the ui file didn't connect it to the ::stop-search
signal. Fix that.
2020-06-05 14:34:38 -04:00
Matthias Clasen
ed1872f0a8 Merge branch 'frame-clock-start-time' into 'master'
Tweaks to frame clock for better ties to vsync

See merge request GNOME/gtk!2043
2020-06-05 18:33:48 +00:00
Matthias Clasen
34841c3a5f Merge branch 'master.msvc' into 'master'
Fix latest GTK master on Visual Studio

See merge request GNOME/gtk!2028
2020-06-05 18:31:08 +00:00
Matthias Clasen
185f0181ac Merge branch 'columnview-reorder-cells' into 'master'
Columnview reorder cells

See merge request GNOME/gtk!2047
2020-06-05 18:29:26 +00:00
Matthias Clasen
60d6a0f2d5 Merge branch 'rubberband-again' into 'master'
Rubberband again

See merge request GNOME/gtk!2041
2020-06-05 17:59:15 +00:00
Matthias Clasen
99a1d10bf1 multiselection: Fix the select_range implementation
When exclusive is TRUE, we would not always emit a
::selection-changed signal that covers all the items
that were unselected.

This commit includes a test.
2020-06-05 13:50:30 -04:00
Matthias Clasen
2f1028ed79 set: Add a few useful functions
Allow to find out if a set is empty, and its
min and max.
2020-06-05 13:49:23 -04:00
Matthias Clasen
f631e0e1e0 columnview: Update column positions on reordering
Tell reordered columns to reorder their cells to
the new position. This is necessary to get things
like separators right. The visible symptom of this
problem was the lack of the right border when the
last column is reorder to another position, since
the title widget was still the last in its container,
so :last-child applied.
2020-06-05 13:28:44 -04:00
Matthias Clasen
6df489d5a9 columnviewcolumn: Add private api to set the position
This is needed to make columns reorder their cells when
their position in the column views list of columns
changes.
2020-06-05 13:28:44 -04:00
Matthias Clasen
15c6ad88c0 listitemwidget: Add api to reorder children
We need this to keep the rows in sync with the columns
when they are reordered.
2020-06-05 13:28:44 -04:00
Matthias Clasen
40f6a9d830 columnviewlayout: Handle for_size propertly
When we are given a for_size as width for the whole
column view, we need to distribute it over the columns
as gtk_column_view_allocate_columns would, in order
to find out which for_size to give to each cell.

This is a bit recursive, but works. Since we are
doing this recursion for every row, we should consider
adding a cache for those distributed widths.
2020-06-05 13:27:50 -04:00
Ray Strode
bd06c00f3a Merge branch 'wip/damaged-but-no-frost-bite' into 'master'
x11: defer _NET_WM_FRAME_DRAWN update until frame usable by compositor

See merge request GNOME/gtk!1982
2020-06-05 15:58:37 +00:00
Matthias Clasen
f6d23f0c29 Merge branch 'matthiasc/for-master' into 'master'
gtk-demo: Bring back the applauncher demo

See merge request GNOME/gtk!2040
2020-06-05 15:38:03 +00:00
Emmanuele Bassi
2a24459b92 Merge branch 'ebassi/for-master' into 'master'
Add missing annotation

See merge request GNOME/gtk!2046
2020-06-05 15:29:41 +00:00
Matthias Clasen
f6da324670 columnview: Split gtk_column_view_allocate_columns
Split off a helper function that just distributes
the widths, without actually allocating the columns.

This will be used in measuring in the future.
2020-06-05 11:27:40 -04:00
Matthias Clasen
11a18bd61a columnview: Take column width into account for measuring
When measuring the height of a cell, we need to give
it it the width of its column, if we expect realistic
results.
2020-06-05 10:42:20 -04:00
Ray Strode
972134abe4 x11: Defer _NET_WM_FRAME_DRAWN update until frame usable by compositor
With the vendor provided Nvidia driver there is a small window of time
after drawing to a GL surface before the updates to that surface
can be used by the compositor.

Drawing is already coordinated with the compositor through the frame
synchronization protocol detailed here:

https://fishsoup.net/misc/wm-spec-synchronization.html

Unfortunately, at the moment, GdkX11Surface tells the compositor the
frame is ready immediately after drawing to the surface, not later,
when it's consumable by the compositor.

This commit defers announcing the frame as ready until it's consumable
by the compositor. It does this by listening for the X server to announce
damage events associated with the frame drawing.  It tries to find the
right damage event by waiting until fence placed at buffer swap time
signals.
2020-06-05 10:01:13 -04:00
Ray Strode
f8770b78ea x11: Factor out some of frame sync code into subroutines
This commit moves some of the end frame sync counter handling
code to subroutines.

It's a minor readability win, but the main motivation is to
make it easier in a subsequent commit to defer updating the
sync counter until a more appropriate time.
2020-06-05 10:01:13 -04:00
Ray Strode
10f2b11fda x11: Add back support for the damage extension
commit 14bf58ec5d dropped support
for using the DAMAGE extension since there was no code that
needed it.

We're going to need it again, however, to address an NVidia
vendor driver issue.

This commit does the plumbing to add it back.
2020-06-05 10:01:13 -04:00
Timm Bäder
ea1cc4b991 filechooserwidget: Avoid an uninitialised value
For NULL filters, we were never calling g_list_store_find, so leaving
filter_index undefined.
2020-06-05 15:38:55 +02:00
Timm Bäder
8bee3e2fe0 demos: Avoid shadowing a global from time.h
Sad but true.
2020-06-05 15:38:55 +02:00
Timm Bäder
1f7adfd9ff filterlistmodel: Fix fallthrough annotations in unreachable code
They are only unreachable in debug builds but still break the build on
clang.
2020-06-05 15:38:55 +02:00
Matthias Clasen
9e55cd68e4 columview: Make cells propagate request mode
I think this is necessary to make wrapping
labels work.
2020-06-05 09:37:21 -04:00
Matthias Clasen
2a6dc67fd7 gtk-demo: Improve wrapping in settings demo
The columnview overrides the width of its content,
so if a label is not willing to wrap its content
below a certain width, it will just get cut off.

Avoid that by not setting width-chars on the wrapping
content.
2020-06-05 09:35:56 -04:00
Emmanuele Bassi
1061ad289a Add missing annotation 2020-06-05 14:33:17 +01:00
Matthias Clasen
0f81b58545 columviewlayout: Skip children when we should
Every layout manager should call gtk_widget_should_layout
on their children before measuring or allocating them.
So do it here too.
2020-06-05 08:44:23 -04:00
Matthias Clasen
2437c5a0ae listview: Add an example to the docs
The example is an excerpt from the applauncher
demo in gtk4-demo.
2020-06-05 08:22:48 -04:00
Matthias Clasen
669a6ddeaa gtk-demo: Bring back the applauncher demo
Just without the coverflow. It was a well-documented
demo, so it is useful to keep around.
2020-06-05 08:22:48 -04:00
Yariv Barkan
f5de46670b frame clock: schedule in refresh intervals
When the application does not receive "frame drawn" signals we schedule
the clock to run more or less at intervals equal to the last known
refresh interval. In order to minimize clock skew we have to aim for
exact intervals.
2020-06-05 11:57:49 +02:00
Alexander Larsson
91af8a705b frame clock: Better handle non-regular clock cycles
We try to step the frame clock in whole refresh_interval steps, but to
avoid drift and rounding issues we additionally try to converge it to
be synced to the physical vblank (actually the time we get the
frame-drawn message from the compositor, but these are tied together).

However, the convergence to vsync only really makes sense if the new
frame_time actually is tied to the vsync. It may very well be that
some other kind of event (say a network or mouse event) triggered
the redraw, and not a vsync presentation.

We used to assume that all frames that are close in time (< 4 frames
apart) were regular and thus tied to the vsync, but there is really no
guarantee of that. Even non regular times could be rapid.

This commit changes the code to only do the convergence-to-real-time
if the cause of the clock cycle was a thaw (i.e. last frame drawn and
animating). Paint cycles for any other kind of reason are always
scheduled an integer number of frames after the last cycle that was
caused by a thaw.
2020-06-05 11:30:47 +02:00
Alexander Larsson
82c314f1af frame clock: Track if paint is caused by thaw or not
When we get to a paint cycle we now know if this was caused by a
thaw, which typically means last frame was drawn, or some other event.

In the first case the time of the cycle is tied to the vblank in some
sense, and in the others it is essentially random. We can use this
information to compute better frame times. (Will be done in later
commits.)
2020-06-05 11:16:57 +02:00
Benjamin Otte
672413f1f6 Merge branch 'cleanup-snapshot-inhibit' into 'master'
reftest: Clean up reftest_inhibit_snapshot()

See merge request GNOME/gtk!2034
2020-06-05 07:38:52 +00:00
Matthias Clasen
843bf23f84 Drop gtk_multi_selection-copy
It is not used anymore.
2020-06-05 00:51:35 -04:00
Matthias Clasen
eeb2d2cc38 listbase: Redo rubberbanding
Make it so that the selection is only updated in the end.
2020-06-05 00:51:35 -04:00
Chun-wei Fan
c370b8f309 demos/gtk-demo/listview*.c: Include stdlib.h
atoi() and qsort() both require this header for them to be defined
2020-06-05 11:16:45 +08:00
Chun-wei Fan
acd9c12667 modules: Fix build on Visual Studio
Visual Studio does not allow decorating functions with '__declspec (dllexport)'
if a prototype exists and is not decorated with '__declspec (dllexport)' as
well, so we cannot just decorate g_io_module_[load|unload|query] in the various
module sources with G_MODULE_EXPORT because the prototypes of these functions
have been marked with _GLIB_EXTERN, which equates to 'extern' unless overridden

Fix this by overriding _GLIB_EXTERN with the appropriate visibility flag, as we
have used to define _GDK_EXTERN.  Unfortunately, we can't just use _GDK_EXTERN
G_MODULE_EXPORT as they may have not been defined yet for our use

Do this across the board for all modules, even if they are not buildable on
Visual Studio nor Windows, for consistency's sake.
2020-06-05 11:16:45 +08:00
Timm Bäder
5535b26395 Merge branch 'fix-quadratic-add' into 'master'
Avoid quadratic slowdown in gtk_widget_add()

See merge request GNOME/gtk!2027
2020-06-05 02:57:38 +00:00
Matthias Clasen
20611cf68c Add gtk_selection_model_[un]select_callback
Add a methods to add or remove a whole set
(specified via a query-range style callback).
2020-06-04 22:28:54 -04:00
Matthias Clasen
06c34ce02f set: Add a few useful functions
Allow to find out if a set is empty, and its
min and max.
2020-06-04 21:36:23 -04:00
Matthias Clasen
4fb50c7408 Merge branch 'matthiasc/for-master' into 'master'
more documentation for list widgets

See merge request GNOME/gtk!2039
2020-06-04 21:17:21 +00:00