Compare commits

...

1725 Commits

Author SHA1 Message Date
Matthias Clasen
fe4f4d3719 gsk: Tweak GskGLShader long desc
Reformulate one paragraph, as suggested by Benjamin.
2020-09-28 14:01:59 -04:00
Matthias Clasen
e8d1537606 gsk: Use guint for array indices
Avoids some trivialities and static analyis complaints.
2020-09-28 13:57:54 -04:00
Matthias Clasen
2f33ec418b gsk: Cosmetic docs tweak 2020-09-28 13:55:24 -04:00
Matthias Clasen
6fc9294036 gsk: Small doc tweaks
Add an annotation, and tweak the docs for
gsk_gl_shader_node_new slightly.
2020-09-28 13:53:51 -04:00
Matthias Clasen
3297510040 gsk: Improve gsk_gl_shader_node_new preconditions
Check all that we can.
2020-09-28 13:50:15 -04:00
Matthias Clasen
a2849d3f7a gsk: Tweak shader node deserialization
Use a GskShaderArgsBuilder and make the parser
more precise about commas vs semicolons.
2020-09-28 13:38:12 -04:00
Matthias Clasen
f8dc75089e gsk: Reuse css printing function
Don't copy _gtk_css_print_string, just use it.
2020-09-28 13:10:57 -04:00
Matthias Clasen
003cf4f6ce css: Move the last parser api to the new header
This lets us use it from the render node parser
in gsk.
2020-09-28 13:09:54 -04:00
Matthias Clasen
30f2e7e153 rendernodeparser: Tweak the shader node serialization
We call it args now in the api. Follow suit for the
serialization.
2020-09-28 12:57:31 -04:00
Matthias Clasen
1ed2b1b8e3 gsk: Beef up GskShaderArgsBuilder docs
Mention that args are zero-initialized.
2020-09-28 12:51:31 -04:00
Matthias Clasen
4906779f72 gtk-demo: Simplify transitions demo
We are not using the frame clock anymore, so don't
pass it around.
2020-09-28 12:45:31 -04:00
Matthias Clasen
cda8bb4384 gtk-demo: Tweak the transition demo text
Fix some types, and say a bit more here.
2020-09-28 12:41:51 -04:00
Matthias Clasen
a801be3c97 gsk: Fix the shader example
I mixed up my variable names.
2020-09-28 12:18:37 -04:00
Alexander Larsson
59c8c75ede GskShaderArgBuilder: Use standard builder-like API
Primarily this is ref/unref vs copy, and ne wfree_to_args() method. But
also some minor renames.
2020-09-28 16:40:14 +02:00
Alexander Larsson
796b205958 gsk_gl_shader_format_args: Pass arguments by value
Primitive values are now passed by values (although vectors still
by pointer). Also since we can now no longer handle missing definitions
that is an error.
2020-09-28 16:40:14 +02:00
Alexander Larsson
947a933819 gtk-demo: Only use one GskGLShader in fishbowl
We don't want to use a new shader per paintable, because then we will
need to recompile each one. Also remove some leftover unused vars from
the cogs glsl.
2020-09-28 16:40:14 +02:00
Alexander Larsson
48cb5ca3db snapshot: Drop n_children from push_gl_shader and use custom pop
We now always assume you pass the right amount of children for the
shader, and each such child is followed by
gtk_snapshot_gl_shader_pop_texture() and then a final
gtk_snapshot_pop().

This means we handle the 0 child case ok, and that we can validate
that the number of pops of various types are correct.
2020-09-28 16:40:14 +02:00
Matthias Clasen
f19001d4c3 Add some more docs
Add an example to the GskGLShader docs.
2020-09-25 20:38:22 -04:00
Matthias Clasen
6ecf612677 Add another shader test
This one tests the convenience api for creating
uniform data.
2020-09-25 20:37:48 -04:00
Matthias Clasen
e0b3746655 gtk-demo: Add a shader paintable to the fishbowl
This gets around 500 instances at 60fps on my system.
2020-09-25 17:22:22 -04:00
Matthias Clasen
1bc81fac2a gtk-demo: Add a shader paintable demo
Add a shader paintable to the OpenGL transitions
demo. This is reusing one of the shadertoy examples,
tweaked slightly to work as a standalone fragment
shader.
2020-09-25 17:22:22 -04:00
Matthias Clasen
bdcc29ebef gtk-demo: Add a shader paintable
This is a GdkPaintable implementation wrapped
around a GskGLShader. It can optionally be hooked
up to a frame clock to update a time uniform.

The code is set up for this to live as public api
in GSK, if we find it useful enough.
2020-09-25 17:21:40 -04:00
Alexander Larsson
810e9c238e snapshot: Drop the varargs versions of push_gl_shader()
We can now just use gsk_gl_shader_format_args() directly, relying
on the transfer-full of the shader args argument.
2020-09-25 16:51:46 +02:00
Alexander Larsson
e4dfa5597a gtk_snapshot_push_gl_shader: Make @args transfer-full
This makes the common case of this just being created a lot easier.
2020-09-25 16:46:39 +02:00
Alexander Larsson
32aa470f68 Rename uniform_data to shader args, or just args
This makes a lot of types and function names shorter.
Also, we add a "..." version of gsk_gl_shader_format_args_va().
2020-09-25 16:38:10 +02:00
Alexander Larsson
a234ab1e55 Finish remaining renames from GLSHADER to GL_SHADER (etc)
This fixes all remaining cases in public headers.
2020-09-25 14:31:44 +02:00
Alexander Larsson
e93a51b1cc GskGLShader: Drop fallback node and add try_compile function to replace it
This removes the fallback node from GskGLShaderNode and adds
a new function gsk_gl_shader_try_compile_for() which tries to compile a
shader against a renderer. Then you can use the return value of this
both as a way to implement the fallback, and as a way to get at
the error report in a saner way.
2020-09-25 14:31:33 +02:00
Matthias Clasen
66cd15d858 Add some shader tests
These are just basic api usage tests, no rendering.
They found the issues fixed in the preceding commits.
2020-09-23 18:05:57 -04:00
Matthias Clasen
a0bc9d65da gsk: Make uniform regex more forgiving
Accept - in initializers, otherwise we don't accept
things like uniform int n = -2;
2020-09-23 18:03:52 -04:00
Matthias Clasen
a580c711e5 gsk: Make uniform regex more forgiving
Accept comments after a uniform declaration - the
very first shader example I tried had these, so we
better support it.
2020-09-23 17:48:35 -04:00
Matthias Clasen
e91d5b82ce gsk: Fix getters and setters for vector types
The types we store for the uniforms are VEC2/3/4,
even though we just store a bunch of floats.

This was found while adding some simple tests.
2020-09-23 17:42:10 -04:00
Matthias Clasen
0516c59ff5 gsk: Add more shader debug spew
Print out the full assembled shader sources when
GSK_DEBUG=shaders is given. This is very verbose,
but may be useful to see what we actually pass
to the compiler.
2020-09-23 16:17:56 -04:00
Matthias Clasen
a3ea3f94dc gsk: Add some shader debug spew
When we're done extracting uniform info from the glsl,
print out what we've found for GSK_DEBUG=shaders. If
something goes wrong, this will be useful.
2020-09-23 15:40:57 -04:00
Matthias Clasen
5e9fe2f6e8 docs: Add new snapshot apis 2020-09-23 14:59:25 -04:00
Matthias Clasen
6613c523c2 Rename gl shader snapshot apis
Rename gtk_snapshot_push_glshader and friends to
gtk_snapshot_push_gl_shader, following the similar
renaming in GSK.

Update all callers.
2020-09-23 14:53:42 -04:00
Matthias Clasen
efa0fa0bf4 gsk: Small doc fixups
Tweak the gl shader docs here and there.
2020-09-23 14:46:35 -04:00
Matthias Clasen
1b6f7917ed Add GskGLShader apis to the docs 2020-09-23 14:41:22 -04:00
Alexander Larsson
8cc18d2c82 shadertoy demo: Fix GLSL on GLES
I was getting "assignment to varying fragColor" errors
2020-09-23 17:38:03 +02:00
Alexander Larsson
d97267b897 gtk-demo: Add GskGLShaderNode demo
Add adds a demo showing off GskGLShaderNode in various ways.

It has a transistion widget, using some examples from
gl-transitions.com, with child widgets being both images, a GL area
and real widgets (that let you edit the transition shaders
themselves.

It also has a fancy fire effect on hove on the buttons.
2020-09-23 17:28:23 +02:00
Alexander Larsson
21e0ad0561 Support GLShaderNode in backends
For vulkan/broadway this just means to ignore it, but for the gl
backend we support (with up to 4 texture inputs, which is similar to
what shadertoy does, so should be widely supported).
2020-09-23 17:01:17 +02:00
Alexander Larsson
94cccc5e71 GtkSnapshot: Add gtk_snapshot_push_glshader() 2020-09-23 17:01:13 +02:00
Alexander Larsson
111dfdf3f5 Add GskGLShaderNode
This is a rendernode that is supposed to run a GLSL fragment
shader with a set of inputs and produce outputs.
The inputs are:
 * A GskGLShader object with the source and uniforms definitions
   computed from the source.
 * A the data for the uniforms, formated according to the GskGLShader
 * a list of render nodes that are rendered to textures

Additionally there is a fallback node which is used in case
OpenGL is not supported or there is some kind of failure
with the shader code.
2020-09-23 17:01:08 +02:00
Alexander Larsson
0693deb02f gl: Add some namespacing to the preamble symbols
This adds a gsk prefix to the stuff in the preamble, as we want to
avoid it conflicting with things in the main shader. Especially once
we start allow some customization of shaders.
2020-09-22 12:50:10 +02:00
Alexander Larsson
ffd39c257a gl backend: Add line numbers to source in glsl compilation errors
Almost always the source is created by combining various sources, which
means the line numbers in the error messages are hard to use. Adding
the line numbers to the source in the error message helps with this.
2020-09-22 12:50:10 +02:00
Alexander Larsson
ec0ad5738c gl: Properly report error if shader linking fails
In gsk_gl_shader_builder_create_program(), if linking fails we
need to return -1 to indicate error, rather than the old deleted
program id.
2020-09-22 09:40:16 +02:00
Alexander Larsson
c958fd8e86 glrenderer: Move ProgramState into Program
There is no real reason to have this on the side indexed via the
index, as it is stored next to each other anyway. Plus, storing them
together lets use use `Program` structures not in the array.
2020-09-22 09:40:16 +02:00
Matthias Clasen
5e4180b5f0 Merge branch 'improve-columnview-styling' into 'master'
Adwaita: Improve columnview styling

See merge request GNOME/gtk!2608
2020-09-22 03:01:38 +00:00
nana-4
2d6a9990b7 Adwaita: Don't restrict columnview editablelabel style to .data-table
This should be available without .data-table.
2020-09-22 10:40:15 +09:00
nana-4
42be26f1b1 Adwaita: Improve columnview styling
- Move padding from parent row to child cell.
- Align horizontal sizing of cell with header button.
- Properly support GtkColumnView:show-column-separators.
- Change cell height with and without .data-table.
2020-09-22 10:37:04 +09:00
nana-4
f98055b075 Adwaita: Fix separator color for lists 2020-09-22 10:35:15 +09:00
Matthias Clasen
3252d4cab2 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2607
2020-09-21 18:11:41 +00:00
Matthias Clasen
2c527ec87e inspector: Make switches go back to normal size 2020-09-21 11:53:48 -04:00
Matthias Clasen
d5e315c470 gtk-demo: Improve the pickers demo
"Two of every kind..." Add some customized pickers
here. This found a number of issues that have been
fixed in the preceding commits.
2020-09-21 11:53:48 -04:00
Matthias Clasen
256f845d89 colorbutton: Fix handling of transient parents
When we create the dialog before the button has
been rooted, we need to update its transient
parent when that happens.
2020-09-21 11:53:48 -04:00
Timm Bäder
b3c21bc89a Merge branch 'fix-hover-tracking' into 'master'
main: Update pointer focus state for button releases

Closes #3172

See merge request GNOME/gtk!2601
2020-09-21 12:20:00 +00:00
Marek Černocký
6bc46a9a69 Updated Czech translation 2020-09-21 08:30:59 +02:00
Matthias Clasen
1d34f955a2 filechooser: Fix gtk_file_chooser_set_choice
This broke when it was ported to GtkDropDown.
2020-09-20 12:04:49 -04:00
Matthias Clasen
ee75bae8f8 fontchooser: Make sure the tweak button is updated
This was showing up as tweak buttons being visible
when they should not. The code probably relied on
widgets being hidden by default (as they were in
GTK3).
2020-09-20 10:59:37 -04:00
Matthias Clasen
3c62cd90d4 fontchooser: Handle families without faces
This might seem useless, but I've met fonts
where pango_font_family_get_face (family, NULL)
return NULL. Handle it without criticals.
2020-09-20 10:59:37 -04:00
Matthias Clasen
81793b62d8 docs: Improve gtk_widget_set_font_map docs 2020-09-20 10:59:37 -04:00
Matthias Clasen
9ee7bdf4cb Merge branch 'fix-wayland-popups' into 'master'
wayland: Fix grabbing popup

See merge request GNOME/gtk!2604
2020-09-20 14:19:50 +00:00
Matthias Clasen
bb402a1f1d wayland: Fix grabbing popup
A typo snuck into commit 3023a61e1d that
caused us to fail all grabbing popups with
"grab failed: not viewable". Fix that.
2020-09-20 10:02:53 -04:00
Emin Tufan Çetin
02614713da Update Turkish translation 2020-09-20 06:38:03 +00:00
Matthias Clasen
18a5ca257a Merge branch 'kill-widget-new' into 'master'
Drop gtk_widget_new

See merge request GNOME/gtk!2603
2020-09-19 21:25:32 +00:00
Matthias Clasen
874b9ef8b0 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2602
2020-09-19 21:22:30 +00:00
Matthias Clasen
d89f7fd046 Drop gtk_widget_new
An abstract type should not have a constructor.
If you want to be generic, just use g_object_new.
2020-09-19 16:58:42 -04:00
Matthias Clasen
aeeffe27c2 NEWS: Updates 2020-09-19 16:49:46 -04:00
Matthias Clasen
cdc5e83ef2 Merge branch 'matthiasc/for-master' into 'master'
textbuffer: Redo insert markup a little bit

See merge request GNOME/gtk!2600
2020-09-19 20:48:49 +00:00
Matthias Clasen
661da6baec main: Update pointer focus state for button releases
Failure to do so makes the old pointer focus target
'sticky', because we end up ignoring the result of
picking the pointer focus until a motion event comes
in.

Fixes: #3172
2020-09-19 16:48:15 -04:00
Matthias Clasen
e927866ed4 shortcutswindow: Drop the Private struct 2020-09-19 16:22:04 -04:00
Matthias Clasen
4b9e7ac355 revealer: Drop the Private struct 2020-09-19 14:41:41 -04:00
Matthias Clasen
bebe0b5c1b magnifier: Drop the Private struct 2020-09-19 14:36:44 -04:00
Matthias Clasen
2ad9864cdc Cosmetic 2020-09-19 14:31:02 -04:00
Matthias Clasen
ec46900f06 colorscale: Drop the Private struct 2020-09-19 14:29:35 -04:00
Matthias Clasen
93cfa3855c Merge branch 'wayland-backend-api-cleanup' into 'master'
wayland: Change backend api to use GdkToplevel

See merge request GNOME/gtk!2598
2020-09-19 18:19:18 +00:00
Matthias Clasen
6b708e9b60 textbuffer: Redo insert markup a little bit
Redo the tag insertion function to avoid quadratic
behavior, and at the same time, fix handling of
alpha for color attributes.

Update the copy of this function in gtk4-demo
as well.
2020-09-19 14:17:28 -04:00
Matthias Clasen
6e81573776 Merge branch 'password-entry-activate' into 'master'
Add GtkPasswordEntry::activate

Closes #3174

See merge request GNOME/gtk!2599
2020-09-19 18:12:35 +00:00
Matthias Clasen
dd0da0f3cc passwordentry: Add an ::activate signal
GtkSearchEntry has one, no reason why GtkPasswordEntry
should not as well.

Fixes: #3174
2020-09-19 13:25:03 -04:00
Matthias Clasen
48594a2d7a passwordentry: Drop the Private struct 2020-09-19 13:23:40 -04:00
Matthias Clasen
31042bd761 docs: Add missing Wayland backend api
Since Wayland is now our flagship backend,
we should put some effort into the docs.
2020-09-19 13:13:31 -04:00
Matthias Clasen
3023a61e1d wayland: Change backend api to use GdkToplevel
Most of the surface api we have in the Wayland backend
only makes sense for toplevels, so reshuffle things to
take a GdkToplevel instead of a GdkSurface.

Update all callers and the docs.
2020-09-19 13:07:11 -04:00
Matthias Clasen
c1e33056fb NEWS: Updates 2020-09-19 12:09:24 -04:00
Matthias Clasen
57253b0039 Merge branch 'wip/baedert/radial-gradient' into 'master'
Radial gradients

Closes #2262, #3170, and #3173

See merge request GNOME/gtk!2597
2020-09-19 15:49:14 +00:00
Matthias Clasen
84d82dcda9 Merge branch 'wip/fontchooser-language-filtering' into 'master'
fontchooser: add language filtering

See merge request GNOME/gtk!2551
2020-09-19 15:06:56 +00:00
Matthias Clasen
4e35d56263 fontchooser: Remove signal handlers in dispose
Avoid ordering issues in dispose by disconnecting
the rows_changed_cb handler first thing.
2020-09-19 10:44:50 -04:00
Matthias Clasen
a9bf129286 fontchooser: Don't show "No fonts" prematurely
Don't switch to the empty page while we are still busy
filtering. Fonts might yet appear.
2020-09-19 10:25:45 -04:00
Matthias Clasen
76b7f0ca1c fontchooser: Use filter language for sample text
When you are asking to only see fonts that support
a given language, you probably want to see the
sample text for that language too.
2020-09-19 10:13:36 -04:00
Matthias Clasen
09604eb3eb fontchooser: Add user filtering
Add a popover that has filtering options. As a start,
allow filtering by monospace and by language coverage.
2020-09-19 10:13:36 -04:00
Matthias Clasen
0485a6c008 Improve language names
Shorten a few of the names we pick up by removing
parentheses that make them excessively long.
2020-09-19 09:47:15 -04:00
Matthias Clasen
169c208b7a Merge branch 'matthiasc/for-master' into 'master'
win32: Fix compiler warnings

See merge request GNOME/gtk!2596
2020-09-19 13:26:34 +00:00
Matthias Clasen
7b2c4fdb6a Merge branch 'font-chooser-sample-text' into 'master'
fontchooser: Determine sample text intelligently

See merge request GNOME/gtk!2546
2020-09-19 13:19:28 +00:00
Matthias Clasen
e0b1c3e8b0 win32: Fix compiler warnings
The compiler informs me that GetLastError() return a DWORD,
so use %lx to print it.
2020-09-19 08:29:29 -04:00
Matthias Clasen
6b9622f0da Try one more time to fix win32 ci 2020-09-19 08:13:35 -04:00
Zander Brown
cfd1520a9f Update British English translation 2020-09-19 11:42:18 +00:00
Timm Bäder
79dc25e0b1 cssimageradial: Avoid creating color stops with an offset > 1 2020-09-19 08:55:18 +02:00
Timm Bäder
1d371db8d8 scrolledwindow: Ignore captured motion events if no child is set
Fixes #3173
2020-09-19 08:44:58 +02:00
Matthias Clasen
69d5dc7c9a fontchooser: Determine sample text intelligently
Look at the languages supported by a font, and pick
a suitable sample text from the pango list of sample
texts. We can only implement this on platforms using
fontconfig, since it relies on pangofc apis.

This bumps the pango dependency to 1.47.1.
2020-09-18 23:04:39 -04:00
Timm Bäder
f938377464 rendernodes: Clarify color_stops arguments 2020-09-18 19:01:10 +02:00
Timm Bäder
6e14b26622 gsk: Add docs for radial gradient nodes 2020-09-18 18:41:01 +02:00
Timm Bäder
5d5fbc69a4 rendernodes: Enfore end > start for radial gradient nodes 2020-09-18 18:29:08 +02:00
Timm Bäder
a770ab34c4 gl renderer: Consolidate color pre-multiplication
Add a common function that tells us what it does and replace all the
manual stuff with it.

Fixes #3170
2020-09-18 15:45:08 +02:00
Timm Bäder
b8e4240751 gl renderer: Add radial gradient shader 2020-09-18 15:39:07 +02:00
Timm Bäder
2c5a4a799a rendernode: Pull local variable into closest scope 2020-09-18 15:39:07 +02:00
Timm Bäder
07b6431afe Inspector: Show radial gradient node info 2020-09-18 15:39:07 +02:00
Timm Bäder
0c2d00835b gl renderer: Set an error if we don't have one already
We can't fail and not set the error, since caller don't expect that.
2020-09-18 15:39:07 +02:00
Timm Bäder
dbfc172f6a radial gradients: Allow 0 start/end values 2020-09-18 15:39:07 +02:00
Timm Bäder
6a089816fc gsk: Parse radial gradient nodes 2020-09-18 15:39:07 +02:00
Matthias Clasen
2886e19772 css: switch to h/vradius 2020-09-18 15:39:07 +02:00
Matthias Clasen
c08df82d54 snapshot: switch to h/vradius 2020-09-18 15:39:07 +02:00
Matthias Clasen
ebfb3e771d rendernode: switch to h/vradius 2020-09-18 15:39:04 +02:00
Matthias Clasen
2881d347d3 css: Use snapshot api for radial gradients 2020-09-18 15:39:04 +02:00
Matthias Clasen
66d16049c3 snapshot: Add api for radial gradients
These are the equivalents of the linear gradient apis.
2020-09-18 15:39:04 +02:00
Matthias Clasen
0c6226c20b gsk: Add a radial gradient node
Only a fallback implementation for now.

Fixes #2262
2020-09-18 15:38:55 +02:00
Matthias Clasen
9267f705ef Merge branch 'matthiasc/for-master' into 'master'
gtk-demo: Cosmetic changes

See merge request GNOME/gtk!2590
2020-09-18 02:00:46 +00:00
Matthias Clasen
a8adbfbc9f gtk-demo: Cosmetic changes
Polish the text view demos a little bit.
2020-09-17 21:38:10 -04:00
Matthias Clasen
f00f6e9641 Merge branch 'language-names-GError-fixes' into 'master'
Language names g error fixes

See merge request GNOME/gtk!2589
2020-09-17 23:34:03 +00:00
Peter Bloomfield
50f373fbc2 language-names: Do not g_free() a GError
It's NULL anyway, so freeing GError with g_free() when it's allocated with
GSlice never actually happens, but it just looks bad.
2020-09-17 23:34:03 +00:00
Matthias Clasen
f2f0a9ee0e Merge branch 'wip/wayland-respond-to-configure' into 'master'
Make sure to respond to configure events in time

Closes #2910

See merge request GNOME/gtk!2588
2020-09-17 18:49:31 +00:00
Jonas Ådahl
4200936f21 wayland/surface: Make sure to commit ack_configure
We must wl_surface.commit after xdg_surface.ack_configure to make it
have an effect. We failed to do so when a configure event didn't result
in new updates, so make sure we fall back on an simple
wl_surface.commit if there was no new actual frame painted.

Closes: #2910
2020-09-17 18:20:08 +02:00
Goran Vidović
90991a341d Update Croatian translation
(cherry picked from commit 1c07a20ca4)
2020-09-17 15:39:02 +00:00
Jonas Ådahl
1abcd6f304 wayland: Commit surface from cairo context
In order to make the cairo renderer/context behave more similar to how
the OpenGL and Vulkan renderer/context behaves, request a frame callback
and commit in the end frame vfunc.

This means the end frame vfunc in cairo does

 * attach buffer
 * request frame callback
 * sync surface state
 * commit

Where as e.g. the OpenGL version of the same flow does

 * attach buffer
 * request frame callback
 * sync surface state
 * eglSwapBuffers()

where eglSwapBuffers() indirectly calls wl_surface_commit().
2020-09-17 17:35:35 +02:00
Jonas Ådahl
f87de393b5 wayland/surface: Remove 'committed' signal
It wasn't used by anything anymore, lets remove it.
2020-09-17 16:01:08 +02:00
Matthias Clasen
35c3a60c08 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2587
2020-09-17 03:41:32 +00:00
Matthias Clasen
cf1ed3a72a gtk-demo: Fix toggle- vs checkbutton confusion 2020-09-16 23:07:21 -04:00
Matthias Clasen
18e46bd6f8 gtk-demo: Beef up the hypertext demo
Its almost a dictionary.
2020-09-16 23:01:49 -04:00
Matthias Clasen
7082624fd7 textview: Properly delete anchored children
When we remove anchors with widgets from the text
buffer, we used to call gtk_widget_destroy(), which
indirectly called gtk_container_remove() which cleared
the child properly. When gtk_widget_destroy() was
removed, we replaced the calls with gtk_widget_unparent(),
but that is not enough. Explicitly call
gtk_text_view_remove() instead - we know the parent
is a text view.
2020-09-16 23:01:49 -04:00
Matthias Clasen
25d30011a0 textview: Make clickable tags work again
We were claiming the clicks too eagerly, preventing
clickable links, e.g. in GtkAboutDialog, from working.
2020-09-16 22:30:58 -04:00
Matthias Clasen
cd60ed4391 Plug a memory leak in an error case
gtk_show_uri() not freeing the error after showing
it to the user.

Pointed out by Peter Bloomfield in #3166
2020-09-16 19:13:18 -04:00
Matthias Clasen
a1e21c1acb Merge branch 'wip/sadiq/headerbar-demo' into 'master'
gtk-demo: Add a switch to headerbar demo

See merge request GNOME/gtk!2571
2020-09-16 23:12:26 +00:00
Milo Casagrande
ba6c14ad34 Update Italian translation 2020-09-16 07:43:11 +00:00
Matthias Clasen
c6aff910ed Merge branch 'matthiasc/for-master' into 'master'
gtk-demo: Add another demo

See merge request GNOME/gtk!2584
2020-09-16 02:56:08 +00:00
Matthias Clasen
d71337513f gtk-demo: Add another demo
Show how to add a context menu to a custom widget,
and how to make a GtkPicture lookalike.
2020-09-15 22:40:13 -04:00
Matthias Clasen
2741431d6e Merge branch 'stack-add-child' into 'master'
stack: Add gtk_stack_add_child

Closes #3165

See merge request GNOME/gtk!2583
2020-09-16 02:22:36 +00:00
Matthias Clasen
cc9fe4b354 stack: Add gtk_stack_add_child
The name of children is not essential, so add
a way to add children without providing one.

Fixes: #3165
2020-09-15 18:39:09 -04:00
Matthias Clasen
e4d29ba9fd Merge branch 'master.win32' into 'master'
Some more fixes for Windows

Closes #3157

See merge request GNOME/gtk!2580
2020-09-15 11:12:27 +00:00
Matthias Clasen
6f56d8df28 Merge branch 'wip/jimmac/dnd-green' into 'master'
Adwaita: update tango color for DND

Closes #3158

See merge request GNOME/gtk!2581
2020-09-15 11:04:59 +00:00
Matthias Clasen
9eb4eef48b Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2582
2020-09-15 11:04:54 +00:00
Matthias Clasen
e69b623a27 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

See merge request GNOME/gtk!2579
2020-09-15 10:54:31 +00:00
Jakub Steiner
d1a68ac7ba Adwaita: update tango color for DND
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3158
2020-09-15 12:18:55 +02:00
Chun-wei Fan
52ba70d549 gdksurface-win32.c: Fix display of CSD windows
Since the changes to GDK to use surface subtypes, CSD windows were
broken because we did not set the window styles properly.  Fix this by
first acquiring whether decorations are used by the GtkWindow, and based
on that result we set the decorations that we want to use accordingly
and so apply them.

Thanks to Matt Jakeman for investigating into the issue and providing
pointers to a proposed fix.

Fixes issue #3157, besides the part where window sizes are not correct
since that is likely caused a separate issue.
2020-09-15 15:56:36 +08:00
Chun-wei Fan
02aec7f5f4 gdkevents-win32.c: Clean up WM_ACTIVATE handling a bit
We can group some things together, to make things a little bit more clear
2020-09-15 15:53:34 +08:00
Chun-wei Fan
c766e31e8f demos: Fix minesweeper demos on Windows
Make sure the callback functions in the .ui files are exported, so that
those functions can be recognized at runtime so that things run
properly.
2020-09-15 15:53:20 +08:00
Timm Bäder
a545fa15e4 inspector: Remove unsued function 2020-09-15 05:28:31 +02:00
Timm Bäder
e669433cde listbox: Activate single-click rows if n_press >= 1
Quickly clicking rows should always activate the row if
single-click-activation is enabled. Before, only the first click
(n_press == 1) would activate the row.
2020-09-15 05:21:54 +02:00
Timm Bäder
a6f86d9c26 popover: Only destroy arrow render node if position changed 2020-09-15 05:21:54 +02:00
Timm Bäder
d0f182757a sizegroup demo: Fix a checkbutton/togglebutton mixup 2020-09-15 05:21:54 +02:00
Timm Bäder
c8f4c8c4f0 filechooserwidget: Plug a memory leak
g_list_store_append refs the file
2020-09-15 05:21:54 +02:00
Timm Bäder
87f589f738 emojichooser: Fix typo in css class 2020-09-15 05:21:54 +02:00
Timm Bäder
27f3600419 listbox: Add preconditions to remove() 2020-09-15 05:21:53 +02:00
Timm Bäder
40ee7186bf build: Unify two if statements
They both check glib_minor_req.is_odd()
2020-09-15 05:21:53 +02:00
Timm Bäder
a0422bfe25 inspector: Fix huge listbox rows
This is handled by .rich-list
2020-09-15 05:21:53 +02:00
Matthias Clasen
67c1600ac2 Document some API as widget-implementation only
Using gtk_widget_insert_before on a complex container
is a *bad* idea; it will mess up the containers bookkeeping
of its children and can easily lead to failure and crashes.
2020-09-14 20:28:44 -04:00
Matthias Clasen
50400879e0 gtk-demo: Add more detail to the dnd demo text 2020-09-14 17:49:16 -04:00
Matthias Clasen
b20e67dc83 gtk-demo: Add some keywords
Make the builder demo show up in searches for toolbar and
menubar.
2020-09-14 17:33:12 -04:00
Matthias Clasen
a3dcfafba6 gtk-demo: Improve the builder demo
Make the keyboard shortcuts work.
2020-09-14 17:06:34 -04:00
Matthias Clasen
82ce1a9d6b gtk-demo: Improve the builder demo
Make the toolbar look right.
2020-09-14 16:51:05 -04:00
Matthias Clasen
cc6faeab50 gtk-demo: More space
Increase the inter-paragraph spacing in the info
text, to make paragraphs more clearly separated.
2020-09-14 16:21:13 -04:00
Matthias Clasen
aa32613beb gtk-demo: Cosmetic change 2020-09-14 16:20:52 -04:00
Matthias Clasen
6a3e12cfae gtk-demo: Add some details 2020-09-14 16:11:11 -04:00
Rūdolfs Mazurs
fc6d621146 Update Latvian translation 2020-09-14 19:45:03 +00:00
Matthias Clasen
37a24711a4 Merge branch 'issue-2923' into 'master'
Annotate the expression array as "nullable"

Closes #2923

See merge request GNOME/gtk!2578
2020-09-14 17:01:54 +00:00
Emmanuele Bassi
595cc929e6 Annotate the expression array as "nullable"
While it's a bit dubious whether array+length annotations should be
marked as "nullable", we do this elsewhere in the API, so might as well
be consistent.

In practice, the array argument is only ever allowed to be NULL iff the
length argument is 0; annotations are static, so if somebody decides to
pass a NULL argument with a non-zero value, they will get a run time
critical error, instead of a compile time one, which is somewhat counter
to the point of annotating the API in the first place.

Fixes: #2923
2020-09-14 17:00:23 +01:00
Matthias Clasen
27e6826860 Merge branch 'matthiasc/for-master' into 'master'
widget-factory: Fix the toggle buttons on page 3

See merge request GNOME/gtk!2577
2020-09-14 15:44:51 +00:00
Matthias Clasen
7a2400c8a1 widget-factory: Fix the toggle buttons on page 3
They should not both be active initially.
2020-09-14 11:19:39 -04:00
Piotr Drąg
3c4259393c Update POTFILES.skip 2020-09-14 16:55:31 +02:00
Matthias Clasen
a201bfd9a5 Merge branch 'wip/jimmac/navlist-expander-whitespace' into 'master'
Adwaita: navigation list expander whitespace

See merge request GNOME/gtk!2575
2020-09-14 12:59:05 +00:00
Matthias Clasen
921f3a6e16 Merge branch 'wip/jimmac/gridview-whitespace' into 'master'
Wip/jimmac/gridview whitespace

Closes #3164

See merge request GNOME/gtk!2574
2020-09-14 12:49:52 +00:00
Jakub Steiner
e7c75f04dd Adwaita: navigation list expander whitespace
- Address https://gitlab.gnome.org/GNOME/gtk/-/issues/3138#note_910476
2020-09-14 14:31:23 +02:00
Jakub Steiner
7dd819dffc icon-browser: use content-view
- make content prominent by using content-view style for the main grid.
2020-09-14 14:18:52 +02:00
Jakub Steiner
8eab10dabf Adwaita: whitespace for the grid
- separate labels
- 12px margins around cells

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3164
2020-09-14 14:18:52 +02:00
Mohammed Sadiq
bd900fe8c9 gtk-demo: Add a switch to headerbar demo
We don't have any demos with a switch in headerbar.
2020-09-14 17:11:13 +05:30
Matthias Clasen
6a676d527c Merge branch 'wip/jimmac/natigation-sidebar-whitespace' into 'master'
Wip/jimmac/natigation sidebar whitespace

Closes #3138

See merge request GNOME/gtk!2572
2020-09-14 11:13:52 +00:00
Jakub Steiner
f125e6234b Merge branch 'wip/jimmac/cut-finger' into 'master'
assets: adjust gesture graphic

Closes #3074

See merge request GNOME/gtk!2573
2020-09-14 10:34:52 +00:00
Jakub Steiner
bcb2861447 assets: adjust gesture graphic
- quick, somebody on the internet is offended!

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3074
2020-09-14 12:14:40 +02:00
Jakub Steiner
962f76ddc9 Adwaita: navigation-sidebar spacing
- split from placessidebar as it's more generic

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3138
2020-09-14 11:51:54 +02:00
Matthias Clasen
d45aabb4ec Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2570
2020-09-14 04:45:07 +00:00
Matthias Clasen
9f03462ffb gtk-demo: Improve the scrolling demo
Add an fps label to the scrolling demo.
2020-09-13 23:43:45 -04:00
Matthias Clasen
3b11896581 gtk-demo: Impove the fishbowl demo
Use tnum for the fps label to avoid jiggling.
2020-09-13 23:43:45 -04:00
Matthias Clasen
c66a8cb941 gtk-demo: Use gdk_frame_clock_get_fps
Remove another copy of this code in the theme
switching benchmark.
2020-09-13 23:43:45 -04:00
Matthias Clasen
c462f35a5e inspector: Use gdk_frame_clock_get_fps 2020-09-13 23:35:01 -04:00
Matthias Clasen
b166999683 Add gdk_frame_clock_get_fps
We already have more than one copy of this code
in GTK, so just export this function.
2020-09-13 23:35:01 -04:00
Matthias Clasen
4b589b6afb main: Reshuffle debug code
Mode all the debug flags related code together,
to make gtkmain.c a bit less messy.
2020-09-13 22:48:29 -04:00
Matthias Clasen
fedeb51f31 Drop support for GTK_TEST_TOUCHSCREEN
This environment variable is undocumented, and you can
just use GTK_DEBUG=touchscreen insead.
2020-09-13 22:44:32 -04:00
Matthias Clasen
d2faa38eed Move version-related functions to gtkversion.c
This is just an internal cleanup, to make gtkmain.c
a bit less messy.
2020-09-13 22:23:06 -04:00
Matthias Clasen
ff9ca2b68d Clean up debug flags code a bit
Use the GtkDebugFlags enum, since we have it.
2020-09-13 22:10:25 -04:00
Matthias Clasen
aa5207b349 iconview: Small doc additions 2020-09-13 21:51:42 -04:00
Matthias Clasen
2b5b6e0885 Drop gtk_render_slider from headers
The function does not exist.
2020-09-13 21:51:42 -04:00
Matthias Clasen
93d9a2ceda colorchooser: Bring back gtk_color_chooser_widget_new
This was removed by accident in commit f392fbfb6d6f1116728b.
2020-09-13 21:51:42 -04:00
Matthias Clasen
5ab77e72e2 docs: Misc updates
Pick up a number of symbols that have been missed,
and drop GtkAccelLabel.
2020-09-13 21:51:42 -04:00
Matthias Clasen
5a7faa6512 docs: Add new check button apis 2020-09-13 21:51:42 -04:00
Matthias Clasen
b7d42502ce docs: Some touchups to the migration guide 2020-09-13 21:51:42 -04:00
Matthias Clasen
2d766dff96 NEWS: Updates 2020-09-13 21:51:42 -04:00
Matthias Clasen
e3bab0b766 Merge branch 'gtk-demo-demo' into 'master'
Gtk demo demo

See merge request GNOME/gtk!2569
2020-09-13 23:37:22 +00:00
Matthias Clasen
d3c5c7f4ef Merge branch 'update-default-palette' into 'master'
colorchooserwidget: Update default palette

See merge request GNOME/gtk!2568
2020-09-13 23:28:57 +00:00
nana-4
f6e4486338 colorchooserwidget: Update default palette
This makes it completely in line with the new GNOME HIG color palette.

See https://gitlab.gnome.org/GNOME/gtk/-/issues/3146
2020-09-14 07:05:04 +09:00
Matthias Clasen
9d6990fdb9 gtk-demo: Don't offer to run titles
When a group is selected (such as 'Benchmark'),
make the run button insensitive - there is nothing
to run.
2020-09-13 17:55:10 -04:00
Matthias Clasen
3f1fa66479 Demo thyself
Make gtk-demo show itself as a useful example.
2020-09-13 17:54:58 -04:00
Matthias Clasen
8094f757eb Merge branch 'demo-keywords' into 'master'
gtk-demo: add keywords to filtering

See merge request GNOME/gtk!2567
2020-09-13 21:13:21 +00:00
Matthias Clasen
d732c869c2 gtk-demo: Add keywords to demos
Add the names of the main widgets as keywords to
our demos, but also things like "game". This helps
finding relevant demos in our growing list. You
can now for example type "label", and find the
"error states" and "links" demos showing GtkLabel
features.
2020-09-13 15:00:14 -04:00
Matthias Clasen
691261c71a gtk-demo: Support keywords for search
Filter the sidebar on keywords that can be provided
by the demos. We extract keywords from the doc comment
at the top of each demo source by looking for words that
look like class names. We also allow to specify keywords
explicitly.
2020-09-13 15:00:14 -04:00
Matthias Clasen
fe6f70efe1 gtk-demo: Ignore some lines in info
Ignore lines starting with # in the info comment at
the top of source files. This will be used to add
keywords for search in following commits.
2020-09-13 14:42:03 -04:00
Matthias Clasen
cddbc8f1cc Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2566
2020-09-13 18:39:12 +00:00
Matthias Clasen
a90801e696 gtk-demo: Add another demo
This one is a more or less direct copy of the
settings dialog from widget-factory, demonstrating
error states and builder scopes.
2020-09-13 12:36:30 -04:00
Rūdolfs Mazurs
f445cc0d70 Update Latvian translation 2020-09-13 12:30:52 +00:00
Claude Paroz
6cf7b95bec Updated French translation 2020-09-13 10:46:33 +02:00
Matthias Clasen
7518fd0d70 gtk-demo: Make F11 toggle fullscreen
In the video player demo, we have a button to make
the window fullscreen, but no easy way back. Add
the usual F11 keybinding, to make things at least
somewhat recoverable.
2020-09-13 02:31:41 -04:00
Matthias Clasen
30c3a533f4 video: Make autoplay work
We were setting things up in the wrong order, so
autoplay had no effect when you using gtk_video_set_file().
2020-09-13 01:56:56 -04:00
Matthias Clasen
52304fe7da gtk-demo: Add some example videos
Add buttons to show the gtk-logo animation and
the Big Buck Bunny trailer.
2020-09-13 01:51:55 -04:00
Matthias Clasen
22257b124a placessidebar: Remove a pointless restriction
The sidebar was refusing to show shortcuts for
things that don't have a local path, for no
good reason.
2020-09-13 01:14:00 -04:00
Matthias Clasen
4629182246 filechooser: Fix setting unlisted filters
This is documented to work, but it was broken
when we ported things to list models.
2020-09-13 01:12:51 -04:00
Matthias Clasen
c8a9e7fa82 Fix a compiler warning 2020-09-13 01:12:39 -04:00
Matthias Clasen
8f593827cf widget-factory: Fix error states demo
Fix a corner case of input validation in the settings
dialog.
2020-09-13 00:17:19 -04:00
Matthias Clasen
8984fe3c35 Cosmetics 2020-09-13 00:17:19 -04:00
Matthias Clasen
fc720b57e2 gtk-demo: Don't refer to removed demos
The animated background demos was referring to the
pixbuf demo that was removed a while ago. Reword
the text accordingly.
2020-09-13 00:17:19 -04:00
Emin Tufan Çetin
4cb367a6e2 Update Turkish translation 2020-09-12 17:11:40 +00:00
Matthias Clasen
b534752d5c Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3110 and #2994

See merge request GNOME/gtk!2565
2020-09-12 16:25:17 +00: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
6ed1c181ee AUTHORS: some updates 2020-09-12 11:52:14 -04:00
Matthias Clasen
0011a1032d text: Claim the sequence when we start selecting
Without this, drag-select will only work sporadically
in entries in headerbars.

Fixes: #2994
2020-09-12 11:18:36 -04:00
Matthias Clasen
38b71ba292 Cosmetics
Add a missing comma.
2020-09-12 11:11:28 -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
756c52ef08 filechooser: Prevent a crash
With csd, we are handling external widgets when
there is an entry in the headerbar. Use a weak ref
to prevent that pointer from going stale. This fixes
a crash when cancelling a save dialog.

Fixes: #3110
2020-09-12 10:40:13 -04:00
Emmanuele Bassi
9afdb41b6b Merge branch 'ebassi/for-master' into 'master'
Properly annotate GtkLayoutManagerClass.create_layout_child()

Closes #3156

See merge request GNOME/gtk!2564
2020-09-12 14:24:13 +00:00
Emmanuele Bassi
25bcec5cbb Properly annotate GtkLayoutManagerClass.create_layout_child()
We're missing the ownership transfer rule for the created GtkLayoutChild
instance; this makes the virtual function not introspectable.

Fixes: #3156
2020-09-12 14:33:24 +01:00
Emin Tufan Çetin
eba5232e35 Update Turkish translation 2020-09-12 06:14:30 +00:00
Matthias Clasen
7ee3439522 Merge branch 'emblem-demo' into 'master'
Emblem demo

See merge request GNOME/gtk!2563
2020-09-12 01:33:51 +00:00
Matthias Clasen
71ea619274 gtk-demo: Add an emblem demo
Add a simple demo for adding emblems to icons
using GdkPaintable.
2020-09-11 21:09:41 -04:00
Matthias Clasen
f679ba566e gtk-demo: Tweak the animated paintable
Make it possible to have no background in
the animated paintable. This will be used
in a future demo.

Update all users.
2020-09-11 21:08:36 -04:00
Matthias Clasen
2679e29375 gtk-demo: Fix a few crash
The paintable demos were forgetting to clear
their window variable.
2020-09-11 21:07:10 -04:00
Matthias Clasen
e55bdf87b5 Merge branch 'text-layout-speedup' into 'master'
textlayout: Avoid some iter comparisons

See merge request GNOME/gtk!2561
2020-09-11 21:20:38 +00:00
Matthias Clasen
c09575d9cb textlayout: Avoid some iter comparisons
We were doing more iter comparisons than necessary in the
inner loop of gtk_text_layout_snapshot(), in the presence
of a selection. Rewrite the code to compare line numbers
instead, which is faster than full iter comparisons.
2020-09-11 16:41:42 -04:00
Matthias Clasen
c3b925d696 Merge branch 'wip/otte/for-master' into 'master'
contentserializer: Don't send the terminating \0 byte for strings

Closes #3150

See merge request GNOME/gtk!2560
2020-09-11 15:50:23 +00:00
Benjamin Otte
640856edec contentserializer: Don't send the terminating \0 byte for strings
Fixes #3150
2020-09-11 17:25:02 +02:00
Matthias Clasen
1e7fccf46f Merge branch 'wip/jimmac/new-colors' into 'master'
Wip/jimmac/new colors

Closes #3146

See merge request GNOME/gtk!2558
2020-09-11 13:56:48 +00:00
Matthias Clasen
ff392fbfb6 colorchooser: Don't parse color names needlessly
We have a fancy macro to initialize GdkRGBAs without
any runtime work, lets use them.
2020-09-11 09:31:17 -04:00
Matthias Clasen
498cbae95c colorchooser: Drop color names
These were not used anymore, after a11y stopped using them.
2020-09-11 09:12:34 -04:00
Matthias Clasen
fa9608fd02 color chooser: Don't show too many custom colors
The code was hardcoding a fixed number of custom
colors, but we really want to match the number
of columns in the palette(s). Make it so.
2020-09-11 08:42:03 -04:00
Jakub Steiner
8700e136da colorChooser: updte color palette
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3146
2020-09-11 10:47:24 +02:00
Ask Hjorth Larsen
2e54810937 Updated Danish translation of gtk-properties 2020-09-11 02:31:50 +02:00
Ask Hjorth Larsen
93a09a4a6a Updated Danish translation of gtk 2020-09-11 02:31:41 +02:00
Matthias Clasen
299b1bd848 Merge branch 'matthiasc/for-master' into 'master'
x11: Print all tested glx extensions

See merge request GNOME/gtk!2556
2020-09-10 21:56:46 +00:00
Matthias Clasen
1e9a9876d5 x11: Print all tested glx extensions
When initializing a glx context, print all the extensions
we look for.
2020-09-10 17:30:28 -04:00
Matthias Clasen
1de7440c8c Merge branch 'gdk-cleanups' into 'master'
Gdk cleanups

Closes #2790

See merge request GNOME/gtk!2553
2020-09-10 20:21:12 +00:00
Matej Urbančič
5c87432a0c Update Slovenian translation 2020-09-10 20:12:10 +00:00
Matej Urbančič
80e53e704c Update Slovenian translation 2020-09-10 20:09:27 +00:00
Matthias Clasen
24bf01dd42 Merge branch 'fix-vulkan-context-creation' into 'master'
Fix vulkan context creation

Closes #3147

See merge request GNOME/gtk!2555
2020-09-10 18:18:55 +00:00
Matthias Clasen
2113f98c5c gdk: Don't create surfaces of size 0x0
Don't pass 0x0 as size when calling gdk_surface_new().
The Wayland backend takes us literally, and we end
up with a surface that (temporarily) has these
dimensions, confusing other APIs that we pass the
size to, such as Vulkan.
2020-09-10 13:56:44 -04:00
Matthias Clasen
b9d4654fca vulkan: Fix swapchain creation
We end up with a surface that has size 0x0 at the
time we create the Vulkan context, and that is a
size that Vulkan doesn't like, so ensure we request
at least 1x1.

Fixes: #3147
2020-09-10 13:55:16 -04:00
Matthias Clasen
7151b1fc31 Merge branch 'ebassi/for-master' into 'master'
docs: Add note on command line arguments

See merge request GNOME/gtk!2554
2020-09-10 17:39:25 +00:00
Emmanuele Bassi
790733673f docs: Add note on command line arguments
We don't parse them any more, and developers should stop using them when
migrating from GTK3 to GTK4.
2020-09-10 17:53:50 +01:00
Milo Casagrande
aff788e583 Update Italian translation 2020-09-10 08:03:38 +00:00
Matthias Clasen
d5d4af585d gdk: Move GdkSurfaceEdge to the right header
This is only used in gdktoplevel.h, so move it there.
2020-09-10 00:44:05 -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
cee275980a gdk: Move GdkSurfaceState to the right header
This is really a toplevel state, so move it
to that header.
2020-09-10 00:25:51 -04:00
Matthias Clasen
b3aa5ad4f9 Move GdkFullscreenMode to the right header
This enum is just used for a GdkToplevel property now,
so move the declaration to the gdktoplevel.h header.
2020-09-10 00:22:26 -04:00
Matthias Clasen
9b0b19d335 NEWS: Updates 2020-09-09 23:49:58 -04:00
Matthias Clasen
d47d036663 search entry: Don't propagate handled events
When the text says it has handled the event,
trust it. We don't want to emit ::search-started
if the content hasn't changed, but we still
should not propagate e.g. an Insert key press
if it has already toggled overwrite mode in
the text.

Fixes: #2874
2020-09-09 22:26:27 -04:00
Matthias Clasen
5c67fe0bc2 Merge branch 'fix-gl-texture-cache' into 'master'
gsk: Fix the gl texture cache

See merge request GNOME/gtk!2552
2020-09-09 19:27:24 +00:00
Matthias Clasen
1057588a8f gsk: Fix the gl texture cache
We need to include both the scale and the filtering
in the key for the texture cache, since those affect
the texture.

This fixes misrendering in the recorder in the inspector
whenever transforms are involved. An example where this
was showing up is testrevealer's swing transition.
2020-09-09 13:55:09 -04:00
Tim Sabsch
75f0b7acaa Update German translation 2020-09-09 17:23:14 +00:00
Benjamin Otte
9a927176df Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

Closes #3137

See merge request GNOME/gtk!2550
2020-09-09 16:44:29 +00:00
Benjamin Otte
cb5b375f43 revealer: Remove arbitrary 100x scale limit
This is no longer necessary because the bug it was rying to solve is now
solved via the preference for min and nat size.
2020-09-09 17:38:37 +02:00
Benjamin Otte
dfccaa8831 revealer: Prefer min and nat size
Assume that the fully expanded revealer will likely get an allocation
that matches the child's minimum or natural allocation, so we
special-case these two values.

So when - due to the precision loss - multiple sizes would match the
current allocation, we don't pick one at random, we prefer the min and
nat size.

The preference of nat size over min sie was decided after an IRC vote,
we don't actually have an idea what's more likely to happen in the real
world.
Should we ever get better data, we might want to switch.
2020-09-09 17:38:37 +02:00
Benjamin Otte
cc58956dbb revealer: Use floor(), not ceil()
We use ceil() in measure(), so using it again will increase the
child's size whenever there is even a tiny rounding error.

This should also not make the size too small, because:
min = ceil(child_min * scale)
min / scale >= child_min
floor (min / scale) >= floor (child_min) = child_min
The last equality is because child_min is an integer.

Fixes #3137
2020-09-09 17:38:37 +02:00
Benjamin Otte
0ad10ccf39 revealer: Refactor code
Assign the values in the same place.
2020-09-09 17:38:37 +02:00
Benjamin Otte
8cb03a8cc0 widget: Add a critical when allocation is too small. 2020-09-09 17:38:37 +02:00
Emmanuele Bassi
df7cbdfff4 Merge branch 'issue-3140' into 'master'
Make sure we don't call back into GtkEntryBuffer

Closes #3140

See merge request GNOME/gtk!2549
2020-09-09 10:54:07 +00:00
Emmanuele Bassi
f4b410daa7 Make sure we don't call back into GtkEntryBuffer
After commit 7e77afe94c moved the deletion
of text into the signal handler, in order to make undo work, we need to
override the GtkEntryBuffer::deleted-text class closure when subclassing
GtkEntryBuffer, as well as overriding GtkEntryBufferClass.delete_text,
otherwise the default class closure will be invoked, and will try to
delete an empty buffer.

Fixes: #3140
2020-09-09 11:29:16 +01:00
Emmanuele Bassi
b3d3d81c82 Merge branch 'gtksecurememory-win32' into 'master'
Port gtksecurememory.c to Windows

See merge request GNOME/gtk!2548
2020-09-09 10:12:44 +00:00
Chun-wei Fan
3095bccd2e gtksecurememory.c: Port secure memory allocation to Windows
Use the Windows API CryptProtectMemory() to encrypt the data that we want to
secure, and use CryptUnprotectMemory() to de-crypt the secured data that we
want to access, since mmap() and mlock() are not available on Windows.
2020-09-09 13:50:15 +08:00
Chun-wei Fan
c72b2f6167 gtksecurememory.c: Don't include unistd.h unconditionally
It is not universally available on non-POSIX systems.
2020-09-09 13:48:33 +08:00
Matthias Clasen
3d10b28df4 Merge branch 'matthiasc/for-master' into 'master'
shadertoy demo: Cosmetic fixes

See merge request GNOME/gtk!2547
2020-09-09 00:40:54 +00:00
Matthias Clasen
d6807b966c shadertoy demo: Cosmetic fixes 2020-09-08 20:08:23 -04:00
Matthias Clasen
887d0b7411 Merge branch 'ebassi/secure-buffer' into 'master'
Add secure entry buffer

Closes #3119 and #2403

See merge request GNOME/gtk!2545
2020-09-08 23:48:25 +00:00
Matthias Clasen
3921476504 Merge branch 'shadertoy-demo' into 'master'
gtk-demo: Add shadertoy demo

See merge request GNOME/gtk!2540
2020-09-08 23:47:54 +00:00
Emmanuele Bassi
ae97284409 docs: Add a note on GtkPasswordEntry's secure storage 2020-09-08 23:50:12 +01:00
Emmanuele Bassi
7cda32d49e Use GtkPasswordEntryBuffer in GtkPasswordEntry
Now that we have a secure buffer, we should start using it.

Fixed: #3119
2020-09-08 23:50:12 +01:00
Emmanuele Bassi
fb99bde840 Add a secure GtkEntryBuffer
We have a widget for password and passphrase entries, but we have no way
to handle the data securely. This is usually performed by a separate
GtkEntryBuffer—for instance, the one in GCR. While we have API for
setting a new entry buffer on GtkText, we don't have API for
GtkPasswordEntry, though, so the options are:

 - expose additional API for GtkPasswordEntry to allow setting a secure
   text buffer on the internal GtkText widget
 - provide a secure text buffer out of the box

Given that an insecure-by-default GtkPasswordEntry is basically
pointless, might as well have a secure buffer built in.

We don't really need to make the password entry buffer public out of the
box, but we can re-evaluate at a later date.

Fixes: #2403
2020-09-08 23:50:12 +01:00
Emmanuele Bassi
9dc5c6a0f3 Move g_autoptr macro for GtkEntryBuffer
We need it into its own header, so we can derive from GtkEntryBuffer
with G_DECLARE_* macros without including gtk.h.
2020-09-08 23:50:12 +01:00
Emmanuele Bassi
107e49002d Check for mlock()
We use it in the secure memory allocator, if it's available.
2020-09-08 23:50:12 +01:00
Emmanuele Bassi
31a7574544 Import egg-secure-memory allocator from gcr
We can re-use the code inside gcr, as we know that it's working, tested,
and license compatible.
2020-09-08 23:50:12 +01:00
Emmanuele Bassi
859df747ac Merge branch 'sorter-constructor-fix-warning' into 'master'
Fix warning in listview_settings demo

See merge request GNOME/gtk!2544
2020-09-08 17:54:25 +00:00
Andreas Persson
81c835c418 Fix warning in listview_settings demo
Fix a warning introduced when sorter constructors were changed to return
exact types.
2020-09-08 18:48:54 +02:00
Ask Hjorth Larsen
33e633cc5c Updated Danish translation of gtk-properties 2020-09-08 16:23:16 +02:00
Ask Hjorth Larsen
73b46eafe1 Updated Danish translation of gtk 2020-09-08 16:23:05 +02:00
Marek Černocký
710ef690ec Updated Czech translation 2020-09-08 15:33:40 +02: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
Danial Behzadi
45c61fdbe3 Update Persian translation 2020-09-08 12:50:36 +00:00
Alexandre Franke
ec49b68257 Update French translation 2020-09-08 09:15:19 +00:00
Alexander Larsson
0092a08dfc gtk-demo: Add shadertoy demo
This adds a small demo of using OpenGL shaders, it renders a quad
over the entire widget with a custom fragment shader. The coordinates
and the uniform names are compatible with the ones on shadertoy.com
(although some features, like texture inputs are missing currently).

The default shader in the demo is
https://www.shadertoy.com/view/wsjBD3 which is CC0, so it is
redistributable by Gtk+ (most other shaders are CC-BY-NC-SA which
isn't obviously compatible). I also added a set of buttons loading
a few other CC0 shaders I found.
2020-09-08 09:56:25 +02:00
Matthias Clasen
bab7092a69 Merge branch 'gl-linear' into 'master'
Gl: use linear interpolation

See merge request GNOME/gtk!2523
2020-09-07 21:27:09 +00:00
Matthias Clasen
3b6941b04b Add some tests for the axis-aligned check 2020-09-07 14:22:47 -04:00
Matthias Clasen
fe429ffc45 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2541
2020-09-07 17:03:27 +00:00
Matthias Clasen
d595c6ab12 gsk: Complain if we fail to realize a renderer
The only likely place where this is going to happen
is if a renderer was explicitly requested with the
GSK_RENDERER environment variable, and in that case,
it is misleading to silently use a different renderer.
2020-09-07 11:18:45 -04:00
Matthias Clasen
2738d5bc93 gsk: Mention gl as valid value for GSK_RENDERER 2020-09-07 11:18:45 -04:00
Matthias Clasen
5a8267dfae text: Set the hotspot for the drag icon
This makes the drag icon align properly with the
dragged text at the beginning of the drag.
2020-09-07 11:18:45 -04:00
Marek Černocký
d03ce22446 Updated Czech translation 2020-09-07 14:34:07 +02:00
Gil Forcada
350051c56e Update Catalan translation 2020-09-07 10:31:39 +00:00
Daniel Mustieles
979ec828d2 Updated Spanish translation 2020-09-07 08:59:50 +02:00
Fran Dieguez
99ddb3c927 Update Galician translation 2020-09-06 23:22:39 +00:00
Fran Dieguez
770910e608 Update Galician translation 2020-09-06 23:20:08 +00:00
Matthias Clasen
7180bfc288 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3123

See merge request GNOME/gtk!2539
2020-09-06 21:39:08 +00:00
Matthias Clasen
bc80ed4240 aboutdialog: Disable text undo
The text buffers here are not editable, so it
does not make sense to have text undo enabled
for them.

Fixes: #3123
2020-09-06 17:02:00 -04:00
Matthias Clasen
4d45c2669c text history: Update state when enabled changes
This makes can-undo go FALSE when we disable the
text history, as it should.
2020-09-06 17:02:00 -04:00
Balázs Úr
dd8ca7259f Update Hungarian translation 2020-09-06 20:31:44 +00:00
Matthias Clasen
06c866f45e Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2538
2020-09-06 19:38:56 +00:00
Baurzhan Muftakhidinov
2bd7ed5ebd Update Kazakh translation 2020-09-06 17:36:39 +00:00
Matthias Clasen
adc9d91e0e text: Stop drag updates when a dnd starts
This prevents the selection from changing underneath
us, messing up move dnd operations.
2020-09-06 12:19:44 -04:00
Matthias Clasen
1150c23b0f Merge branch 'listwidgets-doc-fix' into 'master'
docs: Update list widgets docs

See merge request GNOME/gtk!2537
2020-09-06 15:53:59 +00:00
Matthias Clasen
9b8c175f23 textview: Fix dnd
When we start a dnd of the selection in the drag-update handler,
set the gesture state to denied. Otherwise, we get more drag-update
signals, and things get really confused, leading to no dnd and
sadness.
2020-09-06 11:48:10 -04:00
Andreas Persson
e0134aaf15 docs: Update list widgets docs
Removed sentence that claimed the view will wrap the model in a
GtkSingleSelection, as it's no longer true. Fixed the code example in
GtkListView for the same reason. Fixed a small typo in GtkDropDown docs.
2020-09-06 17:19:24 +02:00
Matthias Clasen
bd7aa1782c Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2535
2020-09-06 13:25:43 +00:00
Alexandre Franke
007c9c6218 Update French translation 2020-09-06 12:44:35 +00:00
Matthias Clasen
8c8baa9aa6 gtk-demo: Add some comments
Add some comments to the math in the transforms demo.
2020-09-06 08:43:58 -04:00
Asier Sarasua Garmendia
7ae0f56378 Update Basque translation 2020-09-06 09:01:32 +00:00
Kukuh Syafaat
3fcf7adb25 Update Indonesian translation 2020-09-06 05:16:58 +00:00
Matthias Clasen
8b38d1895c gtk-demo: Simplify the constraints demos
Give them all a close button in the header.
2020-09-05 22:54:16 -04:00
Matthias Clasen
a4ba25f0f8 inspector: Fix teardown of the general tab
We were connecting signal handlers to the display
and seats here, and never cleaning them up, leading
to crashes after the inspector is closed. This is
fairly easy to reproduce under Wayland, where the
scroll device is only created the first time we
create a scroll event.
2020-09-05 22:35:30 -04: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
Goran Vidović
716c7b2f21 Update Croatian translation 2020-09-05 20:45:50 +00:00
Aurimas Černius
c74c38ad06 Updated Lithuanian translation 2020-09-05 19:57:34 +03:00
Matthias Clasen
727f25f6da Merge branch 'revert-43ca43a22f' into 'master'
Revert "Adwaita: rich-list styling"

See merge request GNOME/gtk!2533
2020-09-05 16:00:33 +00:00
Matthias Clasen
01959e1662 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3122

See merge request GNOME/gtk!2534
2020-09-05 14:49:10 +00:00
nana-4
12afc10ec3 Revert "Adwaita: rich-list styling"
This reverts commit 2f0a4c7128.

It seems the commit was accidentally added when
768e24afc1 was manually merged and pushed.
2020-09-05 23:13:24 +09:00
Matthias Clasen
2f70279f85 Merge branch 'typo_correction' into 'master'
Typo correction

Closes #3086 and #3090

See merge request GNOME/gtk!2532
2020-09-05 13:54:18 +00:00
Matthias Clasen
ffc77ca926 css: Use an array when parsing selectors
There's no need for us to have a hard size-limit here;
with GdkArray we don't have to give up on stack-preallocation
either.
2020-09-05 09:51:59 -04:00
Emin Tufan Çetin
021eeedef0 Update Turkish translation 2020-09-05 12:45:24 +00:00
Matthias Clasen
635492b016 text: Don't replace unselected text with Emoji
We must be careful to not select everything on focus-in
before we have the Emoji inserted. This was accidentally
broken in d5121af876.

Fixes: #3122
2020-09-05 08:40:02 -04:00
Yuri Chornoivan
bd226cc31e Update Ukrainian translation 2020-09-05 12:29:46 +00:00
Ahmed Eldemery
cbd3158d91 add a missing comma 2020-09-05 13:49:01 +02:00
Ahmed Eldemery
982cf0c4d3 Merge remote-tracking branch 'upstream/master' into master 2020-09-05 13:46:27 +02:00
Piotr Drąg
d37cb36eb1 Update Polish translation 2020-09-05 13:27:57 +02:00
Piotr Drąg
e374917c56 Update POTFILES.in 2020-09-05 11:53:39 +02:00
Matthias Clasen
1dd4e91fee Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2531
2020-09-04 17:57:23 +00:00
Matthias Clasen
c1bf9f3b41 layoutmanager demo: Make icons come out upright
Rearrange the vertices so that the icons show
up in the proper orientation.
2020-09-04 13:40:10 -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
81f84fbe8f modelbutton: Claim the gesture
This aligns the model button behavior with what
GtkButton does.
2020-09-04 13:20:33 -04:00
Matthias Clasen
60e37d3368 Update gsk tests
Add a clip-coordinates-2d test that is similar
to clip-coordinates-3d, but actually uses a 2D
transform.
2020-09-04 13:19:01 -04:00
Matthias Clasen
e0cc7b5d86 Check for pixel-alignedness for interpolation
When rendering to an offscreen because of transforms,
check if transforming the bounds of the node results
in a non-axis-aligned quad. If it doesn't, we want
GL_NEAREST interpolation to get sharp edges. Otherwise,
we use GL_LINEAR to get better results for things
that are actually transformed.
2020-09-04 13:16:53 -04:00
Matthias Clasen
9843515736 gl: Reshuffle some code
Just rearrange the cases in this switch, no effective change.
2020-09-04 13:16:11 -04:00
Matthias Clasen
41497aeb8b Add gsk_matrix_transform_rect
This is a projecting version of the corresponding
graphene api. While we are at it, rewrite
gsk_matrix_transform_bounds() to use
gsk_matrix_transform_rect().
2020-09-04 13:15:21 -04:00
Matej Urbančič
bb2a0e69f4 Updated Slovenian translation 2020-09-04 17:30:55 +02:00
Matthias Clasen
f70e37a341 Merge branch 'release-script' into 'master'
Release script

See merge request GNOME/gtk!2530
2020-09-04 15:30:35 +00:00
Benjamin Otte
1a445d79c4 Merge branch 'demo_css_pixbufs_fix' into 'master'
gtk-demo: Fix CSS in pixbufs demo

See merge request GNOME/gtk!2529
2020-09-04 14:40:36 +00:00
Matthias Clasen
925a01162f build: Add a release script
I've goofed up too many times producing the separate
doc tarballs. So lets collect the required steps in a script.
2020-09-04 10:26:16 -04:00
Björn Daase
3bcbb4a7cc gtk-demo: Fix CSS in pixbufs demo 2020-09-04 16:14:09 +02:00
Matthias Clasen
a8eae7afaa build: Move the gtk-doc dep to the toplevel
We want to include the gtk-doc subproject in release
tarballs, using --include-subprojects, but that only
works if we've actually built the subproject. And
enabling gtk-doc for dist builds is problematic -
it tends to break meson dist.

So declare the gtk-doc dependency independent of
-Dgtk_doc, and use --force-fallback-for for it.
2020-09-04 09:57:14 -04:00
Dušan Kazik
99a09e0d08 Update Slovak translation 2020-09-04 12:42:52 +00:00
Matthias Clasen
275302a9d5 Merge branch 'fix-gtk-application-menu-example' into 'master'
GtkApplicationWindow: Fix menubar example

See merge request GNOME/gtk!2528
2020-09-04 12:32:40 +00:00
Emmanuele Bassi
749d0744da Merge branch 'ebassi/for-master' into 'master'
Ebassi/for master

Closes #3118

See merge request GNOME/gtk!2527
2020-09-04 11:56:03 +00:00
Emmanuel Gil Peyrot
62f7395c77 GtkApplicationWindow: Fix menubar example
This example was using invalid attribute syntax.
2020-09-04 13:49:28 +02:00
Emmanuele Bassi
f7f0bc0369 Use consistent argument name
Declarations, definitions, and gtk-doc stanzas should use the same name
for arguments. Otherwise both g-ir-scanner and gtk-doc will complain
that they can't find the argument.
2020-09-04 12:05:01 +01:00
Emmanuele Bassi
1896d7f463 build: Make sysprof truly optional
We are falling back to the sysprof subproject even if sysprof support
has been explicitly disabled.

Fixes: #3118
2020-09-04 12:02:15 +01:00
Emmanuele Bassi
927c4abf23 Merge branch 'fix-vulkan-dependency-searching' into 'master'
meson: Fix Vulkan dependency checking

Closes #3108

See merge request GNOME/gtk!2526
2020-09-04 10:49:50 +00:00
Chun-wei Fan
b322ddba5c gdksurface-win32.c: Fix missed include
We need to include gdkdevice-win32.h for gdksurface-win32.c
2020-09-04 17:24:57 +08:00
Nirbheek Chauhan
b25871438d meson: Fix Vulkan dependency checking
The dependency block was completely wrong. It was:

1. Not searching for the lib manually when -Dvulkan=enabled (default).
   The else block was only hit when -Dvulkan=auto.
2. Unconditionally searching for the vulkan library in the else block
   when -Dvulkan=disabled

The manual searching is also not required because Meson has a custom
'vulkan' dependency class that already supports Windows, and is more
correct than the code here. Specifically, the current code does not
support picking up the Vulkan SDK from a custom path.

Fixes #3108
2020-09-04 11:50:50 +05:30
Jordi Mas
aff3cc6194 Update Catalan translation 2020-09-04 06:26:23 +02:00
Ahmed Eldemery
f2c4ad0087 Merge remote-tracking branch 'upstream/master' into master 2020-09-03 20:24:26 +02:00
Matthias Clasen
1a131a04d3 3.99.1 2020-09-03 14:20:06 -04:00
Matthias Clasen
887539e4ff gridview: Make constructor arguments nullable
I forgot to adjust the precondition when copying things
around.
2020-09-03 14:20:06 -04:00
Matthias Clasen
98440142da Merge branch 'layout-manager-transform-demo' into 'master'
Layout manager transform demo

See merge request GNOME/gtk!2519
2020-09-03 14:49:31 +00:00
Matthias Clasen
acc2516b3c Add another layout manager demo
This demo uses transforms to place icons on a sphere.
2020-09-03 10:09:22 -04:00
Matthias Clasen
fd7a9069ce Cosmetic improvement to the layout manager demo
Give this a better title, since we will have more
than one layout manager demo soon.
2020-09-03 10:09:22 -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
eee6d28c67 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3109 and #3112

See merge request GNOME/gtk!2522
2020-09-02 19:47:40 +00:00
Matthias Clasen
30ab8b3eca Fix picking
My previous change here was too hasty - this code is not
actually transforming points - it is just a convoluted
way to transform the z axis from child coordinates to
the parent.
2020-09-02 15:20:58 -04:00
Matthias Clasen
d5121af876 text widgets: Don't lose focus after Emoji
Make sure to grab focus back when the Emoji chooser
disappears. This prevents focus going nowhere when
the Emoji chooser is canceled.

Fixes: #3112
2020-09-02 15:20:58 -04:00
Matthias Clasen
9512e461d5 textview: Fix placement of Emoji chooser
If the selection extends beyond the visible range,
place the Emoji chooser over the center of the window.

Fixes: #3109
2020-09-02 15:20:58 -04:00
Matthias Clasen
70c5dee968 NEWS: Updates 2020-09-02 15:20:58 -04:00
Emin Tufan Çetin
6c9fe63a23 Update Turkish translation 2020-09-02 18:26:15 +00:00
Mario Blättermann
a909f9d0f5 Update German translation 2020-09-02 17:14:28 +00:00
Carlos Garnacho
21b9dad9e6 Merge branch 'gesture-nullable-sequence' into 'master'
Annotate sequence argument of GtkGesture signals as nullable

See merge request GNOME/gtk!2520
2020-09-02 11:11:54 +00:00
Sebastian Dröge
ae5d1cd161 Annotate sequence argument of GtkGesture signals as nullable 2020-09-02 13:32:20 +03:00
Matthias Clasen
f53b59533d README: Cosmetics 2020-09-01 19:21:32 -04:00
Matthias Clasen
062822ab06 Merge branch 'checkbutton-fixes' into 'master'
Checkbutton fixes

See merge request GNOME/gtk!2518
2020-09-01 22:15:33 +00:00
Goran Vidović
fc333ead79 Update Croatian translation 2020-09-01 21:14:00 +00:00
Matthias Clasen
746bdd3d47 checkbutton: Don't notify write-only properties
Nobody is listening...
2020-09-01 16:31:07 -04:00
Matthias Clasen
c5c67cbb8c action helper: Drop G_GNUC_INTERNAL from headers
We haven't needed this for a long time now.
2020-09-01 16:29:21 -04:00
Matthias Clasen
639c839ba4 Add docs about grouping via action
Mention this in the docs for gtk_check_button_set_group
and gtk_toggle_button_set_group.
2020-09-01 16:29:21 -04:00
Matthias Clasen
5f8769e1a8 checkbutton: Support GtkActionable properly
Support grouping buttons via a radio action, as well
as via explicit gtk_check_button_set_group() calls.
2020-09-01 16:29:21 -04:00
Matthias Clasen
3569360949 actionhelper: Add a getter
Add a getter for the GtkActionHelper:role property.
2020-09-01 16:29:20 -04:00
Aurimas Černius
7070459c40 Updated Lithuanian translation 2020-09-01 22:45:16 +03:00
Matthias Clasen
1c0bf2604c checkbutton: Don't leak the action helper 2020-09-01 15:24:34 -04:00
Fran Dieguez
c2786fefa8 Update Galician translation 2020-09-01 19:08:43 +00:00
Matthias Clasen
1bbab5664d Merge branch 'license-clarification' into 'master'
License clarification

See merge request GNOME/gtk!2517
2020-09-01 18:58:52 +00:00
Matthias Clasen
a3030d3a62 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3107

See merge request GNOME/gtk!2516
2020-09-01 18:26:21 +00:00
Matthias Clasen
ec6d3ead03 Add a license clarification 2020-09-01 14:25:56 -04:00
Matthias Clasen
87855dd375 Move timsort sources to a subdirectory
This makes it easier to identify the files that
belong together, and are under the same license.
2020-09-01 14:25:56 -04:00
Matthias Clasen
0e6eba3968 inspector: Plug another memory leak
Fixes: #3107
2020-09-01 13:06:20 -04:00
Matthias Clasen
aaef9bec7f treelistrowsorter: Plug a memory leak 2020-09-01 13:01:34 -04:00
Matthias Clasen
391c05ef70 inspector: Plug a small memory leak 2020-09-01 12:57:08 -04:00
Benjamin Otte
133a9a6784 Merge branch 'listview-constructors' into 'master'
list widgets: Simplify the constructors

See merge request GNOME/gtk!2515
2020-09-01 16:42:09 +00: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
7051fdee5d Merge branch 'projective-transform' into 'master'
Replace uses of graphene_matrix_transform_

See merge request GNOME/gtk!2514
2020-09-01 13:44:38 +00:00
Matthias Clasen
e36b594867 Replace uses of graphene_matrix_transform_
Replace our uses of graphene_matrix_transform_point,
_point3d and _bounds by our own versions that handle
projective transforms correctly.

This fixes render node bounds being incorrect for widgets
involving projective transforms (e.g. testrevealer swing
transformations), and also fixes picking on such widgets.
2020-09-01 09:18:38 -04:00
Matthias Clasen
99a7a2188a gsk: Add some private transform apis
Some of the graphene_matrix_transform apis don't work
correctly with projective matrices, so add our own
variants.
2020-09-01 09:18:38 -04:00
Asier Sarasua Garmendia
3ac9f78141 Update Basque translation 2020-09-01 12:21:34 +00:00
Benjamin Otte
a8d6ba9517 Merge branch 'view-selection-model-3' into 'master'
list widgets: Use selection models in the api

See merge request GNOME/gtk!2512
2020-09-01 11:08:51 +00:00
Daniel Mustieles
482794515b Updated Spanish translation 2020-09-01 11:05:08 +02:00
Matthias Clasen
9377ce984d Merge branch 'adwaita-more-border-spacing' into 'master'
Adwaita: Add border-spacing to some container widgets and style classes (properly)

See merge request GNOME/gtk!2479
2020-08-31 21:17:21 +00: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
Matej Urbančič
b661bd9775 Updated Slovenian translation 2020-08-31 21:53:05 +02:00
Matej Urbančič
87dd79bc17 Updated Slovenian translation 2020-08-31 21:50:01 +02:00
Matthias Clasen
d2d8b748e9 NEWS: Updates 2020-08-31 13:37:52 -04:00
Matthias Clasen
ccb447da02 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

Closes #2777

See merge request GNOME/gtk!2503
2020-08-31 16:30:21 +00:00
Matthias Clasen
4580e71250 Merge branch 'fix_resource_leak_in_gdkdisplayclose_gtk4' into 'master'
Fix resource leak in gdk_display_close() under Wayland

See merge request GNOME/gtk!2511
2020-08-31 16:17:05 +00:00
Matthias Clasen
76b5ff6a00 pagesetupdialog: Just use labels in check buttons
Check buttons lost their ability to hold general
content. And while that is maybe sad, the tiny
images here are not really useful anyway, and
should just go away.
2020-08-31 12:05:53 -04:00
Julien Ropé
665955b81e Fix resource leak in gdk_display_close() under Wayland
When using the gdk_display_close(), the handle to the Wayland compositor was not released. This could cause the consumption of all available handles, preventing other processes from accessing the display.

Fixing this by calling wl_display_disconnect() when releasing the GdkWaylandDisplay object.

Signed-off-by: Julien Ropé <jrope@redhat.com>
2020-08-31 17:46:18 +02:00
Matthias Clasen
501cf493bf Fix a typo 2020-08-31 10:50:14 -04:00
sicklylife
684c36c13f Update Japanese translation 2020-08-31 14:36:14 +00:00
sicklylife
d93eb0d88f Update Japanese translation 2020-08-31 14:30:59 +00:00
Boyuan Yang
64b049f798 Update Chinese (China) translation 2020-08-31 13:44:27 +00:00
Matthias Clasen
03dd629257 Fix up the focus-chain tests
Several typos here, and some of the expected
output changes due to widget class changes.
2020-08-31 08:20:25 -04:00
Matthias Clasen
6ccc6a5650 doc shooter: Remove radio button remnants 2020-08-31 08:13:20 -04:00
Rafael Fontenelle
5adc1dc40f Update Brazilian Portuguese translation 2020-08-31 11:12:54 +00:00
Jakub Steiner
768e24afc1 Merge branch 'nana-4/gtk-fix-circular-button-styling' 2020-08-31 11:27:29 +02:00
nana-4
4cf9228659 Adwaita: Ensure button.circular is a perfect circle
It seems the commit 9d60047616 had no
effect, even on image buttons.
2020-08-31 11:24:46 +02:00
Jakub Steiner
2f0a4c7128 Adwaita: rich-list styling
FIXME: why is the second list in Demo>List Box>Controls taller?
2020-08-31 11:21:57 +02:00
Yuri Chornoivan
e64b08ab90 Update Ukrainian translation 2020-08-31 06:13:57 +00:00
Kukuh Syafaat
9bc97fb52c Update Indonesian translation 2020-08-31 06:04:08 +00:00
Kukuh Syafaat
077f21c9ff Update Indonesian translation 2020-08-31 06:02:57 +00:00
Matthias Clasen
cff211ea1f migration guide: Mention button hierarchy changes 2020-08-30 22:25:56 -04:00
Matthias Clasen
17c4838569 Drop GtkRadioButton 2020-08-30 22:25:36 -04:00
Matthias Clasen
bb6045f02d builder-tool: Replace radio buttons by check buttons
For --3to4, replace GtkRadioButton by either GtkCheckButton
or GtkToggleButton, depending on the value of :draw-indicator.

Update the testsuite to cover this.
2020-08-30 22:17:31 -04:00
Matthias Clasen
b98352de3e widget-factory: Stop using radio buttons
Use grouped toggle buttons for the view switcher
on page 2.
2020-08-30 22:17:31 -04:00
Matthias Clasen
1125a4379c iconbrowser: Stop using radio buttons
Replace them with grouped toggle buttons.
2020-08-30 22:14:05 -04:00
Matthias Clasen
f085ac837c fontrendering demo: Stop using radio buttons
Replace them with grouped toggled buttons.
2020-08-30 22:14:05 -04:00
Matthias Clasen
28d7f497ef togglebutton: Add grouping
This is the replacement for groups of radiobuttons
with draw-indicator = FALSE.
2020-08-30 22:14:05 -04:00
Matthias Clasen
b69e8d8e7b Remove GtkRadioButton uses in ui files in tests 2020-08-30 21:23:25 -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
cfade230ce docs: Update the gallery image for check buttons
Show grouped and ungrouped check buttons.
2020-08-30 21:23:25 -04:00
Matthias Clasen
238d52497d doc shooter: Drop radio buttons
Instead, show grouped checkbuttons.
2020-08-30 21:23:25 -04:00
Matthias Clasen
ba6070b7be build: The doc shooter works without x11 now
No need to restrict the build to just x11.
We're not using pixmaps anymore.
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
Matthias Clasen
cd284da794 checkbutton: Reuse a helper function 2020-08-30 21:23:25 -04:00
Matthias Clasen
591b52584e checkbutton: Fix clicking on the last group member
Clicking on the last group member was letting me
uncheck it, creating a radio group without active
item, which is not what we want.
2020-08-30 21:23:25 -04:00
Matthias Clasen
f30d32f609 pagesetupdialog: Drop gtkradiobutton.h include
No longer used.
2020-08-30 21:23:25 -04:00
Matthias Clasen
33b65d5e61 stackswitcher: Drop gtkradiobutton.h include
No longer used.
2020-08-30 21:23:25 -04:00
Matthias Clasen
00124b593e inspector: Drop gtkradiobutton.h include
No longer used.
2020-08-30 21:23:25 -04:00
Matthias Clasen
2d6c43b598 checkbutton: Drop gtkradiobutton.h include
No longer used.
2020-08-30 21:23:25 -04:00
Matthias Clasen
d6e1276fe1 mountoperation: Stop using radio buttons
Use grouped check buttons instead.
2020-08-30 21:23:25 -04:00
Matthias Clasen
151b9c71db printeroptionwidget: Stop using radio buttons
Use grouped check buttons instead.
2020-08-30 21:23:25 -04:00
Matthias Clasen
c9eb497989 gtk-demo: Fix up the fontrendering demo 2020-08-30 21:23:14 -04:00
Matthias Clasen
dc8b88393d Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3104

See merge request GNOME/gtk!2507
2020-08-30 22:01:45 +00:00
Matthias Clasen
7a05381825 gtk-demo: Port to font explorer to grouped checkbuttons
Stop using radio buttons here.
2020-08-30 17:59:23 -04:00
Matthias Clasen
e21b6a5721 widget-factory: Fix up radio buttons
Keep calling them radiobutton, since that is what they are.
And make the insensitive second group of three match what
we have in gtk3-widget-factory, and be parallel to the
insensitive checkbuttons next to it.
2020-08-30 17:59:23 -04:00
Matthias Clasen
d3042dabf4 printdialog: Make collate image smaller
This matches the appearance on GTK 3, and prevents
the checkbuttons next to the image from being spaced
out.
2020-08-30 17:59:23 -04:00
Matthias Clasen
830b2b7f30 printdialog: Fix radio groups
We need to use grouped checkbuttons now.
2020-08-30 17:59:23 -04:00
Matthias Clasen
af155838bd fontchooser: Fix radio groups for features
We need to use grouped checkbuttons now.
2020-08-30 17:59:23 -04:00
Matthias Clasen
2212daf979 Better fontconfig suppression 2020-08-30 13:14:55 -04:00
Matthias Clasen
5ef0ed1189 inspector: Add some translator comments
Some of the strings we have here are hard to translate,
so leave some hints, and some context.

Fixes: #3104
2020-08-30 13:12:10 -04:00
Matthias Clasen
071763c844 inspector: Add a dark background to the recorder
Add a button to toggle the background in the node
view between dark and light. This helps to discern
the borders of some nodes.
2020-08-30 08:59:13 -04:00
Matthias Clasen
c69ac09afb Another attempt to make circular buttons square
circular button, square hole...
2020-08-30 08:34:30 -04:00
Matthias Clasen
4ba84d6426 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3098

See merge request GNOME/gtk!2506
2020-08-30 12:29:24 +00:00
Bruce Cowan
fac0e7abd8 Update British English translation 2020-08-30 11:46:48 +00:00
Asier Sarasua Garmendia
14daddfa9d Update Basque translation 2020-08-30 10:26:53 +00:00
Asier Sarasua Garmendia
0c150e48f1 Update Basque translation 2020-08-30 10:23:55 +00:00
Matthias Clasen
c51f69c446 gtk-demo: Cosmetic change to the css shadows demo
Make the text view in the bottom take up the bulk
of the window, as it used to be.
2020-08-29 16:42:30 -04:00
Matthias Clasen
8e74687ab3 page setup dialog: Prevent cascading paper dialogs
We trigger the paper dialog when the "manage" item
in the dropdown is selected. But the selection also
changes due to internal changes, such as reloading
the custom paper list when the paper dialog is
closed. We need to be extra careful to avoid triggering
another paper dialog when that happens.

Fixes: #3098
2020-08-29 16:30:34 -04:00
Matthias Clasen
15c6760a96 print dialog: Prevent cascading paper dialogs
We trigger the paper dialog when the "manage" item
in the dropdown is selected. But the selection also
changes due to internal changes, such as reloading
the custom paper list when the paper dialog is
closed. We need to be extra careful to avoid triggering
another paper dialog when that happens.
2020-08-29 16:30:26 -04:00
Matthias Clasen
6ffb3d3fe5 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2504
2020-08-29 17:37:18 +00:00
Matthias Clasen
0f42d37f8b css: Fix parsing of scientific notation
The parser got its chars mixed up while parsing numbers
like 2.3e-04. While it is unlikely to meet such numbers
in human-generated css, we do have them e.g. when saving
render node trees with transforms.

Also add some css parser tests for number parsing.
2020-08-29 12:44:26 -04:00
Boyuan Yang
02d57f1fd7 Update Chinese (China) translation 2020-08-29 15:22:48 +00: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
51b398b960 rendernodes: Whitespace 2020-08-29 16:46:28 +02:00
Timm Bäder
b0d89b1882 wayland: Fix a GSettingsSchema leak 2020-08-29 16:46:28 +02:00
Timm Bäder
c1c2205018 gl renderer: Adjust gaussian blur sigma
To look more like what browsers do.
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
2bff84ca6c gl: Adjust blur radius_multiplier
2.0 Looks much closer to what my browser does.

Fixes #2777
2020-08-29 16:46:25 +02:00
Boyuan Yang
e8805eb9bf Update Chinese (China) translation 2020-08-29 14:19:45 +00:00
Timm Bäder
21e2c7fa33 icon-browser: Add .navigation-sidebar to sidebar 2020-08-29 11:11:29 +02:00
Timm Bäder
53eed09e08 gdkcairoprivate: Fix header guard 2020-08-29 11:11:29 +02:00
Timm Bäder
0fd8a287fc spinbutton: Whitespace 2020-08-29 11:11:29 +02:00
Timm Bäder
1d6ac9b47b button: Use gtk_widget_class_add_shortcut directly
To show how that works
2020-08-29 11:11:29 +02:00
Timm Bäder
acbb59bfae button: Whitespace 2020-08-29 11:11:29 +02:00
Timm Bäder
ea21e50cc1 testadjustsize: Fix overlay/box confusion 2020-08-29 11:11:29 +02:00
Timm Bäder
e970c69843 gsk: Fix border node diff implementation
This was showing up in the interactive constraint demo in gtk4-demo.
2020-08-29 11:11:29 +02:00
Piotr Drąg
ce737f69d7 Update POTFILES.skip 2020-08-29 10:55:11 +02:00
Changwoo Ryu
e4ad403a9a Update Korean translation 2020-08-29 03:57:33 +00:00
Changwoo Ryu
722cab1b6b Update Korean translation 2020-08-29 03:56:51 +00:00
Matthias Clasen
38c2555d46 Merge branch 'issue-3099' into 'master'
demo: Fix the resource path for css_pixbufs demo

Closes #3099

See merge request GNOME/gtk!2500
2020-08-29 03:54:32 +00:00
Emmanuele Bassi
ebef48f7df demo: Fix the resource path for css_pixbufs demo
Fixes: #3099
2020-08-28 18:39:59 +01:00
Ahmed Eldemery
a67899870a Merge remote-tracking branch 'upstream/master' into master 2020-08-28 18:45:15 +02:00
Asier Sarasua Garmendia
a0565ea8d9 Update Basque translation 2020-08-28 18:45:01 +02:00
Matthias Clasen
1d2634e73b NEWS: Updates 2020-08-28 18:45:01 +02:00
Matthias Clasen
18a85998dc idle sizer: Request a motion event after layout
When we are reallocating widgets, make sure that
we get a motion event in the next frame cycle,
so the hover state gets updated.
2020-08-28 18:45:01 +02:00
Matthias Clasen
c6fee8cee5 Add a function to request motion events
We want to ensure that the pointer position is reflected
when widget geometry changes, so add a function that tells
GDK "please create a motion event at the current position
on this surface, if one doesn't happen already".
2020-08-28 18:45:01 +02:00
Jordi Mas
dc17cf19b4 Update Catalan translation 2020-08-28 18:45:01 +02:00
Matthias Clasen
df88abb9c4 bookmarksmanager: Cancel async reads properly
This was causing the objects-finalize test to fail in ci.
2020-08-28 18:45:01 +02:00
Matthias Clasen
bba7f444dc Don't export gdk_surface_constrain_size
It has one last use in gtkwindow.c, but that will
go away and doesn't need this function to be exported
anyway.
2020-08-28 18:45:01 +02:00
Kukuh Syafaat
6b9db59e62 Update Indonesian translation 2020-08-28 18:45:01 +02:00
Carlos Garnacho
0077f95ace gdk/wayland: Use double-click/drag-threshold settings from g-d-s
Handle both these settings, and the older settings-daemon ones for
backwards compatibility. The keys are already checked for existence
in the schema, so it will just use the existing ones.
2020-08-28 18:45:01 +02:00
Carlos Garnacho
c770adb918 gdk/wayland: Look for font settings in gsettings-desktop-schemas
Prefer this location, but also look for the old location in
settings-daemon for backwards compatibility. This applies to both
direct settings lookups and via the settings portal.
2020-08-28 18:45:01 +02:00
Alexander Mikhaylenko
529b44625d wayland: Fix dnd hotspot movement
_gdk_wayland_surface_offset_next_wl_buffer() moves the surface relatively
to its current position, pass it a delta instead of new position.
2020-08-28 18:45:01 +02:00
Matthias Clasen
c10636789d gdk: Drop an unused vfunc 2020-08-28 18:45:01 +02:00
Matthias Clasen
8124f5896d gdk: Cosmetics 2020-08-28 18:45:01 +02:00
Matthias Clasen
28f831ebb0 broadway: Fix up surface_at_position 2020-08-28 18:45:01 +02:00
Matthias Clasen
3ec7a6c861 win32: Fix return value of get_device_state
We need to look a the position, not the child surface.
2020-08-28 18:45:01 +02:00
Matthias Clasen
8da4a02da0 wayland: Drop unused argument from query_state
Now that this is backend-only api, we can just
drop unused arguments.
2020-08-28 18:45:01 +02:00
Matthias Clasen
e6d4555b34 wayland: Fix return value of get_device_state
We need to look a the position, not the child surface.
2020-08-28 18:45:01 +02:00
Matthias Clasen
f854c2850f broadway: Drop unused argument from query_state
Now that this is backend-only api, we can just
drop unused arguments.
2020-08-28 18:45:01 +02:00
Matthias Clasen
d6392c9035 broadway: Fix return value of get_device_state
We need to look a the position, not the child surface.
2020-08-28 18:45:01 +02:00
Matthias Clasen
02631d2b6e x11: Drop unused argument from query_state
Now that this is backend-only api, we can just
drop unused arguments.
2020-08-28 18:45:01 +02:00
Matthias Clasen
9cddc36fe2 x11: Fix return value of get_device_state
We need to look a the position, not the child surface.
2020-08-28 18:45:01 +02:00
Matthias Clasen
690d72e696 gdk: Drop the query_state vfunc
It is no longer used.
2020-08-28 18:45:01 +02:00
Matthias Clasen
9dbf81e7d9 x11: Stop setting the query_state vfunc 2020-08-28 18:45:01 +02:00
Matthias Clasen
0546f09b1d win32: Stop using the query_state vfunc 2020-08-28 18:45:01 +02:00
Matthias Clasen
22099ebb05 macos: Stop setting the query_state vfunc 2020-08-28 18:45:01 +02:00
Matthias Clasen
07ef594be1 wayland: Stop using the query_state vfunc
Just call the backend implementation directly.
2020-08-28 18:45:01 +02:00
Matthias Clasen
d785212706 broadway: Stop using the query_state vfunc
Just call the backend implementation directly.
2020-08-28 18:45:01 +02:00
Matthias Clasen
9b0c2e62ba Drop _gdk_device_query_state
It is now unused.
2020-08-28 18:45:01 +02:00
Matthias Clasen
983f072514 macos: Stop using _gdk_device_query_state
Directly use the backend implementation.
2020-08-28 18:45:01 +02:00
Matthias Clasen
275b95841b win32: Stop using _gdk_device_query_state
Directly use the backend implementation.
2020-08-28 18:45:01 +02:00
Matthias Clasen
7d9bc01797 x11: Stop using _gdk_device_query_state
Directly use the backend implementation.
2020-08-28 18:45:01 +02:00
Matthias Clasen
028644d0ad Make gdk_surface_get_device_position return a boolean
A year ago, we make this function not return the child
surface anymore. But the information whether the device
is actually over the surface is still useful, and we
should not loose it.
2020-08-28 18:45:01 +02:00
Matthias Clasen
76e83d3216 main: Avoid a crash with crossing event handling
We are reusing the GtkCrossingData struct for multiple
calls here, so we need to make sure that the targets
stay alive from beginning to end.

Fixes: #3090
2020-08-28 18:45:01 +02:00
Matthias Clasen
002376f837 widget: Avoid a crash in crossing event handling
We need to make sure that the crossing data stays
alive until we are done handling it, so take references
on all the widgets in it.
2020-08-28 18:45:01 +02:00
Alexander Larsson
39d71dbb0a broadway: Prune fully clipped render nodes
If some node is fully outside the clip region we don't send it to the daemon.
This helps a lot in how much data we send for scrolling viewports.

However, sending partial trees makes node reuse a bit more tricky. We
can't save for reuse any node that could possibly clip different depending on
the clip region, as that could be different next frame. So, unless the
node is fully contained in the current clip (and we thus know it is not
parial) we don't allow reusing that next frame.

This fixes #3086
2020-08-28 18:45:01 +02:00
Alexander Larsson
b5e7499bbd broadway: Track the clip region in the renderer
If we know what can't possibly be visible we may can later decide to
not expose a node.
2020-08-28 18:45:01 +02:00
Fran Dieguez
fed6ba9bd0 Update Galician translation 2020-08-28 18:45:01 +02:00
Alexander Larsson
5581f78f41 Broadway: Fix handling of debug nodes
The debug nodes have id BROADWAY_NODE_DEBUG, which happens to be "12".
So, don't hardcode the wrong number "14".
2020-08-28 18:45:01 +02:00
Alexander Larsson
a97ea17c92 broadway: Correct handling of opaque colors
If alpha is 255, we use rgb() instead of rgba(), not if alpha is 0.
This makes the title bar gradient go from fully transparent to blue
rather than black to blue..
2020-08-28 18:45:01 +02:00
Matthias Clasen
67f259cd1a fontchooser: Populate the list incrementally
By adding 20 fonts / frame to the font list, we can
get the font chooser dialog to show up much faster.

This change gets the font chooser up in 265ms here.
2020-08-28 18:45:01 +02:00
Emmanuele Bassi
e5f4459e4b a11y: Simplify the ATContext::state-change signal
We cannot pass all the data we pass to the virtual function, because the
types are private, but the class and the signal are public API.

The signal is just a notification, so we can decouple the virtual
function (which stays the same, for internal types that implement the
ATContext API contract) from the signal.
2020-08-28 18:45:01 +02:00
Emmanuele Bassi
890c7816f0 Annotate GValue-variants methods of GtkAccessible
The variadic arguments methods cannot be used by language bindings,
which means we can let them use their names when calling the
GValue-based methods.
2020-08-28 18:45:01 +02:00
Emmanuele Bassi
e25e73c56c Properly document GtkAccessible:accessible-role
Use a gtk-doc stanza, instead of the GParamSpec strings.
2020-08-28 18:45:01 +02:00
Emmanuele Bassi
8a2b3f0692 a11y: Do not notify of empty state changes
If the ATContext state hasn't changed—for instance, if the accessible
attributes have been set to their default value, or have been set to the
same value—do not emit an accessible state change. State changes can be
arbitrarily expensive, so we want to ensure that they are meaningful.
2020-08-28 18:45:01 +02:00
Emmanuele Bassi
1ec4995d14 a11y: Notify callers when an attributes set changes
We can use that information inside the ATContext.
2020-08-28 18:45:01 +02:00
Emmanuele Bassi
dd624de8e8 a11y: GtkATContext.update_state() was renamed to update() 2020-08-28 18:45:01 +02:00
Emmanuele Bassi
92737b27bf a11y: Allow bulk attribute update with the GValue API
Like we do for the varargs API.
2020-08-28 18:45:01 +02:00
Emmanuele Bassi
fe50286e14 a11y: Different value types cannot be equal
Bail out early, instead of going deep into the GtkAccessibleValue type
equal() implementation, where we expect both accessible values to have
the same type.
2020-08-28 18:45:01 +02:00
Aurimas Černius
9d65ee58c9 Updated Lithuanian translation 2020-08-28 18:45:01 +02:00
nana-4
ad5a78b1e7 gtk-demo: Avoid double borders in the blendmodes demo 2020-08-28 18:45:01 +02:00
nana-4
cd3a7b416e gtk-demo: Avoid double borders in the fontrendering demo
Replace the frame with a separator.
2020-08-28 18:45:01 +02:00
nana-4
fc63c6371f gtk-demo: Avoid double borders in the dnd demo
Replace the frame with a separator.
2020-08-28 18:45:01 +02:00
nana-4
d13fa73d04 gtk-demo: Avoid double borders in the panes demo
Using frames for the children of the panes looks bad.
2020-08-28 18:45:01 +02:00
nana-4
c6976d6897 inspector: Avoid double borders in the resource tab
Replace the frames with a separator.
2020-08-28 18:45:01 +02:00
nana-4
6371fca799 inspector: Avoid double borders in the accessibility tab
Replace the frame with a separator.
2020-08-28 18:45:01 +02:00
Asier Sarasua Garmendia
f3ebb76746 Update Basque translation 2020-08-28 10:26:30 +00:00
Timm Bäder
620388a071 gtk4-demo: Add background to CSS Basics demo
So people can at least read the textview contents
2020-08-28 04:35:46 +02:00
Matthias Clasen
f6adba57bb NEWS: Updates 2020-08-27 20:50:40 -04:00
Matthias Clasen
5533494839 Merge branch 'synthetic-motion' into 'master'
Synthetic motion

See merge request GNOME/gtk!2493
2020-08-27 20:24:34 +00:00
Matthias Clasen
5b5d2665d3 idle sizer: Request a motion event after layout
When we are reallocating widgets, make sure that
we get a motion event in the next frame cycle,
so the hover state gets updated.
2020-08-27 16:01:45 -04:00
Jordi Mas
1a39ac64ab Update Catalan translation 2020-08-27 20:54:16 +02:00
Matthias Clasen
78134fc6d3 Add a function to request motion events
We want to ensure that the pointer position is reflected
when widget geometry changes, so add a function that tells
GDK "please create a motion event at the current position
on this surface, if one doesn't happen already".
2020-08-27 13:33:45 -04:00
Matthias Clasen
564ae4bdb1 Merge branch 'matthiasc/for-master' into 'master'
bookmarksmanager: Cancel async reads properly

See merge request GNOME/gtk!2495
2020-08-27 17:04:34 +00:00
Matthias Clasen
e4215ec4c7 bookmarksmanager: Cancel async reads properly
This was causing the objects-finalize test to fail in ci.
2020-08-27 12:36:36 -04:00
Matthias Clasen
74f8c59236 Merge branch 'matthiasc/for-master' into 'master'
Don't export gdk_surface_constrain_size

See merge request GNOME/gtk!2494
2020-08-27 12:12:52 +00:00
Matthias Clasen
dd0c43b7ba Don't export gdk_surface_constrain_size
It has one last use in gtkwindow.c, but that will
go away and doesn't need this function to be exported
anyway.
2020-08-27 07:31:45 -04:00
Kukuh Syafaat
9de7390ea0 Update Indonesian translation 2020-08-27 03:03:54 +00:00
Matthias Clasen
81e113d8aa Merge branch 'wip/carlosg/shuffle-font-mouse-settings' into 'master'
Look up font and mouse settings in gsettings-desktop-schemas

See merge request GNOME/gtk!2489
2020-08-27 00:08:45 +00:00
Matthias Clasen
b26f4d5429 Merge branch 'wip/exalm/hotspot-fix' into 'master'
wayland: Fix dnd hotspot movement

See merge request GNOME/gtk!2492
2020-08-26 23:44:15 +00:00
Alexander Mikhaylenko
0a59429dc8 wayland: Fix dnd hotspot movement
_gdk_wayland_surface_offset_next_wl_buffer() moves the surface relatively
to its current position, pass it a delta instead of new position.
2020-08-27 04:04:48 +05:00
Matthias Clasen
70ae073394 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2488
2020-08-26 22:34:08 +00:00
Carlos Garnacho
6421355065 gdk/wayland: Use double-click/drag-threshold settings from g-d-s
Handle both these settings, and the older settings-daemon ones for
backwards compatibility. The keys are already checked for existence
in the schema, so it will just use the existing ones.
2020-08-27 00:27:50 +02:00
Carlos Garnacho
536966e848 gdk/wayland: Look for font settings in gsettings-desktop-schemas
Prefer this location, but also look for the old location in
settings-daemon for backwards compatibility. This applies to both
direct settings lookups and via the settings portal.
2020-08-27 00:18:09 +02:00
Matthias Clasen
1c44910dfe gdk: Drop an unused vfunc 2020-08-26 18:09:47 -04:00
Matthias Clasen
bf9bb71813 gdk: Cosmetics 2020-08-26 17:56:41 -04:00
Matthias Clasen
75915bc782 broadway: Fix up surface_at_position 2020-08-26 17:56:41 -04:00
Matthias Clasen
618891a41a win32: Fix return value of get_device_state
We need to look a the position, not the child surface.
2020-08-26 17:56:41 -04:00
Matthias Clasen
0d82fcf76f wayland: Drop unused argument from query_state
Now that this is backend-only api, we can just
drop unused arguments.
2020-08-26 17:56:41 -04:00
Matthias Clasen
0091de63b4 wayland: Fix return value of get_device_state
We need to look a the position, not the child surface.
2020-08-26 17:56:41 -04:00
Matthias Clasen
338d6adb10 broadway: Drop unused argument from query_state
Now that this is backend-only api, we can just
drop unused arguments.
2020-08-26 17:56:41 -04:00
Matthias Clasen
c4c155d698 broadway: Fix return value of get_device_state
We need to look a the position, not the child surface.
2020-08-26 17:56:41 -04:00
Matthias Clasen
b9016229c1 x11: Drop unused argument from query_state
Now that this is backend-only api, we can just
drop unused arguments.
2020-08-26 17:56:41 -04:00
Matthias Clasen
cf257e6676 x11: Fix return value of get_device_state
We need to look a the position, not the child surface.
2020-08-26 17:56:41 -04:00
Matthias Clasen
62ed769e74 gdk: Drop the query_state vfunc
It is no longer used.
2020-08-26 17:56:41 -04:00
Matthias Clasen
f3a0357ab0 x11: Stop setting the query_state vfunc 2020-08-26 17:56:41 -04:00
Matthias Clasen
1d8ac79296 win32: Stop using the query_state vfunc 2020-08-26 17:56:41 -04:00
Matthias Clasen
374c776749 macos: Stop setting the query_state vfunc 2020-08-26 17:56:41 -04:00
Matthias Clasen
8c9e1e7444 wayland: Stop using the query_state vfunc
Just call the backend implementation directly.
2020-08-26 17:56:41 -04:00
Matthias Clasen
73d81d7178 broadway: Stop using the query_state vfunc
Just call the backend implementation directly.
2020-08-26 17:56:41 -04:00
Matthias Clasen
84355ccbff Drop _gdk_device_query_state
It is now unused.
2020-08-26 17:56:41 -04:00
Matthias Clasen
b2c92392fc macos: Stop using _gdk_device_query_state
Directly use the backend implementation.
2020-08-26 17:56:41 -04:00
Matthias Clasen
9e06e830b7 win32: Stop using _gdk_device_query_state
Directly use the backend implementation.
2020-08-26 17:56:41 -04:00
Matthias Clasen
62a4a356c9 x11: Stop using _gdk_device_query_state
Directly use the backend implementation.
2020-08-26 15:31:07 -04:00
Matthias Clasen
1e4c6cde10 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3090

See merge request GNOME/gtk!2485
2020-08-26 18:02:18 +00:00
Matthias Clasen
372db8d239 Merge branch 'broadway-prune' into 'master'
broadway: Prune fully clipped render nodes

Closes #3086

See merge request GNOME/gtk!2487
2020-08-26 17:52:57 +00:00
Alexander Larsson
d57e6b754f broadway: Prune fully clipped render nodes
If some node is fully outside the clip region we don't send it to the daemon.
This helps a lot in how much data we send for scrolling viewports.

However, sending partial trees makes node reuse a bit more tricky. We
can't save for reuse any node that could possibly clip different depending on
the clip region, as that could be different next frame. So, unless the
node is fully contained in the current clip (and we thus know it is not
parial) we don't allow reusing that next frame.

This fixes #3086
2020-08-26 18:08:00 +02:00
nana-4
59e0959186 Adwaita: Add border-spacing to some container widgets and style classes
This commit adds border-spacing to actionbar, searchbar, .toolbar and
.app-notification, so their child widgets won't appear to be connected
even without margin.
2020-08-27 00:47:08 +09:00
Fran Dieguez
3b1300632d Update Galician translation 2020-08-26 15:42:23 +00:00
nana-4
738f5f4523 Adwaita: Fix border-spacing for headerbar
GtkHeaderBar uses GtkCenterBox internally nowadays, so the theme needs
to correspond to it.
2020-08-27 00:38:17 +09:00
Alexander Larsson
4b1ea7c4a1 broadway: Track the clip region in the renderer
If we know what can't possibly be visible we may can later decide to
not expose a node.
2020-08-26 16:55:56 +02:00
Matthias Clasen
74a452df6c Make gdk_surface_get_device_position return a boolean
A year ago, we make this function not return the child
surface anymore. But the information whether the device
is actually over the surface is still useful, and we
should not loose it.
2020-08-26 09:11:28 -04:00
Timm Bäder
45046a53eb Merge branch 'broadway-debug-nodes' into 'master'
Broadway: Fix handling of debug nodes

See merge request GNOME/gtk!2486
2020-08-26 12:38:09 +00:00
Alexander Larsson
918996b047 Broadway: Fix handling of debug nodes
The debug nodes have id BROADWAY_NODE_DEBUG, which happens to be "12".
So, don't hardcode the wrong number "14".
2020-08-26 14:01:00 +02:00
Matthias Clasen
b6eb85ee72 main: Avoid a crash with crossing event handling
We are reusing the GtkCrossingData struct for multiple
calls here, so we need to make sure that the targets
stay alive from beginning to end.

Fixes: #3090
2020-08-26 07:27:38 -04:00
Matthias Clasen
44741e1b77 widget: Avoid a crash in crossing event handling
We need to make sure that the crossing data stays
alive until we are done handling it, so take references
on all the widgets in it.
2020-08-26 07:26:49 -04:00
Emmanuele Bassi
eef1818cee Merge branch 'broadway-alpha-colors' into 'master'
broadway: Correct handling of opaque colors

See merge request GNOME/gtk!2484
2020-08-26 11:20:03 +00:00
Alexander Larsson
fcaa6e98d0 broadway: Correct handling of opaque colors
If alpha is 255, we use rgb() instead of rgba(), not if alpha is 0.
This makes the title bar gradient go from fully transparent to blue
rather than black to blue..
2020-08-26 12:18:28 +02:00
Matthias Clasen
f48a1e4069 Merge branch 'matthiasc/for-master' into 'master'
fontchooser: Populate the list incrementally

See merge request GNOME/gtk!2483
2020-08-25 20:53:02 +00:00
Emmanuele Bassi
c21b9bec95 Merge branch 'ebassi/for-master' into 'master'
Ebassi/for master

See merge request GNOME/gtk!2480
2020-08-25 20:34:18 +00:00
Aurimas Černius
659ec97456 Updated Lithuanian translation 2020-08-25 23:23:57 +03:00
Matthias Clasen
42cc15bb74 Merge branch 'demo-double-border-fixes' into 'master'
gtk-demo: Avoid double borders

See merge request GNOME/gtk!2478
2020-08-25 20:19:49 +00:00
Matthias Clasen
8e452b2b54 Merge branch 'inspector-double-border-fixes' into 'master'
inspector: Avoid double borders

See merge request GNOME/gtk!2477
2020-08-25 20:18:47 +00:00
Matthias Clasen
740559a54f fontchooser: Populate the list incrementally
By adding 20 fonts / frame to the font list, we can
get the font chooser dialog to show up much faster.

This change gets the font chooser up in 265ms here.
2020-08-25 15:51:04 -04:00
Matthias Clasen
75cf990f74 Merge branch 'matthiasc/for-master' into 'master'
Revert unintentional calendar change

See merge request GNOME/gtk!2482
2020-08-25 18:29:27 +00:00
Matthias Clasen
612d2ea1f0 Revert unintentional calendar change
This was unintentionally included in c0efadc0f3.
2020-08-25 14:12:35 -04:00
Emmanuele Bassi
d58136e23d a11y: Simplify the ATContext::state-change signal
We cannot pass all the data we pass to the virtual function, because the
types are private, but the class and the signal are public API.

The signal is just a notification, so we can decouple the virtual
function (which stays the same, for internal types that implement the
ATContext API contract) from the signal.
2020-08-25 16:36:08 +01:00
Emmanuele Bassi
256c9c9873 Annotate GValue-variants methods of GtkAccessible
The variadic arguments methods cannot be used by language bindings,
which means we can let them use their names when calling the
GValue-based methods.
2020-08-25 16:36:08 +01:00
Emmanuele Bassi
fd568e63c2 Properly document GtkAccessible:accessible-role
Use a gtk-doc stanza, instead of the GParamSpec strings.
2020-08-25 16:36:08 +01:00
Emmanuele Bassi
797b3bd1b1 a11y: Do not notify of empty state changes
If the ATContext state hasn't changed—for instance, if the accessible
attributes have been set to their default value, or have been set to the
same value—do not emit an accessible state change. State changes can be
arbitrarily expensive, so we want to ensure that they are meaningful.
2020-08-25 16:36:08 +01:00
Emmanuele Bassi
32a1cd13c8 a11y: Notify callers when an attributes set changes
We can use that information inside the ATContext.
2020-08-25 16:36:08 +01:00
Emmanuele Bassi
1338dcddcb a11y: GtkATContext.update_state() was renamed to update() 2020-08-25 16:36:08 +01:00
Emmanuele Bassi
911a71c705 a11y: Allow bulk attribute update with the GValue API
Like we do for the varargs API.
2020-08-25 16:36:08 +01:00
Emmanuele Bassi
701a0dabd0 a11y: Different value types cannot be equal
Bail out early, instead of going deep into the GtkAccessibleValue type
equal() implementation, where we expect both accessible values to have
the same type.
2020-08-25 16:36:08 +01:00
Matthias Clasen
4dc1aea2ad Merge branch 'adwaita-rounded-frames' into 'master'
Adwaita: Make frames rounded

See merge request GNOME/gtk!2476
2020-08-25 12:52:36 +00:00
nana-4
09fa3886ba gtk-demo: Avoid double borders in the blendmodes demo 2020-08-25 21:24:10 +09:00
nana-4
bb7d5b2de6 gtk-demo: Avoid double borders in the fontrendering demo
Replace the frame with a separator.
2020-08-25 21:24:10 +09:00
nana-4
d906242c78 gtk-demo: Avoid double borders in the dnd demo
Replace the frame with a separator.
2020-08-25 21:24:10 +09:00
nana-4
d9e8223b03 gtk-demo: Avoid double borders in the panes demo
Using frames for the children of the panes looks bad.
2020-08-25 21:24:10 +09:00
nana-4
b79797ea97 inspector: Avoid double borders in the resource tab
Replace the frames with a separator.
2020-08-25 21:20:57 +09:00
nana-4
5bfc95321e inspector: Avoid double borders in the accessibility tab
Replace the frame with a separator.
2020-08-25 21:20:57 +09:00
nana-4
c0efadc0f3 Adwaita: Make frames rounded
As per GNOME mockups.

Since GtkFrame now sets GTK_OVERFLOW_HIDDEN, we can round the frame
without corner overlapping.

This also adds some margin to the child label of GtkFrame to ensure it
will not be clipped by the rounded corners of the frame.
2020-08-25 21:12:35 +09:00
nana-4
ef837f0415 Adwaita: Remove a shadow-type leftover
After commit edae2a8dc5, frames always
draw frames. So, remove the unused frame.flat styling.
2020-08-25 21:12:35 +09:00
Emmanuele Bassi
944607f240 Merge branch 'wip/smcv/no-yelp' into 'master'
docs: Don't build Yelp manual for bundled gtk-doc subproject

See merge request GNOME/gtk!2475
2020-08-25 11:18:35 +00:00
Simon McVittie
43781652b3 docs: Don't build Yelp manual for bundled gtk-doc subproject
This adds dependencies that would otherwise be unnecessary.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-08-25 11:55:35 +01:00
Matthias Clasen
9729a060f5 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #2979

See merge request GNOME/gtk!2474
2020-08-25 02:37:57 +00:00
Matthias Clasen
43ec96684a text: Properly handle focus moving to a descendent
To discriminate between is-focus and contains-focus,
we need to use notify::is-focus. This makes sure
we don't get annoying warnings when the blink_cb
gets triggered on an unfocused entry.

Fixes: #2979
2020-08-24 18:31:35 -04:00
Matthias Clasen
66e0f8505e emojichooser: Grab focus on map
This is the right thing to do, since we have a visible
entry and want text input to go there.
2020-08-24 18:31:08 -04:00
Matthias Clasen
22c914b7f5 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2473
2020-08-24 21:57:11 +00:00
Matthias Clasen
fd7d61887c colorchooser: Fix the add_palette api
When adding a custom palette, we need to arrange
for the custom section to stay at the bottom.

Maybe there should be a way to turn off custom
colors, too.
2020-08-24 17:20:17 -04:00
Matthias Clasen
bdaf346128 gtk-demo: Make the color picker demo less boring
Maybe the first ever use of the add_palette api.
Surprise, it doesn't work!
2020-08-24 17:19:36 -04:00
Bruce Cowan
6af7704858 Update British English translation 2020-08-24 18:39:24 +00:00
Matthias Clasen
7ff326e700 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3081

See merge request GNOME/gtk!2472
2020-08-24 16:43:39 +00:00
Matthias Clasen
c890d5991c Add reftests for center layout
Add a test that checks behavior with invisible children,
and another one that ensures we go back to box-like
layout if min-size is forced.
2020-08-24 12:02:34 -04:00
Matthias Clasen
d27f9abbca Merge branch 'unmapped-text' into 'master'
Unmapped text

See merge request GNOME/gtk!2466
2020-08-24 15:52:08 +00:00
Matthias Clasen
08f58122d1 Add a reftest for grid layouts
This tests that invisible children don't influence
the layout.
2020-08-24 11:38:00 -04:00
Matthias Clasen
17dcb10707 Add a reftest for box layouts
This tests that invisible children don't influence
the layout.
2020-08-24 11:34:30 -04:00
Matthias Clasen
2ac51ad827 centerlayout: Some spacing-related fixes
Try to arrange for border-spacing to actually be
respected in the final layout.

Fixes: #3081
2020-08-24 11:34:30 -04:00
Matthias Clasen
2e72b663b0 Merge branch 'wip/carlosg/start-spinbutton-start' into 'master'
gtkspinbutton: Group up/down button gestures with self

Closes #3085

See merge request GNOME/gtk!2471
2020-08-24 13:31:06 +00:00
Carlos Garnacho
e61f516a7c gtkspinbutton: Group up/down button gestures with self
We are adding click gestures on the up/down buttons, but can't let
the GtkButton built-in ones prevent ours to run.

As the saying goes, if you can't beat them, join them. Group the
spinbutton and GtkButton gestures together, so it's irrelevant which
gets called first and ends up winning.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3085
2020-08-24 14:55:47 +02:00
Daniel Mustieles
f71c9a2146 Updated Spanish translation 2020-08-24 12:07:49 +02:00
Matthias Clasen
7428731e5b Merge branch 'matthiasc/for-master' into 'master'
docs: Some updates to GtkWidgetClass docs

See merge request GNOME/gtk!2470
2020-08-24 02:28:00 +00:00
Matthias Clasen
6043ed8c89 docs: Some updates to GtkWidgetClass docs
Mention layout managers for vfuncs that are skipped
if you have one.
2020-08-23 20:40:15 -04:00
Goran Vidović
f394375719 Update Croatian translation 2020-08-23 22:02:30 +00:00
Goran Vidović
ae2a914f07 Update Croatian translation 2020-08-23 22:01:05 +00:00
Rafael Fontenelle
cd9bee83ef Update Brazilian Portuguese translation 2020-08-23 21:52:38 +00:00
Matthias Clasen
ca0f136deb text: Don't compute invisible char needlessly
There is no real reason to do expensive text layout
operations unless we need the invisible char because
the text's visibilty is FALSE.
2020-08-23 17:41:13 -04:00
Matthias Clasen
c0191c7225 text: Defer most recomputation until we're mapped
It doesn't make sense to update scroll positions or
im cursor locations while we're unmapped, and doing
so causes us to do expensive text measuring.
2020-08-23 17:41:13 -04:00
Matthias Clasen
d5114cc18d Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2464
2020-08-23 21:36:07 +00:00
Matthias Clasen
40d7092f4a widget: Queue a draw when we need to
The code in gtk_widget_real_css_changed assumes that
queue_resize > queue_allocate > queue_draw, but the
second one is not really true. These days, we happily
keep reusing the same render node even when the child
allocation is changed.

So, if a css change has flags that tell us we should
redraw, we need to queue a draw, otherwise we might
end up reusing an outdated render node.

This fixes spinners staying visible when they stop
spinning, despite the theme setting their opacity
to 0.
2020-08-23 17:07:37 -04:00
Matthias Clasen
dc963dcbcb Cosmetics
gtk_css_style_change_affects takes flags for a reason,
no need to call it multiple times.
2020-08-23 16:45:15 -04:00
Matthias Clasen
c4d350c260 build: Start using meson feature options
Use feature options for things that are optional features,
update the docs.

Visible changes here is that the 'print-backends' option
got renamed to 'print' to go better with 'media', and the
'tracker3' option got renamed to 'tracker'.

For options that have been changed into features, the
syntax now is -Dfeature=enabled or -Dfeature=disabled
or -Dfeature=auto.
2020-08-23 16:45:15 -04:00
Matthias Clasen
54e4bf8b75 Fix a leak in the font chooser widget
Contrary to what you may expect, pango_attr_font_desc_new()
is not transfer full, it makes a copy of the font description.
2020-08-23 16:45:15 -04:00
Matthias Clasen
0540337531 Merge branch 'fix_widget_factory_ui' into 'master'
fix position of radiobutton1

See merge request GNOME/gtk!2463
2020-08-23 16:26:35 +00:00
Ahmed Eldemery
86acb13057 fix position of radiobutton1 2020-08-23 17:39:17 +02:00
Boyuan Yang
11314cf0b4 Update Chinese (China) translation 2020-08-23 15:04:45 +00:00
Goran Vidović
37ce545d72 Update Croatian translation 2020-08-23 11:14:23 +00:00
Emin Tufan Çetin
85764ce505 Update Turkish translation 2020-08-22 21:26:01 +00:00
Boyuan Yang
ff5cdbaf03 Update Chinese (China) translation 2020-08-22 20:18:25 +00:00
Yuri Chornoivan
420c4e1f16 Update Ukrainian translation 2020-08-22 16:30:41 +00:00
Jakub Steiner
a498aca3ab Adwaita: error labels insensitive & backdrop states
- address colored labels for the two states

See https://gitlab.gnome.org/GNOME/gtk/-/issues/3063#note_891618
2020-08-22 10:14:11 -04:00
Matthias Clasen
4eacfdba60 Merge branch 'remove-unnecessary-frames' into 'master'
Remove unnecessary frames from some widgets

See merge request GNOME/gtk!2462
2020-08-22 14:09:35 +00:00
Andika Triwidada
4fefea7471 Update Indonesian translation 2020-08-22 13:19:15 +00:00
Piotr Drąg
bc132dae54 Update Polish translation 2020-08-22 15:17:37 +02:00
Piotr Drąg
5822cdbc95 Update POTFILES.in and POTFILES.skip 2020-08-22 13:48:19 +02:00
nana-4
6a7a0f0b8a viewport: Remove unused frame
We've always removed this with Adwaita.
2020-08-22 09:30:28 +09:00
nana-4
1948f8a07f placessidebar: Remove unused frame
We've always removed this with Adwaita.
2020-08-22 09:23:52 +09:00
nana-4
8eb807d7f4 entrycompletion: Remove unnecessary frame
The popover already has a border as a frame. Don't create double
borders.
2020-08-22 09:18:31 +09: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
e915a1aa7f Rename the profiler option
We don't support any profilers other than sysprof,
so name the option accordingly. While we are at it,
change it to a meson feature option, so
-Dprofiler=true becomes -Dsysprof=enabled
2020-08-21 18:51:48 -04:00
Matthias Clasen
7a9501b1fb Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2461
2020-08-21 22:36:45 +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
Matthias Clasen
f4511ff91c ci: Use depth=1 for all subprojects
This helps reduce bandwidth requirements for ci.
2020-08-21 17:45:00 -04:00
Matthias Clasen
f00e2e2146 inhibit: Pass valid arguments when Inhibiting
When we pass "" as reason, gnome-session responds
with a "Reason not specified" error. So, send
"Reason not specified" instead. Its true.
2020-08-21 17:40:36 -04:00
Christian Hergert
5a5b30681e testsuite: use SysprofProfiler for profiling
Instead of using sysprof-cli to profile subprocesses, this uses
libsysprof's SysprofProfiler directly so that we can avoid an indirect
subprocess as well as disabling the polkit nag.

To do this, we have to link against libsysprof instead of
libsysprof-capture. This is limited to the -Dbuild-tests=true and
-Dprofiler=true case.
2020-08-21 13:51:52 -07:00
Matthias Clasen
ab5e62ddab Merge branch 'matthiasc/for-master' into 'master'
layoutmanager: Fix the child-widget property

Closes #3080

See merge request GNOME/gtk!2460
2020-08-21 20:45:53 +00:00
Matthias Clasen
936f3f1ad9 Explicitly set grid positions in the ui file
We were outsmarted by a combination of gtk-builder-tool
removing default values and GtkGrid guessing good values
for omitted properties.

Fixes: #3080
2020-08-21 16:22:59 -04:00
Matthias Clasen
865b29500c layoutmanager: Fix the child-widget property
We were setting the child-widget property to the parent.
Oops.
2020-08-21 14:29:14 -04:00
Matthias Clasen
7039f31391 fixup a counting error
Remember: 1, 2, 3, _4_, 5...
2020-08-21 13:39:38 -04:00
Matthias Clasen
ed67d9c103 Merge branch 'codespell-changes' into 'master'
*: Fix spelling mistakes found by codespell

See merge request GNOME/gtk!2459
2020-08-21 17:32:12 +00:00
Matthias Clasen
5377026e61 wip: Port test-performance to use sysprof-cli
This isn't working for the tests yet, since it
needs a single-application mode that we don't
quite have in sysprof-cli.
2020-08-21 13:24:29 -04:00
Matthias Clasen
40f3da19ae Update the docs around profiling
Mention sysprof-cli, and stop mentioning GTK_TRACE_FD.
2020-08-21 10:55:01 -04:00
Matthias Clasen
d4e069a629 Port tracing to the sysprof collector api
Use the new sysprof collector api to do tracing.
2020-08-21 10:55:01 -04:00
Matthias Clasen
a416650f6b application: Drop support for profiler activation
Drop support for the org.gnome.Sysprof3.Profiler
D-Bus interface. It is not really used, and if
we don't expose it, we can simplify our profiler
infrastructure.
2020-08-21 10:55:01 -04:00
Matthias Clasen
e5d088208a Merge branch 'fontconfig-speedup' into 'master'
Trigger fontconfig initialization early

See merge request GNOME/gtk!2454
2020-08-21 14:49:31 +00:00
Björn Daase
3ef7772552 docs: Reword GtkTreeView question 28 2020-08-21 15:35:29 +02:00
Björn Daase
24ce38bb36 docs: Reword gtk4-update-icon-cache description 2020-08-21 15:33:12 +02:00
Björn Daase
6315cd977c *: Fix spelling mistakes found by codespell 2020-08-21 15:29:34 +02:00
Matthias Clasen
9770e064e8 Merge branch 'builder-tool-boxes' into 'master'
builder-tool: Rewrite GtkBox

See merge request GNOME/gtk!2447
2020-08-21 13:22:48 +00:00
Jason Francis
2437622b5f builder-tool: Rewrite GtkBox
Rewrite expand/fill properties on GtkBox to
hexpand/halign/vexpand/valign on the child widget.

Rewrite GtkVBox and GtkHBox to GtkBox, setting the orientation
property.

Added a test for boxes.
2020-08-20 23:41:29 -04:00
Goran Vidović
bb8c818ba1 Update Croatian translation 2020-08-20 21:47:34 +00:00
Jakub Steiner
dd2e1e4867 Merge branch 'wip/jimmac/rich-list-styling' into 'master'
Adwaita: rich-list styling

See merge request GNOME/gtk!2456
2020-08-20 20:58:31 +00:00
Jakub Steiner
5f630481db Adwaita: rich-list styling
FIXME: why is the second list in Demo>List Box>Controls taller?

https://gitlab.gnome.org/GNOME/gtk/-/issues/3073
2020-08-20 19:39:18 +02:00
Matej Urbančič
da6253eadc Updated Slovenian translation 2020-08-20 18:14:54 +02:00
Matthias Clasen
c6b261afa0 Merge branch 'frame-overflow-hidden' into 'master'
frame: Set GTK_OVERFLOW_HIDDEN

See merge request GNOME/gtk!2455
2020-08-20 14:03:41 +00:00
nana-4
e07827e976 frame: Set GTK_OVERFLOW_HIDDEN
It doesn't really make sense for the frame to allow drawing children
outside of it.
2020-08-20 22:24:36 +09:00
Marek Kasik
5a8f90357d printing: Use original names for remote CUPS printers
CUPS uses resource paths in the form of "printers/printer_name"
or "classes/class_name" so it is enough to remove the "printers/"
or "classes/" prefix and use the string behind it as a name.

There was recently introduced a wrong check for the prefix.
This commit fixes it in the way it was originally intended.
2020-08-20 13:54:02 +02:00
Matthias Clasen
a674832658 Trigger fontconfig initialization early
Add a pango call to create the fontmap already in gtk_init.
This will let us hide the cost of FcInit() (which on font-heavy
systems can be ~100ms) in a thread, on the pango side.
2020-08-19 22:12:00 -04:00
Matthias Clasen
2031bcd388 Merge branch 'replace-hardcoded-margins' into 'master'
tooltip & placessidebar: Replace hard-coded margins with theme

See merge request GNOME/gtk!2444
2020-08-20 00:30:37 +00:00
Goran Vidović
4e157b33dc Update Croatian translation 2020-08-19 21:51:29 +00:00
Matthias Clasen
174c9a938e Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2453
2020-08-19 20:46:18 +00:00
Timm Bäder
ec81ccd5f9 label: Try to avoid a pango_layout_get_extents call
Measuring text is quite expensive, so only do this if really necessary.
2020-08-19 16:14:59 -04:00
Matthias Clasen
8acd60fda9 widget-factory: Improve the error states example
Elaborate the error state handling, and make it show
delayed states in GtkSwitch too.
2020-08-19 13:22:44 -04:00
sicklylife
bcd0a9e5d8 Update Japanese translation 2020-08-18 10:03:51 +00:00
sicklylife
5b35c5fb19 Update Japanese translation 2020-08-18 09:46:29 +00:00
Baurzhan Muftakhidinov
1dcb68c8e3 Update Kazakh translation 2020-08-18 07:20:38 +00:00
Andika Triwidada
bca6113539 Update Indonesian translation 2020-08-18 04:50:25 +00:00
Fran Dieguez
e35c000b4a Update Galician translation 2020-08-17 16:47:55 +00:00
Baurzhan Muftakhidinov
29d7d652c4 Update Kazakh translation 2020-08-17 10:26:54 +00:00
Jakub Steiner
581f224b61 Merge branch 'wip/jimmac/error-labels-insensitive' into 'master'
Adwaita: error labels insensitive & backdrop states

See merge request GNOME/gtk!2449
2020-08-17 08:21:58 +00:00
Jakub Steiner
aabb713594 Adwaita: error labels insensitive & backdrop states
- address colored labels for the two states

See https://gitlab.gnome.org/GNOME/gtk/-/issues/3063#note_891618
2020-08-17 10:00:29 +02:00
Piotr Drąg
a0af12e492 Update Polish translation 2020-08-16 11:56:23 +02:00
nana-4
19c2cc1296 placessidebar: Replace hard-coded margins with theme
So we can easily adjust the widget sizing in the theme.
2020-08-15 22:46:31 +09:00
nana-4
9b42edbef4 tooltip: Replace hard-coded margins with theme
So we can easily adjust the widget sizing in the theme.
2020-08-15 22:46:31 +09:00
Matthias Clasen
303e023c36 Merge branch 'gtkassistant_docstring' into 'master'
gtkassistant: Minor docstring wording changes

See merge request GNOME/gtk!2442
2020-08-15 12:49:29 +00:00
Timm Bäder
5e35ca5692 Merge branch 'slider-button-style-class-again' into 'master'
pathbar: Set .slider-button style class to slider buttons again

See merge request GNOME/gtk!2443
2020-08-15 10:49:02 +00:00
nana-4
667b3b117d pathbar: Set .slider-button style class to slider buttons again
This was set in the .ui file that no longer exists, so we need to set it
again here.
2020-08-15 18:31:32 +09:00
Holger Knust
cb7c903594 gtkassistant: Minor docstring wording changes
Changed the wording to improve the clarity of the documentation. Fixed grammar issue ("spllited")
2020-08-15 05:20:03 -04:00
Matthias Clasen
e6e2d6b45a Merge branch 'gdk-internal-cleanup' into 'master'
Gdk internal cleanup

See merge request GNOME/gtk!2438
2020-08-14 13:00:13 +00:00
Matthias Clasen
fa0a88ae22 Merge branch 'api-touchups' into 'master'
Api touchups

See merge request GNOME/gtk!2439
2020-08-14 12:47:50 +00:00
Jakub Steiner
17cdc13847 Merge branch 'wip/jimmac/error-entries-and-labels' into 'master'
Adwaita: error labels and entries

See merge request GNOME/gtk!2440
2020-08-14 12:42:56 +00:00
Florentina Mușat
d40d4d5fae Update Romanian translation 2020-08-14 12:16:01 +00:00
Jakub Steiner
131e2f6e43 Adwaita: error labels and entries
See https://gitlab.gnome.org/GNOME/gtk/-/issues/3063
2020-08-14 14:13:37 +02:00
Matthias Clasen
b3786b7b07 gdk: Slim down gdkinternals.h more
Move things to the private headers they belong in.
2020-08-14 07:45:53 -04:00
Matthias Clasen
6cf8f1cdf2 gdk: Move GdkSurfaceTypeHint to its sole user
The x11 backend is the only place where surface
type hints are used in any way. Move the enum
there.
2020-08-14 07:45:53 -04:00
Matthias Clasen
79c2c3e353 win32: Drop vestigial surface type hint field
This wasn't used in any way.
2020-08-14 07:45:53 -04: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
Matthias Clasen
35708162cc Make GtkNativeInterface private
We are not sure yet if allowing out-of-tree
implementations of GtkNative are a good idea.
2020-08-14 07:03:27 -04:00
Piotr Drąg
e29e569d6f Update POTFILES.skip 2020-08-14 12:16:51 +02:00
Matthias Clasen
3d7343144f wayland: Drop unused surface type hint field
This wasn't used at all.
2020-08-13 22:24:06 -04:00
Matthias Clasen
3c44e9c563 gdk: Slim down gdkinternals.h
Move things to the private headers they belong in.
2020-08-13 22:24:06 -04:00
Matthias Clasen
8a13d18655 Drop gdk_device_get_position
Convert the last user to _gdk_device_query_state
and drop this unused internal api.
2020-08-13 22:24:06 -04:00
Matthias Clasen
9786185cc0 gdk: Clean up gdkdevice.h
This header looked just too disorderly.
Same for gdkdevicetool.h.
2020-08-13 22:24:06 -04:00
Matthias Clasen
22ac6d3148 gdk: Documentation touchups
Minor rewordings here and there, strip nonpublic
functions of doc comments, deemphasize logical/physical
devices.
2020-08-13 22:24:06 -04:00
Matthias Clasen
97e0f1108d docs: Cosmetics 2020-08-13 22:24:06 -04:00
Matthias Clasen
0ae7f794a3 Merge branch 'matthiasc/for-master' into 'master'
gtk-demo: Fix the builder demo

See merge request GNOME/gtk!2437
2020-08-13 23:44:58 +00:00
Matthias Clasen
15bd2a2a5c Merge branch 'fix_expander_demo' into 'master'
fix resource not found in expander demo

See merge request GNOME/gtk!2436
2020-08-13 23:08:09 +00:00
Matthias Clasen
28c1e74220 docs: Minor tweaks to the tutorial
Fix a link, and mention meson in a few places.
2020-08-13 17:45:04 -04:00
Matthias Clasen
e694a4137c examples: Fix multiple small problems
Add a paragraph about running the example apps
uninstalled in the README, and verify that the
standalone Makefiles actually work. Hint: some
didn't.
2020-08-13 17:30:47 -04:00
Matthias Clasen
005f9a995e gtk-demo: Fix the builder demo
The about dialog here wasn't working.
At the same time, make the statusbar
useful for something by showing our
action messages there.
2020-08-13 17:19:59 -04:00
Matthias Clasen
e48a1d2df0 Merge branch 'list-styles' into 'master'
Implement and document list styles

See merge request GNOME/gtk!2421
2020-08-13 21:15:22 +00:00
Matthias Clasen
6191404656 Merge branch 'async-highlight' into 'master'
gtk-demo: Async highlight

See merge request GNOME/gtk!2435
2020-08-13 21:15:09 +00:00
Ahmed Eldemery
6037d08bd8 fix resource not found in expander demo 2020-08-13 22:46:38 +02:00
Matthias Clasen
bcc5e475fc gtk-demo: Do markup parsing incrementally too
Pango has a markup parser api, might as well
use it to keep things responsive.
2020-08-13 16:33:16 -04:00
Matthias Clasen
a0cdb544ed gtk-demo: Fix the Windows build 2020-08-13 16:33:16 -04:00
Matthias Clasen
80cddd4cc1 gtk-demo: Move the highlighting to a separate file
Move all the logic related to asynchronous highlighting
to fontify.c, to keep main.c from becoming too cluttered.
2020-08-13 16:33:16 -04:00
Jakub Steiner
f4561d3fd5 Adwaita: rich-list rows
- add whitespace to match the existing look
2020-08-13 16:30:22 -04:00
Jakub Steiner
c5963b960a Adwaita: fix focus for .navigation-sidebar 2020-08-13 16:30:22 -04:00
Jakub Steiner
df4c57c001 flatpak: builder options
- avoid vulkan from crashing the inspector
2020-08-13 16:30:22 -04:00
Matthias Clasen
2b0e9542cb gtk-demo: take off the makeup
Remove all the hardcoded spacing from the listbox
demo, so the rich-list styling can take effect.
2020-08-13 16:30:22 -04:00
Matthias Clasen
b49fd47276 Adwaita: Fix hover in navigation sidebars
The placessidebar gets this from somewhere else, but
it wasn't working in the gtk-demo sidebar, so add it
explicitly. placessidebar specific styles should be
dropped from Adwaita as much as possible, but not
doing that here.
2020-08-13 16:30:22 -04:00
Jakub Steiner
bdb1d87859 Adwaita: style rich-list and data-table
- style special list types
- add navigation-sidebar too

https://gitlab.gnome.org/GNOME/gtk/-/issues/2929
2020-08-13 16:30:22 -04:00
Matthias Clasen
d1b1b5bd9b widget-factory: Use rich-list style
Use the .rich-list style for the listbox on page 2.
2020-08-13 16:30:22 -04:00
Matthias Clasen
283fc9d7e4 gtk-demo: Use style classes in the listbox demo
Add a .rich-list style class to the controls demo.
2020-08-13 16:30:22 -04:00
Matthias Clasen
d8753a9fa3 gtk-demo: Use style classes in the settings demo
Use .navigation-sidebar on the left, and .data-table
on the right.
2020-08-13 16:30:22 -04:00
Matthias Clasen
a9858c6662 gtk-demo: Use a style class on the sidebar
Use .navigation-sidebar for the main sidebar.
2020-08-13 16:30:21 -04:00
Matthias Clasen
0279e1c76b inspector: Use the new list style classes
Set .rich-list and .data-table on lists, as appropriate.
2020-08-13 16:30:21 -04:00
Matthias Clasen
cce3ff6f04 placessidebar: Use the .navigation-sidebar style class 2020-08-13 16:30:21 -04:00
Matthias Clasen
221786dda3 lists: Mention list style classes in docs
Document that GtkListView, GtkColumnView and GtkListBox
support .rich-list, .navigation-sidebar and .data-table
style classes.
2020-08-13 16:30:21 -04:00
Matthias Clasen
aacb06dbee gtk-demo: Insert markup incrementally
The slowest step of highlighting our buffers is
inserting the markup into the buffer. Do that
incrementally, to avoid blocking the UI for
extended periods.
2020-08-13 12:59:52 -04:00
Matthias Clasen
ea887959bd textbuffer: Some more insert_with_attributes speedup
There is no need for use to collect tags in an array;
we can just insert them into the text buffer right away.
2020-08-13 12:36:39 -04:00
Matthias Clasen
4c78f628db gtk-demo: Fontify asynchronously
Run highlight asynchronously. It isn't a problem for
most demos, but the cursor demo has an unusually large
ui file, which takes highlight a little bit of time
to produce.
2020-08-13 12:25:38 -04:00
Emmanuele Bassi
0228c89011 Merge branch 'openbsd-roaring' into 'master'
OpenBSD: don't include malloc.h

See merge request GNOME/gtk!2434
2020-08-13 16:23:20 +00:00
Antoine Jacoutot
b4508be3c9 OpenBSD: don't include malloc.h
This header doesn't exist anymore on recent OpenBSD releases.
2020-08-13 17:48:34 +02:00
Matthias Clasen
dded2ddb21 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2433
2020-08-13 12:08:54 +00:00
Matthias Clasen
e9afb63a01 widget-factory: Add more error states
Add a label with the .error style class in the
configuration dialog, also add another entry validation
here, to have it in one place.
2020-08-13 07:40:54 -04:00
Daniel Mustieles
3a0fdffe5e Updated Spanish translation 2020-08-13 10:41:42 +02:00
Daniel Mustieles
ff51d7b838 Updated Spanish translation 2020-08-13 10:34:43 +02:00
Daniel Mustieles
ef22c4a4fa Updated Spanish translation 2020-08-13 10:34:33 +02:00
Matthias Clasen
ebaf533a31 Merge branch 'matthiasc/for-master' into 'master'
Speed up gtk_text_buffer_insert_markup

See merge request GNOME/gtk!2432
2020-08-13 03:40:22 +00:00
Matthias Clasen
88dcd2597a Speed up gtk_text_buffer_insert_markup
Instead of blindly creating new tags for every attribute,
reuse existing tags. For the syntax highlighting of the
ui file of the cursors demo, this gets us down from
20.000 tags to 6.
2020-08-12 22:51:59 -04:00
Matthias Clasen
0d0807fc44 Merge branch 'matthiasc/for-master' into 'master'
gtk-demo: Group small images

See merge request GNOME/gtk!2431
2020-08-13 01:07:36 +00:00
Matthias Clasen
7226878916 gtk-demo: Group small images
Instead of showing 30 tabs, put all the cursor images
into one page.  Do the same for the small images in
the css animated background demo.
2020-08-12 20:26:15 -04:00
Fran Dieguez
afa9d9aa8c Update Galician translation 2020-08-12 22:40:19 +00:00
Matthias Clasen
28a3911b15 Merge branch 'matthiasc/for-master' into 'master'
widget-factory: Add an entry with error state

See merge request GNOME/gtk!2430
2020-08-12 21:14:54 +00:00
Matthias Clasen
94696490dc widget-factory: Add an entry with error state
Enter the wrong thing into the age entry for seeing
error states.
2020-08-12 13:26:46 -04:00
Matthias Clasen
dbc6a94daf Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2429
2020-08-12 10:51:17 +00:00
Matthias Clasen
0a9acd10d2 gtk-demo: Celebrate losses too
Everybody is a winner!
2020-08-11 23:26:06 -04:00
Matthias Clasen
3340a5ee04 gtk-demo: Visual improvement to solitaire
Make the fields visible.
2020-08-11 23:10:48 -04:00
Matthias Clasen
5e2aeee9b0 gtk-demo: Add a layout manager demo
This is more or less a copy of the layout manager
example from clutter.
2020-08-11 23:10:48 -04:00
Matthias Clasen
9b0a5b1fde Add sizes to toplevelsize warnings
Might as well be informative while we're annoying.
2020-08-11 16:27:03 -04:00
Matthias Clasen
540cffee89 gtk-demo: Drop the pixbufs demo
It is from a different era, and doesn't show
the apis we want to promote. The visuals live
on, in the Css/Animated Backgrounds demo.
2020-08-11 16:26:04 -04:00
Matthias Clasen
e0b95c6234 Merge branch 'wip/smcv/roaring-license' into 'master'
Add attribution and licensing information for "roaring bitmaps" code

See merge request GNOME/gtk!2408
2020-08-11 16:02:25 +00:00
Yuri Chornoivan
40c32bbef6 Update Ukrainian translation 2020-08-11 15:58:16 +00:00
Timm Bäder
d0b192325a Merge branch 'afranke-master-patch-25531' into 'master'
Fix a string

See merge request GNOME/gtk!2428
2020-08-11 14:26:23 +00:00
Alexandre Franke
e16d108b68 Fix a string 2020-08-11 14:05:58 +00:00
Emin Tufan Çetin
f8b8c90c3d Update Turkish translation 2020-08-10 22:29:47 +00:00
Matthias Clasen
823219d429 Merge branch 'button-claim-clicks' into 'master'
button: Claim click events

Closes #3054

See merge request GNOME/gtk!2425
2020-08-10 22:24:50 +00:00
Matthias Clasen
102acd2581 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3058

See merge request GNOME/gtk!2427
2020-08-10 21:45:09 +00:00
Matthias Clasen
82253d1a0a gtk-demo: Give the video player a default size 2020-08-10 16:36:36 -04:00
Matthias Clasen
19b93fc9f7 gtk-demo: Add a file filter for the video player
We are only interested in video files here.
2020-08-10 16:36:36 -04:00
Matthias Clasen
e9d03d06fe window: Fix an oversight
Commit 658719a205 moved the call to
gtk_window_compute_default_size() outside the
if (priv->needs_default_size)
but unfortunately, that function cleared that field,
so we never entered the branch.

Keep the setting of priv->needs_default_size in the
branch, where it belongs.
2020-08-10 16:36:36 -04:00
Matthias Clasen
63fb2126db gtk-demo: Make the image demo more robust
Make sure we don't crash if the demo is closed
early.

Fixes: #3058
2020-08-10 16:35:56 -04:00
Matthias Clasen
90080d5bec Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2426
2020-08-10 17:46:37 +00:00
Matthias Clasen
be5b03224c gtk-demo: Give the video player a default size 2020-08-10 12:53:41 -04:00
Matthias Clasen
091289a85d gtk-demo: Add a file filter for the video player
We are only interested in video files here.
2020-08-10 12:53:41 -04:00
Matthias Clasen
17710709f9 window: Fix an oversight
Commit 658719a205 moved the call to
gtk_window_compute_default_size() outside the
if (priv->needs_default_size)
but unfortunately, that function cleared that field,
so we never entered the branch.

Keep the setting of priv->needs_default_size in the
branch, where it belongs.
2020-08-10 12:53:41 -04:00
Matthias Clasen
6fafc8b811 button: Claim click events
This fixes issues with double activation on clicks.

Fixes: #3054
2020-08-09 22:58:22 -04:00
Matthias Clasen
bc20fe3cca Merge branch 'matthiasc/for-master' into 'master'
gtk-demo: Add a little extra in peg solitaire

Closes #3051

See merge request GNOME/gtk!2424
2020-08-10 01:10:41 +00:00
Matthias Clasen
8cbca4f693 print-editor: Icon credits
Give the artist credits.
2020-08-09 20:30:00 -04:00
Matthias Clasen
6e9de7f271 node-editor: Don't install the icon
We don't want to install an icon if we're not
installing the app. Also give the artist credit.

Fixes: #3051
2020-08-09 20:28:56 -04:00
Matthias Clasen
aa1b9531c1 gtk-demo: Add a little extra in peg solitaire
A win needs to be celebrated!
2020-08-09 18:59:29 -04:00
Matthias Clasen
66fa530574 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3027

See merge request GNOME/gtk!2423
2020-08-09 22:46:50 +00:00
Matthias Clasen
e5247b7cbb gtk-demo: Finish peg solitaire demo
The restart button was simply not implemented.
While we are at it, make the pegs a bit bigger,
so clicking them is easier.
2020-08-09 18:27:18 -04:00
Matthias Clasen
da0955feeb gtk-demo: Cosmetic fixes to the textmask demo
Make this come up with the right size.
2020-08-09 18:05:27 -04:00
Matthias Clasen
2335953c5d gtk-demo: Cosmetic fixes for the fontrendering demo
Make this look a bit less thrown together.
2020-08-09 18:02:04 -04:00
Matthias Clasen
42902085e5 gtk-demo: Dark theme support for dnd demo
Add minimal dark theme support to the dnd demo,
by picking suitable default colors for our items.
2020-08-09 17:36:41 -04:00
Matthias Clasen
230107cd84 gtk-demo: Cosmetic improvements to the expander demo
Set the textview up like our other readonly textviews.

Also sneak in a little easter egg.
2020-08-09 17:12:04 -04:00
Matthias Clasen
b69dc3d054 gtk-demo: Add warnings to the themes demo
Add a warning that the flickering here may be
hazardous to photosensitive viewers.
2020-08-09 16:36:00 -04:00
Matthias Clasen
a85fc0008c wayland: Don't send invalid anchor rectangles
When we send an anchor rectangle with a width or
height of 0, mutter reponds with "Invalid anchor
rectangle size". So, don't do that.

This was seen as sudden disappearance of gtk4-demo
when you click the fishbowl benchmark all the way
through to the menubuttons.

Fixes: #3027
2020-08-09 16:02:25 -04:00
Matthias Clasen
2bf9ae005f Adwaita: Small improvement for dropdown
Put some space between the arrow and the text.
This was noticable in the new listbox2 demo.
2020-08-09 15:43:46 -04:00
Matthias Clasen
4650f7ec14 gtk-demo: Cosmetic improvement to listbox2 demo
Make the checkbutton and the check align vertically.
2020-08-09 15:43:01 -04:00
Asier Sarasua Garmendia
5dd0262a56 Update Basque translation 2020-08-09 19:39:35 +00:00
Christian Kirbach
b13e1a5a7b Update German translation 2020-08-09 19:05:18 +00:00
Matthias Clasen
ce1cd67fa4 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2422
2020-08-09 17:11:18 +00:00
Matthias Clasen
eb5329d389 gtk-demo: Group the listbox demos 2020-08-09 12:36:06 -04:00
Matthias Clasen
5b41612f28 gtk-demo: Add another listbox demo
This is a more typical listbox use.
2020-08-09 12:36:06 -04:00
Matthias Clasen
473ed75ed5 Adwaita: be careful with list separators
We only want the list .separators class to affect its
immediate children - otherwise, we end up with separators
in dropdowns that are places into button strips. As a side
benefit, restricting this to immediate children makes for
faster matching.
2020-08-09 12:01:08 -04:00
Matthias Clasen
3760d44f18 gtk-demo: Fix an indentation mishap 2020-08-09 11:14:28 -04:00
Matthias Clasen
79f0687929 gtk-demo: Drop the modelbutton demo
Not a public api, so shouldn't be featured in a demo.
2020-08-09 10:59:22 -04:00
Matthias Clasen
c80a612af7 gtk-demo: Improve filtering
Show sidebar rows if any parent matches. This lets one
search for "lists" and get just the subtree with all the
listview demos.
2020-08-09 10:54:45 -04:00
Emin Tufan Çetin
358b698efa Update Turkish translation 2020-08-09 08:19:33 +00:00
Matthias Clasen
0f7b2159b6 Merge branch 'demo-polish' into 'master'
Demo polish

See merge request GNOME/gtk!2420
2020-08-09 04:28:31 +00:00
Matthias Clasen
7f565806a8 gtk-demo: Make source formatting uniform
Give the text view in the source tab the same
formatting as tabs we add for extra sources.
2020-08-09 00:03:43 -04:00
Matthias Clasen
1d49f933e9 gtk-demo: Adapt hightlighting style for dark themes
Switch to a highlight style that is readable with
dark background, if prefer-dark is set or we are
in HighContrastInverse.
2020-08-08 23:50:45 -04:00
Matthias Clasen
1d1d9de09e gtk-demo: Cosmetics 2020-08-08 23:41:50 -04:00
Matthias Clasen
d1aacc01d4 gtk-demo: Make content views monospace
That works better for code.
2020-08-08 23:41:05 -04:00
Matthias Clasen
2a3d3ec079 gtk-demo: Follow font settings again
highlight puts font and size information into
its pango markup; strip that out to make our
text follow font settings again.
2020-08-08 23:38:07 -04:00
Matthias Clasen
c60fba0267 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3048

See merge request GNOME/gtk!2419
2020-08-08 23:08:44 +00:00
Matthias Clasen
75ad180c78 textutil: Do a little better on retro X servers
When running on a non-composited, non-rgba X server
(such as Xnest), force the drag icons for text selections
to have a background, so we don't end up with black
text on black background.

Fixes: #3048
2020-08-08 18:33:56 -04:00
Matthias Clasen
765fe201ce inspector: Avoid a crash
I've seen the inspector crash when running on an
X server without an xsettings manager around. Better
be safe.
2020-08-08 18:33:56 -04:00
Matthias Clasen
3469c639f6 bookmarksmanager: Load bookmarks initially
This was broken in 1e6171a4a7.
2020-08-08 18:33:56 -04:00
Matthias Clasen
d642bfc8ce Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3037 and #3030

See merge request GNOME/gtk!2417
2020-08-08 19:13:44 +00:00
Matthias Clasen
c6a7b39ee1 Remove deprecation guards around gtk_window_present
It is not deprecated anymore.
2020-08-08 14:49:50 -04:00
Matthias Clasen
112883186c gtk-demo: Fix iconscroll complex text
We changed the way fontify works.
Adapt the iconscroll use.
2020-08-08 14:38:18 -04:00
Matthias Clasen
57a213a4ea gtk-demo: Fix iconscroll colors
We changed the way the color grid works.
Adapt the iconscroll use of it.

Fixes: #3030
2020-08-08 14:36:48 -04:00
Matthias Clasen
dbbc9b5c58 placessidebar: Fix dnd cancellation
When the drag is canceled by being dropped outside,
we get a ::cancel emission, that we want to handle
just like ::dnd-finished.

Fixes: #3037
2020-08-08 14:26:31 -04:00
Matthias Clasen
e18de295c6 placessidebar: Fix the bookmark drag icon
Just use the widget; a paintable only works if the
widget it is based on actually gets drawn, the
clone we create here wasn't.
2020-08-08 14:24:45 -04:00
Matthias Clasen
4eaf08e964 placessidebar: Fix bookmarks dnd
We were not handling drops of bookmarks correctly,
leading to criticals during DND.

Fixes: #3037
2020-08-08 14:11:29 -04:00
Matthias Clasen
2d5b44703c placessidebar: We're not a listbox anymore
The placessidebar used to derive from GtkListBox,
but it doesn't anymore. There was one case leftover,
leading to criticals during bookmark DND.
2020-08-08 14:11:29 -04:00
Matthias Clasen
19c6ef38fe bookmarksmanager: Load bookmarks initially
This was broken in 1e6171a4a7.
2020-08-08 14:11:29 -04:00
Matthias Clasen
4f5e3b7b0d gtk-demo: Improve an error message
Be more helpful when we can't do syntax highlighting.
2020-08-08 13:56:17 -04:00
Simon McVittie
95cd8c1eb9 Move roaring bitmaps code to gtk/roaring/ and add a README
As suggested by Matthias Clasen on gtk!2408. This keeps the
Apache-licensed stuff together.

As per the discussion on gtk!2408 and gtk!2409, replacing this with
upstream CRoaring is specifically not supported by the GTK maintainers.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-08-08 18:30:41 +01:00
Simon McVittie
dfb16019f8 Include a copy of the Apache license
4(a) requires giving recipients of the work a copy of the license, and
in any case it's best for source code distributions to be self-contained
(including the full text of all applicable licenses).

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-08-08 18:27:37 +01:00
Simon McVittie
bef86d48af roaring.[ch]: Add attribution and licensing information
OS distributions that take copyright and licensing seriously will tend
to become concerned about source files that appear to come from a
third party and do not come with copyright/licensing information,
and stating that these files are modified is required by clause 4(b)
of the Apache license.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-08-08 18:27:37 +01:00
Matthias Clasen
d1d269ea6b Merge branch 'patch-1' into 'master'
Correct typos in gtktextbtree.c

See merge request GNOME/gtk!2413
2020-08-08 17:05:25 +00:00
Matthias Clasen
3d807f4b00 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3047, #3034, #3038, and #3036

See merge request GNOME/gtk!2416
2020-08-08 16:27:27 +00:00
Matthias Clasen
9654fff6e0 Merge branch 'scroll-to-cursor' into 'master'
Scroll to cursor after canceling a selection

Closes #2960

See merge request GNOME/gtk!2321
2020-08-08 16:18:19 +00:00
Matthias Clasen
8a67899e0f bookmarksmanager: Ignore delete events
Surpisingly, when a monitored file gets atomically replaced
with g_file_set_contents(), the file monitor reports a
DELETED event for the temp file, which is not the file
I'm monitoring.

Just ignore DELETED events.

Fixes: #3036
2020-08-08 11:48:32 -04:00
Matthias Clasen
bb30a23004 x11: Fix getting the primary monitor
Actually return the primary monitor.

Fixes: #3038
2020-08-08 11:48:32 -04:00
Matthias Clasen
3faa7feb7c label: Disable unavailable actions
Fixes: #3034
2020-08-08 11:48:32 -04:00
Matthias Clasen
d099276b89 printeditor: Create the dialog every time
Trying to work around gtk_show_about_dialog() is
not worth it, just recreate the dialog from scratch.
2020-08-08 11:48:32 -04:00
Matthias Clasen
56afa05b97 widgetfactory: Create the dialog every time
Trying to work around gtk_show_about_dialog() is
not worth it, just recreate the dialog from scratch.

Fixes: #3047
2020-08-08 11:48:32 -04:00
Matthias Clasen
c6fdfeae7e about dialog: remove unnecessary guards
We decided to undeprecate gtk_window_present,
so no deprecation guards needed.
2020-08-08 11:48:32 -04:00
Matthias Clasen
8725fd308b Merge branch 'surface-size' into 'master'
Surface size

See merge request GNOME/gtk!2415
2020-08-08 14:44:52 +00:00
Emmanuele Bassi
c40e23bde6 Merge branch 'wip/smcv/cloudprint-redundant-decls' into 'master'
cloudprint: Fix redundant declarations

See merge request GNOME/gtk!2414
2020-08-08 13:59:37 +00:00
Simon McVittie
afcb9c0e63 cloudprint: Fix redundant declarations
G_DEFINE_DYNAMIC_TYPE declares these functions as static, and
-Werror=redundant-decls won't let us redeclare them. This is the
equivalent of 72c72d0b, but for a different backend.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-08-08 14:24:31 +01:00
Matthias Clasen
fd1033f974 surface: Add width and height properties 2020-08-08 09:24:30 -04:00
Matthias Clasen
16505a4d1e gdk: Move the ::popup-layout-changed signal
Move this signal from GdkSurface to GtkPopup,
where it belongs.
2020-08-08 09:24:30 -04:00
Piotr Drąg
a1ec68422f Update POTFILES.in and POTFILES.skip 2020-08-08 13:07:18 +02:00
Felix Yan
f8060b859d Correct typos in gtktextbtree.c 2020-08-08 09:29:08 +00:00
Matthias Clasen
0c0ced1374 Merge branch 'activatable-colorswatch-style' into 'master'
Adwaita: Limit color swatch's hover effect to .activatable

See merge request GNOME/gtk!2411
2020-08-08 03:09:30 +00:00
Matthias Clasen
bfd8c5383f Merge branch 'wip/chergert/popover-offset' into 'master'
popover: allow setting popup layout offset

See merge request GNOME/gtk!2412
2020-08-08 02:41:04 +00:00
Christian Hergert
4d88e3af17 popover: allow setting popup layout offset
Currently there is no way to alter the offset of the popup when positioning
with GdkPopupLayout. This makes using the popup difficult for scenarios
like completion windows where you may need to offset the window by a given
amount for aligning text.

gtk_popover_set_offset() allows setting these values and are analagous to
the function of the same name for GdkPopupLayout.
2020-08-07 17:10:52 -07:00
nana-4
b694771728 colorbutton: Remove .activatable style class from the color swatch
The button itself is activatable, but its color swatch is not.
2020-08-08 08:37:33 +09:00
nana-4
51d6ec5131 Adwaita: Limit color swatch's hover effect to .activatable
Non-activatable color swatches shouldn't have the interactive effect.
2020-08-08 08:33:38 +09:00
Efstathios Iosifidis
7625ccd6fa Update Greek translation 2020-08-07 20:41:27 +00:00
Matthias Clasen
95e2a2b4b3 Merge branch 'leak-fixes' into 'master'
Leak fixes

See merge request GNOME/gtk!2406
2020-08-07 20:29:02 +00:00
Matthias Clasen
4e774eddb9 Merge branch 'wip/chergert/fix-textview-yrange-invalidation' into 'master'
linedisplaycache: improve invalidation with y_range

See merge request GNOME/gtk!2407
2020-08-07 20:17:22 +00:00
Christian Hergert
35325ea11a linedisplaycache: improve invalidation with y_range
When we invalidate a y_range using the common pattern of y==0 and
old_height==new_height, we are generally invalidating the entire buffer.

This short-circuits that case to just invalidate the buffer in a faster
and more complete form. The problem here appears to be that we can't
always calculate the ranges properly to invalidate because validation
has not run far enough.
2020-08-07 12:44:26 -07:00
Matthias Clasen
5673310364 textbuffer: Fix a leak
gtk_text_buffer_insert_markup was leaking all the tags
that it inserts.
2020-08-07 15:26:11 -04:00
Matthias Clasen
2d72ba21ce gtk-demo: Don't leak the markup 2020-08-07 15:19:33 -04:00
Matthias Clasen
e0786a4a00 gtk-demo: Fix a memory leak
The colors demo was leaking a reference to its model.
This was showing up as crash when you manage to close
both the demo window and the main window while the
sorting is ongoing.
2020-08-07 15:15:18 -04:00
Matthias Clasen
0b21883518 toplevel: Revise docs wording a bit
The documentation of ::compute-size didn't quite
keep up with the changes in the MR. Fix it up.
2020-08-07 14:56:42 -04:00
Matthias Clasen
1ccab92813 Merge branch 'matthias/fix-min-size' into 'master'
Matthias/fix min size

See merge request GNOME/gtk!2404
2020-08-07 18:46:24 +00:00
Matthias Clasen
f6d9e15c16 window: Don't set min_size > size
This fixes the failing reftest.
2020-08-07 13:55:02 -04:00
Jakub Steiner
cd0b9a2359 Merge branch 'wip/jimmac/vte-bg-color' into 'master'
Wip/jimmac/vte bg color

Closes vte#226

See merge request GNOME/gtk!2403
2020-08-07 17:16:14 +00:00
Jakub Steiner
96500816bc Adwaita: add public color for text views
- define @text_view_bg to complement @theme_text_color for high
  contrast legible text views.

Fixes https://gitlab.gnome.org/GNOME/vte/-/issues/226
2020-08-07 18:58:32 +02:00
Jakub Steiner
9d60047616 Adwaita: force circular imagebuttons to be square
Addresses https://gitlab.gnome.org/GNOME/gnome-clocks/-/merge_requests/123#note_884741
2020-08-07 18:57:45 +02:00
Matthias Clasen
a95012caa3 Check sanity of toplevel sizes
Emit a warning when sizes returned in GdkToplevelSize
don't look sane. This is the case in the failing
reftest.
2020-08-07 12:45:19 -04:00
Matthias Clasen
51d55e4fbc Merge branch 'demo-highlighting' into 'master'
gtk-demo: Modernize source highlighting

See merge request GNOME/gtk!2401
2020-08-07 16:21:55 +00:00
Matthias Clasen
05255bfc90 gtk-demo: Modernize source highlighting
Drop the homegrown highlighting code, and just use highlight
to produce Pango markup.

When using an external highlighter, we can also highlight css,
xml, headers, at least.
2020-08-07 11:54:10 -04:00
Matthias Clasen
41ef2c5f34 Merge branch 'wip/dont-leak-toplevel-present-callback' into 'master'
wayland/toplevel: Don't leak wl_callback used during present()

See merge request GNOME/gtk!2399
2020-08-07 12:58:05 +00:00
Matthias Clasen
4dfd413e0b Merge branch 'wip/oholy/gtkmountoperation-newline' into 'master'
gtkmountoperation: Drop the new line character when splitting a message

See merge request GNOME/gtk!2397
2020-08-07 12:51:46 +00:00
Jonas Ådahl
6724d4250f wayland/toplevel: Don't leak wl_callback used during present() 2020-08-07 14:01:16 +02:00
Matthias Clasen
8cd2f615ad Merge branch 'wip/fix-wayland-toplevel-present-callback' into 'master'
Fix Wayland toplevel present callback issues

Closes #3026

See merge request GNOME/gtk!2395
2020-08-07 11:56:30 +00:00
Ondrej Holy
517a34bdc8 gtkmountoperation: Drop the new line character when splitting a message
When asking for a password, the message string is split on primary
and secondary if it contains a newline character. However, the newline
character is currently part of both strings, which creates weird
spacing between the GtkLabels. I suppose this is bug, which was not
visible as in most cases (if not all) the message string hasn't
contained the new line characters so far. But we are going to change
that now, see GNOME/gvfs!82. Let's drop the new line character similarly
as it is done when asking for a question, or showing processes in order
to fix the weird spacing.
2020-08-07 10:37:19 +02:00
Jonas Ådahl
658719a205 gtk/window: Fix min size calculation
It should always use "preferred" size, not any remembered or otherwise
computed one, otherwise we won't be able to shrink to the preferred size.
2020-08-07 10:18:32 +02:00
Jonas Ådahl
c27f811462 wayland/surface: Destroy toplevel present callback if ignored
We might break the loop early, e.g. if we're unmapped before the round
trip finishes, and to avoid the callback to write to invalid stack
memory, destroy the callback so it won't be invoked.

Fixes: #3026
2020-08-07 09:06:21 +02:00
Jonas Ådahl
3590923c8b wayland/surface: Fix toplevel present roundtrip condition
We should round trip until we both have received callback and have
ensured we received the initial configuration.
2020-08-07 09:06:21 +02:00
Matthias Clasen
1b7004ffc7 Merge branch 'about-polish' into 'master'
About polish

See merge request GNOME/gtk!2394
2020-08-07 02:35:09 +00:00
Matthias Clasen
85c713127e aboutdialog: Make margins more uniform
Use similar margins in the Credits and System tabs.
2020-08-06 22:18:14 -04:00
Matthias Clasen
87a8fda163 demos: Brush up about dialogs
Show OS info, and generally polish this here and there.
2020-08-06 22:17:36 -04:00
Matthias Clasen
79e6269058 Merge branch 'gtk-demo-leaks' into 'master'
Gtk demo leaks

See merge request GNOME/gtk!2393
2020-08-07 01:36:34 +00:00
Matthias Clasen
6cf04c505f Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

See merge request GNOME/gtk!2392
2020-08-07 01:16:11 +00:00
Matthias Clasen
14900efe38 gtk-demo: Plug a big memory leak
The colors demo was leaking all its colors. Oops.
2020-08-06 21:14:11 -04:00
Matthias Clasen
04c3c659f5 gtk-demo: Plug a small memory leak
The settings demo was leaking a GtkBuilderScope.
2020-08-06 21:13:39 -04:00
Benjamin Otte
8557aaf327 demo: fix memleak 2020-08-07 02:53:21 +02:00
Benjamin Otte
052962a760 treeview: Use gtk_snapshot_append_border()
No need to construct the node manually.
2020-08-07 02:52:22 +02:00
Benjamin Otte
278fbcbbb4 demo: Don't crash when closing words demo
Make sure the stringlist we're loading into doesn't go away.

It'd be better to have a cancellable, but I'm lazy.
2020-08-07 02:52:22 +02:00
Matthias Clasen
26542778f7 Merge branch 'dnd-leaks' into 'master'
Dnd leaks

See merge request GNOME/gtk!2391
2020-08-07 00:34:38 +00:00
Matthias Clasen
a712ffa2ab widgetpaintable: Clear an idle in dispose
We were not removing the pending_update idle
in dispose, which is at least suspicious, if
not deadly. Move the idle cleanup code into
unset_widget(), which we are already calling
in dispose().
2020-08-06 20:02:33 -04:00
Matthias Clasen
12450cfcef wayland: Don't leak content formats
We were not unreffing the formats here.
2020-08-06 20:02:33 -04:00
Matthias Clasen
71373ff6fb drop: Don't leak the surface and formats 2020-08-06 20:02:33 -04:00
Matthias Clasen
1fa9261fe3 contentdeserializer: Add some missing annotations 2020-08-06 20:02:33 -04:00
Matthias Clasen
c212dd4ec0 Merge branch 'scroll-compression-leak' into 'master'
Fix a leak in scroll event compression

See merge request GNOME/gtk!2390
2020-08-06 23:56:56 +00:00
Matthias Clasen
2ae1f40da2 Merge branch 'cairo-node-leak' into 'master'
gsk: Don't leak cairo nodes

See merge request GNOME/gtk!2389
2020-08-06 23:33:20 +00:00
Matthias Clasen
0c82aa314c Fix a leak in scroll event compression
We were leaking the last event in a sequence
of scroll events.
2020-08-06 19:31:38 -04:00
Matthias Clasen
9e5ddeaa8a gsk: Don't leak cairo nodes
Not chaining up in finalize is a leak, after all.
2020-08-06 18:35:41 -04:00
Matthias Clasen
4e3251872c Merge branch 'focus-workaround' into 'master'
gridview: Work around unexpected focus changes

See merge request GNOME/gtk!2387
2020-08-06 19:31:24 +00:00
Matthias Clasen
c13d70479b gridview: Work around unexpected focus changes
As things currently stand, we get events for focus changes
before the widget is allocated, and try to scroll in response.
Therefore, leaving n_columns at 0 until size-allocate leads
to plenty of division-by-zero. Just set it to 1 initially
to avoid that. This is a workaround for #3025.
2020-08-06 14:35:19 -04:00
Matthias Clasen
ecd50891ff Merge branch 'toplevel-size-declaration' into 'master'
gdk/toplevel: fix declarations of GdkToplevelSize

See merge request GNOME/gtk!2386
2020-08-06 14:43:28 +00:00
Andreas Persson
71cec2ef5d gdk/toplevel: fix declarations of GdkToplevelSize
GDK_AVAILABLE_IN_ALL was missing from gdk_toplevel_size_get_bounds and
gdk_toplevel_size_set_max_size was declared though it doesn't exist.
2020-08-06 16:14:10 +02:00
Emmanuele Bassi
83e9b5b408 Merge branch 'rsvg-check' into 'master'
Specify version for optional librsvg dependency

See merge request GNOME/gtk!2385
2020-08-06 12:35:19 +00: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
dd0c364938 Merge branch 'matthiasc/for-master' into 'master'
testsvg: Some additions

See merge request GNOME/gtk!2383
2020-08-06 04:15:01 +00: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
9212d95b0f Merge branch 'svg-viewer' into 'master'
Add an svg test

See merge request GNOME/gtk!2382
2020-08-06 03:44:18 +00: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
8f7edb8a7d Merge branch 'fix-puzzle-keynav' into 'master'
Fix puzzle keynav

Closes #3023

See merge request GNOME/gtk!2381
2020-08-06 02:00:05 +00:00
Matthias Clasen
dcf37412c1 gtk-demo: Fix keynav in the puzzle demo
Fixes: #3023
2020-08-05 20:52:22 -04:00
Matthias Clasen
d6c35ab02f NEWS: Updates 2020-08-05 20:38:22 -04:00
Matthias Clasen
66df338087 Merge branch 'wip/carlosg/stop-spinbutton-stop' into 'master'
Let spinbuttons stop

Closes #3016

See merge request GNOME/gtk!2380
2020-08-05 22:42:41 +00:00
Christoph Reiter
d1718355cd Merge branch 'msys2-ccache-setup-first' into 'master'
CI: move ccache setup before building anything

See merge request GNOME/gtk!2379
2020-08-05 22:05:25 +00:00
Carlos Garnacho
bb3675b3c7 gtkspinbutton: Claim button gestures when starting to spin
The gesture should be acknowledged by the spin button, in order to
guarantee it will also receive the button release.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3016
2020-08-06 00:01:34 +02:00
Carlos Garnacho
36711b6691 gtkbutton: Don't claim gesture till emission
That means waiting till button release.
2020-08-06 00:01:18 +02:00
Carlos Garnacho
dc8adcda0e gtkgesture: ::cancel if a claimed sequence goes denied
The regular paths just emit ::end, which isn't the whole thing.
This gives an opportunity to gestures that are stolen the sequence
to clean themselves up.
2020-08-06 00:01:18 +02:00
Matthias Clasen
883a43ddd7 Merge branch 'wip/chergert/fix-anchored-cleanup' into 'master'
textview: properly remove anchored widgets

Closes #3021

See merge request GNOME/gtk!2378
2020-08-05 21:49:42 +00:00
Christian Hergert
5ff2b8535f textview: properly remove anchored widgets
Fixes #3021
2020-08-05 14:08:07 -07:00
Matthias Clasen
750f9917e3 Merge branch 'gdk-doc-cleanup' into 'master'
docs: Clean up dangling links in gdk docs

See merge request GNOME/gtk!2377
2020-08-05 20:21:18 +00:00
Christoph Reiter
e77d82eaac CI: move ccache setup before building anything
otherwise glib/pango end up in the wrong cache dir
2020-08-05 21:58:46 +02:00
Matthias Clasen
4babdcd662 Merge branch 'fontrendering-demo-fix' into 'master'
gtk-demo: Make fontrendering demo work more than once

Closes #3019

See merge request GNOME/gtk!2375
2020-08-05 19:54:34 +00:00
Matthias Clasen
f5b0cab5cf Merge branch 'ci-git-build-test' into 'master'
CI: msys2: build glib/pango master manually before gtk

Closes #3002

See merge request GNOME/gtk!2376
2020-08-05 19:53:28 +00:00
Matthias Clasen
1d7b273669 docs: Clean up dangling links in gdk docs
Clean up references to no-longer-existing APIs.
2020-08-05 15:45:43 -04:00
Christoph Reiter
774d431525 CI: msys2: build glib/pango master manually before gtk
The win toolchain has problems linking meson subprojects to libgtk.
To work around that build glib/pango from git and install them first
as long as the installed version is too old at least.

Fixes #3002
2020-08-05 21:35:38 +02:00
Matthias Clasen
845afdbcd8 Merge branch 'fix-aspect-frame' into 'master'
aspectframe: Fix use in ui files

Closes #3020

See merge request GNOME/gtk!2374
2020-08-05 18:46:11 +00:00
Matthias Clasen
b58bad557b gtk-demo: Make fontrendering demo work more than once
We weren't cleaning up properly, causing the window
to not close the second time it is opened.

Fixes: #3019
2020-08-05 14:36:54 -04:00
Matthias Clasen
6dfd92b191 aspectframe: Fix use in ui files
GtkAspectFrame code assumes that its child will be in
self->child, but that is only the case if we arrange
for <child> in ui files to end up calling
gtk_aspect_frame_set_child(). Therefore, implement
GtkBuildable.

Fixes: #3020
2020-08-05 14:05:47 -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
Matthias Clasen
0b0f7dc9c0 Merge branch 'inspector-settings-crash' into 'master'
inspector: Stop showing settings bindings

Closes #3015

See merge request GNOME/gtk!2373
2020-08-05 16:13:52 +00:00
Matthias Clasen
df19049dde inspector: Stop showing settings bindings
We were playing fast-and-loose with private GIO data
when showing settings bindings in the property editor,
and this was causing crashes.

We can show this information again if GIO ever gets
api to introspect it.

Fixes: #3015
2020-08-05 11:11:58 -04:00
Matthias Clasen
edc2adbb5b Merge branch 'fix-solid-csd' into 'master'
Adwaita: Reduce the solid csd borders

Closes #2997

See merge request GNOME/gtk!2372
2020-08-05 14:13:21 +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
cfd3651003 Merge branch 'matthiasc/for-master' into 'master'
testborderdrawing: Don't crash on exit

See merge request GNOME/gtk!2370
2020-08-05 12:48:41 +00:00
Matthias Clasen
7c252e3830 Merge branch 'gradient-hard-stop-test' into 'master'
Add a reftest for gradients with hard stops

See merge request GNOME/gtk!2371
2020-08-05 12:48:30 +00:00
Matthias Clasen
d44d9ad40d Adwaita: Reduce the solid csd borders
Reduce the borders we draw ourselves for solid csd
to 1 pixel. It still doesn't look great, but at least
it doesn't look outright broken.

Fixes: #2997
2020-08-05 08:47:00 -04:00
Matthias Clasen
9c8bceb691 testborderdrawing: Don't crash on exit 2020-08-05 08:19:07 -04:00
Matthias Clasen
21a1413bf3 Add a reftest for gradients with hard stops
This is testing the issue described in #1293.

No fix though, this is still broken in Vulkan.
It works correctly in GL and with cairo.
2020-08-05 08:10:35 -04:00
Matthias Clasen
8870ec5e7b Merge branch 'hex-color-parse' into 'master'
Hex color parse

Closes #2931

See merge request GNOME/gtk!2356
2020-08-05 11:46:55 +00:00
Matthias Clasen
c46f262d6e Merge branch 'master.win32' into 'master'
Another round of fixes for GDK/Win32

See merge request GNOME/gtk!2369
2020-08-05 11:31:52 +00:00
Chun-wei Fan
edc1c28236 GdkGLContext: Drop gdk_gl_context_has_[framebuffer_blit|frame_terminator]()
gdk_gl_context_has_framebuffer_blit() and gdk_gl_context_has_frame_terminator()
were only used by by GDK/Win32, and they do not provide performance advantages
in GTK master, so clean up the code a bit by dropping them.
2020-08-05 18:56:57 +08:00
Chun-wei Fan
f454c6f9d0 testsuite/gsk: Only run Broadway tests if enabled
We may not have enabled building the broadway renderer for our build, so don't
run the broadway renderer tests unless it is enabled.
2020-08-05 16:23:14 +08:00
Chun-wei Fan
cf5a6a003a testsuite: Setup tests env by platform
Check whether we really have x11 and wayland enabled before we try to setup the
tests to use these respective GDK backends, and only attempt to setup tests
running with the Broadway backend if it has been enabled.

Also, add a setup for running tests with the GDK-Win32 backend on Windows, for
builds that target Windows.
2020-08-05 16:23:14 +08:00
Chun-wei Fan
d2291abe2a gdksurface-win32.c: Fix resizing
Use gdk_surface_get_geometry() to get the correct x and y coordinates of the
window that we are resizing, so that the window does not reposition itself
automatically at the top-left corner at resizing as we to used hard-code the x
and y coordinates to 0.
2020-08-05 16:23:14 +08:00
Chun-wei Fan
5ce0098adc gdkvulkancontext-win32.c: Implement ->begin_frame()
By doing so, we ensure that resizes of windows will work on Vulkan renderer, by
first calling gdk_win32_surface_handle_queued_move_resize() before we proceed
as usual
2020-08-05 16:23:14 +08:00
Chun-wei Fan
46a8a3fe31 gdk[cairo|gl]context-win32.c: Use gdk_win32_surface_handle_queued_move_resize()
Use the shared function that was added in the previous commit, to simplify
things.

Also make gdk_win32_surface_get_queued_window_rect() and
gdk_win32_surface_apply_queued_move_resize() back into static functions, since
they are now used only by the code in gdksurface-win32.c
2020-08-05 16:23:14 +08:00
Chun-wei Fan
c6ada2a329 gdksurface-win32.c: Add function to handle queued moves/resizes
Since we need to deal with queued moves and resizes in the Cairo, GL and Vulkan
draw contexts, and the logic involved in all three of these are largely
similar, add a function gdk_win32_surface_handle_queued_move_resize() that will
handle this, which will be shared between these three types of draw contexts.
2020-08-05 16:23:12 +08:00
Fran Dieguez
a7d665f28b Update Galician translation 2020-08-05 07:56:11 +00:00
Chun-wei Fan
69bb4f8beb GDK-Win32: Move some functions around
Move gdk_win32_surface_get_queued_window_rect() and
gdk_win32_surface_apply_queued_move_resize() to gdksurface-win32.c, since these
functions are not only used for Cairo draw contexts, but is also used for GL
draw contexts, and will be used for Vulkan draw contexts.
2020-08-05 15:38:08 +08:00
Chun-wei Fan
06f28af80f gdksurface-win32.c: Fix Aerosnap computation
Don't get the default display when we compute the Aerosnap region, but instead
get it from the underlying GdkSurface that we are using for the computation.

Also, don't unref the monitors that we obtain from the display in the wrong
place, which was why we had crashes whenever we triggered AeroSnap code (and we
are actually not supposed to do that as they are owned by the GdkDisplay that
is owned by the GdkSurface we are using), and this will eliminate lots of
criticals that are spewed as a result.
2020-08-05 15:38:08 +08:00
Matthias Clasen
e60d6f70bf Merge branch 'drop-accel-label' into 'master'
Drop accel label

See merge request GNOME/gtk!2368
2020-08-05 03:44:43 +00:00
Matthias Clasen
9126132e42 Merge branch 'docs-cleanup' into 'master'
Docs cleanup

See merge request GNOME/gtk!2367
2020-08-05 03:17:06 +00:00
Matthias Clasen
8562c623d3 Drop GtkAccelLabel
We no longer use this widget anywhere.
2020-08-04 23:05:18 -04:00
Matthias Clasen
2b8aeed4d8 Drop GtkCallback
It is no longer used in any of our public APIs.
2020-08-04 22:24:33 -04:00
Matthias Clasen
ce89f1eda1 selectionfiltermodel: Drop a leftover symbol
We decided not to do new_for_type() for list model
wrappers, so this function does not exist.
2020-08-04 22:11:34 -04:00
Matthias Clasen
f561000124 docs: Clean up many dangling links
In many cases, these were references to no longer
existing api, so some rewording was necessary.
2020-08-04 22:11:34 -04:00
Matthias Clasen
93c9600145 docs: Drop GtkPlacesSidebar from visual index
No longer a public widget.
2020-08-04 19:31:22 -04:00
Fran Dieguez
31726cdc95 Update Galician translation 2020-08-04 22:12:01 +00:00
Matthias Clasen
39eeb2a723 Merge branch 'try-to-fix-xvfb-in-ci' into 'master'
ci: Pass -noreset to Xvfb

See merge request GNOME/gtk!2366
2020-08-04 16:56:12 +00:00
Matthias Clasen
a06339fb48 ci: Pass -norest to Xvfb
This may help with the sporadic "No display" failures
we are seeing when running tests under X11 in ci.
2020-08-04 11:59:32 -04:00
Matthias Clasen
0e1afbbdad Merge branch 'popoverflow' into 'master'
popover: Set overflow: hidden

Closes #3012

See merge request GNOME/gtk!2365
2020-08-04 15:47:50 +00:00
Matthias Clasen
a42738729b Merge branch 'a11y-crash' into 'master'
A11y crash

Closes #3014

See merge request GNOME/gtk!2364
2020-08-04 15:47:36 +00:00
Matthias Clasen
d6e352e862 popover: Set overflow: hidden
This keeps overlay scrollbars from wrecking our
nice rounded corners.

Fixes: #3012
2020-08-04 11:10:49 -04:00
Matthias Clasen
f7eb5f8897 a11y: Don't do unnecessary work
Only serialize all the attributes if we are actually
going to print them.
2020-08-04 11:02:00 -04:00
Matthias Clasen
7398323b82 scrolledwindow: Fix a11y support code
This error was introduced by me in 971ee2d28a
and causes a crash in the scrolling benchmark in gtk-demo.

Fixes: #3014
2020-08-04 11:00:32 -04:00
Jonas Ådahl
4ee82e8175 gdk/toplevel: Fix typo in documentation 2020-08-04 16:53:10 +02:00
Jonas Ådahl
cebe469898 gtk/window: Don't remember size from GdkSurface
If we're maximized, and try to remember the non-maximized size, we'd
still get the maximized size.
2020-08-04 15:04:24 +02:00
Florentina Mușat
bbb15f65a7 Update Romanian translation 2020-08-04 11:23:33 +00:00
Matthias Clasen
b3a874c4d1 Merge branch 'modern-doc-shooter' into 'master'
Modern doc shooter

See merge request GNOME/gtk!2363
2020-08-04 11:22:07 +00:00
Matthias Clasen
f49d267187 docs: Add a gallery image for GtkDropDown 2020-08-04 00:33:37 -04:00
Matthias Clasen
2c306f75c4 docs: Add a gallery image for GtkEditableLabel 2020-08-04 00:26:51 -04:00
Matthias Clasen
d7cd28c641 docs: Add gallery image for GtkPasswordEntry 2020-08-04 00:19:08 -04:00
Matthias Clasen
92cb629640 docs: Avoid focus in gallery images
Seeing focus rectangles and selections in these
images is a distraction, and we used to avoid it.
Bring that back.
2020-08-04 00:18:30 -04:00
Matthias Clasen
1492e8cf0e docs: Improve the gallery image for scales 2020-08-04 00:18:30 -04:00
Matthias Clasen
0ae46040a4 docs: Add gallery images for some more widgets
This adds GtkPicture, GtkVideo, GtkMediaControls.
2020-08-04 00:18:30 -04:00
Matthias Clasen
1d1e1a0068 docs: Regenerate widget gallery images 2020-08-04 00:18:30 -04:00
Matthias Clasen
1e3df88ee0 docs: Redo the doc shooter code
Steal snapshotting code from the reftests to
make this work again.

Other changes here: catch up with container removal.
2020-08-04 00:18:30 -04:00
Matthias Clasen
e818e98187 Merge branch 'pagesetup-leftover' into 'master'
Pagesetup leftover

See merge request GNOME/gtk!2362
2020-08-04 03:47:13 +00:00
Matthias Clasen
b4050482ec Merge branch 'doc-links' into 'master'
Doc links

See merge request GNOME/gtk!2361
2020-08-04 00:35:40 +00:00
Matthias Clasen
942a90cd64 pagesetupdialog: Fix leftover tree model code
This was overlooked when the rest of the dialog
was ported to use list models.
2020-08-03 20:25:00 -04:00
Matthias Clasen
20c1fb0a0a docs: Tweak documentation for list widgets
Fix numerous cases of : vs :: for signal references,
add some more details here and there.
2020-08-03 18:43:25 -04:00
Matthias Clasen
7972dc8776 docs: Unify docs around incremental operations
Sync up the wording around incremental filtering
and sorting to be more similar.
2020-08-03 18:43:25 -04:00
Matthias Clasen
7cb0dd9039 docs: Fix signal references
It is :: for signals, : for properties, | for actions.
2020-08-03 18:43:25 -04:00
Matthias Clasen
a5058c605f docs: Fix typos 2020-08-03 18:43:21 -04:00
Matthias Clasen
70b0bdd5e3 docs: Tell pandoc we need Docbook4
gtk-doc assumes Docbook4, with <ulink> and so on.
Without this, all the links in markdown are converted
to <link xlink:href=...> and then lost in the docbook->html
conversion.
2020-08-03 16:53:44 -04:00
Matthias Clasen
2d72cd00e3 docs: Fix a typo 2020-08-03 16:53:32 -04:00
Yuri Chornoivan
95a533e8e1 Update Ukrainian translation 2020-08-03 17:02:11 +00:00
Matthias Clasen
0eb36cb823 Merge branch 'patch-1' into 'master'
show: remove obsolete comment

See merge request GNOME/gtk!2359
2020-08-03 16:22:19 +00:00
Alex
c8d51a7b98 show: remove obsolete comment
g_app_info_launch_default_for_uri supports x-scheme-handler directly since at least 2.27.1, released almost 10 years ago.

Link: https://bugzilla.gnome.org/show_bug.cgi?id=631410
Link: 9b262f1c5f
2020-08-03 15:36:36 +00:00
Matthias Clasen
c77600f1e9 Merge branch 'treeview-editing' into 'master'
treeview: Don't react to clicks on cell editables

Closes #3008

See merge request GNOME/gtk!2358
2020-08-03 12:28:20 +00:00
Matthias Clasen
64b8d8b3e4 ci: Update subprojects
Otherwise, we end up stuck on old checkouts, and
bumping requirements lets to build failures.
2020-08-03 08:11:03 -04:00
Matthias Clasen
83682d919f treeview: Don't react to clicks on cell editables
We need to let these pass through, otherwise we
interfere with the entries that are used for editing.

Fixes: #3008
2020-08-03 07:51:09 -04:00
Matthias Clasen
6ed1cd63b6 Merge branch 'filechoosernative-docs' into 'master'
docs: Introspect GtkFileChooserNative info

Closes #2799

See merge request GNOME/gtk!2357
2020-08-03 11:09:03 +00:00
Matthias Clasen
cb320849de docs: Introspect GtkFileChooserNative info
We were missing gtk_file_chooser_native_get_type
in gtk4.types.in, causing introspected info to not
be included.

Fixes: #2799
2020-08-03 00:13:10 -04:00
Matthias Clasen
9659d3f78a Merge branch 'applaunch-warning' into 'master'
x11: Ignore stray DestroyNotify events

Closes #3006

See merge request GNOME/gtk!2355
2020-08-03 03:30:59 +00:00
Matthias Clasen
1f3327d326 rgba: Use pango_color_parse_with_alpha
Use this newly exported pango function, so we
can support hex colors with alpha like #rrggbbaa.

Fixes: #2931
2020-08-02 23:30:33 -04:00
Matthias Clasen
15325fe546 Bump the pango dependency
Require pango 1.45.5, so we can use pango_color_parse_with_alpha.
2020-08-02 23:30:33 -04:00
Matthias Clasen
4152e90e7e x11: Ignore stray DestroyNotify events
There's no use in making a delete event with a
NULL surface. Just ignore such events.

Fixes: #3006
2020-08-02 22:45:28 -04:00
Matthias Clasen
c211fdcf42 Merge branch 'fishbowl-crash' into 'master'
Fishbowl crash

Closes #2996 and #3003

See merge request GNOME/gtk!2352
2020-08-03 02:19:01 +00:00
Matthias Clasen
af63893377 Merge branch 'search-demo-fixes' into 'master'
Search demo fixes

Closes #3004

See merge request GNOME/gtk!2354
2020-08-03 02:18:41 +00:00
Matthias Clasen
3304df7042 Merge branch 'tagged-entry-demo' into 'master'
gtk-demo: Simplify the tagged entry demo

Closes #3005

See merge request GNOME/gtk!2353
2020-08-03 02:18:28 +00:00
Matthias Clasen
df85ef1754 gtk-demo: Fix cleanup of search entry demo
We can't use the ::destroy signal anymore; use
a weak ref instead, and make ensure the entry
stays around long enough for us to finish the
cleanup.

Fixes: #3004
2020-08-02 21:53:59 -04:00
Matthias Clasen
a7e25f2c73 gtk-demo: Make search progress visible again
Set a progress fraction, so that the pulsing progress
in the search entry demo is actually visible.
2020-08-02 21:47:21 -04:00
Matthias Clasen
1c583edfb7 Merge branch 'font-explorer-crash' into 'master'
gtk-demo: Avoid invalid OpenType feature tags

Closes #2962

See merge request GNOME/gtk!2351
2020-08-03 01:40:51 +00:00
Matthias Clasen
89c10e092a Merge branch 'emoji-insert-fix' into 'master'
textview: Make insert-emoji replace the selection

Closes #2996

See merge request GNOME/gtk!2350
2020-08-03 01:40:43 +00:00
Matthias Clasen
4bdd94fd3f gtk-demo: Simplify the tagged entry demo
No need for an intermediate box widget here;
we can just use a box layout. As a side-effect,
this fixes the theme to apply to the selection.

Fixes: #3005
2020-08-02 21:39:23 -04:00
Matthias Clasen
5a55f6ff7b gdk: Fix gdk_surface_get_layout_monitor
We are determining the monitor by maximizing the
intersection; that only works if our rectangle
is not empty.

Fixes: #3003
2020-08-02 21:29:18 -04:00
Matthias Clasen
af07cfea5f gtk-demo: Avoid invalid OpenType feature tags
ss00 doesn't exist, and we use xxxx as placeholder
for 'default' choices in alternatives. Add a warning
in case we run across invalid OpenType feature tags
in fonts.

Fixes: #2962
2020-08-02 21:13:37 -04:00
Matthias Clasen
348a38a876 textview: Make insert-emoji replace the selection
This is the expected behavior, and matches what
GtkText does.

Fixes: #2996
2020-08-02 20:48:14 -04:00
Matthias Clasen
0d98bab82b Merge branch 'filechooser-completions' into 'master'
filechooser: Prevent over-eager completions

Closes #2995

See merge request GNOME/gtk!2347
2020-08-03 00:23:28 +00:00
Matthias Clasen
992c5fade7 Merge branch 'wip/chergert/gtk4-textview-fix-selections' into 'master'
textlinedisplaycache: short-circuit y_range invalidation

Closes #2975

See merge request GNOME/gtk!2348
2020-08-03 00:23:13 +00:00
Matthias Clasen
75d09d5ab3 Merge branch 'fix-win32-ci' into 'master'
ci: Don't use --werror for the win32 build

See merge request GNOME/gtk!2349
2020-08-03 00:19:43 +00:00
Matthias Clasen
1c49371edf ci: Don't use --werror for the win32 build
This leads to warnings from the glib win32 build
failing our ci. Only use werror for gtk itself.
2020-08-02 19:59:25 -04:00
Christian Hergert
94d17a6809 textlinedisplaycache: short-circuit y_range invalidation
If we have a y==-1 then we are generally invalidating the whole textview.
For this case, we can just discard the entire GtkTextLineDisplay cache.

Fixes #2975
2020-08-02 16:35:50 -07:00
Matthias Clasen
9605e49fbf filechooser: Prevent over-eager completions
We don't want the completions to pop up after we call
gtk_file_chooser_set_current_name(). This used to be
handled by gtk_entry_set_text() blocking the completion
signal handler. We don't have that anymore, so block
popup completion around the call to gtk_editable_set_text()
instead.

Fixes: #2995
2020-08-02 19:18:11 -04:00
Matthias Clasen
43816ba8d9 Merge branch 'grid-api' into 'master'
grid layout: Rename some properties

Closes #2967

See merge request GNOME/gtk!2345
2020-08-02 23:17:40 +00:00
Matthias Clasen
71be1751c6 builder-tool: Rewrite top/left-attach
Rewrite the GtkGrid:top/left-attach child properties
to the GtkGridLayoutChild:row/column layout properties.

Update expected test output to match.
2020-08-02 17:58:03 -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
7fe7d5ab4f Merge branch 'fix-textiter-tests' into 'master'
textbuffer: Fix a test failure

See merge request GNOME/gtk!2346
2020-08-02 21:55:43 +00:00
Matthias Clasen
4340f75304 textbuffer: Fix a test failure
The previous change to gtktextbuffer.c was breaking
the textiter testcase.
2020-08-02 17:23:26 -04:00
Matthias Clasen
0add626822 textbuffer: Be careful with tags when copying
We can only insert tags in the buffer if they come
from the same GtkTextTagTable as the buffer uses.
If that is not the case, paste the text without tags.

Fixes: #2991
2020-08-02 13:54:06 -04:00
Matthias Clasen
793ea05f4a Merge branch 'text-drag-select' into 'master'
textview: Only claim the event when appropriate

Closes #2999

See merge request GNOME/gtk!2344
2020-08-02 17:45:30 +00:00
Matthias Clasen
638ea2d6fc Merge branch 'fallback-menu-critical' into 'master'
popovermenu: Avoid a critical

Closes #2998

See merge request GNOME/gtk!2343
2020-08-02 17:42:22 +00:00
Matthias Clasen
c959f9c701 textview: Only claim the event when appropriate
Don't claim the event unconditionally for the click gesture,
since we may want to start a drag selection.

Fixes: #2999
2020-08-02 13:32:37 -04:00
Matthias Clasen
f8a303b0e5 popovermenu: Avoid a critical
While we guarantee that the widget that a controller
is attached to stays around while it is handling an event,
the same is not true for the root that the widget belongs
to. In corner cases (such as clicking "Close" in the
fallback window menu), it may already be gone.
Avoid a critical in that case.

Fixes: #2998
2020-08-02 13:09:00 -04:00
Matthias Clasen
ddda963f81 Merge branch 'selectable-label-draw' into 'master'
label: Redraw when focus changes

See merge request GNOME/gtk!2342
2020-08-02 16:40:12 +00:00
Matthias Clasen
9bf50e5650 Merge branch 'linked-button-fixes' into 'master'
Adwaita: Add linked styling for particular button widgets

Closes #2939 and #1903

See merge request GNOME/gtk!2339
2020-08-02 16:39:59 +00:00
Matthias Clasen
acc57ea799 Merge branch 'controllers-list' into 'master'
Controllers list

See merge request GNOME/gtk!2341
2020-08-02 16:25:50 +00:00
Matthias Clasen
1c8471c38f label: Redraw when focus changes
When focus changes in a selectable label, we need to
redraw to make the text caret (dis)appear.
2020-08-02 12:11:38 -04:00
Matthias Clasen
17208ca7fa Go back to keeping a list of event controllers
This reverts 4b9e5304cc. It caused a number of regressions,
such as event controller ordering changes.
2020-08-02 12:01:06 -04:00
Matthias Clasen
1c16cb751f Revert "Add gtk_widget_prepend_controller"
This reverts commit 692cc42e10.
2020-08-02 12:01:06 -04:00
Matthias Clasen
127612d213 Revert "entry completion: Make keynav work again"
This reverts commit 53a30eaa12.
2020-08-02 12:01:06 -04:00
Matthias Clasen
4ad401f3fa Merge branch 'matthiasc/for-master' into 'master'
shortcutswindow: Clear search entry on unmap

Closes #2981

See merge request GNOME/gtk!2340
2020-08-02 15:05:17 +00:00
Matthias Clasen
888a65c1fb shortcutswindow: Clear search entry on unmap
Otherwise, the search term will linger around until
somebody clicks the search button again.

Fixes: #2981
2020-08-02 09:33:52 -04:00
Piotr Drąg
3d65178f37 Update Polish translation 2020-08-02 14:36:18 +02:00
nana-4
891027f0c3 Adwaita: Add linked styling for particular button widgets
Those button widgets need some special linked styling like what
combobox has.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/1903
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2939
2020-08-02 19:14:26 +09:00
nana-4
5f00675de4 appchooserbutton: Set a CSS name
Otherwise it has a CSS name "widget".
2020-08-02 18:26:40 +09:00
Matthias Clasen
be03613e30 Merge branch 'ci-installed-tests' into 'master'
Run installed tests in ci

Closes #2966

See merge request GNOME/gtk!2335
2020-08-02 03:47:22 +00:00
Matthias Clasen
d17e51df06 Merge branch 'inspector-device-details' into 'master'
inspector: Introspect enum values

See merge request GNOME/gtk!2338
2020-08-02 03:25:33 +00:00
Matthias Clasen
5ecf1431f0 cups: Don't emit a warning if we can't talk to avahi
The g_warning in this case makes the templates test
fail if it can't connect to the system bus (as is the
case for running installed tests in ci).
2020-08-01 23:24:36 -04:00
Matthias Clasen
28a9fa2486 installed-tests: Fix the icontheme test
We forgot to install some of the icons, causing
the test to fail.
2020-08-01 23:24:36 -04:00
Matthias Clasen
7cf61e6a4b ci: Add a build that runs installed tests
This will hopefully prevent regressions in
installed-tests.
2020-08-01 23:24:36 -04:00
Matthias Clasen
0d608c492d inspector: Introspect enum values
Stop hardcoding arrays with names for enum values.
This has bitten us repeatedly as these enums were
changed around; time to stop doing it.
2020-08-01 23:05:24 -04:00
Matthias Clasen
7bc553a5cc Merge branch 'label-copy-link-fix' into 'master'
Label copy link fix

See merge request GNOME/gtk!2337
2020-08-02 02:45:53 +00:00
Matthias Clasen
934946acfc Merge branch 'matthiasc/for-master' into 'master'
testsuite: Fix installed tests

Closes #2966

See merge request GNOME/gtk!2336
2020-08-02 02:45:30 +00:00
Matthias Clasen
3a9b824ce5 ci: Use newer fedora image
v22 adds gnome-desktop-testing-runner and enables sudo.
2020-08-01 22:12:47 -04:00
Matthias Clasen
501b2b43ef ci: Enable sudo in the image
This is needed so we can install what we built.
2020-08-01 22:12:08 -04:00
Matthias Clasen
aea253bc60 ci: Add gnome-desktop-testing to images 2020-08-01 22:12:08 -04:00
Matthias Clasen
4fed32315c testsuite: Fix installed tests
This broken recently, when we converted the tests
array to a dictionary.

Fixes: #2966
2020-08-01 22:12:08 -04:00
Matthias Clasen
d19e60a40d testsuite: Fix installed tests
This broken recently, when we converted the tests
array to a dictionary.

Fixes: #2966
2020-08-01 22:06:21 -04:00
Matthias Clasen
e0c7d7daeb menusectionbox: Avoid a critical warning
The popover may already be gone when the item
is activated. Don't trigger a critical in that
case.

Related: #2986
2020-08-01 22:03:41 -04:00
Matthias Clasen
64ed69c56f label: Be more selective when selecting on focus-in
We don't want to select on focus-in when the focus
comes from a child. The case where this does harm
is when you activate copy or paste actions from the
context menu. We close the menu before triggering the
action, and if that causes the text in the label to
be selected, unexpected things happen, since the action
applies to the current selection.

This is the equivalent of cd9f5733b3 for GtkLabel.
2020-08-01 22:01:52 -04:00
Matthias Clasen
2a962e1c9a Merge branch 'glib-build-fix' into 'master'
togglebutton: Don't crash on click

See merge request GNOME/gtk!2334
2020-08-02 01:30:31 +00:00
Matthias Clasen
74662776d4 togglebutton: Don't crash on click
The code used to do
if (parent_class->clicked)
  parent_class->clicked (...)
That is pointless because the parent_class never changes,
so there' no need for that if and commit 415946eb0f
took it out. Unfortunately, p arent_class->clicked is NULL
though, so the whole call needs to go.
2020-08-01 20:09:05 -04:00
Matthias Clasen
0b2833f69c Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

Closes #2980, #2974, #2949, and #2766

See merge request GNOME/gtk!2333
2020-08-01 23:58:04 +00:00
Timm Bäder
41b458fba7 Fix and improve various code samples 2020-08-01 20:01:04 +02:00
Timm Bäder
f716daa483 aboutdialog: Fix a code sample
gdk_texture_new_from_file takes a GFile these days.
2020-08-01 19:30:31 +02:00
Timm Bäder
415946eb0f togglebutton: Modernice source file
Make this a little less ancient looking.
2020-08-01 19:24:54 +02:00
Timm Bäder
65b79d2585 Avoid refering to old GtkContainer API in the docs 2020-08-01 15:34:59 +02:00
Timm Bäder
e976825342 button: Use g_object_notify_by_pspec() 2020-08-01 15:34:07 +02:00
Timm Bäder
b489a1f6b5 stack: Allow NULL names
Does this work?
2020-08-01 15:27:13 +02:00
Timm Bäder
2f65459fcc stack: Only compare page names if the new page has one 2020-08-01 15:26:53 +02:00
Timm Bäder
f5af18738b listbox: Add _append
To have easy replacement API for gtk_container_add.
2020-08-01 15:26:28 +02:00
Timm Bäder
b37b85333d adwaita: Reset popover background in backdrop
Otherwise it inherits the generic background color from .background

Fixes #2766
2020-08-01 10:34:04 +02:00
Timm Bäder
76f2396764 popover: Use gtk_widget_add_css_class 2020-08-01 10:31:38 +02:00
Timm Bäder
547842e7f0 window: Keep titlebar after main child
Fixes #2949
2020-08-01 09:30:48 +02:00
Timm Bäder
ebaea07286 inspector: Avoid some failing casts
We might be inspecting a non-widget here, so can't just cast that.
2020-08-01 08:59:46 +02:00
Timm Bäder
0822de1971 textview: Only show "insert emoji" menu item if editable
Fixes #2974
2020-08-01 08:59:46 +02:00
Timm Bäder
954a144336 mediastream demo: Add a weak pointer to the window
Do what other demos do as well.

Fixes 2983
2020-08-01 08:59:46 +02:00
Timm Bäder
bf24da0d80 inspector: Add a type check
We only connect to this signal if sl->obejct is a GtkAccessible, so only
disconnect from it on the same condition.

Fixes #2980
2020-08-01 08:59:41 +02:00
Jordi Mas
d743e757ec Update Catalan translation 2020-08-01 07:33:03 +02:00
Rico Tzschichholz
746a40bbfe Merge branch 'ricotz/for-master' into 'master'
Add annotations to improve GIR API

See merge request GNOME/gtk!2332
2020-07-31 19:31:40 +00:00
Rico Tzschichholz
d1cab4fbdd gtk: Add annotations to improve GIR API 2020-07-31 20:56:36 +02:00
Rico Tzschichholz
7a58a6a097 gsk: Add annotations to improve GIR API 2020-07-31 20:56:36 +02:00
Rico Tzschichholz
371cdf3250 gdk/x11: Add annotations to improve GIR API 2020-07-31 20:56:36 +02:00
Matthias Clasen
1087ff48f0 Merge branch 'glib-build-fix' into 'master'
widget: Drop unnecessary includes

See merge request GNOME/gtk!2328
2020-07-31 18:52:50 +00:00
Matthias Clasen
15982ab6d2 meson: Try to limit the damage
Try to teach meson not to build our subprojects with
-Werror, since that is just insane, and exposes us
to random build failures in subprojects.
2020-07-31 14:20:11 -04:00
Matthias Clasen
0dc6ee2c44 Merge branch 'dont-always-inline' into 'master'
gsk: Don't the always_inline function attribute

See merge request GNOME/gtk!2331
2020-07-31 17:39:22 +00:00
Matthias Clasen
f136a6f51f testgtk: More GTimeVal eradication 2020-07-31 13:37:29 -04:00
Matthias Clasen
6ab13a6303 gsk: Don't the always_inline function attribute
Visual C doesn't understand it, and the compiler
should know better, anyway.
2020-07-31 13:13:46 -04:00
Matthias Clasen
358f66482d Merge branch 'master.win32' into 'master'
Some improvements for GDK/Win32

See merge request GNOME/gtk!2327
2020-07-31 17:10:47 +00:00
Matthias Clasen
0d3fa01be2 Merge branch 'wip/carlosg/cursor-fallout' into 'master'
gdk: Fix toplevel calculation on pointer grab switch

Closes #2970

See merge request GNOME/gtk!2330
2020-07-31 17:10:05 +00:00
Matthias Clasen
e0d1aac8a5 Bump the glib dependency
Some of the new apis we want to use to avoid
deprecations were only introduced in 2.65.
2020-07-31 13:07:31 -04:00
Matthias Clasen
fc31f3d629 placesview: Keep up with GLib deprecations
We were using deprecated GBookmarkFile api here too.
2020-07-31 12:54:57 -04:00
Carlos Garnacho
9564cba492 gdk: Fix toplevel calculation on pointer grab switch
This check used to read if (grab || device_type != GDK_DEVICE_TYPE_PHYSICAL),
the grab check was only reserved to physical devices, which the current
pointer device definitely doesn't act like. So the condition was "fixed" the
wrong way around, and the latter check is now moot, so the condition should
really go away. We always want to check the new toplevel under the pointer
here.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2970
2020-07-31 18:53:01 +02:00
Matthias Clasen
90eec6734f Merge branch 'cups-build-fix' into 'master'
Fix the build with cups < 2.3

Closes #2968

See merge request GNOME/gtk!2329
2020-07-31 16:33:46 +00:00
Matthias Clasen
72e14bd6dd recentmanager: Keep up with GLib deprecations
All the time_t based apis in GBookmarkFile have
been deprecated; use GDateTime instead. This
changes a few GtkRecentManager APIs.
2020-07-31 12:18:47 -04:00
Matthias Clasen
99bb8bb3f7 numericsorter: Ignore deprecations
We use g_value_get_char here; replacing it with
g_value_get_schar is not entirely trivial, so just
ignore deprecations for now.
2020-07-31 11:36:03 -04:00
Matthias Clasen
ff42c94174 gtkicontheme: Stop using GTimeVal
It has been deprecated and the deprecation warnings
break our -Werror build in ci.
2020-07-31 11:22:16 -04:00
Chun-wei Fan
20388f83f5 GDK-Win32: Use SetProcessDpiAwarenessContext() where available
This allows us to use DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 for the
DPI awareness mode, which will help us to better support use cases with
multiple monitors.  This is actualy a more advaned version of the
current PROCESS_PER_MONITOR_DPI_AWARE via using SetProcessDpiAwareness().

Note that this is not enabled by default, but also enabled via using
GDK_WIN32_PER_MONITOR_HIDPI, as in the PROCESS_PER_MONITOR_DPI_AWARE
case.

Note also, that appliation compatibility settings and DPI-awareness
manifests takes precedence over this API call, as before.
2020-07-31 23:20:25 +08:00
Chun-wei Fan
c97979873a demos: Fix running on Visual Studio builds
We need to mark the non-static callback functions for export.
2020-07-31 23:20:25 +08:00
Chun-wei Fan
d6955d4427 gskrenderer.c: Default to the GL renderer on Windows too
Since we have now made the Win32 GL contexts share the global context as
the other backends have, we are more ready to use the GL renderer by
default on Windows as well.

Note that currently we can only enable this when not running on
OpenGL/ES as the OpenGL/ES shaders are not ready at this point, and the
OpenGL/ES support that we have from libANGLE does not support full
desktop OpenGL operations.
2020-07-31 23:20:14 +08:00
Chun-wei Fan
85706dc39d gdkglcontext-win32.c: Create a global shared GL context
Like the other backends, we ought to create our WGL/EGL GL contexts like
the following:

"Create a global GL context that connects all GL contexts on a display
and lets us share textures between them."
2020-07-31 23:19:28 +08:00
Chun-wei Fan
07166a55ee gdksurface-win32.c: Deal with modal and decoration props
Handle these cases, especially the modal case, which we did not handle
previously after the conversion to surface subtypes.
2020-07-31 23:19:28 +08:00
Matthias Clasen
2dfa5ac804 x11: Stop using GTimeVal
It has been deprecated, and that is breaking our
ci builds with -Werror.
2020-07-31 10:58:53 -04:00
Matthias Clasen
8c66e2ff66 widget: Drop unnecessary includes
We don't need to include gobjectnotifyqueue.c anymore,
since style properties are gone. This should fix the
build with -Werror.
2020-07-31 10:34:37 -04:00
Matthias Clasen
d761e3cf2c Fix the build with cups < 2.3
PPD_CUSTOM_UNKNOWN was introduced in cups 2.3.
Only handle it when we build against a new enough cups.

Fixes: #2968
2020-07-31 10:01:45 -04:00
Florentina Mușat
360ffb8e87 Update Romanian translation 2020-07-31 13:42:35 +00:00
Yuri Chornoivan
731b672875 Update Ukrainian translation 2020-07-31 12:52:54 +00:00
Daniel Mustieles
d5a31daa41 Updated Spanish translation 2020-07-31 13:48:24 +02:00
Matthias Clasen
554954d126 3.99.0 2020-07-30 22:16:31 -04:00
Matthias Clasen
73477b5abf testsuite: Use Wayland by default
I'm tired of xwayland crashing and killing my shell.
2020-07-30 22:16:31 -04:00
Matthias Clasen
62803c19f5 Merge branch 'focus-active' into 'master'
Focus active

Closes #2390

See merge request GNOME/gtk!2324
2020-07-30 17:50:54 +00:00
Matthias Clasen
643d873f47 eventcontrollerkey: Update im focus when active window changes
Use the new GTK_CROSSING_ACTIVE crossing events to update
the im context focus when the window becomes active or
inactive. IBus requires this, since it has only a single,
global focus location.

Fixes: #2390
2020-07-30 13:23:45 -04:00
Matthias Clasen
b0d40403e1 window: Emit GTK_CROSSING_ACTIVE crossing events
Emit crossing events when the active window changes.
We don't want to emit GTK_CROSSING_FOCUS events, since
every window has its own focus location (focus does not
jump from window to window), so we use the new
GTK_CROSSING_ACTIVE type of crossing event for this.
2020-07-30 13:22:26 -04:00
Matthias Clasen
12170acf46 Define GTK_CROSSING_ACTIVE
Document the different crossing event kinds that we use,
and add GTK_CROSSING_ACTIVE. We are going to use it in
the future when the active window changes.
2020-07-30 13:21:28 -04:00
Matthias Clasen
38648855b0 Merge branch 'wip/carlosg/more-device-api-cleanup' into 'master'
More device API cleanup

See merge request GNOME/gtk!2323
2020-07-30 17:01:15 +00:00
Carlos Garnacho
96452a2e46 gdk: Rename gdk_seat_get_physical_devices() to gdk_seat_get_devices()
We don't want to tell what they are, and the distinction is now less
clear. Remove the adjective from the function name.
2020-07-30 18:44:40 +02:00
Carlos Garnacho
46eb054337 gdk: Drop gdk_device_get_device_type()
There is no longer a hierarchy of devices, or none that is seen
on the outside.
2020-07-30 18:44:40 +02:00
Carlos Garnacho
4a2050e220 gdk/x11: Make device type a X11 detail
The only legit uses of device types are here in gdk/x11, move the
concept of device type to X11, so we can drop it from public API.
2020-07-30 18:30:13 +02:00
Carlos Garnacho
3c68db8e47 gdk: Make gdk_device_list_physical_devices() private
Physical devices should probably be accounted internally in gdk/x11,
make this out of private API so at least the implementation details
don't leak.
2020-07-30 18:30:13 +02:00
Carlos Garnacho
9912c80d70 gdk: Drop gdk_device_get_associated_device()
Devices are no longer associated like this, the seat should be used
to resolve queries on other devices.
2020-07-30 18:30:13 +02:00
Carlos Garnacho
2f792396d7 gtkimcontext: Avoid gdk_device_get_associated_device()
Query the seat for that.
2020-07-30 18:30:13 +02:00
Carlos Garnacho
6730b26b43 gtktextview: Avoid gdk_device_get_associated_device()
Query the seat for that.
2020-07-30 18:30:13 +02:00
Carlos Garnacho
6e83d1f54e gtkwindowhandle: Avoid gdk_device_get_associated_device()
Query the seat for that.
2020-07-30 18:19:44 +02:00
Carlos Garnacho
fb9db7fede gtkdragsource: Avoid gdk_device_get_associated_device()
Query the seat for that.
2020-07-30 18:19:44 +02:00
Carlos Garnacho
7991032aeb gdk/x11: Avoid gdk_device_get_associated_device()
Query the seat for that.
2020-07-30 18:19:44 +02:00
Carlos Garnacho
0cbc857ea4 gdk/win32: Avoid gdk_device_get_associated_device()
Query the seat for that.
2020-07-30 18:17:42 +02:00
Carlos Garnacho
398c1d1ad7 gdk/macos: Avoid gdk_device_get_associated_device()
Query the seat for that.
2020-07-30 18:17:42 +02:00
Carlos Garnacho
94982dbab7 gdk: Avoid gdk_device_get_associated_device()
Query the seat for that.
2020-07-30 18:17:42 +02:00
Benjamin Otte
4dc2ab61c9 Merge branch 'wip/otte/geometry' into 'master'
Some GdkGeometry cleanups

See merge request GNOME/gtk!2322
2020-07-30 15:31:27 +00:00
Benjamin Otte
13d3afa56e Remove unused GDK_HINT_POS 2020-07-30 17:06:15 +02:00
Benjamin Otte
3dd0e6d0b1 Remove gravity from GdkGeometry
It's always northwest
2020-07-30 17:06:15 +02:00
Benjamin Otte
11db6ad574 Remove aspect ratio from GdkGeometry
It's unused.
2020-07-30 17:06:15 +02:00
Benjamin Otte
ebcef256ab gdk: Remove unused flags 2020-07-30 17:06:15 +02:00
Benjamin Otte
b12b06e917 gdk: Remove base_size and increment from GdkGeometry
It's unused.
2020-07-30 16:55:45 +02:00
neyfag
a27c3039d0 Scroll to cursor after canceling a selection 2020-07-30 15:52:57 +02:00
Matthias Clasen
0ee3370afc Merge branch 'wip/master.win.egl' into 'master'
Add an EGL (OpenGL/ES 3) renderer for GTK+-4.x (using Google's ANGLE project) for Windows

Closes #105

See merge request GNOME/gtk!215
2020-07-30 12:18:02 +00:00
Rico Tzschichholz
c2b5997437 Merge branch 'ricotz/for-master' into 'master'
a11y: Fix typo in GtkATContext::state-changed docs

See merge request GNOME/gtk!2320
2020-07-30 07:35:48 +00:00
Rico Tzschichholz
f02a17805e a11y: Fix typo in GtkATContext::state-changed docs 2020-07-30 09:06:49 +02:00
Chun-wei Fan
a481733b40 GDK/Win32: Force GLES if running on ARM64
If GLES support is enabled on Windows, force GLES mode if we are running
on a ARM64 version of Windows (i.e. Windows 10 for ARM).

This is required as ARM64 versions of Windows only provide a software
implementation of OpenGL 1.1/1.2, which is not enough for our purposes.
Thus, we could make instead use the GLES support provided via Google's
libANGLE (which emulates OpenGL/ES 3 with Direct3D 9/11), so that we
can run GtkGLArea programs under OpenGL/ES in ARM64 versions of Windows.

Note that eventually we could update the libepoxy build files for Windows
to not check nor enable WGL when building for ARM64 Windows, as the WGL
items do not work, although they do build.
2020-07-30 14:30:13 +08:00
Chun-wei Fan
cf0175ffce OpenGL/ES: Fix 'R' and 'B' bits inverted on Windows
We need to use GL_BGRA instead of GL_RGBA when doing glReadPixels() on
EGL on Windows (ANGLE) so that the red and blue bits won't be displayed
inverted.

Also fix the logic where we determine whether to bit blit or redraw
everything.
2020-07-30 14:30:13 +08:00
Chun-wei Fan
e5600ab99b demos: Fix glarea demo on OpenGL/ES
Some implementations of the ES 1.00 shader (such as Google's ANGLE) do
not like the 'f' suffix for floats, so just drop it, as it should be
harmless to drop.
2020-07-30 14:26:33 +08:00
Chun-wei Fan
257fd990d1 Add a EGL renderer (via ANGLE) for Windows
This is for adding a EGL-based renderer which is done via the ANGLE
project, which translate EGL calls to Direct3D 9/11.  This is done as a
possible solution to issue #105, especially for cases where the needed
full GL extensions to map OpenGL to Direct3D is unavailable or
unreliable, or when the OpenGL implementation from the graphics drivers
are problematic.

To enable this, do the following:
-Build ANGLE and ensure the ANGLE libEGL.dll and libGLESv2.dll are
 available.  A sufficiently-recent ANGLE is needed for things to
 work correctly--note that the copy of ANGLE that is included in
 qtbase-5.10.1 is sufficient.  ANGLE is licensed under a BSD 3-clause
 license.
-Build libepoxy on Windows with EGL support enabled.
-Currently, prior to running GTK+ programs, the GDK_DEBUG envvar needs
 to be set with gl-gles as at least one of the flags.

Known issues:
-Only OpenGL ES 3 is supported, ANGLE's ES 2 does not support the needed
 extensions, notably GL_OES_vertex_array_object, but its ES 3 support is
 sufficient.
-There is no autodetection or fallback mechanism to enable using
 EGL/Angle automatically yet.  There are no plans to do this in this
 commit.
2020-07-30 14:26:33 +08:00
Chun-wei Fan
12a23162b3 build: Check for EGL support in libepoxy on Windows
...EGL support needs to be explicitly enabled during the build of
libepoxy on Windows as it is not enabled by default on Windows.

With this, we can add an EGL renderer for Windows that make use of
Google's libANGLE, which is a library that translates OpenGL/ES calls
to Direct3D 9/11, which will provide better hardware compatibility
on Windows and would act as one of the foundations to resolve issue #105.
2020-07-30 14:26:33 +08:00
Matthias Clasen
0b11e78064 Merge branch 'display-cleanup' into 'master'
Display cleanup

See merge request GNOME/gtk!2319
2020-07-30 03:55:23 +00:00
Matthias Clasen
e8026e29b6 Merge branch 'surface-cleanup' into 'master'
Surface cleanup

See merge request GNOME/gtk!2317
2020-07-30 03:43:30 +00:00
Matthias Clasen
ee1a868913 Merge branch 'a11y-work' into 'master'
A11y work

See merge request GNOME/gtk!2318
2020-07-30 03:28:02 +00:00
Matthias Clasen
488722e7c4 docs: Don't refer to nonexisting functions
gdk_surface_input_shape_combine_mask() no longer
exists.
2020-07-29 23:00:57 -04:00
Matthias Clasen
7df070d681 gdk: Move default group api to the X11 backend
This is the only place where it is implemented.
2020-07-29 22:58:37 -04:00
Matthias Clasen
abf8cbeaea a11y: Set an accessible role for GtkLevelBar
Use the 'meter' role for GtkLevelBar, and set the
appropriate properties.

Update the docs and add a test.
2020-07-29 22:46:00 -04:00
Matthias Clasen
c0de580d46 a11y: Set an accessible role for GtkExpander
Use the button accessible role for GtkExpander
and set attributes as appropriate.

Update the documentation and add a test.
2020-07-29 22:46:00 -04:00
Matthias Clasen
144114bf40 a11y: Set accessible role for GtkLinkButton
Set the accessible role for GtkLinkButton to button.
We don't use the 'link' role since ARIA says "if it
behaves like a button, use 'button'".

Update docs and add a test.

This changes should not be neccessary, since
GtkLinkButton derives from GtkButton, see #2965.
2020-07-29 22:46:00 -04:00
Matthias Clasen
c68fe1053a a11y: Set an accessible role for GtkTextView
Use the text-box accessible role for GtkTextView
and set properties as appropriate.

Update the documentation and add a test.
2020-07-29 22:46:00 -04:00
Matthias Clasen
4d012a6d95 Rename gdk_surface_queue_expose
We don't have expose events anymore; instead, there
is a ::render signal. So rename queue_expose to
queue_render to match.

Update all callers.
2020-07-29 22:40:01 -04:00
Matthias Clasen
c1eedf6845 gdk: Stop exporting gdk_surface_freeze_updates
The only legitimate use for freezing the frame clock
is in GDK backends. Exporting this function for
applications makes no sense.
2020-07-29 22:30:44 -04:00
Matthias Clasen
9722bb4d9e iconbrowser: Add screenshots to appdata
appstream validation is picky and insists we have
at least on screenshot.
2020-07-29 20:23:46 -04:00
Matthias Clasen
ad3514216d Update our appdata files
Mention the new release in all our appdata files.
2020-07-29 17:58:45 -04:00
Matthias Clasen
59fce30200 icon-browser: Install desktop file and appdata
That is needed to make the flatpak build in our
ci happy.
2020-07-29 17:42:49 -04:00
Matthias Clasen
2e80658251 testsuite: Skip the skipping
meson 0.55 considers a test failed if we skip any cases.
Until that is fixed, just skip them quietly.

See https://github.com/mesonbuild/meson/issues/7515
2020-07-29 16:35:36 -04:00
Matthias Clasen
53e74c365b testsuite: Stop setting NO_AT_BRIDGE
We are not paying attention to that environment
variable anymore.
2020-07-29 14:57:07 -04:00
Matthias Clasen
047709e911 NEWS: Updates 2020-07-29 12:40:15 -04:00
Matthias Clasen
7e355cbe1e docs: Mention workarea in the migration guide 2020-07-29 12:39:57 -04:00
Matthias Clasen
3eab58816b Merge branch 'wip/ditch-workarea' into 'master'
gdk/monitor: Remove gdk_monitor_work_area and GdkMonitor::work-area

See merge request GNOME/gtk!2316
2020-07-29 16:24:32 +00:00
Jonas Ådahl
c7c71137b2 gdk/monitor: Remove gdk_monitor_work_area and GdkMonitor::work-area
It's not a portable API, so remove it. The corresponding backend
specific functions are still available, if they were implemented, e.g.
gdk_macos_monitor_get_workarea() and gdk_x11_monitor_get_workarea().
2020-07-29 17:57:30 +02:00
Matthias Clasen
ec34675019 Merge branch 'better-doc-link-fix' into 'master'
docs: Fix links in markdown content differently

See merge request GNOME/gtk!2315
2020-07-29 12:16:55 +00:00
Matthias Clasen
85fb015b45 docs: Fix links in markdown content differently
pandoc insists on using the xlink namespace for hrefs,
and the namespace setup doesn't carry over xi:includes.
My first fix was to tell pandoc to generate standalone
docbook documents, which makes it insert the xlink
namespace. But it also makes it wrap all sections and
chapters in articles, and that messes up our toc structure.

So, patch things up differently by stripping the xlink:
from hrefs via regex.

Yay for XML!
2020-07-29 07:47:59 -04:00
Matthias Clasen
d40b1d31b5 Merge branch 'doc-fixes' into 'master'
Doc fixes

See merge request GNOME/gtk!2314
2020-07-29 11:24:48 +00:00
Matthias Clasen
5fd03f3297 Merge branch 'a11y-work' into 'master'
A11y work

See merge request GNOME/gtk!2312
2020-07-29 11:19:22 +00:00
Daniel Mustieles
a3a66be76e Updated Spanish translation 2020-07-29 12:40:18 +02:00
Daniel Mustieles
3bb3bc2982 Updated Spanish translation 2020-07-29 12:40:17 +02:00
Florentina Mușat
a7ac16098a Update Romanian translation 2020-07-29 10:33:19 +00:00
Matthias Clasen
3b35ae870c docs: Add a missing symbol 2020-07-28 22:40:10 -04:00
Matthias Clasen
d0abe5a919 filter: Typo fix 2020-07-28 22:40:10 -04:00
Matthias Clasen
26200c0f7e filechooser: Document the response.activate action 2020-07-28 22:40:10 -04:00
Matthias Clasen
07bf9045fb a11y: Document GtkATContext::state-changed 2020-07-28 22:40:10 -04:00
Matthias Clasen
e4a3746755 docs: Update the symbols list
Make sure the sections file is in sync with what
we actually export.
2020-07-28 22:40:10 -04:00
Matthias Clasen
1772d23f8e docs: Update private headers list 2020-07-28 22:40:10 -04:00
Matthias Clasen
e07b9605bc a11y: Fix a few glitches in the role enum
When the enumeration was synced with the latest draft
of the ARIA spec, the math and note roles missed the boat.
2020-07-28 22:20:40 -04:00
Matthias Clasen
fc47e79cb6 Document gdk_device_tool_get_axes 2020-07-28 21:58:06 -04:00
Matthias Clasen
2a92ee22da gdk: Small doc fixup
We no longer use <!-- --> for plurals, gtk-doc is smart
enough to detect them without that.
2020-07-28 21:53:56 -04:00
Matthias Clasen
23dcf36ec9 NEWS: Updates 2020-07-28 21:17:17 -04:00
Matthias Clasen
b5f256937f Merge branch 'wip/carlosg/device-api-cleanup' into 'master'
Cleanups to device/event API

See merge request GNOME/gtk!2313
2020-07-28 23:49:35 +00:00
Carlos Garnacho
cab1dcb696 gdk: Conflate GDK devices
Make GdkEvents hold a single GdkDevice. This device is closer to
the logical device conceptually, although it must be sufficient for
device checks (i.e. GdkInputSource), which makes it similar to the
physical devices.

Make the logical devices have a more accurate GdkInputSource where
needed, and conflate the event devices altogether.
2020-07-29 01:27:51 +02:00
Carlos Garnacho
25ea17a6fc gdk: Drop source_device argument from _gdk_display_device_grab_update()
It's just passed around and used nowhere.
2020-07-29 01:27:51 +02:00
Carlos Garnacho
4a2bbed157 gdk: Make events hold an axis array matching GdkAxisUse
Instead of doing device-specific translations of array positions,
use GdkAxisUse as an array index right away.
2020-07-29 01:27:51 +02:00
Carlos Garnacho
7629f6d533 gdk: Make GdkDevice axis API internal
All outside interaction happens through gdk_event_get_axis(), no
device poking is necessary, nor axis to array index translations.
2020-07-29 01:27:51 +02:00
Carlos Garnacho
230ce9bfde gdk: Remove gdk_device_get_axes()
Besides the implicit x/y assumptions, devices don't have axes. Those
are actually provided by the GdkDeviceTool driving the device, and
different tools may have different axes.

It does not make sense to offer this API that can change beneath
someone's feet, we now have gdk_device_tool_get_axes() which is static
to the tool.
2020-07-29 01:27:51 +02:00
Carlos Garnacho
2736633a60 inspector: Show tool axes, instead of device axes
We are moving away from the latter as they are inconsistent with
Wayland. Make the inspector introspect known tools and their info,
instead.
2020-07-29 01:27:51 +02:00
Matthias Clasen
1755e07af7 a11y: Set an accessible role for GtkPasswordEntry
Use the text-box accessible role for GtkPasswordEntry.
And set properties as appropriate.

Update the documentation and add a test.
2020-07-28 18:23:57 -04:00
Matthias Clasen
a610bb89a0 a11y: Set an accessible role for GtkSearchEntry
Use the searchbox accessible role for GtkSearchEntry.
And set properties as appropriate.

Update the documentation and add a test.
2020-07-28 18:16:37 -04:00
Matthias Clasen
2040b7ecdf a11y: Set an accessible role for GtkLabel
Use the label accessible role for GtkLabel. ARIA has some
ominous wording about it going way, but while we have it,
GtkLabel is the obvious candidate for carrying it.

Update the documentation and add a test.
2020-07-28 18:16:37 -04:00
Matthias Clasen
cc35cc6c4e a11y: Add tests for mnemonics
We set up labelled-by accessible relations when
a label is set as mnemonic widget. Verify that that
happens as expected.
2020-07-28 18:16:37 -04:00
Matthias Clasen
9a82aadca7 a11y: Set an accessible role for GtkEntry
Use the text-box accessible role for GtkEntry and
set the placeholder and read-only accessible properties.

Update the documentation and add tests.
2020-07-28 18:16:37 -04:00
Matthias Clasen
23e185e674 a11y: Add a scrollbar relation test
Check that GtkScrolledWindow sets up the expected
relations between its scrollbars and child.
2020-07-28 18:16:37 -04:00
Matthias Clasen
971ee2d28a a11y: Set up controls relations for scrollbars
GtkScrolledWindow knows what its scrollbars control,
so set up the accessible relations for this.
2020-07-28 18:16:37 -04:00
Matthias Clasen
efd4169fa2 a11y: Set accessible roles for GtkImage and GtkPicture
Use the img accessible role for these.
Also update the documentation and add tests.
2020-07-28 18:16:37 -04:00
Carlos Garnacho
b52ad33031 gdk: Add gdk_seat_get_tools() API call
There's GdkSeat::tool-added and ::tool-removed, but there's no
API to query the known tools. Add this call.
2020-07-29 00:11:34 +02:00
Matthias Clasen
5926008647 Merge branch 'wip/chergert/bump-sysprof-abi' into 'master'
build: bump to sysprof 4 ABI

See merge request GNOME/gtk!2192
2020-07-28 20:33:33 +00: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
cc50be971d Merge branch 'ebassi/for-master' into 'master'
Ebassi/for master

See merge request GNOME/gtk!2311
2020-07-28 16:30:47 +00:00
Emmanuele Bassi
3294557717 a11y: Update the valuetext attribute of GtkProgressBar
Since progress bars can have a label, we should propagate that information
to ATs whenever it's set.
2020-07-28 16:59:08 +01:00
Emmanuele Bassi
470349c902 a11y: Add an explicit "reset to default" method
In some cases we explicitly want to unset an accessible attribute; for
instance, an accessible property is gated on a widget property, and if
the widget property gets unset, the accessible property should be reset.
2020-07-28 16:49:13 +01:00
Emmanuele Bassi
bf06cad5d9 a11y: Add proper error reporting to value collection
We're currently overloading NULL to mean both "this value is undefined,
and should be reset to its default" and "the value collection failed".
Let's do error reporting right, by using GError to mean "the collection
failed, for this specific reason"; then, we can use a NULL return value
to signal that the accessible attribute should be reset to its default
value.

This is only relevant for pointer-sized attribute values: strings,
references, and reference lists; numeric, boolean, tristate, and token
values either cannot be undefined, or have a specific "undefined" value.
2020-07-28 16:49:13 +01:00
Emmanuele Bassi
2e8de6bd88 a11y: Fix the error message for the attribute test macros
We're missing a closing parenthesis.
2020-07-28 16:49:13 +01:00
Emmanuele Bassi
7f04faf30d a11y: Use undefined as default for string attributes
Instead of an empty string.
2020-07-28 16:49:13 +01:00
Emmanuele Bassi
4fa891b55d Remove stray gtk-doc annotation
It confuses the g-i scanner, and gtk-doc.
2020-07-28 16:49:13 +01:00
Carlos Garnacho
254007a142 gdk: Add gdk_device_tool_get_axes()
Axes are actually a per-tool property, we just adapt devices to the
current tool.
2020-07-28 17:37:09 +02:00
Carlos Garnacho
1b846e29c7 docs: Correct migration note
A mentioned API call is now internal.
2020-07-28 17:36:18 +02:00
Carlos Garnacho
a2876b5cb4 gdkdevice: Remove gdk_device_get_state()
This is not needed nor recommended anymore, all reasons to maybe
need this were all kept within gdk.
2020-07-28 17:36:18 +02:00
Carlos Garnacho
5f8258109e gtkwindow: Move away from gdk_device_get_state()
Use gdk_device_get_modifier_state() poking the keyboard and keymap,
instead of this function.
2020-07-28 17:36:18 +02:00
Carlos Garnacho
6a4277a9a9 gtkpopover: Move away from gdk_device_get_state()
Use gdk_device_get_modifier_state() poking the keyboard and keymap,
instead of this function.
2020-07-28 17:36:18 +02:00
Piotr Drąg
f4e001c91a Update POTFILES.in and POTFILES.skip 2020-07-28 17:01:53 +02:00
Carlos Garnacho
3285f52dc8 gdk: Drop GDK_SOURCE_CURSOR
Looking at the xf86-input-wacom driver code, this is not even a thing
anymore. Drop this device type, in modern days there's
GDK_DEVICE_TOOL_TYPE_MOUSE for this.
2020-07-28 15:25:28 +02:00
Matthias Clasen
400a5b4e1f Merge branch 'wip/a11y-inspector' into 'master'
inspector: Show a11y information

See merge request GNOME/gtk!2302
2020-07-28 13:08:28 +00:00
Matthias Clasen
42a4940671 inspector: Show a11y information
Show a tab for  accessibility information.

This shows the role and the accessible attributes
(states, properties, relations).

For now, changing the values is not possible, and
we only show the explicitly set values. In the future,
we want to show the attributes that are relevant for
the role, regardless of whether they are set or not,
and allow changing some of the attributes (the ones
that are not fully managed by GTK itself).
2020-07-28 08:41:24 -04:00
Matthias Clasen
ecc329fa2a a11y: Add change notification to GtkATContext
Emit a ::state-change signal when state changes;
this was already a vfunc, but we want to listen
to state changes from the inspector too.
2020-07-28 08:41:24 -04:00
Emmanuele Bassi
5fc5e52f52 Merge branch 'a11y-tests' into 'master'
Add more a11y tests

See merge request GNOME/gtk!2303
2020-07-28 11:47:14 +00:00
Matthias Clasen
1d8e62fb01 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

See merge request GNOME/gtk!2306
2020-07-28 11:44:05 +00:00
Matthias Clasen
09faa582e3 Merge branch 'ebassi/for-master' into 'master'
Split GtkProgressBar finalization

See merge request GNOME/gtk!2308
2020-07-28 11:37:45 +00:00
Emmanuele Bassi
a85ba95b20 Split GtkProgressBar finalization
We're stopping activity mode when finalizing, which will change
accessible state; this will create a GtkATContext, and since GtkWidget
drops its GtkATContext on dispose(), we're going to end up leaking it on
the floor:

```
2,007 (64 direct, 1,943 indirect) bytes in 1 blocks are definitely lost in loss record 36,242 of 36,944
   at 0x483977F: malloc (vg_replace_malloc.c:307)
   by 0x5222105: g_malloc (gmem.c:106)
   by 0x523E222: g_slice_alloc (gslice.c:1025)
   by 0x523E261: g_slice_alloc0 (gslice.c:1051)
   by 0x534B398: g_type_create_instance (gtype.c:1849)
   by 0x53302EE: g_object_new_internal (gobject.c:1937)
   by 0x53312AF: g_object_new_valist (gobject.c:2262)
   by 0x532FEE8: g_object_new (gobject.c:1780)
   by 0x4B3F942: gtk_test_at_context_new (gtktestatcontext.c:107)
   by 0x491CC50: gtk_at_context_create (gtkatcontext.c:380)
   by 0x4BFEDA0: gtk_widget_accessible_get_at_context (gtkwidget.c:8127)
   by 0x4906079: gtk_accessible_get_at_context (gtkaccessible.c:83)
   by 0x490618F: gtk_accessible_update_state (gtkaccessible.c:137)
   by 0x4ACBA6D: gtk_progress_bar_act_mode_leave (gtkprogressbar.c:690)
   by 0x4ACB4F8: gtk_progress_bar_finalize (gtkprogressbar.c:564)
```

We're also unparenting widgets and changing styles, which is another
potential source of leaks and side effects.
2020-07-28 11:47:40 +01:00
Timm Bäder
2050120098 bitset: Fix typo 2020-07-28 08:10:43 +02:00
Timm Bäder
b213b01200 widget-factory: Remove useless separators
They don't serve a purpose and are not relevant for theming purposes.
2020-07-28 06:14:45 +02:00
Timm Bäder
ac1f242b6c gl renderer: Throw inset shadows with all !send values away 2020-07-28 05:34:12 +02:00
Timm Bäder
ebbb729aea gl renderer: Linear gradient state tracking 2020-07-28 05:34:12 +02:00
Timm Bäder
bbabec3f18 inspector: Avoid an uninitialized value 2020-07-28 05:34:12 +02:00
Timm Bäder
dded144313 gl renderer: Assert that we have program state
This is never a problem in reality, just for static analysis.
2020-07-28 05:34:12 +02:00
Timm Bäder
3f59566729 gl renderer: Repat node child bounds can't be NULL 2020-07-28 05:34:12 +02:00
Timm Bäder
e0420bae09 gl renderer: Remove dead code
We aren't using n_corners anyway
2020-07-28 05:34:12 +02:00
Timm Bäder
a3b452725b render nodes: Simplify diffing of uniform border nodes 2020-07-28 05:34:12 +02:00
Timm Bäder
d5f0256f8b listbox demo: Remove frames around labels
Having frames around those labels looks stupid
2020-07-28 05:34:12 +02:00
Timm Bäder
9cdf9847c2 gl: Add a gdk_gl_context_has_debug accessor
Check if the label_object_ etc. functions are gonna do anything at all.
The g_type_name_from_instance calls keep poppoing up in profiles.
2020-07-28 05:34:12 +02:00
Timm Bäder
fa85ec5cf5 GskTransform: Restructure _to_affine and _to_translation
Make the simple cases more explicit.
2020-07-28 05:34:12 +02:00
Timm Bäder
0ce32cd4b5 gl renderer: Save rectilinearity in clip stack
So we don't have to repeatedly call it in pop_clip()
2020-07-28 05:34:12 +02:00
Timm Bäder
756b84033a GskTransform: Remove unused function from private header
We only use this in gsktransform.c
2020-07-28 05:34:12 +02:00
Timm Bäder
5a9b54df96 gl renderer: More color matrix state tracking 2020-07-28 05:34:12 +02:00
Timm Bäder
d7ba281c15 gl renderer: Add contains_rect helper 2020-07-28 05:34:12 +02:00
Timm Bäder
c6c87b97c2 gl renderer: Add own graphene_rect_intersects 2020-07-28 05:34:11 +02:00
Timm Bäder
2fa9dddea6 gsk: Remember border node uniformity
Lots of border nodes have all the same width and the same color.
Renderers might be able to simplifty that, so keep an extra bit per
border node.
2020-07-28 05:34:11 +02:00
Timm Bäder
72d4a83af8 gl renderer: Moar state tracking
Track what we really need to send for inset shadows, which are used
as a border replacement in many cases.

Fishbowl says I can draw around 200-300 more switches per frame like
this too.
2020-07-28 05:34:11 +02:00
Timm Bäder
f4d9e4032f widget: Compare proper adjusted size to new size when allocating
We were comparing first but then still modifying the adjusted size later
on, leading to unnecessary resizes.
2020-07-28 05:34:11 +02:00
Timm Bäder
fcf502a686 gl renderer: Fix scrolledwindow undershoot rendering 2020-07-28 05:34:11 +02:00
Matthias Clasen
6e494b93ce a11y: Add spinbutton tests
Tests the fix in the previous commit.
2020-07-27 21:18:10 -04:00
Matthias Clasen
9458c1cc47 spinbutton: Update accessible state
Make sure to set value-max/min/now when the adjustment
changes.
2020-07-27 21:18:10 -04:00
Matthias Clasen
9190e95df9 a11y: Add scrollbar tests
Tests the fix in the previous commit.
2020-07-27 21:18:10 -04:00
Matthias Clasen
e10aedccc6 widget: Update accessible state
The sensitive property corresponds to the accessible
property disabled, so update it when sensitivity
changes.
2020-07-27 21:18:10 -04:00
Matthias Clasen
a63d03810f scrollbar: Update accessible state
We have the scrollbar role, and are therefore expected
to set value-min/max/now properties.
2020-07-27 21:18:10 -04:00
Matthias Clasen
d2c5e3f2b3 a11y: Add switch tests
Tests the fix in the previous commit.
2020-07-27 21:18:10 -04:00
Matthias Clasen
2ef4be21c8 switch: Initialize accessible state
The checked state defaults to undefined, so we need
to set it to the desired false state.
2020-07-27 21:18:10 -04:00
Matthias Clasen
2cbaa568b5 a11y: Add separator tests
Tests the fix in the previous commit.
2020-07-27 21:18:10 -04:00
Matthias Clasen
d8ac144923 separator: Initialize accessible state
The orientation property of separators should be
set ab initio.
2020-07-27 21:18:10 -04:00
Matthias Clasen
606daab475 a11y: Add progressbar tests
Test the changes in the previous commit.
2020-07-27 21:18:10 -04:00
Matthias Clasen
ec5829c401 progressbar: Fix up acessible state handling
We must initialize the properties in init, since they
are expected to be there ab initio, and we can't call
gtk_accessible_update_property from finalize - it causes
us to recreate an at context and badness follows.
2020-07-27 21:18:10 -04:00
Matthias Clasen
d3a8597a93 a11y: Add dialog and window tests
Tests the modal property changes in the previous commit.
2020-07-27 21:18:10 -04:00
Matthias Clasen
29cf11fb6e a11y: Set an accessible role for GtkWindow
Use the window accessible role for GtkWindow, and
set the modal accessible property.
2020-07-27 21:18:10 -04:00
Matthias Clasen
6ca245306b a11y: Add checkbutton tests
Tests the fix in the previous commit.
2020-07-27 21:18:09 -04:00
Matthias Clasen
4a9b4ad720 checkbutton: Initialize accessible state
The checked state of checkbuttons should be FALSE
initially, not UNDEFINED.
2020-07-27 21:18:09 -04:00
Matthias Clasen
36689d1884 Merge branch 'wip/chergert/fix-macos-time-conversion' into 'master'
macos: support ARM/PowerPC time conversion for DisplayLink times

See merge request GNOME/gtk!2301
2020-07-27 20:51:17 +00:00
Christian Hergert
0243736003 macos: support ARM/PowerPC time conversion for DisplayLink times
When converting DisplayLink frame presentation times, we need to take into
account the arch-specific types. This tracks changes in GNOME/GLib!1566 so
that precision is not lost.
2020-07-27 12:49:57 -07:00
Matthias Clasen
450899ef4c Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2300
2020-07-27 18:50:45 +00:00
Yuri Chornoivan
c6c9ca6009 Update Ukrainian translation 2020-07-27 17:45:19 +00:00
Matthias Clasen
99ec400c2a gtk-demo: Simplify colors demo
Make best use of our new constructors.
2020-07-27 13:30:00 -04:00
Matthias Clasen
da9b4d778b NEWS: Tweak the wording 2020-07-27 13:30:00 -04:00
Matthias Clasen
252e29c373 Merge branch 'a11y-docs' into 'master'
a11y: Document roles of widgets

See merge request GNOME/gtk!2299
2020-07-27 15:45:51 +00:00
Matthias Clasen
6266bcafee docs: Flesh out the role table in the a11y intro
Add cross-references for all the widgets currently
implementing non-default roles.
2020-07-27 11:10:58 -04:00
Matthias Clasen
d90f79de0e a11y: Document roles of widgets
Add a section to the long description for each
widget that is using a non-default accessible role.
2020-07-27 10:48:08 -04:00
Piotr Drąg
790db8db53 Update POTFILES.in and POTFILES.skip 2020-07-27 16:45:40 +02:00
Matthias Clasen
38b1fbb261 Merge branch 'ebassi/a11y-fixes' into 'master'
Ebassi/a11y fixes

Closes #2955

See merge request GNOME/gtk!2298
2020-07-27 14:27:07 +00:00
Emmanuele Bassi
cd7bb0200a a11y: Test unset relations
We use "NULL" in C to mean "undefined", when it comes to relations that
deal with references or reference lists.
2020-07-27 14:26:19 +01:00
Emmanuele Bassi
05d9e0c1c8 a11y: Allow unsetting the relations using NULL
Accessible values storing references and reference lists can be unset by
using NULL to mean "undefined"; since we cannot return the NULL value,
we need to intercept it when collecting a value, and replace it with an
undefined GtkAccessibleValue, which is also the value used as the
default for GtkAccessibleRelation values that store a reference or a
reference list.

Fixes: #2955
2020-07-27 14:26:19 +01:00
Emmanuele Bassi
b7be6ee00d docs: Document a11y attributes 2020-07-27 14:26:19 +01:00
Matthias Clasen
604d4a1cb2 NEWS: Updates 2020-07-27 08:40:43 -04:00
Emmanuele Bassi
b68d54cdbc Merge branch 'ebassi/ci-dags' into 'master'
ci: Use DAG attributes

See merge request GNOME/gtk!2297
2020-07-27 12:06:59 +00: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
Emmanuele Bassi
19bae10b45 ci: Use DAG attributes
Some jobs can run out of order, as they are entirely self-contained. If
we use the newly added DAG attributes, we can speed up the CI pipeline.
2020-07-27 12:44:36 +01:00
Emmanuele Bassi
4060febd7f a11y: Make GtkATContext.create() public
Implementations of the GtkAccessible interface should have a way to
instantiate the appropriate GtkATContext.
2020-07-27 11:48:11 +01:00
Emmanuele Bassi
9a4458ba33 docs: Add missing GTK_ACCESSIBLE_VALUE_UNDEFINED 2020-07-27 11:46:07 +01:00
Matthias Clasen
40b65b2608 a11y: Add some more tests
Test that setting multiple states or properties
at the same time works as expected.
2020-07-27 01:21:05 -04:00
Matthias Clasen
6c4c93b8d0 Add some more a11y tests
Add some tests that exercise the accessible machinery
without any connection to widgets.
2020-07-27 01:13:16 -04:00
Matthias Clasen
4c5df54e39 a11y: Be a bit safer against crashes
We are collecting values from varargs and use them
as indices into static arrays. We should at least
do some bounds checking to prevent silly crashes.
2020-07-27 00:21:01 -04:00
Matthias Clasen
2ce6ac00cf docs: Expand GtkAccessible documentation
Add some hints and examples.
2020-07-26 22:39:47 -04:00
Matthias Clasen
98f3112158 docs: Add documentation for accessible enumerations
This is largely taking text from the aria spec.
2020-07-26 22:39:47 -04:00
Matthias Clasen
9a27614b41 docs: Update GtkAccessibleRole docs
Sync up the docs with changed enum values, and document
all the roles that are used in GTK at the moment. All
others are left as "Unused".
2020-07-26 21:23:48 -04:00
Matthias Clasen
29abefbe61 docs: Fix up some issues in the a11y docs
Fix up syntax errors and links in the introductory
section about accessibility.
2020-07-26 21:23:48 -04:00
Matthias Clasen
81c8a2bb4b docs: Update a11y docs
Add some missing functions.
2020-07-26 21:23:48 -04: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
e57d6ec359 Merge branch 'list-constructors' into 'master'
List constructors

See merge request GNOME/gtk!2296
2020-07-26 23:56:21 +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
72bb7fc701 selectionfiltermodel: Make constructor allow-none
We don't pay attention to item-type anymore, so
drop the item-type property and the _for_item_type()
constructor, and allow passing NULL to the regular
constructor.

We don't make this constructor transfer-full, since
the selection filter model is not a wrapping model
like the others. It is more like fork than a wrap.
2020-07-26 18:04:40 -04:00
Matthias Clasen
cdc263f796 multiselection: Make constructor transfer full
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Also make the constructor return GtkMultiSelection *.

Update all callers.
2020-07-26 18:04:40 -04:00
Matthias Clasen
ccb9dcc86b singleselection: 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
68d6671413 noselection: 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
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
Matthias Clasen
b6d9f3facb slicelistmodel: 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
06c6d62629 listlistmodel: Drop item_type
We are using G_TYPE_OBJECT throughout, so there
is no need for GtkListListModel to do anything else.

Update all callers.
2020-07-26 18:02:51 -04:00
Matthias Clasen
32b8fe40bb maplistmodel: 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:02:51 -04:00
Matthias Clasen
1e8be87026 flattenlistmodel: Make the 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:02:44 -04:00
Emmanuele Bassi
cbc6244bc5 ci: Re-enable the accessibility test suite
Now that we have something that is both reliable and local.
2020-07-26 21:27:03 +01:00
Emmanuele Bassi
ac0fcc55a6 a11y: Add a simple test case for GtkButton's accessible state 2020-07-26 21:27:03 +01:00
Emmanuele Bassi
3d642460e7 a11y: Simplify the test API
We don't need as many functions to print out the property, relation, and
state of an accessible. Additionally, we should allow comparing the
accessible attributes with an expected value, and print out the real
accessible value if they do not match.
2020-07-26 21:27:03 +01:00
Emmanuele Bassi
82664003c0 a11y: Allow setting the role post-construction
Some widgets have different roles after they are constructed, so we need
to allow changing the role defined by the class. We should still avoid
setting a role after the GtkATContext has been created.
2020-07-26 21:27:03 +01:00
Emmanuele Bassi
b9a1cb74a1 a11y: Add API to retrieve accessible values
We are going to use this for implementing ATContext subclasses, but also
in the testing API.
2020-07-26 20:49:08 +01:00
Emmanuele Bassi
dc1c1e8af9 a11y: Add more test API 2020-07-26 20:49:08 +01:00
Emmanuele Bassi
83eac3f33a a11y: Restart the accessibility test suite 2020-07-26 20:49:08 +01:00
Emmanuele Bassi
296f0844df Fix build with debugging notes disabled 2020-07-26 20:31:15 +01:00
Matthias Clasen
e17b5f337d a11y: Update GtkCheckButton
This is a bit unfortunate, since the aria modelling
doesn't quite agree with ours, so we have to listen
for the togglebutton property change, and we inherit
the pressed state from the togglebutton accessible.
2020-07-26 20:31:15 +01:00
Matthias Clasen
c36ad5f474 a11y: Update GtkSpinButton
Set the appropriate accessible role, and update
the value properties.
2020-07-26 20:31:15 +01:00
Matthias Clasen
b7777add36 a11y: Update GtkProgressBar
Update state and properties as appropriate.
2020-07-26 20:31:15 +01:00
Matthias Clasen
609383f93c testatcontext: Print role nicks
This makes for easier reading.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
a9e0cf77a0 a11y: Update labelled-by when setting mnemonic labels
The ARIA labelled-by attribute behaves the same way as the mnemonic
labels in GTK.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
86b58529fd a11y: Change the collection type for reflist attributes 2020-07-26 20:31:15 +01:00
Emmanuele Bassi
2fee3793b4 a11y: Allow storing list of references in GtkAccessibleValue
It's one of the fundamental accessible value types in ARIA.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
03b773f45a a11y: Change default accessible role
Only GtkWidget should use GTK_ACCESSIBLE_ROLE_WIDGET as its default
accessible role; the default for GtkAccessible and GtkATContext should
be GTK_ACCESSIBLE_ROLE_NONE, meaning "an element whose implicit native
role semantics will not be mapped to the accessibility API", according
to the WAI-ARIA specification.
2020-07-26 20:31:15 +01:00
Matthias Clasen
8adcf95300 inspector: Support the a11y debug flag
Add support for the GTK_DEBUG_A11Y debug flag in
the logs tab.
2020-07-26 20:31:15 +01:00
Matthias Clasen
0b6df9efe7 testatcontext: Use the new debug flag
Only dump a11y state if GTK_DEBUG=accessibility is set.
2020-07-26 20:31:15 +01:00
Matthias Clasen
01f31665b8 Add GTK_DEBUG=accessibility
Add a debug flag for accessibility-related debug spew.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
0d87f8cd62 a11y: Add testing API
We want to test the accessibility API, as well as the implementation
inside each widget. For that, we should expose an API that lets us
verify that a GtkAccessible has a given role, as well as a given
property.

The API follows the pattern of other GTest API:

 - a macro to assert that a condition is respected
 - a function that prints out the error message in case of failure
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
52c1fb8dfe a11y: Implement role and state change in GtkSwitch
Set the "switch" role, and update the "checked" state when the :active
property is toggled.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
732578eb53 a11y: Consolidate the attributes container
While we have split the various attributes for convenience, there's no
reason why we should have specialised data types for the attributes
container object.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
1124f2507d a11y: Add relations API
Since we split relation attributes from the generic properties, we need
to add API for setting and retrieving their values.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
d37511f76b a11y: Simplify GtkAccessibleValue
Reduce the amount of subclassing, by handling collection of fundamental
types directly from the generic code paths. We now handle boolean,
tristate, integer, number, string, and relation values in the generic
code path; if an attribute supports the "undefined" value, we return the
undefined value singleton.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
55d29d08a1 a11y: Resync with the ARIA spec
Drop roles and properties that were deprecated in WAI-ARIA 1.1, and add
new roles and properties defined in WAI-ARIA 1.2 and later.

We also split the relationship properties into their own enumeration, so
we can keep the GtkAccessibleProperty type more compact.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
ae446e8f4a Remove GTK_ACCESSIBLE_STATE_NONE
It's pointless, we can use an explicit value of `-1` everywhere.
Additionally, it complicates all code that uses the state enumeration as
an array index, since now we need to guard against a negative offset.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
c56e9b2031 a11y: Add binding-friendly accessible property setter
Matching the one for the accessible state.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
93978544c0 a11y: Collect reference value
Some properties that take a reference to an accessible haven't been
updated to collect the correct type.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
1b612cd5db a11y: Update the accessible label for GtkButton 2020-07-26 20:31:15 +01:00
Emmanuele Bassi
3a1d69ca29 a11y: Update GtkSeparator
Add an accessible role, and update the orientation state.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
9af74629f6 a11y: Set the role for GtkScale 2020-07-26 20:31:15 +01:00
Emmanuele Bassi
59d85d42cf a11y: Update the accessible state for GtkRange 2020-07-26 20:31:15 +01:00
Emmanuele Bassi
2c75ba5509 a11y: Update the "pressed" state on toggle buttons 2020-07-26 20:31:15 +01:00
Emmanuele Bassi
58628f9a9e a11y: Add roles to various widgets 2020-07-26 20:31:15 +01:00
Emmanuele Bassi
da1ce01a6f Add accessible properties to GtkAccessible
We propagate the accessible state and properties to each ATContext in
the same virtual function, since they are functionally similar.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
654956223d Add GtkAccessiblePropertySet
Like GtkAccessibleStateSet, the PropertySet is a set for accessible
properties.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
382fa01301 Plumb all the GtkAccessibleProperty values into GtkAccessibleValue
Similarly to how we deal with GtkAccessibleState.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
572861be27 Allow setting the accessible role at construction
Some widgets have different accessible roles depending on some
parameter, so we cannot set the role at class init time. For those
widgets, we add an "accessible-role" property to GtkAccessible, and we
allow setting it (only) at construction time.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
5a173df3da Start documenting the Accessibility API
Add the introductory text from #2833, and the various types to the API
reference.
2020-07-26 20:31:14 +01:00
Emmanuele Bassi
3ea069a8d3 Update the accessible state on widget visibility changes
The GTK_ACCESSIBLE_STATE_HIDDEN has the opposite meaning of the
GtkWidget:visible property.
2020-07-26 20:31:14 +01:00
Emmanuele Bassi
25f6da5e89 Have GtkWidget implement GtkAccessible
Each widget type has an accessible role associated to its class, as
roles cannot change during the life time of a widget instance.

Each widget is also responsible for creating an ATContext, to proxy
state changes to the underlying accessibility infrastructure.
2020-07-26 20:31:14 +01:00
Emmanuele Bassi
566f75af82 Plug GtkATContext into GtkAccessible
An Accessible implementation must create an ATContext object. UI
elements are supposed to interact with the GtkAccessible API, but we
expose GtkATContext to allow patterns like delegation.
2020-07-26 20:31:14 +01:00
Emmanuele Bassi
a382dfd3bd Add GtkATContext
The ATContext type is meant to be used as the base class for
implementations of the assistive technology API—the actual mechanism
needed to communicate to components like the screen reader, or any other
AT.

Every time the widget state changes, the ATContext is meant to broadcast
the state change; and every time the AT queries the state of a UI
element, the ATContext is meant to provide that information.

We also have a "test" ATContext implementation, which is meant to be
used to write tests to verify that changes are propagated without
requiring a whole desktop session.
2020-07-26 20:31:14 +01:00
Emmanuele Bassi
823ee58332 Add GtkAccessibleStateSet
Since states can be set or unset, we need a container type that has all
the possible states, and a bitmask that tells us which ones are set.
2020-07-26 20:31:14 +01:00
Emmanuele Bassi
55120a25db Add GtkAccessibleValue
All accessible properties and states may have one of the following
types:

 - true/false
 - true/false/undefined
 - true/false/mixed/undefined
 - reference (to another UI element)
 - reference list
 - integer
 - number (real numerical value)
 - string
 - token (one of a limited set of allowed values)
 - token list

See: https://www.w3.org/WAI/PF/aria/states_and_properties#propcharacteristic_value

The GtkAccessibleValue is a simple reference counted type that can be
"subclassed" to implement each value type.

This initial commit adds GtkAccessibleValue and the basic subclasses for
plain boolean, tristate (true/false/undefined), and token types,
including statically allocated values that can be shared instead of
allocated.
2020-07-26 20:31:14 +01:00
Emmanuele Bassi
14faec3ce2 Introduce GtkAccessible
GtkAccessible is an interface for accessible UI elements.

Currently, it doesn't do much except exist as a type; in the future, it
will be the entry point for all accessible state in GTK.
2020-07-26 20:31:14 +01:00
Emmanuele Bassi
82fe6fbc62 a11y: Add the supported accessibility roles
The list of roles is taken from the WAI-ARIA 1.2 specification:

  https://w3c.github.io/aria/

Some of these roles do not make entirely sense from a GTK application
perspective, but we can remove them before finalizing the API.
2020-07-26 20:31:14 +01: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
ea0fc7619d Merge branch 'wip/otte/boolfilter' into 'master'
Add GtkBoolFilter

See merge request GNOME/gtk!2288
2020-07-26 19:24:25 +00:00
Jordi Mas
f2ed1656b4 Update Catalan translation 2020-07-26 21:13:16 +02:00
Benjamin Otte
2f27d29247 Add GtkBoolFilter
Takes a boolean GtkExpression (like a boolean object property) to run a
filter with.
2020-07-26 20:43:08 +02:00
Matthias Clasen
ef6babf896 Merge branch 'matthiasc/for-master' into 'master'
overlaylayout: Document minimally

See merge request GNOME/gtk!2285
2020-07-26 12:00:49 +00:00
Matthias Clasen
7f9570b95b overlaylayout: Document minimally
This layout manager is not reusable, but we
still need to make its layout properties show
up in the docs.
2020-07-25 19:02:33 -04:00
Matthias Clasen
d8d8a71a7a Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2284
2020-07-25 17:30:11 +00:00
Matthias Clasen
2ff3e3d1e4 gtk: Improve struct packing in places
Plug some holes in our structs by rearranging
a few fields. This is was done looking at
pahole output.
2020-07-25 11:57:37 -04:00
Matthias Clasen
73f4f518b8 gdk: Improve struct packing in places
Plug some holes in our structs by rearranging
a few fields. This is was done looking at
pahole output.
2020-07-25 11:57:37 -04:00
Matthias Clasen
6e9dbba130 colorswatch: Remove unused radius fields
The radius fields are never used.
2020-07-25 11:57:37 -04:00
Matthias Clasen
706aa93ab5 hsla: Just store floats
We are using floats for rgb, and we don't need more precision
for hsl colors either. We use hsl for computing color expressions
like shade(), lighter() and darker(), which are not precisely
specified anyway.

This commit updates the one test where the output changes a
tiny bit due to this.
2020-07-25 11:56:05 -04:00
Matthias Clasen
54deed9a5a headerbar: Drop the Private struct 2020-07-25 07:41:05 -04:00
Matthias Clasen
0e70ddcab3 colorplane: Drop the Private struct and padding 2020-07-24 22:56:24 -04:00
Matthias Clasen
f2bdb1fb87 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2283
2020-07-25 00:05:28 +00:00
Matthias Clasen
ec9fd76c87 Merge branch 'wip/otte/types' into 'master'
Get rid of unneeded glib types

See merge request GNOME/gtk!2282
2020-07-24 23:54:01 +00:00
Matthias Clasen
bacaa5eb9a Add another sortlistmodel test
This tests the crash fix in f7b73b2e01.
2020-07-24 19:28:54 -04:00
Matthias Clasen
9a297516ba testsuite: Add an incremental sort test
Add a test that makes changes to a model while it
is incrementally sorted.
2020-07-24 19:23:18 -04:00
Matthias Clasen
e9bff53015 timsort: Avoid a crash
We need to clear the pointer after freeing the data,
since the sortlistmodel keeps its timsort structure
around and reuses it.
2020-07-24 19:23:18 -04: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
Matthias Clasen
2a43ce1705 testsuite: Use better names for sortlistmodel tests
Name the tests for what they do.
2020-07-24 15:37:49 -04:00
Matthias Clasen
3324a6e6b3 testsuite: Reenable tests for incremental sort
This was unintentionally disabled.
2020-07-24 15:22:14 -04:00
Matthias Clasen
46423e614d Merge branch 'remove-align-widget' into 'master'
menubutton: Remove align-widget property

See merge request GNOME/gtk!2280
2020-07-24 18:17:30 +00:00
Matthias Clasen
f7b73b2e01 sortlistmodel: Fix a crash 2020-07-24 14:15:14 -04:00
Matthias Clasen
c85e424279 dropdown: Fix popup sizing
Setting a width request is not quite enough, since
gtk_widget_set_size_request() only queues a resize
when the widget is visible. Explicitly force one
here. Without this, the popup sometimes shows up
too small.
2020-07-24 14:15:04 -04:00
Florian Müllner
b146c48e23 menubutton: Remove align-widget property
The property has been unused since commit 8701e34f74. That was four
years ago, so it's safe to say that nobody has been missing it terribly.
2020-07-24 13:55:06 +02:00
Timm Bäder
3176d69009 Merge branch 'fix-gdk-array-msvc' into 'master'
gdk/gdkarrayimpl.c: Fix build on Visual Studio

See merge request GNOME/gtk!2279
2020-07-24 09:28:21 +00:00
Chun-wei Fan
89f7d841ab gdk/gdkarrayimpl.c: Fix build on Visual Studio
It seems like initializing something to an empty array using `{}` is a GCCism,
so just stuff a 0 within the braces to accomplish the same thing.
2020-07-24 16:25:24 +08:00
Matthias Clasen
7e2fceebca Merge branch 'matthiasc/for-master' into 'master'
filechooser: Remove a leftover signal emission

Closes #2942

See merge request GNOME/gtk!2276
2020-07-24 02:58:51 +00:00
Matthias Clasen
1e00c887ec docs: Work around escaping bugs
This is truly a russian doll of documentation formats:
a string containing <> inside an xml fragment in an |[ ]|
gtk-doc example in markdown in a doc comment.

Sadly, something gets escaping wrong, so the <> end up
literally in the docbook and mess up the last step of
our document formatting, even after turning them into
entities.

Work around this with an extra level of entities that
really shouldn't be necessary.
2020-07-23 18:24:18 -04:00
Matthias Clasen
561d3c68a0 docs: Pass --standalone to pandoc
This flag causes pandoc to emit a proper doctype
declaration and, crucially, namespace declarations
for the xlink namespace that it insists on using
for href attributes. Without this, putting external
links in md documents doesn't survive the journey
through xml.
2020-07-23 18:24:18 -04:00
Matthias Clasen
03601cb794 docs: Improve shortcut trigger docs
Point out the need to escape <> in xml.
2020-07-23 18:24:18 -04:00
Matthias Clasen
3108b8b4d3 docs: Explain the shortcutcontroller example a bit
Add a reference to the the syntax for shortcut actions
in builder files.
2020-07-23 18:24:18 -04:00
Matthias Clasen
d1afe32762 filechooser: Remove a leftover signal emission
Commit 0145809a94 replace the response-requested
signal with an action, but didn't actually remove the emission
of that no-longer-existing signal.

Fixes: #2942
2020-07-23 12:54:07 -04:00
Benjamin Otte
603dd72b09 Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

See merge request GNOME/gtk!2277
2020-07-23 14:34:33 +00:00
Benjamin Otte
e81ba8924a searchenginemodel: Remove unused code 2020-07-23 15:31:08 +02:00
Benjamin Otte
8832ab45d9 searchengine: Remove unused set_recursive() call 2020-07-23 15:31:08 +02:00
Florentina Mușat
87d6e17bc7 Update Romanian translation 2020-07-23 10:33:16 +00:00
Florentina Mușat
a5033cd79b Update Romanian translation 2020-07-23 10:32:08 +00:00
Matthias Clasen
44cbf3d605 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2275
2020-07-23 00:19:15 +00:00
Matthias Clasen
fb6288791e NEWS: Updates 2020-07-22 19:51:27 -04:00
Matthias Clasen
2160f52cbf migration guide: Add some tables
Add a table mapping event signals to their event controller
replacements, and a table mapping former GtkContainer
subclasses to their gtk_container_add replacement.
2020-07-22 19:38:58 -04:00
Benjamin Otte
8825e621c9 Merge branch 'wip/otte/for-master' into 'master'
timsort: Actually 0-terminate the array in get_runs()

See merge request GNOME/gtk!2274
2020-07-22 18:08:24 +00:00
Benjamin Otte
e22abd73f2 timsort: Actually 0-terminate the array in get_runs()
This could cause SEGVs when changing the sort during an ongoing sort
operation.
2020-07-22 18:59:22 +02:00
Yuri Chornoivan
f77d4d7fc0 Update Ukrainian translation 2020-07-22 13:27:26 +00:00
Yuri Chornoivan
8243133ca7 Update Ukrainian translation 2020-07-22 13:22:09 +00:00
Matthias Clasen
63a4345d2c Merge branch 'wip/otte/sortlistmodel2' into 'master'
Massively refactor and improve sortlistmodel

See merge request GNOME/gtk!2273
2020-07-22 13:15:45 +00:00
Piotr Drąg
56685a483d Update POTFILES.in 2020-07-22 15:01:05 +02:00
Benjamin Otte
b23f793753 gtk-demo: Add a progress bar when the colors demo resorts 2020-07-22 14:30:49 +02:00
Benjamin Otte
2b19e2fc1f sortlistmodel: Add progress estimation 2020-07-22 14:30:49 +02:00
Benjamin Otte
703f8b8136 timsort: Add progress estimation 2020-07-22 14:30:49 +02:00
Benjamin Otte
5b18968867 sortlistmodel: Make key generation part of the step function
SSave the missing keys as a bitset and iterate over that bitset in the
step function.

Solves the problem with a large UI block at the beginning of a sort
operation when all the keys were generated, in particular when key
generation was slow.

Benchmarks for maximum time taken by a single main loop callback:

     initial sort with complex GFileInfo keys
                       old      new
      32,000 items   137ms      3ms
     128,000 items   520ms     31ms

     initial sort with string keys
                       old      new
      32,000 items   187ms      1ms
     128,000 items   804ms      3ms
2020-07-22 14:30:49 +02:00
Benjamin Otte
e8c4e1205a gtk-demo: Make colors demo do incremental sorting 2020-07-22 14:30:49 +02:00
Benjamin Otte
bf5c540357 sortlistmodel: Properly compute runs
When updating a (partially) sorted model, take the known runs for the
existing sort and apply them to the new sort. That way, we don't have to
check the whole model again.

Benchmarks:

      appending half the items to a model of strings
                        old      new
      512,000 items   437ms    389ms
    1,024,000 items  1006ms    914ms

      appending 10% of the items to a model of strings
                        old      new
      512,000 items   206ms    132ms
    1,024,000 items   438ms    301ms

      appending 1 item to a model of strings
                        old      new
       64,000 items   1.8ms   0.00ms
      512,000 items     ---   0.01ms
2020-07-22 14:30:49 +02:00
Benjamin Otte
c03383d3e5 sortlistmodel: Make sort stable again
Previously, the sort was not stable when items were added/removed while
sorting or the sort algorithm was changed.

Now the sort looks at the item position (via the key's location in the
keys array) to make sure each comparison stays stable with respect to
this position.
2020-07-22 14:30:49 +02:00
Benjamin Otte
eaaa287078 multisorter: Implement GtkSortKeys 2020-07-22 14:30:49 +02:00
Benjamin Otte
554defaf1a treelistrowsorter: Implement GtkSortKeys 2020-07-22 14:30:49 +02:00
Benjamin Otte
659fe52b7b numericsorter: Implement GtkSortKeys 2020-07-22 14:30:49 +02:00
Benjamin Otte
0970077af9 stringsorter: Implement GtkSortKeys 2020-07-22 14:30:49 +02:00
Benjamin Otte
814c88fbc1 sortkeys: Add an equal sort keys
Compares every element as equal.
This is useful when sorters are in an invalid configuration.
2020-07-22 14:30:49 +02:00
Benjamin Otte
3b24c8a0a4 sortlistmodel: Use GtkSortKeys
This massively speeds up sorting with expensive sort functions that it's
the most worthwhile optimization of this whole branch.
It's slower for simple sort functions though.

It's also quite a lot slower when the model doesn't support sort keys
(like GtkCustomSorter), but all the other sorters do support keys.

Of course, this depends on the number of items in the model - the number
of comparisons scales O(N * log N) while the overhead for key handling
scales O(N).
So as the log N part grows, generating keys gets more and more
beneficial.

Benchmarks:

       initial sort of a GFileInfo model with display-name keys
                       items     keys
         8,000 items   715ms     50ms
        64,000 items     ---    554ms

       initial sort of a GFileInfo model with complex keys
                       items     keys
        64,000 items   340ms    295ms
       128,000 items   641ms    605ms

       removing half a GFileInfo model with display-name keys
       (no comparisons, just key freeing overhead of a complex sorter)
                       items     keys
       512,000 items    14ms     21ms
     2,048,000 items    40ms     62ms

       removing half a GFileInfo model with complex keys
       (no comparisons, just key freeing overhead of a complex sorter)
                       items     keys
       512,000 items    90ms    237ms
     2,048,000 items   247ms    601ms
2020-07-22 14:30:49 +02:00
Benjamin Otte
e34c7e6796 sorter: Introduce GtkSortKeys
GtkSortKeys is an immutable struct that can be used to manage "sort
keys" for items.

Sort keys are memory that is created specifically for sorting. Because
sorting involves lots of comparisons, it's a good idea to prepare the
data relevant for sorting in advance and sort on that data.

In measurements with a PropertyExpression on a string sorter, it's about
??? faster
2020-07-22 14:30:49 +02:00
Benjamin Otte
8c608e9c1c sortlistmodel: Split the SortItem into 2 arrays
Instead of one item keeping the item + its position and sorting that
list, keep the items in 1 array and put the positions into a 2nd array.

This is generally slower while sorting, but allows multiple improvements:

1. We can replace items with keys
   This allows avoiding multiple slow lookups when using complex
   comparisons

2. We can keep multiple position arrays
   This allows doing a sorting in the background without actually
   emitting items-changed() until the array is completely sorted.

3. The main list tracks the items in the original model
   So only a single memmove() is necessary there, while the old version
   had to upgrade the position in every item.
Benchmarks:

        sorting a model of simple strings
                          old      new
        256,000 items   256ms    268ms
        512,000 items   569ms    638ms

        sorting a model of file trees, directories first, by size
                          old      new
         64,000 items   350ms    364ms
        128,000 items   667ms    691ms

        removing half the model
                          old      new
        512,000 items    24ms     15ms
      1,024,000 items    49ms     25ms
2020-07-22 14:30:49 +02:00
Benjamin Otte
283c3b70dd sortlistmodel: Add an incremental property
Also refactor a large part of the sortmodel to make this convenient.

A large amount of time has been spent on getting items-changed regions
minimized.
2020-07-22 14:30:49 +02:00
Benjamin Otte
93599c2c48 testsuite: Add exhaustive sortlistmodel test
This is basically a copy/paste from the filterlistmodel test, but
adapted for sorting.
2020-07-22 14:04:40 +02:00
Benjamin Otte
080e625090 sortlistmodel: Make the sort callback useful
1. Run step() for a while to avoid very short steps
   This way, we batch items-changed() emissions.

2. Track the change region accurately
   This way, we can avoid invalidating the whole list if our step just
   touched a small part of a huge list.
   As this is a merge sort, this is a common occurence when we're buys
   merging chunks: The rest of the model outside those chunks isn't
   changed.

Note that the tracking is accurate: It determines the minimum change
region in the model.

This will be important, because the testsuite is going to test this.
2020-07-22 14:04:40 +02:00
Benjamin Otte
26696a741e timsort: Add change tracking to gtk_tim_sort_step() 2020-07-22 14:04:40 +02:00
Benjamin Otte
a209e54b8f timsort: Add gtk_tim_sort_set_max_merge_size()
Makes the SOrtListModel responsive when incrementally sorting.

By making it configurable we can avoid losting performance in the
non-incremental case.
2020-07-22 14:04:40 +02:00
Benjamin Otte
8921dadaa1 timsort: Make sure merges don't take too long
Limit the size of the merged areas and thereby chunk larger merges into
smaller ones.
2020-07-22 14:04:40 +02:00
Benjamin Otte
47232acbd8 sortlistmodel: Make sorting incremental
This is just an experiment so far to see how long it takes to sort.
2020-07-22 14:04:40 +02:00
Benjamin Otte
cbad8ec2e4 timsort: Add gtk_tim_sort_set_runs()
... and use it in the SortListModel

Setting runs allows declaring already sorted regions so the sort does
not attempt to sort them again.

This massively speeds up partial inserts where we can reuse the sorted
model as a run and only resort the newly inserted parts.

Benchmarks:

    appending half the model
                    qsort  timsort
    128,000 items    94ms     69ms
    256,000 items   202ms    143ms
    512,000 items   488ms    328ms

    appending 1 item
                    qsort  timsort
      8,000 items   1.5ms    0.0ms
     16,000 items   3.1ms    0.0ms
              ...
    512,000 items     ---    1.8ms
2020-07-22 14:04:40 +02:00
Benjamin Otte
800170b47d sortlistmodel: Use timsort
Simply replace the old qsort() call with a timsort() call.

This is ultimately relevant because timsort is a LOT faster in merging
to already sorted lists (think items-chaged adding some items) or
reversing an existing list (think columnview sort order changes).

Benchmarks:

    initially sorting the model
                    qsort  timsort
    128,000 items   124ms    111ms
    256,000 items   264ms    250ms
2020-07-22 14:04:40 +02:00
Benjamin Otte
97c5cb3514 Add a timsort() implementation 2020-07-22 14:04:40 +02:00
Benjamin Otte
081afc0477 sortlistmodel: Track item positions
The model now tracks the original positions on top of just the items so that
it can remove items in an items-changed emission.

It now takes twice as much memory but removes items much faster.

Benchmarks:

Removing 50% of a model:
                   before    after
   250,000 items    135ms     10ms
   500,000 items    300ms     25ms

Removing 1 item:
     4,000 items    2.2ms      0ms
     8,000 items    4.6ms      0ms
   500,000 items      ---   0.01ms
2020-07-22 14:04:40 +02:00
Benjamin Otte
e807fc3be0 sortlistmodel: Replace with an array-based model
This is the dumbest possible sortmodel using an array:
Just grab all the items, put them in the array, qsort() the array.

Some benchmarks (setting a new model):

  125,000 items - old: 549ms
                  new: 115ms
  250,000 items - new: 250ms

This performance can not be kept for simple additions and removals
though.
2020-07-22 14:04:40 +02:00
Boyuan Yang
a1bd3389ed Update Chinese (China) translation 2020-07-22 02:58:46 +00:00
Boyuan Yang
03a3b5a0b1 Update Chinese (China) translation 2020-07-22 02:39:21 +00:00
Boyuan Yang
1ee2d9a5fa Update Chinese (China) translation 2020-07-22 02:20:08 +00:00
Matthias Clasen
2e07fcd680 Merge branch 'wip/chergert/quartz4u' into 'master'
Merge GDK macOS branch

See merge request GNOME/gtk!2272
2020-07-21 22:22:41 +00:00
Matthias Clasen
d3365d5a60 Merge branch 'matthiasc/for-master' into 'master'
gdk: Update gdkkeysyms.h

See merge request GNOME/gtk!2271
2020-07-21 21:53:16 +00:00
Christian Hergert
9dbf99d91a macos: prototype new GDK backend for macOS
This is fairly substantial rewrite of the GDK backend for quartz and
renamed to macOS to allow for a greenfield implementation.

Many things have come across from the quartz implementation fairly
intact such as the eventloop integration design and discovery of
event windows from the NSEvent.

However much has been changed to fit in with the new GDK design and
how removal of child GdkWindow have been completely eliminated.
Furthermore, the new GdkPopup allows for regular NSWindow to be used
to provide popovers unlike the previous implementation.

The object design more closely follows the ideal for a GDK backend.

Views have been broken out into subclasses so that we can support
multiple GSK renderer paths such as GL and Cairo (and Metal in the
future). However mixed mode GL and Cairo will not be supported. Currently
only the Cairo renderer has been implemented.

A new frame clock implementation using CVDisplayLink provides more
accurate information about when to draw drawing the next frame. Some
testing will need to be done here to understand the power implications
of this.

This implementation has also gained edge snapping for CSD windows. Some
work was also done to ensure that CSD windows have opaque regions
registered with the display server.

     ** This is still very much a work-in-progress **

Some outstanding work that needs to be done:

 - Finish a GL context for macOS and alternate NSView for GL rendering
   (possibly using speciailized CALayer for OpenGL).
 - Input rework to ensure that we don't loose remapping of keys that was
   dropped from GDK during GTK 4 development.
 - Make sure input methods continue to work.
 - Drag-n-Drop is still very much a work in progress
 - High resolution input scrolling needs various work in GDK to land
   first before we can plumb that to NSEvent.
 - gtk/ has a number of things based on GDK_WINDOWING_QUARTZ that need
   to be updated to use the macOS backend.

But this is good enough to start playing with and breaking things which
is what I'd like to see.
2020-07-21 14:45:12 -07:00
Christian Hergert
0154a7f528 gdk: disable file transfer portal on macOS 2020-07-21 14:45:12 -07:00
Christian Hergert
add47bebc6 build: add ATK fallback subproject wrapper
Very similar to the other fallbacks we use.
2020-07-21 14:45:12 -07:00
Christian Hergert
514b62223d build: squash various warnings with Clang
Otherwise we have really chatty builds that make it difficult to catch
new issues when compiling.
2020-07-21 14:45:12 -07:00
Christian Hergert
7884ab6161 build: fix linking support on macOS with Clang
This was preventing any sort of building on macOS, even though the quartz
backend is currently non-functional. Fixing this is a pre-requisite to
getting a new macOS backend compiling.
2020-07-21 14:45:12 -07:00
Matthias Clasen
bc542c5304 gdk: Update gdkkeysyms.h
Run the gdkkeysyms-update.pl script to pick up several
new keysyms:
GDK_dead_lowline
GDK_dead_aboveverticalline
GDK_dead_belowverticalline
GDK_dead_longsolidusoverlay
GDK_Keyboard
GDK_WWAN
GDK_RFKill
GDK_AudioPreset
2020-07-21 16:55:28 -04:00
Matthias Clasen
d66ac4981e Merge branch 'matthiasc/for-master' into 'master'
inspector: Make picking objects show them

Closes #1876

See merge request GNOME/gtk!2269
2020-07-20 22:06:42 +00:00
Matthias Clasen
9b647a47d1 inspector: Make picking objects show them
Changing the selection in the object tree is
not a useful action if we are already in the
object details. Most likely, a user who picks
an object wants to inspect its details, so
just always show them.

Fixes: #1876
2020-07-20 17:30:16 -04:00
Benjamin Otte
b67ffe9650 sortlistmodel: Test that the model is stable
Stability is measured relative to the child model, not relative to the
previous sorter.
2020-07-20 22:28:01 +02:00
Benjamin Otte
2c519b006d testsuite: Fix a leak 2020-07-20 22:28:01 +02:00
Matthias Clasen
852429d163 Merge branch 'barthalion/asan-runner' into 'master'
ci: Switch ASAN tests to runners tagged so

See merge request GNOME/gtk!2267
2020-07-20 16:17:49 +00:00
Matthias Clasen
ee9c6bbf75 Merge branch 'action-muxer-speedup' into 'master'
Action muxer speedup

See merge request GNOME/gtk!1754
2020-07-20 16:17:17 +00:00
Bartłomiej Piotrowski
d9ece94377 ci: Switch ASAN tests to runners tagged so 2020-07-20 16:41:46 +02:00
Matthias Clasen
486fbce42b actionmuxer: Update docs and clean up headers
Update the doc comment at the top to describe the
current  functionality of GtkActionMuxer.
2020-07-20 08:24:54 -04:00
Matthias Clasen
ed92026632 actionmuxer: Use an array for accels
We have a lot of accels across all the muxers, but the vast
majority has just one or two, so an array is going to be
smaller and faster for this.
2020-07-20 08:24:54 -04:00
Matthias Clasen
05e614feb7 actionmuxer: Create observed_actions and groups on demand
The vast majority of action muxers don't have observers or
groups, so we can avoid the overhead of carrying all these
empty hash tables.
2020-07-20 08:24:54 -04:00
Matthias Clasen
14059afdf1 inspector: Make the actions tab work again
Bring back the actions tab; we don't receive
changes anymore, since GtkActionMuxer lost
the GActionGroup signals for this, and the
action observer machinery has no way to listen
for all changes.
2020-07-20 08:24:54 -04:00
Matthias Clasen
9b294eb94e Add gtk_action_muxer_list_actions
This is needed to reinstate the actions support
in the inspector.
2020-07-20 08:24:53 -04:00
Matthias Clasen
96d42cf1cc actionmuxer: Stop implementing GActionGroup
Instead of implementing the GActionGroup interface
and using its signals for propagating changes up
and down the muxer hierarchy, use the GtkActionObserver
mechanism. This cuts down on the signal emission
overhead.
2020-07-20 08:24:53 -04:00
Matthias Clasen
4786a16696 actionmuxer: Port internal users
Port all internal users of the action muxer
from the GActionGroup interface to the new
action muxer apis.
2020-07-20 08:24:52 -04:00
Matthias Clasen
14bb12125f actionmuxer: Add some more api
We want to drop the GActionGroup interface from
GtkActionMuxer, so add the necessary api directly
to GtkActionMuxer itself.
2020-07-20 08:24:14 -04:00
Matthias Clasen
07e8dafcea inspector: Remove action support temporarily
This is using the action muxer as a GActionGroup,
and we want to remove that interface from GtkActionMuxer.

The support will come back later.
2020-07-20 08:24:14 -04:00
Matthias Clasen
ab67a81f11 Speed up action muxer setup more
Don't emit signals for group insertion/removal
if nobody is listening.
2020-07-20 08:24:14 -04:00
Matthias Clasen
aa76f7e210 Speed up action muxer setup
We don't need to duplicate all these action names and
emit all these signals if nobody is listening.
2020-07-20 08:24:14 -04:00
Matthias Clasen
0c15463e41 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2266
2020-07-20 12:23:12 +00:00
Matthias Clasen
5df1356295 gsk: Remove an unused debug flag
GSK_DEBUG_DIFF was not used anywhere, so remove it.
2020-07-20 07:03:08 -04:00
Matthias Clasen
95fc81c565 inspector: Add a few more debug flags
Add check buttons for GTK_DEBUG=constraints and
GTK_DEBUG=layout in the logs page.
2020-07-20 07:03:08 -04:00
Matthias Clasen
378e594f75 Tweak the GTK_DEBUG=help output
I got the layout flag wrong when I added the
improved help output. It is about layout managers,
not about showing layout borders.
2020-07-20 07:03:08 -04:00
Matthias Clasen
86c7fceb09 Merge branch 'list-model-docs' into 'master'
List model docs

See merge request GNOME/gtk!2182
2020-07-19 23:50:09 +00:00
Matthias Clasen
b5e20a3e37 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2265
2020-07-19 19:14:04 +00:00
Matthias Clasen
75a30b1f98 windowhandle: Don't use an action muxer needlessly
The api that is meant to be used here is
gtk_widget_activate_action.
2020-07-19 13:50:23 -04:00
Matthias Clasen
c64a021af4 NEWS: Updates 2020-07-18 18:28:51 -04:00
Matthias Clasen
9b64635925 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2264
2020-07-18 17:31:31 +00:00
Matthias Clasen
7b76be5360 button: Add explicit key bindings for activation
We should not rely on GtkWindow to have global
"activate-default" key bindings that happen to
fall back to activating the focus widget. This is
unreliable, since the bubbling up from the button
to the toplevel may run across other widgets that
may want to use Enter for their own purpose, and
then the button loses out. By adding our own
key bindings, the button gets to handle it before
its ancestors.

This fixes check buttons in the inspector property
list not reacting to Enter despite having focus.
2020-07-18 12:53:10 -04:00
Matthias Clasen
2e2336ffce text: Claim clicks when grabbing focus
If we don't, an ancestor (such a GtkListItemWidget)
may interpret the click as "I should grab focus!",
and still our focus away. This was causing hard-to-focus
entries in the property list in the inspector.
2020-07-18 12:47:47 -04:00
Matthias Clasen
76d80ef516 inspector: Add focus handling to the property editor
We want to focus the actual control here.
2020-07-18 11:55:19 -04:00
Matthias Clasen
287d80bd36 editablelabel: Stop editing on focus-out
This is the expected behavior for the main use case,
treeview-like 'edit one cell at a time'.
2020-07-18 10:45:27 -04:00
Matthias Clasen
77072b3eaa fixup editing style class 2020-07-18 10:10:28 -04:00
Matthias Clasen
c7833bb090 editablelabel: Document css nodes
Just the usual.
2020-07-18 09:55:46 -04:00
Matthias Clasen
899024cef7 editablelabel: Add a style class while editing
Add the .editing style class to the editable label
while it is editing. The idea is that themes can
show a frame around the entry.
2020-07-18 09:54:55 -04:00
Rico Tzschichholz
4da3edd42e Merge branch 'wip/ricotz/annotations' into 'master'
gtk: Improve g-i annotations for methods of GtkExpression subclasses

See merge request GNOME/gtk!2263
2020-07-18 11:06:47 +00:00
Rico Tzschichholz
6b59626817 gtk: Improve g-i annotations for methods of GtkExpression subclasses 2020-07-18 12:30:05 +02:00
Matthias Clasen
7c02ae00c2 inspector: Clean up GtkInspectorGeneral
Drop the Private struct.
2020-07-18 00:31:04 -04:00
Matthias Clasen
80e29a3627 inspector: Clean up GtkInspectorMiscInfo
Drop the Private struct.
2020-07-18 00:25:46 -04:00
Matthias Clasen
26163a4f30 inspector: Clean up GtkInspectorVisual
Drop the Private struct, and do all cleanup in dispose.
2020-07-18 00:17:42 -04:00
Matthias Clasen
dbd88fc210 inspector: Clean up GtkInspectorActions
Drop the Private struct, dispose properly,
and don't derive from GtkBox.
2020-07-17 23:59:49 -04:00
Matthias Clasen
2de31e4cac inspector: Clean up GtkInspectorActionEditor
Drop the Private struct, dispose properly,
and don't derive from GtkBox.
2020-07-17 23:36:05 -04:00
Matthias Clasen
1bff328895 inspector: Clean up GtkInspectorLogs
Drop the Private struct, dispose properly,
and don't derive from GtkBox.
2020-07-17 23:24:14 -04:00
Matthias Clasen
facf78a5b6 inspector: Allow disposing the inspector
We were hiding the inspector when the window
is closed, but that has the side-effect of
keeping references to application windows,
so we would keep them artificially alive,
which can have side-effects.

So, make the inspector go away when closed.
2020-07-17 23:15:42 -04:00
Matthias Clasen
6b19fcd859 inspector: Properly dispose GtkInspectorWindow 2020-07-17 23:15:25 -04:00
Matthias Clasen
ca784e3e1a inspector: Properly dispose GtkInspectorShortcuts 2020-07-17 23:13:29 -04:00
Matthias Clasen
314c8558d7 inspector: Properly dispose GtkInspectorListData 2020-07-17 23:13:07 -04:00
Matthias Clasen
af30a7fe06 inspector: Dispose tree data properly
Another place where we were leaking children.
2020-07-17 22:54:19 -04:00
Matthias Clasen
9ffd7d1970 inspector: Dispose the recorder properly
We were leaking children here.
2020-07-17 22:54:10 -04:00
Matthias Clasen
cb906c80eb inspector: Drop the recorder Private struct 2020-07-17 22:37:24 -04:00
Matthias Clasen
96ce0eb600 Merge branch 'matthiasc/for-master' into 'master'
gtk-demo: Don't use GtkColorSwatch

See merge request GNOME/gtk!2262
2020-07-18 01:17:43 +00:00
Matthias Clasen
0e476c1f28 gtk-demo: Don't use GtkColorSwatch
Making our own is 80 lines of code, so just do it.
2020-07-17 20:44:06 -04:00
Matthias Clasen
f2924988db Merge branch 'ebassi/for-master' into 'master'
Fix typo in the GtkStrinFilter constructor declaration

See merge request GNOME/gtk!2261
2020-07-17 13:18:59 +00:00
Emmanuele Bassi
671435e07f Fix typo in the GtkStrinFilter constructor declaration 2020-07-17 14:16:46 +01:00
Emmanuele Bassi
b17cfb9b65 Merge branch 'ebassi/for-master' into 'master'
Fix typo in the gtk-doc stanza for gtk_string_filter_new()

See merge request GNOME/gtk!2259
2020-07-17 13:09:55 +00:00
Emmanuele Bassi
0385f1aaf4 Fix typo in the gtk-doc stanza for gtk_string_filter_new() 2020-07-17 12:03:17 +01:00
Matthias Clasen
8611faf338 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

Closes #2776

See merge request GNOME/gtk!2258
2020-07-17 10:56:16 +00:00
Timm Bäder
7e19911d3f testwidgettransforms: Fix GtkBox casts 2020-07-17 07:14:50 +02:00
Timm Bäder
c1f5153f6d boxlayout: Remove unnecessary checks
The pointers passed to GtkLayoutManager::measure() are never NULL. The
ones passed to gtk_layout_manager_measure() can be, however.
2020-07-17 06:31:57 +02:00
Timm Bäder
2bd87ce771 boxlayout: Remove unused include 2020-07-17 06:27:50 +02:00
Timm Bäder
de0547ede7 migration guide: Remove a stray html tag 2020-07-17 06:27:23 +02:00
Timm Bäder
14589c2a59 widget: Save a gtk_css_node_get_style call 2020-07-17 05:49:12 +02:00
Timm Bäder
f678b3804d widget: Remove useless if statement
filter_value is never NULL anyway.
2020-07-17 05:49:12 +02:00
Timm Bäder
720c298786 snapshot: Use collect_default directoy in push_debug()
Instead of going through collect_debug and then doing a collect_default
anyway if the message is NULL.
2020-07-17 05:49:12 +02:00
Timm Bäder
f721d2de15 debug: Remove resize highlighting
This has been broken ever since the debug highlighting moved to
inspector overlays.
2020-07-17 05:49:12 +02:00
Timm Bäder
11f07cb5ad GdkRGBA: Fix typo in documentation 2020-07-17 05:49:11 +02:00
Timm Bäder
37d7ab88dc gl renderer: Avoid 9-slicing things that can't be
The outline needs to be large enough so changing the size of the outline
does not affect the resulting blurred texture.

Fixes #2776
2020-07-17 05:49:11 +02:00
Timm Bäder
6cde64072d gl renderer: Remove outdated comment 2020-07-17 05:49:11 +02:00
Timm Bäder
6a60b0f591 gl renderer: Try to intersect rounded clips more often 2020-07-17 05:49:11 +02:00
Timm Bäder
339d9f05e4 gl renderer: Remove unused flag 2020-07-17 05:49:11 +02:00
Timm Bäder
4e4207457f adwaita: Remove header bar border radius
We get this from the window node these days.
2020-07-17 05:49:11 +02:00
Timm Bäder
46bb3e3046 icontheme: Indentation 2020-07-17 05:49:11 +02:00
Timm Bäder
34008e6aab gl renderer: Ignore rounded clip that only increase the clip
This fixes the widget factory rendering too much.

In the widget-factory, we generally have a pretty small update area (two
spinners and a progressbar). We take the extents of that as a update
area and inital clip.

However, the first clip node we see is from the toplevel window, which
essentially increases the clip again to almost the entire window.

Fix that by ignoring such cases.
2020-07-17 05:49:11 +02:00
Timm Bäder
d6b3ac850d testsuite: Fix test case indentation 2020-07-17 05:49:11 +02:00
Matthias Clasen
9742200ff6 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2257
2020-07-17 03:20:20 +00:00
Matthias Clasen
ec10857b84 docs: Move columns below columnview 2020-07-16 22:14:39 -04:00
Matthias Clasen
353d4d161c Cosmetic docs change 2020-07-16 22:08:15 -04:00
Matthias Clasen
bcd650f169 docs: Revise the filter docs a bit 2020-07-16 21:48:08 -04:00
Matthias Clasen
72d66dfcdd docs: Revise sorter docs a bit 2020-07-16 21:45:11 -04:00
Matthias Clasen
5e97df5058 bitset: try again 2020-07-16 21:44:31 -04:00
Matthias Clasen
059d131e2b Merge branch 'wip/chergert/subclass-treeview' into 'master'
treeview: allow subclassing GtkTreeView

Closes #2936

See merge request GNOME/gtk!2256
2020-07-17 01:05:07 +00:00
Matthias Clasen
8f7c207c7c docs: Add more GtkExpression
Make GtkExpression show up in the object
hierarchy, and add the param spec and GValue
support to the docs.
2020-07-16 21:02:33 -04:00
Matthias Clasen
b9e8935037 docs: Document GtkBitsetIter 2020-07-16 20:28:21 -04:00
Matthias Clasen
5f33f4ae8e docs: Add an example
Add a small example for setting up columnview sorting.
2020-07-16 20:21:21 -04:00
Matthias Clasen
adf0e8b1e6 docs: Fix examples
The formatting for examples in the GtkExpression
long description was messed up.
2020-07-16 20:21:21 -04:00
Christian Hergert
7500f9b255 treeview: allow subclassing GtkTreeView
Porting code from GTK 3 without the ability to subclass GtkTreeView
directly can cause an extreme amount of pain on application developers.
It can also complicate performance when it comes to dealing with
encapsulation as the outer widget would also encapsulate the GtkScrollable
implementation from GtkTreeView, typically through GtkViewport.

Fixes #2936
2020-07-16 17:06:15 -07:00
Matthias Clasen
a8d433dd26 docs: Link to GtkTreeRowReference
The list overview cross-reference table links
to all objects, except for this one.
2020-07-16 19:53:47 -04:00
Matthias Clasen
ecaf6fced0 docs: Add GtkTreeExpander
We want to link to it from various places, so it needs
to be present in the docs.
2020-07-16 19:53:47 -04:00
Matthias Clasen
31a7cac4a6 Merge branch 'matthiasc/arrays' into 'master'
Matthiasc/arrays

See merge request GNOME/gtk!2253
2020-07-16 23:31:31 +00:00
Matthias Clasen
5eec736b07 multifilter: Use GdkArray for the filters 2020-07-16 18:44:25 -04:00
Matthias Clasen
cf4a8e2152 multisorter: Use GdkArray for the sorters 2020-07-16 18:44:25 -04:00
Matthias Clasen
31bb969cce Merge branch 'matthiasc/for-master' into 'master'
gtk-demo: Use better api

See merge request GNOME/gtk!2254
2020-07-16 21:03:21 +00:00
Matthias Clasen
f4a7c7f6bf gtk-demo: Use better api
We have a getter for the model, lets use it.
2020-07-16 16:26:41 -04:00
Benjamin Otte
495069c868 Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

See merge request GNOME/gtk!2251
2020-07-16 19:43:45 +00:00
Matthias Clasen
dfe470475b Merge branch 'missing-exports' into 'master'
Add missing exports for GtkColumnView methods.

See merge request GNOME/gtk!2252
2020-07-16 18:52:22 +00:00
Benjamin Otte
de56e892aa listitemmanager: Do a better job on double items
Previously, we would unparent the existing item that we were about
to reuse, and not the duplicate one.

Change that.
2020-07-16 20:43:16 +02:00
Benjamin Otte
e518c1f2f3 stringfilter: Make the constructor take an expression
An expression is critically important for a string filter and people
should be made aware of it when constructing the filter.
2020-07-16 20:43:16 +02:00
Benjamin Otte
c5ea59d7d1 gtk-demo: Don't make demos modal
That way, demo windows can be maximized and multiple demos can run at
once.

It's especially useful when using --run because the main window is
invisible then.
2020-07-16 20:43:16 +02:00
Benjamin Otte
22eccbdbb6 testsuite: Don't be too exhaustive
The test was taking over 60s on CI, that's a but much.
2020-07-16 20:43:16 +02:00
Benjamin Otte
58e85c85e4 testsuite: Add a case with escaped Latin-1 code
This came up in recent g_uri_escape() discussions.
2020-07-16 20:43:11 +02:00
Matthias Clasen
6b89148487 Merge branch 'wip/otte/vector' into 'master'
Arrays

See merge request GNOME/gtk!2197
2020-07-16 18:05:43 +00:00
Matthias Clasen
ddb9e428ec Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2250
2020-07-16 17:39:16 +00:00
Andreas Persson
b7fa353db2 Add missing exports for GtkColumnView methods.
GDK_AVAILABLE_IN_ALL was missing for one method in GtkColumnView and one
in GtkColumnViewColumn.
2020-07-16 18:58:41 +02:00
Matthias Clasen
87b5eadb7c treesorter tests: Add a comment
This looks like a leak, but isn't one.
Add a comment to that effect.
2020-07-16 12:14:28 -04:00
Benjamin Otte
60a09e59e8 stringlist: Convert to array
Stringlists are usually built and then never modified, and accessing
items through an array is faster.
2020-07-16 18:09:58 +02:00
Benjamin Otte
6f8e9bf3a9 snapshot: Use GdkArray for the state stack 2020-07-16 18:09:58 +02:00
Benjamin Otte
90b7b84337 array: Add a bunch of new features
* GDK_ARRAY_BY_VALUE
  #define this to get GArray-like behavior
* gdk_array_splice (v, 0, 0, NULL, 25)
  Adding items but passing NULL as the items will zero() them.
* gdk_array_set_size()
  A nicer way to call gdk_array_splice()
* constify getters
2020-07-16 18:09:58 +02:00
Benjamin Otte
088b5fc57f icontheme: Use GdkArray 2020-07-16 18:09:58 +02:00
Benjamin Otte
a4cd974912 array: Add null-termination 2020-07-16 18:09:57 +02:00
Benjamin Otte
65359dcc59 snapshot: Port node list to GdkArray 2020-07-16 18:09:57 +02:00
Benjamin Otte
ac8b398c50 snapshot: Move structs into .c file
They aren't used anywhere else.
2020-07-16 18:09:57 +02:00
Benjamin Otte
aac2417893 Remove preallocated array code
Now with GdkArray, we can use that one instead.
2020-07-16 18:09:57 +02:00
Benjamin Otte
ad8892df10 main: Use a GdkArray 2020-07-16 18:09:57 +02:00
Benjamin Otte
edc7977c4e cssselector: Use GdkArray 2020-07-16 18:09:57 +02:00
Benjamin Otte
8bf8ac5076 Add GdkArray
This is a scary idea where you #define a bunch of preprocessor values
and then #include "gdkarrayimpl.c" and end up with a dynamic array for
that data type.

See https://en.wikipedia.org/wiki/X_Macro for what's going on.

What are the advantages over using GArray or GPtrArray?

 * It's typesafe
   Because it works like C++ templates, we can use the actual type of
   the object instead of having to use gpointer.

 * It's one less indirection
   instead of 2 indirections via self->array->data, this array is
   embedded, so self->array is the actual data, and just one indirection
   away. This is pretty irrelevant in general, but can be very noticable
   in tight loops.

 * It's all inline
   Because the whole API is defined as static inline functions, the
   compiler has full access to everything and can (and does) optimize
   out unnecessary calls, thereby speeding up some operations quite
   significantly, when full optimizations are enabled.

 * It has more features
   In particular preallocation allows for avoiding malloc() calls, which
   can again speed up tight loops a lot.
   But there's also splice(), which is very useful when used with
   listmodels.
2020-07-16 18:09:57 +02:00
Benjamin Otte
c36cbd5140 sortlistmodel: Remove forgotten G_PARAM_CONSTRUCT_ONLY 2020-07-16 17:33:29 +02:00
Matthias Clasen
ee96bc7185 multiselection tests: Plug a leak
g_list_model_get_item is transfer full.
2020-07-16 08:54:36 -04:00
Matthias Clasen
f94f325636 filterlistmodel tests: Plug a leak
g_list_model_get_item is transfer full.
2020-07-16 08:54:36 -04:00
Matthias Clasen
6c1217dd93 filter tests: Plug a leak
g_list_model_get_item is transfer full.
2020-07-16 08:54:36 -04:00
Matthias Clasen
edb792503b printunixdialog: Plug a leak
g_list_model_get_item is transfer full.
2020-07-16 08:54:36 -04:00
Matthias Clasen
3a43859286 Cosmetics 2020-07-16 08:54:36 -04:00
Matthias Clasen
c55dd104d4 placessidebar: Plug a leak
g_list_model_get_item is transfer full.
2020-07-16 08:54:36 -04:00
Matthias Clasen
497d137fb8 filechoosernativewin32: Plug a leak
g_list_model_get_item is transfer full.
2020-07-16 08:54:36 -04:00
Matthias Clasen
df01c5c7a4 columnlistitemfactory: Plug a leak
g_list_model_get_item is transfer full.
2020-07-16 08:54:36 -04:00
Matthias Clasen
2d1135fba6 applicationaccels: Plug a leak
g_list_model_get_item is transfer full.
2020-07-16 08:54:36 -04:00
Matthias Clasen
f54ed6f7dc columviewsorter: Add an assertion 2020-07-16 08:54:36 -04:00
Matthias Clasen
b7efd896b6 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2249
2020-07-16 12:52:46 +00:00
Matthias Clasen
46eb51bc30 inspector: Avoid losing a reference
This was copying the example in the treelistrowsorter
docs that the previous commit fixed, so we apply
the same fix here.
2020-07-16 07:14:01 -04:00
Matthias Clasen
500dbaabc3 treelistrowsorter: Fix a faulty example
gtk_tree_list_row_sorter_new() consumes the
sorter, so we can't pass gtk_column_view_get_sorter(),
since that is transfer none.
2020-07-16 07:14:01 -04:00
Matthias Clasen
594ec3d822 inspector: Don't derive from GtkBox
We don't do that anymore. A bin layout
is sufficient here.
2020-07-16 07:14:01 -04:00
Matthias Clasen
f280508209 inspector: Drop a Private struct
These are really not needed in the inspector.
2020-07-16 07:14:01 -04:00
Matthias Clasen
480b88c776 inspector: Drop an unused field 2020-07-16 07:14:01 -04:00
Efstathios Iosifidis
a4e63905b1 Update Greek translation 2020-07-15 18:12:26 +00:00
Matthias Clasen
5666127dbc Merge branch 'matthiasc/for-master' into 'master'
inspector: Use substring matching in the property list

See merge request GNOME/gtk!2247
2020-07-15 16:52:05 +00:00
Matthias Clasen
c1c110ba65 inspector: Use substring matching in the property list
This is convenient for things like "set both hexpand and
vexpand", since you can then search for "expand"
2020-07-15 11:29:06 -04:00
Florentina Mușat
eb2a839892 Update Romanian translation 2020-07-15 08:58:58 +00:00
Matthias Clasen
1c537a6d2e Merge branch 'wip/jimmac/file-dialog-sidebar-color' into 'master'
Adwaita: sidebar color for file picker

See merge request GNOME/gtk!2242
2020-07-15 01:41:35 +00:00
Matthias Clasen
c12261a6ec Merge branch 'wip/fix-picom-crasher' into 'master'
x11: Don't set up frame sync fence on unsupported compositors

Closes #2927

See merge request GNOME/gtk!2245
2020-07-15 01:40:49 +00:00
Matthias Clasen
5af7d6bff3 Merge branch 'idle-inhibit' into 'master'
Add support for idle inhibition on Wayland

Closes #2202

See merge request GNOME/gtk!2226
2020-07-15 01:38:55 +00:00
Matthias Clasen
de0f4b0f5b Merge branch 'shortcuts-section-reflow-fix' into 'master'
Fix shortcuts section reflow

Closes #2928

See merge request GNOME/gtk!2246
2020-07-15 01:38:38 +00:00
Emmanuel Gil Peyrot
966ab1152d gtk/wayland: Add support for idle inhibition in GtkApplication
This feature was previously only supported on DBus compositors, such as
Mutter, this adds support for other compositors such as all of those
based on wlroots.

This implementation prefers the idle-inhibit Wayland protocol to the
DBus version if it is available, since the inhibitor is per-surface
instead of global it allows a finer control over which displays get
dimmed for instance.  For every case not supported by this protocol, a
fallback to the DBus version is used.

It can’t do anything if the GtkWindow isn’t passed, which might warrant
some documentation change to encourage users to not use NULL for this
argument.

This has been tested on Sway.

Fixes #2202.
2020-07-14 21:47:22 +02:00
Emmanuel Gil Peyrot
74a4432688 gdk/wayland: Add an API to inhibit and uninhibit idle
This uses the idle-inhibit protocol from wayland-protocols, to attach an
inhibitor to the GdkSurface.  The inhibit function can be called as many
times as the user wants, but the uninhibit function MUST be called as
many times to unset the idle inhibition.

This has been tested on Sway.
2020-07-14 21:47:22 +02:00
Matthias Clasen
115d0cdc07 Fix shortcuts section reflow
When this code was ported from gtk_container_get_children
to the dom api, we inadvertendly inverted the order of the
list in one place. With the dom api, we can just avoid
reversing lists altogether, so do that.

Fixes: #2928
2020-07-14 14:48:32 -04:00
Ray Strode
d0ec616fba x11: Don't set up frame sync fence on unsupported compositors
Not all compositors support _NET_WM_FRAME_DRAWN.  In cases
where the compositor doesn't support _NET_WM_FRAME_DRAWN we don't
need to do all the fancy damage tracking and fence watching.

Furthermore, if the compositor doesn't support _NET_WM_FRAME_DRAWN,
it's possible that one frame will start before the previous frame has
made it through the pipeline, leading to a blown assertion.

This commit side-steps the unnecessary code and associated assertion
when _NET_WM_FRAME_DRAWN isn't supported.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2927
2020-07-14 14:33:12 -04:00
Florentina Mușat
38cce2bb18 Update Romanian translation 2020-07-14 14:52:19 +00:00
Matthias Clasen
9cb7002b98 Merge branch 'wip/jimmac/large-title-letterspacing' into 'master'
Adwaita: revert letter-spacing for large-title

Closes #2932

See merge request GNOME/gtk!2243
2020-07-14 11:47:36 +00:00
Yuri Chornoivan
eb9c91c0a9 Update Ukrainian translation 2020-07-14 10:33:34 +00:00
Jakub Steiner
be07153efa Adwaita: revert letter-spacing for large-title
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2932
2020-07-14 12:24:25 +02:00
Jakub Steiner
627ec82e60 Adwaita: sidebar color for file picker
- use menu like hovers and desaturated selected_bg_color

Partially addresses https://gitlab.gnome.org/GNOME/gtk/-/issues/1586
2020-07-14 11:37:29 +02:00
Matthias Clasen
ccc34ca06c Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2241
2020-07-14 02:43:25 +00:00
Matthias Clasen
2b5dd0082d inspector: Show some information about expressions
This is not too useful, but better than nothing.
2020-07-13 20:49:56 -04:00
Matthias Clasen
7b36b339aa expression: Add some introspection
Add a few apis to peek inside expressions, mainly
for the benefit of GtkInspector and similar uses.
2020-07-13 20:19:07 -04:00
Matthias Clasen
b7eb663b82 gtk-demo: Make the words demo expand
We want to fill the window here.
2020-07-13 17:54:27 -04:00
Matthias Clasen
1b28353be5 inspector: Ellipsize in the object tree
We don't want a long label to blow up the width
of the inspector window.
2020-07-13 17:32:52 -04:00
Matthias Clasen
a07c030d02 inspector: Fix up input enum names
We've recently added and removed a few values in these
enumerations. Keep the names in sync, so we don't show
nonsense.
2020-07-13 17:13:43 -04:00
Matthias Clasen
339cccdf53 NEWS: Updates and fixes 2020-07-13 17:10:22 -04:00
Matthias Clasen
577126e99c Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2240
2020-07-13 20:48:08 +00:00
Matthias Clasen
125ea5ee4a treeexpander: Be focusable
We need to be focusable so that we can take focus
if the child doesn't.
2020-07-13 15:06:35 -04:00
Matthias Clasen
3c5afc06d1 searchbar: Set a focus vfunc
We don't want to take focus ourselves here.
2020-07-13 15:06:08 -04:00
Matthias Clasen
f87c15f4f9 Merge branch 'wip/jimmac/file-dialog-sidebar-color' into 'master'
Adwaita: sidebar color for file picker

Closes #1586

See merge request GNOME/gtk!2238
2020-07-13 16:31:07 +00:00
Jakub Steiner
fe5c0e2fe3 Adwaita: sidebar color for file picker
- avoid using the selected blue for the sidebar

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/1586
2020-07-13 17:03:55 +02:00
Matthias Clasen
c8421cfd82 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2236
2020-07-13 14:38:03 +00:00
Matthias Clasen
fbf99b8d65 Merge branch 'wip/carlosg/windowhandle-gesture-state' into 'master'
gtkwindowhandle: Only claim gesture on action

See merge request GNOME/gtk!2237
2020-07-13 14:32:06 +00:00
Yuri Chornoivan
57312c9b79 Update Ukrainian translation 2020-07-13 14:18:40 +00:00
Carlos Garnacho
35d2539ef8 gtkwindowhandle: Only claim gesture on action
The press gesture does not need to set claimed state just for n-press
tracking, it will however reset all other click gestures on each press
if the event gets propagated all the way up.

Fixes tracking of multi-press in gestures in widgets that are children
of the window handle. E.g. the headerbar listview in the "File browser"
gtk4-demo demo.
2020-07-13 15:48:12 +02:00
Matthias Clasen
08a4f4552c Give the inspector a devel header too
Lets clearly communicate that we're unstable.
2020-07-13 08:28:02 -04:00
Matthias Clasen
6502d3669f print-editor: Set the devel style class
Lets clearly communicate that we're unstable.
2020-07-13 08:27:51 -04:00
Matthias Clasen
53831e67a7 Integrate the new icons
Install and use the node-editor and print-editor icons.
2020-07-13 07:30:46 -04:00
Jakub Steiner
e742fc1206 demos: icons for Print and Node Editors
- probably needs meson build hooks
2020-07-13 07:30:46 -04:00
Piotr Drąg
4ef5ee23e6 Update POTFILES.in 2020-07-13 13:17:37 +02:00
Matthias Clasen
4a8330fda0 Merge branch 'matthiasc/for-master' into 'master'
gtk-demo: Work harder to filter the tree

See merge request GNOME/gtk!2234
2020-07-12 23:16:35 +00:00
Matthias Clasen
b4096cee64 gtk-demo: Work harder to filter the tree
Arrange for an item to be visible if it either
matches the filter or has children that do.
2020-07-12 18:26:56 -04:00
Matthias Clasen
032302c358 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2233
2020-07-12 21:23:07 +00:00
Matthias Clasen
a888e1cb65 demo: Clear filter when search is stopped
When the search entry disappears on Escape,
reset the search string to "", so we don't
end up with a filtered list and no obvious
way to remove the filtering.
2020-07-12 16:47:51 -04:00
Matthias Clasen
c80b33b2ad gtk-demo: Make the search bar appear for typing
Having the search bar present from the start is
a bit jarring. Make it appear when called for.
2020-07-12 16:26:17 -04:00
Matthias Clasen
f32239df1f searchbar: Add a key-capture-widget property
This is handy to set up this relationship in ui files,
and also makes it accessible in the inspector.
2020-07-12 16:25:48 -04:00
Matthias Clasen
22c1b541df Merge branch 'wip/sadiq/demo-filter' into 'master'
demo: Add a search filter

See merge request GNOME/gtk!2232
2020-07-12 19:04:00 +00:00
Matthias Clasen
78a59c95fe Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2231
2020-07-12 16:59:10 +00:00
Mohammed Sadiq
7583d48266 demo: Add a search filter 2020-07-12 22:19:40 +05:30
Matthias Clasen
f1188aaeac Fix gtk_file_chooser_error_stack_set_custom_error
This never worked, due to a typo.
2020-07-12 12:15:08 -04:00
Matthias Clasen
4dac5c222f Drop GtkFileChooserEmbed
This private interface is no longer used.
2020-07-12 12:15:08 -04:00
Matthias Clasen
0145809a94 filechooserdialog: Stop using ::response-requested
Replace the ::response-requested signal by an action.
2020-07-12 12:15:08 -04:00
Matthias Clasen
2e6b8810c0 filechooserdialog: Stop using the embed interface
Just call private GtkFileChooserWidget api. There
is no real justification for diverting this through
an extra interface.
2020-07-12 10:59:49 -04:00
Matthias Clasen
d8abcdb5a1 Remove unused includes
Only GtkFileChooserWidget and GtkFileChooserDialog
use the GtkFileChooserEmbed interface.
2020-07-12 10:59:31 -04:00
Matthias Clasen
65ecfa20dd filechooserwidget: Use dropdown api better
We now have GtkStringList, so we can implement
the choice api a little cleaner with it.
2020-07-12 10:58:33 -04:00
Matthias Clasen
aa5ab02166 filechooserwidget: Remove homegrown profiling
We have sysprof support now, so we no longer have
to use this homegrown profiler.
2020-07-12 10:58:33 -04:00
Matthias Clasen
7ddbbb50ff Merge branch 'drop-file-system' into 'master'
Drop file system

See merge request GNOME/gtk!2229
2020-07-12 14:41:01 +00:00
Matthias Clasen
f2eb036119 Merge branch 'matthiasc/for-master' into 'master'
gtk-demo: Make style apply in the file browser

See merge request GNOME/gtk!2230
2020-07-12 13:58:30 +00:00
Matthias Clasen
8a8b96bf4b Drop GtkFileSystem
It is no longer used.
2020-07-12 09:49:31 -04:00
Matthias Clasen
bdcda2d8f0 filechooserwidget: Stop using GtkFileSystem
Just use gio directly.
2020-07-12 09:49:31 -04:00
Matthias Clasen
ef3f997d55 filechooser: Drop get_file_system from the interface
This is no longer used.
2020-07-12 09:49:31 -04:00
Matthias Clasen
b41d380230 filechooserbutton: Stop using GtkFileSystem
Just use gio directly.
2020-07-12 09:49:31 -04:00
Matthias Clasen
0210850e86 Reduce includes of gtkfilesystem.h
Move a few non-filesystem helpers to gtkfileutils.h,
and drop the include in all the places where it isn't needed.
2020-07-12 09:12:43 -04:00
Matthias Clasen
053223bf65 pathbar: Stop using GtkFileSystem
This is just a thin wrapper around some gio functionality
these days, and we want to get rid of it.
2020-07-12 09:12:43 -04:00
Matthias Clasen
746b84cc0f gtk-demo: Make style apply in the file browser
Commit 5afe6f7825 claims to make this demo
'look good', but it failed to actually make its
css apply. Now it really looks good.
2020-07-12 08:11:42 -04:00
Matthias Clasen
f1ad883e00 pathbar: Drop the Private struct 2020-07-11 17:23:55 -04:00
Matthias Clasen
191e0e8d5e Merge branch 'matthiasc/for-master' into 'master'
Fix the build with clang

See merge request GNOME/gtk!2225
2020-07-10 19:29:18 +00:00
Matthias Clasen
55217e2181 Fix the build with clang
clang doesn't allow G_GNUC_FALLBACK in dead code.
Seems silly, but what can we do.
2020-07-10 13:21:23 -04:00
Emmanuele Bassi
7c8cd23c5f Merge branch 'ebassi/ci-timeout' into 'master'
Ebassi/ci timeout

See merge request GNOME/gtk!2223
2020-07-10 17:01:56 +00:00
Matthias Clasen
6aafb81702 Merge branch 'ci-tweaks' into 'master'
ci: Use lsan again

See merge request GNOME/gtk!2224
2020-07-10 16:13:48 +00:00
Emmanuele Bassi
0578422612 build: Restructure the tests to use dictionaries
Instead of an array of arrays, let's use an array of dictionaries; it's
easier to add optional keys without requiring to remember where to put
empty arrays.
2020-07-10 16:32:15 +01:00
Emmanuele Bassi
ad04da84c9 Add the filtermodel-exhaustive test to the slow suite
This increases the default timeout.
2020-07-10 16:16:15 +01:00
Emmanuele Bassi
333b013f7f Increase the default timeout for slow tests
If a test is part of the 'slow' test suite, we should increment the
default timeout to compensate.
2020-07-10 16:13:37 +01:00
Matthias Clasen
b3dc517565 ci: Use lsan again
Turning it off didn't fix the crashes; and we allow
the asan build to fail anyway now. And the leak reports
are useful whenever it doesn't crash.
2020-07-10 11:11:42 -04:00
Emmanuele Bassi
70e4dabe89 ci: Increase the timeout multiplier
We do have some slow tests.
2020-07-10 16:08:59 +01:00
Emmanuele Bassi
d3443d6f2a ci: Use the timeout multiplier from the environment
When running our test suite on our CI infrastructure.
2020-07-10 16:08:14 +01:00
Matthias Clasen
a508f68044 Merge branch 'asan-ci' into 'master'
Asan ci

See merge request GNOME/gtk!2214
2020-07-10 13:04:34 +00:00
Matthias Clasen
f191b64bbc Disable lsan for now
The leak sanitizer causes on average 3-4 tests
to segfault during a testsuite run. Disable it
for now to see if we can get a successful
testsuite run with asan alone.
2020-07-10 07:32:48 -04:00
Matthias Clasen
e9efe77839 Merge branch 'wip/Jehan/gio-querymodules-pkg-config-master' into 'master'
build-aux: search various Glib/GIO utilities in .pc file.

See merge request GNOME/gtk!2129
2020-07-09 23:53:25 +00:00
Matthias Clasen
d98c0d32f2 ci: Add a build with asan
Run our testsuite under asan. We do this in a
separate build, since we need to turn off
introspection to make the build succeed.

As Michael Catanzaro pointed out, this requires a
privileged runner in order to use kernel apis.
2020-07-09 19:43:06 -04:00
Matthias Clasen
dfa2dcceb8 Merge branch 'matthiasc/for-master' into 'master'
x11: Plug a memory leak

See merge request GNOME/gtk!2222
2020-07-09 23:06:37 +00:00
Matthias Clasen
d441e7106b x11: Plug a memory leak
Don't leak atoms when we're storing the clipboard.
2020-07-09 18:19:32 -04:00
Benjamin Otte
4cd92f979c Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

See merge request GNOME/gtk!2221
2020-07-09 21:34:02 +00:00
Benjamin Otte
d1a068e5b1 sorter: Remove a return_if_fail()
It's too expsensive.
2020-07-09 22:29:36 +02:00
Benjamin Otte
4d90846182 testsuite: Be more exhaustive
Create larger source models in tests, so that we hit the incremental
batch size more often and have a higher chance to expose bugs there.
2020-07-09 22:29:36 +02:00
Benjamin Otte
986f721938 filterlistmodel: Don't filter out every 513th element
Incremental filtering would skip every 513th element due to an
off-by-one error.

Test included
2020-07-09 22:29:36 +02:00
Matthias Clasen
7903246355 Ignore more leaks in asan
These showed up in ci. The atk-bridge will
be gone before too long anyway. Since we
may not have debug symbols in ci, just at
the so's.
2020-07-09 16:18:07 -04:00
Matthias Clasen
0252ae2be3 Merge branch 'wip/carlosg/range-autoscroll' into 'master'
gtkrange: group gestures the right way around

See merge request GNOME/gtk!2220
2020-07-09 20:05:07 +00:00
Matthias Clasen
fa90e42a38 ci: Set LSAN_OPTIONS for tests
When running the testsuite with the address sanitizer,
many of our dependencies cause it to report cause it
to report memory leaks, causing tests to fail.
Therefore, point the leak sanitizer at a list of
suppressions. The list is kept in the lsan.supp
file in git.
2020-07-09 15:07:50 -04:00
Matthias Clasen
2d36109565 ci: Use the fedora:v20 image
This image includes libasan and libubsan.
2020-07-09 15:07:50 -04:00
Matthias Clasen
de8258171a ci: Mention image layering in the README 2020-07-09 15:07:50 -04:00
Matthias Clasen
2ed6224778 ci: Add libasan and libubsan to the image
Add libasan and libubsan to fedora-base:v20,
and build fedora:20 on top of it.

This is so we can build and run the tests with
the address and undefined behavior sanitizers.
2020-07-09 15:07:50 -04:00
Carlos Garnacho
e1a0171094 gtkrange: group gestures the right way around
The gtk_gesture_group() call is not a commutative operation, it
takes two gestures, maybe detaches the first one from its current
group, and adds it to the same group than the second gesture.

With the flipped argument order here, GtkRange was actually detaching
the same gesture in order to group it with a second one two times, so
the desired effect to group all 3 gestures was not achieved.

Fixes autoscroll as the drag gesture is now actually grouped with the
click one, so drag offsets can be accessed from the autoscroll
timeout.
2020-07-09 20:49:25 +02:00
Matthias Clasen
395521f3d3 x11: Plug a memory leak
Don't leak atoms when we're storing the clipboard.
2020-07-09 13:52:53 -04:00
Matthias Clasen
8c95a84ea4 Merge branch 'matthiasc/for-master' into 'master'
css: Plug a memory leak

Closes #2921

See merge request GNOME/gtk!2219
2020-07-09 17:19:57 +00:00
Matthias Clasen
75db19c789 css: Plug a memory leak
When a rule has no styles, we don't add it
to our ruleset. Since we are not adopting
the selectors in this case, we must free them.

Fixes: #2921
2020-07-09 12:14:18 -04:00
Matthias Clasen
f00d2b30bb Merge branch 'wip/carlosg/scrollbar-fixes' into 'master'
Scrollbar fixes

Closes #2879

See merge request GNOME/gtk!2216
2020-07-09 15:56:13 +00:00
Carlos Garnacho
c0c5ce2f9b gdk/x11: Ignore regular crossing events while in implicit grabs
If we create an implicit grab on a surface, leave the surface, and
release the button, we would get 2 XI_Leave events, one with mode
XINotifyNormal when the pointer leaves the surface, and another with
mode XINotifyUngrab when the button is released.

Meanwhile, the upper layers rely on crossing events being paired,
and particularly in no crossing event being sent until the implicit
grab is dismissed (either by releasing it, or via more pervasive
grabs).

Ignoring the set of XINotifyNormal events while an implicit grab
is active adapts the X11 backend to this behavior. If the grab were
released or taken away by another grab, a crossing event with one
of the other XINotify*Grab/XINotify*Ungrab will be generated.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2879
2020-07-09 17:02:07 +02:00
Matthias Clasen
ee9f9ae05e Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2212
2020-07-09 14:49:42 +00:00
Matthias Clasen
387649ded4 Merge branch 'ebassi/subprojects-depth' into 'master'
Use depth=1 for cloning sub-projects

See merge request GNOME/gtk!2215
2020-07-09 14:39:01 +00:00
Matthias Clasen
be12131d74 Merge branch 'file-chooser-api-cleanup-2' into 'master'
File chooser api cleanup 2

See merge request GNOME/gtk!2213
2020-07-09 14:31:14 +00:00
Carlos Garnacho
896ebdc9d7 gtkscrolledwindow: Look up correctly target in captured motion events
Check correctly that the captured motion events are emitted towards the
content or one of the scrollbars, in order to have it set the expected
"over" state depending on whether the drag begins from the scrolledwindow
content or one of the scrollbars.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2879
2020-07-09 16:10:55 +02:00
Matthias Clasen
bc58bd0b83 NEWS: Updates 2020-07-09 09:29:09 -04:00
Matthias Clasen
8d4c87876b Add a suppression file for asan
This can be used similar to valgrind suppressions:

LSAN_OPTIONS=suppressions=`pwd`/lsan.supp meson  tests -Cbuild
2020-07-09 09:29:09 -04:00
Matthias Clasen
cebc99ddc7 tests: Plug some more memory leaks
These showed up under asan.
2020-07-09 09:29:09 -04:00
Matthias Clasen
1b62203f18 cups: Plug a memory leak
This showed up under asan.
2020-07-09 09:29:09 -04:00
Matthias Clasen
06dd8c2cfd Merge branch 'wayland_surface_app_id_changing' into 'master'
add a way to change the application_id of a toplevel wayland GdkSurface

See merge request GNOME/gtk!2205
2020-07-09 13:28:07 +00:00
Emmanuele Bassi
5da21ca4dc Use depth=1 for cloning sub-projects
We don't really need the full history and branches when building
sub-projects.

This should shave some bandwidth and time in our CI pipeline as well.
2020-07-09 14:07:14 +01:00
Matthias Clasen
3e16ef33b0 Merge branch 'fix-levelbar-layout' into 'master'
levelbar: Chainup to parent buildable when handling custom tags

See merge request GNOME/gtk!2200
2020-07-09 11:42:33 +00:00
Matthias Clasen
2746a2d929 filechooser: Drop the ::selection-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 02:06:31 -04: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
911ae64931 filechoosernative: Update docs
Remove mention of things that are no longer
in the filechooser api.
2020-07-09 01:44:09 -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
f3744c991a Cosmetics 2020-07-09 01:02:21 -04:00
Matthias Clasen
dcee15c0f1 filechooser: Drop gtk_file_chooser_[un]select_file
Most use cases for these apis can be handled with
gtk_file_chooser_set_file and/or
gtk_file_chooser_set_current_folder.
2020-07-09 00:50:03 -04:00
Matthias Clasen
2321e9de05 filechooser: Drop gtk_file_chooser_[un]_select_all
For now, we just remove them as public api, they are
still used internally.
2020-07-09 00:50:03 -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
0f8bc67a98 docs: Add gtk_file_chooser_get_shortcut_folders 2020-07-09 00:50:03 -04:00
Matthias Clasen
379d830123 Merge branch 'printing-portal-fix-master' into 'master'
Remember to call print_cb even if print operation is cancelled.

Closes #2917

See merge request GNOME/gtk!2211
2020-07-09 04:40:34 +00:00
Matthias Clasen
bc8bc68b80 Add a suppression file for asan
This can be used similar to valgrind suppressions:

LSAN_OPTIONS=suppressions=`pwd`/lsan.supp meson  tests -Cbuild
2020-07-09 00:33:35 -04:00
Matthias Clasen
8c4df51a14 tests: Plug some more memory leaks
These showed up under asan.
2020-07-09 00:33:14 -04:00
Matthias Clasen
06d67d2384 cups: Plug a memory leak
This showed up under asan.
2020-07-09 00:32:17 -04:00
Casey Jao
cc8bb5fc54 Remember to call print_cb even if print operation is cancelled.
Closes #2917.
2020-07-08 23:32:43 -04:00
Matthias Clasen
8fb1e33d0f Merge branch 'matthiasc/for-master' into 'master'
directorylist: Fix file monitoring implementation

See merge request GNOME/gtk!2209
2020-07-09 02:08:53 +00:00
Matthias Clasen
0dc946da63 testsuite: Assorted leak fixes
All found by asan.
2020-07-08 17:44:49 -04:00
Matthias Clasen
26a23d3e56 shortcuttrigger: Fix some leaks in error paths
Found while running the testsuite under asan.
2020-07-08 17:44:42 -04:00
Matthias Clasen
766f4bc8fe css: Fix some memory leaks in error paths
Found while running the testsuite under asan.
2020-07-08 17:44:36 -04:00
Matthias Clasen
3d008d5929 picture: Don't leak alternative-test
This leak showed up while running the testsuite
under asan.
2020-07-08 17:44:29 -04:00
Matthias Clasen
0546e26434 bookmarklist: Don't leak uris
This leak showed up in multiple places while
running the testsuite under asan.
2020-07-08 17:44:23 -04:00
Matthias Clasen
e6d8eedc00 testsuite: Fix a memory leak in the bitmask tests
This was showing up when running under asan.
2020-07-08 17:44:16 -04:00
Matthias Clasen
13b37b0ba4 gsk: Fix a transform leak
This was found by running our testsuite under asan.
2020-07-08 17:44:08 -04:00
Matthias Clasen
779c71b66d testsuite: Fix some memory leaks reported by asan 2020-07-08 15:09:13 -04:00
Matthias Clasen
8e73d007f5 testsuite: Fix an asan error
asan complains that some of the memorytexture tests
read past limits. Avoid that.
2020-07-08 15:09:08 -04:00
Matthias Clasen
e376d638fb directorylist: Fix file monitoring implementation
The while loops were never advancing the iterator.
Oops.
2020-07-08 15:08:53 -04:00
Yuri Chornoivan
52982a88aa Update Ukrainian translation 2020-07-08 18:28:01 +00:00
Baurzhan Muftakhidinov
422c1d9c0d Update Kazakh translation 2020-07-08 17:44:28 +00:00
Daniel Șerbănescu
ccc8ad8700 Update Romanian translation 2020-07-08 16:22:30 +00:00
Florentina Mușat
6b0eb970d8 Update Romanian translation 2020-07-08 16:17:12 +00:00
Florentina Mușat
775e35865c Update Romanian translation 2020-07-08 08:33:20 +00:00
Matthias Clasen
49ce680d53 Merge branch 'directorylist-monitor' into 'master'
directorylist: Add monitoring

See merge request GNOME/gtk!2207
2020-07-08 02:25:46 +00:00
Matthias Clasen
463f3d3a52 directorylist: Add monitoring
Add a GtkDirectoryList:monitored property, and
keep a file monitor if it is set to TRUE. To ensure
that the list reflects reality, we reload the directory
when monitoring is turned on after the fact. This means
that turning monitoring is expensive, while turning it
off is cheap, so we default to monitoring being on.
2020-07-07 21:21:41 -04:00
Jordi Mas
f6347f18b0 Fixes to Catalan translations 2020-07-07 20:24:24 +02:00
Yuri Chornoivan
2e959fe300 Update Ukrainian translation 2020-07-07 18:03:32 +00:00
Yuri Chornoivan
56f771ba29 Update Ukrainian translation 2020-07-07 17:55:52 +00:00
Baurzhan Muftakhidinov
32e96215b4 Update Kazakh translation 2020-07-07 17:21:22 +00:00
Matthias Clasen
86f800e11d Merge branch 'inspector-navigation' into 'master'
Inspector navigation

See merge request GNOME/gtk!2201
2020-07-07 17:04:51 +00:00
Matthias Clasen
4d371b2b16 inspector: Fix property list styling
We use dropdowns here now, so style them.

Also, avoid the swoosh when switching to the
property list, when everything shrinks.
2020-07-07 11:21:42 -04:00
Caolán McNamara
7e97c2513f gtk#767 add a way to change the application_id of a toplevel wayland GdkSurface
so LibreOffice can reuse toplevels and get the right task icons

references;
 https://gitlab.gnome.org/GNOME/gtk/-/issues/767
 https://lists.freedesktop.org/archives/wayland-devel/2019-July/040704.html
 e0d6ad1d5e
 https://bugs.documentfoundation.org/show_bug.cgi?id=125934
 https://bugzilla.redhat.com/show_bug.cgi?id=1334915
 https://bugreports.qt.io/browse/QTBUG-77182
2020-07-07 15:56:12 +01:00
Emmanuele Bassi
2bf5a150e6 Merge branch 'issue-2915' into 'master'
Issue 2915

Closes #2915

See merge request GNOME/gtk!2204
2020-07-07 11:48:07 +00:00
Emmanuele Bassi
18c87faaa5 Annotate string array
Fixes: #2915
2020-07-07 12:06:28 +01:00
Emmanuele Bassi
fdeda388bf Fix "not nullable" annotation 2020-07-07 12:03:44 +01:00
Stefano Facchini
ea2c27c640 levelbar: Chainup to parent buildable when handling custom tags
This is necessary to handle <layout> tags.
2020-07-07 09:34:00 +02:00
Matthias Clasen
dfc04a590d inspector: Reshuffle the sidebar
Move the sidebar in the object page below the
object header, for a more logical hierarchy.
2020-07-07 02:05:18 -04:00
Matthias Clasen
fe5b364675 inspector: Drop unused properties
The individual pages no longer need the object tree
to show object details, this works with the window
now.
2020-07-07 01:25:21 -04:00
Matthias Clasen
9b73c55559 Merge branch 'patch-1' into 'master'
Fix typo: Filer -> Filter

See merge request GNOME/gtk!2203
2020-07-07 05:08:19 +00:00
Matthias Clasen
0b38a0663d inspector: Add dom-like navigation controls
Maintain a stack of objects, and add ˂˅˄˃ buttons
that navigate this stack, as well as the widget
tree and list models.
2020-07-07 00:51:18 -04:00
Matthias Clasen
e5c0716293 inspector: Remove an unused field 2020-07-07 00:48:43 -04:00
Matthias Clasen
54a3293cad stack: Fix handling of GtkStackPage:visible
The stack wasn't updating its visible-child when
the stack pages visible property changes. This
showed up in the inspector, when showing the details
for a list model item.
2020-07-07 00:48:43 -04:00
Yuri Chornoivan
818287a7ce Update Ukrainian translation 2020-07-07 04:45:03 +00:00
Yuri Chornoivan
59119cd898 Fix typo: Filer -> Filter 2020-07-07 04:41:44 +00:00
Matthias Clasen
130bd5937c docs: Add guidance about list model performance
Add a section about the performance tradeoffs between
different list model implementations.
2020-07-03 09:29:19 -04:00
Jehan
2fb755e0c9 build-aux: fallback to default glib-compile-schemas & gio-querymodules.
The pkg-config variables have been added in GLib 2.62.0. Let's fallback
to default names for these tools in such case (`pkg-config` still
returns a 0 return value, but with empty output for absent variables).
2020-06-28 12:48:27 +02:00
Jehan
cd096819d8 build-aux: search various Glib/GIO utilities in .pc file.
Some distributions are renaming Glib/GIO utilities for multi-arch
reasons so pkg-config variables have been added to find the correct name
of a tool. GTK+ should use these variables instead of searching in PATH.
See glib#1796.
2020-06-28 12:46:32 +02:00
2024 changed files with 194474 additions and 206359 deletions

View File

@@ -16,11 +16,11 @@ stages:
# Common variables
variables:
COMMON_MESON_FLAGS: "--fatal-meson-warnings --werror"
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true -Dvulkan=yes"
FEATURE_FLAGS: "-Dcloudproviders=true"
MESON_TEST_TIMEOUT_MULTIPLIER: 2
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v17"
COMMON_MESON_FLAGS: "--fatal-meson-warnings -Dgtk:werror=true"
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled"
MESON_TEST_TIMEOUT_MULTIPLIER: 3
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v22"
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
DOCS_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora-docs:v19"
@@ -68,11 +68,13 @@ style-check-diff:
fedora-x86_64:
extends: .build-fedora-default
stage: build
needs: []
variables:
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
script:
- meson subprojects update
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
-Dprofiler=true
-Dsysprof=enabled
_build
- ninja -C _build
- .gitlab-ci/run-tests.sh _build x11
@@ -82,14 +84,38 @@ fedora-x86_64:
release-build:
extends: .build-fedora-default
stage: build
needs: []
variables:
EXTRA_MESON_FLAGS: "--buildtype=release"
script:
- meson subprojects update
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
_build
- ninja -C _build
- .gitlab-ci/run-tests.sh _build x11
installed-tests:
extends: .build-fedora-default
stage: build
needs: []
variables:
EXTRA_MESON_FLAGS: "--prefix=/usr --libdir=/usr/lib64 -Dinstall-tests=true"
script:
- meson subprojects update
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
_build
- ninja -C _build
- sudo ninja -C _build install
- dbus-run-session xvfb-run -a -s "-screen 0 1024x768x24"
gnome-desktop-testing-runner
--report-directory=_build/installed-tests-report/failed/
--parallel=0
gtk-4.0
artifacts:
paths:
- "_build/installed-tests-report/"
.mingw-defaults:
stage: build
tags:
@@ -109,6 +135,7 @@ release-build:
msys2-mingw64:
extends: .mingw-defaults
needs: []
variables:
MSYSTEM: "MINGW64"
CHERE_INVOKING: "yes"
@@ -139,37 +166,44 @@ msys2-mingw64:
flatpak-manual:demo:
extends: .flatpak-manual
needs: []
variables:
APPID: org.gtk.Demo4
flatpak-master:demo:
extends: .flatpak-master
needs: []
variables:
APPID: org.gtk.Demo4
flatpak-manual:widget-factory:
extends: .flatpak-manual
needs: []
variables:
APPID: org.gtk.WidgetFactory4
flatpak-master:widget-factory:
extends: .flatpak-master
needs: []
variables:
APPID: org.gtk.WidgetFactory4
flatpak-manual:icon-browser:
extends: .flatpak-manual
needs: []
variables:
APPID: org.gtk.IconBrowser4
flatpak-master:icon-browser:
extends: .flatpak-master
needs: []
variables:
APPID: org.gtk.IconBrowser4
static-scan:
image: $FEDORA_IMAGE
stage: analysis
needs: []
variables:
EXTRA_MESON_FLAGS: "--buildtype=debug"
script:
@@ -180,9 +214,27 @@ static-scan:
- _scan_build/meson-logs
allow_failure: true
# Run tests with the address sanitizer. We need to turn off introspection,
# since it is incompatible with asan
asan-build:
image: $FEDORA_IMAGE
tags: [ asan ]
stage: analysis
needs: []
variables:
script:
- CC=clang meson --buildtype=debugoptimized -Db_sanitize=address -Db_lundef=false -Dintrospection=false _build
- ninja -C _build
- .gitlab-ci/run-tests.sh _build wayland
artifacts:
paths:
- _build/meson-logs
allow_failure: true
reference:
image: $DOCS_IMAGE
stage: docs
needs: []
variables:
EXTRA_MESON_FLAGS: "--buildtype=release"
script:
@@ -198,6 +250,7 @@ reference:
pages:
stage: deploy
needs: ['reference']
script:
- mv _reference/ public/
artifacts:

0
.gitlab-ci/.lock Normal file
View File

View File

@@ -35,4 +35,13 @@ branch, as well as their available versions.
- [ ] Add the new job to `.gitlab-ci.yml` referencing the image
- [ ] Open a merge request with your changes and let it run
### Checklist for Adding a new dependency to a CI image
Our images are layered, and the base (called fedora-base) contains
all the rpm payload. Therefore, adding a new dependency is a 2-step
process:
1. [ ] Build and upload fedora-base:$version+1
1. [ ] Build and upload fedora:$version+1 based on fedora-base:version+1
[registry]: https://gitlab.gnome.org/GNOME/gtk/container_registry

View File

@@ -29,6 +29,7 @@ RUN dnf -y install \
glib2-static \
glibc-devel \
glibc-headers \
gnome-desktop-testing \
gobject-introspection-devel \
graphene-devel \
gstreamer1-devel \
@@ -41,12 +42,14 @@ RUN dnf -y install \
itstool \
json-glib-devel \
lcov \
libasan \
libattr-devel \
libepoxy-devel \
libffi-devel \
libmount-devel \
librsvg2 \
libselinux-devel \
libubsan \
libXcomposite-devel \
libXcursor-devel \
libXcursor-devel \
@@ -73,7 +76,6 @@ RUN dnf -y install \
python3-wheel \
redhat-rpm-config \
sassc \
sysprof-devel \
systemtap-sdt-devel \
vulkan-devel \
wayland-devel \

View File

@@ -1,8 +1,11 @@
FROM registry.gitlab.gnome.org/gnome/gtk/fedora-base:v19
FROM registry.gitlab.gnome.org/gnome/gtk/fedora-base:v21
# Enable sudo for wheel users
RUN sed -i -e 's/# %wheel/%wheel/' -e '0,/%wheel/{s/%wheel/# %wheel/}' /etc/sudoers
ARG HOST_USER_ID=5555
ENV HOST_USER_ID ${HOST_USER_ID}
RUN useradd -u $HOST_USER_ID -ms /bin/bash user
RUN useradd -u $HOST_USER_ID -G wheel -ms /bin/bash user
USER user
WORKDIR /home/user

View File

@@ -7,14 +7,17 @@ srcdir=$( pwd )
builddir=$1
backend=$2
# Ignore memory leaks lower in dependencies
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp
case "${backend}" in
x11)
xvfb-run -a -s "-screen 0 1024x768x24" \
xvfb-run -a -s "-screen 0 1024x768x24 -noreset" \
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=gtk:a11y \
--no-suite=gsk-compare-broadway
# Store the exit code for the CI run, but always
@@ -30,10 +33,10 @@ case "${backend}" in
export WAYLAND_DISPLAY=wayland-5
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=gtk:a11y \
--no-suite=gsk-compare-broadway
exit_code=$?
@@ -48,10 +51,10 @@ case "${backend}" in
export BROADWAY_DISPLAY=:5
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=gtk:a11y \
--no-suite=gsk-compare-opengl
# don't let Broadway failures fail the run, for now

View File

@@ -33,17 +33,29 @@ pacman --noconfirm -S --needed \
mingw-w64-$MSYS2_ARCH-gst-plugins-bad \
mingw-w64-$MSYS2_ARCH-shared-mime-info
# https://gitlab.gnome.org/GNOME/gtk/issues/2243
wget "https://gitlab.gnome.org/creiter/gitlab-ci-win32-runner-v2/raw/master/pango/mingw-w64-$MSYS2_ARCH-pango-git-1.44.7.90.ge48ae523-1-any.pkg.tar.zst"
pacman --noconfirm -U "mingw-w64-$MSYS2_ARCH-pango-git-1.44.7.90.ge48ae523-1-any.pkg.tar.zst"
# https://github.com/msys2/MINGW-packages/pull/6465
pacman --noconfirm -S --needed mingw-w64-$MSYS2_ARCH-brotli
mkdir -p _ccache
export CCACHE_BASEDIR="$(pwd)"
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
# https://gitlab.gnome.org/GNOME/gtk/-/issues/2243
# https://gitlab.gnome.org/GNOME/gtk/-/issues/3002
if ! pkg-config --atleast-version=2.65.0 glib-2.0; then
git clone https://gitlab.gnome.org/GNOME/glib.git _glib
meson setup _glib_build _glib
meson compile -C _glib_build
meson install -C _glib_build
fi
pkg-config --modversion glib-2.0
if ! pkg-config --atleast-version=1.47.0 pango; then
git clone https://gitlab.gnome.org/GNOME/pango.git _pango
meson setup _pango_build _pango
meson compile -C _pango_build
meson install -C _pango_build
fi
pkg-config --modversion pango
# Build
ccache --zero-stats
ccache --show-stats
@@ -54,9 +66,9 @@ meson \
-Dx11-backend=false \
-Dwayland-backend=false \
-Dwin32-backend=true \
-Dvulkan=no \
-Dvulkan=disabled \
-Dintrospection=false \
--werror \
-Dgtk:werror=true \
_build
unset CCACHE_DISABLE

30
AUTHORS
View File

@@ -1,5 +1,5 @@
Please do not mail any of the authors listed here
asking questions about this version of GTK+.
Please do not mail any of the authors listed here
asking questions about this version of GTK.
Original Authors
----------------
@@ -7,8 +7,8 @@ Peter Mattis <petm@xcf.berkeley.edu>
Spencer Kimball <spencer@xcf.berkeley.edu>
Josh MacDonald <jmacd@xcf.berkeley.edu>
The GTK+ Team (in alphabetical order)
-------------------------------------
The Team that build GTK 2 (in alphabetical order)
-------------------------------------------------
Shawn T. Amundson <amundson@gtk.org>
Jerome Bolliet <bolliet@gtk.org>
Damon Chaplin <damon@gtk.org>
@@ -28,11 +28,24 @@ Jay Painter <jpaint@gtk.org>
Manish Singh <manish@gtk.org>
Owen Taylor <otaylor@gtk.org>
The current team (GTK 3 and 4)
------------------------------
Jonas Ådahl <jadahl@gmail.com>
Tim Bäder <mail@baedert.org>
Emmanuele Bassi <ebassi@gnome.org>
Chun-wei Fan <fanchunwei@src.gnome.org>
Matthias Clasen <mclasen@redhat.com>
Carlos Garnacho <mrgarnacho@gmail.com>
Alexander Larsson <alexl@redhat.com>
Benjamin Otte <otte@gnome.org>
There are many others who have contributed patches; we thank them,
GTK+ is much better because of them.
GTK is much better because of them.
Over time, GTK+ has incorporated some pieces of software which
Over time, GTK has incorporated some pieces of software which
started as independent projects. We list the original authors here:
@@ -63,3 +76,8 @@ DirectFB backend
Denis Oliver Kropp
Sven Neumann
Mike Emmel
gtkparasite
-----------
Christian Hammond

332
NEWS
View File

@@ -1,3 +1,335 @@
Overview of Changes in GTK 3.99.2
=================================
* GtkEntry:
- Fix issues with Emoji insertion
- Fix issues with dnd
- Set correct hotspot for dnd icon
* GtkPasswordEntry:
- Use non-pageable memory
* GtkSearchEntry:
- Don't handle forwarded events twice
* GtkPasswordEntry:
- Add an ::activate signal
* GtkTextView:
- Fix dnd
- Improve undo state tracking
- Speed rendering in the presence of selections
- Make clickable links work again
- Fix handling of anchored children
* GtkRevealer:
- Fix clipping issues in the swing transitions
* GtkColorChooser:
- Update the default palette
* GtkFileChooser:
- Fix a crash
- Fix setting unlisted filters
* GtkFontChooser:
- Determine sample text based on font coverage
- Allow filtering by language
* GtkStack:
- Add gtk_stack_add_child
* GtkVideo:
- Make autoplay work
* CSS:
- Allow more than 64 selectors per rule
* Adwaita:
- Improve gesture graphics
- Tweak DND highlight color
- Add spacing to .navigation-sidebar
* GDK:
- Add gdk_frame_clock_get_fps
* GSK:
- Add radial gradient nodes
* GL renderer:
- Fix clipping with projective transforms
- Use linear interpolation for offscreen rendering
with non-axis-aligned transforms
- Fix texture caching to avoid size mismatches
* Vulkan renderer:
- Fix swapchain creation
* Windows:
- Fix display of CSD windows
* Wayland
- Always ack configure to avoid jumping windows
* API cleanups:
- Make filter and sorter constructors return exact types
- Rename GdkSurfaceState to GdkToplevelState
- Remove GdkWaylandSurface::committed
- Make Wayland backend api take GdkToplevel
* Demos:
- Bug and crash fixes
- Cosmetic improvements for several demos
- Improve search in the sidebar
- Add a Shadertoy demo
- Add an Emblem demo
- Add a demo for input validation and error states
- Add a demo for context menus
- Make gtk-demo demo itself
* Build:
- Fix Vulkan dependency checking
- Make sysprof truly optional
* Translation updates:
Basque
British English
Catalan
Croatian
Czech
Danish
French
Galician
German
Hungarian
Indonesian
Italian
Kazakh
Latvian
Lithuanian
Persian
Polish
Slovak
Slovenian
Spanish
Turkish
Ukrainian
Overview of Changes in GTK 3.99.1
=================================
* GtkGridLayout: Rename left-/top-attach to column/row
* Drop GtkAccelLabel - it is no longer used
* GtkTextView:
- Fix redraw issues with selections
- Make insert-emoji replace the selection
* GtkTreeView:
- Fix selection handling in cell editables
* GtkPopover:
- Allow setting popup offset
* GtkPlacesSidebar:
- Fix DND
* GtkTextview:
- Speed up gtk_text_buffer_insert_markup
* GtkFrame:
- Set GTK_OVERFLOW_HIDDEN
* GtkSpinButton:
- Fix spinning
* GtkFontChooser:
- Populate the list incrementally
* GtkButton: Simplify the button hierarchy; GtkRadioButton
is gone, GtkCheckButton and GtkToggleButton can be grouped
* list widgets:
- Change apis to make models explicitly GtkSelectionModel
- Simplify constructors
* CSS:
- Hexadecimal colors can now specify alpha
- Fix parsing of numbers in scientific notation
* Themes:
- Add and document highlevel list styles
- Drop the style class defines. Just use string literals
- Round the corners of frames
- Make circular buttons square
* GL renderer:
- Fix clipping with projective transforms
* Documentation:
- Refresh the widget gallery
- Add images for new widgets to the gallery
- Fix many cross-references
- Make sure tutorial examples are buildable
* Demos:
- Numerous crash- and bug fixes
- Improve about dialogs
- gtk4-demo: Modernize source highlighting
- gtk4-demo: Improve sidebar filtering
- gtk4-demo: Drop some outdated demos
- gtk4-demo: Polish a number of existing demos
- gtk4-demo: Add several new demos
- widget-factory: Show error states
* Tools:
- Make gtk4-builder-tool rewrite GtkBox
- Make gtk4-builder-tool rewrite radio buttons
- Rewrite the profiling support, drop support
for D-Bus profiler activation, use SYSPROF_TRACE_FD
* Printing:
- Fix build with cups < 2.3
* win32:
- Default to the GL renderer when we can
* Broadway:
- Fix handling of opaque colors
- Fix handling of debug nodes
- Prune clipped render nodes
* Wayland:
- Support newer schemas for settings
- Fix DND hotspot handling
- Disconnect on display close
* Translation updates:
Basque
Brazilian Portuguese
British English
Catalan
Chinese (China)
Croatian
Galician
German
Greek
Indonesian
Japanese
Kazakh
Korean
Lithuanian
Polish
Romanian
Slovenian
Spanish
Turkish
Ukrainian
Overview of Changes in GTK 3.99.0
=================================
* Remove the old accessibility implementation and
add the foundations for a new one that is based
on ARIA. The relevant widget api is GtkAccessible,
the backend implementations will use GtkATContext.
Currently, there is just a nascent test backend.
* Update the GTK headers to use char *, int, float and
double instead of the corresponding GLib types.
* Add GtkEditableLabel, a label that can be edited
* Add GtkBookmarkList, a list model for bookmarks
* Add GtkStringList, a list model for strings
* Add GtkBitset, and use it for representing selections
* GtkTreeView:
- Make cell editing work again
* GtkSpinButton:
- Make autosizing work again
* Printing:
- Use GtkDropDown in the print dialog
* GtkApplication
- Support opening files on OS X
* GtkFileChooser:
- Fix libcloudproviders support
- Turn GtkFileFilter into a GtkFilter
- Simplify the api
* GtkGridView, GtkListView:
- Improve scrolling behavior
- Autoscroll and autoexpand during DND
* GtkScrolledWindow:
- Make autoscrolling work again
* GtkFilterListModel:
- Add incremental filtering
- Add a boolean filter, GtkBoolFilter
* GtkSortListModel:
- Use timsort
- Add various tweaks that massively speed up sorting
- Add incremental sorting
* GtkWidget:
- Massively speed up action handling
* GtkEntry:
- Make entry completion work again
- Drop action support from GtkEntryCompletion
* Inspector:
- Improve list model support
- Add direct navigation between objects
- Show accessibility information
* GDK:
- Compress scroll events
- Keep a scroll history
- Clean up GdkDevice api
- Drop the master/slave device split
- Move axes to GdkDeviceTool
- Change monitor workarea to be per-backend API
- Improve frame clock accuracy
- Add a new macOS backend
- Add an ANGLE-based GLES renderer for Windows
* GSK:
- Use GL_ARB_framebuffer_object
* gtk-demo:
- Add incremental refill to the color grid
- Improve performance of the color grid
- Add an incrementally filtering word list
- Improve the sidebar
* Install print-editor as another demo
* Translation updates
Basque
Catalan
Chinese
Japanese
Kazakh
Lithuanian
Polish
Romanian
Spanish
Turkish
Ukrainian
Overview of Changes in GTK 3.98.5
=================================

View File

@@ -1,7 +1,7 @@
GTK — The GTK toolkit
=====================
[![Build Status](https://gitlab.gnome.org/GNOME/gtk/badges/master/build.svg)](https://gitlab.gnome.org/GNOME/gtk/pipelines)
[![Build status](https://gitlab.gnome.org/GNOME/gtk/badges/master/pipeline.svg)](https://gitlab.gnome.org/GNOME/gtk/-/commits/master)
General information
-------------------
@@ -56,7 +56,6 @@ building for:
- [Pango](https://download.gnome.org/sources/pango)
- [Epoxy](https://github.com/anholt/libepoxy)
- [Graphene](https://github.com/ebassi/graphene)
- [ATK](https://download.gnome.org/sources/atk)
- [Xkb-common](https://github.com/xkbcommon/libxkbcommon)
If you are building the X11 backend, you will also need:
@@ -70,7 +69,6 @@ If you are building the X11 backend, you will also need:
- xcursor
- xdamage
- xcomposite
- [atk-bridge-2.0](https://download.gnome.org/sources/at-spi2-atk)
If you are building the Wayland backend, you will also need:
@@ -100,7 +98,7 @@ And, finally, you can install GTK using:
$ sudo ninja install
```
Complete information about installing GTK+ and related libraries
Complete information about installing GTK and related libraries
can be found in the file:
```
@@ -163,3 +161,7 @@ version 2.1 or, at your option, any later version, as published by the Free
Software Foundation.
Please, see the [`COPYING`](./COPYING) file for further information.
GTK includes a small number of source files under the Apache license:
- A fork of the roaring bitmaps implementation in [gtk/roaring](./gtk/roaring)
- An adaptation of timsort from python in [gtk/timsort](./gtk/timsort)

View File

@@ -1,29 +1,38 @@
{
"app-id": "org.gtk.Demo4",
"runtime": "org.gnome.Platform",
"runtime-version": "master",
"sdk": "org.gnome.Sdk",
"command": "gtk4-demo",
"tags": ["devel", "development", "nightly"],
"desktop-file-name-prefix": "(Development) ",
"finish-args": [
"app-id" : "org.gtk.Demo4",
"runtime" : "org.gnome.Platform",
"runtime-version" : "master",
"sdk" : "org.gnome.Sdk",
"command" : "gtk4-demo",
"tags" : [
"devel",
"development",
"nightly"
],
"desktop-file-name-prefix" : "(Development) ",
"finish-args" : [
"--device=dri",
"--share=ipc",
"--socket=fallback-x11",
"--socket=wayland",
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*"
"--talk-name=org.gtk.vfs",
"--talk-name=org.gtk.vfs.*"
],
"cleanup": [
"cleanup" : [
"/include",
"/lib/pkgconfig", "/share/pkgconfig",
"/lib/pkgconfig",
"/share/pkgconfig",
"/share/aclocal",
"/man", "/share/man", "/share/gtk-doc",
"*.la", ".a",
"/man",
"/share/man",
"/share/gtk-doc",
"*.la",
".a",
"/lib/girepository-1.0",
"/share/gir-1.0",
"/share/doc"
],
"modules": [
"modules" : [
{
"name" : "wayland",
"buildsystem" : "autotools",
@@ -39,18 +48,18 @@
]
},
{
"name": "graphene",
"buildsystem": "meson",
"builddir": true,
"config-opts": [
"name" : "graphene",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dtests=false",
"-Dbenchmarks=false"
],
"sources": [
"sources" : [
{
"type": "git",
"url": "https://github.com/ebassi/graphene.git"
"type" : "git",
"url" : "https://github.com/ebassi/graphene.git"
}
]
},
@@ -58,7 +67,7 @@
"name" : "libsass",
"buildsystem" : "meson",
"builddir" : true,
"config-opts": [
"config-opts" : [
"--libdir=/app/lib"
],
"sources" : [
@@ -73,7 +82,7 @@
"name" : "sassc",
"buildsystem" : "meson",
"builddir" : true,
"config-opts": [
"config-opts" : [
"--libdir=/app/lib"
],
"sources" : [
@@ -85,18 +94,25 @@
]
},
{
"name": "gtk",
"buildsystem": "meson",
"builddir": true,
"config-opts": [
"--libdir=/app/lib"
"name" : "gtk",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Denable_vulkan=no",
"-Dbuildtype=debugoptimized"
],
"sources": [
"sources" : [
{
"type": "git",
"url": "https://gitlab.gnome.org/GNOME/gtk.git"
"type" : "git",
"url" : "https://gitlab.gnome.org/GNOME/gtk.git"
}
]
}
]
],
"build-options" : {
"env" : {
"GSK_RENDERER" : "opengl"
}
}
}

View File

@@ -1,29 +1,38 @@
{
"app-id": "org.gtk.IconBrowser4",
"runtime": "org.gnome.Platform",
"runtime-version": "master",
"sdk": "org.gnome.Sdk",
"command": "gtk4-icon-browser",
"tags": ["devel", "development", "nightly"],
"desktop-file-name-prefix": "(Development) ",
"finish-args": [
"app-id" : "org.gtk.IconBrowser4",
"runtime" : "org.gnome.Platform",
"runtime-version" : "master",
"sdk" : "org.gnome.Sdk",
"command" : "gtk4-icon-browser",
"tags" : [
"devel",
"development",
"nightly"
],
"desktop-file-name-prefix" : "(Development) ",
"finish-args" : [
"--device=dri",
"--share=ipc",
"--socket=fallback-x11",
"--socket=wayland",
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*"
"--talk-name=org.gtk.vfs",
"--talk-name=org.gtk.vfs.*"
],
"cleanup": [
"cleanup" : [
"/include",
"/lib/pkgconfig", "/share/pkgconfig",
"/lib/pkgconfig",
"/share/pkgconfig",
"/share/aclocal",
"/man", "/share/man", "/share/gtk-doc",
"*.la", ".a",
"/man",
"/share/man",
"/share/gtk-doc",
"*.la",
".a",
"/lib/girepository-1.0",
"/share/gir-1.0",
"/share/doc"
],
"modules": [
"modules" : [
{
"name" : "wayland",
"buildsystem" : "autotools",
@@ -39,18 +48,18 @@
]
},
{
"name": "graphene",
"buildsystem": "meson",
"builddir": true,
"config-opts": [
"name" : "graphene",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dtests=false",
"-Dbenchmarks=false"
],
"sources": [
"sources" : [
{
"type": "git",
"url": "https://github.com/ebassi/graphene.git"
"type" : "git",
"url" : "https://github.com/ebassi/graphene.git"
}
]
},
@@ -58,7 +67,7 @@
"name" : "libsass",
"buildsystem" : "meson",
"builddir" : true,
"config-opts": [
"config-opts" : [
"--libdir=/app/lib"
],
"sources" : [
@@ -73,7 +82,7 @@
"name" : "sassc",
"buildsystem" : "meson",
"builddir" : true,
"config-opts": [
"config-opts" : [
"--libdir=/app/lib"
],
"sources" : [
@@ -85,18 +94,24 @@
]
},
{
"name": "gtk",
"buildsystem": "meson",
"builddir": true,
"config-opts": [
"--libdir=/app/lib"
"name" : "gtk",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Denable_vulkan=no",
"-Dbuildtype=debugoptimized"
],
"sources": [
"sources" : [
{
"type": "git",
"url": "https://gitlab.gnome.org/GNOME/gtk.git"
"type" : "git",
"url" : "https://gitlab.gnome.org/GNOME/gtk.git"
}
]
}
]
],
"build-options" : {
"env" : {
}
}
}

View File

@@ -1,29 +1,38 @@
{
"app-id": "org.gtk.WidgetFactory4",
"runtime": "org.gnome.Platform",
"runtime-version": "master",
"sdk": "org.gnome.Sdk",
"command": "gtk4-widget-factory",
"tags": ["devel", "development", "nightly"],
"desktop-file-name-prefix": "(Development) ",
"finish-args": [
"app-id" : "org.gtk.WidgetFactory4",
"runtime" : "org.gnome.Platform",
"runtime-version" : "master",
"sdk" : "org.gnome.Sdk",
"command" : "gtk4-widget-factory",
"tags" : [
"devel",
"development",
"nightly"
],
"desktop-file-name-prefix" : "(Development) ",
"finish-args" : [
"--device=dri",
"--share=ipc",
"--socket=fallback-x11",
"--socket=wayland",
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*"
"--talk-name=org.gtk.vfs",
"--talk-name=org.gtk.vfs.*"
],
"cleanup": [
"cleanup" : [
"/include",
"/lib/pkgconfig", "/share/pkgconfig",
"/lib/pkgconfig",
"/share/pkgconfig",
"/share/aclocal",
"/man", "/share/man", "/share/gtk-doc",
"*.la", ".a",
"/man",
"/share/man",
"/share/gtk-doc",
"*.la",
".a",
"/lib/girepository-1.0",
"/share/gir-1.0",
"/share/doc"
],
"modules": [
"modules" : [
{
"name" : "wayland",
"buildsystem" : "autotools",
@@ -39,18 +48,18 @@
]
},
{
"name": "graphene",
"buildsystem": "meson",
"builddir": true,
"config-opts": [
"name" : "graphene",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dtests=false",
"-Dbenchmarks=false"
],
"sources": [
"sources" : [
{
"type": "git",
"url": "https://github.com/ebassi/graphene.git"
"type" : "git",
"url" : "https://github.com/ebassi/graphene.git"
}
]
},
@@ -58,7 +67,7 @@
"name" : "libsass",
"buildsystem" : "meson",
"builddir" : true,
"config-opts": [
"config-opts" : [
"--libdir=/app/lib"
],
"sources" : [
@@ -73,7 +82,7 @@
"name" : "sassc",
"buildsystem" : "meson",
"builddir" : true,
"config-opts": [
"config-opts" : [
"--libdir=/app/lib"
],
"sources" : [
@@ -85,18 +94,28 @@
]
},
{
"name": "gtk",
"buildsystem": "meson",
"builddir": true,
"config-opts": [
"--libdir=/app/lib"
"name" : "gtk",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Denable_vulkan=no",
"-Dbuildtype=debugoptimized"
],
"sources": [
"sources" : [
{
"type": "git",
"url": "https://gitlab.gnome.org/GNOME/gtk.git"
"type" : "git",
"url" : "https://gitlab.gnome.org/GNOME/gtk.git"
}
]
}
]
],
"build-options" : {
"env" : {
"DBUS_SESSION_BUS_ADDRESS" : "''",
"GSK_RENDERER" : "opengl",
"GDK_DEBUG" : "vulkan-disable",
"G_ENABLE_DEBUG" : "true"
}
}
}

View File

@@ -15,7 +15,13 @@ if 'DESTDIR' not in os.environ:
gtk_immodule_dir = os.path.join(gtk_moduledir, 'immodules')
print('Compiling GSettings schemas...')
subprocess.call(['glib-compile-schemas',
glib_compile_schemas = subprocess.check_output(['pkg-config',
'--variable=glib_compile_schemas',
'gio-2.0']).strip()
if not os.path.exists(glib_compile_schemas):
# pkg-config variables only available since GLib 2.62.0.
glib_compile_schemas = 'glib-compile-schemas'
subprocess.call([glib_compile_schemas,
os.path.join(gtk_datadir, 'glib-2.0', 'schemas')])
print('Updating icon cache...')
@@ -24,8 +30,14 @@ if 'DESTDIR' not in os.environ:
print('Updating module cache for print backends...')
os.makedirs(gtk_printmodule_dir, exist_ok=True)
subprocess.call(['gio-querymodules', gtk_printmodule_dir])
gio_querymodules = subprocess.check_output(['pkg-config',
'--variable=gio_querymodules',
'gio-2.0']).strip()
if not os.path.exists(gio_querymodules):
# pkg-config variables only available since GLib 2.62.0.
gio_querymodules = 'gio-querymodules'
subprocess.call([gio_querymodules, gtk_printmodule_dir])
print('Updating module cache for input methods...')
os.makedirs(gtk_immodule_dir, exist_ok=True)
subprocess.call(['gio-querymodules', gtk_immodule_dir])
subprocess.call([gio_querymodules, gtk_immodule_dir])

View File

@@ -69,6 +69,9 @@
/* Define to 1 if you have the `mkstemp' function. */
#mesondefine HAVE_MKSTEMP
/* Define to 1 if you have the `mlock` function. */
#mesondefine HAVE_MLOCK
/* Define to 1 if you have a working `mmap' system call. */
#mesondefine HAVE_MMAP
@@ -103,7 +106,7 @@
#mesondefine HAVE_SYS_PARAM_H
/* Have the sysprof-capture library */
#mesondefine HAVE_SYSPROF_CAPTURE
#mesondefine HAVE_SYSPROF
/* Define to 1 if you have the <sys/stat.h> header file. */
#mesondefine HAVE_SYS_STAT_H

View File

@@ -81,11 +81,11 @@ constraint_editor_application_activate (GApplication *app)
static void
constraint_editor_application_open (GApplication *app,
GFile **files,
gint n_files,
const gchar *hint)
int n_files,
const char *hint)
{
ConstraintEditorWindow *win;
gint i;
int i;
for (i = 0; i < n_files; i++)
{

View File

@@ -193,7 +193,7 @@ constraint_editor_window_load (ConstraintEditorWindow *self,
static void
open_response_cb (GtkNativeDialog *dialog,
gint response,
int response,
ConstraintEditorWindow *self)
{
gtk_native_dialog_hide (dialog);
@@ -285,7 +285,7 @@ serialize_model (GListModel *list)
static void
save_response_cb (GtkNativeDialog *dialog,
gint response,
int response,
ConstraintEditorWindow *self)
{
gtk_native_dialog_hide (dialog);

View File

@@ -13,8 +13,8 @@
<object class="GtkLabel">
<property name="label">Target</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
@@ -23,8 +23,8 @@
<signal name="changed" handler="update_preview" swapped="yes"/>
<signal name="changed" handler="update_button" swapped="yes"/>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
<property name="column">1</property>
<property name="row">1</property>
</layout>
</object>
</child>
@@ -32,8 +32,8 @@
<object class="GtkComboBoxText" id="target_attr">
<signal name="changed" handler="update_preview" swapped="yes"/>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
<property name="column">2</property>
<property name="row">1</property>
</layout>
</object>
</child>
@@ -41,8 +41,8 @@
<object class="GtkLabel">
<property name="label">Relation</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
<property name="column">0</property>
<property name="row">2</property>
</layout>
</object>
</child>
@@ -50,8 +50,8 @@
<object class="GtkComboBoxText" id="relation">
<signal name="changed" handler="update_preview" swapped="yes"/>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
<property name="column">1</property>
<property name="row">2</property>
</layout>
</object>
</child>
@@ -59,8 +59,8 @@
<object class="GtkLabel">
<property name="label">Source</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="column">0</property>
<property name="row">3</property>
</layout>
</object>
</child>
@@ -69,8 +69,8 @@
<signal name="changed" handler="update_preview" swapped="yes"/>
<signal name="changed" handler="update_button" swapped="yes"/>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
<property name="column">1</property>
<property name="row">3</property>
</layout>
</object>
</child>
@@ -79,8 +79,8 @@
<signal name="changed" handler="update_preview" swapped="yes"/>
<signal name="changed" handler="source_attr_changed" swapped="yes"/>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">3</property>
<property name="column">2</property>
<property name="row">3</property>
</layout>
</object>
</child>
@@ -88,8 +88,8 @@
<object class="GtkLabel">
<property name="label">Multiplier</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">4</property>
<property name="column">0</property>
<property name="row">4</property>
</layout>
</object>
</child>
@@ -97,8 +97,8 @@
<object class="GtkEntry" id="multiplier">
<signal name="changed" handler="update_preview" swapped="yes"/>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">4</property>
<property name="column">1</property>
<property name="row">4</property>
</layout>
</object>
</child>
@@ -106,8 +106,8 @@
<object class="GtkLabel">
<property name="label">Constant</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">5</property>
<property name="column">0</property>
<property name="row">5</property>
</layout>
</object>
</child>
@@ -115,8 +115,8 @@
<object class="GtkEntry" id="constant">
<signal name="changed" handler="update_preview" swapped="yes"/>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">5</property>
<property name="column">1</property>
<property name="row">5</property>
</layout>
</object>
</child>
@@ -124,16 +124,16 @@
<object class="GtkLabel">
<property name="label">Strength</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">6</property>
<property name="column">0</property>
<property name="row">6</property>
</layout>
</object>
</child>
<child>
<object class="GtkComboBoxText" id="strength">
<layout>
<property name="left-attach">1</property>
<property name="top-attach">6</property>
<property name="column">1</property>
<property name="row">6</property>
</layout>
</object>
</child>
@@ -141,8 +141,8 @@
<object class="GtkLabel" id="preview">
<property name="xalign">0</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">7</property>
<property name="column">1</property>
<property name="row">7</property>
<property name="column-span">2</property>
</layout>
<attributes>
@@ -155,8 +155,8 @@
<property name="label">Create</property>
<signal name="clicked" handler="create_constraint"/>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">8</property>
<property name="column">2</property>
<property name="row">8</property>
</layout>
</object>
</child>

View File

@@ -174,28 +174,25 @@ constraint_view_init (ConstraintView *self)
manager = gtk_constraint_layout_new ();
gtk_widget_set_layout_manager (GTK_WIDGET (self), manager);
all_children = gtk_widget_observe_children (GTK_WIDGET (self));
all_constraints = gtk_constraint_layout_observe_constraints (GTK_CONSTRAINT_LAYOUT (manager));
guides = gtk_constraint_layout_observe_guides (GTK_CONSTRAINT_LAYOUT (manager));
filter = gtk_custom_filter_new (omit_internal, NULL, NULL);
all_constraints = gtk_constraint_layout_observe_constraints (GTK_CONSTRAINT_LAYOUT (manager));
filter = GTK_FILTER (gtk_custom_filter_new (omit_internal, NULL, NULL));
constraints = (GListModel *)gtk_filter_list_model_new (all_constraints, filter);
g_object_unref (filter);
filter = gtk_custom_filter_new (omit_internal, NULL, NULL);
all_children = gtk_widget_observe_children (GTK_WIDGET (self));
filter = GTK_FILTER (gtk_custom_filter_new (omit_internal, NULL, NULL));
children = (GListModel *)gtk_filter_list_model_new (all_children, filter);
g_object_unref (filter);
list = g_list_store_new (G_TYPE_LIST_MODEL);
g_list_store_append (list, children);
g_list_store_append (list, guides);
g_list_store_append (list, constraints);
self->model = G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (list)));
g_object_unref (children);
g_object_unref (guides);
g_object_unref (constraints);
g_object_unref (all_children);
g_object_unref (all_constraints);
g_object_unref (list);
self->model = G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (list)));
controller = (GtkEventController *)gtk_gesture_drag_new ();
g_signal_connect (controller, "drag-begin", G_CALLBACK (drag_begin), self);

View File

@@ -55,8 +55,8 @@
<object class="GtkLabel">
<property name="label">Name</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
<property name="column">0</property>
<property name="row">0</property>
</layout>
</object>
</child>
@@ -64,8 +64,8 @@
<object class="GtkEntry" id="name">
<property name="max-width-chars">20</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
<property name="column">1</property>
<property name="row">0</property>
<property name="column-span">2</property>
</layout>
</object>
@@ -74,8 +74,8 @@
<object class="GtkLabel">
<property name="label">Min Size</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
@@ -84,8 +84,8 @@
<property name="adjustment">min_width_adj</property>
<property name="max-width-chars">5</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
<property name="column">1</property>
<property name="row">1</property>
</layout>
</object>
</child>
@@ -94,8 +94,8 @@
<property name="adjustment">min_height_adj</property>
<property name="max-width-chars">5</property>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
<property name="column">2</property>
<property name="row">1</property>
</layout>
</object>
</child>
@@ -103,8 +103,8 @@
<object class="GtkLabel">
<property name="label">Nat Size</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
<property name="column">0</property>
<property name="row">2</property>
</layout>
</object>
</child>
@@ -113,8 +113,8 @@
<property name="adjustment">nat_width_adj</property>
<property name="max-width-chars">5</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
<property name="column">1</property>
<property name="row">2</property>
</layout>
</object>
</child>
@@ -123,8 +123,8 @@
<property name="adjustment">nat_height_adj</property>
<property name="max-width-chars">5</property>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">2</property>
<property name="column">2</property>
<property name="row">2</property>
</layout>
</object>
</child>
@@ -132,8 +132,8 @@
<object class="GtkLabel">
<property name="label">Max Size</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="column">0</property>
<property name="row">3</property>
</layout>
</object>
</child>
@@ -142,8 +142,8 @@
<property name="adjustment">max_width_adj</property>
<property name="max-width-chars">5</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
<property name="column">1</property>
<property name="row">3</property>
</layout>
</object>
</child>
@@ -152,8 +152,8 @@
<property name="adjustment">max_height_adj</property>
<property name="max-width-chars">5</property>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">3</property>
<property name="column">2</property>
<property name="row">3</property>
</layout>
</object>
</child>
@@ -161,16 +161,16 @@
<object class="GtkLabel">
<property name="label">Strength</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">4</property>
<property name="column">0</property>
<property name="row">4</property>
</layout>
</object>
</child>
<child>
<object class="GtkComboBoxText" id="strength">
<layout>
<property name="left-attach">1</property>
<property name="top-attach">4</property>
<property name="column">1</property>
<property name="row">4</property>
<property name="column-span">2</property>
</layout>
</object>
@@ -180,8 +180,8 @@
<property name="label">Create</property>
<signal name="clicked" handler="create_guide"/>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">5</property>
<property name="column">2</property>
<property name="row">5</property>
</layout>
</object>
</child>

View File

@@ -0,0 +1,345 @@
// Originally from: https://www.shadertoy.com/view/wsjBD3
// License CC0: A battered alien planet
// Been experimenting with space inspired shaders
#define PI 3.141592654
#define TAU (2.0*PI)
#define TOLERANCE 0.00001
#define MAX_ITER 65
#define MIN_DISTANCE 0.01
#define MAX_DISTANCE 9.0
const vec3 skyCol1 = vec3(0.35, 0.45, 0.6);
const vec3 skyCol2 = vec3(0.4, 0.7, 1.0);
const vec3 skyCol3 = pow(skyCol1, vec3(0.25));
const vec3 sunCol1 = vec3(1.0,0.6,0.4);
const vec3 sunCol2 = vec3(1.0,0.9,0.7);
const vec3 smallSunCol1 = vec3(1.0,0.5,0.25)*0.5;
const vec3 smallSunCol2 = vec3(1.0,0.5,0.25)*0.5;
const vec3 mountainColor = 1.0*sqrt(vec3(0.95, 0.65, 0.45));
const float cellWidth = 1.0;
const vec4 planet = vec4(80.0, -20.0, 100.0, 50.0)*1000.0;
void rot(inout vec2 p, float a) {
float c = cos(a);
float s = sin(a);
p = vec2(p.x*c + p.y*s, -p.x*s + p.y*c);
}
vec2 mod2(inout vec2 p, vec2 size) {
vec2 c = floor((p + size*0.5)/size);
p = mod(p + size*0.5,size) - size*0.5;
return c;
}
float circle(vec2 p, float r) {
return length(p) - r;
}
float egg(vec2 p, float ra, float rb) {
const float k = sqrt(3.0);
p.x = abs(p.x);
float r = ra - rb;
return ((p.y<0.0) ? length(vec2(p.x, p.y )) - r :
(k*(p.x+r)<p.y) ? length(vec2(p.x, p.y-k*r)) :
length(vec2(p.x+r,p.y )) - 2.0*r) - rb;
}
vec2 hash(vec2 p) {
p = vec2(dot (p, vec2 (127.1, 311.7)), dot (p, vec2 (269.5, 183.3)));
return -1. + 2.*fract (sin (p)*43758.5453123);
}
vec2 raySphere(vec3 ro, vec3 rd, vec4 sphere) {
vec3 center = sphere.xyz;
float radius = sphere.w;
vec3 m = ro - center.xyz;
float b = dot(m, rd);
float c = dot(m, m) - radius*radius;
if(c > 0.0 && b > 0.0) return vec2(-1.0, -1.0);
float discr = b * b - c;
if(discr < 0.0) return vec2(-1.0);
float normalMultiplier = 1.0;
float s = sqrt(discr);
float t0 = -b - s;
float t1 = -b + s;;
return vec2(t0, t1);
}
float noise1(vec2 p) {
vec2 n = mod2(p, vec2(cellWidth));
vec2 hh = hash(sqrt(2.0)*(n+1000.0));
hh.x *= hh.y;
float r = 0.225*cellWidth;
float d = circle(p, 2.0*r);
float h = hh.x*smoothstep(0.0, r, -d);
return h*0.25;
}
float noise2(vec2 p) {
vec2 n = mod2(p, vec2(cellWidth));
vec2 hh = hash(sqrt(2.0)*(n+1000.0));
hh.x *= hh.y;
rot(p, TAU*hh.y);
float r = 0.45*cellWidth;
// float d = circle(p, 1.0*r);
float d = egg(p, 0.75*r, 0.5*r*abs(hh.y));
float h = (hh.x)*smoothstep(0.0, r, -2.0*d);
return h*0.275;
}
float height(vec2 p, float dd, int mx) {
const float aa = 0.45;
const float ff = 2.03;
const float tt = 1.2;
const float oo = 3.93;
const float near = 0.25;
const float far = 0.65;
float a = 1.0;
float o = 0.2;
float s = 0.0;
float d = 0.0;
int i = 0;
for (; i < 4;++i) {
float nn = a*noise2(p);
s += nn;
d += abs(a);
p += o;
a *= aa;
p *= ff;
o *= oo;
rot(p, tt);
}
float lod = s/d;
float rdd = dd/MAX_DISTANCE;
mx = int(mix(float(4), float(mx), step(rdd, far)));
for (; i < mx; ++i) {
float nn = a*noise1(p);
s += nn;
d += abs(a);
p += o;
a *= aa;
p *= ff;
o *= oo;
rot(p, tt);
}
float hid = (s/d);
return mix(hid, lod, smoothstep(near, far, rdd));
}
float loheight(vec2 p, float d) {
return height(p, d, 0);
}
float height(vec2 p, float d) {
return height(p, d, 6);
}
float hiheight(vec2 p, float d) {
return height(p, d, 8);
}
vec3 normal(vec2 p, float d) {
vec2 eps = vec2(0.00125, 0.0);
vec3 n;
n.x = (hiheight(p - eps.xy, d) - hiheight(p + eps.xy, d));
n.y = 2.0*eps.x;
n.z = (hiheight(p - eps.yx, d) - hiheight(p + eps.yx, d));
return normalize(n);
}
const float stepLength[] = float[](0.9, 0.25);
float march(vec3 ro, vec3 rd, out int max_iter) {
float dt = 0.1;
float d = MIN_DISTANCE;
int currentStep = 0;
float lastd = d;
for (int i = 0; i < MAX_ITER; ++i)
{
vec3 p = ro + d*rd;
float h = height(p.xz, d);
if (d > MAX_DISTANCE) {
max_iter = i;
return MAX_DISTANCE;
}
float hd = p.y - h;
if (hd < TOLERANCE) {
++currentStep;
if (currentStep >= stepLength.length()) {
max_iter = i;
return d;
}
d = lastd;
continue;
}
float sl = stepLength[currentStep];
dt = max(hd, TOLERANCE)*sl + 0.0025*d;
lastd = d;
d += dt;
}
max_iter = MAX_ITER;
return MAX_DISTANCE;
}
vec3 sunDirection() {
return normalize(vec3(-0.5, 0.085, 1.0));
}
vec3 smallSunDirection() {
return normalize(vec3(-0.2, -0.05, 1.0));
}
float psin(float f) {
return 0.5 + 0.5*sin(f);
}
vec3 skyColor(vec3 ro, vec3 rd) {
vec3 sunDir = sunDirection();
vec3 smallSunDir = smallSunDirection();
float sunDot = max(dot(rd, sunDir), 0.0);
float smallSunDot = max(dot(rd, smallSunDir), 0.0);
float angle = atan(rd.y, length(rd.xz))*2.0/PI;
vec3 skyCol = mix(mix(skyCol1, skyCol2, max(0.0, angle)), skyCol3, clamp(-angle*2.0, 0.0, 1.0));
vec3 sunCol = 0.5*sunCol1*pow(sunDot, 20.0) + 8.0*sunCol2*pow(sunDot, 2000.0);
vec3 smallSunCol = 0.5*smallSunCol1*pow(smallSunDot, 200.0) + 8.0*smallSunCol2*pow(smallSunDot, 20000.0);
vec3 dust = pow(sunCol2*mountainColor, vec3(1.75))*smoothstep(0.05, -0.1, rd.y)*0.5;
vec2 si = raySphere(ro, rd, planet);
vec3 planetSurface = ro + si.x*rd;
vec3 planetNormal = normalize(planetSurface - planet.xyz);
float planetDiff = max(dot(planetNormal, sunDir), 0.0);
float planetBorder = max(dot(planetNormal, -rd), 0.0);
float planetLat = (planetSurface.x+planetSurface.y)*0.0005;
vec3 planetCol = mix(1.3*vec3(0.9, 0.8, 0.7), 0.3*vec3(0.9, 0.8, 0.7), pow(psin(planetLat+1.0)*psin(sqrt(2.0)*planetLat+2.0)*psin(sqrt(3.5)*planetLat+3.0), 0.5));
vec3 final = vec3(0.0);
final += step(0.0, si.x)*pow(planetDiff, 0.75)*planetCol*smoothstep(-0.075, 0.0, rd.y)*smoothstep(0.0, 0.1, planetBorder);
final += skyCol + sunCol + smallSunCol + dust;
return final;
}
vec3 getColor(vec3 ro, vec3 rd) {
int max_iter = 0;
vec3 skyCol = skyColor(ro, rd);
vec3 col = vec3(0);
float d = march(ro, rd, max_iter);
if (d < MAX_DISTANCE) {
vec3 sunDir = sunDirection();
vec3 osunDir = sunDir*vec3(-1.0, .0, -1.0);
vec3 p = ro + d*rd;
vec3 normal = normal(p.xz, d);
float amb = 0.2;
float dif1 = max(0.0, dot(sunDir, normal));
vec3 shd1 = sunCol2*mix(amb, 1.0, pow(dif1, 0.75));
float dif2 = max(0.0, dot(osunDir, normal));
vec3 shd2 = sunCol1*mix(amb, 1.0, pow(dif2, 0.75));
vec3 ref = reflect(rd, normal);
vec3 rcol = skyColor(p, ref);
col = mountainColor*amb*skyCol3;
col += mix(shd1, shd2, -0.5)*mountainColor;
float fre = max(dot(normal, -rd), 0.0);
fre = pow(1.0 - fre, 5.0);
col += rcol*fre*0.5;
col += (1.0*p.y);
col = tanh(col);
col = mix(col, skyCol, smoothstep(0.5*MAX_DISTANCE, 1.0*MAX_DISTANCE, d));
} else {
col = skyCol;
}
// col += vec3(1.1, 0.0, 0.0)* smoothstep(0.25, 1.0,(float(max_iter)/float(MAX_ITER)));
return col;
}
vec3 getSample1(vec2 p, float time) {
float off = 0.5*iTime;
vec3 ro = vec3(0.5, 1.0-0.25, -2.0 + off);
vec3 la = ro + vec3(0.0, -0.30, 2.0);
vec3 ww = normalize(la - ro);
vec3 uu = normalize(cross(vec3(0.0,1.0,0.0), ww));
vec3 vv = normalize(cross(ww, uu));
vec3 rd = normalize(p.x*uu + p.y*vv + 2.0*ww);
vec3 col = getColor(ro, rd) ;
return col;
}
vec3 getSample2(vec2 p, float time) {
p.y-=time*0.25;
float h = height(p, 0.0);
vec3 n = normal(p, 0.0);
vec3 lp = vec3(10.0, -1.2, 0.0);
vec3 ld = normalize(vec3(p.x, h, p.y)- lp);
float d = max(dot(ld, n), 0.0);
vec3 col = vec3(0.0);
col = vec3(1.0)*(h+0.1);
col += vec3(1.5)*pow(d, 0.75);
return col;
}
void mainImage(out vec4 fragColor, vec2 fragCoord) {
vec2 q = fragCoord.xy/iResolution.xy;
vec2 p = -1.0 + 2.0*q;
p.x *= iResolution.x/iResolution.y;
vec3 col = getSample1(p, iTime);
fragColor = vec4(col, 1.0);
}

View File

@@ -1,4 +1,3 @@
#include "config.h"
#include <gtk/gtk.h>
@@ -34,7 +33,7 @@ static void create_window (GApplication *app, const char *contents);
static void
show_action_dialog (GSimpleAction *action)
{
const gchar *name;
const char *name;
GtkWidget *dialog;
name = g_action_get_name (G_ACTION (action));
@@ -58,9 +57,9 @@ show_action_infobar (GSimpleAction *action,
gpointer data)
{
DemoApplicationWindow *window = data;
gchar *text;
const gchar *name;
const gchar *value;
char *text;
const char *name;
const char *value;
name = g_action_get_name (G_ACTION (action));
value = g_variant_get_string (parameter, NULL);
@@ -92,7 +91,7 @@ activate_new (GSimpleAction *action,
static void
open_response_cb (GtkNativeDialog *dialog,
gint response_id,
int response_id,
gpointer user_data)
{
GtkFileChooserNative *native = user_data;
@@ -185,7 +184,7 @@ activate_about (GSimpleAction *action,
{
GtkWidget *window = user_data;
const gchar *authors[] = {
const char *authors[] = {
"Peter Mattis",
"Spencer Kimball",
"Josh MacDonald",
@@ -193,7 +192,7 @@ activate_about (GSimpleAction *action,
NULL
};
const gchar *documentors[] = {
const char *documentors[] = {
"Owen Taylor",
"Tony Gale",
"Matthias Clasen <mclasen@redhat.com>",
@@ -244,9 +243,9 @@ static void
update_statusbar (GtkTextBuffer *buffer,
DemoApplicationWindow *window)
{
gchar *msg;
gint row, col;
gint count;
char *msg;
int row, col;
int count;
GtkTextIter iter;
/* clear any previous message, underflow is allowed */
@@ -473,11 +472,11 @@ static void
surface_state_changed (GtkWidget *widget)
{
DemoApplicationWindow *window = (DemoApplicationWindow *)widget;
GdkSurfaceState new_state;
GdkToplevelState new_state;
new_state = gdk_toplevel_get_state (GDK_TOPLEVEL (gtk_native_get_surface (GTK_NATIVE (widget))));
window->maximized = (new_state & GDK_SURFACE_STATE_MAXIMIZED) != 0;
window->fullscreen = (new_state & GDK_SURFACE_STATE_FULLSCREEN) != 0;
window->maximized = (new_state & GDK_TOPLEVEL_STATE_MAXIMIZED) != 0;
window->fullscreen = (new_state & GDK_TOPLEVEL_STATE_FULLSCREEN) != 0;
}
static void

View File

@@ -31,8 +31,8 @@
</object>
</child>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
<property name="column">0</property>
<property name="row">0</property>
</layout>
</object>
</child>
@@ -54,8 +54,8 @@
</object>
</child>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
@@ -70,8 +70,8 @@
</object>
</child>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
<property name="column">0</property>
<property name="row">2</property>
</layout>
</object>
</child>
@@ -79,8 +79,8 @@
<object class="GtkStatusbar" id="status">
<property name="hexpand">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="column">0</property>
<property name="row">3</property>
</layout>
</object>
</child>

View File

@@ -16,8 +16,8 @@ static GtkWidget *placeholder;
static void
on_name_appeared (GDBusConnection *connection,
const gchar *name,
const gchar *name_owner,
const char *name,
const char *name_owner,
gpointer user_data)
{
name_seen = TRUE;
@@ -25,7 +25,7 @@ on_name_appeared (GDBusConnection *connection,
static void
on_name_vanished (GDBusConnection *connection,
const gchar *name,
const char *name,
gpointer user_data)
{
if (!name_seen)
@@ -55,7 +55,7 @@ do_application_demo (GtkWidget *toplevel)
if (placeholder == NULL)
{
const gchar *command;
const char *command;
GError *error = NULL;
if (g_file_test ("./gtk4-demo-application" APP_EXTENSION, G_FILE_TEST_IS_EXECUTABLE))

View File

@@ -1,8 +1,8 @@
/* Assistant
*
* Demonstrates a sample multi-step assistant. Assistants are used to divide
* an operation into several simpler sequential steps, and to guide the user
* through these steps.
* Demonstrates a sample multi-step assistant with GtkAssistant. Assistants
* are used to divide an operation into several simpler sequential steps,
* and to guide the user through these steps.
*/
#include <gtk/gtk.h>
@@ -12,7 +12,7 @@ static GtkWidget *progress_bar = NULL;
static gboolean
apply_changes_gradually (gpointer data)
{
gdouble fraction;
double fraction;
/* Work, work, work... */
fraction = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (progress_bar));
@@ -47,8 +47,8 @@ on_assistant_close_cancel (GtkWidget *widget, gpointer data)
static void
on_assistant_prepare (GtkWidget *widget, GtkWidget *page, gpointer data)
{
gint current_page, n_pages;
gchar *title;
int current_page, n_pages;
char *title;
current_page = gtk_assistant_get_current_page (GTK_ASSISTANT (widget));
n_pages = gtk_assistant_get_n_pages (GTK_ASSISTANT (widget));
@@ -70,8 +70,8 @@ on_entry_changed (GtkWidget *widget, gpointer data)
{
GtkAssistant *assistant = GTK_ASSISTANT (data);
GtkWidget *current_page;
gint page_number;
const gchar *text;
int page_number;
const char *text;
page_number = gtk_assistant_get_current_page (assistant);
current_page = gtk_assistant_get_nth_page (assistant, page_number);

BIN
demos/gtk-demo/bbb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -8,6 +8,10 @@
<property name="default-height">300</property>
<child>
<object class="GtkGrid">
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<property name="row-spacing">12</property>
<property name="column-spacing">12</property>
<child>
@@ -18,8 +22,8 @@
<class name="dim-label"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
<property name="column">0</property>
<property name="row">0</property>
</layout>
</object>
</child>
@@ -29,8 +33,8 @@
<property name="has-frame">1</property>
<property name="min-content-width">150</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
@@ -40,8 +44,8 @@
<property name="hexpand">1</property>
<property name="stack">stack</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
<property name="column">1</property>
<property name="row">0</property>
</layout>
</object>
</child>
@@ -67,8 +71,8 @@
<object class="GtkLabel">
<property name="label" translatable="yes">Duck</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
<property name="column">0</property>
<property name="row">0</property>
</layout>
</object>
</child>
@@ -76,8 +80,8 @@
<object class="GtkLabel">
<property name="label" translatable="yes">Background</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
<property name="column">1</property>
<property name="row">0</property>
</layout>
</object>
</child>
@@ -87,8 +91,8 @@
<class name="duck"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
@@ -98,8 +102,8 @@
<class name="gradient"/>
</style>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
<property name="column">1</property>
<property name="row">1</property>
</layout>
</object>
</child>
@@ -108,8 +112,8 @@
<property name="label" translatable="yes">
Blended picture</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
<property name="column">0</property>
<property name="row">2</property>
<property name="column-span">2</property>
</layout>
</object>
@@ -121,8 +125,8 @@ Blended picture</property>
<class name="blend0"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="column">0</property>
<property name="row">3</property>
<property name="column-span">2</property>
</layout>
</object>
@@ -146,8 +150,8 @@ Blended picture</property>
<object class="GtkLabel">
<property name="label" translatable="yes">Red</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
<property name="column">0</property>
<property name="row">0</property>
</layout>
</object>
</child>
@@ -155,8 +159,8 @@ Blended picture</property>
<object class="GtkLabel">
<property name="label" translatable="yes">Blue</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
<property name="column">1</property>
<property name="row">0</property>
</layout>
</object>
</child>
@@ -166,8 +170,8 @@ Blended picture</property>
<class name="red"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
@@ -177,8 +181,8 @@ Blended picture</property>
<class name="blue"/>
</style>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
<property name="column">1</property>
<property name="row">1</property>
</layout>
</object>
</child>
@@ -187,8 +191,8 @@ Blended picture</property>
<property name="label" translatable="yes">
Blended picture</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
<property name="column">0</property>
<property name="row">2</property>
<property name="column-span">2</property>
</layout>
</object>
@@ -200,8 +204,8 @@ Blended picture</property>
<class name="blend1"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="column">0</property>
<property name="row">3</property>
<property name="column-span">2</property>
</layout>
</object>
@@ -228,8 +232,8 @@ Blended picture</property>
<class name="cyan"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
@@ -239,8 +243,8 @@ Blended picture</property>
<class name="magenta"/>
</style>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
<property name="column">1</property>
<property name="row">1</property>
</layout>
</object>
</child>
@@ -250,8 +254,8 @@ Blended picture</property>
<class name="yellow"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="column">0</property>
<property name="row">3</property>
</layout>
</object>
</child>
@@ -262,8 +266,8 @@ Blended picture</property>
<class name="blend2"/>
</style>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
<property name="column">1</property>
<property name="row">3</property>
</layout>
</object>
</child>
@@ -275,8 +279,8 @@ Blended picture</property>
<class name="dim-label"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
<property name="column">0</property>
<property name="row">0</property>
</layout>
</object>
</child>
@@ -288,8 +292,8 @@ Blended picture</property>
<class name="dim-label"/>
</style>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
<property name="column">1</property>
<property name="row">0</property>
</layout>
</object>
</child>
@@ -301,8 +305,8 @@ Blended picture</property>
<class name="dim-label"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
<property name="column">0</property>
<property name="row">2</property>
</layout>
</object>
</child>
@@ -314,8 +318,8 @@ Blended picture</property>
<attribute name="weight" value="bold"></attribute>
</attributes>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
<property name="column">1</property>
<property name="row">2</property>
</layout>
</object>
</child>
@@ -324,8 +328,8 @@ Blended picture</property>
</object>
</child>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
<property name="column">1</property>
<property name="row">1</property>
</layout>
</object>
</child>

View File

@@ -132,10 +132,10 @@ blur_overlay_child_update_style_classes (BlurOverlay *overlay,
gboolean is_left, is_right, is_top, is_bottom;
gboolean has_left, has_right, has_top, has_bottom;
has_left = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_LEFT);
has_right = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_RIGHT);
has_top = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_TOP);
has_bottom = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_BOTTOM);
has_left = gtk_widget_has_css_class (child, "left");
has_right = gtk_widget_has_css_class (child, "right");
has_top = gtk_widget_has_css_class (child, "top");
has_bottom = gtk_widget_has_css_class (child, "bottom");
is_left = is_right = is_top = is_bottom = FALSE;
@@ -158,24 +158,24 @@ blur_overlay_child_update_style_classes (BlurOverlay *overlay,
is_bottom = (child_allocation->y + child_allocation->height == height);
if (has_left && !is_left)
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_LEFT);
gtk_widget_remove_css_class (child, "left");
else if (!has_left && is_left)
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_LEFT);
gtk_widget_add_css_class (child, "left");
if (has_right && !is_right)
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_RIGHT);
gtk_widget_remove_css_class (child, "right");
else if (!has_right && is_right)
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_RIGHT);
gtk_widget_add_css_class (child, "right");
if (has_top && !is_top)
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_TOP);
gtk_widget_remove_css_class (child, "top");
else if (!has_top && is_top)
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_TOP);
gtk_widget_add_css_class (child, "top");
if (has_bottom && !is_bottom)
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_BOTTOM);
gtk_widget_remove_css_class (child, "bottom");
else if (!has_bottom && is_bottom)
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_BOTTOM);
gtk_widget_add_css_class (child, "bottom");
}
static void

View File

@@ -1,6 +1,8 @@
/* Builder
* #Keywords: GMenu, GtkPopoverMenuBar, GtkBuilder, GtkStatusBar, toolbar
*
* Demonstrates an interface loaded from a XML description.
* Demonstrates a traditional interface, loaded from a XML description,
* and shows how to connect actions to the menu items and toolbar buttons.
*/
#include <gtk/gtk.h>
@@ -21,15 +23,38 @@ about_activate (GSimpleAction *action,
gpointer user_data)
{
GtkWidget *window = user_data;
GtkBuilder *builder;
GtkWidget *about_dlg;
builder = g_object_get_data (G_OBJECT (window), "builder");
about_dlg = GTK_WIDGET (gtk_builder_get_object (builder, "aboutdialog1"));
gtk_window_set_transient_for (GTK_WINDOW (about_dlg), GTK_WINDOW (window));
gtk_window_set_hide_on_close (GTK_WINDOW (about_dlg), TRUE);
g_signal_connect (about_dlg, "response", G_CALLBACK (gtk_widget_hide), NULL);
gtk_widget_show (about_dlg);
about_dlg = GTK_WIDGET (g_object_get_data (G_OBJECT (window), "about"));
gtk_window_present (GTK_WINDOW (about_dlg));
}
static void
remove_timeout (gpointer data)
{
guint id = GPOINTER_TO_UINT (data);
g_source_remove (id);
}
static gboolean
pop_status (gpointer data)
{
gtk_statusbar_pop (GTK_STATUSBAR (data), 0);
g_object_set_data (G_OBJECT (data), "timeout", NULL);
return G_SOURCE_REMOVE;
}
static void
status_message (GtkStatusbar *status,
const char *text)
{
guint id;
gtk_statusbar_push (GTK_STATUSBAR (status), 0, text);
id = g_timeout_add (5000, pop_status, status);
g_object_set_data_full (G_OBJECT (status), "timeout", GUINT_TO_POINTER (id), remove_timeout);
}
static void
@@ -37,7 +62,10 @@ help_activate (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
g_print ("Help not available\n");
GtkWidget *status;
status = GTK_WIDGET (g_object_get_data (G_OBJECT (user_data), "status"));
status_message (GTK_STATUSBAR (status), "Help not available");
}
static void
@@ -45,7 +73,13 @@ not_implemented (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
g_print ("Action “%s” not implemented\n", g_action_get_name (G_ACTION (action)));
GtkWidget *status;
char *text;
text = g_strdup_printf ("Action “%s” not implemented", g_action_get_name (G_ACTION (action)));
status = GTK_WIDGET (g_object_get_data (G_OBJECT (user_data), "status"));
status_message (GTK_STATUSBAR (status), text);
g_free (text);
}
static GActionEntry win_entries[] = {
@@ -70,6 +104,9 @@ do_builder (GtkWidget *do_widget)
if (!window)
{
GtkBuilder *builder;
GtkWidget *about;
GtkWidget *status;
GtkEventController *controller;
builder = gtk_builder_new_from_resource ("/builder/demo.ui");
@@ -83,6 +120,51 @@ do_builder (GtkWidget *do_widget)
window);
gtk_widget_insert_action_group (window, "win", actions);
controller = gtk_shortcut_controller_new ();
gtk_shortcut_controller_set_scope (GTK_SHORTCUT_CONTROLLER (controller),
GTK_SHORTCUT_SCOPE_GLOBAL);
gtk_widget_add_controller (window, controller);
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_n, GDK_CONTROL_MASK),
gtk_named_action_new ("win.new")));
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_o, GDK_CONTROL_MASK),
gtk_named_action_new ("win.open")));
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_s, GDK_CONTROL_MASK),
gtk_named_action_new ("win.save")));
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_s, GDK_CONTROL_MASK|GDK_SHIFT_MASK),
gtk_named_action_new ("win.save-as")));
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_q, GDK_CONTROL_MASK),
gtk_named_action_new ("win.quit")));
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_c, GDK_CONTROL_MASK),
gtk_named_action_new ("win.copy")));
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_x, GDK_CONTROL_MASK),
gtk_named_action_new ("win.cut")));
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_v, GDK_CONTROL_MASK),
gtk_named_action_new ("win.paste")));
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_F1, 0),
gtk_named_action_new ("win.help")));
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
gtk_shortcut_new (gtk_keyval_trigger_new (GDK_KEY_F7, 0),
gtk_named_action_new ("win.about")));
about = GTK_WIDGET (gtk_builder_get_object (builder, "aboutdialog1"));
gtk_window_set_transient_for (GTK_WINDOW (about), GTK_WINDOW (window));
gtk_window_set_hide_on_close (GTK_WINDOW (about), TRUE);
g_signal_connect (about, "response", G_CALLBACK (gtk_widget_hide), NULL);
g_object_set_data_full (G_OBJECT (window), "about",
about, (GDestroyNotify)gtk_window_destroy);
status = GTK_WIDGET (gtk_builder_get_object (builder, "statusbar1"));
g_object_set_data (G_OBJECT (window), "status", status);
g_object_unref (builder);
}

224
demos/gtk-demo/cogs.glsl Normal file
View File

@@ -0,0 +1,224 @@
// Originally from: https://www.shadertoy.com/view/3ljyDD
// License CC0: Hexagonal tiling + cog wheels
// Nothing fancy, just hexagonal tiling + cog wheels
#define PI 3.141592654
#define TAU (2.0*PI)
#define MROT(a) mat2(cos(a), sin(a), -sin(a), cos(a))
float hash(in vec2 co) {
return fract(sin(dot(co.xy ,vec2(12.9898,58.233))) * 13758.5453);
}
float pcos(float a) {
return 0.5 + 0.5*cos(a);
}
void rot(inout vec2 p, float a) {
float c = cos(a);
float s = sin(a);
p = vec2(c*p.x + s*p.y, -s*p.x + c*p.y);
}
float modPolar(inout vec2 p, float repetitions) {
float angle = 2.0*PI/repetitions;
float a = atan(p.y, p.x) + angle/2.;
float r = length(p);
float c = floor(a/angle);
a = mod(a,angle) - angle/2.;
p = vec2(cos(a), sin(a))*r;
// For an odd number of repetitions, fix cell index of the cell in -x direction
// (cell index would be e.g. -5 and 5 in the two halves of the cell):
if (abs(c) >= (repetitions/2.0)) c = abs(c);
return c;
}
float pmin(float a, float b, float k) {
float h = clamp( 0.5+0.5*(b-a)/k, 0.0, 1.0 );
return mix( b, a, h ) - k*h*(1.0-h);
}
const vec2 sz = vec2(1.0, sqrt(3.0));
const vec2 hsz = 0.5*sz;
const float smallCount = 16.0;
vec2 hextile(inout vec2 p) {
// See Art of Code: Hexagonal Tiling Explained!
// https://www.youtube.com/watch?v=VmrIDyYiJBA
vec2 p1 = mod(p, sz)-hsz;
vec2 p2 = mod(p - hsz*1.0, sz)-hsz;
vec2 p3 = mix(p2, p1, vec2(length(p1) < length(p2)));
vec2 n = p3 - p;
p = p3;
return n;
}
float circle(vec2 p, float r) {
return length(p) - r;
}
float box(vec2 p, vec2 b) {
vec2 d = abs(p)-b;
return length(max(d,0.0)) + min(max(d.x,d.y),0.0);
}
float unevenCapsule(vec2 p, float r1, float r2, float h) {
p.x = abs(p.x);
float b = (r1-r2)/h;
float a = sqrt(1.0-b*b);
float k = dot(p,vec2(-b,a));
if( k < 0.0 ) return length(p) - r1;
if( k > a*h ) return length(p-vec2(0.0,h)) - r2;
return dot(p, vec2(a,b) ) - r1;
}
float cogwheel(vec2 p, float innerRadius, float outerRadius, float cogs, float holes) {
float cogWidth = 0.25*innerRadius*TAU/cogs;
float d0 = circle(p, innerRadius);
vec2 icp = p;
modPolar(icp, holes);
icp -= vec2(innerRadius*0.55, 0.0);
float d1 = circle(icp, innerRadius*0.25);
vec2 cp = p;
modPolar(cp, cogs);
cp -= vec2(innerRadius, 0.0);
float d2 = unevenCapsule(cp.yx, cogWidth, cogWidth*0.75, (outerRadius-innerRadius));
float d3 = circle(p, innerRadius*0.20);
float d = 1E6;
d = min(d, d0);
d = pmin(d, d2, 0.5*cogWidth);
d = min(d, d2);
d = max(d, -d1);
d = max(d, -d3);
return d;
}
float ccell1(vec2 p, float r) {
float d = 1E6;
const float bigCount = 60.0;
vec2 cp0 = p;
rot(cp0, -iTime*TAU/bigCount);
float d0 = cogwheel(cp0, 0.36, 0.38, bigCount, 5.0);
vec2 cp1 = p;
float nm = modPolar(cp1, 6.0);
cp1 -= vec2(0.5, 0.0);
rot(cp1, 0.2+TAU*nm/2.0 + iTime*TAU/smallCount);
float d1 = cogwheel(cp1, 0.11, 0.125, smallCount, 5.0);
d = min(d, d0);
d = min(d, d1);
return d;
}
float ccell2(vec2 p, float r) {
float d = 1E6;
vec2 cp0 = p;
float nm = modPolar(cp0, 6.0);
vec2 cp1 = cp0;
const float off = 0.275;
const float count = smallCount + 2.0;
cp0 -= vec2(off, 0.0);
rot(cp0, 0.+TAU*nm/2.0 - iTime*TAU/count);
float d0 = cogwheel(cp0, 0.09, 0.105, count, 5.0);
cp1 -= vec2(0.5, 0.0);
rot(cp1, 0.2+TAU*nm/2.0 + iTime*TAU/smallCount);
float d1 = cogwheel(cp1, 0.11, 0.125, smallCount, 5.0);
float l = length(p);
float d2 = l - (off+0.055);
float d3 = d2 + 0.020;;
vec2 tp0 = p;
modPolar(tp0, 60.0);
tp0.x -= off;
float d4 = box(tp0, vec2(0.0125, 0.005));
float ctime = -(iTime*0.05 + r)*TAU;
vec2 tp1 = p;
rot(tp1, ctime*12.0);
tp1.x -= 0.13;
float d5 = box(tp1, vec2(0.125, 0.005));
vec2 tp2 = p;
rot(tp2, ctime);
tp2.x -= 0.13*0.5;
float d6 = box(tp2, vec2(0.125*0.5, 0.0075));
float d7 = l - 0.025;
float d8 = l - 0.0125;
d = min(d, d0);
d = min(d, d1);
d = min(d, d2);
d = max(d, -d3);
d = min(d, d4);
d = min(d, d5);
d = min(d, d6);
d = min(d, d7);
d = max(d, -d8);
return d;
}
float df(vec2 p, float scale, inout vec2 nn) {
p /= scale;
nn = hextile(p);
nn = round(nn);
float r = hash(nn);
float d;;
if (r < 0.5) {
d = ccell1(p, r);
} else {
d = ccell2(p, r);
}
return d*scale;
}
vec3 postProcess(vec3 col, vec2 q) {
//col = saturate(col);
col=pow(clamp(col,0.0,1.0),vec3(0.75));
col=col*0.6+0.4*col*col*(3.0-2.0*col); // contrast
col=mix(col, vec3(dot(col, vec3(0.33))), -0.4); // satuation
col*=0.5+0.5*pow(19.0*q.x*q.y*(1.0-q.x)*(1.0-q.y),0.7); // vigneting
return col;
}
void mainImage(out vec4 fragColor, vec2 fragCoord) {
vec2 q = fragCoord/iResolution.xy;
vec2 p = -1.0 + 2.0*q;
p.x *= iResolution.x/iResolution.y;
float tm = iTime*0.1;
p += vec2(cos(tm), sin(tm*sqrt(0.5)));
float z = mix(0.5, 1.0, pcos(tm*sqrt(0.3)));
float aa = 4.0 / iResolution.y;
vec2 nn = vec2(0.0);
float d = df(p, z, nn);
vec3 col = vec3(160.0)/vec3(255.0);
vec3 baseCol = vec3(0.3);
vec4 logoCol = vec4(baseCol, 1.0)*smoothstep(-aa, 0.0, -d);
col = mix(col, logoCol.xyz, pow(logoCol.w, 8.0));
col += 0.4*pow(abs(sin(20.0*d)), 0.6);
col = postProcess(col, q);
fragColor = vec4(col, 1.0);
}

226
demos/gtk-demo/cogs2.glsl Normal file
View File

@@ -0,0 +1,226 @@
uniform float iTime;
// Originally from: https://www.shadertoy.com/view/3ljyDD
// License CC0: Hexagonal tiling + cog wheels
// Nothing fancy, just hexagonal tiling + cog wheels
#define PI 3.141592654
#define TAU (2.0*PI)
#define MROT(a) mat2(cos(a), sin(a), -sin(a), cos(a))
float hash(in vec2 co) {
return fract(sin(dot(co.xy ,vec2(12.9898,58.233))) * 13758.5453);
}
float pcos(float a) {
return 0.5 + 0.5*cos(a);
}
void rot(inout vec2 p, float a) {
float c = cos(a);
float s = sin(a);
p = vec2(c*p.x + s*p.y, -s*p.x + c*p.y);
}
float modPolar(inout vec2 p, float repetitions) {
float angle = 2.0*PI/repetitions;
float a = atan(p.y, p.x) + angle/2.;
float r = length(p);
float c = floor(a/angle);
a = mod(a,angle) - angle/2.;
p = vec2(cos(a), sin(a))*r;
// For an odd number of repetitions, fix cell index of the cell in -x direction
// (cell index would be e.g. -5 and 5 in the two halves of the cell):
if (abs(c) >= (repetitions/2.0)) c = abs(c);
return c;
}
float pmin(float a, float b, float k) {
float h = clamp( 0.5+0.5*(b-a)/k, 0.0, 1.0 );
return mix( b, a, h ) - k*h*(1.0-h);
}
const vec2 sz = vec2(1.0, sqrt(3.0));
const vec2 hsz = 0.5*sz;
const float smallCount = 16.0;
vec2 hextile(inout vec2 p) {
// See Art of Code: Hexagonal Tiling Explained!
// https://www.youtube.com/watch?v=VmrIDyYiJBA
vec2 p1 = mod(p, sz)-hsz;
vec2 p2 = mod(p - hsz*1.0, sz)-hsz;
vec2 p3 = mix(p2, p1, vec2(length(p1) < length(p2)));
vec2 n = p3 - p;
p = p3;
return n;
}
float circle(vec2 p, float r) {
return length(p) - r;
}
float box(vec2 p, vec2 b) {
vec2 d = abs(p)-b;
return length(max(d,0.0)) + min(max(d.x,d.y),0.0);
}
float unevenCapsule(vec2 p, float r1, float r2, float h) {
p.x = abs(p.x);
float b = (r1-r2)/h;
float a = sqrt(1.0-b*b);
float k = dot(p,vec2(-b,a));
if( k < 0.0 ) return length(p) - r1;
if( k > a*h ) return length(p-vec2(0.0,h)) - r2;
return dot(p, vec2(a,b) ) - r1;
}
float cogwheel(vec2 p, float innerRadius, float outerRadius, float cogs, float holes) {
float cogWidth = 0.25*innerRadius*TAU/cogs;
float d0 = circle(p, innerRadius);
vec2 icp = p;
modPolar(icp, holes);
icp -= vec2(innerRadius*0.55, 0.0);
float d1 = circle(icp, innerRadius*0.25);
vec2 cp = p;
modPolar(cp, cogs);
cp -= vec2(innerRadius, 0.0);
float d2 = unevenCapsule(cp.yx, cogWidth, cogWidth*0.75, (outerRadius-innerRadius));
float d3 = circle(p, innerRadius*0.20);
float d = 1E6;
d = min(d, d0);
d = pmin(d, d2, 0.5*cogWidth);
d = min(d, d2);
d = max(d, -d1);
d = max(d, -d3);
return d;
}
float ccell1(vec2 p, float r) {
float d = 1E6;
const float bigCount = 60.0;
vec2 cp0 = p;
rot(cp0, -iTime*TAU/bigCount);
float d0 = cogwheel(cp0, 0.36, 0.38, bigCount, 5.0);
vec2 cp1 = p;
float nm = modPolar(cp1, 6.0);
cp1 -= vec2(0.5, 0.0);
rot(cp1, 0.2+TAU*nm/2.0 + iTime*TAU/smallCount);
float d1 = cogwheel(cp1, 0.11, 0.125, smallCount, 5.0);
d = min(d, d0);
d = min(d, d1);
return d;
}
float ccell2(vec2 p, float r) {
float d = 1E6;
vec2 cp0 = p;
float nm = modPolar(cp0, 6.0);
vec2 cp1 = cp0;
const float off = 0.275;
const float count = smallCount + 2.0;
cp0 -= vec2(off, 0.0);
rot(cp0, 0.+TAU*nm/2.0 - iTime*TAU/count);
float d0 = cogwheel(cp0, 0.09, 0.105, count, 5.0);
cp1 -= vec2(0.5, 0.0);
rot(cp1, 0.2+TAU*nm/2.0 + iTime*TAU/smallCount);
float d1 = cogwheel(cp1, 0.11, 0.125, smallCount, 5.0);
float l = length(p);
float d2 = l - (off+0.055);
float d3 = d2 + 0.020;;
vec2 tp0 = p;
modPolar(tp0, 60.0);
tp0.x -= off;
float d4 = box(tp0, vec2(0.0125, 0.005));
float ctime = -(iTime*0.05 + r)*TAU;
vec2 tp1 = p;
rot(tp1, ctime*12.0);
tp1.x -= 0.13;
float d5 = box(tp1, vec2(0.125, 0.005));
vec2 tp2 = p;
rot(tp2, ctime);
tp2.x -= 0.13*0.5;
float d6 = box(tp2, vec2(0.125*0.5, 0.0075));
float d7 = l - 0.025;
float d8 = l - 0.0125;
d = min(d, d0);
d = min(d, d1);
d = min(d, d2);
d = max(d, -d3);
d = min(d, d4);
d = min(d, d5);
d = min(d, d6);
d = min(d, d7);
d = max(d, -d8);
return d;
}
float df(vec2 p, float scale, inout vec2 nn) {
p /= scale;
nn = hextile(p);
nn = round(nn);
float r = hash(nn);
float d;;
if (r < 0.5) {
d = ccell1(p, r);
} else {
d = ccell2(p, r);
}
return d*scale;
}
vec3 postProcess(vec3 col, vec2 q) {
//col = saturate(col);
col=pow(clamp(col,0.0,1.0),vec3(0.75));
col=col*0.6+0.4*col*col*(3.0-2.0*col); // contrast
col=mix(col, vec3(dot(col, vec3(0.33))), -0.4); // satuation
col*=0.5+0.5*pow(19.0*q.x*q.y*(1.0-q.x)*(1.0-q.y),0.7); // vigneting
return col;
}
void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv) {
vec2 q = fragCoord/resolution.xy;
vec2 p = -1.0 + 2.0*q;
p.x *= resolution.x/resolution.y;
float tm = iTime*0.1;
p += vec2(cos(tm), sin(tm*sqrt(0.5)));
float z = mix(0.5, 1.0, pcos(tm*sqrt(0.3)));
float aa = 4.0 / resolution.y;
vec2 nn = vec2(0.0);
float d = df(p, z, nn);
vec3 col = vec3(160.0)/vec3(255.0);
vec3 baseCol = vec3(0.3);
vec4 logoCol = vec4(baseCol, 1.0)*smoothstep(-aa, 0.0, -d);
col = mix(col, logoCol.xyz, pow(logoCol.w, 8.0));
col += 0.4*pow(abs(sin(20.0*d)), 0.6);
col = postProcess(col, q);
fragColor = vec4(col, 1.0);
}

View File

@@ -1,4 +1,5 @@
/* Combo Boxes
* #Keywords: GtkCellRenderer
*
* The GtkComboBox widget allows to select one option out of a list.
* The GtkComboBoxEntry additionally allows the user to enter a value
@@ -38,7 +39,7 @@ create_icon_store (void)
GtkTreeIter iter;
GtkListStore *store;
gint i;
int i;
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
@@ -77,7 +78,7 @@ set_sensitive (GtkCellLayout *cell_layout,
gpointer data)
{
GtkTreePath *path;
gint *indices;
int *indices;
gboolean sensitive;
path = gtk_tree_model_get_path (tree_model, iter);
@@ -175,7 +176,7 @@ create_capital_store (void)
GtkTreeIter iter, iter2;
GtkTreeStore *store;
gint i;
int i;
store = gtk_tree_store_new (1, G_TYPE_STRING);

View File

@@ -1,4 +1,5 @@
/* Constraints/Simple
* #Keywords: GtkLayoutManager
*
* GtkConstraintLayout provides a layout manager that uses relations
* between widgets (also known as "constraints") to compute the position
@@ -254,15 +255,11 @@ do_constraints (GtkWidget *do_widget)
if (!window)
{
GtkWidget *header, *box, *grid, *button;
GtkWidget *box, *grid;
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Constraints");
header = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
@@ -272,12 +269,6 @@ do_constraints (GtkWidget *do_widget)
gtk_widget_set_hexpand (grid, TRUE);
gtk_widget_set_vexpand (grid, TRUE);
gtk_box_append (GTK_BOX (box), grid);
button = gtk_button_new_with_label ("Close");
gtk_box_append (GTK_BOX (box), button);
gtk_widget_set_hexpand (grid, TRUE);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_window_destroy), window);
}
if (!gtk_widget_get_visible (window))

View File

@@ -1,4 +1,5 @@
/* Constraints/Interactive
* #Keywords: GtkConstraintLayout
*
* Demonstrate how constraints can be updates during user interaction.
* The vertical edge between the buttons can be dragged with the mouse.
@@ -210,15 +211,11 @@ do_constraints2 (GtkWidget *do_widget)
if (!window)
{
GtkWidget *header, *box, *grid, *button;
GtkWidget *box, *grid;
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Constraints");
header = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
@@ -228,12 +225,6 @@ do_constraints2 (GtkWidget *do_widget)
gtk_widget_set_hexpand (grid, TRUE);
gtk_widget_set_vexpand (grid, TRUE);
gtk_box_append (GTK_BOX (box), grid);
button = gtk_button_new_with_label ("Close");
gtk_box_append (GTK_BOX (box), button);
gtk_widget_set_hexpand (grid, TRUE);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_window_destroy), window);
}
if (!gtk_widget_get_visible (window))

View File

@@ -130,15 +130,11 @@ do_constraints3 (GtkWidget *do_widget)
if (!window)
{
GtkWidget *header, *box, *grid, *button;
GtkWidget *box, *grid;
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Constraints");
header = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
@@ -148,12 +144,6 @@ do_constraints3 (GtkWidget *do_widget)
gtk_widget_set_hexpand (grid, TRUE);
gtk_widget_set_vexpand (grid, TRUE);
gtk_box_append (GTK_BOX (box), grid);
button = gtk_button_new_with_label ("Close");
gtk_box_append (GTK_BOX (box), button);
gtk_widget_set_hexpand (grid, TRUE);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_window_destroy), window);
}
if (!gtk_widget_get_visible (window))

View File

@@ -1,7 +1,6 @@
/* Theming/CSS Accordion
*
* A simple accordion demo written using CSS transitions and multiple backgrounds
*
*/
#include <gtk/gtk.h>

View File

@@ -1,8 +1,7 @@
/* Theming/CSS Basics
*
* Gtk themes are written using CSS. Every widget is build of multiple items
* GTK themes are written using CSS. Every widget is build of multiple items
* that you can style very similarly to a regular website.
*
*/
#include <gtk/gtk.h>

View File

@@ -15,6 +15,10 @@
border: 1px solid;
}
window {
background-color: white;
}
/* Make sure selections are visible */
selection {
background-color: darkGreen;

View File

@@ -38,14 +38,14 @@ struct {
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static void
update_css_for_blend_mode (GtkCssProvider *provider,
const gchar *blend_mode)
const char *blend_mode)
{
GBytes *bytes;
gchar *css;
char *css;
bytes = g_resources_lookup_data ("/css_blendmodes/css_blendmodes.css", 0, NULL);
css = g_strdup_printf ((gchar*) g_bytes_get_data (bytes, NULL),
css = g_strdup_printf ((char *) g_bytes_get_data (bytes, NULL),
blend_mode,
blend_mode,
blend_mode);
@@ -62,7 +62,7 @@ row_activated (GtkListBox *listbox,
GtkListBoxRow *row,
GtkCssProvider *provider)
{
const gchar *blend_mode;
const char *blend_mode;
blend_mode = blend_modes[gtk_list_box_row_get_index (row)].id;
@@ -75,7 +75,7 @@ setup_listbox (GtkBuilder *builder,
{
GtkWidget *normal_row;
GtkWidget *listbox;
gint i;
int i;
normal_row = NULL;
listbox = gtk_list_box_new ();

View File

@@ -1,8 +1,7 @@
/* Theming/Multiple Backgrounds
*
* Gtk themes are written using CSS. Every widget is build of multiple items
* GTK themes are written using CSS. Every widget is build of multiple items
* that you can style very similarly to a regular website.
*
*/
#include <gtk/gtk.h>

View File

@@ -1,6 +1,7 @@
/* Theming/Animated Backgrounds
*
* This demo is done in honour of the Pixbufs demo further down.
* This demo is in honour of a classic Pixbufs demo.
*
* It is done exclusively with CSS as the background of the window.
*/

View File

@@ -46,19 +46,19 @@
}
@keyframes size-the-image {
0% { background-size: 96px, 12px, 96px, 12px, 96px, 12px, 96px, 12px, auto }
100% { background-size: 12px, 96px, 12px, 96px, 12px, 96px, 12px, 96px, auto }
0% { background-size: 96px, 12px, 96px, 12px, 96px, 12px, 96px, 12px, auto; }
100% { background-size: 12px, 96px, 12px, 96px, 12px, 96px, 12px, 96px, auto; }
}
window {
background-image: url("resource://css_pixbufs/apple-red.png"),
url("resource://css_pixbufs/gnome-applets.png"),
url("resource://css_pixbufs/gnome-calendar.png"),
url("resource://css_pixbufs/gnome-foot.png"),
url("resource://css_pixbufs/gnome-gmush.png"),
url("resource://css_pixbufs/gnome-gimp.png"),
url("resource://css_pixbufs/gnome-gsame.png"),
url("resource://css_pixbufs/gnu-keys.png"),
background-image: url("resource://css_pixbufs/images/apple-red.png"),
url("resource://css_pixbufs/images/gnome-applets.png"),
url("resource://css_pixbufs/images/gnome-calendar.png"),
url("resource://css_pixbufs/images/gnome-foot.png"),
url("resource://css_pixbufs/images/gnome-gmush.png"),
url("resource://css_pixbufs/images/gnome-gimp.png"),
url("resource://css_pixbufs/images/gnome-gsame.png"),
url("resource://css_pixbufs/images/gnu-keys.png"),
url("resource://css_pixbufs/background.jpg");
background-position: 50.00% 75.00%, 67.68% 67.68%, 75.00% 50.00%, 67.68% 32.32%, 50.00% 25.00%, 32.32% 32.32%, 25.00% 50.00%, 32.32% 67.68%, 0% 0%;
background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat;

View File

@@ -106,6 +106,7 @@ do_css_shadows (GtkWidget *do_widget)
child = create_toolbar ();
gtk_paned_set_start_child (GTK_PANED (paned), child);
gtk_paned_set_resize_start_child (GTK_PANED (paned), FALSE);
text = gtk_text_buffer_new (NULL);
gtk_text_buffer_create_tag (text,

View File

@@ -4,7 +4,7 @@
<property name="name">default</property>
</object>
<object class="GdkCursor" id="default_cursor_image">
<property name="texture">resource:///cursors/default_cursor.png</property>
<property name="texture">resource:///cursors/images/default_cursor.png</property>
<property name="hotspot-x">5</property>
<property name="hotspot-y">5</property>
</object>
@@ -13,7 +13,7 @@
<property name="fallback">default_cursor_image</property>
</object>
<object class="GdkCursor" id="default_cursor_image_fallback">
<property name="texture">resource:///cursors/default_cursor.png</property>
<property name="texture">resource:///cursors/images/default_cursor.png</property>
<property name="hotspot-x">5</property>
<property name="hotspot-y">5</property>
<property name="fallback">default_cursor</property>
@@ -22,21 +22,21 @@
<property name="name">none</property>
</object>
<object class="GdkCursor" id="none_cursor_image">
<property name="texture">resource:///cursors/none_cursor.png</property>
<property name="texture">resource:///cursors/images/none_cursor.png</property>
</object>
<object class="GdkCursor" id="none_cursor_fallback">
<property name="name">none</property>
<property name="fallback">none_cursor_image</property>
</object>
<object class="GdkCursor" id="none_cursor_image_fallback">
<property name="texture">resource:///cursors/none_cursor.png</property>
<property name="texture">resource:///cursors/images/none_cursor.png</property>
<property name="fallback">none_cursor</property>
</object>
<object class="GdkCursor" id="gtk-logo_cursor">
<property name="name">gtk-logo</property>
</object>
<object class="GdkCursor" id="gtk-logo_cursor_image">
<property name="texture">resource:///cursors/gtk_logo_cursor.png</property>
<property name="texture">resource:///cursors/images/gtk_logo_cursor.png</property>
<property name="hotspot-x">18</property>
<property name="hotspot-y">2</property>
</object>
@@ -45,7 +45,7 @@
<property name="fallback">gtk-logo_cursor_image</property>
</object>
<object class="GdkCursor" id="gtk-logo_cursor_image_fallback">
<property name="texture">resource:///cursors/gtk_logo_cursor.png</property>
<property name="texture">resource:///cursors/images/gtk_logo_cursor.png</property>
<property name="hotspot-x">18</property>
<property name="hotspot-y">2</property>
<property name="fallback">gtk-logo_cursor</property>
@@ -54,7 +54,7 @@
<property name="name">context-menu</property>
</object>
<object class="GdkCursor" id="context-menu_cursor_image">
<property name="texture">resource:///cursors/context_menu_cursor.png</property>
<property name="texture">resource:///cursors/images/context_menu_cursor.png</property>
<property name="hotspot-x">5</property>
<property name="hotspot-y">5</property>
</object>
@@ -63,7 +63,7 @@
<property name="fallback">context-menu_cursor_image</property>
</object>
<object class="GdkCursor" id="context-menu_cursor_image_fallback">
<property name="texture">resource:///cursors/context_menu_cursor.png</property>
<property name="texture">resource:///cursors/images/context_menu_cursor.png</property>
<property name="hotspot-x">5</property>
<property name="hotspot-y">5</property>
<property name="fallback">context-menu_cursor</property>
@@ -72,7 +72,7 @@
<property name="name">help</property>
</object>
<object class="GdkCursor" id="help_cursor_image">
<property name="texture">resource:///cursors/help_cursor.png</property>
<property name="texture">resource:///cursors/images/help_cursor.png</property>
<property name="hotspot-x">16</property>
<property name="hotspot-y">27</property>
</object>
@@ -81,7 +81,7 @@
<property name="fallback">help_cursor_image</property>
</object>
<object class="GdkCursor" id="help_cursor_image_fallback">
<property name="texture">resource:///cursors/help_cursor.png</property>
<property name="texture">resource:///cursors/images/help_cursor.png</property>
<property name="hotspot-x">16</property>
<property name="hotspot-y">27</property>
<property name="fallback">help_cursor</property>
@@ -90,7 +90,7 @@
<property name="name">pointer</property>
</object>
<object class="GdkCursor" id="pointer_cursor_image">
<property name="texture">resource:///cursors/pointer_cursor.png</property>
<property name="texture">resource:///cursors/images/pointer_cursor.png</property>
<property name="hotspot-x">14</property>
<property name="hotspot-y">9</property>
</object>
@@ -99,7 +99,7 @@
<property name="fallback">pointer_cursor_image</property>
</object>
<object class="GdkCursor" id="pointer_cursor_image_fallback">
<property name="texture">resource:///cursors/pointer_cursor.png</property>
<property name="texture">resource:///cursors/images/pointer_cursor.png</property>
<property name="hotspot-x">14</property>
<property name="hotspot-y">9</property>
<property name="fallback">pointer_cursor</property>
@@ -108,7 +108,7 @@
<property name="name">progress</property>
</object>
<object class="GdkCursor" id="progress_cursor_image">
<property name="texture">resource:///cursors/progress_cursor.png</property>
<property name="texture">resource:///cursors/images/progress_cursor.png</property>
<property name="hotspot-x">5</property>
<property name="hotspot-y">4</property>
</object>
@@ -117,7 +117,7 @@
<property name="fallback">progress_cursor_image</property>
</object>
<object class="GdkCursor" id="progress_cursor_image_fallback">
<property name="texture">resource:///cursors/progress_cursor.png</property>
<property name="texture">resource:///cursors/images/progress_cursor.png</property>
<property name="hotspot-x">5</property>
<property name="hotspot-y">4</property>
<property name="fallback">progress_cursor</property>
@@ -126,7 +126,7 @@
<property name="name">wait</property>
</object>
<object class="GdkCursor" id="wait_cursor_image">
<property name="texture">resource:///cursors/wait_cursor.png</property>
<property name="texture">resource:///cursors/images/wait_cursor.png</property>
<property name="hotspot-x">11</property>
<property name="hotspot-y">11</property>
</object>
@@ -135,7 +135,7 @@
<property name="fallback">wait_cursor_image</property>
</object>
<object class="GdkCursor" id="wait_cursor_image_fallback">
<property name="texture">resource:///cursors/wait_cursor.png</property>
<property name="texture">resource:///cursors/images/wait_cursor.png</property>
<property name="hotspot-x">11</property>
<property name="hotspot-y">11</property>
<property name="fallback">wait_cursor</property>
@@ -144,7 +144,7 @@
<property name="name">cell</property>
</object>
<object class="GdkCursor" id="cell_cursor_image">
<property name="texture">resource:///cursors/cell_cursor.png</property>
<property name="texture">resource:///cursors/images/cell_cursor.png</property>
<property name="hotspot-x">15</property>
<property name="hotspot-y">15</property>
</object>
@@ -153,7 +153,7 @@
<property name="fallback">cell_cursor_image</property>
</object>
<object class="GdkCursor" id="cell_cursor_image_fallback">
<property name="texture">resource:///cursors/cell_cursor.png</property>
<property name="texture">resource:///cursors/images/cell_cursor.png</property>
<property name="hotspot-x">15</property>
<property name="hotspot-y">15</property>
<property name="fallback">cell_cursor</property>
@@ -162,7 +162,7 @@
<property name="name">crosshair</property>
</object>
<object class="GdkCursor" id="crosshair_cursor_image">
<property name="texture">resource:///cursors/crosshair_cursor.png</property>
<property name="texture">resource:///cursors/images/crosshair_cursor.png</property>
<property name="hotspot-x">15</property>
<property name="hotspot-y">15</property>
</object>
@@ -171,7 +171,7 @@
<property name="fallback">crosshair_cursor_image</property>
</object>
<object class="GdkCursor" id="crosshair_cursor_image_fallback">
<property name="texture">resource:///cursors/crosshair_cursor.png</property>
<property name="texture">resource:///cursors/images/crosshair_cursor.png</property>
<property name="hotspot-x">15</property>
<property name="hotspot-y">15</property>
<property name="fallback">crosshair_cursor</property>
@@ -180,7 +180,7 @@
<property name="name">text</property>
</object>
<object class="GdkCursor" id="text_cursor_image">
<property name="texture">resource:///cursors/text_cursor.png</property>
<property name="texture">resource:///cursors/images/text_cursor.png</property>
<property name="hotspot-x">14</property>
<property name="hotspot-y">15</property>
</object>
@@ -189,7 +189,7 @@
<property name="fallback">text_cursor_image</property>
</object>
<object class="GdkCursor" id="text_cursor_image_fallback">
<property name="texture">resource:///cursors/text_cursor.png</property>
<property name="texture">resource:///cursors/images/text_cursor.png</property>
<property name="hotspot-x">14</property>
<property name="hotspot-y">15</property>
<property name="fallback">text_cursor</property>
@@ -198,7 +198,7 @@
<property name="name">vertical-text</property>
</object>
<object class="GdkCursor" id="vertical-text_cursor_image">
<property name="texture">resource:///cursors/vertical_text_cursor.png</property>
<property name="texture">resource:///cursors/images/vertical_text_cursor.png</property>
<property name="hotspot-x">16</property>
<property name="hotspot-y">15</property>
</object>
@@ -207,7 +207,7 @@
<property name="fallback">vertical-text_cursor_image</property>
</object>
<object class="GdkCursor" id="vertical-text_cursor_image_fallback">
<property name="texture">resource:///cursors/vertical_text_cursor.png</property>
<property name="texture">resource:///cursors/images/vertical_text_cursor.png</property>
<property name="hotspot-x">16</property>
<property name="hotspot-y">15</property>
<property name="fallback">vertical-text_cursor</property>
@@ -216,7 +216,7 @@
<property name="name">alias</property>
</object>
<object class="GdkCursor" id="alias_cursor_image">
<property name="texture">resource:///cursors/alias_cursor.png</property>
<property name="texture">resource:///cursors/images/alias_cursor.png</property>
<property name="hotspot-x">12</property>
<property name="hotspot-y">11</property>
</object>
@@ -225,7 +225,7 @@
<property name="fallback">alias_cursor_image</property>
</object>
<object class="GdkCursor" id="alias_cursor_image_fallback">
<property name="texture">resource:///cursors/alias_cursor.png</property>
<property name="texture">resource:///cursors/images/alias_cursor.png</property>
<property name="hotspot-x">12</property>
<property name="hotspot-y">11</property>
<property name="fallback">alias_cursor</property>
@@ -234,7 +234,7 @@
<property name="name">copy</property>
</object>
<object class="GdkCursor" id="copy_cursor_image">
<property name="texture">resource:///cursors/copy_cursor.png</property>
<property name="texture">resource:///cursors/images/copy_cursor.png</property>
<property name="hotspot-x">12</property>
<property name="hotspot-y">11</property>
</object>
@@ -243,7 +243,7 @@
<property name="fallback">copy_cursor_image</property>
</object>
<object class="GdkCursor" id="copy_cursor_image_fallback">
<property name="texture">resource:///cursors/copy_cursor.png</property>
<property name="texture">resource:///cursors/images/copy_cursor.png</property>
<property name="hotspot-x">12</property>
<property name="hotspot-y">11</property>
<property name="fallback">copy_cursor</property>
@@ -252,7 +252,7 @@
<property name="name">move</property>
</object>
<object class="GdkCursor" id="move_cursor_image">
<property name="texture">resource:///cursors/move_cursor.png</property>
<property name="texture">resource:///cursors/images/move_cursor.png</property>
<property name="hotspot-x">12</property>
<property name="hotspot-y">11</property>
</object>
@@ -261,7 +261,7 @@
<property name="fallback">move_cursor_image</property>
</object>
<object class="GdkCursor" id="move_cursor_image_fallback">
<property name="texture">resource:///cursors/move_cursor.png</property>
<property name="texture">resource:///cursors/images/move_cursor.png</property>
<property name="hotspot-x">12</property>
<property name="hotspot-y">11</property>
<property name="fallback">move_cursor</property>
@@ -270,7 +270,7 @@
<property name="name">no-drop</property>
</object>
<object class="GdkCursor" id="no-drop_cursor_image">
<property name="texture">resource:///cursors/no_drop_cursor.png</property>
<property name="texture">resource:///cursors/images/no_drop_cursor.png</property>
<property name="hotspot-x">12</property>
<property name="hotspot-y">11</property>
</object>
@@ -279,7 +279,7 @@
<property name="fallback">no-drop_cursor_image</property>
</object>
<object class="GdkCursor" id="no-drop_cursor_image_fallback">
<property name="texture">resource:///cursors/no_drop_cursor.png</property>
<property name="texture">resource:///cursors/images/no_drop_cursor.png</property>
<property name="hotspot-x">12</property>
<property name="hotspot-y">11</property>
<property name="fallback">no-drop_cursor</property>
@@ -288,7 +288,7 @@
<property name="name">not-allowed</property>
</object>
<object class="GdkCursor" id="not-allowed_cursor_image">
<property name="texture">resource:///cursors/not_allowed_cursor.png</property>
<property name="texture">resource:///cursors/images/not_allowed_cursor.png</property>
<property name="hotspot-x">12</property>
<property name="hotspot-y">11</property>
</object>
@@ -297,7 +297,7 @@
<property name="fallback">not-allowed_cursor_image</property>
</object>
<object class="GdkCursor" id="not-allowed_cursor_image_fallback">
<property name="texture">resource:///cursors/not_allowed_cursor.png</property>
<property name="texture">resource:///cursors/images/not_allowed_cursor.png</property>
<property name="hotspot-x">12</property>
<property name="hotspot-y">11</property>
<property name="fallback">not-allowed_cursor</property>
@@ -306,7 +306,7 @@
<property name="name">grab</property>
</object>
<object class="GdkCursor" id="grab_cursor_image">
<property name="texture">resource:///cursors/grab_cursor.png</property>
<property name="texture">resource:///cursors/images/grab_cursor.png</property>
<property name="hotspot-x">10</property>
<property name="hotspot-y">6</property>
</object>
@@ -315,7 +315,7 @@
<property name="fallback">grab_cursor_image</property>
</object>
<object class="GdkCursor" id="grab_cursor_image_fallback">
<property name="texture">resource:///cursors/grab_cursor.png</property>
<property name="texture">resource:///cursors/images/grab_cursor.png</property>
<property name="hotspot-x">10</property>
<property name="hotspot-y">6</property>
<property name="fallback">grab_cursor</property>
@@ -324,7 +324,7 @@
<property name="name">grabbing</property>
</object>
<object class="GdkCursor" id="grabbing_cursor_image">
<property name="texture">resource:///cursors/grabbing_cursor.png</property>
<property name="texture">resource:///cursors/images/grabbing_cursor.png</property>
<property name="hotspot-x">15</property>
<property name="hotspot-y">14</property>
</object>
@@ -333,7 +333,7 @@
<property name="fallback">grabbing_cursor_image</property>
</object>
<object class="GdkCursor" id="grabbing_cursor_image_fallback">
<property name="texture">resource:///cursors/grabbing_cursor.png</property>
<property name="texture">resource:///cursors/images/grabbing_cursor.png</property>
<property name="hotspot-x">15</property>
<property name="hotspot-y">14</property>
<property name="fallback">grabbing_cursor</property>
@@ -342,7 +342,7 @@
<property name="name">all-scroll</property>
</object>
<object class="GdkCursor" id="all-scroll_cursor_image">
<property name="texture">resource:///cursors/all_scroll_cursor.png</property>
<property name="texture">resource:///cursors/images/all_scroll_cursor.png</property>
<property name="hotspot-x">15</property>
<property name="hotspot-y">15</property>
</object>
@@ -351,7 +351,7 @@
<property name="fallback">all-scroll_cursor_image</property>
</object>
<object class="GdkCursor" id="all-scroll_cursor_image_fallback">
<property name="texture">resource:///cursors/all_scroll_cursor.png</property>
<property name="texture">resource:///cursors/images/all_scroll_cursor.png</property>
<property name="hotspot-x">15</property>
<property name="hotspot-y">15</property>
<property name="fallback">all-scroll_cursor</property>
@@ -360,7 +360,7 @@
<property name="name">col-resize</property>
</object>
<object class="GdkCursor" id="col-resize_cursor_image">
<property name="texture">resource:///cursors/col_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/col_resize_cursor.png</property>
<property name="hotspot-x">16</property>
<property name="hotspot-y">15</property>
</object>
@@ -369,7 +369,7 @@
<property name="fallback">col-resize_cursor_image</property>
</object>
<object class="GdkCursor" id="col-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/col_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/col_resize_cursor.png</property>
<property name="hotspot-x">16</property>
<property name="hotspot-y">15</property>
<property name="fallback">col-resize_cursor</property>
@@ -378,7 +378,7 @@
<property name="name">row-resize</property>
</object>
<object class="GdkCursor" id="row-resize_cursor_image">
<property name="texture">resource:///cursors/row_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/row_resize_cursor.png</property>
<property name="hotspot-x">15</property>
<property name="hotspot-y">17</property>
</object>
@@ -387,7 +387,7 @@
<property name="fallback">row-resize_cursor_image</property>
</object>
<object class="GdkCursor" id="row-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/row_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/row_resize_cursor.png</property>
<property name="hotspot-x">15</property>
<property name="hotspot-y">17</property>
<property name="fallback">row-resize_cursor</property>
@@ -396,7 +396,7 @@
<property name="name">n-resize</property>
</object>
<object class="GdkCursor" id="n-resize_cursor_image">
<property name="texture">resource:///cursors/n_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/n_resize_cursor.png</property>
<property name="hotspot-x">17</property>
<property name="hotspot-y">7</property>
</object>
@@ -405,7 +405,7 @@
<property name="fallback">n-resize_cursor_image</property>
</object>
<object class="GdkCursor" id="n-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/n_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/n_resize_cursor.png</property>
<property name="hotspot-x">17</property>
<property name="hotspot-y">7</property>
<property name="fallback">n-resize_cursor</property>
@@ -414,7 +414,7 @@
<property name="name">e-resize</property>
</object>
<object class="GdkCursor" id="e-resize_cursor_image">
<property name="texture">resource:///cursors/e_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/e_resize_cursor.png</property>
<property name="hotspot-x">25</property>
<property name="hotspot-y">17</property>
</object>
@@ -423,7 +423,7 @@
<property name="fallback">e-resize_cursor_image</property>
</object>
<object class="GdkCursor" id="e-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/e_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/e_resize_cursor.png</property>
<property name="hotspot-x">25</property>
<property name="hotspot-y">17</property>
<property name="fallback">e-resize_cursor</property>
@@ -432,7 +432,7 @@
<property name="name">s-resize</property>
</object>
<object class="GdkCursor" id="s-resize_cursor_image">
<property name="texture">resource:///cursors/s_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/s_resize_cursor.png</property>
<property name="hotspot-x">17</property>
<property name="hotspot-y">23</property>
</object>
@@ -441,7 +441,7 @@
<property name="fallback">s-resize_cursor_image</property>
</object>
<object class="GdkCursor" id="s-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/s_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/s_resize_cursor.png</property>
<property name="hotspot-x">17</property>
<property name="hotspot-y">23</property>
<property name="fallback">s-resize_cursor</property>
@@ -450,7 +450,7 @@
<property name="name">w-resize</property>
</object>
<object class="GdkCursor" id="w-resize_cursor_image">
<property name="texture">resource:///cursors/w_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/w_resize_cursor.png</property>
<property name="hotspot-x">8</property>
<property name="hotspot-y">17</property>
</object>
@@ -459,7 +459,7 @@
<property name="fallback">w-resize_cursor_image</property>
</object>
<object class="GdkCursor" id="w-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/w_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/w_resize_cursor.png</property>
<property name="hotspot-x">8</property>
<property name="hotspot-y">17</property>
<property name="fallback">w-resize_cursor</property>
@@ -468,7 +468,7 @@
<property name="name">ne-resize</property>
</object>
<object class="GdkCursor" id="ne-resize_cursor_image">
<property name="texture">resource:///cursors/ne_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/ne_resize_cursor.png</property>
<property name="hotspot-x">20</property>
<property name="hotspot-y">13</property>
</object>
@@ -477,7 +477,7 @@
<property name="fallback">ne-resize_cursor_image</property>
</object>
<object class="GdkCursor" id="ne-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/ne_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/ne_resize_cursor.png</property>
<property name="hotspot-x">20</property>
<property name="hotspot-y">13</property>
<property name="fallback">ne-resize_cursor</property>
@@ -486,7 +486,7 @@
<property name="name">nw-resize</property>
</object>
<object class="GdkCursor" id="nw-resize_cursor_image">
<property name="texture">resource:///cursors/nw_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/nw_resize_cursor.png</property>
<property name="hotspot-x">13</property>
<property name="hotspot-y">13</property>
</object>
@@ -495,7 +495,7 @@
<property name="fallback">nw-resize_cursor_image</property>
</object>
<object class="GdkCursor" id="nw-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/nw_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/nw_resize_cursor.png</property>
<property name="hotspot-x">13</property>
<property name="hotspot-y">13</property>
<property name="fallback">nw-resize_cursor</property>
@@ -504,7 +504,7 @@
<property name="name">se-resize</property>
</object>
<object class="GdkCursor" id="se-resize_cursor_image">
<property name="texture">resource:///cursors/se_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/se_resize_cursor.png</property>
<property name="hotspot-x">19</property>
<property name="hotspot-y">19</property>
</object>
@@ -513,7 +513,7 @@
<property name="fallback">se-resize_cursor_image</property>
</object>
<object class="GdkCursor" id="se-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/se_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/se_resize_cursor.png</property>
<property name="hotspot-x">19</property>
<property name="hotspot-y">19</property>
<property name="fallback">se-resize_cursor</property>
@@ -522,7 +522,7 @@
<property name="name">sw-resize</property>
</object>
<object class="GdkCursor" id="sw-resize_cursor_image">
<property name="texture">resource:///cursors/sw_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/sw_resize_cursor.png</property>
<property name="hotspot-x">13</property>
<property name="hotspot-y">19</property>
</object>
@@ -531,7 +531,7 @@
<property name="fallback">sw-resize_cursor_image</property>
</object>
<object class="GdkCursor" id="sw-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/sw_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/sw_resize_cursor.png</property>
<property name="hotspot-x">13</property>
<property name="hotspot-y">19</property>
<property name="fallback">sw-resize_cursor</property>
@@ -540,7 +540,7 @@
<property name="name">ew-resize</property>
</object>
<object class="GdkCursor" id="ew-resize_cursor_image">
<property name="texture">resource:///cursors/ew_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/ew_resize_cursor.png</property>
<property name="hotspot-x">16</property>
<property name="hotspot-y">15</property>
</object>
@@ -549,7 +549,7 @@
<property name="fallback">ew-resize_cursor_image</property>
</object>
<object class="GdkCursor" id="ew-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/ew_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/ew_resize_cursor.png</property>
<property name="hotspot-x">16</property>
<property name="hotspot-y">15</property>
<property name="fallback">ew-resize_cursor</property>
@@ -558,7 +558,7 @@
<property name="name">ns-resize</property>
</object>
<object class="GdkCursor" id="ns-resize_cursor_image">
<property name="texture">resource:///cursors/ns_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/ns_resize_cursor.png</property>
<property name="hotspot-x">15</property>
<property name="hotspot-y">17</property>
</object>
@@ -567,7 +567,7 @@
<property name="fallback">ns-resize_cursor_image</property>
</object>
<object class="GdkCursor" id="ns-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/ns_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/ns_resize_cursor.png</property>
<property name="hotspot-x">15</property>
<property name="hotspot-y">17</property>
<property name="fallback">ns-resize_cursor</property>
@@ -576,7 +576,7 @@
<property name="name">nesw-resize</property>
</object>
<object class="GdkCursor" id="nesw-resize_cursor_image">
<property name="texture">resource:///cursors/nesw_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/nesw_resize_cursor.png</property>
<property name="hotspot-x">14</property>
<property name="hotspot-y">14</property>
</object>
@@ -585,7 +585,7 @@
<property name="fallback">nesw-resize_cursor_image</property>
</object>
<object class="GdkCursor" id="nesw-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/nesw_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/nesw_resize_cursor.png</property>
<property name="hotspot-x">14</property>
<property name="hotspot-y">14</property>
<property name="fallback">nesw-resize_cursor</property>
@@ -594,7 +594,7 @@
<property name="name">nwse-resize</property>
</object>
<object class="GdkCursor" id="nwse-resize_cursor_image">
<property name="texture">resource:///cursors/nwse_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/nwse_resize_cursor.png</property>
<property name="hotspot-x">14</property>
<property name="hotspot-y">14</property>
</object>
@@ -603,7 +603,7 @@
<property name="fallback">nwse-resize_cursor_image</property>
</object>
<object class="GdkCursor" id="nwse-resize_cursor_image_fallback">
<property name="texture">resource:///cursors/nwse_resize_cursor.png</property>
<property name="texture">resource:///cursors/images/nwse_resize_cursor.png</property>
<property name="hotspot-x">14</property>
<property name="hotspot-y">14</property>
<property name="fallback">nwse-resize_cursor</property>
@@ -612,7 +612,7 @@
<property name="name">zoom-in</property>
</object>
<object class="GdkCursor" id="zoom-in_cursor_image">
<property name="texture">resource:///cursors/zoom_in_cursor.png</property>
<property name="texture">resource:///cursors/images/zoom_in_cursor.png</property>
<property name="hotspot-x">14</property>
<property name="hotspot-y">13</property>
</object>
@@ -621,7 +621,7 @@
<property name="fallback">zoom-in_cursor_image</property>
</object>
<object class="GdkCursor" id="zoom-in_cursor_image_fallback">
<property name="texture">resource:///cursors/zoom_in_cursor.png</property>
<property name="texture">resource:///cursors/images/zoom_in_cursor.png</property>
<property name="hotspot-x">14</property>
<property name="hotspot-y">13</property>
<property name="fallback">zoom-in_cursor</property>
@@ -630,7 +630,7 @@
<property name="name">zoom-out</property>
</object>
<object class="GdkCursor" id="zoom-out_cursor_image">
<property name="texture">resource:///cursors/zoom_out_cursor.png</property>
<property name="texture">resource:///cursors/images/zoom_out_cursor.png</property>
<property name="hotspot-x">14</property>
<property name="hotspot-y">13</property>
</object>
@@ -639,7 +639,7 @@
<property name="fallback">zoom-out_cursor_image</property>
</object>
<object class="GdkCursor" id="zoom-out_cursor_image_fallback">
<property name="texture">resource:///cursors/zoom_out_cursor.png</property>
<property name="texture">resource:///cursors/images/zoom_out_cursor.png</property>
<property name="hotspot-x">14</property>
<property name="hotspot-y">13</property>
<property name="fallback">zoom-out_cursor</property>
@@ -682,7 +682,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/default_cursor.png</property>
<property name="paintable">resource:///cursors/images/default_cursor.png</property>
</object>
</child>
<child>
@@ -742,7 +742,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/none_cursor.png</property>
<property name="paintable">resource:///cursors/images/none_cursor.png</property>
</object>
</child>
<child>
@@ -802,7 +802,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/gtk_logo_cursor.png</property>
<property name="paintable">resource:///cursors/images/gtk_logo_cursor.png</property>
</object>
</child>
<child>
@@ -875,7 +875,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/context_menu_cursor.png</property>
<property name="paintable">resource:///cursors/images/context_menu_cursor.png</property>
</object>
</child>
<child>
@@ -935,7 +935,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/help_cursor.png</property>
<property name="paintable">resource:///cursors/images/help_cursor.png</property>
</object>
</child>
<child>
@@ -995,7 +995,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/pointer_cursor.png</property>
<property name="paintable">resource:///cursors/images/pointer_cursor.png</property>
</object>
</child>
<child>
@@ -1055,7 +1055,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/progress_cursor.png</property>
<property name="paintable">resource:///cursors/images/progress_cursor.png</property>
</object>
</child>
<child>
@@ -1115,7 +1115,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/wait_cursor.png</property>
<property name="paintable">resource:///cursors/images/wait_cursor.png</property>
</object>
</child>
<child>
@@ -1188,7 +1188,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/cell_cursor.png</property>
<property name="paintable">resource:///cursors/images/cell_cursor.png</property>
</object>
</child>
<child>
@@ -1248,7 +1248,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/crosshair_cursor.png</property>
<property name="paintable">resource:///cursors/images/crosshair_cursor.png</property>
</object>
</child>
<child>
@@ -1308,7 +1308,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/text_cursor.png</property>
<property name="paintable">resource:///cursors/images/text_cursor.png</property>
</object>
</child>
<child>
@@ -1368,7 +1368,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/vertical_text_cursor.png</property>
<property name="paintable">resource:///cursors/images/vertical_text_cursor.png</property>
</object>
</child>
<child>
@@ -1441,7 +1441,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/alias_cursor.png</property>
<property name="paintable">resource:///cursors/images/alias_cursor.png</property>
</object>
</child>
<child>
@@ -1501,7 +1501,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/copy_cursor.png</property>
<property name="paintable">resource:///cursors/images/copy_cursor.png</property>
</object>
</child>
<child>
@@ -1561,7 +1561,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/move_cursor.png</property>
<property name="paintable">resource:///cursors/images/move_cursor.png</property>
</object>
</child>
<child>
@@ -1621,7 +1621,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/no_drop_cursor.png</property>
<property name="paintable">resource:///cursors/images/no_drop_cursor.png</property>
</object>
</child>
<child>
@@ -1681,7 +1681,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/not_allowed_cursor.png</property>
<property name="paintable">resource:///cursors/images/not_allowed_cursor.png</property>
</object>
</child>
<child>
@@ -1741,7 +1741,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/grab_cursor.png</property>
<property name="paintable">resource:///cursors/images/grab_cursor.png</property>
</object>
</child>
<child>
@@ -1801,7 +1801,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/grabbing_cursor.png</property>
<property name="paintable">resource:///cursors/images/grabbing_cursor.png</property>
</object>
</child>
<child>
@@ -1874,7 +1874,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/all_scroll_cursor.png</property>
<property name="paintable">resource:///cursors/images/all_scroll_cursor.png</property>
</object>
</child>
<child>
@@ -1934,7 +1934,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/col_resize_cursor.png</property>
<property name="paintable">resource:///cursors/images/col_resize_cursor.png</property>
</object>
</child>
<child>
@@ -1994,7 +1994,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/row_resize_cursor.png</property>
<property name="paintable">resource:///cursors/images/row_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2054,7 +2054,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/n_resize_cursor.png</property>
<property name="paintable">resource:///cursors/images/n_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2114,7 +2114,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/e_resize_cursor.png</property>
<property name="paintable">resource:///cursors/images/e_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2174,7 +2174,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/s_resize_cursor.png</property>
<property name="paintable">resource:///cursors/images/s_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2234,7 +2234,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/w_resize_cursor.png</property>
<property name="paintable">resource:///cursors/images/w_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2294,7 +2294,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/ne_resize_cursor.png</property>
<property name="paintable">resource:///cursors/images/ne_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2354,7 +2354,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/nw_resize_cursor.png</property>
<property name="paintable">resource:///cursors/images/nw_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2414,7 +2414,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/sw_resize_cursor.png</property>
<property name="paintable">resource:///cursors/images/sw_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2474,7 +2474,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/se_resize_cursor.png</property>
<property name="paintable">resource:///cursors/images/se_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2534,7 +2534,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/ew_resize_cursor.png</property>
<property name="paintable">resource:///cursors/images/ew_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2594,7 +2594,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/ns_resize_cursor.png</property>
<property name="paintable">resource:///cursors/images/ns_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2654,7 +2654,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/nesw_resize_cursor.png</property>
<property name="paintable">resource:///cursors/images/nesw_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2714,7 +2714,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/nwse_resize_cursor.png</property>
<property name="paintable">resource:///cursors/images/nwse_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2787,7 +2787,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/zoom_in_cursor.png</property>
<property name="paintable">resource:///cursors/images/zoom_in_cursor.png</property>
</object>
</child>
<child>
@@ -2847,7 +2847,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="paintable">resource:///cursors/zoom_out_cursor.png</property>
<property name="paintable">resource:///cursors/images/zoom_out_cursor.png</property>
</object>
</child>
<child>

View File

@@ -51,6 +51,8 @@
<file>cssview.css</file>
<file>reset.css</file>
<file>background.jpg</file>
</gresource>
<gresource prefix="/css_pixbufs/images">
<file>apple-red.png</file>
<file>gnome-applets.png</file>
<file>gnome-calendar.png</file>
@@ -67,6 +69,8 @@
</gresource>
<gresource prefix="/cursors">
<file>cursors.ui</file>
</gresource>
<gresource prefix="/cursors/images">
<file>alias_cursor.png</file>
<file>all_scroll_cursor.png</file>
<file>cell_cursor.png</file>
@@ -108,6 +112,9 @@
<gresource prefix="/dnd">
<file>dnd.css</file>
</gresource>
<gresource prefix="/errorstates">
<file>errorstates.ui</file>
</gresource>
<gresource prefix="/fishbowl">
<file>fishbowl.ui</file>
<file>gtkfishbowl.c</file>
@@ -117,6 +124,27 @@
<file>gtkgears.c</file>
<file>gtkgears.h</file>
</gresource>
<gresource prefix="/shadertoy">
<file>gtkshadertoy.c</file>
<file>gtkshadertoy.h</file>
<file>alienplanet.glsl</file>
<file>mandelbrot.glsl</file>
<file>neon.glsl</file>
<file>cogs.glsl</file>
<file>glowingstars.glsl</file>
</gresource>
<gresource prefix="/gltransition">
<file>gtkshaderstack.c</file>
<file>gtkshaderstack.h</file>
<file>gtkshaderbin.h</file>
<file>gtkshaderbin.c</file>
<file>fire.glsl</file>
<file>transition1.glsl</file>
<file>transition2.glsl</file>
<file>transition3.glsl</file>
<file>transition4.glsl</file>
<file>cogs2.glsl</file>
</gresource>
<gresource prefix="/iconscroll">
<file>iconscroll.ui</file>
</gresource>
@@ -124,6 +152,24 @@
<file>gnome-fs-directory.png</file>
<file>gnome-fs-regular.png</file>
</gresource>
<gresource prefix="/layoutmanager">
<file>demolayout.h</file>
<file>demolayout.c</file>
<file>demowidget.h</file>
<file>demowidget.c</file>
<file>demochild.h</file>
<file>demochild.c</file>
</gresource>
<gresource prefix="/layoutmanager2">
<file>demo2layout.h</file>
<file>demo2layout.c</file>
<file>demo2widget.h</file>
<file>demo2widget.c</file>
<file>four_point_transform.h</file>
<file>four_point_transform.c</file>
<file>singular_value_decomposition.h</file>
<file>singular_value_decomposition.c</file>
</gresource>
<gresource prefix="/listview_filebrowser">
<file>listview_filebrowser.ui</file>
<file>listview_filebrowser.css</file>
@@ -142,6 +188,16 @@
<file compressed="true">color.names.txt</file>
<file>listview_colors.css</file>
</gresource>
<gresource prefix="/main">
<file>fontify.c</file>
<file>fontify.h</file>
<file>main.ui</file>
</gresource>
<gresource prefix="/menu">
<file>demo3widget.c</file>
<file>demo3widget.h</file>
<file>demo3widget.ui</file>
</gresource>
<gresource prefix="/shortcuts">
<file>shortcuts.ui</file>
<file>shortcuts-builder.ui</file>
@@ -165,16 +221,8 @@
<file>floppybuddy.gif</file>
<file>gtk-logo.webm</file>
</gresource>
<gresource prefix="/pixbufs">
<file>apple-red.png</file>
<file>background.jpg</file>
<file>gnome-applets.png</file>
<file>gnome-calendar.png</file>
<file>gnome-foot.png</file>
<file>gnome-gmush.png</file>
<file>gnome-gimp.png</file>
<file>gnome-gsame.png</file>
<file>gnu-keys.png</file>
<gresource prefix="/video-player">
<file>bbb.png</file>
</gresource>
<gresource prefix="/sources">
<file>application_demo.c</file>
@@ -199,6 +247,7 @@
<file>editable_cells.c</file>
<file>entry_completion.c</file>
<file>entry_undo.c</file>
<file>errorstates.c</file>
<file>expander.c</file>
<file>filtermodel.c</file>
<file>fishbowl.c</file>
@@ -210,6 +259,7 @@
<file>gears.c</file>
<file>gestures.c</file>
<file>glarea.c</file>
<file>gltransition.c</file>
<file>headerbar.c</file>
<file>hypertext.c</file>
<file>iconscroll.c</file>
@@ -217,8 +267,11 @@
<file>iconview_edit.c</file>
<file>images.c</file>
<file>infobar.c</file>
<file>layoutmanager.c</file>
<file>layoutmanager2.c</file>
<file>links.c</file>
<file>listbox.c</file>
<file>listbox2.c</file>
<file>listview_applauncher.c</file>
<file>listview_colors.c</file>
<file>listview_clocks.c</file>
@@ -228,26 +281,28 @@
<file>listview_weather.c</file>
<file>listview_words.c</file>
<file>list_store.c</file>
<file>main.c</file>
<file>markup.c</file>
<file>modelbutton.c</file>
<file>menu.c</file>
<file>overlay.c</file>
<file>overlay2.c</file>
<file>paint.c</file>
<file>pagesetup.c</file>
<file>paintable.c</file>
<file>paintable_animated.c</file>
<file>paintable_emblem.c</file>
<file>paintable_mediastream.c</file>
<file>panes.c</file>
<file>password_entry.c</file>
<file>peg_solitaire.c</file>
<file>pickers.c</file>
<file>pixbufs.c</file>
<file>printing.c</file>
<file>revealer.c</file>
<file>rotated_text.c</file>
<file>scale.c</file>
<file>search_entry.c</file>
<file>search_entry2.c</file>
<file>shadertoy.c</file>
<file>shortcuts.c</file>
<file>shortcut_triggers.c</file>
<file>sizegroup.c</file>
@@ -279,6 +334,9 @@
<file>messages.txt</file>
<file>apple-red.png</file>
</gresource>
<gresource prefix="/listbox2">
<file>listbox2.ui</file>
</gresource>
<gresource prefix="/glarea">
<file>glarea-gl.fs.glsl</file>
<file>glarea-gl.vs.glsl</file>
@@ -310,9 +368,6 @@
<gresource prefix="/scale">
<file>scale.ui</file>
</gresource>
<gresource prefix="/modelbutton">
<file>modelbutton.ui</file>
</gresource>
<gresource prefix="/tagged_entry">
<file>demotaggedentry.c</file>
<file>demotaggedentry.h</file>

View File

@@ -29,29 +29,24 @@
<item>
<attribute name="label" translatable="yes">_New</attribute>
<attribute name="action">win.new</attribute>
<attribute name="accel">&lt;Control&gt;n</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Open</attribute>
<attribute name="action">win.open</attribute>
<attribute name="accel">&lt;Control&gt;o</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Save</attribute>
<attribute name="action">win.save</attribute>
<attribute name="accel">&lt;Control&gt;s</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Save _As</attribute>
<attribute name="action">win.save-as</attribute>
<attribute name="accel">&lt;Control&gt;q</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">win.quit</attribute>
<attribute name="accel">&lt;Control&gt;&lt;Shift&gt;s</attribute>
</item>
</section>
</submenu>
@@ -61,17 +56,14 @@
<item>
<attribute name="label" translatable="yes">_Copy</attribute>
<attribute name="action">win.copy</attribute>
<attribute name="accel">&lt;Control&gt;c</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Cut</attribute>
<attribute name="action">win.cut</attribute>
<attribute name="accel">&lt;Control&gt;x</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Paste</attribute>
<attribute name="action">win.paste</attribute>
<attribute name="accel">&lt;Control&gt;v</attribute>
</item>
</section>
</submenu>
@@ -81,12 +73,10 @@
<item>
<attribute name="label" translatable="yes">_Help</attribute>
<attribute name="action">win.help</attribute>
<attribute name="accel">F1</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_About</attribute>
<attribute name="action">win.about</attribute>
<attribute name="accel">F7</attribute>
</item>
</section>
</submenu>
@@ -95,9 +85,6 @@
<property name="program-name" translatable="yes">Builder demo</property>
<property name="logo-icon-name" translatable="yes">gtk3-demo</property>
<property name="modal">True</property>
<accessibility>
<relation target="window1" type="subwindow-of"/>
</accessibility>
</object>
<object class="GtkWindow" id="window1">
<property name="default-height">250</property>
@@ -113,16 +100,15 @@
</child>
<child>
<object class="GtkBox" id="toolbar1">
<child internal-child="accessible">
<object class="AtkObject" id="a11y-toolbar">
<property name="AtkObject::accessible-name">The toolbar</property>
</object>
</child>
<style>
<class name="toolbar"/>
</style>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">New</property>
<property name="tooltip-text" translatable="yes">Create a new file</property>
<property name="icon-name">document-new</property>
<property name="action-name">win.new</property>
</object>
</child>
<child>
@@ -130,6 +116,7 @@
<property name="label" translatable="yes">Open</property>
<property name="tooltip-text" translatable="yes">Open a file</property>
<property name="icon-name">document-open</property>
<property name="action-name">win.open</property>
</object>
</child>
<child>
@@ -137,6 +124,7 @@
<property name="label" translatable="yes">Save</property>
<property name="tooltip-text" translatable="yes">Save a file</property>
<property name="icon-name">document-save</property>
<property name="action-name">win.save</property>
</object>
</child>
<child>
@@ -147,6 +135,7 @@
<property name="label" translatable="yes">Copy</property>
<property name="tooltip-text" translatable="yes">Copy selected object into the clipboard</property>
<property name="icon-name">edit-copy</property>
<property name="action-name">win.copy</property>
</object>
</child>
<child>
@@ -154,6 +143,7 @@
<property name="label" translatable="yes">Cut</property>
<property name="tooltip-text" translatable="yes">Cut selected object into the clipboard</property>
<property name="icon-name">edit-cut</property>
<property name="action-name">win.cut</property>
</object>
</child>
<child>
@@ -161,6 +151,7 @@
<property name="label" translatable="yes">Paste</property>
<property name="tooltip-text" translatable="yes">Paste object from the clipboard</property>
<property name="icon-name">edit-paste</property>
<property name="action-name">win.paste</property>
</object>
</child>
</object>
@@ -174,14 +165,6 @@
<object class="GtkTreeView" id="treeview1">
<property name="model">liststore1</property>
<property name="tooltip-column">3</property>
<child internal-child="accessible">
<object class="AtkObject" id="a11y-treeview">
<property name="AtkObject::accessible-name">Name list</property>
<property name="AtkObject::accessible-description">
A list of person with name, surname and age columns
</property>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="column1">
<property name="title">Name</property>

View File

@@ -0,0 +1,204 @@
#include "demo2layout.h"
#include "four_point_transform.h"
struct _Demo2Layout
{
GtkLayoutManager parent_instance;
float position;
float offset;
};
struct _Demo2LayoutClass
{
GtkLayoutManagerClass parent_class;
};
G_DEFINE_TYPE (Demo2Layout, demo2_layout, GTK_TYPE_LAYOUT_MANAGER)
static void
demo2_layout_measure (GtkLayoutManager *layout_manager,
GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
GtkWidget *child;
int minimum_size = 0;
int natural_size = 0;
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
{
int child_min = 0, child_nat = 0;
if (!gtk_widget_should_layout (child))
continue;
gtk_widget_measure (child, orientation, -1,
&child_min, &child_nat,
NULL, NULL);
minimum_size = MAX (minimum_size, child_min);
natural_size = MAX (natural_size, child_nat);
}
*minimum = minimum_size;
*natural = 3 * natural_size;
}
#define RADIANS(angle) ((angle)*M_PI/180.0);
/* Spherical coordinates */
#define SX(r,t,p) ((r) * sin (t) * cos (p))
#define SZ(r,t,p) ((r) * sin (t) * sin (p))
#define SY(r,t,p) ((r) * cos (t))
static double
map_offset (double x)
{
x = fmod (x, 180.0);
if (x < 0.0)
x += 180.0;
return x;
}
static void
demo2_layout_allocate (GtkLayoutManager *layout_manager,
GtkWidget *widget,
int width,
int height,
int baseline)
{
GtkWidget *child;
GtkRequisition child_req;
int i, j, k;
float x0, y0;
float w, h;
graphene_point3d_t p1, p2, p3, p4;
graphene_point3d_t q1, q2, q3, q4;
double t_1, t_2, p_1, p_2;
double r;
graphene_matrix_t m;
GskTransform *transform;
double position = DEMO2_LAYOUT (layout_manager)->position;
double offset = DEMO2_LAYOUT (layout_manager)->offset;
/* for simplicity, assume all children are the same size */
gtk_widget_get_preferred_size (gtk_widget_get_first_child (widget), &child_req, NULL);
w = child_req.width;
h = child_req.height;
r = 300;
x0 = y0 = 300;
for (child = gtk_widget_get_first_child (widget), i = 0;
child != NULL;
child = gtk_widget_get_next_sibling (child), i++)
{
j = i / 36;
k = i % 36;
gtk_widget_set_child_visible (child, FALSE);
graphene_point3d_init (&p1, w, h, 1.);
graphene_point3d_init (&p2, w, 0., 1.);
graphene_point3d_init (&p3, 0., 0., 1.);
graphene_point3d_init (&p4, 0., h, 1.);
t_1 = RADIANS (map_offset (offset + 10 * j));
t_2 = RADIANS (map_offset (offset + 10 * (j + 1)));
p_1 = RADIANS (position + 10 * k);
p_2 = RADIANS (position + 10 * (k + 1));
if (t_2 < t_1)
continue;
if (SZ (r, t_1, p_1) > 0 ||
SZ (r, t_2, p_1) > 0 ||
SZ (r, t_1, p_2) > 0 ||
SZ (r, t_2, p_2) > 0)
continue;
gtk_widget_set_child_visible (child, TRUE);
graphene_point3d_init (&q1, x0 + SX (r, t_1, p_1), y0 + SY (r, t_1, p_1), SZ (r, t_1, p_1));
graphene_point3d_init (&q2, x0 + SX (r, t_2, p_1), y0 + SY (r, t_2, p_1), SZ (r, t_2, p_1));
graphene_point3d_init (&q3, x0 + SX (r, t_2, p_2), y0 + SY (r, t_2, p_2), SZ (r, t_2, p_2));
graphene_point3d_init (&q4, x0 + SX (r, t_1, p_2), y0 + SY (r, t_1, p_2), SZ (r, t_1, p_2));
/* Get a matrix that moves p1 -> q1, p2 -> q2, ... */
perspective_3d (&p1, &p2, &p3, &p4,
&q1, &q2, &q3, &q4,
&m);
transform = gsk_transform_matrix (NULL, &m);
/* Since our matrix was built for transforming points with z = 1,
* prepend a translation to the z = 1 plane.
*/
transform = gsk_transform_translate_3d (transform,
&GRAPHENE_POINT3D_INIT (0, 0, 1));
gtk_widget_allocate (child, w, h, -1, transform);
}
}
static GtkSizeRequestMode
demo2_layout_get_request_mode (GtkLayoutManager *layout_manager,
GtkWidget *widget)
{
return GTK_SIZE_REQUEST_CONSTANT_SIZE;
}
static void
demo2_layout_class_init (Demo2LayoutClass *klass)
{
GtkLayoutManagerClass *layout_class = GTK_LAYOUT_MANAGER_CLASS (klass);
layout_class->get_request_mode = demo2_layout_get_request_mode;
layout_class->measure = demo2_layout_measure;
layout_class->allocate = demo2_layout_allocate;
}
static void
demo2_layout_init (Demo2Layout *self)
{
}
GtkLayoutManager *
demo2_layout_new (void)
{
return g_object_new (DEMO2_TYPE_LAYOUT, NULL);
}
void
demo2_layout_set_position (Demo2Layout *layout,
float position)
{
layout->position = position;
}
float
demo2_layout_get_position (Demo2Layout *layout)
{
return layout->position;
}
void
demo2_layout_set_offset (Demo2Layout *layout,
float offset)
{
layout->offset = offset;
}
float
demo2_layout_get_offset (Demo2Layout *layout)
{
return layout->offset;
}

View File

@@ -0,0 +1,16 @@
#pragma once
#include <gtk/gtk.h>
#define DEMO2_TYPE_LAYOUT (demo2_layout_get_type ())
G_DECLARE_FINAL_TYPE (Demo2Layout, demo2_layout, DEMO2, LAYOUT, GtkLayoutManager)
GtkLayoutManager * demo2_layout_new (void);
void demo2_layout_set_position (Demo2Layout *layout,
float position);
float demo2_layout_get_position (Demo2Layout *layout);
void demo2_layout_set_offset (Demo2Layout *layout,
float offset);
float demo2_layout_get_offset (Demo2Layout *layout);

View File

@@ -0,0 +1,172 @@
#include "demo2widget.h"
#include "demo2layout.h"
struct _Demo2Widget
{
GtkWidget parent_instance;
gint64 start_time;
gint64 end_time;
float start_position;
float end_position;
float start_offset;
float end_offset;
gboolean animating;
};
struct _Demo2WidgetClass
{
GtkWidgetClass parent_class;
};
G_DEFINE_TYPE (Demo2Widget, demo2_widget, GTK_TYPE_WIDGET)
static void
demo2_widget_init (Demo2Widget *self)
{
gtk_widget_set_focusable (GTK_WIDGET (self), TRUE);
}
static void
demo2_widget_dispose (GObject *object)
{
GtkWidget *child;
while ((child = gtk_widget_get_first_child (GTK_WIDGET (object))))
gtk_widget_unparent (child);
G_OBJECT_CLASS (demo2_widget_parent_class)->dispose (object);
}
/* From clutter-easing.c, based on Robert Penner's
* infamous easing equations, MIT license.
*/
static double
ease_out_cubic (double t)
{
double p = t - 1;
return p * p * p + 1;
}
static gboolean
update_position (GtkWidget *widget,
GdkFrameClock *clock,
gpointer data)
{
Demo2Widget *self = DEMO2_WIDGET (widget);
Demo2Layout *layout = DEMO2_LAYOUT (gtk_widget_get_layout_manager (widget));
gint64 now;
double t;
now = gdk_frame_clock_get_frame_time (clock);
if (now >= self->end_time)
{
self->animating = FALSE;
return G_SOURCE_REMOVE;
}
t = (now - self->start_time) / (double) (self->end_time - self->start_time);
t = ease_out_cubic (t);
demo2_layout_set_position (layout, self->start_position + t * (self->end_position - self->start_position));
demo2_layout_set_offset (layout, self->start_offset + t * (self->end_offset - self->start_offset));
gtk_widget_queue_allocate (widget);
return G_SOURCE_CONTINUE;
}
static void
rotate_sphere (GtkWidget *widget,
const char *action,
GVariant *parameters)
{
Demo2Widget *self = DEMO2_WIDGET (widget);
Demo2Layout *layout = DEMO2_LAYOUT (gtk_widget_get_layout_manager (widget));
GtkOrientation orientation;
int direction;
g_variant_get (parameters, "(ii)", &orientation, &direction);
self->end_position = self->start_position = demo2_layout_get_position (layout);
self->end_offset = self->start_offset = demo2_layout_get_offset (layout);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
self->end_position += 10 * direction;
else
self->end_offset += 10 * direction;
self->start_time = g_get_monotonic_time ();
self->end_time = self->start_time + 0.5 * G_TIME_SPAN_SECOND;
if (!self->animating)
{
gtk_widget_add_tick_callback (widget, update_position, NULL, NULL);
self->animating = TRUE;
}
}
static void
demo2_widget_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkWidget *child;
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
{
/* our layout manager sets this for children that are out of view */
if (!gtk_widget_get_child_visible (child))
continue;
gtk_widget_snapshot_child (widget, child, snapshot);
}
}
static void
demo2_widget_class_init (Demo2WidgetClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->dispose = demo2_widget_dispose;
widget_class->snapshot = demo2_widget_snapshot;
gtk_widget_class_install_action (widget_class, "rotate", "(ii)", rotate_sphere);
gtk_widget_class_add_binding_action (widget_class,
GDK_KEY_Left, 0,
"rotate",
"(ii)", GTK_ORIENTATION_HORIZONTAL, -1);
gtk_widget_class_add_binding_action (widget_class,
GDK_KEY_Right, 0,
"rotate",
"(ii)", GTK_ORIENTATION_HORIZONTAL, 1);
gtk_widget_class_add_binding_action (widget_class,
GDK_KEY_Up, 0,
"rotate",
"(ii)", GTK_ORIENTATION_VERTICAL, 1);
gtk_widget_class_add_binding_action (widget_class,
GDK_KEY_Down, 0,
"rotate",
"(ii)", GTK_ORIENTATION_VERTICAL, -1);
/* here is where we use our custom layout manager */
gtk_widget_class_set_layout_manager_type (widget_class, DEMO2_TYPE_LAYOUT);
}
GtkWidget *
demo2_widget_new (void)
{
return g_object_new (DEMO2_TYPE_WIDGET, NULL);
}
void
demo2_widget_add_child (Demo2Widget *self,
GtkWidget *child)
{
gtk_widget_set_parent (child, GTK_WIDGET (self));
}

View File

@@ -0,0 +1,11 @@
#pragma once
#include <gtk/gtk.h>
#define DEMO2_TYPE_WIDGET (demo2_widget_get_type ())
G_DECLARE_FINAL_TYPE (Demo2Widget, demo2_widget, DEMO2, WIDGET, GtkWidget)
GtkWidget * demo2_widget_new (void);
void demo2_widget_add_child (Demo2Widget *self,
GtkWidget *child);

View File

@@ -0,0 +1,243 @@
#include <math.h>
#include "demo3widget.h"
enum
{
PROP_PAINTABLE = 1,
PROP_SCALE
};
struct _Demo3Widget
{
GtkWidget parent_instance;
GdkPaintable *paintable;
float scale;
GtkWidget *menu;
};
struct _Demo3WidgetClass
{
GtkWidgetClass parent_class;
};
G_DEFINE_TYPE (Demo3Widget, demo3_widget, GTK_TYPE_WIDGET)
static void
demo3_widget_init (Demo3Widget *self)
{
self->scale = 1.f;
gtk_widget_init_template (GTK_WIDGET (self));
}
static void
demo3_widget_dispose (GObject *object)
{
Demo3Widget *self = DEMO3_WIDGET (object);
g_clear_object (&self->paintable);
g_clear_pointer (&self->menu, gtk_widget_unparent);
G_OBJECT_CLASS (demo3_widget_parent_class)->dispose (object);
}
static void
demo3_widget_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
Demo3Widget *self = DEMO3_WIDGET (widget);
int x, y, width, height;
double w, h;
width = gtk_widget_get_width (widget);
height = gtk_widget_get_height (widget);
w = self->scale * gdk_paintable_get_intrinsic_width (self->paintable);
h = self->scale * gdk_paintable_get_intrinsic_height (self->paintable);
x = MAX (0, (width - ceil (w)) / 2);
y = MAX (0, (height - ceil (h)) / 2);
gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_save (snapshot);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
gdk_paintable_snapshot (self->paintable, snapshot, w, h);
gtk_snapshot_restore (snapshot);
gtk_snapshot_pop (snapshot);
}
static void
demo3_widget_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
Demo3Widget *self = DEMO3_WIDGET (widget);
int size;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
size = gdk_paintable_get_intrinsic_width (self->paintable);
else
size = gdk_paintable_get_intrinsic_height (self->paintable);
*minimum = *natural = self->scale * size;
}
static void
demo3_widget_size_allocate (GtkWidget *widget,
int width,
int height,
int baseline)
{
Demo3Widget *self = DEMO3_WIDGET (widget);
/* Since we are not using a layout manager (who would do this
* for us), we need to allocate a size for our menu by calling
* gtk_native_check_resize().
*/
gtk_native_check_resize (GTK_NATIVE (self->menu));
}
static void
demo3_widget_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
Demo3Widget *self = DEMO3_WIDGET (object);
switch (prop_id)
{
case PROP_PAINTABLE:
g_clear_object (&self->paintable);
self->paintable = g_value_dup_object (value);
gtk_widget_queue_resize (GTK_WIDGET (object));
break;
case PROP_SCALE:
self->scale = g_value_get_float (value);
gtk_widget_queue_resize (GTK_WIDGET (object));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
demo3_widget_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
Demo3Widget *self = DEMO3_WIDGET (object);
switch (prop_id)
{
case PROP_PAINTABLE:
g_value_set_object (value, self->paintable);
break;
case PROP_SCALE:
g_value_set_float (value, self->scale);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
pressed_cb (GtkGestureClick *gesture,
guint n_press,
double x,
double y,
Demo3Widget *self)
{
/* We are placing our menu at the point where
* the click happened, before popping it up.
*/
gtk_popover_set_pointing_to (GTK_POPOVER (self->menu),
&(const GdkRectangle){ x, y, 1, 1 });
gtk_popover_popup (GTK_POPOVER (self->menu));
}
static void
zoom_cb (GtkWidget *widget,
const char *action_name,
GVariant *parameter)
{
Demo3Widget *self = DEMO3_WIDGET (widget);
float scale;
if (g_str_equal (action_name, "zoom.in"))
scale = MIN (10, self->scale * M_SQRT2);
else if (g_str_equal (action_name, "zoom.out"))
scale = MAX (0.01, self->scale / M_SQRT2);
else
scale = 1.0;
gtk_widget_action_set_enabled (widget, "zoom.in", scale < 10);
gtk_widget_action_set_enabled (widget, "zoom.out", scale > 0.01);
gtk_widget_action_set_enabled (widget, "zoom.reset", scale != 1);
g_object_set (widget, "scale", scale, NULL);
}
static void
demo3_widget_class_init (Demo3WidgetClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->dispose = demo3_widget_dispose;
object_class->set_property = demo3_widget_set_property;
object_class->get_property = demo3_widget_get_property;
widget_class->snapshot = demo3_widget_snapshot;
widget_class->measure = demo3_widget_measure;
widget_class->size_allocate = demo3_widget_size_allocate;
g_object_class_install_property (object_class, PROP_PAINTABLE,
g_param_spec_object ("paintable", "Paintable", "Paintable",
GDK_TYPE_PAINTABLE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_SCALE,
g_param_spec_float ("scale", "Scale", "Scale",
0.0, 10.0, 1.0,
G_PARAM_READWRITE));
/* These are the actions that we are using in the menu */
gtk_widget_class_install_action (widget_class, "zoom.in", NULL, zoom_cb);
gtk_widget_class_install_action (widget_class, "zoom.out", NULL, zoom_cb);
gtk_widget_class_install_action (widget_class, "zoom.reset", NULL, zoom_cb);
gtk_widget_class_set_template_from_resource (widget_class, "/menu/demo3widget.ui");
gtk_widget_class_bind_template_child (widget_class, Demo3Widget, menu);
gtk_widget_class_bind_template_callback (widget_class, pressed_cb);
}
GtkWidget *
demo3_widget_new (const char *resource)
{
Demo3Widget *self;
GdkPixbuf *pixbuf;
GdkPaintable *paintable;
pixbuf = gdk_pixbuf_new_from_resource (resource, NULL);
paintable = GDK_PAINTABLE (gdk_texture_new_for_pixbuf (pixbuf));
self = g_object_new (DEMO3_TYPE_WIDGET, "paintable", paintable, NULL);
g_object_unref (pixbuf);
g_object_unref (paintable);
return GTK_WIDGET (self);
}

View File

@@ -0,0 +1,8 @@
#pragma once
#include <gtk/gtk.h>
#define DEMO3_TYPE_WIDGET (demo3_widget_get_type ())
G_DECLARE_FINAL_TYPE (Demo3Widget, demo3_widget, DEMO3, WIDGET, GtkWidget)
GtkWidget * demo3_widget_new (const char *resource);

View File

@@ -0,0 +1,30 @@
<interface>
<menu id="model">
<item>
<attribute name="label">Zoom Out</attribute>
<attribute name="action">zoom.out</attribute>
</item>
<item>
<attribute name="label">Zoom In</attribute>
<attribute name="action">zoom.in</attribute>
</item>
<item>
<attribute name="label">11</attribute>
<attribute name="action">zoom.reset</attribute>
</item>
</menu>
<template class="Demo3Widget">
<child>
<object class="GtkPopoverMenu" id="menu">
<property name="has-arrow">0</property>
<property name="menu-model">model</property>
</object>
</child>
<child>
<object class="GtkGestureClick">
<property name="button">3</property>
<signal name="pressed" handler="pressed_cb"/>
</object>
</child>
</template>
</interface>

View File

@@ -0,0 +1,72 @@
#include "demochild.h"
/* This is a trivial child widget just for demo purposes.
* It draws a 32x32 square in fixed color.
*/
struct _DemoChild
{
GtkWidget parent_instance;
GdkRGBA color;
};
struct _DemoChildClass
{
GtkWidgetClass parent_class;
};
G_DEFINE_TYPE (DemoChild, demo_child, GTK_TYPE_WIDGET)
static void
demo_child_init (DemoChild *self)
{
}
static void
demo_child_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
DemoChild *self = DEMO_CHILD (widget);
int width, height;
width = gtk_widget_get_width (widget);
height = gtk_widget_get_height (widget);
gtk_snapshot_append_color (snapshot, &self->color,
&GRAPHENE_RECT_INIT(0, 0, width, height));
}
static void
demo_child_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
*minimum = *natural = 32;
}
static void
demo_child_class_init (DemoChildClass *class)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
widget_class->snapshot = demo_child_snapshot;
widget_class->measure = demo_child_measure;
}
GtkWidget *
demo_child_new (const char *color)
{
DemoChild *self;
self = g_object_new (DEMO_TYPE_CHILD,
"tooltip-text", color,
NULL);
gdk_rgba_parse (&self->color, color);
return GTK_WIDGET (self);
}

View File

@@ -0,0 +1,8 @@
#pragma once
#include <gtk/gtk.h>
#define DEMO_TYPE_CHILD (demo_child_get_type ())
G_DECLARE_FINAL_TYPE (DemoChild, demo_child, DEMO, CHILD, GtkWidget)
GtkWidget * demo_child_new (const char *color);

View File

@@ -17,7 +17,7 @@ G_DEFINE_TYPE(DemoImage, demo_image, GTK_TYPE_WIDGET)
static GdkPaintable *
get_image_paintable (GtkImage *image)
{
const gchar *icon_name;
const char *icon_name;
GtkIconTheme *icon_theme;
GtkIconPaintable *icon;

189
demos/gtk-demo/demolayout.c Normal file
View File

@@ -0,0 +1,189 @@
#include "demolayout.h"
struct _DemoLayout
{
GtkLayoutManager parent_instance;
float position;
int pos[16];
};
struct _DemoLayoutClass
{
GtkLayoutManagerClass parent_class;
};
G_DEFINE_TYPE (DemoLayout, demo_layout, GTK_TYPE_LAYOUT_MANAGER)
static void
demo_layout_measure (GtkLayoutManager *layout_manager,
GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
GtkWidget *child;
int minimum_size = 0;
int natural_size = 0;
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
{
int child_min = 0, child_nat = 0;
if (!gtk_widget_should_layout (child))
continue;
gtk_widget_measure (child, orientation, -1,
&child_min, &child_nat,
NULL, NULL);
minimum_size = MAX (minimum_size, child_min);
natural_size = MAX (natural_size, child_nat);
}
/* A back-of-a-napkin calculation to reserve enough
* space for arranging 16 children in a circle.
*/
*minimum = 16 * minimum_size / G_PI + minimum_size;
*natural = 16 * natural_size / G_PI + natural_size;
}
static void
demo_layout_allocate (GtkLayoutManager *layout_manager,
GtkWidget *widget,
int width,
int height,
int baseline)
{
DemoLayout *self = DEMO_LAYOUT (layout_manager);
GtkWidget *child;
int i;
int child_width = 0;
int child_height = 0;
int x0, y0;
float r;
float t;
t = self->position;
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
{
GtkRequisition child_req;
if (!gtk_widget_should_layout (child))
continue;
gtk_widget_get_preferred_size (child, &child_req, NULL);
child_width = MAX (child_width, child_req.width);
child_height = MAX (child_height, child_req.height);
}
/* the center of our layout */
x0 = (width / 2);
y0 = (height / 2);
/* the radius for our circle of children */
r = 8 * child_width / G_PI;
for (child = gtk_widget_get_first_child (widget), i = 0;
child != NULL;
child = gtk_widget_get_next_sibling (child), i++)
{
GtkRequisition child_req;
float a = self->pos[i] * G_PI / 8;
int gx, gy;
int cx, cy;
int x, y;
if (!gtk_widget_should_layout (child))
continue;
gtk_widget_get_preferred_size (child, &child_req, NULL);
/* The grid position of child. */
gx = x0 + (i % 4 - 2) * child_width;
gy = y0 + (i / 4 - 2) * child_height;
/* The circle position of child. Note that we
* are adjusting the position by half the child size
* to place the center of child on a centered circle.
* This assumes that the children don't use align flags
* or uneven margins that would shift the center.
*/
cx = x0 + sin (a) * r - child_req.width / 2;
cy = y0 + cos (a) * r - child_req.height / 2;
/* we interpolate between the two layouts according to
* the position value that has been set on the layout.
*/
x = t * cx + (1 - t) * gx;
y = t * cy + (1 - t) * gy;
gtk_widget_size_allocate (child,
&(const GtkAllocation){ x, y, child_width, child_height},
-1);
}
}
static GtkSizeRequestMode
demo_layout_get_request_mode (GtkLayoutManager *layout_manager,
GtkWidget *widget)
{
return GTK_SIZE_REQUEST_CONSTANT_SIZE;
}
static void
demo_layout_class_init (DemoLayoutClass *klass)
{
GtkLayoutManagerClass *layout_class = GTK_LAYOUT_MANAGER_CLASS (klass);
layout_class->get_request_mode = demo_layout_get_request_mode;
layout_class->measure = demo_layout_measure;
layout_class->allocate = demo_layout_allocate;
}
static void
demo_layout_init (DemoLayout *self)
{
int i;
for (i = 0; i < 16; i++)
self->pos[i] = i;
}
GtkLayoutManager *
demo_layout_new (void)
{
return g_object_new (DEMO_TYPE_LAYOUT, NULL);
}
void
demo_layout_set_position (DemoLayout *layout,
float position)
{
layout->position = position;
}
/* Shuffle the circle positions of the children.
* Should be called when we are in the grid layout.
*/
void
demo_layout_shuffle (DemoLayout *layout)
{
int i, j, tmp;
for (i = 0; i < 16; i++)
{
j = g_random_int_range (0, i + 1);
tmp = layout->pos[i];
layout->pos[i] = layout->pos[j];
layout->pos[j] = tmp;
}
}

View File

@@ -0,0 +1,13 @@
#pragma once
#include <gtk/gtk.h>
#define DEMO_TYPE_LAYOUT (demo_layout_get_type ())
G_DECLARE_FINAL_TYPE (DemoLayout, demo_layout, DEMO, LAYOUT, GtkLayoutManager)
GtkLayoutManager * demo_layout_new (void);
void demo_layout_set_position (DemoLayout *layout,
float position);
void demo_layout_shuffle (DemoLayout *layout);

View File

@@ -23,14 +23,12 @@
#include "demotaggedentry.h"
#include <gtk/gtk.h>
#include <gtk/gtk-a11y.h>
struct _DemoTaggedEntry
{
GtkWidget parent_instance;
GtkWidget *box;
GtkWidget *entry;
GtkWidget *text;
};
struct _DemoTaggedEntryClass
@@ -46,15 +44,10 @@ G_DEFINE_TYPE_WITH_CODE (DemoTaggedEntry, demo_tagged_entry, GTK_TYPE_WIDGET,
static void
demo_tagged_entry_init (DemoTaggedEntry *entry)
{
entry->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_parent (entry->box, GTK_WIDGET (entry));
entry->entry = gtk_text_new ();
gtk_widget_set_hexpand (entry->entry, TRUE);
gtk_widget_set_vexpand (entry->entry, TRUE);
gtk_widget_set_hexpand (entry->box, FALSE);
gtk_widget_set_vexpand (entry->box, FALSE);
gtk_box_append (GTK_BOX (entry->box), entry->entry);
entry->text = gtk_text_new ();
gtk_widget_set_hexpand (entry->text, TRUE);
gtk_widget_set_vexpand (entry->text, TRUE);
gtk_widget_set_parent (entry->text, GTK_WIDGET (entry));
gtk_editable_init_delegate (GTK_EDITABLE (entry));
}
@@ -62,12 +55,15 @@ static void
demo_tagged_entry_dispose (GObject *object)
{
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (object);
GtkWidget *child;
if (entry->entry)
if (entry->text)
gtk_editable_finish_delegate (GTK_EDITABLE (entry));
g_clear_pointer (&entry->entry, gtk_widget_unparent);
g_clear_pointer (&entry->box, gtk_widget_unparent);
while ((child = gtk_widget_get_first_child (GTK_WIDGET (entry))))
gtk_widget_unparent (child);
entry->text = NULL;
G_OBJECT_CLASS (demo_tagged_entry_parent_class)->dispose (object);
}
@@ -101,7 +97,7 @@ demo_tagged_entry_grab_focus (GtkWidget *widget)
{
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (widget);
return gtk_widget_grab_focus (entry->entry);
return gtk_widget_grab_focus (entry->text);
}
static void
@@ -118,15 +114,14 @@ demo_tagged_entry_class_init (DemoTaggedEntryClass *klass)
gtk_editable_install_properties (object_class, 1);
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_ENTRY_ACCESSIBLE);
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT);
gtk_widget_class_set_css_name (widget_class, "entry");
}
static GtkEditable *
demo_tagged_entry_get_delegate (GtkEditable *editable)
{
return GTK_EDITABLE (DEMO_TAGGED_ENTRY (editable)->entry);
return GTK_EDITABLE (DEMO_TAGGED_ENTRY (editable)->text);
}
static void
@@ -147,7 +142,7 @@ demo_tagged_entry_add_tag (DemoTaggedEntry *entry,
{
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
gtk_box_append (GTK_BOX (entry->box), tag);
gtk_widget_set_parent (tag, GTK_WIDGET (entry));
}
void
@@ -157,10 +152,7 @@ demo_tagged_entry_insert_tag_after (DemoTaggedEntry *entry,
{
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
if (sibling == NULL)
gtk_box_append (GTK_BOX (entry->box), tag);
else
gtk_box_insert_child_after (GTK_BOX (entry->box), tag, sibling);
gtk_widget_insert_after (tag, GTK_WIDGET (entry), sibling);
}
void
@@ -169,7 +161,7 @@ demo_tagged_entry_remove_tag (DemoTaggedEntry *entry,
{
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
gtk_box_remove (GTK_BOX (entry->box), tag);
gtk_widget_unparent (tag);
}
struct _DemoTaggedEntryTag

121
demos/gtk-demo/demowidget.c Normal file
View File

@@ -0,0 +1,121 @@
#include "demowidget.h"
#include "demolayout.h"
/* parent widget */
struct _DemoWidget
{
GtkWidget parent_instance;
gboolean backward; /* whether we go 0 -> 1 or 1 -> 0 */
gint64 start_time; /* time the transition started */
guint tick_id; /* our tick cb */
};
struct _DemoWidgetClass
{
GtkWidgetClass parent_class;
};
G_DEFINE_TYPE (DemoWidget, demo_widget, GTK_TYPE_WIDGET)
/* The widget is controlling the transition by calling
* demo_layout_set_position() in a tick callback.
*
* We take half a second to go from one layout to the other.
*/
#define DURATION (0.5 * G_TIME_SPAN_SECOND)
static gboolean
transition (GtkWidget *widget,
GdkFrameClock *frame_clock,
gpointer data)
{
DemoWidget *self = DEMO_WIDGET (widget);
DemoLayout *demo_layout = DEMO_LAYOUT (gtk_widget_get_layout_manager (widget));
gint64 now = g_get_monotonic_time ();
gtk_widget_queue_allocate (widget);
if (self->backward)
demo_layout_set_position (demo_layout, 1.0 - (now - self->start_time) / DURATION);
else
demo_layout_set_position (demo_layout, (now - self->start_time) / DURATION);
if (now - self->start_time >= DURATION)
{
self->backward = !self->backward;
demo_layout_set_position (demo_layout, self->backward ? 1.0 : 0.0);
/* keep things interesting by shuffling the positions */
if (!self->backward)
demo_layout_shuffle (demo_layout);
self->tick_id = 0;
return G_SOURCE_REMOVE;
}
return G_SOURCE_CONTINUE;
}
static void
clicked (GtkGestureClick *gesture,
guint n_press,
double x,
double y,
gpointer data)
{
DemoWidget *self = data;
if (self->tick_id != 0)
return;
self->start_time = g_get_monotonic_time ();
self->tick_id = gtk_widget_add_tick_callback (GTK_WIDGET (self), transition, NULL, NULL);
}
static void
demo_widget_init (DemoWidget *self)
{
GtkGesture *gesture;
gesture = gtk_gesture_click_new ();
g_signal_connect (gesture, "pressed", G_CALLBACK (clicked), self);
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture));
}
static void
demo_widget_dispose (GObject *object)
{
GtkWidget *child;
while ((child = gtk_widget_get_first_child (GTK_WIDGET (object))))
gtk_widget_unparent (child);
G_OBJECT_CLASS (demo_widget_parent_class)->dispose (object);
}
static void
demo_widget_class_init (DemoWidgetClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->dispose = demo_widget_dispose;
/* here is where we use our custom layout manager */
gtk_widget_class_set_layout_manager_type (widget_class, DEMO_TYPE_LAYOUT);
}
GtkWidget *
demo_widget_new (void)
{
return g_object_new (DEMO_TYPE_WIDGET, NULL);
}
void
demo_widget_add_child (DemoWidget *self,
GtkWidget *child)
{
gtk_widget_set_parent (child, GTK_WIDGET (self));
}

View File

@@ -0,0 +1,11 @@
#pragma once
#include <gtk/gtk.h>
#define DEMO_TYPE_WIDGET (demo_widget_get_type ())
G_DECLARE_FINAL_TYPE (DemoWidget, demo_widget, DEMO, WIDGET, GtkWidget)
GtkWidget * demo_widget_new (void);
void demo_widget_add_child (DemoWidget *self,
GtkWidget *child);

View File

@@ -1,4 +1,5 @@
/* Dialogs
* #Keywords: GtkMessageDialog
*
* Dialogs are used to pop up transient windows for information
* and user feedback.
@@ -16,7 +17,7 @@ message_dialog_clicked (GtkButton *button,
gpointer user_data)
{
GtkWidget *dialog;
static gint i = 1;
static int i = 1;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,

View File

@@ -1,8 +1,12 @@
/* Drag-and-Drop
* #Keywords: dnd, menu, popover, gesture
*
* This demo shows dragging colors and widgets.
* The items in this demo can be moved, recolored
* and rotated.
*
* The demo also has an example for creating a
* menu-like popover without using a menu model.
*/
#include <gtk/gtk.h>
@@ -153,6 +157,30 @@ click_done (GtkGesture *gesture)
gtk_widget_insert_after (item, canvas, last_child);
}
static gboolean
theme_is_dark (void)
{
GtkSettings *settings;
char *theme;
gboolean prefer_dark;
gboolean dark;
settings = gtk_settings_get_default ();
g_object_get (settings,
"gtk-theme-name", &theme,
"gtk-application-prefer-dark-theme", &prefer_dark,
NULL);
if ((strcmp (theme, "Adwaita") == 0 && prefer_dark) || strcmp (theme, "HighContrastInverse") == 0)
dark = TRUE;
else
dark = FALSE;
g_free (theme);
return dark;
}
static void
canvas_item_init (CanvasItem *item)
{
@@ -180,7 +208,11 @@ canvas_item_init (CanvasItem *item)
gtk_widget_set_name (item->label, id);
g_free (id);
gdk_rgba_parse (&rgba, "yellow");
if (theme_is_dark ())
gdk_rgba_parse (&rgba, "blue");
else
gdk_rgba_parse (&rgba, "yellow");
set_color (item, &rgba);
item->angle = 0;
@@ -538,7 +570,6 @@ canvas_new (void)
canvas = gtk_fixed_new ();
gtk_widget_set_hexpand (canvas, TRUE);
gtk_widget_set_vexpand (canvas, TRUE);
gtk_widget_add_css_class (canvas, "frame");
source = gtk_drag_source_new ();
gtk_drag_source_set_actions (source, GDK_ACTION_MOVE);
@@ -597,6 +628,83 @@ css_button_new (const char *class)
return button;
}
typedef struct
{
GtkWidget parent_instance;
GdkRGBA color;
} ColorSwatch;
typedef struct
{
GtkWidgetClass parent_class;
} ColorSwatchClass;
G_DEFINE_TYPE (ColorSwatch, color_swatch, GTK_TYPE_WIDGET)
static GdkContentProvider *
color_swatch_drag_prepare (GtkDragSource *source,
double x,
double y,
ColorSwatch *swatch)
{
return gdk_content_provider_new_typed (GDK_TYPE_RGBA, &swatch->color);
}
static void
color_swatch_init (ColorSwatch *swatch)
{
GtkDragSource *source = gtk_drag_source_new ();
g_signal_connect (source, "prepare", G_CALLBACK (color_swatch_drag_prepare), swatch);
gtk_widget_add_controller (GTK_WIDGET (swatch), GTK_EVENT_CONTROLLER (source));
}
static void
color_swatch_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
ColorSwatch *swatch = (ColorSwatch *)widget;
float w = gtk_widget_get_width (widget);
float h = gtk_widget_get_height (widget);
gtk_snapshot_append_color (snapshot, &swatch->color,
&GRAPHENE_RECT_INIT(0, 0, w, h));
}
void
color_swatch_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum_size,
int *natural_size,
int *minimum_baseline,
int *natural_baseline)
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
*minimum_size = *natural_size = 48;
else
*minimum_size = *natural_size = 32;
}
static void
color_swatch_class_init (ColorSwatchClass *class)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
widget_class->snapshot = color_swatch_snapshot;
widget_class->measure = color_swatch_measure;
gtk_widget_class_set_css_name (widget_class, "colorswatch");
}
static GtkWidget *
color_swatch_new (const char *color)
{
ColorSwatch *swatch = g_object_new (color_swatch_get_type (), NULL);
gdk_rgba_parse (&swatch->color, color);
return GTK_WIDGET (swatch);
}
static GtkWidget *window = NULL;
GtkWidget *
@@ -659,6 +767,8 @@ do_dnd (GtkWidget *do_widget)
y += 100;
}
gtk_box_append (GTK_BOX (box), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
sw = gtk_scrolled_window_new ();
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
@@ -670,18 +780,7 @@ do_dnd (GtkWidget *do_widget)
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), box3);
for (i = 0; colors[i]; i++)
{
GdkRGBA rgba;
GtkWidget *swatch;
gdk_rgba_parse (&rgba, colors[i]);
swatch = g_object_new (g_type_from_name ("GtkColorSwatch"),
"rgba", &rgba,
"selectable", FALSE,
NULL);
gtk_box_append (GTK_BOX (box3), swatch);
}
gtk_box_append (GTK_BOX (box3), color_swatch_new (colors[i]));
gtk_box_append (GTK_BOX (box3), css_button_new ("rainbow1"));
gtk_box_append (GTK_BOX (box3), css_button_new ("rainbow2"));

View File

@@ -1,4 +1,5 @@
/* Drawing Area
* #Keywords: GtkDrawingArea
*
* GtkDrawingArea is a blank area where you can draw custom displays
* of various kinds.
@@ -64,8 +65,8 @@ scribble_draw (GtkDrawingArea *da,
/* Draw a rectangle on the screen */
static void
draw_brush (GtkWidget *widget,
gdouble x,
gdouble y)
double x,
double y)
{
GdkRectangle update_rect;
cairo_t *cr;

View File

@@ -254,7 +254,7 @@ do_dropdown (GtkWidget *do_widget)
gtk_widget_set_margin_bottom (box, 10);
gtk_window_set_child (GTK_WINDOW (window), box);
button = gtk_drop_down_new ();
button = gtk_drop_down_new (NULL, NULL);
model = G_LIST_MODEL (pango_cairo_font_map_get_default ());
gtk_drop_down_set_model (GTK_DROP_DOWN (button), model);

View File

@@ -16,9 +16,9 @@
typedef struct
{
gint number;
gchar *product;
gint yummy;
int number;
char *product;
int yummy;
}
Item;
@@ -74,7 +74,7 @@ add_items (void)
static GtkTreeModel *
create_items_model (void)
{
gint i = 0;
int i = 0;
GtkListStore *model;
GtkTreeIter iter;
@@ -109,7 +109,7 @@ static GtkTreeModel *
create_numbers_model (void)
{
#define N_NUMBERS 10
gint i = 0;
int i = 0;
GtkListStore *model;
GtkTreeIter iter;
@@ -192,7 +192,7 @@ remove_item (GtkWidget *widget, gpointer data)
if (gtk_tree_selection_get_selected (selection, NULL, &iter))
{
gint i;
int i;
GtkTreePath *path;
path = gtk_tree_model_get_path (model, &iter);
@@ -211,7 +211,7 @@ separator_row (GtkTreeModel *model,
gpointer data)
{
GtkTreePath *path;
gint idx;
int idx;
path = gtk_tree_model_get_path (model, iter);
idx = gtk_tree_path_get_indices (path)[0];
@@ -224,7 +224,7 @@ separator_row (GtkTreeModel *model,
static void
editing_started (GtkCellRenderer *cell,
GtkCellEditable *editable,
const gchar *path,
const char *path,
gpointer data)
{
gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (editable),
@@ -233,15 +233,15 @@ editing_started (GtkCellRenderer *cell,
static void
cell_edited (GtkCellRendererText *cell,
const gchar *path_string,
const gchar *new_text,
const char *path_string,
const char *new_text,
gpointer data)
{
GtkTreeModel *model = (GtkTreeModel *)data;
GtkTreePath *path = gtk_tree_path_new_from_string (path_string);
GtkTreeIter iter;
gint column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "column"));
int column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "column"));
gtk_tree_model_get_iter (model, &iter, path);
@@ -249,7 +249,7 @@ cell_edited (GtkCellRendererText *cell,
{
case COLUMN_ITEM_NUMBER:
{
gint i;
int i;
i = gtk_tree_path_get_indices (path)[0];
g_array_index (articles, Item, i).number = atoi (new_text);
@@ -261,8 +261,8 @@ cell_edited (GtkCellRendererText *cell,
case COLUMN_ITEM_PRODUCT:
{
gint i;
gchar *old_text;
int i;
char *old_text;
gtk_tree_model_get (model, &iter, column, &old_text, -1);
g_free (old_text);

View File

@@ -0,0 +1,124 @@
/* Error states
*
* GtkLabel and GtkEntry can indicate errors if you set the .error
* style class on them.
*
* This examples shows how this can be used in a dialog for input validation.
*
* It also shows how pass callbacks and objects to GtkBuilder with
* GtkBuilderScope and gtk_builder_expose_object().
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
static void
validate_more_details (GtkEntry *entry,
GParamSpec *pspec,
GtkEntry *details)
{
if (strlen (gtk_editable_get_text (GTK_EDITABLE (entry))) > 0 &&
strlen (gtk_editable_get_text (GTK_EDITABLE (details))) == 0)
{
gtk_widget_set_tooltip_text (GTK_WIDGET (entry), "Must have details first");
gtk_widget_add_css_class (GTK_WIDGET (entry), "error");
}
else
{
gtk_widget_set_tooltip_text (GTK_WIDGET (entry), "");
gtk_widget_remove_css_class (GTK_WIDGET (entry), "error");
}
}
static gboolean
mode_switch_state_set (GtkSwitch *sw,
gboolean state,
GtkWidget *scale)
{
GtkWidget *label;
label = GTK_WIDGET (g_object_get_data (G_OBJECT (sw), "error_label"));
if (!state ||
(gtk_range_get_value (GTK_RANGE (scale)) > 50))
{
gtk_widget_hide (label);
gtk_switch_set_state (sw, state);
}
else
{
gtk_widget_show (label);
}
return TRUE;
}
static void
level_scale_value_changed (GtkRange *range,
GtkWidget *sw)
{
GtkWidget *label;
label = GTK_WIDGET (g_object_get_data (G_OBJECT (sw), "error_label"));
if (gtk_switch_get_active (GTK_SWITCH (sw)) &&
!gtk_switch_get_state (GTK_SWITCH (sw)) &&
(gtk_range_get_value (range) > 50))
{
gtk_widget_hide (label);
gtk_switch_set_state (GTK_SWITCH (sw), TRUE);
}
else if (gtk_switch_get_state (GTK_SWITCH (sw)) &&
(gtk_range_get_value (range) <= 50))
{
gtk_switch_set_state (GTK_SWITCH (sw), FALSE);
}
}
GtkWidget *
do_errorstates (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *toplevel;
GtkBuilder *builder;
GtkBuilderScope *scope;
GtkWidget *sw, *label;
toplevel = GTK_WIDGET (gtk_widget_get_root (do_widget));
scope = gtk_builder_cscope_new ();
gtk_builder_cscope_add_callback_symbols (GTK_BUILDER_CSCOPE (scope),
"validate_more_details", G_CALLBACK (validate_more_details),
"mode_switch_state_set", G_CALLBACK (mode_switch_state_set),
"level_scale_value_changed", G_CALLBACK (level_scale_value_changed),
NULL);
builder = gtk_builder_new ();
gtk_builder_set_scope (builder, scope);
gtk_builder_expose_object (builder, "toplevel", G_OBJECT (toplevel));
gtk_builder_add_from_resource (builder, "/errorstates/errorstates.ui", NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "dialog"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
sw = GTK_WIDGET (gtk_builder_get_object (builder, "mode_switch"));
label = GTK_WIDGET (gtk_builder_get_object (builder, "error_label"));
g_object_set_data (G_OBJECT (sw), "error_label", label);
g_object_unref (builder);
g_object_unref (scope);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkDialog" id="dialog">
<property name="transient-for">toplevel</property>
<property name="modal">1</property>
<property name="resizable">0</property>
<property name="use-header-bar">1</property>
<property name="title" translatable="yes">Settings</property>
<property name="hide-on-close">1</property>
<child internal-child="content_area">
<object class="GtkBox">
<child>
<object class="GtkGrid">
<property name="row-spacing">10</property>
<property name="column-spacing">10</property>
<property name="margin-start">20</property>
<property name="margin-end">20</property>
<property name="margin-top">20</property>
<property name="margin-bottom">20</property>
<child>
<object class="GtkLabel">
<property name="halign">end</property>
<property name="valign">baseline</property>
<property name="label">_Details</property>
<property name="use-underline">1</property>
<property name="mnemonic-widget">details_entry</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">0</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkEntry" id="details_entry">
<property name="valign">baseline</property>
<signal name="notify::text" handler="validate_more_details" object="more_details_entry" swapped="yes"/>
<layout>
<property name="column">1</property>
<property name="row">0</property>
<property name="column-span">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="halign">end</property>
<property name="valign">baseline</property>
<property name="label">More D_etails</property>
<property name="use-underline">1</property>
<property name="mnemonic-widget">more_details_entry</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkEntry" id="more_details_entry">
<property name="valign">baseline</property>
<signal name="notify::text" handler="validate_more_details" object="details_entry" swapped="no"/>
<layout>
<property name="column">1</property>
<property name="row">1</property>
<property name="column-span">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="halign">end</property>
<property name="valign">baseline</property>
<property name="label">_Level</property>
<property name="use-underline">1</property>
<property name="mnemonic-widget">level_scale</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">0</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkScale" id="level_scale">
<property name="valign">baseline</property>
<property name="draw-value">0</property>
<property name="adjustment">
<object class="GtkAdjustment">
<property name="upper">100</property>
<property name="lower">0</property>
<property name="value">50</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
</property>
<signal name="value-changed" handler="level_scale_value_changed" object="mode_switch" swapped="no"/>
<layout>
<property name="column">1</property>
<property name="row">2</property>
<property name="column-span">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="halign">end</property>
<property name="valign">baseline</property>
<property name="label">_Mode</property>
<property name="use-underline">1</property>
<property name="mnemonic-widget">mode_switch</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">0</property>
<property name="row">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkSwitch" id="mode_switch">
<property name="halign">start</property>
<property name="valign">baseline</property>
<signal name="state-set" handler="mode_switch_state_set" object="level_scale" swapped="no"/>
<layout>
<property name="column">1</property>
<property name="row">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="error_label">
<property name="visible">0</property>
<property name="halign">start</property>
<property name="valign">baseline</property>
<property name="label">Level too low</property>
<style>
<class name="error"/>
</style>
<layout>
<property name="column">2</property>
<property name="row">3</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -13,7 +13,7 @@
static GtkWidget *window = NULL;
static void
response_cb (GtkDialog *dialog, gint response_id)
response_cb (GtkDialog *dialog, int response_id)
{
gtk_window_destroy (GTK_WINDOW (window));
window = NULL;
@@ -35,6 +35,10 @@ do_expander (GtkWidget *do_widget)
GtkWidget *sw;
GtkWidget *tv;
GtkTextBuffer *buffer;
GtkTextIter start;
GtkTextIter end;
GtkTextTag *tag;
GdkPaintable *paintable;
if (!window)
{
@@ -64,12 +68,25 @@ do_expander (GtkWidget *do_widget)
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_propagate_natural_height (GTK_SCROLLED_WINDOW (sw), TRUE);
gtk_widget_set_vexpand (sw, TRUE);
tv = gtk_text_view_new ();
g_object_set (tv,
"left-margin", 10,
"right-margin", 10,
"top-margin", 10,
"bottom-margin", 10,
NULL);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tv));
gtk_text_view_set_editable (GTK_TEXT_VIEW (tv), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (tv), FALSE);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (tv), GTK_WRAP_WORD);
gtk_text_buffer_set_text (GTK_TEXT_BUFFER (buffer),
gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (tv), 2);
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (tv), 2);
gtk_text_buffer_set_text (buffer,
"Finally, the full story with all details. "
"And all the inside information, including "
"error codes, etc etc. Pages of information, "
@@ -77,7 +94,22 @@ do_expander (GtkWidget *do_widget)
"or even resize the window - it works !\n"
"A second paragraph will contain even more "
"innuendo, just to make you scroll down or "
"resize the window. Do it already !", -1);
"resize the window.\n"
"Do it already!\n", -1);
gtk_text_buffer_get_end_iter (buffer, &start);
paintable = GDK_PAINTABLE (gdk_texture_new_from_resource ("/cursors/images/gtk_logo_cursor.png"));
gtk_text_buffer_insert_paintable (buffer, &start, paintable);
g_object_unref (paintable);
gtk_text_iter_backward_char (&start);
gtk_text_buffer_get_end_iter (buffer, &end);
tag = gtk_text_buffer_create_tag (buffer, NULL,
"pixels-above-lines", 200,
"justification", GTK_JUSTIFY_RIGHT,
NULL);
gtk_text_buffer_apply_tag (buffer, tag, &start, &end);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
gtk_expander_set_child (GTK_EXPANDER (expander), sw);
gtk_box_append (GTK_BOX (area), expander);

View File

@@ -1,4 +1,5 @@
/* Tree View/Filter Model
* #Keywords: GtkTreeView
*
* This example demonstrates how GtkTreeModelFilter can be used not
* just to show a subset of the rows, but also to compute columns
@@ -22,8 +23,8 @@ format_number (GtkTreeViewColumn *col,
GtkTreeIter *iter,
gpointer data)
{
gint num;
gchar *text;
int num;
char *text;
gtk_tree_model_get (model, iter, GPOINTER_TO_INT (data), &num, -1);
text = g_strdup_printf ("%d", num);
@@ -35,11 +36,11 @@ static void
filter_modify_func (GtkTreeModel *model,
GtkTreeIter *iter,
GValue *value,
gint column,
int column,
gpointer data)
{
GtkTreeModelFilter *filter_model = GTK_TREE_MODEL_FILTER (model);
gint width, height;
int width, height;
GtkTreeModel *child_model;
GtkTreeIter child_iter;
@@ -75,7 +76,7 @@ visible_func (GtkTreeModel *model,
GtkTreeIter *iter,
gpointer data)
{
gint width;
int width;
gtk_tree_model_get (model, iter,
WIDTH_COLUMN, &width,

View File

@@ -45,12 +45,9 @@
<attributes>
<attribute name="weight" value="bold"></attribute>
</attributes>
<accessibility>
<relation type="label-for" target="treeview1"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
<property name="column">0</property>
<property name="row">0</property>
</layout>
</object>
</child>
@@ -83,12 +80,9 @@
</child>
</object>
</child>
<accessibility>
<relation type="labelled-by" target="label1"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
@@ -133,12 +127,9 @@
</child>
</object>
</child>
<accessibility>
<relation type="labelled-by" target="label2"/>
</accessibility>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
<property name="column">1</property>
<property name="row">1</property>
</layout>
</object>
</child>
@@ -149,12 +140,9 @@
<attributes>
<attribute name="weight" value="bold"></attribute>
</attributes>
<accessibility>
<relation type="label-for" target="treeview2"/>
</accessibility>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
<property name="column">1</property>
<property name="row">0</property>
</layout>
</object>
</child>
@@ -165,12 +153,9 @@
<attributes>
<attribute name="weight" value="bold"></attribute>
</attributes>
<accessibility>
<relation type="label-for" target="treeview3"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
<property name="column">0</property>
<property name="row">2</property>
</layout>
</object>
</child>
@@ -197,12 +182,9 @@
</child>
</object>
</child>
<accessibility>
<relation type="labelled-by" target="label3"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="column">0</property>
<property name="row">3</property>
</layout>
</object>
</child>

72
demos/gtk-demo/fire.glsl Normal file
View File

@@ -0,0 +1,72 @@
uniform float u_time;
uniform sampler2D u_texture1;
/* 2D -> [0..1] random number generator */
float random(vec2 st) {
return fract(sin(dot(st.xy,
vec2(12.9898,78.233))) *
43758.5453123);
}
/* Generate a smoothed 2d noise based on random() */
float noise(vec2 v) {
/* Round point v to integer grid grid */
vec2 grid_point = floor(v);
/* Randomize in grid corners */
float corner1 = random(grid_point);
float corner2 = random(grid_point + vec2(1, 0));
float corner3 = random(grid_point + vec2(0, 1));
float corner4 = random(grid_point + vec2(1, 1));
/* Interpolate smoothly between grid points */
vec2 fraction = smoothstep(vec2(0.0), vec2(1.0), fract(v));
return mix(mix(corner1, corner2, fraction.x),
mix(corner3, corner4, fraction.x),
fraction.y);
}
/* fractal brownian motion noice, see https://www.iquilezles.org/www/articles/fbm/fbm.htm */
float fbm(in vec2 x)
{
const float octaveScale = 1.9;
const float G = 0.5;
float f = 1.0;
float a = 1.0;
float t = 0.0;
int numOctaves = 5;
for (int i = 0; i < numOctaves; i++) {
t += a*noise(f*x);
f *= octaveScale;
a *= G;
}
return t;
}
void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
{
vec2 xy = fragCoord / resolution;
float zoom = 3.0 - sin(u_time*0.5)*0.3;
// Normalize coord to height of widget
vec2 p = (vec2 (-resolution.x/2.0 + fragCoord.x, resolution.y - fragCoord.y) / resolution.yy)* zoom;
// Use recursive incantations of fbm
float q1 = fbm(p - vec2(0.8, 0.3) * u_time);
float q2 = fbm(p - vec2(0.5, 1.3) * u_time);
float r = fbm(2.0*p + vec2(q1,q2) - vec2(0.0, 1.0)*u_time*10.0 *0.4);
// Compute intensity, mostly on the bottom
float w = 2.0 * r * p.y;
// Smooth out left/right side and fade in at start
w /= smoothstep(0.0,0.1, xy.x)* smoothstep(0.0,0.1, 1.0-xy.x) * smoothstep(0.0,0.4, u_time);
// Compute colors
vec3 c = vec3(1.0,.2,.05);
vec3 color = 1.0 / (w*w/c + 1.0);
// Mix in widget
vec4 widget = GskTexture(u_texture1,uv);
fragColor = mix(vec4(color,1), widget, 1.0-color.x);
}

View File

@@ -9,6 +9,7 @@
#include "gtkfishbowl.h"
#include "gtkgears.h"
#include "gskshaderpaintable.h"
const char *const css =
".blurred-button {"
@@ -149,6 +150,38 @@ create_switch (void)
return w;
}
static gboolean
update_paintable (GtkWidget *widget,
GdkFrameClock *frame_clock,
gpointer user_data)
{
GskShaderPaintable *paintable;
gint64 frame_time;
paintable = GSK_SHADER_PAINTABLE (gtk_picture_get_paintable (GTK_PICTURE (widget)));
frame_time = gdk_frame_clock_get_frame_time (frame_clock);
gsk_shader_paintable_update_time (paintable, 0, frame_time);
return G_SOURCE_CONTINUE;
}
static GtkWidget *
create_cogs (void)
{
GtkWidget *picture;
static GskGLShader *cog_shader = NULL;
GdkPaintable *paintable;
if (cog_shader == NULL)
cog_shader = gsk_gl_shader_new_from_resource ("/gltransition/cogs2.glsl");
paintable = gsk_shader_paintable_new (g_object_ref (cog_shader), NULL);
picture = gtk_picture_new_for_paintable (paintable);
gtk_widget_set_size_request (picture, 150, 75);
gtk_widget_add_tick_callback (picture, update_paintable, NULL, NULL);
return picture;
}
static void
mapped (GtkWidget *w)
{
@@ -185,6 +218,7 @@ static const struct {
{ "Gears", create_gears },
{ "Switch", create_switch },
{ "Menubutton", create_menu_button },
{ "Shader", create_cogs },
};
static int selected_widget_type = -1;
@@ -209,7 +243,7 @@ set_widget_type (GtkFishbowl *fishbowl,
widget_types[selected_widget_type].name);
}
void
G_MODULE_EXPORT void
fishbowl_next_button_clicked_cb (GtkButton *source,
gpointer user_data)
{
@@ -224,7 +258,7 @@ fishbowl_next_button_clicked_cb (GtkButton *source,
set_widget_type (fishbowl, new_index);
}
void
G_MODULE_EXPORT void
fishbowl_prev_button_clicked_cb (GtkButton *source,
gpointer user_data)
{
@@ -239,7 +273,7 @@ fishbowl_prev_button_clicked_cb (GtkButton *source,
set_widget_type (fishbowl, new_index);
}
void
G_MODULE_EXPORT void
fishbowl_changes_toggled_cb (GtkToggleButton *button,
gpointer user_data)
{
@@ -249,7 +283,7 @@ fishbowl_changes_toggled_cb (GtkToggleButton *button,
gtk_button_set_icon_name (GTK_BUTTON (button), "changes-allow");
}
char *
G_MODULE_EXPORT char *
format_header_cb (GObject *object,
guint count,
double fps)

View File

@@ -33,6 +33,9 @@
<lookup name="framerate">bowl</lookup>
</closure>
</binding>
<attributes>
<attribute name="font-features" value="tnum=1"/>
</attributes>
</object>
</child>
<child type="end">

View File

@@ -1,4 +1,5 @@
/* Fixed Layout
* #Keywords: GtkLayoutManager
*
* GtkFixed is a container that allows placing and transforming
* widgets manually.

View File

@@ -29,7 +29,7 @@ draw_color (GtkDrawingArea *drawingarea,
}
static GtkWidget *
color_swatch_new (const gchar *color)
color_swatch_new (const char *color)
{
GtkWidget *button, *area;
@@ -48,7 +48,7 @@ do_flowbox (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
GtkWidget *scrolled, *flowbox;
const gchar *colors[] = {
const char *colors[] = {
"AliceBlue",
"AntiqueWhite",
"AntiqueWhite1",
@@ -716,7 +716,7 @@ do_flowbox (GtkWidget *do_widget)
"YellowGreen",
NULL
};
gint i;
int i;
if (!window)
{

View File

@@ -130,6 +130,10 @@ static const char *
get_feature_display_name (unsigned int tag)
{
int i;
static char buf[5] = { 0, };
if (tag == MAKE_TAG ('x', 'x', 'x', 'x'))
return _("Default");
for (i = 0; i < G_N_ELEMENTS (open_type_layout_features); i++)
{
@@ -137,7 +141,10 @@ get_feature_display_name (unsigned int tag)
return g_dpgettext2 (NULL, "OpenType layout", open_type_layout_features[i].name);
}
return NULL;
hb_tag_to_string (tag, buf);
g_warning ("unknown OpenType layout feature tag: %s", buf);
return buf;
}
static void update_display (void);
@@ -151,26 +158,38 @@ set_inconsistent (GtkCheckButton *button,
}
static void
feat_clicked (GtkWidget *feat,
gpointer data)
feat_pressed (GtkGestureClick *gesture,
int n_press,
double x,
double y,
GtkWidget *feat)
{
g_signal_handlers_block_by_func (feat, feat_clicked, NULL);
const guint button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
if (gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (feat)))
if (button == GDK_BUTTON_PRIMARY)
{
set_inconsistent (GTK_CHECK_BUTTON (feat), FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (feat), TRUE);
}
else if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (feat)))
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (feat), FALSE);
}
else
{
set_inconsistent (GTK_CHECK_BUTTON (feat), TRUE);
}
g_signal_handlers_block_by_func (feat, feat_pressed, NULL);
g_signal_handlers_unblock_by_func (feat, feat_clicked, NULL);
if (gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (feat)))
{
set_inconsistent (GTK_CHECK_BUTTON (feat), FALSE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (feat), TRUE);
}
g_signal_handlers_unblock_by_func (feat, feat_pressed, NULL);
}
else if (button == GDK_BUTTON_SECONDARY)
{
gboolean inconsistent = gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (feat));
set_inconsistent (GTK_CHECK_BUTTON (feat), !inconsistent);
}
}
static void
feat_toggled_cb (GtkCheckButton *check_button,
gpointer data)
{
set_inconsistent (check_button, FALSE);
}
static void
@@ -201,6 +220,7 @@ add_check_group (GtkWidget *box,
unsigned int tag;
GtkWidget *feat;
FeatureItem *item;
GtkGesture *gesture;
tag = hb_tag_from_string (tags[i], -1);
@@ -209,7 +229,12 @@ add_check_group (GtkWidget *box,
g_signal_connect (feat, "notify::active", G_CALLBACK (update_display), NULL);
g_signal_connect (feat, "notify::inconsistent", G_CALLBACK (update_display), NULL);
g_signal_connect (feat, "clicked", G_CALLBACK (feat_clicked), NULL);
g_signal_connect (feat, "toggled", G_CALLBACK (feat_toggled_cb), NULL);
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed", G_CALLBACK (feat_pressed), feat);
gtk_widget_add_controller (feat, GTK_EVENT_CONTROLLER (gesture));
gtk_box_append (GTK_BOX (group), feat);
@@ -260,10 +285,11 @@ add_radio_group (GtkWidget *box,
tag = hb_tag_from_string (tags[i], -1);
name = get_feature_display_name (tag);
feat = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (group_button),
name ? name : _("Default"));
feat = gtk_check_button_new_with_label (name ? name : _("Default"));
if (group_button == NULL)
group_button = feat;
else
gtk_check_button_set_group (GTK_CHECK_BUTTON (feat), GTK_CHECK_BUTTON (group_button));
g_signal_connect (feat, "notify::active", G_CALLBACK (update_display), NULL);
g_object_set_data (G_OBJECT (feat), "default", group_button);
@@ -295,7 +321,7 @@ update_display (void)
GList *l;
PangoAttrList *attrs;
PangoAttribute *attr;
gint ins, bound;
int ins, bound;
guint start, end;
PangoLanguage *lang;
char *font_desc;
@@ -336,32 +362,35 @@ update_display (void)
if (!gtk_widget_is_sensitive (item->feat))
continue;
if (GTK_IS_RADIO_BUTTON (item->feat))
if (GTK_IS_CHECK_BUTTON (item->feat))
{
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (item->feat)) &&
strcmp (item->name, "xxxx") != 0)
if (g_object_get_data (G_OBJECT (item->feat), "default"))
{
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (item->feat)) &&
strcmp (item->name, "xxxx") != 0)
{
if (has_feature)
g_string_append (s, ", ");
g_string_append (s, item->name);
g_string_append (s, " 1");
has_feature = TRUE;
}
}
else
{
if (gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (item->feat)))
continue;
if (has_feature)
g_string_append (s, ", ");
g_string_append (s, item->name);
g_string_append (s, " 1");
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (item->feat)))
g_string_append (s, " 1");
else
g_string_append (s, " 0");
has_feature = TRUE;
}
}
else if (GTK_IS_CHECK_BUTTON (item->feat))
{
if (gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (item->feat)))
continue;
if (has_feature)
g_string_append (s, ", ");
g_string_append (s, item->name);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (item->feat)))
g_string_append (s, " 1");
else
g_string_append (s, " 0");
has_feature = TRUE;
}
}
features = g_string_free (s, FALSE);
@@ -479,7 +508,7 @@ update_script_combo (void)
{
GtkListStore *store;
hb_font_t *hb_font;
gint i, j, k;
int i, j, k;
PangoFont *pango_font;
GHashTable *tags;
GHashTableIter iter;
@@ -593,7 +622,7 @@ update_script_combo (void)
static void
update_features (void)
{
gint i, j;
int i, j;
GtkTreeModel *model;
GtkTreeIter iter;
guint script_index, lang_index;
@@ -607,7 +636,7 @@ update_features (void)
gtk_widget_hide (item->feat);
gtk_widget_hide (gtk_widget_get_parent (item->feat));
if (strcmp (item->name, "xxxx") == 0)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item->feat), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (item->feat), TRUE);
}
/* set feature presence checks from the font features */
@@ -661,14 +690,17 @@ update_features (void)
{
gtk_widget_show (item->feat);
gtk_widget_show (gtk_widget_get_parent (item->feat));
if (GTK_IS_RADIO_BUTTON (item->feat))
if (GTK_IS_CHECK_BUTTON (item->feat))
{
GtkWidget *def = GTK_WIDGET (g_object_get_data (G_OBJECT (item->feat), "default"));
gtk_widget_show (def);
}
else if (GTK_IS_CHECK_BUTTON (item->feat))
{
set_inconsistent (GTK_CHECK_BUTTON (item->feat), TRUE);
if (def)
{
gtk_widget_show (def);
gtk_widget_show (gtk_widget_get_parent (def));
gtk_check_button_set_active (GTK_CHECK_BUTTON (def), TRUE);
}
else
set_inconsistent (GTK_CHECK_BUTTON (item->feat), TRUE);
}
}
}
@@ -690,14 +722,14 @@ update_features (void)
p = strstr (feat, buf);
if (p)
{
if (GTK_IS_RADIO_BUTTON (item->feat))
if (GTK_IS_CHECK_BUTTON (item->feat) && g_object_get_data (G_OBJECT (item->feat), "default"))
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item->feat), p[6] == '1');
gtk_check_button_set_active (GTK_CHECK_BUTTON (item->feat), p[6] == '1');
}
else if (GTK_IS_CHECK_BUTTON (item->feat))
{
set_inconsistent (GTK_CHECK_BUTTON (item->feat), FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item->feat), p[6] == '1');
gtk_check_button_set_active (GTK_CHECK_BUTTON (item->feat), p[6] == '1');
}
}
}
@@ -728,8 +760,8 @@ static void
entry_activated (GtkEntry *entry,
GtkAdjustment *adjustment)
{
gdouble value;
gchar *err = NULL;
double value;
char *err = NULL;
value = g_strtod (gtk_editable_get_text (GTK_EDITABLE (entry)), &err);
if (err != NULL)
@@ -939,7 +971,7 @@ instance_changed (GtkComboBox *combo)
{
Axis *axis;
Axis akey;
gdouble value;
double value;
value = coords[ai[i].axis_index];
@@ -1134,15 +1166,15 @@ font_features_reset_features (void)
{
FeatureItem *item = l->data;
if (GTK_IS_RADIO_BUTTON (item->feat))
if (GTK_IS_CHECK_BUTTON (item->feat))
{
if (strcmp (item->name, "xxxx") == 0)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item->feat), TRUE);
}
else if (GTK_IS_CHECK_BUTTON (item->feat))
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item->feat), FALSE);
set_inconsistent (GTK_CHECK_BUTTON (item->feat), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (item->feat), TRUE);
else
{
gtk_check_button_set_active (GTK_CHECK_BUTTON (item->feat), FALSE);
set_inconsistent (GTK_CHECK_BUTTON (item->feat), TRUE);
}
}
}
}
@@ -1285,8 +1317,7 @@ do_font_features (GtkWidget *do_widget)
"palt",
"twid",
"qwid", NULL });
add_check_group (feature_list, _("Alternative Stylistic Sets"), (const char *[]){ "ss00",
"ss01",
add_check_group (feature_list, _("Alternative Stylistic Sets"), (const char *[]){ "ss01",
"ss02",
"ss03",
"ss04",

573
demos/gtk-demo/fontify.c Normal file
View File

@@ -0,0 +1,573 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include <gtk/gtk.h>
#include <glib/gstdio.h>
#ifdef HAVE_GIO_UNIX
#include <gio/gunixoutputstream.h>
#include <fcntl.h>
#endif
/* This is the guts of gtk_text_buffer_insert_markup,
* copied here so we can make an incremental version.
*/
static void
insert_tags_for_attributes (GtkTextBuffer *buffer,
PangoAttrIterator *iter,
GtkTextIter *start,
GtkTextIter *end)
{
GtkTextTagTable *table;
GSList *attrs, *l;
GtkTextTag *tag;
char name[256];
float fg_alpha, bg_alpha;
table = gtk_text_buffer_get_tag_table (buffer);
#define LANGUAGE_ATTR(attr_name) \
{ \
const char *language = pango_language_to_string (((PangoAttrLanguage*)attr)->value); \
g_snprintf (name, 256, "language=%s", language); \
tag = gtk_text_tag_table_lookup (table, name); \
if (!tag) \
{ \
tag = gtk_text_tag_new (name); \
g_object_set (tag, #attr_name, language, NULL); \
gtk_text_tag_table_add (table, tag); \
g_object_unref (tag); \
} \
gtk_text_buffer_apply_tag (buffer, tag, start, end); \
}
#define STRING_ATTR(attr_name) \
{ \
const char *string = ((PangoAttrString*)attr)->value; \
g_snprintf (name, 256, #attr_name "=%s", string); \
tag = gtk_text_tag_table_lookup (table, name); \
if (!tag) \
{ \
tag = gtk_text_tag_new (name); \
g_object_set (tag, #attr_name, string, NULL); \
gtk_text_tag_table_add (table, tag); \
g_object_unref (tag); \
} \
gtk_text_buffer_apply_tag (buffer, tag, start, end); \
}
#define INT_ATTR(attr_name) \
{ \
int value = ((PangoAttrInt*)attr)->value; \
g_snprintf (name, 256, #attr_name "=%d", value); \
tag = gtk_text_tag_table_lookup (table, name); \
if (!tag) \
{ \
tag = gtk_text_tag_new (name); \
g_object_set (tag, #attr_name, value, NULL); \
gtk_text_tag_table_add (table, tag); \
g_object_unref (tag); \
} \
gtk_text_buffer_apply_tag (buffer, tag, start, end); \
}
#define FONT_ATTR(attr_name) \
{ \
PangoFontDescription *desc = ((PangoAttrFontDesc*)attr)->desc; \
char *str = pango_font_description_to_string (desc); \
g_snprintf (name, 256, "font-desc=%s", str); \
g_free (str); \
tag = gtk_text_tag_table_lookup (table, name); \
if (!tag) \
{ \
tag = gtk_text_tag_new (name); \
g_object_set (tag, #attr_name, desc, NULL); \
gtk_text_tag_table_add (table, tag); \
g_object_unref (tag); \
} \
gtk_text_buffer_apply_tag (buffer, tag, start, end); \
}
#define FLOAT_ATTR(attr_name) \
{ \
float value = ((PangoAttrFloat*)attr)->value; \
g_snprintf (name, 256, #attr_name "=%g", value); \
tag = gtk_text_tag_table_lookup (table, name); \
if (!tag) \
{ \
tag = gtk_text_tag_new (name); \
g_object_set (tag, #attr_name, value, NULL); \
gtk_text_tag_table_add (table, tag); \
g_object_unref (tag); \
} \
gtk_text_buffer_apply_tag (buffer, tag, start, end); \
}
#define RGBA_ATTR(attr_name, alpha_value) \
{ \
PangoColor *color; \
GdkRGBA rgba; \
color = &((PangoAttrColor*)attr)->color; \
rgba.red = color->red / 65535.; \
rgba.green = color->green / 65535.; \
rgba.blue = color->blue / 65535.; \
rgba.alpha = alpha_value; \
char *str = gdk_rgba_to_string (&rgba); \
g_snprintf (name, 256, #attr_name "=%s", str); \
g_free (str); \
tag = gtk_text_tag_table_lookup (table, name); \
if (!tag) \
{ \
tag = gtk_text_tag_new (name); \
g_object_set (tag, #attr_name, &rgba, NULL); \
gtk_text_tag_table_add (table, tag); \
g_object_unref (tag); \
} \
gtk_text_buffer_apply_tag (buffer, tag, start, end); \
}
fg_alpha = bg_alpha = 1.;
attrs = pango_attr_iterator_get_attrs (iter);
for (l = attrs; l; l = l->next)
{
PangoAttribute *attr = l->data;
switch ((int)attr->klass->type)
{
case PANGO_ATTR_FOREGROUND_ALPHA:
fg_alpha = ((PangoAttrInt*)attr)->value / 65535.;
break;
case PANGO_ATTR_BACKGROUND_ALPHA:
bg_alpha = ((PangoAttrInt*)attr)->value / 65535.;
break;
default:
break;
}
}
for (l = attrs; l; l = l->next)
{
PangoAttribute *attr = l->data;
switch (attr->klass->type)
{
case PANGO_ATTR_LANGUAGE:
LANGUAGE_ATTR (language);
break;
case PANGO_ATTR_FAMILY:
STRING_ATTR (family);
break;
case PANGO_ATTR_STYLE:
INT_ATTR (style);
break;
case PANGO_ATTR_WEIGHT:
INT_ATTR (weight);
break;
case PANGO_ATTR_VARIANT:
INT_ATTR (variant);
break;
case PANGO_ATTR_STRETCH:
INT_ATTR (stretch);
break;
case PANGO_ATTR_SIZE:
INT_ATTR (size);
break;
case PANGO_ATTR_FONT_DESC:
FONT_ATTR (font-desc);
break;
case PANGO_ATTR_FOREGROUND:
RGBA_ATTR (foreground_rgba, fg_alpha);
break;
case PANGO_ATTR_BACKGROUND:
RGBA_ATTR (background_rgba, bg_alpha);
break;
case PANGO_ATTR_UNDERLINE:
INT_ATTR (underline);
break;
case PANGO_ATTR_UNDERLINE_COLOR:
RGBA_ATTR (underline_rgba, fg_alpha);
break;
case PANGO_ATTR_OVERLINE:
INT_ATTR (overline);
break;
case PANGO_ATTR_OVERLINE_COLOR:
RGBA_ATTR (overline_rgba, fg_alpha);
break;
case PANGO_ATTR_STRIKETHROUGH:
INT_ATTR (strikethrough);
break;
case PANGO_ATTR_STRIKETHROUGH_COLOR:
RGBA_ATTR (strikethrough_rgba, fg_alpha);
break;
case PANGO_ATTR_RISE:
INT_ATTR (rise);
break;
case PANGO_ATTR_SCALE:
FLOAT_ATTR (scale);
break;
case PANGO_ATTR_FALLBACK:
INT_ATTR (fallback);
break;
case PANGO_ATTR_LETTER_SPACING:
INT_ATTR (letter_spacing);
break;
case PANGO_ATTR_FONT_FEATURES:
STRING_ATTR (font_features);
break;
case PANGO_ATTR_ALLOW_BREAKS:
INT_ATTR (allow_breaks);
break;
case PANGO_ATTR_SHOW:
INT_ATTR (show_spaces);
break;
case PANGO_ATTR_INSERT_HYPHENS:
INT_ATTR (insert_hyphens);
break;
case PANGO_ATTR_SHAPE:
case PANGO_ATTR_ABSOLUTE_SIZE:
case PANGO_ATTR_GRAVITY:
case PANGO_ATTR_GRAVITY_HINT:
case PANGO_ATTR_FOREGROUND_ALPHA:
case PANGO_ATTR_BACKGROUND_ALPHA:
break;
case PANGO_ATTR_INVALID:
default:
g_assert_not_reached ();
break;
}
}
g_slist_free_full (attrs, (GDestroyNotify)pango_attribute_destroy);
#undef LANGUAGE_ATTR
#undef STRING_ATTR
#undef INT_ATTR
#undef FONT_ATTR
#undef FLOAT_ATTR
#undef RGBA_ATTR
}
typedef struct
{
GMarkupParseContext *parser;
char *markup;
gsize pos;
gsize len;
GtkTextBuffer *buffer;
GtkTextIter iter;
GtkTextMark *mark;
PangoAttrList *attributes;
char *text;
PangoAttrIterator *attr;
} MarkupData;
static void
free_markup_data (MarkupData *mdata)
{
g_free (mdata->markup);
g_clear_pointer (&mdata->parser, g_markup_parse_context_free);
gtk_text_buffer_delete_mark (mdata->buffer, mdata->mark);
g_clear_pointer (&mdata->attr, pango_attr_iterator_destroy);
g_clear_pointer (&mdata->attributes, pango_attr_list_unref);
g_free (mdata->text);
g_object_unref (mdata->buffer);
g_free (mdata);
}
static gboolean
insert_markup_idle (gpointer data)
{
MarkupData *mdata = data;
gint64 begin;
begin = g_get_monotonic_time ();
do
{
int start, end;
int start_offset;
GtkTextIter start_iter;
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
{
g_idle_add (insert_markup_idle, data);
return G_SOURCE_REMOVE;
}
pango_attr_iterator_range (mdata->attr, &start, &end);
if (end == G_MAXINT) /* last chunk */
end = start - 1; /* resulting in -1 to be passed to _insert */
start_offset = gtk_text_iter_get_offset (&mdata->iter);
gtk_text_buffer_insert (mdata->buffer, &mdata->iter, mdata->text + start, end - start);
gtk_text_buffer_get_iter_at_offset (mdata->buffer, &start_iter, start_offset);
insert_tags_for_attributes (mdata->buffer, mdata->attr, &start_iter, &mdata->iter);
gtk_text_buffer_get_iter_at_mark (mdata->buffer, &mdata->iter, mdata->mark);
}
while (pango_attr_iterator_next (mdata->attr));
free_markup_data (mdata);
return G_SOURCE_REMOVE;
}
static gboolean
parse_markup_idle (gpointer data)
{
MarkupData *mdata = data;
gint64 begin;
GError *error = NULL;
begin = g_get_monotonic_time ();
do {
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
{
g_idle_add (parse_markup_idle, data);
return G_SOURCE_REMOVE;
}
if (!g_markup_parse_context_parse (mdata->parser,
mdata->markup + mdata->pos,
MIN (4096, mdata->len - mdata->pos),
&error))
{
g_warning ("Invalid markup string: %s", error->message);
g_error_free (error);
free_markup_data (mdata);
return G_SOURCE_REMOVE;
}
mdata->pos += 4096;
} while (mdata->pos < mdata->len);
if (!pango_markup_parser_finish (mdata->parser,
&mdata->attributes,
&mdata->text,
NULL,
&error))
{
g_warning ("Invalid markup string: %s", error->message);
g_error_free (error);
free_markup_data (mdata);
return G_SOURCE_REMOVE;
}
if (!mdata->attributes)
{
gtk_text_buffer_insert (mdata->buffer, &mdata->iter, mdata->text, -1);
free_markup_data (mdata);
return G_SOURCE_REMOVE;
}
mdata->attr = pango_attr_list_get_iterator (mdata->attributes);
insert_markup_idle (data);
return G_SOURCE_REMOVE;
}
/* Takes a ref on @buffer while it is operating,
* and consumes @markup.
*/
static void
insert_markup (GtkTextBuffer *buffer,
GtkTextIter *iter,
char *markup,
int len)
{
MarkupData *data;
g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
data = g_new0 (MarkupData, 1);
data->buffer = g_object_ref (buffer);
data->iter = *iter;
data->markup = markup;
data->len = len;
data->parser = pango_markup_parser_new (0);
data->pos = 0;
/* create mark with right gravity */
data->mark = gtk_text_buffer_create_mark (buffer, NULL, iter, FALSE);
parse_markup_idle (data);
}
static void
fontify_finish (GObject *source,
GAsyncResult *result,
gpointer data)
{
GSubprocess *subprocess = G_SUBPROCESS (source);
GtkTextBuffer *buffer = data;
GBytes *stdout_buf = NULL;
GBytes *stderr_buf = NULL;
GError *error = NULL;
if (!g_subprocess_communicate_finish (subprocess,
result,
&stdout_buf,
&stderr_buf,
&error))
{
g_clear_pointer (&stdout_buf, g_bytes_unref);
g_clear_pointer (&stderr_buf, g_bytes_unref);
g_warning ("%s", error->message);
g_clear_error (&error);
g_object_unref (subprocess);
g_object_unref (buffer);
return;
}
if (g_subprocess_get_exit_status (subprocess) != 0)
{
if (stderr_buf)
g_warning ("%s", (char *)g_bytes_get_data (stderr_buf, NULL));
g_clear_pointer (&stderr_buf, g_bytes_unref);
}
g_object_unref (subprocess);
g_clear_pointer (&stderr_buf, g_bytes_unref);
if (stdout_buf)
{
char *markup;
gsize len;
char *p;
GtkTextIter start;
gtk_text_buffer_set_text (buffer, "", 0);
/* highlight puts a span with font and size around its output,
* which we don't want.
*/
markup = g_bytes_unref_to_data (stdout_buf, &len);
for (p = markup + strlen ("<span "); *p != '>'; p++) *p = ' ';
gtk_text_buffer_get_start_iter (buffer, &start);
insert_markup (buffer, &start, markup, len);
}
g_object_unref (buffer);
}
void
fontify (const char *format,
GtkTextBuffer *source_buffer)
{
GSubprocess *subprocess;
char *format_arg;
GtkSettings *settings;
char *theme;
gboolean prefer_dark;
const char *style_arg;
const char *text;
GtkTextIter start, end;
GBytes *bytes;
GError *error = NULL;
settings = gtk_settings_get_default ();
g_object_get (settings,
"gtk-theme-name", &theme,
"gtk-application-prefer-dark-theme", &prefer_dark,
NULL);
if (prefer_dark || strcmp (theme, "HighContrastInverse") == 0)
style_arg = "--style=edit-vim-dark";
else
style_arg = "--style=edit-kwrite";
g_free (theme);
format_arg = g_strconcat ("--syntax=", format, NULL);
subprocess = g_subprocess_new (G_SUBPROCESS_FLAGS_STDIN_PIPE |
G_SUBPROCESS_FLAGS_STDOUT_PIPE |
G_SUBPROCESS_FLAGS_STDERR_PIPE,
&error,
"highlight",
format_arg,
"--out-format=pango",
style_arg,
NULL);
g_free (format_arg);
if (!subprocess)
{
if (g_error_matches (error, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT))
{
static gboolean warned = FALSE;
if (!warned)
{
warned = TRUE;
g_message ("For syntax highlighting, install the “highlight” program");
}
}
else
g_warning ("%s", error->message);
g_clear_error (&error);
return;
}
gtk_text_buffer_get_bounds (source_buffer, &start, &end);
text = gtk_text_buffer_get_text (source_buffer, &start, &end, TRUE);
bytes = g_bytes_new_static (text, strlen (text));
#ifdef HAVE_GIO_UNIX
/* Work around https://gitlab.gnome.org/GNOME/glib/-/issues/2182 */
if (G_IS_UNIX_OUTPUT_STREAM (g_subprocess_get_stdin_pipe (subprocess)))
{
GOutputStream *stdin_pipe = g_subprocess_get_stdin_pipe (subprocess);
int fd = g_unix_output_stream_get_fd (G_UNIX_OUTPUT_STREAM (stdin_pipe));
fcntl (fd, F_SETFL, O_NONBLOCK);
}
#endif
g_subprocess_communicate_async (subprocess,
bytes,
NULL,
fontify_finish,
g_object_ref (source_buffer));
}

6
demos/gtk-demo/fontify.h Normal file
View File

@@ -0,0 +1,6 @@
#pragma once
#include <gtk/gtk.h>
void fontify (const char *format,
GtkTextBuffer *buffer);

View File

@@ -36,11 +36,11 @@ adjustment_get_normalized_value (GtkAdjustment *adj)
static void
val_to_xy (GtkFontPlane *plane,
gint *x,
gint *y)
int *x,
int *y)
{
gdouble u, v;
gint width, height;
double u, v;
int width, height;
width = gtk_widget_get_allocated_width (GTK_WIDGET (plane));
height = gtk_widget_get_allocated_height (GTK_WIDGET (plane));
@@ -57,8 +57,8 @@ plane_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkFontPlane *plane = GTK_FONT_PLANE (widget);
gint x, y;
gint width, height;
int x, y;
int width, height;
cairo_t *cr;
val_to_xy (plane, &x, &y);
@@ -125,11 +125,11 @@ adjustment_set_normalized_value (GtkAdjustment *adj,
static void
update_value (GtkFontPlane *plane,
gint x,
gint y)
int x,
int y)
{
GtkWidget *widget = GTK_WIDGET (plane);
gdouble u, v;
double u, v;
u = CLAMP (x * (1.0 / gtk_widget_get_allocated_width (widget)), 0, 1);
v = CLAMP (1 - y * (1.0 / gtk_widget_get_allocated_height (widget)), 0, 1);
@@ -142,8 +142,8 @@ update_value (GtkFontPlane *plane,
static void
plane_drag_gesture_begin (GtkGestureDrag *gesture,
gdouble start_x,
gdouble start_y,
double start_x,
double start_y,
GtkFontPlane *plane)
{
guint button;
@@ -164,11 +164,11 @@ plane_drag_gesture_begin (GtkGestureDrag *gesture,
static void
plane_drag_gesture_update (GtkGestureDrag *gesture,
gdouble offset_x,
gdouble offset_y,
double offset_x,
double offset_y,
GtkFontPlane *plane)
{
gdouble start_x, start_y;
double start_x, start_y;
gtk_gesture_drag_get_start_point (GTK_GESTURE_DRAG (gesture),
&start_x, &start_y);
@@ -177,8 +177,8 @@ plane_drag_gesture_update (GtkGestureDrag *gesture,
static void
plane_drag_gesture_end (GtkGestureDrag *gesture,
gdouble offset_x,
gdouble offset_y,
double offset_x,
double offset_y,
GtkFontPlane *plane)
{
set_cross_cursor (GTK_WIDGET (plane), FALSE);

View File

@@ -19,13 +19,7 @@ static GtkWidget *show_extents = NULL;
static PangoContext *context;
static int scale = 10;
static void
on_destroy (gpointer data)
{
window = NULL;
}
static int scale = 9;
static void
update_image (void)
@@ -65,7 +59,7 @@ update_image (void)
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
cairo_font_options_set_hint_style (fopt, hintstyle);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hint_metrics)))
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (hint_metrics)))
hintmetrics = CAIRO_HINT_METRICS_ON;
else
hintmetrics = CAIRO_HINT_METRICS_OFF;
@@ -113,7 +107,7 @@ update_image (void)
cr = cairo_create (surface);
cairo_set_line_width (cr, 1);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (show_grid)))
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (show_grid)))
{
int i;
cairo_set_source_rgba (cr, 0.2, 0, 0, 0.2);
@@ -131,7 +125,7 @@ update_image (void)
}
}
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (show_extents)))
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (show_extents)))
{
cairo_set_source_rgba (cr, 0, 0, 1, 1);
@@ -251,9 +245,7 @@ do_fontrendering (GtkWidget *do_widget)
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (on_destroy), NULL);
g_object_set_data_full (G_OBJECT (window), "builder", builder, g_object_unref);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
font_button = GTK_WIDGET (gtk_builder_get_object (builder, "font_button"));
up_button = GTK_WIDGET (gtk_builder_get_object (builder, "up_button"));
down_button = GTK_WIDGET (gtk_builder_get_object (builder, "down_button"));
@@ -276,6 +268,8 @@ do_fontrendering (GtkWidget *do_widget)
g_signal_connect (show_extents, "notify::active", G_CALLBACK (update_image), NULL);
update_image ();
g_object_unref (builder);
}
if (!gtk_widget_get_visible (window))

View File

@@ -6,164 +6,11 @@
<property name="page-increment">4</property>
</object>
<object class="GtkWindow" id="window">
<property name="default-width">600</property>
<property name="default-height">300</property>
<property name="title">Font rendering</property>
<child>
<object class="GtkGrid">
<property name="margin-top">10</property>
<property name="row-spacing">10</property>
<property name="column-spacing">10</property>
<child>
<object class="GtkLabel">
<property name="margin-start">10</property>
<property name="label">Text</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<child>
<object class="GtkEntry" id="entry">
<property name="text">Fonts render</property>
<layout>
<property name="left-attach">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="margin-start">10</property>
<property name="label">Font</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkFontButton" id="font_button">
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Hinting</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="left-attach">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkComboBoxText" id="hinting">
<property name="active">0</property>
<property name="valign">center</property>
<items>
<item translatable="yes" id="none">None</item>
<item translatable="yes" id="slight">Slight</item>
<item translatable="yes" id="medium">Medium</item>
<item translatable="yes" id="full">Full</item>
</items>
<layout>
<property name="left-attach">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="hint_metrics">
<child>
<object class="GtkLabel">
<property name="label">Hint Metrics</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<layout>
<property name="left-attach">3</property>
<property name="top-attach">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="show_extents">
<property name="active">1</property>
<child>
<object class="GtkLabel">
<property name="label">Show Extents</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<layout>
<property name="left-attach">4</property>
<property name="top-attach">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="show_grid">
<property name="active">1</property>
<child>
<object class="GtkLabel">
<property name="label">Show Grid</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<layout>
<property name="left-attach">4</property>
<property name="top-attach">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="up_button">
<property name="icon-name">list-add-symbolic</property>
<style>
<class name="circular"/>
</style>
<layout>
<property name="left-attach">5</property>
<property name="top-attach">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="down_button">
<property name="icon-name">list-remove-symbolic</property>
<style>
<class name="circular"/>
</style>
<layout>
<property name="left-attach">5</property>
<property name="top-attach">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="hexpand">1</property>
<layout>
<property name="left-attach">6</property>
</layout>
</object>
</child>
<child>
<property name="default-width">1080</property>
<property name="default-height">430</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<child type="title">
<object class="GtkBox">
<property name="halign">center</property>
<property name="valign">center</property>
@@ -171,29 +18,170 @@
<class name="linked"/>
</style>
<child>
<object class="GtkRadioButton" id="text_radio">
<property name="draw-indicator">0</property>
<object class="GtkToggleButton" id="text_radio">
<property name="label">Text</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkRadioButton" id="grid_radio">
<property name="draw-indicator">0</property>
<object class="GtkToggleButton" id="grid_radio">
<property name="label">Grid</property>
<property name="group">text_radio</property>
</object>
</child>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="column-span">7</property>
</layout>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkGrid">
<property name="halign">center</property>
<property name="margin-top">10</property>
<property name="margin-bottom">10</property>
<property name="row-spacing">10</property>
<property name="column-spacing">10</property>
<child>
<object class="GtkLabel">
<property name="margin-start">10</property>
<property name="label">Text</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkEntry" id="entry">
<property name="text">Fonts render</property>
<layout>
<property name="column">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="margin-start">10</property>
<property name="label">Font</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">1</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkFontButton" id="font_button">
<layout>
<property name="column">2</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Hinting</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkComboBoxText" id="hinting">
<property name="active">0</property>
<property name="valign">center</property>
<items>
<item translatable="yes" id="none">None</item>
<item translatable="yes" id="slight">Slight</item>
<item translatable="yes" id="medium">Medium</item>
<item translatable="yes" id="full">Full</item>
</items>
<layout>
<property name="column">4</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="hint_metrics">
<property name="label">Hint Metrics</property>
<layout>
<property name="column">4</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="show_extents">
<property name="label">Show Extents</property>
<property name="active">1</property>
<layout>
<property name="column">5</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="show_grid">
<property name="active">1</property>
<property name="label">Show Grid</property>
<layout>
<property name="column">5</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="up_button">
<property name="icon-name">list-add-symbolic</property>
<style>
<class name="circular"/>
</style>
<layout>
<property name="column">6</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="down_button">
<property name="icon-name">list-remove-symbolic</property>
<style>
<class name="circular"/>
</style>
<layout>
<property name="column">6</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="hexpand">1</property>
<layout>
<property name="column">7</property>
</layout>
</object>
</child>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="propagate-natural-height">1</property>
<property name="has-frame">1</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<child>
@@ -203,11 +191,6 @@
<property name="can-shrink">0</property>
</object>
</child>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">4</property>
<property name="column-span">7</property>
</layout>
</object>
</child>
</object>

View File

@@ -0,0 +1,94 @@
#include "four_point_transform.h"
#include "singular_value_decomposition.h"
/* Make a 4x4 matrix that maps
* e1 -> p1
* e2 -> p3
* e3 -> p3
* (1,1,1,0) -> p4
*/
static void
unit_to (graphene_point3d_t *p1,
graphene_point3d_t *p2,
graphene_point3d_t *p3,
graphene_point3d_t *p4,
graphene_matrix_t *m)
{
graphene_vec3_t v1, v2, v3, v4;
graphene_vec4_t vv1, vv2, vv3, vv4, p;
graphene_matrix_t u, s;
float v[16] = { 0., };
double A[16];
double U[16];
double S[4];
double V[16];
double B[4];
double x[4];
int i, j;
graphene_point3d_to_vec3 (p1, &v1);
graphene_point3d_to_vec3 (p2, &v2);
graphene_point3d_to_vec3 (p3, &v3);
graphene_point3d_to_vec3 (p4, &v4);
graphene_vec4_init_from_vec3 (&vv1, &v1, 1.);
graphene_vec4_init_from_vec3 (&vv2, &v2, 1.);
graphene_vec4_init_from_vec3 (&vv3, &v3, 1.);
graphene_vec4_init_from_vec3 (&vv4, &v4, 1.);
graphene_vec4_init (&p, 0., 0., 0., 1.);
graphene_matrix_init_from_vec4 (&u, &vv1, &vv2, &vv3, &p);
/* solve x * u = vv4 */
for (i = 0; i < 4; i++)
for (j = 0; j < 4; j++)
A[j * 4 + i] = graphene_matrix_get_value (&u, i, j);
B[0] = graphene_vec4_get_x (&vv4);
B[1] = graphene_vec4_get_y (&vv4);
B[2] = graphene_vec4_get_z (&vv4);
B[3] = graphene_vec4_get_w (&vv4);
singular_value_decomposition (A, 4, 4, U, S, V);
singular_value_decomposition_solve (U, S, V, 4, 4, B, x);
v[ 0] = x[0];
v[ 5] = x[1];
v[10] = x[2];
v[15] = 1;
graphene_matrix_init_from_float (&s, (const float *)&v);
graphene_matrix_multiply (&s, &u, m);
}
/* Compute a 4x4 matrix m that maps
* p1 -> q1
* p2 -> q2
* p3 -> q3
* p4 -> q4
*
* This is not in general possible, because projective
* transforms preserve coplanarity. But in the cases we
* care about here, both sets of points are always coplanar.
*/
void
perspective_3d (graphene_point3d_t *p1,
graphene_point3d_t *p2,
graphene_point3d_t *p3,
graphene_point3d_t *p4,
graphene_point3d_t *q1,
graphene_point3d_t *q2,
graphene_point3d_t *q3,
graphene_point3d_t *q4,
graphene_matrix_t *m)
{
graphene_matrix_t a, a_inv, b;
unit_to (p1, p2, p3, p4, &a);
unit_to (q1, q2, q3, q4, &b);
graphene_matrix_inverse (&a, &a_inv);
graphene_matrix_multiply (&a_inv, &b, m);
}

View File

@@ -0,0 +1,13 @@
#pragma once
#include <graphene.h>
void perspective_3d (graphene_point3d_t *p1,
graphene_point3d_t *p2,
graphene_point3d_t *p3,
graphene_point3d_t *p4,
graphene_point3d_t *q1,
graphene_point3d_t *q2,
graphene_point3d_t *q3,
graphene_point3d_t *q4,
graphene_matrix_t *m);

View File

@@ -6,6 +6,22 @@ import re
import os
from collections import *
def add_quotes(s):
return "\"" + s.lower() + "\""
def wordify(s):
return s.strip().rstrip(".,;:")
def is_keyword(s):
if s == "GTK":
return False
elif s.startswith(("Gtk", "Gdk", "Pango")):
return True
elif s.startswith("G") and s[1].isupper():
return True
else:
return False
out_file = sys.argv[1]
in_files = sys.argv[2:]
@@ -19,13 +35,14 @@ struct _DemoData
{
const char *name;
const char *title;
const char **keywords;
const char *filename;
GDoDemoFunc func;
DemoData *children;
};
"""
# Demo = namedtuple('Demo', ['name', 'title', 'file', 'func'])
# Demo = namedtuple('Demo', ['name', 'title', 'keywords', 'file', 'func'])
demos = []
@@ -34,14 +51,17 @@ for demo_file in in_files:
demo_name = filename.replace(".c", "")
with open(demo_file, 'r', encoding='utf-8') as f:
title = f.readline().replace("/*", "").strip()
keywords = set()
line = f.readline().strip();
while not line.endswith('*/'):
if line.startswith("* #Keywords:"):
keywords = keywords.union(set(map(wordify, line.replace ("* #Keywords:", "").strip().split(","))))
else:
keywords = keywords.union(set(filter(is_keyword, map(wordify, line.replace ("* ", "").split()))))
line = f.readline().strip()
file_output += "GtkWidget *do_" + demo_name + " (GtkWidget *do_widget);\n"
# demos += Demo(name = demo_name,
# title = title,
# file = demo_file,
# func = "do_" + title)
demos.append((demo_name, title, filename, "do_" + demo_name, -1))
demos.append((demo_name, title, keywords, filename, "do_" + demo_name, -1))
# Generate a List of "Parent names"
parents = []
@@ -57,7 +77,7 @@ for demo in demos:
if not parent_name in parents:
parents.append(parent_name)
parent_ids.append(parent_index)
demos.append(("NULL", parent_name, "NULL", "NULL", parent_index))
demos.append(("NULL", parent_name, set(), "NULL", "NULL", parent_index))
parent_index = parent_index + 1
@@ -71,8 +91,7 @@ for parent in parents:
for child in demos:
if child[1].startswith(parent + "/"):
title = child[1][child[1].rfind('/') + 1:]
file_output += " { \"" + child[0] + "\", \"" + title + "\", \"" + child[2] + "\", " + child[3] + ", NULL },\n"
file_output += " { \"" + child[0] + "\", \"" + title + "\", " + "(const char*[]) {" + ", ".join(list(map(add_quotes, child[2])) + ["NULL"]) + " }, \"" + child[3] + "\", " + child[4] + ", NULL },\n"
file_output += " { NULL }\n};\n"
i = i + 1
@@ -86,9 +105,10 @@ for demo in demos:
# Do not generate one of these for demos with a parent demo
if "/" not in demo[1]:
child_array = "NULL"
name = demo[0];
title = demo[1];
file = demo[2]
name = demo[0]
title = demo[1]
keywords = demo[2]
file = demo[3]
if name != "NULL":
name = "\"" + name + "\""
if title != "NULL":
@@ -96,9 +116,9 @@ for demo in demos:
if file != "NULL":
file = "\"" + file + "\""
if demo[4] != -1:
child_array = "child" + str(demo[4])
file_output += " { " + name + ", " + title + ", " + file + ", " + demo[3] + ", " + child_array + " },\n"
if demo[5] != -1:
child_array = "child" + str(demo[5])
file_output += " { " + name + ", " + title + ", " + "(const char*[]) {" + ", ".join(list(map(add_quotes, keywords)) + ["NULL"]) + " }, " + file + ", " + demo[4] + ", " + child_array + " },\n"
file_output += " { NULL }\n};\n"

View File

@@ -1,4 +1,5 @@
/* Gestures
* #Keywords: GtkGesture
*
* Perform gestures on touchscreens and other input devices. This
* demo reacts to long presses and swipes from all devices, plus
@@ -9,8 +10,8 @@
static GtkGesture *rotate = NULL;
static GtkGesture *zoom = NULL;
static gdouble swipe_x = 0;
static gdouble swipe_y = 0;
static double swipe_x = 0;
static double swipe_y = 0;
static gboolean long_pressed = FALSE;
static gboolean
@@ -26,8 +27,8 @@ touchpad_swipe_gesture_begin (GtkGesture *gesture,
static void
swipe_gesture_swept (GtkGestureSwipe *gesture,
gdouble velocity_x,
gdouble velocity_y,
double velocity_x,
double velocity_y,
GtkWidget *widget)
{
swipe_x = velocity_x / 10;
@@ -37,8 +38,8 @@ swipe_gesture_swept (GtkGestureSwipe *gesture,
static void
long_press_gesture_pressed (GtkGestureLongPress *gesture,
gdouble x,
gdouble y,
double x,
double y,
GtkWidget *widget)
{
long_pressed = TRUE;
@@ -56,8 +57,8 @@ long_press_gesture_end (GtkGesture *gesture,
static void
rotation_angle_changed (GtkGestureRotate *gesture,
gdouble angle,
gdouble delta,
double angle,
double delta,
GtkWidget *widget)
{
gtk_widget_queue_draw (widget);
@@ -65,7 +66,7 @@ rotation_angle_changed (GtkGestureRotate *gesture,
static void
zoom_scale_changed (GtkGestureZoom *gesture,
gdouble scale,
double scale,
GtkWidget *widget)
{
gtk_widget_queue_draw (widget);
@@ -93,8 +94,8 @@ drawing_area_draw (GtkDrawingArea *area,
{
cairo_pattern_t *pat;
cairo_matrix_t matrix;
gdouble angle, scale;
gdouble x_center, y_center;
double angle, scale;
double x_center, y_center;
gtk_gesture_get_bounding_box_center (GTK_GESTURE (zoom), &x_center, &y_center);

View File

@@ -1,7 +1,7 @@
precision highp float;
void main() {
float lerpVal = gl_FragCoord.y / 500.0f;
float lerpVal = gl_FragCoord.y / 500.0;
gl_FragColor = mix(vec4(1.0f, 0.85f, 0.35f, 1.0f), vec4(0.2f, 0.2f, 0.2f, 1.0f), lerpVal);
gl_FragColor = mix(vec4(1.0, 0.85, 0.35, 1.0), vec4(0.2, 0.2, 0.2, 1.0), lerpVal);
}

View File

@@ -0,0 +1,174 @@
// Originally from: https://www.shadertoy.com/view/ttBcRV
// License CC0: Flying through glowing stars
// The result of playing around trying to improve an old shader
#define PI 3.141592654
#define TAU (2.0*PI)
#define TIME iTime
#define RESOLUTION iResolution
#define LESS(a,b,c) mix(a,b,step(0.,c))
#define SABS(x,k) LESS((.5/(k))*(x)*(x)+(k)*.5,abs(x),abs(x)-(k))
#define MROT(a) mat2(cos(a), sin(a), -sin(a), cos(a))
vec3 hsv2rgb(vec3 c) {
const vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
float hash(in vec3 co) {
return fract(sin(dot(co, vec3(12.9898,58.233, 12.9898+58.233))) * 13758.5453);
}
float starn(vec2 p, float r, int n, float m) {
// From IQ: https://www.shadertoy.com/view/3tSGDy
// https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
// Minor tweak to use SABS over abs to smooth inner corners
// SABS: https://www.shadertoy.com/view/Ws2SDK
// next 4 lines can be precomputed for a given shape
float an = 3.141593/float(n);
float en = 3.141593/m; // m is between 2 and n
vec2 acs = vec2(cos(an),sin(an));
vec2 ecs = vec2(cos(en),sin(en)); // ecs=vec2(0,1) for regular polygon,
float bn = mod(atan(p.x,p.y),2.0*an) - an;
p = length(p)*vec2(cos(bn),SABS(sin(bn), 0.15));
p -= r*acs;
p += ecs*clamp( -dot(p,ecs), 0.0, r*acs.y/ecs.y);
return length(p)*sign(p.x);
}
vec4 alphaBlend(vec4 back, vec4 front) {
vec3 xyz = mix(back.xyz*back.w, front.xyz, front.w);
float w = mix(back.w, 1.0, front.w);
return vec4(xyz, w);
}
void rot(inout vec2 p, float a) {
float c = cos(a);
float s = sin(a);
p = vec2(c*p.x + s*p.y, -s*p.x + c*p.y);
}
vec3 offset(float z) {
float a = z;
vec2 p = -0.075*(vec2(cos(a), sin(a*sqrt(2.0))) + vec2(cos(a*sqrt(0.75)), sin(a*sqrt(0.5))));
return vec3(p, z);
}
vec3 doffset(float z) {
float eps = 0.05;
return 0.5*(offset(z + eps) - offset(z - eps))/eps;
}
vec3 ddoffset(float z) {
float eps = 0.05;
return 0.5*(doffset(z + eps) - doffset(z - eps))/eps;
}
vec4 planeCol(vec3 ro, vec3 rd, float n, vec3 pp) {
const float s = 0.5;
vec2 p = pp.xy;
float z = pp.z;
vec2 dpy = dFdy(p);
float aa = length(dpy);
p -= (1.0+5.0*(pp.z - ro.z))*offset(z).xy;
p *= s;
float r = hash(vec3(floor(p+0.5), n));
p = fract(p+0.5)-0.5;
rot(p, ((TAU*r+n)*0.25));
float d = starn(p, 0.20, 3 + 2*int(3.0*r), 3.0);
d -= 0.06;
d/=s;
float ds = -d+0.03;
vec3 cols = hsv2rgb(vec3(337.0/360.0+0.1*sin(n*0.3), 0.8, 0.54+0.2*sin(n*0.3)));
float ts = 1.0 - smoothstep(-aa, 0.0, ds);
vec4 cs = vec4(cols, ts*0.93);
float db = abs(d) - (0.06);
db = abs(db) - 0.03;
db = abs(db) - 0.00;
db = max(db, -d+0.03);
vec3 colb = vec3(1.0, 0.7, 0.5);
float tb = exp(-(db)*30.0*(1.0 - 10.0*aa));
vec4 cb = vec4(1.5*colb, tb);
vec4 ct = alphaBlend(cs, cb);
return ct;
}
vec3 color(vec3 ww, vec3 uu, vec3 vv, vec3 ro, vec2 p) {
vec3 rd = normalize(p.x*uu + p.y*vv + (2.0-tanh(length(p)))*ww);
vec4 col = vec4(vec3(0.0), 1.0);
const float planeDist = 1.0;
const int furthest = 6;
const int fadeFrom = furthest-3;
float nz = floor(ro.z / planeDist);
for (int i = furthest; i >= 1; --i) {
float pz = planeDist*nz + planeDist*float(i);
float pd = (pz - ro.z)/rd.z;
if (pd > 0.0) {
vec3 pp = ro + rd*pd;
vec4 pcol = planeCol(ro, rd, nz+float(i), pp);
float fadeIn = 1.0-smoothstep(planeDist*float(fadeFrom), planeDist*float(furthest), pp.z-ro.z);
pcol.xyz *= sqrt(fadeIn);
col = alphaBlend(col, pcol);
}
}
return col.xyz*col.w;
}
vec3 postProcess(vec3 col, vec2 q) {
col=pow(clamp(col,0.0,1.0),vec3(0.75));
col=col*0.6+0.4*col*col*(3.0-2.0*col);
col=mix(col, vec3(dot(col, vec3(0.33))), -0.4);
col*=0.5+0.5*pow(19.0*q.x*q.y*(1.0-q.x)*(1.0-q.y),0.7);
return col;
}
vec3 effect(vec2 p, vec2 q) {
float tm = TIME*0.65;
vec3 ro = offset(tm);
vec3 dro = doffset(tm);
vec3 ddro = ddoffset(tm);
vec3 ww = normalize(dro);
vec3 uu = normalize(cross(vec3(0.0,1.0,0.0)+1.5*ddro, ww));
vec3 vv = normalize(cross(ww, uu));
vec3 col = color(ww, uu, vv, ro, p);
col = postProcess(col, q);
const float fadeIn = 2.0;
return col*smoothstep(0.0, fadeIn, TIME);
}
void mainImage(out vec4 fragColor, vec2 fragCoord) {
vec2 q = fragCoord/RESOLUTION.xy;
vec2 p = -1. + 2. * q;
p.x *= RESOLUTION.x/RESOLUTION.y;
vec3 col = effect(p, q);
fragColor = vec4(col, 1.0);
}

View File

@@ -0,0 +1,329 @@
/* OpenGL/Transitions
* #Keywords: OpenGL, shader
*
* Create transitions between pages using a custom fragment shader.
*
* The example transitions here are taken from gl-transitions.com, and you
* can edit the shader code itself on the last page of the stack.
*
* The transitions work with arbitrary content. We use images, shaders
* GL areas and plain old widgets to demonstrate this.
*
* The demo also shows some sample fire effects on the buttons.
*/
#include <math.h>
#include <gtk/gtk.h>
#include "gtkshaderstack.h"
#include "gtkshaderbin.h"
#include "gtkshadertoy.h"
#include "gskshaderpaintable.h"
static GtkWidget *demo_window = NULL;
static void
close_window (GtkWidget *widget)
{
/* Reset the state */
demo_window = NULL;
}
static void
text_changed (GtkTextBuffer *buffer,
GtkWidget *button)
{
gtk_widget_show (button);
}
static void
apply_text (GtkWidget *button,
GtkTextBuffer *buffer)
{
GtkWidget *stack;
GskGLShader *shader;
GtkTextIter start, end;
char *text;
stack = g_object_get_data (G_OBJECT (button), "the-stack");
gtk_text_buffer_get_bounds (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, TRUE);
GBytes *bytes = g_bytes_new_take (text, strlen (text));
shader = gsk_gl_shader_new_from_bytes (bytes);
gtk_shader_stack_set_shader (GTK_SHADER_STACK (stack), shader);
g_object_unref (shader);
g_bytes_unref (bytes);
gtk_widget_hide (button);
}
static void
go_back (GtkWidget *button,
GtkWidget *stack)
{
gtk_shader_stack_transition (GTK_SHADER_STACK (stack), FALSE);
}
static void
go_forward (GtkWidget *button,
GtkWidget *stack)
{
gtk_shader_stack_transition (GTK_SHADER_STACK (stack), TRUE);
}
static void
clicked_cb (GtkGestureClick *gesture,
guint n_pressed,
double x,
double y,
gpointer data)
{
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
}
static GtkWidget *
fire_bin_new (void)
{
GtkWidget *bin = gtk_shader_bin_new ();
static GskGLShader *shader = NULL;
if (shader == NULL)
shader = gsk_gl_shader_new_from_resource ("/gltransition/fire.glsl");
gtk_shader_bin_add_shader (GTK_SHADER_BIN (bin), shader, GTK_STATE_FLAG_PRELIGHT, GTK_STATE_FLAG_PRELIGHT);
return bin;
}
static GtkWidget *
new_shadertoy (const char *path)
{
GBytes *shader;
GtkWidget *toy;
toy = gtk_shadertoy_new ();
shader = g_resources_lookup_data (path, 0, NULL);
gtk_shadertoy_set_image_shader (GTK_SHADERTOY (toy),
g_bytes_get_data (shader, NULL));
g_bytes_unref (shader);
return toy;
}
static gboolean
update_paintable (GtkWidget *widget,
GdkFrameClock *frame_clock,
gpointer user_data)
{
GskShaderPaintable *paintable;
gint64 frame_time;
paintable = GSK_SHADER_PAINTABLE (gtk_picture_get_paintable (GTK_PICTURE (widget)));
frame_time = gdk_frame_clock_get_frame_time (frame_clock);
gsk_shader_paintable_update_time (paintable, 0, frame_time);
return G_SOURCE_CONTINUE;
}
static GtkWidget *
make_shader_stack (const char *name,
const char *resource_path,
GtkWidget *scale)
{
GtkWidget *stack, *child, *widget, *vbox, *hbox, *bin;
GtkWidget *label, *button, *tv;
GskGLShader *shader;
GObjectClass *class;
GParamSpecFloat *pspec;
GtkAdjustment *adjustment;
GtkTextBuffer *buffer;
GBytes *bytes;
GtkEventController *controller;
GtkCssProvider *provider;
GdkPaintable *paintable;
stack = gtk_shader_stack_new ();
shader = gsk_gl_shader_new_from_resource (resource_path);
gtk_shader_stack_set_shader (GTK_SHADER_STACK (stack), shader);
g_object_unref (shader);
child = gtk_picture_new_for_resource ("/css_pixbufs/background.jpg");
gtk_picture_set_can_shrink (GTK_PICTURE (child), TRUE);
gtk_shader_stack_add_child (GTK_SHADER_STACK (stack), child);
shader = gsk_gl_shader_new_from_resource ("/gltransition/cogs2.glsl");
paintable = gsk_shader_paintable_new (shader, NULL);
child = gtk_picture_new_for_paintable (paintable);
gtk_widget_add_tick_callback (child, update_paintable, NULL, NULL);
gtk_picture_set_can_shrink (GTK_PICTURE (child), TRUE);
gtk_shader_stack_add_child (GTK_SHADER_STACK (stack), child);
child = gtk_picture_new_for_resource ("/transparent/portland-rose.jpg");
gtk_picture_set_can_shrink (GTK_PICTURE (child), TRUE);
gtk_shader_stack_add_child (GTK_SHADER_STACK (stack), child);
child = new_shadertoy ("/shadertoy/neon.glsl");
gtk_shader_stack_add_child (GTK_SHADER_STACK (stack), child);
child = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
class = g_type_class_ref (GTK_TYPE_SHADER_STACK);
pspec = G_PARAM_SPEC_FLOAT (g_object_class_find_property (class, "duration"));
adjustment = gtk_range_get_adjustment (GTK_RANGE (scale));
if (gtk_adjustment_get_lower (adjustment) == 0.0 &&
gtk_adjustment_get_upper (adjustment) == 0.0)
{
gtk_adjustment_configure (adjustment,
pspec->default_value,
pspec->minimum,
pspec->maximum,
0.1, 0.5, 0);
}
g_type_class_unref (class);
g_object_bind_property (adjustment, "value",
stack, "duration",
G_BINDING_DEFAULT);
widget = gtk_scrolled_window_new ();
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (widget), TRUE);
gtk_widget_set_hexpand (widget, TRUE);
gtk_widget_set_vexpand (widget, TRUE);
controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (controller), 0);
g_signal_connect (controller, "released", G_CALLBACK (clicked_cb), NULL);
gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_BUBBLE);
gtk_widget_add_controller (GTK_WIDGET (widget), controller);
tv = gtk_text_view_new ();
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (tv), 4);
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (tv), 4);
gtk_text_view_set_top_margin (GTK_TEXT_VIEW (tv), 4);
gtk_text_view_set_bottom_margin (GTK_TEXT_VIEW (tv), 4);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tv));
bytes = g_resources_lookup_data (resource_path, 0, NULL);
gtk_text_buffer_set_text (buffer,
(const char *)g_bytes_get_data (bytes, NULL),
g_bytes_get_size (bytes));
g_bytes_unref (bytes);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (widget), tv);
gtk_box_append (GTK_BOX (child), widget);
gtk_shader_stack_add_child (GTK_SHADER_STACK (stack), child);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
widget = gtk_center_box_new ();
label = gtk_label_new (name);
gtk_widget_add_css_class (label, "title-4");
gtk_widget_set_size_request (label, -1, 26);
gtk_center_box_set_center_widget (GTK_CENTER_BOX (widget), label);
button = gtk_button_new_from_icon_name ("view-refresh-symbolic");
g_signal_connect (buffer, "changed", G_CALLBACK (text_changed), button);
g_object_set_data (G_OBJECT (button), "the-stack", stack);
g_signal_connect (button, "clicked", G_CALLBACK (apply_text), buffer);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, "button.small { padding: 0; }", -1);
gtk_style_context_add_provider (gtk_widget_get_style_context (button),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref (provider);
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
gtk_widget_add_css_class (button, "small");
gtk_widget_hide (button);
gtk_center_box_set_end_widget (GTK_CENTER_BOX (widget), button);
gtk_box_append (GTK_BOX (vbox), widget);
gtk_box_append (GTK_BOX (vbox), stack);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_set_halign (hbox, GTK_ALIGN_CENTER);
gtk_box_append (GTK_BOX (vbox), hbox);
button = gtk_button_new_from_icon_name ("go-previous");
g_signal_connect (button, "clicked", G_CALLBACK (go_back), stack);
bin = fire_bin_new ();
gtk_shader_bin_set_child (GTK_SHADER_BIN (bin), button);
gtk_box_append (GTK_BOX (hbox), bin);
button = gtk_button_new_from_icon_name ("go-next");
g_signal_connect (button, "clicked", G_CALLBACK (go_forward), stack);
bin = fire_bin_new ();
gtk_shader_bin_set_child (GTK_SHADER_BIN (bin), button);
gtk_box_append (GTK_BOX (hbox), bin);
return vbox;
}
static GtkWidget *
create_gltransition_window (GtkWidget *do_widget)
{
GtkWidget *window, *headerbar, *scale, *grid;
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Transitions");
headerbar = gtk_header_bar_new ();
scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, NULL);
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
gtk_widget_set_size_request (scale, 100, -1);
gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), scale);
gtk_window_set_titlebar (GTK_WINDOW (window), headerbar);
gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
grid = gtk_grid_new ();
gtk_window_set_child (GTK_WINDOW (window), grid);
gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
gtk_widget_set_valign (grid, GTK_ALIGN_CENTER);
gtk_widget_set_margin_start (grid, 12);
gtk_widget_set_margin_end (grid, 12);
gtk_widget_set_margin_top (grid, 12);
gtk_widget_set_margin_bottom (grid, 12);
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
gtk_grid_set_row_homogeneous (GTK_GRID (grid), TRUE);
gtk_grid_set_column_homogeneous (GTK_GRID (grid), TRUE);
gtk_grid_attach (GTK_GRID (grid),
make_shader_stack ("Wind", "/gltransition/transition1.glsl", scale),
0, 0, 1, 1);
gtk_grid_attach (GTK_GRID (grid),
make_shader_stack ("Radial", "/gltransition/transition2.glsl", scale),
1, 0, 1, 1);
gtk_grid_attach (GTK_GRID (grid),
make_shader_stack ("Crosswarp", "/gltransition/transition3.glsl", scale),
0, 1, 1, 1);
gtk_grid_attach (GTK_GRID (grid),
make_shader_stack ("Kaleidoscope", "/gltransition/transition4.glsl", scale),
1, 1, 1, 1);
return window;
}
GtkWidget *
do_gltransition (GtkWidget *do_widget)
{
if (!demo_window)
demo_window = create_gltransition_window (do_widget);
if (!gtk_widget_get_visible (demo_window))
gtk_widget_show (demo_window);
else
gtk_window_destroy (GTK_WINDOW (demo_window));
return demo_window;
}

View File

@@ -0,0 +1,344 @@
/*
* Copyright © 2020 Red Hat, Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Authors: Matthias Clasen <mclasen@redhat.com>
*/
#include "config.h"
#include <gtk/gtk.h>
#include "gskshaderpaintable.h"
/**
* SECTION:gskshaderpaintable
* @Short_description: Drawing with shaders
* @Title: GskShaderPaintable
* @see_also: #GdkPaintable
*
* GskShaderPaintable is an implementation of the #GdkPaintable interface
* that uses a #GskGLShader to create pixels.
*
* You can set the uniform data that the shader needs for rendering
* using gsk_shader_paintable_set_uniform_data(). This function can
* be called repeatedly to change the uniform data for the next
* snapshot.
*
* Commonly, time is passed to shaders as a float uniform containing
* the elapsed time in seconds. The convenience API
* gsk_shader_paintable_update_time() can be called from a #GtkTickCallback
* to update the time based on the frame time of the frame clock.
*/
struct _GskShaderPaintable
{
GObject parent_instance;
GskGLShader *shader;
GBytes *uniform_data;
gint64 start_time;
};
struct _GskShaderPaintableClass
{
GObjectClass parent_class;
};
enum {
PROP_0,
PROP_SHADER,
PROP_UNIFORM_DATA,
N_PROPS,
};
static GParamSpec *properties[N_PROPS] = { NULL, };
static void
gsk_shader_paintable_paintable_snapshot (GdkPaintable *paintable,
GdkSnapshot *snapshot,
double width,
double height)
{
GskShaderPaintable *self = GSK_SHADER_PAINTABLE (paintable);
gtk_snapshot_push_gl_shader (snapshot, self->shader, &GRAPHENE_RECT_INIT(0, 0, width, height), g_bytes_ref (self->uniform_data));
gtk_snapshot_pop (snapshot);
}
static void
gsk_shader_paintable_paintable_init (GdkPaintableInterface *iface)
{
iface->snapshot = gsk_shader_paintable_paintable_snapshot;
}
G_DEFINE_TYPE_EXTENDED (GskShaderPaintable, gsk_shader_paintable, G_TYPE_OBJECT, 0,
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
gsk_shader_paintable_paintable_init))
static void
gsk_shader_paintable_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GskShaderPaintable *self = GSK_SHADER_PAINTABLE (object);
switch (prop_id)
{
case PROP_SHADER:
gsk_shader_paintable_set_shader (self, g_value_get_object (value));
break;
case PROP_UNIFORM_DATA:
gsk_shader_paintable_set_uniform_data (self, g_value_get_boxed (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gsk_shader_paintable_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GskShaderPaintable *self = GSK_SHADER_PAINTABLE (object);
switch (prop_id)
{
case PROP_SHADER:
g_value_set_object (value, self->shader);
break;
case PROP_UNIFORM_DATA:
g_value_set_boxed (value, self->uniform_data);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gsk_shader_paintable_finalize (GObject *object)
{
GskShaderPaintable *self = GSK_SHADER_PAINTABLE (object);
g_clear_pointer (&self->uniform_data, g_bytes_unref);
g_clear_object (&self->shader);
G_OBJECT_CLASS (gsk_shader_paintable_parent_class)->finalize (object);
}
static void
gsk_shader_paintable_class_init (GskShaderPaintableClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->get_property = gsk_shader_paintable_get_property;
gobject_class->set_property = gsk_shader_paintable_set_property;
gobject_class->finalize = gsk_shader_paintable_finalize;
properties[PROP_SHADER] =
g_param_spec_object ("shader", "Shader", "The shader",
GSK_TYPE_GL_SHADER,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
properties[PROP_UNIFORM_DATA] =
g_param_spec_boxed ("uniform-data", "Uniform data", "The uniform data",
G_TYPE_BYTES,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (gobject_class, N_PROPS, properties);
}
static void
gsk_shader_paintable_init (GskShaderPaintable *self)
{
}
/**
* gsk_shader_paintable_new:
* @shader: (transfer full) (nullable): the shader to use
* @data: (transfer full) (nullable): uniform data
*
* Creates a paintable that uses the @shader to create
* pixels. The shader must not require input textures.
* If @data is %NULL, all uniform values are set to zero.
*
* Returns: (transfer full): a new #GskShaderPaintable
*/
GdkPaintable *
gsk_shader_paintable_new (GskGLShader *shader,
GBytes *data)
{
GdkPaintable *ret;
g_return_val_if_fail (shader == NULL || GSK_IS_GL_SHADER (shader), NULL);
if (shader && !data)
{
int size = gsk_gl_shader_get_args_size (shader);
data = g_bytes_new_take (g_new0 (guchar, size), size);
}
ret = g_object_new (GSK_TYPE_SHADER_PAINTABLE,
"shader", shader,
"uniform-data", data,
NULL);
g_clear_object (&shader);
g_clear_pointer (&data, g_bytes_unref);
return ret;
}
/**
* gsk_shader_paintable_set_shader:
* @self: a #GskShaderPaintable
* @shader: the #GskGLShader to use
*
* Sets the shader that the paintable will use
* to create pixels. The shader must not require
* input textures.
*/
void
gsk_shader_paintable_set_shader (GskShaderPaintable *self,
GskGLShader *shader)
{
g_return_if_fail (GSK_IS_SHADER_PAINTABLE (self));
g_return_if_fail (shader == NULL || GSK_IS_GL_SHADER (shader));
g_return_if_fail (shader == NULL || gsk_gl_shader_get_n_required_textures (shader) == 0);
if (!g_set_object (&self->shader, shader))
return;
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SHADER]);
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
g_clear_pointer (&self->uniform_data, g_bytes_unref);
}
/**
* gsk_shader_paintable_get_shader:
* @self: a #GskShaderPaintable
*
* Returns the shader that the paintable is using.
*
* Returns: (transfer none): the #GskGLShader that is used
*/
GskGLShader *
gsk_shader_paintable_get_shader (GskShaderPaintable *self)
{
g_return_val_if_fail (GSK_IS_SHADER_PAINTABLE (self), NULL);
return self->shader;
}
/**
* gsk_shader_paintable_set_uniform_data:
* @self: a #GskShaderPaintable
* @data: Data block with uniform data for the shader
*
* Sets the uniform data that will be passed to the
* shader when rendering. The @data will typically
* be produced by a #GskUniformDataBuilder.
*
* Note that the @data should be considered immutable
* after it has been passed to this function.
*/
void
gsk_shader_paintable_set_uniform_data (GskShaderPaintable *self,
GBytes *data)
{
g_return_if_fail (GSK_IS_SHADER_PAINTABLE (self));
g_return_if_fail (data == NULL || g_bytes_get_size (data) == gsk_gl_shader_get_args_size (self->shader));
g_clear_pointer (&self->uniform_data, g_bytes_unref);
if (data)
self->uniform_data = g_bytes_ref (data);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_UNIFORM_DATA]);
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
}
/**
* gsk_shader_paintable_get_uniform_data:
* @self: a #GskShaderPaintable
*
* Returns the uniform data set with
* gsk_shader_paintable_get_uniform_data().
*
* Returns: (transfer none): the uniform data
*/
GBytes *
gsk_shader_paintable_get_uniform_data (GskShaderPaintable *self)
{
g_return_val_if_fail (GSK_IS_SHADER_PAINTABLE (self), NULL);
return self->uniform_data;
}
/**
* gsk_shader_paintable_update_time:
* @self: a #GskShaderPaintable
* @time_idx: the index of the uniform for time in seconds as float
* @frame_time: the current frame time, as returned by #GdkFrameClock
*
* This function is a convenience wrapper for
* gsk_shader_paintable_set_uniform_data() that leaves all
* uniform values unchanged, except for the uniform with
* index @time_idx, which will be set to the elapsed time
* in seconds, since the first call to this function.
*
* This function is usually called from a #GtkTickCallback.
*/
void
gsk_shader_paintable_update_time (GskShaderPaintable *self,
int time_idx,
gint64 frame_time)
{
int size;
int offset;
guchar *data;
float time;
GBytes *uniform_data;
size = gsk_gl_shader_get_args_size (self->shader);
offset = gsk_gl_shader_get_uniform_offset (self->shader, time_idx);
data = g_new0 (guchar, size);
memcpy (data, g_bytes_get_data (self->uniform_data, NULL), size);
if (self->start_time == 0)
self->start_time = frame_time;
time = (frame_time - self->start_time) / (float)G_TIME_SPAN_SECOND;
*(float*)(data + offset) = time;
uniform_data = g_bytes_new_take (data, size);
gsk_shader_paintable_set_uniform_data (self, uniform_data);
g_bytes_unref (uniform_data);
}

View File

@@ -0,0 +1,53 @@
/*
* Copyright © 2020 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Authors: Matthias Clasen <mclasen@redhat.com>
*/
#ifndef __GSK_SHADER_PAINTABLE_H__
#define __GSK_SHADER_PAINTABLE_H__
#include <gdk/gdk.h>
#include <gsk/gsk.h>
G_BEGIN_DECLS
#define GSK_TYPE_SHADER_PAINTABLE (gsk_shader_paintable_get_type ())
GDK_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (GskShaderPaintable, gsk_shader_paintable, GSK, SHADER_PAINTABLE, GObject)
GDK_AVAILABLE_IN_ALL
GdkPaintable * gsk_shader_paintable_new (GskGLShader *shader,
GBytes *data);
GDK_AVAILABLE_IN_ALL
GskGLShader * gsk_shader_paintable_get_shader (GskShaderPaintable *self);
GDK_AVAILABLE_IN_ALL
void gsk_shader_paintable_set_shader (GskShaderPaintable *self,
GskGLShader *shader);
GDK_AVAILABLE_IN_ALL
GBytes * gsk_shader_paintable_get_uniform_data (GskShaderPaintable *self);
GDK_AVAILABLE_IN_ALL
void gsk_shader_paintable_set_uniform_data (GskShaderPaintable *self,
GBytes *data);
GDK_AVAILABLE_IN_ALL
void gsk_shader_paintable_update_time (GskShaderPaintable *self,
int time_idx,
gint64 frame_time);
G_END_DECLS
#endif /* __GSK_SHADER_PAINTABLE_H__ */

View File

@@ -98,7 +98,7 @@ gtk_fishbowl_measure (GtkWidget *widget,
GHashTableIter iter;
gpointer key, value;
GtkFishbowlChild *child;
gint child_min, child_nat;
int child_min, child_nat;
*minimum = 0;
*natural = 0;

View File

@@ -305,7 +305,7 @@ create_gear (GLfloat inner_radius,
/* Create the 7 points (only x,y coords) used to draw a tooth */
struct point p[7];
/* Calculate needed sin/cos for varius angles */
/* Calculate needed sin/cos for various angles */
sincos(i * 2.0 * G_PI / teeth + da * 0, &s[0], &c[0]);
sincos(i * 2.0 * M_PI / teeth + da * 1, &s[1], &c[1]);
sincos(i * 2.0 * M_PI / teeth + da * 2, &s[2], &c[2]);
@@ -800,7 +800,7 @@ gtk_gears_realize (GtkWidget *widget)
priv->LightSourcePosition_location = glGetUniformLocation(program, "LightSourcePosition");
priv->MaterialColor_location = glGetUniformLocation(program, "MaterialColor");
/* Set the LightSourcePosition uniform which is constant throught the program */
/* Set the LightSourcePosition uniform which is constant throughout the program */
glUniform4fv(priv->LightSourcePosition_location, 1, priv->LightSourcePosition);
/* make the gears */

View File

@@ -0,0 +1,241 @@
#include "gtkshaderbin.h"
typedef struct {
GskGLShader *shader;
GtkStateFlags state;
GtkStateFlags state_mask;
gboolean compiled;
gboolean compiled_ok;
} ShaderInfo;
struct _GtkShaderBin
{
GtkWidget parent_instance;
GtkWidget *child;
ShaderInfo *active_shader;
GPtrArray *shaders;
guint tick_id;
float time;
gint64 first_frame_time;
};
struct _GtkShaderBinClass
{
GtkWidgetClass parent_class;
};
G_DEFINE_TYPE (GtkShaderBin, gtk_shader_bin, GTK_TYPE_WIDGET)
static void
shader_info_free (ShaderInfo *info)
{
g_object_unref (info->shader);
g_free (info);
}
static void
gtk_shader_bin_finalize (GObject *object)
{
GtkShaderBin *self = GTK_SHADER_BIN (object);
g_ptr_array_free (self->shaders, TRUE);
G_OBJECT_CLASS (gtk_shader_bin_parent_class)->finalize (object);
}
static void
gtk_shader_bin_dispose (GObject *object)
{
GtkShaderBin *self = GTK_SHADER_BIN (object);
g_clear_pointer (&self->child, gtk_widget_unparent);
G_OBJECT_CLASS (gtk_shader_bin_parent_class)->dispose (object);
}
static gboolean
gtk_shader_bin_tick (GtkWidget *widget,
GdkFrameClock *frame_clock,
gpointer unused)
{
GtkShaderBin *self = GTK_SHADER_BIN (widget);
gint64 frame_time;
frame_time = gdk_frame_clock_get_frame_time (frame_clock);
if (self->first_frame_time == 0)
self->first_frame_time = frame_time;
self->time = (frame_time - self->first_frame_time) / (float)G_USEC_PER_SEC;
gtk_widget_queue_draw (widget);
return G_SOURCE_CONTINUE;
}
static void
gtk_shader_bin_init (GtkShaderBin *self)
{
self->shaders = g_ptr_array_new_with_free_func ((GDestroyNotify)shader_info_free);
}
void
gtk_shader_bin_update_active_shader (GtkShaderBin *self)
{
GtkStateFlags new_state = gtk_widget_get_state_flags (GTK_WIDGET (self));
ShaderInfo *new_shader = NULL;
for (int i = 0; i < self->shaders->len; i++)
{
ShaderInfo *info = g_ptr_array_index (self->shaders, i);
if ((info->state_mask & new_state) == info->state)
{
new_shader = info;
break;
}
}
if (self->active_shader == new_shader)
return;
self->active_shader = new_shader;
self->first_frame_time = 0;
if (self->active_shader)
{
if (self->tick_id == 0)
self->tick_id = gtk_widget_add_tick_callback (GTK_WIDGET (self),
gtk_shader_bin_tick,
NULL, NULL);
}
else
{
if (self->tick_id != 0)
{
gtk_widget_remove_tick_callback (GTK_WIDGET (self), self->tick_id);
self->tick_id = 0;
}
}
gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
gtk_shader_bin_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state_flags)
{
GtkShaderBin *self = GTK_SHADER_BIN (widget);
gtk_shader_bin_update_active_shader (self);
}
void
gtk_shader_bin_add_shader (GtkShaderBin *self,
GskGLShader *shader,
GtkStateFlags state,
GtkStateFlags state_mask)
{
ShaderInfo *info = g_new0 (ShaderInfo, 1);
info->shader = g_object_ref (shader);
info->state = state;
info->state_mask = state_mask;
g_ptr_array_add (self->shaders, info);
gtk_shader_bin_update_active_shader (self);
}
void
gtk_shader_bin_set_child (GtkShaderBin *self,
GtkWidget *child)
{
if (self->child == child)
return;
g_clear_pointer (&self->child, gtk_widget_unparent);
if (child)
{
self->child = child;
gtk_widget_set_parent (child, GTK_WIDGET (self));
}
}
GtkWidget *
gtk_shader_bin_get_child (GtkShaderBin *self)
{
return self->child;
}
static void
gtk_shader_bin_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkShaderBin *self = GTK_SHADER_BIN (widget);
int width, height;
width = gtk_widget_get_width (widget);
height = gtk_widget_get_height (widget);
if (self->active_shader)
{
if (!self->active_shader->compiled)
{
GtkNative *native = gtk_widget_get_native (widget);
GskRenderer *renderer = gtk_native_get_renderer (native);
GError *error = NULL;
self->active_shader->compiled = TRUE;
self->active_shader->compiled_ok =
gsk_gl_shader_try_compile_for (self->active_shader->shader,
renderer, &error);
if (!self->active_shader->compiled_ok)
{
g_warning ("GtkShaderBin failed to compile shader: %s", error->message);
g_error_free (error);
}
}
if (self->active_shader->compiled_ok)
{
gtk_snapshot_push_gl_shader (snapshot, self->active_shader->shader,
&GRAPHENE_RECT_INIT(0, 0, width, height),
gsk_gl_shader_format_args (self->active_shader->shader,
"u_time", self->time,
NULL));
gtk_widget_snapshot_child (widget, self->child, snapshot);
gtk_snapshot_gl_shader_pop_texture (snapshot);
gtk_snapshot_pop (snapshot);
return;
}
}
/* Non-shader fallback */
gtk_widget_snapshot_child (widget, self->child, snapshot);
}
static void
gtk_shader_bin_class_init (GtkShaderBinClass *class)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = gtk_shader_bin_finalize;
object_class->dispose = gtk_shader_bin_dispose;
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
widget_class->snapshot = gtk_shader_bin_snapshot;
widget_class->state_flags_changed = gtk_shader_bin_state_flags_changed;
}
GtkWidget *
gtk_shader_bin_new (void)
{
GtkShaderBin *self;
self = g_object_new (GTK_TYPE_SHADER_BIN, NULL);
return GTK_WIDGET (self);
}

View File

@@ -0,0 +1,22 @@
#ifndef __GTK_SHADER_BIN_H__
#define __GTK_SHADER_BIN_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define GTK_TYPE_SHADER_BIN (gtk_shader_bin_get_type ())
G_DECLARE_FINAL_TYPE (GtkShaderBin, gtk_shader_bin, GTK, SHADER_BIN, GtkWidget)
GtkWidget *gtk_shader_bin_new (void);
void gtk_shader_bin_add_shader (GtkShaderBin *self,
GskGLShader *shader,
GtkStateFlags state,
GtkStateFlags state_mask);
void gtk_shader_bin_set_child (GtkShaderBin *self,
GtkWidget *child);
GtkWidget *gtk_shader_bin_get_child (GtkShaderBin *self);
G_END_DECLS
#endif /* __GTK_SHADER_BIN_H__ */

View File

@@ -0,0 +1,353 @@
#include "gtkshaderstack.h"
struct _GtkShaderStack
{
GtkWidget parent_instance;
GskGLShader *shader;
GPtrArray *children;
int current;
int next;
gboolean backwards;
guint tick_id;
float time;
float duration;
gint64 start_time;
};
struct _GtkShaderStackClass
{
GtkWidgetClass parent_class;
};
enum {
PROP_DURATION = 1,
NUM_PROPERTIES
};
static GParamSpec *properties[NUM_PROPERTIES] = { NULL };
G_DEFINE_TYPE (GtkShaderStack, gtk_shader_stack, GTK_TYPE_WIDGET)
static void
gtk_shader_stack_finalize (GObject *object)
{
GtkShaderStack *self = GTK_SHADER_STACK (object);
g_object_unref (self->shader);
G_OBJECT_CLASS (gtk_shader_stack_parent_class)->finalize (object);
}
static void
update_child_visible (GtkShaderStack *self)
{
int i;
for (i = 0; i < self->children->len; i++)
{
GtkWidget *child = g_ptr_array_index (self->children, i);
gtk_widget_set_child_visible (child,
i == self->current || i == self->next);
}
}
static gboolean
transition_cb (GtkWidget *widget,
GdkFrameClock *clock,
gpointer unused)
{
GtkShaderStack *self = GTK_SHADER_STACK (widget);
gint64 frame_time;
frame_time = gdk_frame_clock_get_frame_time (clock);
if (self->start_time == 0)
self->start_time = frame_time;
self->time = (frame_time - self->start_time) / (float)G_USEC_PER_SEC;
gtk_widget_queue_draw (widget);
if (self->time >= self->duration)
{
self->current = self->next;
self->next = -1;
update_child_visible (self);
return G_SOURCE_REMOVE;
}
else
return G_SOURCE_CONTINUE;
}
static void
start_transition (GtkShaderStack *self)
{
self->start_time = 0;
self->tick_id = gtk_widget_add_tick_callback (GTK_WIDGET (self),
transition_cb,
NULL, NULL);
}
static void
stop_transition (GtkShaderStack *self)
{
if (self->tick_id != 0)
{
gtk_widget_remove_tick_callback (GTK_WIDGET (self), self->tick_id);
self->tick_id = 0;
}
if (self->next != -1)
self->current = self->next;
self->next = -1;
update_child_visible (self);
}
static void
gtk_shader_stack_dispose (GObject *object)
{
GtkShaderStack *self = GTK_SHADER_STACK (object);
stop_transition (self);
g_clear_pointer (&self->children, g_ptr_array_unref);
G_OBJECT_CLASS (gtk_shader_stack_parent_class)->dispose (object);
}
void
gtk_shader_stack_transition (GtkShaderStack *self,
gboolean forward)
{
stop_transition (self);
self->backwards = !forward;
if (self->backwards)
self->next = (self->current + self->children->len - 1) % self->children->len;
else
self->next = (self->current + 1) % self->children->len;
update_child_visible (self);
start_transition (self);
}
static void
gtk_shader_stack_init (GtkShaderStack *self)
{
self->children = g_ptr_array_new_with_free_func ((GDestroyNotify)gtk_widget_unparent);
self->current = -1;
self->next = -1;
self->backwards = FALSE;
self->duration = 1.0;
}
static void
gtk_shader_stack_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
GtkShaderStack *self = GTK_SHADER_STACK (widget);
int i;
*minimum = 0;
*natural = 0;
for (i = 0; i < self->children->len; i++)
{
GtkWidget *child = g_ptr_array_index (self->children, i);
int child_min, child_nat;
if (gtk_widget_get_visible (child))
{
gtk_widget_measure (child, orientation, for_size, &child_min, &child_nat, NULL, NULL);
*minimum = MAX (*minimum, child_min);
*natural = MAX (*natural, child_nat);
}
}
}
static void
gtk_shader_stack_size_allocate (GtkWidget *widget,
int width,
int height,
int baseline)
{
GtkShaderStack *self = GTK_SHADER_STACK (widget);
GtkAllocation child_allocation;
GtkWidget *child;
int i;
child_allocation.x = 0;
child_allocation.y = 0;
child_allocation.width = width;
child_allocation.height = height;
for (i = 0; i < self->children->len; i++)
{
child = g_ptr_array_index (self->children, i);
if (gtk_widget_get_visible (child))
gtk_widget_size_allocate (child, &child_allocation, -1);
}
}
static void
gtk_shader_stack_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkShaderStack *self = GTK_SHADER_STACK (widget);
int width, height;
GtkWidget *current, *next;
width = gtk_widget_get_width (widget);
height = gtk_widget_get_height (widget);
current = g_ptr_array_index (self->children, self->current);
if (self->next == -1)
{
gtk_widget_snapshot_child (widget, current, snapshot);
}
else
{
GtkNative *native = gtk_widget_get_native (widget);
GskRenderer *renderer = gtk_native_get_renderer (native);
float progress;
next = g_ptr_array_index (self->children, self->next);
progress = self->time / self->duration;
if (self->backwards)
{
GtkWidget *tmp = next;
next = current;
current = tmp;
progress = 1. - progress;
}
if (gsk_gl_shader_try_compile_for (self->shader,
renderer, NULL))
{
gtk_snapshot_push_gl_shader (snapshot,
self->shader,
&GRAPHENE_RECT_INIT(0, 0, width, height),
gsk_gl_shader_format_args (self->shader,
"progress", progress,
NULL));
gtk_widget_snapshot_child (widget, current, snapshot);
gtk_snapshot_gl_shader_pop_texture (snapshot); /* current child */
gtk_widget_snapshot_child (widget, next, snapshot);
gtk_snapshot_gl_shader_pop_texture (snapshot); /* next child */
gtk_snapshot_pop (snapshot);
}
else
{
/* Non-shader fallback */
gtk_widget_snapshot_child (widget, current, snapshot);
}
}
}
static void
gtk_shader_stack_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkShaderStack *self = GTK_SHADER_STACK (object);
switch (prop_id)
{
case PROP_DURATION:
g_value_set_float (value, self->duration);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_shader_stack_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkShaderStack *self = GTK_SHADER_STACK (object);
switch (prop_id)
{
case PROP_DURATION:
self->duration = g_value_get_float (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_shader_stack_class_init (GtkShaderStackClass *class)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = gtk_shader_stack_finalize;
object_class->dispose = gtk_shader_stack_dispose;
object_class->get_property = gtk_shader_stack_get_property;
object_class->set_property = gtk_shader_stack_set_property;
widget_class->snapshot = gtk_shader_stack_snapshot;
widget_class->measure = gtk_shader_stack_measure;
widget_class->size_allocate = gtk_shader_stack_size_allocate;
properties[PROP_DURATION] =
g_param_spec_float ("duration", "Duration", "Duration",
0.1, 3.0, 1.0,
G_PARAM_READWRITE);
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
}
GtkWidget *
gtk_shader_stack_new (void)
{
return g_object_new (GTK_TYPE_SHADER_STACK, NULL);
}
void
gtk_shader_stack_set_shader (GtkShaderStack *self,
GskGLShader *shader)
{
g_set_object (&self->shader, shader);
}
void
gtk_shader_stack_add_child (GtkShaderStack *self,
GtkWidget *child)
{
g_ptr_array_add (self->children, child);
gtk_widget_set_parent (child, GTK_WIDGET (self));
gtk_widget_queue_resize (GTK_WIDGET (self));
if (self->current == -1)
self->current = 0;
else
gtk_widget_set_child_visible (child, FALSE);
}

View File

@@ -0,0 +1,21 @@
#ifndef __GTK_SHADER_STACK_H__
#define __GTK_SHADER_STACK_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define GTK_TYPE_SHADER_STACK (gtk_shader_stack_get_type ())
G_DECLARE_FINAL_TYPE (GtkShaderStack, gtk_shader_stack, GTK, SHADER_STACK, GtkWidget)
GtkWidget * gtk_shader_stack_new (void);
void gtk_shader_stack_set_shader (GtkShaderStack *self,
GskGLShader *shader);
void gtk_shader_stack_add_child (GtkShaderStack *self,
GtkWidget *child);
void gtk_shader_stack_transition (GtkShaderStack *self,
gboolean forward);
G_END_DECLS
#endif /* __GTK_SHADER_STACK_H__ */

View File

@@ -0,0 +1,526 @@
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <epoxy/gl.h>
#include "gtkshadertoy.h"
const char *default_image_shader =
"void mainImage(out vec4 fragColor, in vec2 fragCoord) {\n"
" // Normalized pixel coordinates (from 0 to 1)\n"
" vec2 uv = fragCoord/iResolution.xy;\n"
"\n"
" // Time varying pixel color\n"
" vec3 col = 0.5 + 0.5*cos(iTime+uv.xyx+vec3(0,2,4));\n"
"\n"
" if (distance(iMouse.xy, fragCoord.xy) <= 10.0) {\n"
" col = vec3(0.0);\n"
" }\n"
"\n"
" // Output to screen\n"
" fragColor = vec4(col,1.0);\n"
"}\n";
const char *shadertoy_vertex_shader =
"#version 150 core\n"
"\n"
"uniform vec3 iResolution;\n"
"\n"
"in vec2 position;\n"
"out vec2 fragCoord;\n"
"\n"
"void main() {\n"
" gl_Position = vec4(position, 0.0, 1.0);\n"
"\n"
" // Convert from OpenGL coordinate system (with origin in center\n"
" // of screen) to Shadertoy/texture coordinate system (with origin\n"
" // in lower left corner)\n"
" fragCoord = (gl_Position.xy + vec2(1.0)) / vec2(2.0) * iResolution.xy;\n"
"}\n";
const char *fragment_prefix =
"#version 150 core\n"
"\n"
"uniform vec3 iResolution; // viewport resolution (in pixels)\n"
"uniform float iTime; // shader playback time (in seconds)\n"
"uniform float iTimeDelta; // render time (in seconds)\n"
"uniform int iFrame; // shader playback frame\n"
"uniform float iChannelTime[4]; // channel playback time (in seconds)\n"
"uniform vec3 iChannelResolution[4]; // channel resolution (in pixels)\n"
"uniform vec4 iMouse; // mouse pixel coords. xy: current (if MLB down), zw: click\n"
"uniform sampler2D iChannel0;\n"
"uniform sampler2D iChannel1;\n"
"uniform sampler2D iChannel2;\n"
"uniform sampler2D iChannel3;\n"
"uniform vec4 iDate; // (year, month, day, time in seconds)\n"
"uniform float iSampleRate; // sound sample rate (i.e., 44100)\n"
"\n"
"in vec2 fragCoord;\n"
"out vec4 vFragColor;\n";
// Fragment shader suffix
const char *fragment_suffix =
" void main() {\n"
" vec4 c;\n"
" mainImage(c, fragCoord);\n"
" vFragColor = c;\n"
" }\n";
typedef struct {
char *image_shader;
gboolean image_shader_dirty;
gboolean error_set;
/* Vertex buffers */
GLuint vao;
GLuint buffer;
/* Active program */
GLuint program;
/* Location of uniforms for program */
GLuint resolution_location;
GLuint time_location;
GLuint timedelta_location;
GLuint frame_location;
GLuint mouse_location;
/* Current uniform values */
float resolution[3];
float time;
float timedelta;
float mouse[4];
int frame;
/* Animation data */
gint64 first_frame_time;
gint64 first_frame;
guint tick;
} GtkShadertoyPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (GtkShadertoy, gtk_shadertoy, GTK_TYPE_GL_AREA)
static gboolean gtk_shadertoy_render (GtkGLArea *area,
GdkGLContext *context);
static void gtk_shadertoy_reshape (GtkGLArea *area,
int width,
int height);
static void gtk_shadertoy_realize (GtkWidget *widget);
static void gtk_shadertoy_unrealize (GtkWidget *widget);
static gboolean gtk_shadertoy_tick (GtkWidget *widget,
GdkFrameClock *frame_clock,
gpointer user_data);
GtkWidget *
gtk_shadertoy_new (void)
{
return g_object_new (gtk_shadertoy_get_type (), NULL);
}
static void
drag_begin_cb (GtkGestureDrag *drag,
double x,
double y,
gpointer user_data)
{
GtkShadertoy *shadertoy = GTK_SHADERTOY (user_data);
GtkShadertoyPrivate *priv = gtk_shadertoy_get_instance_private (shadertoy);
int height = gtk_widget_get_height (GTK_WIDGET (shadertoy));
int scale = gtk_widget_get_scale_factor (GTK_WIDGET (shadertoy));
priv->mouse[0] = x * scale;
priv->mouse[1] = (height - y) * scale;
priv->mouse[2] = priv->mouse[0];
priv->mouse[3] = priv->mouse[1];
}
static void
drag_update_cb (GtkGestureDrag *drag,
double dx,
double dy,
gpointer user_data)
{
GtkShadertoy *shadertoy = GTK_SHADERTOY (user_data);
GtkShadertoyPrivate *priv = gtk_shadertoy_get_instance_private (shadertoy);
int width = gtk_widget_get_width (GTK_WIDGET (shadertoy));
int height = gtk_widget_get_height (GTK_WIDGET (shadertoy));
int scale = gtk_widget_get_scale_factor (GTK_WIDGET (shadertoy));
double x, y;
gtk_gesture_drag_get_start_point (drag, &x, &y);
x += dx;
y += dy;
if (x >= 0 && x < width &&
y >= 0 && y < height)
{
priv->mouse[0] = x * scale;
priv->mouse[1] = (height - y) * scale;
}
}
static void
drag_end_cb (GtkGestureDrag *drag,
gdouble dx,
gdouble dy,
gpointer user_data)
{
GtkShadertoy *shadertoy = GTK_SHADERTOY (user_data);
GtkShadertoyPrivate *priv = gtk_shadertoy_get_instance_private (shadertoy);
priv->mouse[2] = -priv->mouse[2];
priv->mouse[3] = -priv->mouse[3];
}
static void
gtk_shadertoy_init (GtkShadertoy *shadertoy)
{
GtkShadertoyPrivate *priv = gtk_shadertoy_get_instance_private (shadertoy);
GtkGesture *drag;
priv->image_shader = g_strdup (default_image_shader);
priv->tick = gtk_widget_add_tick_callback (GTK_WIDGET (shadertoy), gtk_shadertoy_tick, shadertoy, NULL);
drag = gtk_gesture_drag_new ();
gtk_widget_add_controller (GTK_WIDGET (shadertoy), GTK_EVENT_CONTROLLER (drag));
g_signal_connect (drag, "drag-begin", (GCallback)drag_begin_cb, shadertoy);
g_signal_connect (drag, "drag-update", (GCallback)drag_update_cb, shadertoy);
g_signal_connect (drag, "drag-end", (GCallback)drag_end_cb, shadertoy);
}
static void
gtk_shadertoy_finalize (GObject *obj)
{
GtkShadertoy *shadertoy = GTK_SHADERTOY (obj);
GtkShadertoyPrivate *priv = gtk_shadertoy_get_instance_private (shadertoy);
gtk_widget_remove_tick_callback (GTK_WIDGET (shadertoy), priv->tick);
g_free (priv->image_shader);
G_OBJECT_CLASS (gtk_shadertoy_parent_class)->finalize (obj);
}
static void
gtk_shadertoy_class_init (GtkShadertoyClass *klass)
{
GTK_GL_AREA_CLASS (klass)->render = gtk_shadertoy_render;
GTK_GL_AREA_CLASS (klass)->resize = gtk_shadertoy_reshape;
GTK_WIDGET_CLASS (klass)->realize = gtk_shadertoy_realize;
GTK_WIDGET_CLASS (klass)->unrealize = gtk_shadertoy_unrealize;
G_OBJECT_CLASS (klass)->finalize = gtk_shadertoy_finalize;
}
/* new window size or exposure */
static void
gtk_shadertoy_reshape (GtkGLArea *area, int width, int height)
{
GtkShadertoyPrivate *priv = gtk_shadertoy_get_instance_private ((GtkShadertoy *) area);
priv->resolution[0] = width;
priv->resolution[1] = height;
priv->resolution[2] = 1.0; /* screen aspect ratio */
/* Set the viewport */
glViewport (0, 0, (GLint) width, (GLint) height);
}
static GLuint
create_shader (int type,
const char *src,
GError **error)
{
GLuint shader;
int status;
shader = glCreateShader (type);
glShaderSource (shader, 1, &src, NULL);
glCompileShader (shader);
glGetShaderiv (shader, GL_COMPILE_STATUS, &status);
if (status == GL_FALSE)
{
int log_len;
char *buffer;
glGetShaderiv (shader, GL_INFO_LOG_LENGTH, &log_len);
buffer = g_malloc (log_len + 1);
glGetShaderInfoLog (shader, log_len, NULL, buffer);
g_set_error (error, GDK_GL_ERROR, GDK_GL_ERROR_COMPILATION_FAILED,
"Compile failure in %s shader:\n%s",
type == GL_VERTEX_SHADER ? "vertex" : "fragment",
buffer);
g_free (buffer);
glDeleteShader (shader);
return 0;
}
return shader;
}
static gboolean
init_shaders (GtkShadertoy *shadertoy,
const char *vertex_source,
const char *fragment_source,
GError **error)
{
GtkShadertoyPrivate *priv = gtk_shadertoy_get_instance_private (shadertoy);
GLuint vertex, fragment;
GLuint program = 0;
int status;
gboolean res = TRUE;
vertex = create_shader (GL_VERTEX_SHADER, vertex_source, error);
if (vertex == 0)
return FALSE;
fragment = create_shader (GL_FRAGMENT_SHADER, fragment_source, error);
if (fragment == 0)
{
glDeleteShader (vertex);
return FALSE;
}
program = glCreateProgram ();
glAttachShader (program, vertex);
glAttachShader (program, fragment);
glLinkProgram (program);
glGetProgramiv (program, GL_LINK_STATUS, &status);
if (status == GL_FALSE)
{
int log_len;
char *buffer;
glGetProgramiv (program, GL_INFO_LOG_LENGTH, &log_len);
buffer = g_malloc (log_len + 1);
glGetProgramInfoLog (program, log_len, NULL, buffer);
g_set_error (error, GDK_GL_ERROR, GDK_GL_ERROR_LINK_FAILED,
"Linking failure:\n%s", buffer);
res = FALSE;
g_free (buffer);
glDeleteProgram (program);
goto out;
}
if (priv->program != 0)
glDeleteProgram (priv->program);
priv->program = program;
priv->resolution_location = glGetUniformLocation (program, "iResolution");
priv->time_location = glGetUniformLocation (program, "iTime");
priv->timedelta_location = glGetUniformLocation (program, "iTimeDelta");
priv->frame_location = glGetUniformLocation (program, "iFrame");
priv->mouse_location = glGetUniformLocation (program, "iMouse");
glDetachShader (program, vertex);
glDetachShader (program, fragment);
out:
/* These are now owned by the program and can be deleted */
glDeleteShader (vertex);
glDeleteShader (fragment);
return res;
}
static void
gtk_shadertoy_realize_shader (GtkShadertoy *shadertoy)
{
GtkShadertoyPrivate *priv = gtk_shadertoy_get_instance_private (shadertoy);
char *fragment_shader;
GError *error = NULL;
fragment_shader = g_strconcat (fragment_prefix, priv->image_shader, fragment_suffix, NULL);
if (!init_shaders (shadertoy, shadertoy_vertex_shader, fragment_shader, &error))
{
priv->error_set = TRUE;
gtk_gl_area_set_error (GTK_GL_AREA (shadertoy), error);
g_error_free (error);
}
g_free (fragment_shader);
/* Start new shader at time zero */
priv->first_frame_time = 0;
priv->first_frame = 0;
priv->image_shader_dirty = FALSE;
}
static gboolean
gtk_shadertoy_render (GtkGLArea *area,
GdkGLContext *context)
{
GtkShadertoy *shadertoy = GTK_SHADERTOY (area);
GtkShadertoyPrivate *priv = gtk_shadertoy_get_instance_private (shadertoy);
if (gtk_gl_area_get_error (area) != NULL)
return FALSE;
if (priv->image_shader_dirty)
gtk_shadertoy_realize_shader (shadertoy);
/* Clear the viewport */
glClearColor (0.0, 0.0, 0.0, 1.0);
glClear (GL_COLOR_BUFFER_BIT);
glUseProgram (priv->program);
/* Update uniforms */
if (priv->resolution_location != -1)
glUniform3fv (priv->resolution_location, 1, priv->resolution);
if (priv->time_location != -1)
glUniform1f (priv->time_location, priv->time);
if (priv->timedelta_location != -1)
glUniform1f (priv->timedelta_location, priv->timedelta);
if (priv->frame_location != -1)
glUniform1i (priv->frame_location, priv->frame);
if (priv->mouse_location != -1)
glUniform4fv (priv->mouse_location, 1, priv->mouse);
/* Use the vertices in our buffer */
glBindBuffer (GL_ARRAY_BUFFER, priv->buffer);
glEnableVertexAttribArray (0);
glVertexAttribPointer (0, 4, GL_FLOAT, GL_FALSE, 0, 0);
glDrawArrays (GL_TRIANGLES, 0, 6);
/* We finished using the buffers and program */
glDisableVertexAttribArray (0);
glBindBuffer (GL_ARRAY_BUFFER, 0);
glUseProgram (0);
/* Flush the contents of the pipeline */
glFlush ();
return TRUE;
}
const char *
gtk_shadertoy_get_image_shader (GtkShadertoy *shadertoy)
{
GtkShadertoyPrivate *priv = gtk_shadertoy_get_instance_private (shadertoy);
return priv->image_shader;
}
void
gtk_shadertoy_set_image_shader (GtkShadertoy *shadertoy,
const char *shader)
{
GtkShadertoyPrivate *priv = gtk_shadertoy_get_instance_private (shadertoy);
g_free (priv->image_shader);
priv->image_shader = g_strdup (shader);
/* Don't override error we didn't set it ourselves */
if (priv->error_set)
{
gtk_gl_area_set_error (GTK_GL_AREA (shadertoy), NULL);
priv->error_set = FALSE;
}
priv->image_shader_dirty = TRUE;
}
static void
gtk_shadertoy_realize (GtkWidget *widget)
{
GtkGLArea *glarea = GTK_GL_AREA (widget);
GtkShadertoy *shadertoy = GTK_SHADERTOY (widget);
GtkShadertoyPrivate *priv = gtk_shadertoy_get_instance_private (shadertoy);
/* Draw two triangles across whole screen */
const GLfloat vertex_data[] = {
-1.0f, -1.0f, 0.f, 1.f,
-1.0f, 1.0f, 0.f, 1.f,
1.0f, 1.0f, 0.f, 1.f,
-1.0f, -1.0f, 0.f, 1.f,
1.0f, 1.0f, 0.f, 1.f,
1.0f, -1.0f, 0.f, 1.f,
};
GTK_WIDGET_CLASS (gtk_shadertoy_parent_class)->realize (widget);
gtk_gl_area_make_current (glarea);
if (gtk_gl_area_get_error (glarea) != NULL)
return;
glGenVertexArrays (1, &priv->vao);
glBindVertexArray (priv->vao);
glGenBuffers (1, &priv->buffer);
glBindBuffer (GL_ARRAY_BUFFER, priv->buffer);
glBufferData (GL_ARRAY_BUFFER, sizeof (vertex_data), vertex_data, GL_STATIC_DRAW);
glBindBuffer (GL_ARRAY_BUFFER, 0);
gtk_shadertoy_realize_shader (shadertoy);
}
static void
gtk_shadertoy_unrealize (GtkWidget *widget)
{
GtkGLArea *glarea = GTK_GL_AREA (widget);
GtkShadertoyPrivate *priv = gtk_shadertoy_get_instance_private ((GtkShadertoy *) widget);
gtk_gl_area_make_current (glarea);
if (gtk_gl_area_get_error (glarea) == NULL)
{
if (priv->buffer != 0)
glDeleteBuffers (1, &priv->buffer);
if (priv->vao != 0)
glDeleteVertexArrays (1, &priv->vao);
if (priv->program != 0)
glDeleteProgram (priv->program);
}
GTK_WIDGET_CLASS (gtk_shadertoy_parent_class)->unrealize (widget);
}
static gboolean
gtk_shadertoy_tick (GtkWidget *widget,
GdkFrameClock *frame_clock,
gpointer user_data)
{
GtkShadertoy *shadertoy = GTK_SHADERTOY (widget);
GtkShadertoyPrivate *priv = gtk_shadertoy_get_instance_private (shadertoy);
gint64 frame_time;
gint64 frame;
float previous_time;
frame = gdk_frame_clock_get_frame_counter (frame_clock);
frame_time = gdk_frame_clock_get_frame_time (frame_clock);
if (priv->first_frame_time == 0)
{
priv->first_frame_time = frame_time;
priv->first_frame = frame;
previous_time = 0;
}
else
previous_time = priv->time;
priv->time = (frame_time - priv->first_frame_time) / 1000000.0f;
priv->frame = frame - priv->first_frame;
priv->timedelta = priv->time - previous_time;
gtk_widget_queue_draw (widget);
return G_SOURCE_CONTINUE;
}

View File

@@ -0,0 +1,34 @@
#ifndef __GTK_SHADERTOY_H__
#define __GTK_SHADERTOY_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define GTK_TYPE_SHADERTOY (gtk_shadertoy_get_type ())
#define GTK_SHADERTOY(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
GTK_TYPE_SHADERTOY, \
GtkShadertoy))
#define GTK_IS_SHADERTOY(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
GTK_TYPE_SHADERTOY))
typedef struct _GtkShadertoy GtkShadertoy;
typedef struct _GtkShadertoyClass GtkShadertoyClass;
struct _GtkShadertoy {
GtkGLArea parent;
};
struct _GtkShadertoyClass {
GtkGLAreaClass parent_class;
};
GType gtk_shadertoy_get_type (void) G_GNUC_CONST;
GtkWidget *gtk_shadertoy_new (void);
const char *gtk_shadertoy_get_image_shader (GtkShadertoy *shadertoy);
void gtk_shadertoy_set_image_shader (GtkShadertoy *shadertoy,
const char *shader);
G_END_DECLS
#endif /* __GTK_SHADERTOY_H__ */

View File

@@ -1,4 +1,5 @@
/* Header Bar
* #Keywords: GtkWindowHandle, GtkWindowControls
*
* GtkHeaderBar is a container that is suitable for implementing
* window titlebars. One of its features is that it can position
@@ -48,6 +49,7 @@ do_headerbar (GtkWidget *do_widget)
gtk_box_append (GTK_BOX (box), button);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), box);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), gtk_switch_new ());
gtk_window_set_titlebar (GTK_WINDOW (window), header);

Some files were not shown because too many files have changed in this diff Show More