Commit Graph

63882 Commits

Author SHA1 Message Date
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
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
Matthias Clasen
c37bea1676 Merge branch 'fribidi-include' into 'master'
wayland: Remove unused fribidi include

See merge request GNOME/gtk!2037
2020-06-04 20:03:13 +00:00
Matthias Clasen
ed985640e8 docs: Expand list widget docs
Begin to flesh out the long descriptions for GtkListView,
GtkGridView and GtkColumnView.
2020-06-04 15:33:53 -04:00
Sebastian Keller
2bd938952d wayland: Remove unused fribidi include
The included fribidi header is not used in gdkkeys-wayland.c and already
included in gdk.c which causes linker issues due to the header defining
a global variable.
2020-06-04 20:44:55 +02:00
Matthias Clasen
623a56391c gtk-demo: Cosmetics
Remove a few instances of double semicolon.
2020-06-04 13:30:13 -04:00
Matthias Clasen
1b7fb10361 Merge branch 'matthiasc/for-master' into 'master'
gtk-demo: Allow editing in the settings demo

See merge request GNOME/gtk!2033
2020-06-04 16:32:21 +00:00
Matthias Clasen
f6b6688186 Merge branch 'list-widget-styles' into 'master'
List widget styles

Closes #2818

See merge request GNOME/gtk!2035
2020-06-04 16:27:37 +00:00
Matthias Clasen
99453e937c Merge branch 'demo-drop-awards' into 'master'
gtk-demo: Drop the awards

See merge request GNOME/gtk!2036
2020-06-04 15:27:23 +00:00
Alexander Larsson
d3e0a1f68c Avoid quadratic slowdown in gtk_widget_add()
If you add a widget to a parent, this will invalidate the css nodes
for parent/siblings. Afterwards, if the parent is mapped, we will
realize the new child. This calls gtk_widget_update_alpha() which
needs the css opacity, so it revalidates the css.

Thus, for each widget_add (while visible) will trigger a full
revalidation of each sibling. If you add N children to a parent that
leads to O(N^2) revalidations.

To demo this I changed gtk-demo to always double the count
(independent of the fps) and print the time it took. Here is the
results (after a bit):

Setting fishbowl count=256 took 3,4 msec
Setting fishbowl count=512 took 10,1 msec
Setting fishbowl count=1024 took 34,1 msec
Setting fishbowl count=2048 took 126,3 msec
Setting fishbowl count=4096 took 480,3 msec
Setting fishbowl count=8192 took 1892,7 msec
Setting fishbowl count=16384 took 7751,0 msec
Setting fishbowl count=32768 took 38097,7 msec
Setting fishbowl count=65536 took 191987,7 msec

To fix this we drop gtk_widget_update_alpha() and just
calculate it when needed (which is only in a single place).
It was really only necessary because we previously set
the alpha on the surface.

With this fix the above becomes:

Setting fishbowl count=256 took 1,0 msec
Setting fishbowl count=512 took 1,9 msec
Setting fishbowl count=1024 took 3,7 msec
Setting fishbowl count=2048 took 7,4 msec
Setting fishbowl count=4096 took 18,1 msec
Setting fishbowl count=8192 took 31,0 msec
Setting fishbowl count=16384 took 66,3 msec
Setting fishbowl count=32768 took 126,7 msec
Setting fishbowl count=65536 took 244,6 msec
Setting fishbowl count=131072 took 492,2 msec
Setting fishbowl count=262144 took 984,3 msec
2020-06-04 16:42:59 +02:00
Matthias Clasen
76ff1a2a49 gtk-demo: Drop the awards
This was a neat idea, but maintaining it at a sufficient
level is too much work.
2020-06-04 10:19:44 -04:00
Matthias Clasen
51c6ce1734 list widgets: Document css structure
We didn't fill in this expected part of the widget
documentation yet.
2020-06-04 10:05:17 -04:00